From 990bc3f015a4f8fce2eb918375defcd44980a845 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 8 Jun 2012 09:33:13 +0200 Subject: Used synchronise script to update files --- mesalib/.gitignore | 42 + mesalib/bin/.gitignore | 7 + mesalib/bin/confdiff.sh | 96 +- mesalib/bin/installmesa | 148 +- mesalib/configs/.gitignore | 2 + mesalib/configure.ac | 67 +- mesalib/docs/MESA_agp_offset.spec | 190 +- mesalib/docs/MESA_pack_invert.spec | 276 +- mesalib/docs/MESA_release_buffers.spec | 170 +- mesalib/docs/MESA_resize_buffers.spec | 162 +- mesalib/docs/MESA_swap_control.spec | 258 +- mesalib/docs/MESA_texture_array.spec | 1608 +++--- mesalib/docs/MESA_texture_signed_rgba.spec | 428 +- mesalib/docs/MESA_window_pos.spec | 252 +- mesalib/docs/MESA_ycbcr_texture.spec | 408 +- mesalib/docs/VERSIONS | 3028 +++++------ mesalib/docs/enums.txt | 114 +- mesalib/docs/install.html | 121 +- mesalib/docs/mesa.css | 66 +- mesalib/docs/relnotes-7.10.html | 5590 ++++++++++---------- mesalib/docs/relnotes-7.8.2.html | 292 +- mesalib/docs/relnotes-7.8.3.html | 178 +- mesalib/docs/relnotes-7.9.1.html | 812 +-- mesalib/docs/relnotes-7.9.html | 274 +- mesalib/docs/shading.html | 536 +- mesalib/include/GL/gl_mangle.h | 4622 ++++++++-------- mesalib/scons/dxsdk.py | 146 +- mesalib/scons/fixes.py | 54 +- mesalib/scons/x11.py | 104 +- mesalib/src/gallium/Android.common.mk | 32 + mesalib/src/gallium/Android.mk | 72 + mesalib/src/gallium/Makefile | 12 + mesalib/src/gallium/Makefile.template | 73 + mesalib/src/gallium/README.portability | 109 + mesalib/src/gallium/SConscript | 179 + mesalib/src/gallium/auxiliary/Android.mk | 55 + mesalib/src/gallium/auxiliary/Makefile | 44 + mesalib/src/gallium/auxiliary/Makefile.sources | 197 + mesalib/src/gallium/auxiliary/SConscript | 72 + mesalib/src/gallium/auxiliary/util/.gitignore | 3 + mesalib/src/gallium/auxiliary/util/dbghelp.h | 2530 ++++----- mesalib/src/gallium/auxiliary/util/u_bitmask.c | 656 +-- mesalib/src/gallium/auxiliary/util/u_bitmask.h | 234 +- mesalib/src/gallium/auxiliary/util/u_box.h | 160 +- mesalib/src/gallium/auxiliary/util/u_cache.c | 702 +-- mesalib/src/gallium/auxiliary/util/u_cache.h | 182 +- mesalib/src/gallium/auxiliary/util/u_cpu_detect.c | 686 +-- mesalib/src/gallium/auxiliary/util/u_cpu_detect.h | 138 +- mesalib/src/gallium/auxiliary/util/u_debug_stack.h | 130 +- .../src/gallium/auxiliary/util/u_debug_symbol.c | 486 +- .../src/gallium/auxiliary/util/u_debug_symbol.h | 116 +- mesalib/src/gallium/auxiliary/util/u_dirty_flags.h | 64 +- .../src/gallium/auxiliary/util/u_dirty_surfaces.h | 238 +- mesalib/src/gallium/auxiliary/util/u_dl.c | 188 +- mesalib/src/gallium/auxiliary/util/u_dl.h | 166 +- .../src/gallium/auxiliary/util/u_dump_defines.c | 672 +-- mesalib/src/gallium/auxiliary/util/u_dynarray.h | 228 +- mesalib/src/gallium/auxiliary/util/u_fifo.h | 188 +- mesalib/src/gallium/auxiliary/util/u_format_latc.h | 216 +- .../src/gallium/auxiliary/util/u_format_other.c | 944 ++-- .../src/gallium/auxiliary/util/u_format_other.h | 268 +- .../src/gallium/auxiliary/util/u_format_rgb9e5.h | 328 +- mesalib/src/gallium/auxiliary/util/u_format_rgtc.h | 228 +- mesalib/src/gallium/auxiliary/util/u_format_s3tc.h | 436 +- mesalib/src/gallium/auxiliary/util/u_format_srgb.h | 212 +- .../src/gallium/auxiliary/util/u_format_srgb.py | 200 +- .../src/gallium/auxiliary/util/u_format_tests.h | 142 +- mesalib/src/gallium/auxiliary/util/u_framebuffer.c | 296 +- mesalib/src/gallium/auxiliary/util/u_framebuffer.h | 108 +- mesalib/src/gallium/auxiliary/util/u_half.h | 180 +- mesalib/src/gallium/auxiliary/util/u_half.py | 358 +- .../src/gallium/auxiliary/util/u_handle_table.c | 596 +-- .../src/gallium/auxiliary/util/u_handle_table.h | 232 +- mesalib/src/gallium/auxiliary/util/u_hash.c | 242 +- mesalib/src/gallium/auxiliary/util/u_hash.h | 110 +- mesalib/src/gallium/auxiliary/util/u_hash_table.c | 586 +- mesalib/src/gallium/auxiliary/util/u_hash_table.h | 192 +- mesalib/src/gallium/auxiliary/util/u_init.h | 104 +- mesalib/src/gallium/auxiliary/util/u_keymap.c | 636 +-- mesalib/src/gallium/auxiliary/util/u_keymap.h | 136 +- mesalib/src/gallium/auxiliary/util/u_linear.c | 202 +- mesalib/src/gallium/auxiliary/util/u_linear.h | 212 +- mesalib/src/gallium/auxiliary/util/u_linkage.c | 298 +- mesalib/src/gallium/auxiliary/util/u_math.c | 146 +- mesalib/src/gallium/auxiliary/util/u_memory.h | 200 +- mesalib/src/gallium/auxiliary/util/u_mm.c | 592 +-- mesalib/src/gallium/auxiliary/util/u_mm.h | 182 +- mesalib/src/gallium/auxiliary/util/u_pointer.h | 260 +- mesalib/src/gallium/auxiliary/util/u_pstipple.h | 112 +- mesalib/src/gallium/auxiliary/util/u_rect.h | 206 +- mesalib/src/gallium/auxiliary/util/u_resource.c | 176 +- mesalib/src/gallium/auxiliary/util/u_ringbuffer.c | 320 +- mesalib/src/gallium/auxiliary/util/u_ringbuffer.h | 58 +- mesalib/src/gallium/auxiliary/util/u_sampler.h | 114 +- mesalib/src/gallium/auxiliary/util/u_simple_list.h | 398 +- mesalib/src/gallium/auxiliary/util/u_split_prim.h | 228 +- mesalib/src/gallium/auxiliary/util/u_sse.h | 510 +- mesalib/src/gallium/auxiliary/util/u_surfaces.c | 248 +- mesalib/src/gallium/auxiliary/util/u_surfaces.h | 202 +- mesalib/src/gallium/auxiliary/util/u_texture.c | 206 +- mesalib/src/gallium/auxiliary/util/u_texture.h | 108 +- mesalib/src/gallium/auxiliary/util/u_time.h | 300 +- mesalib/src/glsl/.gitignore | 8 + mesalib/src/glsl/glcpp/.gitignore | 9 + mesalib/src/glsl/glcpp/README | 62 +- mesalib/src/glsl/glcpp/glcpp-parse.y | 3 + mesalib/src/glsl/glsl_parser_extras.cpp | 1 + mesalib/src/glsl/glsl_parser_extras.h | 2 + mesalib/src/glsl/ir.cpp | 8 + mesalib/src/glsl/ir.h | 26 +- mesalib/src/glsl/ir_constant_expression.cpp | 47 + mesalib/src/glsl/ir_validate.cpp | 16 + mesalib/src/glsl/loop_analysis.h | 17 + mesalib/src/glsl/opt_noop_swizzle.cpp | 160 +- mesalib/src/glsl/opt_redundant_jumps.cpp | 240 +- mesalib/src/glsl/standalone_scaffolding.cpp | 1 + mesalib/src/glsl/strtod.h | 86 +- mesalib/src/glu/.gitignore | 1 + mesalib/src/glu/sgi/.gitignore | 1 + mesalib/src/mapi/glapi/.gitignore | 20 + .../src/mapi/glapi/gen/ARB_ES2_compatibility.xml | 116 +- .../src/mapi/glapi/gen/ARB_draw_buffers_blend.xml | 76 +- mesalib/src/mapi/glapi/gen/ARB_draw_instanced.xml | 98 +- .../src/mapi/glapi/gen/ARB_instanced_arrays.xml | 42 +- .../mapi/glapi/gen/ARB_texture_buffer_object.xml | 44 +- .../mapi/glapi/gen/EXT_separate_shader_objects.xml | 52 +- mesalib/src/mapi/glapi/gen/EXT_texture_integer.xml | 196 +- .../src/mapi/glapi/gen/EXT_transform_feedback.xml | 236 +- .../src/mapi/glapi/gen/NV_primitive_restart.xml | 46 +- mesalib/src/mapi/glapi/gen/NV_texture_barrier.xml | 26 +- mesalib/src/mapi/glapi/gen/glX_API.xml | 468 +- mesalib/src/mapi/glapi/gen/gl_SPARC_asm.py | 546 +- mesalib/src/mapi/glapi/gen/gl_procs.py | 430 +- .../src/mapi/glapi/gen/next_available_offset.sh | 78 +- mesalib/src/mapi/glapi/glapi.c | 130 +- mesalib/src/mapi/glapi/glapi_dispatch.c | 184 +- mesalib/src/mapi/glapi/glapi_getproc.c | 1332 ++--- mesalib/src/mapi/mapi/entry.c | 196 +- mesalib/src/mapi/mapi/entry.h | 96 +- mesalib/src/mapi/mapi/mapi.c | 382 +- mesalib/src/mapi/mapi/stub.c | 414 +- mesalib/src/mapi/mapi/stub.h | 114 +- mesalib/src/mapi/mapi/table.c | 112 +- mesalib/src/mapi/mapi/table.h | 144 +- mesalib/src/mesa/.gitignore | 5 + mesalib/src/mesa/drivers/common/driverfuncs.c | 20 +- mesalib/src/mesa/drivers/common/driverfuncs.h | 74 +- mesalib/src/mesa/drivers/common/meta.c | 80 +- mesalib/src/mesa/drivers/common/meta.h | 27 +- mesalib/src/mesa/drivers/dri/.gitignore | 1 + .../src/mesa/drivers/dri/common/xmlpool/.gitignore | 5 + .../src/mesa/drivers/dri/common/xmlpool/Makefile | 192 +- .../mesa/drivers/dri/common/xmlpool/gen_xmlpool.py | 382 +- mesalib/src/mesa/drivers/dri/swrast/.gitignore | 1 + mesalib/src/mesa/gl.pc.in | 26 +- mesalib/src/mesa/main/.gitignore | 13 + mesalib/src/mesa/main/api_loopback.c | 3450 ++++++------ mesalib/src/mesa/main/atifragshader.c | 1592 +++--- mesalib/src/mesa/main/blend.h | 212 +- mesalib/src/mesa/main/bufferobj.c | 19 + mesalib/src/mesa/main/clear.h | 128 +- mesalib/src/mesa/main/clip.c | 232 +- mesalib/src/mesa/main/clip.h | 94 +- mesalib/src/mesa/main/condrender.h | 90 +- mesalib/src/mesa/main/dd.h | 192 +- mesalib/src/mesa/main/depth.h | 136 +- mesalib/src/mesa/main/drawtex.h | 122 +- mesalib/src/mesa/main/enable.h | 142 +- mesalib/src/mesa/main/extensions.c | 1 + mesalib/src/mesa/main/ffvertex_prog.h | 80 +- mesalib/src/mesa/main/fog.h | 138 +- mesalib/src/mesa/main/formats.c | 8 +- mesalib/src/mesa/main/hint.h | 118 +- mesalib/src/mesa/main/lines.h | 98 +- mesalib/src/mesa/main/matrix.h | 226 +- mesalib/src/mesa/main/mipmap.c | 8 +- mesalib/src/mesa/main/mtypes.h | 1 + mesalib/src/mesa/main/multisample.c | 124 +- mesalib/src/mesa/main/multisample.h | 82 +- mesalib/src/mesa/main/pixelstore.h | 104 +- mesalib/src/mesa/main/points.c | 544 +- mesalib/src/mesa/main/points.h | 118 +- mesalib/src/mesa/main/rastpos.c | 1132 ++-- mesalib/src/mesa/main/remap.c | 452 +- mesalib/src/mesa/main/scissor.c | 200 +- mesalib/src/mesa/main/scissor.h | 94 +- mesalib/src/mesa/main/stencil.h | 162 +- mesalib/src/mesa/main/syncobj.c | 852 +-- mesalib/src/mesa/main/texformat.h | 78 +- mesalib/src/mesa/main/texgen.c | 802 +-- mesalib/src/mesa/main/teximage.c | 151 +- mesalib/src/mesa/main/texobj.c | 28 +- mesalib/src/mesa/main/texstore.c | 259 +- mesalib/src/mesa/main/texstore.h | 113 +- mesalib/src/mesa/main/texturebarrier.c | 108 +- mesalib/src/mesa/main/texturebarrier.h | 88 +- mesalib/src/mesa/main/transformfeedback.c | 21 +- mesalib/src/mesa/main/version.c | 1 + mesalib/src/mesa/main/viewport.c | 370 +- mesalib/src/mesa/main/viewport.h | 116 +- mesalib/src/mesa/math/m_debug_clip.c | 818 +-- mesalib/src/mesa/math/m_debug_norm.c | 766 +-- mesalib/src/mesa/math/m_debug_xform.c | 678 +-- mesalib/src/mesa/math/m_matrix.c | 3282 ++++++------ mesalib/src/mesa/math/m_vector.c | 368 +- mesalib/src/mesa/program/.gitignore | 4 + mesalib/src/mesa/program/arbprogparse.h | 90 +- mesalib/src/mesa/program/ir_to_mesa.cpp | 5 + mesalib/src/mesa/program/nvfragparse.h | 94 +- mesalib/src/mesa/program/nvvertparse.h | 98 +- mesalib/src/mesa/program/prog_cache.c | 502 +- mesalib/src/mesa/program/prog_cache.h | 136 +- mesalib/src/mesa/program/sampler.h | 58 +- mesalib/src/mesa/program/symbol_table.h | 124 +- mesalib/src/mesa/state_tracker/Makefile | 2 +- mesalib/src/mesa/state_tracker/st_atom.h | 146 +- mesalib/src/mesa/state_tracker/st_atom_constbuf.h | 82 +- mesalib/src/mesa/state_tracker/st_atom_msaa.c | 166 +- mesalib/src/mesa/state_tracker/st_atom_shader.h | 82 +- mesalib/src/mesa/state_tracker/st_atom_viewport.c | 188 +- mesalib/src/mesa/state_tracker/st_cache.h | 138 +- mesalib/src/mesa/state_tracker/st_cb_bitmap.h | 192 +- mesalib/src/mesa/state_tracker/st_cb_blit.h | 118 +- .../src/mesa/state_tracker/st_cb_bufferobjects.h | 136 +- mesalib/src/mesa/state_tracker/st_cb_condrender.h | 74 +- mesalib/src/mesa/state_tracker/st_cb_drawpixels.h | 140 +- mesalib/src/mesa/state_tracker/st_cb_drawtex.h | 82 +- mesalib/src/mesa/state_tracker/st_cb_eglimage.h | 102 +- mesalib/src/mesa/state_tracker/st_cb_feedback.c | 618 +-- mesalib/src/mesa/state_tracker/st_cb_feedback.h | 104 +- mesalib/src/mesa/state_tracker/st_cb_flush.h | 102 +- mesalib/src/mesa/state_tracker/st_cb_program.h | 76 +- mesalib/src/mesa/state_tracker/st_cb_queryobj.h | 140 +- mesalib/src/mesa/state_tracker/st_cb_rasterpos.h | 100 +- mesalib/src/mesa/state_tracker/st_cb_strings.c | 146 +- mesalib/src/mesa/state_tracker/st_cb_strings.h | 80 +- mesalib/src/mesa/state_tracker/st_cb_syncobj.c | 244 +- mesalib/src/mesa/state_tracker/st_cb_texture.c | 135 +- .../src/mesa/state_tracker/st_cb_texturebarrier.c | 120 +- .../src/mesa/state_tracker/st_cb_texturebarrier.h | 74 +- mesalib/src/mesa/state_tracker/st_cb_viewport.h | 72 +- mesalib/src/mesa/state_tracker/st_debug.h | 144 +- mesalib/src/mesa/state_tracker/st_extensions.c | 4 + mesalib/src/mesa/state_tracker/st_extensions.h | 80 +- mesalib/src/mesa/state_tracker/st_gen_mipmap.h | 104 +- mesalib/src/mesa/state_tracker/st_gl_api.h | 14 +- mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 6 + mesalib/src/mesa/state_tracker/st_manager.h | 104 +- mesalib/src/mesa/swrast/NOTES | 108 +- mesalib/src/mesa/swrast/s_aaline.h | 76 +- mesalib/src/mesa/swrast/s_aatriangle.h | 76 +- mesalib/src/mesa/swrast/s_alpha.c | 320 +- mesalib/src/mesa/swrast/s_alpha.h | 78 +- mesalib/src/mesa/swrast/s_atifragshader.c | 1208 ++--- mesalib/src/mesa/swrast/s_atifragshader.h | 76 +- mesalib/src/mesa/swrast/s_blend.h | 90 +- mesalib/src/mesa/swrast/s_feedback.c | 276 +- mesalib/src/mesa/swrast/s_feedback.h | 100 +- mesalib/src/mesa/swrast/s_fog.h | 84 +- mesalib/src/mesa/swrast/s_lines.h | 82 +- mesalib/src/mesa/swrast/s_logic.h | 80 +- mesalib/src/mesa/swrast/s_masking.h | 82 +- mesalib/src/mesa/swrast/s_points.h | 78 +- mesalib/src/mesa/swrast/s_texcombine.h | 74 +- mesalib/src/mesa/swrast/s_triangle.h | 100 +- mesalib/src/mesa/swrast_setup/NOTES | 130 +- mesalib/src/mesa/swrast_setup/ss_triangle.c | 530 +- mesalib/src/mesa/swrast_setup/ss_triangle.h | 76 +- mesalib/src/mesa/swrast_setup/ss_tritmp.h | 496 +- mesalib/src/mesa/swrast_setup/ss_vb.h | 74 +- mesalib/src/mesa/swrast_setup/swrast_setup.h | 122 +- mesalib/src/mesa/tnl/t_pipeline.h | 146 +- mesalib/src/mesa/tnl/t_vb_fog.c | 552 +- mesalib/src/mesa/tnl/t_vb_normals.c | 374 +- mesalib/src/mesa/tnl/t_vb_points.c | 228 +- mesalib/src/mesa/tnl/t_vb_render.c | 696 +-- mesalib/src/mesa/tnl/t_vb_rendertmp.h | 972 ++-- mesalib/src/mesa/tnl/t_vb_texgen.c | 1218 ++--- mesalib/src/mesa/tnl/t_vb_texmat.c | 256 +- mesalib/src/mesa/tnl/t_vb_vertex.c | 566 +- mesalib/src/mesa/tnl/t_vertex.h | 368 +- mesalib/src/mesa/tnl/t_vp_build.c | 120 +- mesalib/src/mesa/tnl/t_vp_build.h | 84 +- mesalib/src/mesa/vbo/vbo_exec_eval.c | 526 +- mesalib/src/mesa/vbo/vbo_save_loopback.c | 392 +- mesalib/src/mesa/vbo/vbo_split.h | 144 +- mesalib/src/mesa/x86/3dnow.c | 182 +- mesalib/src/mesa/x86/3dnow.h | 72 +- mesalib/src/mesa/x86/3dnow_normal.S | 1704 +++--- mesalib/src/mesa/x86/3dnow_xform1.S | 874 +-- mesalib/src/mesa/x86/3dnow_xform2.S | 954 ++-- mesalib/src/mesa/x86/3dnow_xform3.S | 1122 ++-- mesalib/src/mesa/x86/3dnow_xform4.S | 1140 ++-- mesalib/src/mesa/x86/Makefile | 92 +- mesalib/src/mesa/x86/assyntax.h | 3494 ++++++------ mesalib/src/mesa/x86/clip_args.h | 118 +- mesalib/src/mesa/x86/common_x86.c | 672 +-- mesalib/src/mesa/x86/common_x86_asm.S | 440 +- mesalib/src/mesa/x86/common_x86_asm.h | 106 +- mesalib/src/mesa/x86/common_x86_features.h | 134 +- mesalib/src/mesa/x86/mmx.h | 118 +- mesalib/src/mesa/x86/mmx_blend.S | 804 +-- mesalib/src/mesa/x86/mmx_blendtmp.h | 228 +- mesalib/src/mesa/x86/norm_args.h | 114 +- mesalib/src/mesa/x86/read_rgba_span_x86.S | 1372 ++--- mesalib/src/mesa/x86/read_rgba_span_x86.h | 112 +- mesalib/src/mesa/x86/rtasm/x86sse.c | 2406 ++++----- mesalib/src/mesa/x86/rtasm/x86sse.h | 512 +- mesalib/src/mesa/x86/sse.c | 246 +- mesalib/src/mesa/x86/sse.h | 72 +- mesalib/src/mesa/x86/sse_normal.S | 522 +- mesalib/src/mesa/x86/sse_xform1.S | 892 ++-- mesalib/src/mesa/x86/sse_xform2.S | 932 ++-- mesalib/src/mesa/x86/sse_xform3.S | 1024 ++-- mesalib/src/mesa/x86/sse_xform4.S | 470 +- mesalib/src/mesa/x86/x86_cliptest.S | 814 +-- mesalib/src/mesa/x86/x86_xform.c | 252 +- mesalib/src/mesa/x86/x86_xform.h | 212 +- mesalib/src/mesa/x86/x86_xform2.S | 1148 ++-- mesalib/src/mesa/x86/x86_xform3.S | 1288 ++--- mesalib/src/mesa/x86/x86_xform4.S | 1354 ++--- mesalib/src/mesa/x86/xform_args.h | 102 +- 322 files changed, 54787 insertions(+), 54376 deletions(-) create mode 100644 mesalib/.gitignore create mode 100644 mesalib/bin/.gitignore create mode 100644 mesalib/configs/.gitignore create mode 100644 mesalib/src/gallium/Android.common.mk create mode 100644 mesalib/src/gallium/Android.mk create mode 100644 mesalib/src/gallium/Makefile create mode 100644 mesalib/src/gallium/Makefile.template create mode 100644 mesalib/src/gallium/README.portability create mode 100644 mesalib/src/gallium/SConscript create mode 100644 mesalib/src/gallium/auxiliary/Android.mk create mode 100644 mesalib/src/gallium/auxiliary/Makefile create mode 100644 mesalib/src/gallium/auxiliary/Makefile.sources create mode 100644 mesalib/src/gallium/auxiliary/SConscript create mode 100644 mesalib/src/gallium/auxiliary/util/.gitignore create mode 100644 mesalib/src/glsl/.gitignore create mode 100644 mesalib/src/glsl/glcpp/.gitignore create mode 100644 mesalib/src/glu/.gitignore create mode 100644 mesalib/src/glu/sgi/.gitignore create mode 100644 mesalib/src/mapi/glapi/.gitignore create mode 100644 mesalib/src/mesa/.gitignore create mode 100644 mesalib/src/mesa/drivers/dri/.gitignore create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/.gitignore create mode 100644 mesalib/src/mesa/drivers/dri/swrast/.gitignore create mode 100644 mesalib/src/mesa/main/.gitignore create mode 100644 mesalib/src/mesa/program/.gitignore (limited to 'mesalib') diff --git a/mesalib/.gitignore b/mesalib/.gitignore new file mode 100644 index 000000000..717d45d23 --- /dev/null +++ b/mesalib/.gitignore @@ -0,0 +1,42 @@ +*.a +*.dll +*.exe +*.ilk +*.la +*.lo +*.o +*.obj +*.os +*.pc +*.pdb +*.pyc +*.pyo +*.so +*.so.* +*.sw[a-z] +*.tar +*.tar.bz2 +*.tar.gz +*.zip +*~ +depend +depend.bak +bin/ltmain.sh +lib +lib64 +configure +configure.lineno +autom4te.cache +aclocal.m4 +config.log +config.status +cscope* +.scon* +config.py +build +libtool +manifest.txt +Makefile.in +.dir-locals.el +.deps/ +.libs/ diff --git a/mesalib/bin/.gitignore b/mesalib/bin/.gitignore new file mode 100644 index 000000000..2ee67a666 --- /dev/null +++ b/mesalib/bin/.gitignore @@ -0,0 +1,7 @@ +config.guess +config.sub +install-sh +/depcomp +/missing +ylwrap +compile diff --git a/mesalib/bin/confdiff.sh b/mesalib/bin/confdiff.sh index 43df914f3..568fcd6d5 100644 --- a/mesalib/bin/confdiff.sh +++ b/mesalib/bin/confdiff.sh @@ -1,48 +1,48 @@ -#!/bin/bash -e - -usage() -{ - echo "Usage: $0 " - echo "Highlight differences between Mesa configs" - echo "Example:" - echo " $0 linux linux-x86" -} - -die() -{ - echo "$@" >&2 - return 1 -} - -case "$1" in --h|--help) usage; exit 0;; -esac - -[ $# -lt 2 ] && die 2 targets needed. See $0 --help -target1=$1 -target2=$2 - -topdir=$(cd "`dirname $0`"/..; pwd) -cd "$topdir" - -[ -f "./configs/$target1" ] || die Missing configs/$target1 -[ -f "./configs/$target2" ] || die Missing configs/$target2 - -trap 'rm -f "$t1" "$t2"' 0 - -t1=$(mktemp) -t2=$(mktemp) - -make -f- -n -p < $t1 -TOP = . -include \$(TOP)/configs/$target1 -default: -EOF - -make -f- -n -p < $t2 -TOP = . -include \$(TOP)/configs/$target2 -default: -EOF - -diff -pu -I'^#' $t1 $t2 +#!/bin/bash -e + +usage() +{ + echo "Usage: $0 " + echo "Highlight differences between Mesa configs" + echo "Example:" + echo " $0 linux linux-x86" +} + +die() +{ + echo "$@" >&2 + return 1 +} + +case "$1" in +-h|--help) usage; exit 0;; +esac + +[ $# -lt 2 ] && die 2 targets needed. See $0 --help +target1=$1 +target2=$2 + +topdir=$(cd "`dirname $0`"/..; pwd) +cd "$topdir" + +[ -f "./configs/$target1" ] || die Missing configs/$target1 +[ -f "./configs/$target2" ] || die Missing configs/$target2 + +trap 'rm -f "$t1" "$t2"' 0 + +t1=$(mktemp) +t2=$(mktemp) + +make -f- -n -p < $t1 +TOP = . +include \$(TOP)/configs/$target1 +default: +EOF + +make -f- -n -p < $t2 +TOP = . +include \$(TOP)/configs/$target2 +default: +EOF + +diff -pu -I'^#' $t1 $t2 diff --git a/mesalib/bin/installmesa b/mesalib/bin/installmesa index 771fb4fdc..1e24c05ca 100644 --- a/mesalib/bin/installmesa +++ b/mesalib/bin/installmesa @@ -1,74 +1,74 @@ -#!/bin/sh - -# -# Simple shell script for installing Mesa's header and library files. -# If the copy commands below don't work on a particular system (i.e. the -# -f or -d flags), we may need to branch on `uname` to do the right thing. -# - - -TOP=. - -INCLUDE_DIR="/usr/local/include" -LIB_DIR="/usr/local/lib" - -if [ "x$#" = "x0" ] ; then -echo -echo "***** Mesa installation - You may need root privileges to do this *****" -echo -echo "Default directory for header files is:" ${INCLUDE_DIR} -echo "Enter new directory or press to accept this default." - -read INPUT -if [ "x${INPUT}" != "x" ] ; then - INCLUDE_DIR=${INPUT} -fi - -echo -echo "Default directory for library files is:" ${LIB_DIR} -echo "Enter new directory or press to accept this default." - -read INPUT -if [ "x${INPUT}" != "x" ] ; then - LIB_DIR=${INPUT} -fi - -echo -echo "About to install Mesa header files (GL/*.h) in: " ${INCLUDE_DIR}/GL -echo "and Mesa library files (libGL.*, etc) in: " ${LIB_DIR} -echo "Press to continue, or -C to abort." - -read INPUT - -else -INCLUDE_DIR=$1/include -LIB_DIR=$1/lib -fi - -# flags: -# -f = force -# -d = preserve symlinks (does not work on BSD) - -if [ `uname` = "FreeBSD" ] ; then - CP_FLAGS="-f" -elif [ `uname` = "Darwin" ] ; then - CP_FLAGS="-f" -elif [ `uname` = "AIX" ] ; then - CP_FLAGS="-fh" -else - CP_FLAGS="-fd" -fi - - -set -v - -mkdir -p ${INCLUDE_DIR} -mkdir -p ${INCLUDE_DIR}/GL -# NOT YET: mkdir -p ${INCLUDE_DIR}/GLES -mkdir -p ${LIB_DIR} -cp -f ${TOP}/include/GL/*.h ${INCLUDE_DIR}/GL -cp -f ${TOP}/src/glw/*.h ${INCLUDE_DIR}/GL -# NOT YET: cp -f ${TOP}/include/GLES/*.h ${INCLUDE_DIR}/GLES -cp ${CP_FLAGS} ${TOP}/lib*/lib* ${LIB_DIR} - -echo "Done." +#!/bin/sh + +# +# Simple shell script for installing Mesa's header and library files. +# If the copy commands below don't work on a particular system (i.e. the +# -f or -d flags), we may need to branch on `uname` to do the right thing. +# + + +TOP=. + +INCLUDE_DIR="/usr/local/include" +LIB_DIR="/usr/local/lib" + +if [ "x$#" = "x0" ] ; then +echo +echo "***** Mesa installation - You may need root privileges to do this *****" +echo +echo "Default directory for header files is:" ${INCLUDE_DIR} +echo "Enter new directory or press to accept this default." + +read INPUT +if [ "x${INPUT}" != "x" ] ; then + INCLUDE_DIR=${INPUT} +fi + +echo +echo "Default directory for library files is:" ${LIB_DIR} +echo "Enter new directory or press to accept this default." + +read INPUT +if [ "x${INPUT}" != "x" ] ; then + LIB_DIR=${INPUT} +fi + +echo +echo "About to install Mesa header files (GL/*.h) in: " ${INCLUDE_DIR}/GL +echo "and Mesa library files (libGL.*, etc) in: " ${LIB_DIR} +echo "Press to continue, or -C to abort." + +read INPUT + +else +INCLUDE_DIR=$1/include +LIB_DIR=$1/lib +fi + +# flags: +# -f = force +# -d = preserve symlinks (does not work on BSD) + +if [ `uname` = "FreeBSD" ] ; then + CP_FLAGS="-f" +elif [ `uname` = "Darwin" ] ; then + CP_FLAGS="-f" +elif [ `uname` = "AIX" ] ; then + CP_FLAGS="-fh" +else + CP_FLAGS="-fd" +fi + + +set -v + +mkdir -p ${INCLUDE_DIR} +mkdir -p ${INCLUDE_DIR}/GL +# NOT YET: mkdir -p ${INCLUDE_DIR}/GLES +mkdir -p ${LIB_DIR} +cp -f ${TOP}/include/GL/*.h ${INCLUDE_DIR}/GL +cp -f ${TOP}/src/glw/*.h ${INCLUDE_DIR}/GL +# NOT YET: cp -f ${TOP}/include/GLES/*.h ${INCLUDE_DIR}/GLES +cp ${CP_FLAGS} ${TOP}/lib*/lib* ${LIB_DIR} + +echo "Done." diff --git a/mesalib/configs/.gitignore b/mesalib/configs/.gitignore new file mode 100644 index 000000000..97ac5b732 --- /dev/null +++ b/mesalib/configs/.gitignore @@ -0,0 +1,2 @@ +current +autoconf diff --git a/mesalib/configure.ac b/mesalib/configure.ac index fc1c28eb2..fb7c4a684 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -1434,18 +1434,9 @@ if test "x$enable_egl" = xyes; then if test "$have_libudev" = yes; then DEFINES="$DEFINES -DHAVE_LIBUDEV" fi + if test "x$enable_dri" = xyes; then - # build egl_dri2 when xcb-dri2 is available - PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes], - [have_xcb_dri2=yes],[have_xcb_dri2=no]) - if test "$have_xcb_dri2" = yes; then - HAVE_EGL_DRIVER_DRI2=1 - # workaround a bug in xcb-dri2 generated by xcb-proto 1.6 - save_LIBS="$LIBS" - AC_CHECK_LIB(xcb-dri2, xcb_dri2_connect_alignment_pad, [], - [DEFINES="$DEFINES -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN"]) - LIBS="$save_LIBS" - fi + HAVE_EGL_DRIVER_DRI2=1 fi fi @@ -1723,6 +1714,9 @@ esac AC_SUBST([VG_LIB_DEPS]) AC_SUBST([EGL_CLIENT_APIS]) +dnl +dnl EGL Platforms configuration +dnl AC_ARG_WITH([egl-platforms], [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@], [comma delimited native platforms libEGL supports, e.g. @@ -1740,28 +1734,45 @@ if test "x$with_egl_platforms" != "x" -a "x$enable_egl" != xyes; then AC_MSG_ERROR([cannot build egl state tracker without EGL library]) fi -# verify the requested driver directories exist +# Do per-EGL platform setups and checks egl_platforms=`IFS=', '; echo $with_egl_platforms` for plat in $egl_platforms; do - test -d "$srcdir/src/gallium/state_trackers/egl/$plat" || \ - AC_MSG_ERROR([EGL platform '$plat' does not exist]) - if test "$plat" = "fbdev"; then - GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev" - fi - if test "$plat" = "null"; then - GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/null" - fi - if test "$plat" = "wayland"; then + case "$plat" in + fbdev|null) + GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/$plat" + ;; + + wayland) PKG_CHECK_MODULES([WAYLAND], [wayland-client wayland-server],, \ [AC_MSG_ERROR([cannot find libwayland-client])]) - GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland" + GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland" + + m4_ifdef([WAYLAND_SCANNER_RULES], + [WAYLAND_SCANNER_RULES(['$(top_srcdir)/src/egl/wayland/wayland-drm/protocol'])]) + ;; + + x11) + PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes]) + # workaround a bug in xcb-dri2 generated by xcb-proto 1.6 + save_LIBS="$LIBS" + AC_CHECK_LIB(xcb-dri2, xcb_dri2_connect_alignment_pad, [], + [DEFINES="$DEFINES -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN"]) + LIBS="$save_LIBS" + ;; + + drm) + test "x$enable_gbm" = "xno" && + AC_MSG_ERROR([EGL platform drm needs gbm]) + ;; + + android|gdi) + ;; + + *) + AC_MSG_ERROR([EGL platform '$plat' does not exist]) + ;; + esac - m4_ifdef([WAYLAND_SCANNER_RULES], - [WAYLAND_SCANNER_RULES(['$(top_srcdir)/src/egl/wayland/wayland-drm/protocol'])]) - fi - if test "$plat" = "drm" && test "x$enable_gbm" = "xno"; then - AC_MSG_ERROR([EGL platform drm needs gbm]) - fi case "$plat$have_libudev" in waylandno|drmno) AC_MSG_ERROR([cannot build $plat platfrom without udev]) ;; diff --git a/mesalib/docs/MESA_agp_offset.spec b/mesalib/docs/MESA_agp_offset.spec index bf3ea1748..06e1d902e 100644 --- a/mesalib/docs/MESA_agp_offset.spec +++ b/mesalib/docs/MESA_agp_offset.spec @@ -1,95 +1,95 @@ -Name - - MESA_agp_offset - -Name Strings - - GLX_MESA_agp_offset - -Contact - - Brian Paul, Tungsten Graphics, Inc. (brian.paul 'at' tungstengraphics.com) - Keith Whitwell, Tungsten Graphics, Inc. (keith 'at' tungstengraphics.com) - -Status - - Shipping (Mesa 4.0.4 and later. Only implemented in particular - XFree86/DRI drivers.) - -Version - - 1.0 - -Number - - TBD - -Dependencies - - OpenGL 1.0 or later is required - GLX_NV_vertex_array_range is required. - This extensions is written against the OpenGL 1.4 Specification. - -Overview - - This extensions provides a way to convert pointers in an AGP memory - region into byte offsets into the AGP aperture. - Note, this extension depends on GLX_NV_vertex_array_range, for which - no real specification exists. See GL_NV_vertex_array_range for more - information. - -IP Status - - None - -Issues - - None - -New Procedures and Functions - - unsigned int glXGetAGPOffsetMESA( const void *pointer ) - -New Tokens - - None - -Additions to the OpenGL 1.4 Specification - - None - -Additions to Chapter 3 the GLX 1.4 Specification (Functions and Errors) - - Add a new section, 3.6 as follows: - - 3.6 AGP Memory Access - - On "PC" computers, AGP memory can be allocated with glXAllocateMemoryNV - and freed with glXFreeMemoryNV. Sometimes it's useful to know where a - block of AGP memory is located with respect to the start of the AGP - aperture. The function - - GLuint glXGetAGPOffsetMESA( const GLvoid *pointer ) - - Returns the offset of the given memory block from the start of AGP - memory in basic machine units (i.e. bytes). If pointer is invalid - the value ~0 will be returned. - -GLX Protocol - - None. This is a client side-only extension. - -Errors - - glXGetAGPOffsetMESA will return ~0 if the pointer does not point to - an AGP memory region. - -New State - - None - -Revision History - - 20 September 2002 - Initial draft - 2 October 2002 - finished GLX chapter 3 additions - 27 July 2004 - use unsigned int instead of GLuint, void instead of GLvoid +Name + + MESA_agp_offset + +Name Strings + + GLX_MESA_agp_offset + +Contact + + Brian Paul, Tungsten Graphics, Inc. (brian.paul 'at' tungstengraphics.com) + Keith Whitwell, Tungsten Graphics, Inc. (keith 'at' tungstengraphics.com) + +Status + + Shipping (Mesa 4.0.4 and later. Only implemented in particular + XFree86/DRI drivers.) + +Version + + 1.0 + +Number + + TBD + +Dependencies + + OpenGL 1.0 or later is required + GLX_NV_vertex_array_range is required. + This extensions is written against the OpenGL 1.4 Specification. + +Overview + + This extensions provides a way to convert pointers in an AGP memory + region into byte offsets into the AGP aperture. + Note, this extension depends on GLX_NV_vertex_array_range, for which + no real specification exists. See GL_NV_vertex_array_range for more + information. + +IP Status + + None + +Issues + + None + +New Procedures and Functions + + unsigned int glXGetAGPOffsetMESA( const void *pointer ) + +New Tokens + + None + +Additions to the OpenGL 1.4 Specification + + None + +Additions to Chapter 3 the GLX 1.4 Specification (Functions and Errors) + + Add a new section, 3.6 as follows: + + 3.6 AGP Memory Access + + On "PC" computers, AGP memory can be allocated with glXAllocateMemoryNV + and freed with glXFreeMemoryNV. Sometimes it's useful to know where a + block of AGP memory is located with respect to the start of the AGP + aperture. The function + + GLuint glXGetAGPOffsetMESA( const GLvoid *pointer ) + + Returns the offset of the given memory block from the start of AGP + memory in basic machine units (i.e. bytes). If pointer is invalid + the value ~0 will be returned. + +GLX Protocol + + None. This is a client side-only extension. + +Errors + + glXGetAGPOffsetMESA will return ~0 if the pointer does not point to + an AGP memory region. + +New State + + None + +Revision History + + 20 September 2002 - Initial draft + 2 October 2002 - finished GLX chapter 3 additions + 27 July 2004 - use unsigned int instead of GLuint, void instead of GLvoid diff --git a/mesalib/docs/MESA_pack_invert.spec b/mesalib/docs/MESA_pack_invert.spec index 0eeb58c13..33fb3c7bf 100644 --- a/mesalib/docs/MESA_pack_invert.spec +++ b/mesalib/docs/MESA_pack_invert.spec @@ -1,138 +1,138 @@ -Name - - MESA_pack_invert - -Name Strings - - GL_MESA_pack_invert - -Contact - - Brian Paul, Tungsten Graphics, Inc. (brian.paul 'at' tungstengraphics.com) - Keith Whitwell, Tungsten Graphics, Inc. (keith 'at' tungstengraphics.com) - -Status - - Shipping (Mesa 4.0.4 and later) - -Version - - 1.0 - -Number - - TBD - -Dependencies - - OpenGL 1.0 or later is required - This extensions is written against the OpenGL 1.4 Specification. - -Overview - - This extension adds a new pixel storage parameter to indicate that - images are to be packed in top-to-bottom order instead of OpenGL's - conventional bottom-to-top order. Only pixel packing can be - inverted (i.e. for glReadPixels, glGetTexImage, glGetConvolutionFilter, - etc). - - Almost all known image file formats store images in top-to-bottom - order. As it is, OpenGL reads images from the frame buffer in - bottom-to-top order. Thus, images usually have to be inverted before - writing them to a file with image I/O libraries. This extension - allows images to be read such that inverting isn't needed. - -IP Status - - None - -Issues - - 1. Should we also define UNPACK_INVERT_MESA for glDrawPixels, etc? - - Resolved: No, we're only concerned with pixel packing. There are other - solutions for inverting images when using glDrawPixels (negative Y pixel - zoom) or glTexImage (invert the vertex T coordinates). It would be easy - enough to define a complementary extension for pixel packing in the - future if needed. - -New Procedures and Functions - - None - -New Tokens - - Accepted by the parameter of PixelStorei and PixelStoref - and the parameter of GetIntegerv, GetFloatv, GetDoublev - and GetBooleanv: - - PACK_INVERT_MESA 0x8758 - -Additions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation) - - None - -Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization) - - None - -Additions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment -Operations and the Frame Buffer) - - Add the following entry to table 4.4 (PixelStore parameters) on page 182: - - Parameter Name Type Initial Value Valid Range - --------------------------------------------------------- - PACK_INVERT_MESA boolean FALSE TRUE/FALSE - - In the section labeled "Placement in Client Memory" on page 184 - insert the following text into the paragraph before the sentence - that starts with "If the format is RED, GREEN, BLUE...": - - "The parameter PACK_INVERT_MESA controls whether the image is packed - in bottom-to-top order (the default) or top-to-bottom order. Equation - 3.8 is modified as follows: - - ... the first element of the Nth row is indicated by - - p + Nk, if PACK_INVERT_MESA is false - p + k * (H - 1) - Nk, if PACK_INVERT_MESA is true, where H is the - image height - " - -Additions to Chapter 5 of the OpenGL 1.4 Specification (Special Functions) - - None - -Additions to Chapter 6 of the OpenGL 1.4 Specification (State and -State Requests) - - None - -Additions to Appendix A of the OpenGL 1.4 Specification (Invariance) - - None - -Additions to the AGL/GLX/WGL Specifications - - None - -GLX Protocol - - None - -Errors - - None - -New State - - Add the following entry to table 6.20 (Pixels) on page 235: - - Get Value Type Get Cmd Initial Value Description Sec Attribute - -------------------------------------------------------------------------------------------------- - PACK_INVERT_MESA boolean GetBoolean FALSE Value of PACK_INVERT_MESA 4.3.2 pixel-store - -Revision History - - 21 September 2002 - Initial draft +Name + + MESA_pack_invert + +Name Strings + + GL_MESA_pack_invert + +Contact + + Brian Paul, Tungsten Graphics, Inc. (brian.paul 'at' tungstengraphics.com) + Keith Whitwell, Tungsten Graphics, Inc. (keith 'at' tungstengraphics.com) + +Status + + Shipping (Mesa 4.0.4 and later) + +Version + + 1.0 + +Number + + TBD + +Dependencies + + OpenGL 1.0 or later is required + This extensions is written against the OpenGL 1.4 Specification. + +Overview + + This extension adds a new pixel storage parameter to indicate that + images are to be packed in top-to-bottom order instead of OpenGL's + conventional bottom-to-top order. Only pixel packing can be + inverted (i.e. for glReadPixels, glGetTexImage, glGetConvolutionFilter, + etc). + + Almost all known image file formats store images in top-to-bottom + order. As it is, OpenGL reads images from the frame buffer in + bottom-to-top order. Thus, images usually have to be inverted before + writing them to a file with image I/O libraries. This extension + allows images to be read such that inverting isn't needed. + +IP Status + + None + +Issues + + 1. Should we also define UNPACK_INVERT_MESA for glDrawPixels, etc? + + Resolved: No, we're only concerned with pixel packing. There are other + solutions for inverting images when using glDrawPixels (negative Y pixel + zoom) or glTexImage (invert the vertex T coordinates). It would be easy + enough to define a complementary extension for pixel packing in the + future if needed. + +New Procedures and Functions + + None + +New Tokens + + Accepted by the parameter of PixelStorei and PixelStoref + and the parameter of GetIntegerv, GetFloatv, GetDoublev + and GetBooleanv: + + PACK_INVERT_MESA 0x8758 + +Additions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation) + + None + +Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization) + + None + +Additions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment +Operations and the Frame Buffer) + + Add the following entry to table 4.4 (PixelStore parameters) on page 182: + + Parameter Name Type Initial Value Valid Range + --------------------------------------------------------- + PACK_INVERT_MESA boolean FALSE TRUE/FALSE + + In the section labeled "Placement in Client Memory" on page 184 + insert the following text into the paragraph before the sentence + that starts with "If the format is RED, GREEN, BLUE...": + + "The parameter PACK_INVERT_MESA controls whether the image is packed + in bottom-to-top order (the default) or top-to-bottom order. Equation + 3.8 is modified as follows: + + ... the first element of the Nth row is indicated by + + p + Nk, if PACK_INVERT_MESA is false + p + k * (H - 1) - Nk, if PACK_INVERT_MESA is true, where H is the + image height + " + +Additions to Chapter 5 of the OpenGL 1.4 Specification (Special Functions) + + None + +Additions to Chapter 6 of the OpenGL 1.4 Specification (State and +State Requests) + + None + +Additions to Appendix A of the OpenGL 1.4 Specification (Invariance) + + None + +Additions to the AGL/GLX/WGL Specifications + + None + +GLX Protocol + + None + +Errors + + None + +New State + + Add the following entry to table 6.20 (Pixels) on page 235: + + Get Value Type Get Cmd Initial Value Description Sec Attribute + -------------------------------------------------------------------------------------------------- + PACK_INVERT_MESA boolean GetBoolean FALSE Value of PACK_INVERT_MESA 4.3.2 pixel-store + +Revision History + + 21 September 2002 - Initial draft diff --git a/mesalib/docs/MESA_release_buffers.spec b/mesalib/docs/MESA_release_buffers.spec index e906e1459..52d1e5a9c 100644 --- a/mesalib/docs/MESA_release_buffers.spec +++ b/mesalib/docs/MESA_release_buffers.spec @@ -1,85 +1,85 @@ -Name - - MESA_release_buffers - -Name Strings - - GLX_MESA_release_buffers - -Contact - - Brian Paul (brian.paul 'at' tungstengraphics.com) - -Status - - Shipping since Mesa 2.0 in October, 1996. - -Version - - Last Modified Date: 8 June 2000 - -Number - - 217 - -Dependencies - - OpenGL 1.0 or later is required. - GLX 1.0 or later is required. - -Overview - - Mesa's implementation of GLX is entirely implemented on the client side. - Therefore, Mesa cannot immediately detect when an X window or pixmap is - destroyed in order to free any ancillary data associated with the window - or pixmap. - - The glxMesaReleaseBuffers() function can be used to explicitly indicate - when the back color buffer, depth buffer, stencil buffer, and/or accumu- - lation buffer associated with a drawable can be freed. - -IP Status - - Open-source; freely implementable. - -Issues - - None. - -New Procedures and Functions - - Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ); - -New Tokens - - None. - -Additions to Chapter 3 of the GLX 1.3 Specification (Functions and Errors) - - The function - - Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ); - - causes all software ancillary buffers (back buffer, depth, stencil, - accum, etc) associated with the named drawable to be immediately - deallocated. True is returned if is a valid Mesa GLX drawable, - else False is returned. After calling glXReleaseBuffersMESA, the - drawable should no longer be used for GL rendering. Results of - attempting to do so are undefined. - - -GLX Protocol - - None, since this is a client-side operation. - -Errors - - None. - -New State - - None. - -Revision History - - 8 June 2000 - initial specification +Name + + MESA_release_buffers + +Name Strings + + GLX_MESA_release_buffers + +Contact + + Brian Paul (brian.paul 'at' tungstengraphics.com) + +Status + + Shipping since Mesa 2.0 in October, 1996. + +Version + + Last Modified Date: 8 June 2000 + +Number + + 217 + +Dependencies + + OpenGL 1.0 or later is required. + GLX 1.0 or later is required. + +Overview + + Mesa's implementation of GLX is entirely implemented on the client side. + Therefore, Mesa cannot immediately detect when an X window or pixmap is + destroyed in order to free any ancillary data associated with the window + or pixmap. + + The glxMesaReleaseBuffers() function can be used to explicitly indicate + when the back color buffer, depth buffer, stencil buffer, and/or accumu- + lation buffer associated with a drawable can be freed. + +IP Status + + Open-source; freely implementable. + +Issues + + None. + +New Procedures and Functions + + Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ); + +New Tokens + + None. + +Additions to Chapter 3 of the GLX 1.3 Specification (Functions and Errors) + + The function + + Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ); + + causes all software ancillary buffers (back buffer, depth, stencil, + accum, etc) associated with the named drawable to be immediately + deallocated. True is returned if is a valid Mesa GLX drawable, + else False is returned. After calling glXReleaseBuffersMESA, the + drawable should no longer be used for GL rendering. Results of + attempting to do so are undefined. + + +GLX Protocol + + None, since this is a client-side operation. + +Errors + + None. + +New State + + None. + +Revision History + + 8 June 2000 - initial specification diff --git a/mesalib/docs/MESA_resize_buffers.spec b/mesalib/docs/MESA_resize_buffers.spec index 4d6e9f720..dabc7c421 100644 --- a/mesalib/docs/MESA_resize_buffers.spec +++ b/mesalib/docs/MESA_resize_buffers.spec @@ -1,81 +1,81 @@ -Name - - MESA_resize_buffers - -Name Strings - - GL_MESA_resize_buffers - -Contact - - Brian Paul (brian.paul 'at' tungstengraphics.com) - -Status - - Shipping (since Mesa version 2.2) - -Version - - -Number - - 196 - -Dependencies - - Mesa 2.2 or later is required. - -Overview - - Mesa is often used as a client library with no integration with - the computer's window system (an X server, for example). And since - Mesa does not have an event loop nor window system callbacks, it - cannot properly respond to window system events. In particular, - Mesa cannot automatically detect when a window has been resized. - - Mesa's glViewport command queries the current window size and updates - its internal data structors accordingly. This normally works fine - since most applications call glViewport in response to window size - changes. - - In some situations, however, the application may not call glViewport - when a window size changes but would still like Mesa to adjust to - the new window size. This extension exports a new function to solve - this problem. - -New Procedures and Functions - - void glResizeBuffersMESA( void ) - -New Tokens - - none - -Additions to the OpenGL Specification (no particular section) - - The glResizeBuffersMESA command may be called when the client - determines that a window has been resized. Calling - glResizeBuffersMESA causes Mesa to query the current window size - and adjust its internal data structures. This may include - reallocating depth, stencil, alpha and accumulation buffers. - -Additions to the AGL/GLX/WGL Specifications - - None - -Errors - - INVALID_OPERATION is generated if glResizeBuffersMESA is called between - Begin and End. - -New State - - None. - -New Implementation Dependent State - - None. - -Revision History - - * Revision 1.0 - Initial specification +Name + + MESA_resize_buffers + +Name Strings + + GL_MESA_resize_buffers + +Contact + + Brian Paul (brian.paul 'at' tungstengraphics.com) + +Status + + Shipping (since Mesa version 2.2) + +Version + + +Number + + 196 + +Dependencies + + Mesa 2.2 or later is required. + +Overview + + Mesa is often used as a client library with no integration with + the computer's window system (an X server, for example). And since + Mesa does not have an event loop nor window system callbacks, it + cannot properly respond to window system events. In particular, + Mesa cannot automatically detect when a window has been resized. + + Mesa's glViewport command queries the current window size and updates + its internal data structors accordingly. This normally works fine + since most applications call glViewport in response to window size + changes. + + In some situations, however, the application may not call glViewport + when a window size changes but would still like Mesa to adjust to + the new window size. This extension exports a new function to solve + this problem. + +New Procedures and Functions + + void glResizeBuffersMESA( void ) + +New Tokens + + none + +Additions to the OpenGL Specification (no particular section) + + The glResizeBuffersMESA command may be called when the client + determines that a window has been resized. Calling + glResizeBuffersMESA causes Mesa to query the current window size + and adjust its internal data structures. This may include + reallocating depth, stencil, alpha and accumulation buffers. + +Additions to the AGL/GLX/WGL Specifications + + None + +Errors + + INVALID_OPERATION is generated if glResizeBuffersMESA is called between + Begin and End. + +New State + + None. + +New Implementation Dependent State + + None. + +Revision History + + * Revision 1.0 - Initial specification diff --git a/mesalib/docs/MESA_swap_control.spec b/mesalib/docs/MESA_swap_control.spec index 31340772f..a002563c9 100644 --- a/mesalib/docs/MESA_swap_control.spec +++ b/mesalib/docs/MESA_swap_control.spec @@ -1,129 +1,129 @@ -Name - - MESA_swap_control - -Name Strings - - GLX_MESA_swap_control - -Contact - - Ian Romanick, IBM, idr at us.ibm.com - -Status - - Deployed in DRI drivers post-XFree86 4.3. - -Version - - Date: 5/1/2003 Revision: 1.1 - -Number - - ??? - -Dependencies - - None - - Based on GLX_SGI_swap_control version 1.9 and WGL_EXT_swap_control - version 1.5. - -Overview - - This extension allows an application to specify a minimum periodicity - of color buffer swaps, measured in video frame periods. - -Issues - - * Should implementations that export GLX_MESA_swap_control also export - GL_EXT_swap_control for compatibility with WGL_EXT_swap_control? - - UNRESOLVED. - -New Procedures and Functions - - int glXSwapIntervalMESA(unsigned int interval) - int glXGetSwapIntervalMESA(void) - -New Tokens - - None - -Additions to Chapter 2 of the 1.4 GL Specification (OpenGL Operation) - - None - -Additions to Chapter 3 of the 1.4 GL Specification (Rasterization) - - None - -Additions to Chapter 4 of the 1.4 GL Specification (Per-Fragment Operations -and the Framebuffer) - - None - -Additions to Chapter 5 of the 1.4 GL Specification (Special Functions) - - None - -Additions to Chapter 6 of the 1.4 GL Specification (State and State Requests) - - None - -Additions to the GLX 1.3 Specification - - [Add the following to Section 3.3.10 of the GLX Specification (Double - Buffering)] - - glXSwapIntervalMESA specifies the minimum number of video frame periods - per buffer swap. (e.g. a value of two means that the color buffers - will be swapped at most every other video frame.) A return value - of zero indicates success; otherwise an error occurred. The interval - takes effect when glXSwapBuffers is first called subsequent to the - glXSwapIntervalMESA call. - - A video frame period is the time required by the monitor to display a - full frame of video data. In the case of an interlaced monitor, - this is typically the time required to display both the even and odd - fields of a frame of video data. - - If is set to a value of 0, buffer swaps are not synchro- - nized to a video frame. The value is silently clamped to - the maximum implementation-dependent value supported before being - stored. - - The swap interval is not part of the render context state. It cannot - be pushed or popped. The current swap interval for the window - associated with the current context can be obtained by calling - glXGetSwapIntervalMESA. The default swap interval is 0. - - On XFree86, setting the environment variable LIBGL_THROTTLE_REFRESH sets - the swap interval to 1. - -Errors - - glXSwapIntervalMESA returns GLX_BAD_CONTEXT if there is no current - GLXContext or if the current context is not a direct rendering context. - -GLX Protocol - - None. This extension only extends to direct rendering contexts. - -New State - - Get Value Get Command Type Initial Value - --------- ----------- ---- ------------- - [swap interval] GetSwapInterval Z+ 0 - -New Implementation Dependent State - - None - - -Revision History - - 1.1, 5/1/03 Added the issues section and contact information. - Changed the default swap interval to 0. - 1.0, 3/17/03 Initial version based on GLX_SGI_swap_control and - WGL_EXT_swap_control. +Name + + MESA_swap_control + +Name Strings + + GLX_MESA_swap_control + +Contact + + Ian Romanick, IBM, idr at us.ibm.com + +Status + + Deployed in DRI drivers post-XFree86 4.3. + +Version + + Date: 5/1/2003 Revision: 1.1 + +Number + + ??? + +Dependencies + + None + + Based on GLX_SGI_swap_control version 1.9 and WGL_EXT_swap_control + version 1.5. + +Overview + + This extension allows an application to specify a minimum periodicity + of color buffer swaps, measured in video frame periods. + +Issues + + * Should implementations that export GLX_MESA_swap_control also export + GL_EXT_swap_control for compatibility with WGL_EXT_swap_control? + + UNRESOLVED. + +New Procedures and Functions + + int glXSwapIntervalMESA(unsigned int interval) + int glXGetSwapIntervalMESA(void) + +New Tokens + + None + +Additions to Chapter 2 of the 1.4 GL Specification (OpenGL Operation) + + None + +Additions to Chapter 3 of the 1.4 GL Specification (Rasterization) + + None + +Additions to Chapter 4 of the 1.4 GL Specification (Per-Fragment Operations +and the Framebuffer) + + None + +Additions to Chapter 5 of the 1.4 GL Specification (Special Functions) + + None + +Additions to Chapter 6 of the 1.4 GL Specification (State and State Requests) + + None + +Additions to the GLX 1.3 Specification + + [Add the following to Section 3.3.10 of the GLX Specification (Double + Buffering)] + + glXSwapIntervalMESA specifies the minimum number of video frame periods + per buffer swap. (e.g. a value of two means that the color buffers + will be swapped at most every other video frame.) A return value + of zero indicates success; otherwise an error occurred. The interval + takes effect when glXSwapBuffers is first called subsequent to the + glXSwapIntervalMESA call. + + A video frame period is the time required by the monitor to display a + full frame of video data. In the case of an interlaced monitor, + this is typically the time required to display both the even and odd + fields of a frame of video data. + + If is set to a value of 0, buffer swaps are not synchro- + nized to a video frame. The value is silently clamped to + the maximum implementation-dependent value supported before being + stored. + + The swap interval is not part of the render context state. It cannot + be pushed or popped. The current swap interval for the window + associated with the current context can be obtained by calling + glXGetSwapIntervalMESA. The default swap interval is 0. + + On XFree86, setting the environment variable LIBGL_THROTTLE_REFRESH sets + the swap interval to 1. + +Errors + + glXSwapIntervalMESA returns GLX_BAD_CONTEXT if there is no current + GLXContext or if the current context is not a direct rendering context. + +GLX Protocol + + None. This extension only extends to direct rendering contexts. + +New State + + Get Value Get Command Type Initial Value + --------- ----------- ---- ------------- + [swap interval] GetSwapInterval Z+ 0 + +New Implementation Dependent State + + None + + +Revision History + + 1.1, 5/1/03 Added the issues section and contact information. + Changed the default swap interval to 0. + 1.0, 3/17/03 Initial version based on GLX_SGI_swap_control and + WGL_EXT_swap_control. diff --git a/mesalib/docs/MESA_texture_array.spec b/mesalib/docs/MESA_texture_array.spec index 1cc2217f3..b146821f7 100644 --- a/mesalib/docs/MESA_texture_array.spec +++ b/mesalib/docs/MESA_texture_array.spec @@ -1,804 +1,804 @@ -Name - - MESA_texture_array - -Name Strings - - GL_MESA_texture_array - -Contact - - Ian Romanick, IBM (idr 'at' us.ibm.com) - -IP Status - - No known IP issues. - -Status - - Shipping in Mesa 7.1 - -Version - - -Number - - TBD - -Dependencies - - OpenGL 1.2 or GL_EXT_texture3D is required. - - Support for ARB_fragment_program is assumed, but not required. - - Support for ARB_fragment_program_shadow is assumed, but not required. - - Support for EXT_framebuffer_object is assumed, but not required. - - Written based on the wording of the OpenGL 2.0 specification and - ARB_fragment_program_shadow but not dependent on them. - -Overview - - There are a number of circumstances where an application may wish to - blend two textures out of a larger set of textures. Moreover, in some - cases the selected textures may vary on a per-fragment basis within - a polygon. Several examples include: - - 1. High dynamic range textures. The application stores several - different "exposures" of an image as different textures. On a - per-fragment basis, the application selects which exposures are - used. - - 2. A terrain engine where the altitude of a point determines the - texture applied to it. If the transition is from beach sand to - grass to rocks to snow, the application will store each texture - in a different texture map, and dynamically select which two - textures to blend at run-time. - - 3. Storing short video clips in textures. Each depth slice is a - single frame of video. - - Several solutions to this problem have been proposed, but they either - involve using a separate texture unit for each texture map or using 3D - textures without mipmaps. Both of these options have major drawbacks. - - This extension provides a third alternative that eliminates the major - drawbacks of both previous methods. A new texture target, - TEXTURE_2D_ARRAY, is added that functions identically to TEXTURE_3D in - all aspects except the sizes of the non-base level images. In - traditional 3D texturing, the size of the N+1 LOD is half the size - of the N LOD in all three dimensions. For the TEXTURE_2D_ARRAY target, - the height and width of the N+1 LOD is halved, but the depth is the - same for all levels of detail. The texture then becomes an array of - 2D textures. The per-fragment texel is selected by the R texture - coordinate. - - References: - - http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011557 - http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=000516 - http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011903 - http://www.delphi3d.net/articles/viewarticle.php?article=terraintex.htm - -New Procedures and Functions - - All functions come directly from EXT_texture_array. - - void FramebufferTextureLayerEXT(enum target, enum attachment, - uint texture, int level, int layer); - -New Tokens - - All token names and values come directly from EXT_texture_array. - - Accepted by the parameter of Enable, Disable, and IsEnabled, by - the parameter of GetBooleanv, GetIntegerv, GetFloatv, and - GetDoublev, and by the parameter of TexImage3D, GetTexImage, - GetTexLevelParameteriv, GetTexLevelParameterfv, GetTexParameteriv, and - GetTexParameterfv: - - TEXTURE_1D_ARRAY_EXT 0x8C18 - TEXTURE_2D_ARRAY_EXT 0x8C1A - - Accepted by the parameter of TexImage2D, TexSubImage2D, - CopyTexImage2D, CopyTexSubImage2D, CompressedTexImage2D, - CompressedTexSubImage2D, GetTexLevelParameteriv, and - GetTexLevelParameterfv: - - TEXTURE_1D_ARRAY_EXT - PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 - - Accepted by the parameter of TexImage3D, TexSubImage3D, - CopyTexSubImage3D, CompressedTexImage3D, CompressedTexSubImage3D, - GetTexLevelParameteriv, and GetTexLevelParameterfv: - - TEXTURE_2D_ARRAY_EXT - PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B - - Accepted by the parameter of GetBooleanv, GetIntegerv, - GetFloatv, and GetDoublev - - TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C - TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D - MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF - - Accepted by the parameter of TexParameterf, TexParameteri, - TexParameterfv, and TexParameteriv when the parameter is - TEXTURE_COMPARE_MODE_ARB: - - COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E - - (Note: COMPARE_REF_DEPTH_TO_TEXTURE_EXT is simply an alias for the - existing COMPARE_R_TO_TEXTURE token in OpenGL 2.0; the alternate name - reflects the fact that the R coordinate is not always used.) - - Accepted by the parameter of TexImage3D and - CompressedTexImage3D, and by the parameter of - CompressedTexSubImage3D: - - COMPRESSED_RGB_S3TC_DXT1_EXT - COMPRESSED_RGBA_S3TC_DXT1_EXT - COMPRESSED_RGBA_S3TC_DXT3_EXT - COMPRESSED_RGBA_S3TC_DXT5_EXT - - Accepted by the parameter of - GetFramebufferAttachmentParameterivEXT: - - FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 - - (Note: FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER is simply an alias for the - FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT token provided in - EXT_framebuffer_object. This extension generalizes the notion of - "" to include layers of an array texture.) - -Additions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation) - - None - -Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization) - - -- Section 3.8.1 "Texture Image Specification" - - Change the first paragraph (page 150) to say (spec changes identical to - EXT_texture_array): - - "The command - - void TexImage3D(enum target, int level, int internalformat, - sizei width, sizei height, sizei depth, int border, - enum format, enum type, void *data); - - is used to specify a three-dimensional texture image. target must be one - one of TEXTURE_3D for a three-dimensional texture or - TEXTURE_2D_ARRAY_EXT for an two-dimensional array texture. - Additionally, target may be either PROXY_TEXTURE_3D for a - three-dimensional proxy texture, or PROXY_TEXTURE_2D_ARRAY_EXT for a - two-dimensional proxy array texture." - - Change the fourth paragraph on page 151 to say (spec changes identical - to EXT_texture_array): - - "Textures with a base internal format of DEPTH_COMPONENT are supported - by texture image specification commands only if target is TEXTURE_1D, - TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, TEXTURE_2D_ARRAY_EXT, - PROXY_TEXTURE_1D, PROXY_TEXTURE_2D, PROXY_TEXTURE_1D_ARRAY_EXT, or - PROXY_TEXTURE_2D_ARRAY_EXT. Using this format in conjunction with any - other target will result in an INVALID_OPERATION error." - - - Change the fourth paragraph on page 156 to say (spec changes identical - to EXT_texture_array): - - "The command - - void TexImage2D(enum target, int level, - int internalformat, sizei width, sizei height, - int border, enum format, enum type, void *data); - - is used to specify a two-dimensional texture image. target must be one - of TEXTURE_2D for a two-dimensional texture, TEXTURE_1D_ARRAY_EXT for a - one-dimensional array texture, or one of TEXTURE_CUBE_MAP_POSITIVE_X, - TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE_MAP_POSITIVE_Y, - TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, or - TEXTURE_CUBE_MAP_NEGATIVE_Z for a cube map texture. Additionally, - target may be either PROXY_TEXTURE_2D for a two-dimensional proxy - texture, PROXY_TEXTURE_1D_ARRAY_EXT for a one-dimensional proxy array - texture, or PROXY TEXTURE_CUBE_MAP for a cube map proxy texture in the - special case discussed in section 3.8.11. The other parameters match - the corresponding parameters of TexImage3D. - - For the purposes of decoding the texture image, TexImage2D is - equivalent to calling TexImage3D with corresponding arguments and depth - of 1, except that - - * The border depth, d_b, is zero, and the depth of the image is - always 1 regardless of the value of border. - - * The border height, h_b, is zero if is - TEXTURE_1D_ARRAY_EXT, and otherwise. - - * Convolution will be performed on the image (possibly changing its - width and height) if SEPARABLE 2D or CONVOLUTION 2D is enabled. - - * UNPACK SKIP IMAGES is ignored." - - -- Section 3.8.2 "Alternate Texture Image Specification Commands" - - Change the second paragraph (page 159) (spec changes identical - to EXT_texture_array): - - "The command - - void CopyTexImage2D(enum target, int level, - enum internalformat, int x, int y, sizei width, - sizei height, int border); - - defines a two-dimensional texture image in exactly the manner of - TexImage2D, except that the image data are taken from the framebuffer - rather than from client memory. Currently, target must be one of - TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, TEXTURE_CUBE_MAP_POSITIVE_X, - TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE MAP_POSITIVE_Y, - TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, or - TEXTURE_CUBE_MAP_NEGATIVE_Z. - - - Change the last paragraph on page 160 to say (spec changes identical - to EXT_texture_array): - - "Currently the target arguments of TexSubImage1D and CopyTexSubImage1D - must be TEXTURE_1D, the target arguments of TexSubImage2D and - CopyTexSubImage2D must be one of TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, - TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_X, - TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_NEGATIVE_Y, - TEXTURE_CUBE_MAP_POSITIVE_Z, or TEXTURE_CUBE_MAP_NEGATIVE_Z, and the - target arguments of TexSubImage3D and CopyTexSubImage3D must be - TEXTURE_3D or TEXTURE_2D_ARRAY_EXT. ..." - - - -- Section 3.8.4 "Texture Parameters" - - Change the first paragraph (page 166) to say: - - "Various parameters control how the texel array is treated when - specified or changed, and when applied to a fragment. Each parameter is - set by calling - - void TexParameter{if}(enum target, enum pname, T param); - void TexParameter{if}v(enum target, enum pname, T params); - - target is the target, either TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, - TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT." - - - -- Section 3.8.8 "Texture Minification" in the section "Scale Factor and Level of Detail" - - Change the first paragraph (page 172) to say: - - "Let s(x,y) be the function that associates an s texture coordinate - with each set of window coordinates (x,y) that lie within a primitive; - define t(x,y) and r(x,y) analogously. Let u(x,y) = w_t * s(x,y), - v(x,y) = h_t * t(x,y), and w(x,y) = d_t * r(x,y), where w_t, h_t, - and d_t are as defined by equations 3.15, 3.16, and 3.17 with - w_s, h_s, and d_s equal to the width, height, and depth of the - image array whose level is level_base. For a one-dimensional - texture or a one-dimensional array texture, define v(x,y) = 0 and - w(x,y) = 0; for a two-dimensional texture or a two-dimensional array - texture, define w(x,y) = 0..." - - -- Section 3.8.8 "Texture Minification" in the section "Mipmapping" - - Change the third paragraph (page 174) to say: - - "For a two-dimensional texture, two-dimensional array texture, or - cube map texture," - - Change the fourth paragraph (page 174) to say: - - "And for a one-dimensional texture or a one-dimensional array texture," - - After the first paragraph (page 175) add: - - "For one-dimensional array textures, h_b and d_b are treated as 1, - regardless of the actual values, when performing mipmap calculations. - For two-dimensional array textures, d_b is always treated as one, - regardless of the actual value, when performing mipmap calculations." - - -- Section 3.8.8 "Automatic Mipmap Generation" in the section "Mipmapping" - - Change the third paragraph (page 176) to say (spec changes identical - to EXT_texture_array): - - "The contents of the derived arrays are computed by repeated, filtered - reduction of the level_base array. For one- and two-dimensional array - textures, each layer is filtered independently. ..." - - -- Section 3.8.8 "Manual Mipmap Generation" in the section "Mipmapping" - - Change first paragraph to say (spec changes identical to - EXT_texture_array): - - "Mipmaps can be generated manually with the command - - void GenerateMipmapEXT(enum target); - - where is one of TEXTURE_1D, TEXTURE_2D, TEXTURE_CUBE_MAP, - TEXTURE_3D, TEXTURE_1D_ARRAY, or TEXTURE_2D_ARRAY. Mipmap generation - affects the texture image attached to . ..." - - -- Section 3.8.10 "Texture Completeness" - - Change the second paragraph (page 177) to say (spec changes identical - to EXT_texture_array): - - "For one-, two-, or three-dimensional textures and one- or - two-dimensional array textures, a texture is complete if the following - conditions all hold true:" - - -- Section 3.8.11 "Texture State and Proxy State" - - Change the second and third paragraphs (page 179) to say (spec changes - identical to EXT_texture_array): - - "In addition to image arrays for one-, two-, and three-dimensional - textures, one- and two-dimensional array textures, and the six image - arrays for the cube map texture, partially instantiated image arrays - are maintained for one-, two-, and three-dimensional textures and one- - and two-dimensional array textures. Additionally, a single proxy image - array is maintained for the cube map texture. Each proxy image array - includes width, height, depth, border width, and internal format state - values, as well as state for the red, green, blue, alpha, luminance, - and intensity component resolutions. Proxy image arrays do not include - image data, nor do they include texture properties. When TexImage3D is - executed with target specified as PROXY_TEXTURE_3D, the - three-dimensional proxy state values of the specified level-of-detail - are recomputed and updated. If the image array would not be supported - by TexImage3D called with target set to TEXTURE 3D, no error is - generated, but the proxy width, height, depth, border width, and - component resolutions are set to zero. If the image array would be - supported by such a call to TexImage3D, the proxy state values are set - exactly as though the actual image array were being specified. No pixel - data are transferred or processed in either case. - - Proxy arrays for one- and two-dimensional textures and one- and - two-dimensional array textures are operated on in the same way when - TexImage1D is executed with target specified as PROXY_TEXTURE_1D, - TexImage2D is executed with target specified as PROXY_TEXTURE_2D or - PROXY_TEXTURE_1D_ARRAY_EXT, or TexImage3D is executed with target - specified as PROXY_TETXURE_2D_ARRAY_EXT." - - -- Section 3.8.12 "Texture Objects" - - Change section (page 180) to say (spec changes identical to - EXT_texture_array): - - "In addition to the default textures TEXTURE_1D, TEXTURE_2D, - TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and TEXTURE_2D_EXT, - named one-, two-, and three-dimensional, cube map, and one- and - two-dimensional array texture objects can be created and operated upon. - The name space for texture objects is the unsigned integers, with zero - reserved by the GL. - - A texture object is created by binding an unused name to TEXTURE_1D, - TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or - TEXTURE_2D_ARRAY_EXT. The binding is effected by calling - - void BindTexture(enum target, uint texture); - - with set to the desired texture target and set to - the unused name. The resulting texture object is a new state vector, - comprising all the state values listed in section 3.8.11, set to the - same initial values. If the new texture object is bound to TEXTURE_1D, - TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or - TEXTURE_2D_ARRAY_EXT, it is and remains a one-, two-, - three-dimensional, cube map, one- or two-dimensional array texture - respectively until it is deleted. - - BindTexture may also be used to bind an existing texture object to - either TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, - TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT. The error - INVALID_OPERATION is generated if an attempt is made to bind a texture - object of different dimensionality than the specified target. If the - bind is successful no change is made to the state of the bound texture - object, and any previous binding to target is broken. - - While a texture object is bound, GL operations on the target to which - it is bound affect the bound object, and queries of the target to which - it is bound return state from the bound object. If texture mapping of - the dimensionality of the target to which a texture object is bound is - enabled, the state of the bound texture object directs the texturing - operation. - - In the initial state, TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, - TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and TEXTURE_2D_ARRAY_EXT have - one-, two-, three-dimensional, cube map, and one- and two-dimensional - array texture state vectors respectively associated with them. In order - that access to these initial textures not be lost, they are treated as - texture objects all of whose names are 0. The initial one-, two-, - three-dimensional, cube map, one- and two-dimensional array textures - are therefore operated upon, queried, and applied as TEXTURE_1D, - TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and - TEXTURE_2D_ARRAY_EXT respectively while 0 is bound to the corresponding - targets. - - Change second paragraph on page 181 to say (spec changes identical to - EXT_texture_array): - - "... If a texture that is currently bound to one of the targets - TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, - TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT is deleted, it is as - though BindTexture had been executed with the same target and texture - zero. ..." - - Change second paragraph on page 182 to say (spec changes identical to - EXT_texture_array): - - "The texture object name space, including the initial one-, two-, and - three dimensional, cube map, and one- and two-dimensional array texture - objects, is shared among all texture units. ..." - - - -- Section 3.8.14 "Depth Texture Comparison Modes" in "Texture Comparison Modes" - - Change second through fourth paragraphs (page 188) to say: - - "Let D_t be the depth texture value, in the range [0, 1]. For - texture lookups from one- and two-dimensional, rectangle, and - one-dimensional array targets, let R be the interpolated - texture coordinate, clamped to the range [0, 1]. For texture lookups - from two-dimensional array texture targets, let R be the interpolated - texture coordinate, clamped to the range [0, 1]. Then the - effective texture value L_t, I_t, or A_t is computed as follows: - - If the value of TEXTURE_COMPARE_MODE is NONE, then - - r = Dt - - If the value of TEXTURE_COMPARE_MODE is - COMPARE_REF_DEPTH_TO_TEXTURE_EXT), then r depends on the texture - comparison function as shown in table 3.27." - - -- Section 3.8.15 "Texture Application" - - Change the first paragraph (page 189) to say: - - "Texturing is enabled or disabled using the generic Enable and Disable - commands, respectively, with the symbolic constants TEXTURE_1D, - TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or - TEXTURE_2D_ARRAY_EXT to enable one-, two-, three-dimensional, cube - map, one-dimensional array, or two-dimensional array texture, - respectively. If both two- and one-dimensional textures are enabled, - the two-dimensional texture is used. If the three-dimensional and - either of the two- or one-dimensional textures is enabled, the - three-dimensional texture is used. If the cube map texture and any of - the three-, two-, or one-dimensional textures is enabled, then cube map - texturing is used. If one-dimensional array texture is enabled and any - of cube map, three-, two-, or one-dimensional textures is enabled, - one-dimensional array texturing is used. If two-dimensional array - texture is enabled and any of cube map, three-, two-, one-dimensional - textures or one-dimensional array texture is enabled, two-dimensional - array texturing is used..." - - -- Section 3.11.2 of ARB_fragment_program (Fragment Program Grammar and Restrictions): - - (mostly add to existing grammar rules) - - ::= "MESA_texture_array" - - ::= "1D" - | "2D" - | "3D" - | "CUBE" - | "RECT" - | (if program option is present) - | (if program option is present) - - ::= "ARRAY1D" - | "ARRAY2D" - - ::= "SHADOW1D" - | "SHADOW2D" - | "SHADOWRECT" - | (if program option is present) - - ::= "SHADOWARRAY1D" - | "SHADOWARRAY2D" - - - -- Add Section 3.11.4.5.4 "Texture Stack Option" - - "If a fragment program specifies the "MESA_texture_array" program - option, the rule is modified to add the texture targets - ARRAY1D and ARRAY2D (See Section 3.11.2)." - - -- Section 3.11.6 "Fragment Program Texture Instruction Set" - - (replace 1st and 2nd paragraphs with the following paragraphs) - - "The first three texture instructions described below specify the - mapping of 4-tuple input vectors to 4-tuple output vectors. - The sampling of the texture works as described in section 3.8, - except that texture environments and texture functions are not - applicable, and the texture enables hierarchy is replaced by explicit - references to the desired texture target (i.e., 1D, 2D, 3D, cube map, - rectangle, ARRAY1D, ARRAY2D). These texture instructions specify - how the 4-tuple is mapped into the coordinates used for sampling. The - following function is used to describe the texture sampling in the - descriptions below: - - vec4 TextureSample(vec4 coord, float lodBias, int texImageUnit, - enum texTarget); - - Note that not all four components of the texture coordinates - are used by all texture targets. Component usage for each - is defined in table X. - - coordinates used - texTarget Texture Type s t r layer shadow - ---------------- --------------------- ----- ----- ------ - 1D TEXTURE_1D x - - - - - 2D TEXTURE_2D x y - - - - 3D TEXTURE_3D x y z - - - CUBE TEXTURE_CUBE_MAP x y z - - - RECT TEXTURE_RECTANGLE_ARB x y - - - - ARRAY1D TEXTURE_1D_ARRAY_EXT x - - y - - ARRAY2D TEXTURE_2D_ARRAY_EXT x y - z - - SHADOW1D TEXTURE_1D x - - - z - SHADOW2D TEXTURE_2D x y - - z - SHADOWRECT TEXTURE_RECTANGLE_ARB x y - - z - SHADOWARRAY1D TEXTURE_1D_ARRAY_EXT x - - y z - SHADOWARRAY2D TEXTURE_2D_ARRAY_EXT x y - z w - - Table X: Texture types accessed for each of the , and - coordinate mappings. The "coordinates used" column indicate the - input values used for each coordinate of the texture lookup, the - layer selector for array textures, and the reference value for - texture comparisons." - - -- Section 3.11.6.2 "TXP: Project coordinate and map to color" - - Add to the end of the section: - - "A program will fail to load if the TXP instruction is used in - conjunction with the SHADOWARRAY2D target." - -Additions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment Operations) - - -- Section 4.4.2.3 "Attaching Texture Images to a Framebuffer" - - Add to the end of the section (spec changes identical to - EXT_texture_array): - - "The command - - void FramebufferTextureLayerEXT(enum target, enum attachment, - uint texture, int level, int layer); - - operates identically to FramebufferTexture3DEXT, except that it - attaches a single layer of a three-dimensional texture or a one- or - two-dimensional array texture. is an integer indicating the - layer number, and is treated identically to the parameter in - FramebufferTexture3DEXT. The error INVALID_VALUE is generated if - is negative. The error INVALID_OPERATION is generated if - is non-zero and is not the name of a three dimensional - texture or one- or two-dimensional array texture. Unlike - FramebufferTexture3D, no parameter is accepted. - - If is non-zero and the command does not result in an error, - the framebuffer attachment state corresponding to is - updated as in the other FramebufferTexture commands, except that - FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT is set to ." - - -- Section 4.4.4.1 "Framebuffer Attachment Completeness" - - Add to the end of the list of completeness rules (spec changes - identical to EXT_texture_array): - - "* If FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE and - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT names a one- or - two-dimensional array texture, then - FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT must be smaller than the - number of layers in the texture." - -Additions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions) - - -- Section 5.4 "Display Lists" - - Change the first paragraph on page 242 to say (spec changes - identical to EXT_texture_array): - - "TexImage3D, TexImage2D, TexImage1D, Histogram, and ColorTable are - executed immediately when called with the corresponding proxy arguments - PROXY_TEXTURE_3D or PROXY_TEXTURE_2D_ARRAY_EXT; PROXY_TEXTURE_2D, - PROXY_TEXTURE_CUBE_MAP, or PROXY_TEXTURE_1D_ARRAY_EXT; - PROXY_TEXTURE_1D; PROXY_HISTOGRAM; and PROXY_COLOR_TABLE, - PROXY_POST_CONVOLUTION_COLOR_TABLE, or - PROXY_POST_COLOR_MATRIX_COLOR_TABLE." - -Additions to Chapter 6 of the OpenGL 2.0 Specification (State and State Requests) - - -- Section 6.1.3 "Enumerated Queries" - - Add after the line beginning "If the value of - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE" (spec changes - identical to EXT_texture_array): - - "If is FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT and the - texture object named FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT is a - three-dimensional texture or a one- or two-dimensional array texture, - then will contain the number of texture layer attached to the - attachment point. Otherwise, will contain the value zero." - - -- Section 6.1.4 "Texture Queries" - - Change the first three paragraphs (page 248) to say (spec changes - identical to EXT_texture_array): - - "The command - - void GetTexImage(enum tex, int lod, enum format, - enum type, void *img); - - is used to obtain texture images. It is somewhat different from the - other get commands; tex is a symbolic value indicating which texture - (or texture face in the case of a cube map texture target name) is to - be obtained. TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_1D_ARRAY_EXT, - and TEXTURE_2D_ARRAY_EXT indicate a one-, two-, or three-dimensional - texture, or one- or two-dimensional array texture, respectively. - TEXTURE_CUBE_MAP_POSITIVE_X, ... - - GetTexImage obtains... from the first image to the last for - three-dimensional textures. One- and two-dimensional array textures - are treated as two- and three-dimensional images, respectively, where - the layers are treated as rows or images. These groups are then... - - For three-dimensional and two-dimensional array textures, pixel storage - operations are applied as if the image were two-dimensional, except - that the additional pixel storage state values PACK_IMAGE_HEIGHT and - PACK_SKIP_IMAGES are applied. ..." - -Additions to Appendix A of the OpenGL 2.0 Specification (Invariance) - - None - -Additions to the AGL/GLX/WGL Specifications - - None - -GLX Protocol - - None - -Dependencies on ARB_fragment_program - - If ARB_fragment_program is not supported, the changes to section 3.11 - should be ignored. - -Dependencies on EXT_framebuffer_object - - If EXT_framebuffer_object is not supported, the changes to section - 3.8.8 ("Manual Mipmap Generation"), 4.4.2.3, and 6.1.3 should be ignored. - -Dependencies on EXT_texture_compression_s3tc and NV_texture_compression_vtc - - (Identical dependency as EXT_texture_array.) - - S3TC texture compression is supported for two-dimensional array textures. - When is TEXTURE_2D_ARRAY_EXT, each layer is stored independently - as a compressed two-dimensional textures. When specifying or querying - compressed images using one of the S3TC formats, the images are provided - and/or returned as a series of two-dimensional textures stored - consecutively in memory, with the layer closest to zero specified first. - For array textures, images are not arranged in 4x4x4 or 4x4x2 blocks as in - the three-dimensional compression format provided in the - EXT_texture_compression_vtc extension. Pixel store parameters, including - those specific to three-dimensional images, are ignored when compressed - image data are provided or returned, as in the - EXT_texture_compression_s3tc extension. - - S3TC compression is not supported for one-dimensional texture targets in - EXT_texture_compression_s3tc, and is not supported for one-dimensional - array textures in this extension. If compressed one-dimensional arrays - are needed, use a two-dimensional texture with a height of one. - - This extension allows the use of the four S3TC internal format types in - TexImage3D, CompressedTexImage3D, and CompressedTexSubImage3D calls. - -Errors - - None - -New State - - (add to table 6.15, p. 276) - - Initial - Get Value Type Get Command Value Description Sec. Attribute - ---------------------------- ----- ----------- ----- -------------------- ------ --------- - TEXTURE_BINDING_1D_ARRAY_EXT 2*xZ+ GetIntegerv 0 texture object bound 3.8.12 texture - to TEXTURE_1D_ARRAY - TEXTURE_BINDING_2D_ARRAY_EXT 2*xZ+ GetIntegerv 0 texture object bound 3.8.12 texture - to TEXTURE_2D_ARRAY - - -New Implementation Dependent State - - (add to Table 6.32, p. 293) - - Minimum - Get Value Type Get Command Value Description Sec. Attribute - ---------------------------- ---- ----------- ------- ------------------ ----- --------- - MAX_TEXTURE_ARRAY_LAYERS_EXT Z+ GetIntegerv 64 maximum number of 3.8.1 - - layers for texture - arrays - -Issues - - (1) Is "texture stack" a good name for this functionality? - - NO. The name is changed to "array texture" to match the - nomenclature used by GL_EXT_texture_array. - - (2) Should the R texture coordinate be treated as normalized or - un-normalized? If it were un-normalized, floor(R) could be thought - of as a direct index into the array texture. This may be more - convenient for applications. - - RESOLVED. All texture coordinates are normalized. The issue of - un-normalized texture coordinates has been discussed in the ARB - before and should be left for a layered extension. - - RE-RESOLVED. The R coordinate is un-normalized. Accessing an array - using [0, layers-1] coordinates is much more natural. - - (3) How does LOD selection work for stacked textures? - - RESOLVED. For 2D array textures the R coordinate is ignored, and - the LOD selection equations for 2D textures are used. For 1D - array textures the T coordinate is ignored, and the LOD selection - equations for 1D textures are used. The expected usage is in a - fragment program with an explicit LOD selection. - - (4) What is the maximum size of a 2D array texture? Is it the same - as for a 3D texture, or should a new query be added? How about for 1D - array textures? - - RESOLVED. A new query is added. - - (5) How are array textures exposed in GLSL? - - RESOLVED. Use GL_EXT_texture_array. - - (6) Should a 1D array texture also be exposed? - - RESOLVED. For orthogonality, yes. - - (7) How are stacked textures attached to framebuffer objects? - - RESOLVED. Layers of both one- and two-dimensional array textures - are attached using FreambufferTextureLayerEXT. Once attached, the - array texture layer behaves exactly as either a one- or - two-dimensional texture. - - (8) How is this extension related to GL_EXT_texture_array? - - This extension adapats GL_MESAX_texture_stack to the notation, - indexing, and FBO access of GL_EXT_texture_array. This extension - replaces the GLSL support of GL_EXT_texture_array with - GL_ARB_fragment_program support. - - Assembly program support is also provided by GL_NV_gpu_program4. - GL_NV_gpu_program4 also adds support for other features that are - specific to Nvidia hardware, while this extension adds only support - for array textures. - - Much of text of this extension that has changed since - GL_MESAX_texture_stack comes directly from either - GL_EXT_texture_array or GL_NV_gpu_program4. - -Revision History - - ||2005/11/15||0.1||idr||Initial draft MESAX version.|| - ||2005/12/07||0.2||idr||Added framebuffer object interactions.|| - ||2005/12/12||0.3||idr||Updated fragment program interactions.|| - ||2007/05/16||0.4||idr||Converted to MESA_texture_array. Brought in line with EXT_texture_array and NV_gpu_program4.|| +Name + + MESA_texture_array + +Name Strings + + GL_MESA_texture_array + +Contact + + Ian Romanick, IBM (idr 'at' us.ibm.com) + +IP Status + + No known IP issues. + +Status + + Shipping in Mesa 7.1 + +Version + + +Number + + TBD + +Dependencies + + OpenGL 1.2 or GL_EXT_texture3D is required. + + Support for ARB_fragment_program is assumed, but not required. + + Support for ARB_fragment_program_shadow is assumed, but not required. + + Support for EXT_framebuffer_object is assumed, but not required. + + Written based on the wording of the OpenGL 2.0 specification and + ARB_fragment_program_shadow but not dependent on them. + +Overview + + There are a number of circumstances where an application may wish to + blend two textures out of a larger set of textures. Moreover, in some + cases the selected textures may vary on a per-fragment basis within + a polygon. Several examples include: + + 1. High dynamic range textures. The application stores several + different "exposures" of an image as different textures. On a + per-fragment basis, the application selects which exposures are + used. + + 2. A terrain engine where the altitude of a point determines the + texture applied to it. If the transition is from beach sand to + grass to rocks to snow, the application will store each texture + in a different texture map, and dynamically select which two + textures to blend at run-time. + + 3. Storing short video clips in textures. Each depth slice is a + single frame of video. + + Several solutions to this problem have been proposed, but they either + involve using a separate texture unit for each texture map or using 3D + textures without mipmaps. Both of these options have major drawbacks. + + This extension provides a third alternative that eliminates the major + drawbacks of both previous methods. A new texture target, + TEXTURE_2D_ARRAY, is added that functions identically to TEXTURE_3D in + all aspects except the sizes of the non-base level images. In + traditional 3D texturing, the size of the N+1 LOD is half the size + of the N LOD in all three dimensions. For the TEXTURE_2D_ARRAY target, + the height and width of the N+1 LOD is halved, but the depth is the + same for all levels of detail. The texture then becomes an array of + 2D textures. The per-fragment texel is selected by the R texture + coordinate. + + References: + + http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011557 + http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=000516 + http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011903 + http://www.delphi3d.net/articles/viewarticle.php?article=terraintex.htm + +New Procedures and Functions + + All functions come directly from EXT_texture_array. + + void FramebufferTextureLayerEXT(enum target, enum attachment, + uint texture, int level, int layer); + +New Tokens + + All token names and values come directly from EXT_texture_array. + + Accepted by the parameter of Enable, Disable, and IsEnabled, by + the parameter of GetBooleanv, GetIntegerv, GetFloatv, and + GetDoublev, and by the parameter of TexImage3D, GetTexImage, + GetTexLevelParameteriv, GetTexLevelParameterfv, GetTexParameteriv, and + GetTexParameterfv: + + TEXTURE_1D_ARRAY_EXT 0x8C18 + TEXTURE_2D_ARRAY_EXT 0x8C1A + + Accepted by the parameter of TexImage2D, TexSubImage2D, + CopyTexImage2D, CopyTexSubImage2D, CompressedTexImage2D, + CompressedTexSubImage2D, GetTexLevelParameteriv, and + GetTexLevelParameterfv: + + TEXTURE_1D_ARRAY_EXT + PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 + + Accepted by the parameter of TexImage3D, TexSubImage3D, + CopyTexSubImage3D, CompressedTexImage3D, CompressedTexSubImage3D, + GetTexLevelParameteriv, and GetTexLevelParameterfv: + + TEXTURE_2D_ARRAY_EXT + PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B + + Accepted by the parameter of GetBooleanv, GetIntegerv, + GetFloatv, and GetDoublev + + TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C + TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D + MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF + + Accepted by the parameter of TexParameterf, TexParameteri, + TexParameterfv, and TexParameteriv when the parameter is + TEXTURE_COMPARE_MODE_ARB: + + COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E + + (Note: COMPARE_REF_DEPTH_TO_TEXTURE_EXT is simply an alias for the + existing COMPARE_R_TO_TEXTURE token in OpenGL 2.0; the alternate name + reflects the fact that the R coordinate is not always used.) + + Accepted by the parameter of TexImage3D and + CompressedTexImage3D, and by the parameter of + CompressedTexSubImage3D: + + COMPRESSED_RGB_S3TC_DXT1_EXT + COMPRESSED_RGBA_S3TC_DXT1_EXT + COMPRESSED_RGBA_S3TC_DXT3_EXT + COMPRESSED_RGBA_S3TC_DXT5_EXT + + Accepted by the parameter of + GetFramebufferAttachmentParameterivEXT: + + FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 + + (Note: FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER is simply an alias for the + FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT token provided in + EXT_framebuffer_object. This extension generalizes the notion of + "" to include layers of an array texture.) + +Additions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation) + + None + +Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization) + + -- Section 3.8.1 "Texture Image Specification" + + Change the first paragraph (page 150) to say (spec changes identical to + EXT_texture_array): + + "The command + + void TexImage3D(enum target, int level, int internalformat, + sizei width, sizei height, sizei depth, int border, + enum format, enum type, void *data); + + is used to specify a three-dimensional texture image. target must be one + one of TEXTURE_3D for a three-dimensional texture or + TEXTURE_2D_ARRAY_EXT for an two-dimensional array texture. + Additionally, target may be either PROXY_TEXTURE_3D for a + three-dimensional proxy texture, or PROXY_TEXTURE_2D_ARRAY_EXT for a + two-dimensional proxy array texture." + + Change the fourth paragraph on page 151 to say (spec changes identical + to EXT_texture_array): + + "Textures with a base internal format of DEPTH_COMPONENT are supported + by texture image specification commands only if target is TEXTURE_1D, + TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, TEXTURE_2D_ARRAY_EXT, + PROXY_TEXTURE_1D, PROXY_TEXTURE_2D, PROXY_TEXTURE_1D_ARRAY_EXT, or + PROXY_TEXTURE_2D_ARRAY_EXT. Using this format in conjunction with any + other target will result in an INVALID_OPERATION error." + + + Change the fourth paragraph on page 156 to say (spec changes identical + to EXT_texture_array): + + "The command + + void TexImage2D(enum target, int level, + int internalformat, sizei width, sizei height, + int border, enum format, enum type, void *data); + + is used to specify a two-dimensional texture image. target must be one + of TEXTURE_2D for a two-dimensional texture, TEXTURE_1D_ARRAY_EXT for a + one-dimensional array texture, or one of TEXTURE_CUBE_MAP_POSITIVE_X, + TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE_MAP_POSITIVE_Y, + TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, or + TEXTURE_CUBE_MAP_NEGATIVE_Z for a cube map texture. Additionally, + target may be either PROXY_TEXTURE_2D for a two-dimensional proxy + texture, PROXY_TEXTURE_1D_ARRAY_EXT for a one-dimensional proxy array + texture, or PROXY TEXTURE_CUBE_MAP for a cube map proxy texture in the + special case discussed in section 3.8.11. The other parameters match + the corresponding parameters of TexImage3D. + + For the purposes of decoding the texture image, TexImage2D is + equivalent to calling TexImage3D with corresponding arguments and depth + of 1, except that + + * The border depth, d_b, is zero, and the depth of the image is + always 1 regardless of the value of border. + + * The border height, h_b, is zero if is + TEXTURE_1D_ARRAY_EXT, and otherwise. + + * Convolution will be performed on the image (possibly changing its + width and height) if SEPARABLE 2D or CONVOLUTION 2D is enabled. + + * UNPACK SKIP IMAGES is ignored." + + -- Section 3.8.2 "Alternate Texture Image Specification Commands" + + Change the second paragraph (page 159) (spec changes identical + to EXT_texture_array): + + "The command + + void CopyTexImage2D(enum target, int level, + enum internalformat, int x, int y, sizei width, + sizei height, int border); + + defines a two-dimensional texture image in exactly the manner of + TexImage2D, except that the image data are taken from the framebuffer + rather than from client memory. Currently, target must be one of + TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, TEXTURE_CUBE_MAP_POSITIVE_X, + TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE MAP_POSITIVE_Y, + TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, or + TEXTURE_CUBE_MAP_NEGATIVE_Z. + + + Change the last paragraph on page 160 to say (spec changes identical + to EXT_texture_array): + + "Currently the target arguments of TexSubImage1D and CopyTexSubImage1D + must be TEXTURE_1D, the target arguments of TexSubImage2D and + CopyTexSubImage2D must be one of TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, + TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_X, + TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_NEGATIVE_Y, + TEXTURE_CUBE_MAP_POSITIVE_Z, or TEXTURE_CUBE_MAP_NEGATIVE_Z, and the + target arguments of TexSubImage3D and CopyTexSubImage3D must be + TEXTURE_3D or TEXTURE_2D_ARRAY_EXT. ..." + + + -- Section 3.8.4 "Texture Parameters" + + Change the first paragraph (page 166) to say: + + "Various parameters control how the texel array is treated when + specified or changed, and when applied to a fragment. Each parameter is + set by calling + + void TexParameter{if}(enum target, enum pname, T param); + void TexParameter{if}v(enum target, enum pname, T params); + + target is the target, either TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, + TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT." + + + -- Section 3.8.8 "Texture Minification" in the section "Scale Factor and Level of Detail" + + Change the first paragraph (page 172) to say: + + "Let s(x,y) be the function that associates an s texture coordinate + with each set of window coordinates (x,y) that lie within a primitive; + define t(x,y) and r(x,y) analogously. Let u(x,y) = w_t * s(x,y), + v(x,y) = h_t * t(x,y), and w(x,y) = d_t * r(x,y), where w_t, h_t, + and d_t are as defined by equations 3.15, 3.16, and 3.17 with + w_s, h_s, and d_s equal to the width, height, and depth of the + image array whose level is level_base. For a one-dimensional + texture or a one-dimensional array texture, define v(x,y) = 0 and + w(x,y) = 0; for a two-dimensional texture or a two-dimensional array + texture, define w(x,y) = 0..." + + -- Section 3.8.8 "Texture Minification" in the section "Mipmapping" + + Change the third paragraph (page 174) to say: + + "For a two-dimensional texture, two-dimensional array texture, or + cube map texture," + + Change the fourth paragraph (page 174) to say: + + "And for a one-dimensional texture or a one-dimensional array texture," + + After the first paragraph (page 175) add: + + "For one-dimensional array textures, h_b and d_b are treated as 1, + regardless of the actual values, when performing mipmap calculations. + For two-dimensional array textures, d_b is always treated as one, + regardless of the actual value, when performing mipmap calculations." + + -- Section 3.8.8 "Automatic Mipmap Generation" in the section "Mipmapping" + + Change the third paragraph (page 176) to say (spec changes identical + to EXT_texture_array): + + "The contents of the derived arrays are computed by repeated, filtered + reduction of the level_base array. For one- and two-dimensional array + textures, each layer is filtered independently. ..." + + -- Section 3.8.8 "Manual Mipmap Generation" in the section "Mipmapping" + + Change first paragraph to say (spec changes identical to + EXT_texture_array): + + "Mipmaps can be generated manually with the command + + void GenerateMipmapEXT(enum target); + + where is one of TEXTURE_1D, TEXTURE_2D, TEXTURE_CUBE_MAP, + TEXTURE_3D, TEXTURE_1D_ARRAY, or TEXTURE_2D_ARRAY. Mipmap generation + affects the texture image attached to . ..." + + -- Section 3.8.10 "Texture Completeness" + + Change the second paragraph (page 177) to say (spec changes identical + to EXT_texture_array): + + "For one-, two-, or three-dimensional textures and one- or + two-dimensional array textures, a texture is complete if the following + conditions all hold true:" + + -- Section 3.8.11 "Texture State and Proxy State" + + Change the second and third paragraphs (page 179) to say (spec changes + identical to EXT_texture_array): + + "In addition to image arrays for one-, two-, and three-dimensional + textures, one- and two-dimensional array textures, and the six image + arrays for the cube map texture, partially instantiated image arrays + are maintained for one-, two-, and three-dimensional textures and one- + and two-dimensional array textures. Additionally, a single proxy image + array is maintained for the cube map texture. Each proxy image array + includes width, height, depth, border width, and internal format state + values, as well as state for the red, green, blue, alpha, luminance, + and intensity component resolutions. Proxy image arrays do not include + image data, nor do they include texture properties. When TexImage3D is + executed with target specified as PROXY_TEXTURE_3D, the + three-dimensional proxy state values of the specified level-of-detail + are recomputed and updated. If the image array would not be supported + by TexImage3D called with target set to TEXTURE 3D, no error is + generated, but the proxy width, height, depth, border width, and + component resolutions are set to zero. If the image array would be + supported by such a call to TexImage3D, the proxy state values are set + exactly as though the actual image array were being specified. No pixel + data are transferred or processed in either case. + + Proxy arrays for one- and two-dimensional textures and one- and + two-dimensional array textures are operated on in the same way when + TexImage1D is executed with target specified as PROXY_TEXTURE_1D, + TexImage2D is executed with target specified as PROXY_TEXTURE_2D or + PROXY_TEXTURE_1D_ARRAY_EXT, or TexImage3D is executed with target + specified as PROXY_TETXURE_2D_ARRAY_EXT." + + -- Section 3.8.12 "Texture Objects" + + Change section (page 180) to say (spec changes identical to + EXT_texture_array): + + "In addition to the default textures TEXTURE_1D, TEXTURE_2D, + TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and TEXTURE_2D_EXT, + named one-, two-, and three-dimensional, cube map, and one- and + two-dimensional array texture objects can be created and operated upon. + The name space for texture objects is the unsigned integers, with zero + reserved by the GL. + + A texture object is created by binding an unused name to TEXTURE_1D, + TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or + TEXTURE_2D_ARRAY_EXT. The binding is effected by calling + + void BindTexture(enum target, uint texture); + + with set to the desired texture target and set to + the unused name. The resulting texture object is a new state vector, + comprising all the state values listed in section 3.8.11, set to the + same initial values. If the new texture object is bound to TEXTURE_1D, + TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or + TEXTURE_2D_ARRAY_EXT, it is and remains a one-, two-, + three-dimensional, cube map, one- or two-dimensional array texture + respectively until it is deleted. + + BindTexture may also be used to bind an existing texture object to + either TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, + TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT. The error + INVALID_OPERATION is generated if an attempt is made to bind a texture + object of different dimensionality than the specified target. If the + bind is successful no change is made to the state of the bound texture + object, and any previous binding to target is broken. + + While a texture object is bound, GL operations on the target to which + it is bound affect the bound object, and queries of the target to which + it is bound return state from the bound object. If texture mapping of + the dimensionality of the target to which a texture object is bound is + enabled, the state of the bound texture object directs the texturing + operation. + + In the initial state, TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, + TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and TEXTURE_2D_ARRAY_EXT have + one-, two-, three-dimensional, cube map, and one- and two-dimensional + array texture state vectors respectively associated with them. In order + that access to these initial textures not be lost, they are treated as + texture objects all of whose names are 0. The initial one-, two-, + three-dimensional, cube map, one- and two-dimensional array textures + are therefore operated upon, queried, and applied as TEXTURE_1D, + TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and + TEXTURE_2D_ARRAY_EXT respectively while 0 is bound to the corresponding + targets. + + Change second paragraph on page 181 to say (spec changes identical to + EXT_texture_array): + + "... If a texture that is currently bound to one of the targets + TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, + TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT is deleted, it is as + though BindTexture had been executed with the same target and texture + zero. ..." + + Change second paragraph on page 182 to say (spec changes identical to + EXT_texture_array): + + "The texture object name space, including the initial one-, two-, and + three dimensional, cube map, and one- and two-dimensional array texture + objects, is shared among all texture units. ..." + + + -- Section 3.8.14 "Depth Texture Comparison Modes" in "Texture Comparison Modes" + + Change second through fourth paragraphs (page 188) to say: + + "Let D_t be the depth texture value, in the range [0, 1]. For + texture lookups from one- and two-dimensional, rectangle, and + one-dimensional array targets, let R be the interpolated + texture coordinate, clamped to the range [0, 1]. For texture lookups + from two-dimensional array texture targets, let R be the interpolated + texture coordinate, clamped to the range [0, 1]. Then the + effective texture value L_t, I_t, or A_t is computed as follows: + + If the value of TEXTURE_COMPARE_MODE is NONE, then + + r = Dt + + If the value of TEXTURE_COMPARE_MODE is + COMPARE_REF_DEPTH_TO_TEXTURE_EXT), then r depends on the texture + comparison function as shown in table 3.27." + + -- Section 3.8.15 "Texture Application" + + Change the first paragraph (page 189) to say: + + "Texturing is enabled or disabled using the generic Enable and Disable + commands, respectively, with the symbolic constants TEXTURE_1D, + TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or + TEXTURE_2D_ARRAY_EXT to enable one-, two-, three-dimensional, cube + map, one-dimensional array, or two-dimensional array texture, + respectively. If both two- and one-dimensional textures are enabled, + the two-dimensional texture is used. If the three-dimensional and + either of the two- or one-dimensional textures is enabled, the + three-dimensional texture is used. If the cube map texture and any of + the three-, two-, or one-dimensional textures is enabled, then cube map + texturing is used. If one-dimensional array texture is enabled and any + of cube map, three-, two-, or one-dimensional textures is enabled, + one-dimensional array texturing is used. If two-dimensional array + texture is enabled and any of cube map, three-, two-, one-dimensional + textures or one-dimensional array texture is enabled, two-dimensional + array texturing is used..." + + -- Section 3.11.2 of ARB_fragment_program (Fragment Program Grammar and Restrictions): + + (mostly add to existing grammar rules) + + ::= "MESA_texture_array" + + ::= "1D" + | "2D" + | "3D" + | "CUBE" + | "RECT" + | (if program option is present) + | (if program option is present) + + ::= "ARRAY1D" + | "ARRAY2D" + + ::= "SHADOW1D" + | "SHADOW2D" + | "SHADOWRECT" + | (if program option is present) + + ::= "SHADOWARRAY1D" + | "SHADOWARRAY2D" + + + -- Add Section 3.11.4.5.4 "Texture Stack Option" + + "If a fragment program specifies the "MESA_texture_array" program + option, the rule is modified to add the texture targets + ARRAY1D and ARRAY2D (See Section 3.11.2)." + + -- Section 3.11.6 "Fragment Program Texture Instruction Set" + + (replace 1st and 2nd paragraphs with the following paragraphs) + + "The first three texture instructions described below specify the + mapping of 4-tuple input vectors to 4-tuple output vectors. + The sampling of the texture works as described in section 3.8, + except that texture environments and texture functions are not + applicable, and the texture enables hierarchy is replaced by explicit + references to the desired texture target (i.e., 1D, 2D, 3D, cube map, + rectangle, ARRAY1D, ARRAY2D). These texture instructions specify + how the 4-tuple is mapped into the coordinates used for sampling. The + following function is used to describe the texture sampling in the + descriptions below: + + vec4 TextureSample(vec4 coord, float lodBias, int texImageUnit, + enum texTarget); + + Note that not all four components of the texture coordinates + are used by all texture targets. Component usage for each + is defined in table X. + + coordinates used + texTarget Texture Type s t r layer shadow + ---------------- --------------------- ----- ----- ------ + 1D TEXTURE_1D x - - - - + 2D TEXTURE_2D x y - - - + 3D TEXTURE_3D x y z - - + CUBE TEXTURE_CUBE_MAP x y z - - + RECT TEXTURE_RECTANGLE_ARB x y - - - + ARRAY1D TEXTURE_1D_ARRAY_EXT x - - y - + ARRAY2D TEXTURE_2D_ARRAY_EXT x y - z - + SHADOW1D TEXTURE_1D x - - - z + SHADOW2D TEXTURE_2D x y - - z + SHADOWRECT TEXTURE_RECTANGLE_ARB x y - - z + SHADOWARRAY1D TEXTURE_1D_ARRAY_EXT x - - y z + SHADOWARRAY2D TEXTURE_2D_ARRAY_EXT x y - z w + + Table X: Texture types accessed for each of the , and + coordinate mappings. The "coordinates used" column indicate the + input values used for each coordinate of the texture lookup, the + layer selector for array textures, and the reference value for + texture comparisons." + + -- Section 3.11.6.2 "TXP: Project coordinate and map to color" + + Add to the end of the section: + + "A program will fail to load if the TXP instruction is used in + conjunction with the SHADOWARRAY2D target." + +Additions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment Operations) + + -- Section 4.4.2.3 "Attaching Texture Images to a Framebuffer" + + Add to the end of the section (spec changes identical to + EXT_texture_array): + + "The command + + void FramebufferTextureLayerEXT(enum target, enum attachment, + uint texture, int level, int layer); + + operates identically to FramebufferTexture3DEXT, except that it + attaches a single layer of a three-dimensional texture or a one- or + two-dimensional array texture. is an integer indicating the + layer number, and is treated identically to the parameter in + FramebufferTexture3DEXT. The error INVALID_VALUE is generated if + is negative. The error INVALID_OPERATION is generated if + is non-zero and is not the name of a three dimensional + texture or one- or two-dimensional array texture. Unlike + FramebufferTexture3D, no parameter is accepted. + + If is non-zero and the command does not result in an error, + the framebuffer attachment state corresponding to is + updated as in the other FramebufferTexture commands, except that + FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT is set to ." + + -- Section 4.4.4.1 "Framebuffer Attachment Completeness" + + Add to the end of the list of completeness rules (spec changes + identical to EXT_texture_array): + + "* If FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE and + FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT names a one- or + two-dimensional array texture, then + FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT must be smaller than the + number of layers in the texture." + +Additions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions) + + -- Section 5.4 "Display Lists" + + Change the first paragraph on page 242 to say (spec changes + identical to EXT_texture_array): + + "TexImage3D, TexImage2D, TexImage1D, Histogram, and ColorTable are + executed immediately when called with the corresponding proxy arguments + PROXY_TEXTURE_3D or PROXY_TEXTURE_2D_ARRAY_EXT; PROXY_TEXTURE_2D, + PROXY_TEXTURE_CUBE_MAP, or PROXY_TEXTURE_1D_ARRAY_EXT; + PROXY_TEXTURE_1D; PROXY_HISTOGRAM; and PROXY_COLOR_TABLE, + PROXY_POST_CONVOLUTION_COLOR_TABLE, or + PROXY_POST_COLOR_MATRIX_COLOR_TABLE." + +Additions to Chapter 6 of the OpenGL 2.0 Specification (State and State Requests) + + -- Section 6.1.3 "Enumerated Queries" + + Add after the line beginning "If the value of + FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE" (spec changes + identical to EXT_texture_array): + + "If is FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT and the + texture object named FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT is a + three-dimensional texture or a one- or two-dimensional array texture, + then will contain the number of texture layer attached to the + attachment point. Otherwise, will contain the value zero." + + -- Section 6.1.4 "Texture Queries" + + Change the first three paragraphs (page 248) to say (spec changes + identical to EXT_texture_array): + + "The command + + void GetTexImage(enum tex, int lod, enum format, + enum type, void *img); + + is used to obtain texture images. It is somewhat different from the + other get commands; tex is a symbolic value indicating which texture + (or texture face in the case of a cube map texture target name) is to + be obtained. TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_1D_ARRAY_EXT, + and TEXTURE_2D_ARRAY_EXT indicate a one-, two-, or three-dimensional + texture, or one- or two-dimensional array texture, respectively. + TEXTURE_CUBE_MAP_POSITIVE_X, ... + + GetTexImage obtains... from the first image to the last for + three-dimensional textures. One- and two-dimensional array textures + are treated as two- and three-dimensional images, respectively, where + the layers are treated as rows or images. These groups are then... + + For three-dimensional and two-dimensional array textures, pixel storage + operations are applied as if the image were two-dimensional, except + that the additional pixel storage state values PACK_IMAGE_HEIGHT and + PACK_SKIP_IMAGES are applied. ..." + +Additions to Appendix A of the OpenGL 2.0 Specification (Invariance) + + None + +Additions to the AGL/GLX/WGL Specifications + + None + +GLX Protocol + + None + +Dependencies on ARB_fragment_program + + If ARB_fragment_program is not supported, the changes to section 3.11 + should be ignored. + +Dependencies on EXT_framebuffer_object + + If EXT_framebuffer_object is not supported, the changes to section + 3.8.8 ("Manual Mipmap Generation"), 4.4.2.3, and 6.1.3 should be ignored. + +Dependencies on EXT_texture_compression_s3tc and NV_texture_compression_vtc + + (Identical dependency as EXT_texture_array.) + + S3TC texture compression is supported for two-dimensional array textures. + When is TEXTURE_2D_ARRAY_EXT, each layer is stored independently + as a compressed two-dimensional textures. When specifying or querying + compressed images using one of the S3TC formats, the images are provided + and/or returned as a series of two-dimensional textures stored + consecutively in memory, with the layer closest to zero specified first. + For array textures, images are not arranged in 4x4x4 or 4x4x2 blocks as in + the three-dimensional compression format provided in the + EXT_texture_compression_vtc extension. Pixel store parameters, including + those specific to three-dimensional images, are ignored when compressed + image data are provided or returned, as in the + EXT_texture_compression_s3tc extension. + + S3TC compression is not supported for one-dimensional texture targets in + EXT_texture_compression_s3tc, and is not supported for one-dimensional + array textures in this extension. If compressed one-dimensional arrays + are needed, use a two-dimensional texture with a height of one. + + This extension allows the use of the four S3TC internal format types in + TexImage3D, CompressedTexImage3D, and CompressedTexSubImage3D calls. + +Errors + + None + +New State + + (add to table 6.15, p. 276) + + Initial + Get Value Type Get Command Value Description Sec. Attribute + ---------------------------- ----- ----------- ----- -------------------- ------ --------- + TEXTURE_BINDING_1D_ARRAY_EXT 2*xZ+ GetIntegerv 0 texture object bound 3.8.12 texture + to TEXTURE_1D_ARRAY + TEXTURE_BINDING_2D_ARRAY_EXT 2*xZ+ GetIntegerv 0 texture object bound 3.8.12 texture + to TEXTURE_2D_ARRAY + + +New Implementation Dependent State + + (add to Table 6.32, p. 293) + + Minimum + Get Value Type Get Command Value Description Sec. Attribute + ---------------------------- ---- ----------- ------- ------------------ ----- --------- + MAX_TEXTURE_ARRAY_LAYERS_EXT Z+ GetIntegerv 64 maximum number of 3.8.1 - + layers for texture + arrays + +Issues + + (1) Is "texture stack" a good name for this functionality? + + NO. The name is changed to "array texture" to match the + nomenclature used by GL_EXT_texture_array. + + (2) Should the R texture coordinate be treated as normalized or + un-normalized? If it were un-normalized, floor(R) could be thought + of as a direct index into the array texture. This may be more + convenient for applications. + + RESOLVED. All texture coordinates are normalized. The issue of + un-normalized texture coordinates has been discussed in the ARB + before and should be left for a layered extension. + + RE-RESOLVED. The R coordinate is un-normalized. Accessing an array + using [0, layers-1] coordinates is much more natural. + + (3) How does LOD selection work for stacked textures? + + RESOLVED. For 2D array textures the R coordinate is ignored, and + the LOD selection equations for 2D textures are used. For 1D + array textures the T coordinate is ignored, and the LOD selection + equations for 1D textures are used. The expected usage is in a + fragment program with an explicit LOD selection. + + (4) What is the maximum size of a 2D array texture? Is it the same + as for a 3D texture, or should a new query be added? How about for 1D + array textures? + + RESOLVED. A new query is added. + + (5) How are array textures exposed in GLSL? + + RESOLVED. Use GL_EXT_texture_array. + + (6) Should a 1D array texture also be exposed? + + RESOLVED. For orthogonality, yes. + + (7) How are stacked textures attached to framebuffer objects? + + RESOLVED. Layers of both one- and two-dimensional array textures + are attached using FreambufferTextureLayerEXT. Once attached, the + array texture layer behaves exactly as either a one- or + two-dimensional texture. + + (8) How is this extension related to GL_EXT_texture_array? + + This extension adapats GL_MESAX_texture_stack to the notation, + indexing, and FBO access of GL_EXT_texture_array. This extension + replaces the GLSL support of GL_EXT_texture_array with + GL_ARB_fragment_program support. + + Assembly program support is also provided by GL_NV_gpu_program4. + GL_NV_gpu_program4 also adds support for other features that are + specific to Nvidia hardware, while this extension adds only support + for array textures. + + Much of text of this extension that has changed since + GL_MESAX_texture_stack comes directly from either + GL_EXT_texture_array or GL_NV_gpu_program4. + +Revision History + + ||2005/11/15||0.1||idr||Initial draft MESAX version.|| + ||2005/12/07||0.2||idr||Added framebuffer object interactions.|| + ||2005/12/12||0.3||idr||Updated fragment program interactions.|| + ||2007/05/16||0.4||idr||Converted to MESA_texture_array. Brought in line with EXT_texture_array and NV_gpu_program4.|| diff --git a/mesalib/docs/MESA_texture_signed_rgba.spec b/mesalib/docs/MESA_texture_signed_rgba.spec index bcc4d4203..e3a6b59af 100644 --- a/mesalib/docs/MESA_texture_signed_rgba.spec +++ b/mesalib/docs/MESA_texture_signed_rgba.spec @@ -1,214 +1,214 @@ -Name - - MESA_texture_signed_rgba - -Name Strings - - GL_MESA_texture_signed_rgba - -Contact - - - -Notice - - - -IP Status - - No known IP issues - -Status - - - -Version - - 0.3, 2009-03-24 - -Number - - Not assigned ? - -Dependencies - - Written based on the wording of the OpenGL 2.0 specification. - - This extension trivially interacts with ARB_texture_float. - This extension shares some language with ARB_texture_compression_rgtc - but does not depend on it. - -Overview - - OpenGL prior to 3.1 does not support any signed texture formats. - ARB_texture_compression_rgtc introduces some compressed red and - red_green signed formats but no uncompressed ones, which might - still be useful. NV_texture_shader adds signed texture formats, - but also a lot of functionality which has been superseded by fragment - shaders. - It is usually possible to get the same functionality - using a unsigned format by doing scale and bias in a shader, but this - is undesirable since modern hardware has direct support for this. - This extension adds a signed 4-channel texture format by backporting - the relevant features from OpenGL 3.1, as a means to support this in - OpenGL implementations only supporting older versions. - -Issues - - 1) What should this extension be called? - - RESOLVED: MESA_texture_signed_rgba seems reasonable. - The rgba part is there because only 4 channel format is supported. - - - 2) Should the full set of signed formats (alpha, luminance, rgb, etc.) - be supported? - - RESOLVED: NO. To keep this extension simple, only add the most - universal format, rgba. alpha/luminance can't be trivially supported - since OpenGL 3.1 does not support them any longer, and there is some - implied dependency on ARB_texture_rg for red/red_green formats so - avoid all this. Likewise, only 8 bits per channel is supported. - - - 3) Should this extension use new enums for the texture formats? - - RESOLVED: NO. Same enums as those used in OpenGL 3.1. - - - 4) How are signed integer values mapped to floating-point values? - - RESOLVED: Same as described in issue 5) of - ARB_texture_compression_rgtc (quote): - A signed 8-bit two's complement value X is computed to - a floating-point value Xf with the formula: - - { X / 127.0, X > -128 - Xf = { - { -1.0, X == -128 - - This conversion means -1, 0, and +1 are all exactly representable, - however -128 and -127 both map to -1.0. Mapping -128 to -1.0 - avoids the numerical awkwardness of have a representable value - slightly more negative than -1.0. - - This conversion is intentionally NOT the "byte" conversion listed - in Table 2.9 for component conversions. That conversion says: - - Xf = (2*X + 1) / 255.0 - - The Table 2.9 conversion is incapable of exactly representing - zero. - - (Difference to ARB_texture_compression_rgtc): - This is the same mapping as OpenGL 3.1 uses. - This is also different to what NV_texture_shader used. - The above mapping should be considered the reference, but there - is some leeway so other mappings are allowed for implementations which - cannot do this. Particularly the mapping given in NV_texture_shader or - the standard OpenGL byte/float mapping is considered acceptable too, as - might be a mapping which represents -1.0 by -128, 0.0 by 0 and 1.0 by - 127 (that is, uses different scale factors for negative and positive - numbers). - Also, it is ok to store incoming GL_BYTE user data as-is, without - converting to GL_FLOAT (using the standard OpenGL float/byte mapping) - and converting back (using the mapping described here). - Other than those subtle issues there are no other non-standard - conversions used, so when using for instance CopyTexImage2D with - a framebuffer clamped to [0,1] all converted numbers will be in the range - [0, 127] (and not scaled and biased). - - - 5) How will signed components resulting from RGBA8_SNORM texture - fetches interact with fragment coloring? - - RESOLVED: Same as described in issue 6) of - ARB_texture_compression_rgtc (quote): - The specification language for this extension is silent - about clamping behavior leaving this to the core specification - and other extensions. The clamping or lack of clamping is left - to the core specification and other extensions. - - For assembly program extensions supporting texture fetches - (ARB_fragment_program, NV_fragment_program, NV_vertex_program3, - etc.) or the OpenGL Shading Language, these signed formats will - appear as expected with unclamped signed components as a result - of a texture fetch instruction. - - If ARB_color_buffer_float is supported, its clamping controls - will apply. - - NV_texture_shader extension, if supported, adds support for - fixed-point textures with signed components and relaxed the - fixed-function texture environment clamping appropriately. If the - NV_texture_shader extension is supported, its specified behavior - for the texture environment applies where intermediate values - are clamped to [-1,1] unless stated otherwise as in the case - of explicitly clamped to [0,1] for GL_COMBINE. or clamping the - linear interpolation weight to [0,1] for GL_DECAL and GL_BLEND. - - Otherwise, the conventional core texture environment clamps - incoming, intermediate, and output color components to [0,1]. - - This implies that the conventional texture environment - functionality of unextended OpenGL 1.5 or OpenGL 2.0 without - using GLSL (and with none of the extensions referred to above) - is unable to make proper use of the signed texture formats added - by this extension because the conventional texture environment - requires texture source colors to be clamped to [0,1]. Texture - filtering of these signed formats would be still signed, but - negative values generated post-filtering would be clamped to - zero by the core texture environment functionality. The - expectation is clearly that this extension would be co-implemented - with one of the previously referred to extensions or used with - GLSL for the new signed formats to be useful. - - - 6) Should the RGBA_SNORM tokens also be accepted by CopyTexImage - functions? - - RESOLVED: YES. - - - 7) What to do with GetTexParameter if ARB_texture_float is supported, - in particular what datatype should this return for TEXTURE_RED_TYPE_ARB, - TEXTURE_GREEN_TYPE_ARB, TEXTURE_BLUE_TYPE_ARB, TEXTURE_ALPHA_TYPE_ARB? - - RESOLVED: ARB_texture_float states type is either NONE, - UNSIGNED_NORMALIZED_ARB, or FLOAT. This extension adds a new enum, - SIGNED_NORMALIZED, which will be returned accordingly. This is the - same behaviour as in OpenGL 3.1. - - -New Tokens - - - Accepted by the parameter of - TexImage1D, TexImage2D, TexImage3D, CopyTexImage1D, and CopyTexImage2D: - - RGBA_SNORM 0x8F93 - RGBA8_SNORM 0x8F97 - - Returned by the parameter of GetTexLevelParameter: - - SIGNED_NORMALIZED 0x8F9C - - -Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization): - - -- Section 3.8.1, Texture Image Specification - - Add to Table 3.16 (page 154): Sized internal formats - - Sized Base R G B A L I D - Internal Format Internal Format bits bits bits bits bits bits bits - --------------- --------------- ---- ---- ---- ---- ---- ---- ---- - RGBA8_SNORM RGBA 8 8 8 8 0 0 0 - - -Dependencies on ARB_texture_float extension: - - If ARB_texture_float is supported, GetTexParameter queries with - of TEXTURE_RED_TYPE_ARB, TEXTURE_GREEN_TYPE_ARB, TEXTURE_BLUE_TYPE_ARB or - TEXTURE_ALPHA_TYPE_ARB return SIGNED_NORMALIZED if - the base internal format is RGBA_SNORM. +Name + + MESA_texture_signed_rgba + +Name Strings + + GL_MESA_texture_signed_rgba + +Contact + + + +Notice + + + +IP Status + + No known IP issues + +Status + + + +Version + + 0.3, 2009-03-24 + +Number + + Not assigned ? + +Dependencies + + Written based on the wording of the OpenGL 2.0 specification. + + This extension trivially interacts with ARB_texture_float. + This extension shares some language with ARB_texture_compression_rgtc + but does not depend on it. + +Overview + + OpenGL prior to 3.1 does not support any signed texture formats. + ARB_texture_compression_rgtc introduces some compressed red and + red_green signed formats but no uncompressed ones, which might + still be useful. NV_texture_shader adds signed texture formats, + but also a lot of functionality which has been superseded by fragment + shaders. + It is usually possible to get the same functionality + using a unsigned format by doing scale and bias in a shader, but this + is undesirable since modern hardware has direct support for this. + This extension adds a signed 4-channel texture format by backporting + the relevant features from OpenGL 3.1, as a means to support this in + OpenGL implementations only supporting older versions. + +Issues + + 1) What should this extension be called? + + RESOLVED: MESA_texture_signed_rgba seems reasonable. + The rgba part is there because only 4 channel format is supported. + + + 2) Should the full set of signed formats (alpha, luminance, rgb, etc.) + be supported? + + RESOLVED: NO. To keep this extension simple, only add the most + universal format, rgba. alpha/luminance can't be trivially supported + since OpenGL 3.1 does not support them any longer, and there is some + implied dependency on ARB_texture_rg for red/red_green formats so + avoid all this. Likewise, only 8 bits per channel is supported. + + + 3) Should this extension use new enums for the texture formats? + + RESOLVED: NO. Same enums as those used in OpenGL 3.1. + + + 4) How are signed integer values mapped to floating-point values? + + RESOLVED: Same as described in issue 5) of + ARB_texture_compression_rgtc (quote): + A signed 8-bit two's complement value X is computed to + a floating-point value Xf with the formula: + + { X / 127.0, X > -128 + Xf = { + { -1.0, X == -128 + + This conversion means -1, 0, and +1 are all exactly representable, + however -128 and -127 both map to -1.0. Mapping -128 to -1.0 + avoids the numerical awkwardness of have a representable value + slightly more negative than -1.0. + + This conversion is intentionally NOT the "byte" conversion listed + in Table 2.9 for component conversions. That conversion says: + + Xf = (2*X + 1) / 255.0 + + The Table 2.9 conversion is incapable of exactly representing + zero. + + (Difference to ARB_texture_compression_rgtc): + This is the same mapping as OpenGL 3.1 uses. + This is also different to what NV_texture_shader used. + The above mapping should be considered the reference, but there + is some leeway so other mappings are allowed for implementations which + cannot do this. Particularly the mapping given in NV_texture_shader or + the standard OpenGL byte/float mapping is considered acceptable too, as + might be a mapping which represents -1.0 by -128, 0.0 by 0 and 1.0 by + 127 (that is, uses different scale factors for negative and positive + numbers). + Also, it is ok to store incoming GL_BYTE user data as-is, without + converting to GL_FLOAT (using the standard OpenGL float/byte mapping) + and converting back (using the mapping described here). + Other than those subtle issues there are no other non-standard + conversions used, so when using for instance CopyTexImage2D with + a framebuffer clamped to [0,1] all converted numbers will be in the range + [0, 127] (and not scaled and biased). + + + 5) How will signed components resulting from RGBA8_SNORM texture + fetches interact with fragment coloring? + + RESOLVED: Same as described in issue 6) of + ARB_texture_compression_rgtc (quote): + The specification language for this extension is silent + about clamping behavior leaving this to the core specification + and other extensions. The clamping or lack of clamping is left + to the core specification and other extensions. + + For assembly program extensions supporting texture fetches + (ARB_fragment_program, NV_fragment_program, NV_vertex_program3, + etc.) or the OpenGL Shading Language, these signed formats will + appear as expected with unclamped signed components as a result + of a texture fetch instruction. + + If ARB_color_buffer_float is supported, its clamping controls + will apply. + + NV_texture_shader extension, if supported, adds support for + fixed-point textures with signed components and relaxed the + fixed-function texture environment clamping appropriately. If the + NV_texture_shader extension is supported, its specified behavior + for the texture environment applies where intermediate values + are clamped to [-1,1] unless stated otherwise as in the case + of explicitly clamped to [0,1] for GL_COMBINE. or clamping the + linear interpolation weight to [0,1] for GL_DECAL and GL_BLEND. + + Otherwise, the conventional core texture environment clamps + incoming, intermediate, and output color components to [0,1]. + + This implies that the conventional texture environment + functionality of unextended OpenGL 1.5 or OpenGL 2.0 without + using GLSL (and with none of the extensions referred to above) + is unable to make proper use of the signed texture formats added + by this extension because the conventional texture environment + requires texture source colors to be clamped to [0,1]. Texture + filtering of these signed formats would be still signed, but + negative values generated post-filtering would be clamped to + zero by the core texture environment functionality. The + expectation is clearly that this extension would be co-implemented + with one of the previously referred to extensions or used with + GLSL for the new signed formats to be useful. + + + 6) Should the RGBA_SNORM tokens also be accepted by CopyTexImage + functions? + + RESOLVED: YES. + + + 7) What to do with GetTexParameter if ARB_texture_float is supported, + in particular what datatype should this return for TEXTURE_RED_TYPE_ARB, + TEXTURE_GREEN_TYPE_ARB, TEXTURE_BLUE_TYPE_ARB, TEXTURE_ALPHA_TYPE_ARB? + + RESOLVED: ARB_texture_float states type is either NONE, + UNSIGNED_NORMALIZED_ARB, or FLOAT. This extension adds a new enum, + SIGNED_NORMALIZED, which will be returned accordingly. This is the + same behaviour as in OpenGL 3.1. + + +New Tokens + + + Accepted by the parameter of + TexImage1D, TexImage2D, TexImage3D, CopyTexImage1D, and CopyTexImage2D: + + RGBA_SNORM 0x8F93 + RGBA8_SNORM 0x8F97 + + Returned by the parameter of GetTexLevelParameter: + + SIGNED_NORMALIZED 0x8F9C + + +Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization): + + -- Section 3.8.1, Texture Image Specification + + Add to Table 3.16 (page 154): Sized internal formats + + Sized Base R G B A L I D + Internal Format Internal Format bits bits bits bits bits bits bits + --------------- --------------- ---- ---- ---- ---- ---- ---- ---- + RGBA8_SNORM RGBA 8 8 8 8 0 0 0 + + +Dependencies on ARB_texture_float extension: + + If ARB_texture_float is supported, GetTexParameter queries with + of TEXTURE_RED_TYPE_ARB, TEXTURE_GREEN_TYPE_ARB, TEXTURE_BLUE_TYPE_ARB or + TEXTURE_ALPHA_TYPE_ARB return SIGNED_NORMALIZED if + the base internal format is RGBA_SNORM. diff --git a/mesalib/docs/MESA_window_pos.spec b/mesalib/docs/MESA_window_pos.spec index ac3e5b1b3..9e81e9c4d 100644 --- a/mesalib/docs/MESA_window_pos.spec +++ b/mesalib/docs/MESA_window_pos.spec @@ -1,126 +1,126 @@ -Name - - MESA_window_pos - -Name Strings - - GL_MESA_window_pos - -Contact - - Brian Paul, brian.paul 'at' tungstengraphics.com - -Status - - Shipping (since Mesa version 1.2.8) - -Version - - -Number - - 197 - -Dependencies - - OpenGL 1.0 is required. - The extension is written against the OpenGL 1.2 Specification - -Overview - - In order to set the current raster position to a specific window - coordinate with the RasterPos command, the modelview matrix, projection - matrix and viewport must be set very carefully. Furthermore, if the - desired window coordinate is outside of the window's bounds one must - rely on a subtle side-effect of the Bitmap command in order to circumvent - frustum clipping. - - This extension provides a set of functions to directly set the - current raster position, bypassing the modelview matrix, the - projection matrix and the viewport to window mapping. Furthermore, - clip testing is not performed. - - This greatly simplifies the process of setting the current raster - position to a specific window coordinate prior to calling DrawPixels, - CopyPixels or Bitmap. - -New Procedures and Functions - - void WindowPos2dMESA(double x, double y) - void WindowPos2fMESA(float x, float y) - void WindowPos2iMESA(int x, int y) - void WindowPos2sMESA(short x, short y) - void WindowPos2ivMESA(const int *p) - void WindowPos2svMESA(const short *p) - void WindowPos2fvMESA(const float *p) - void WindowPos2dvMESA(const double *p) - void WindowPos3iMESA(int x, int y, int z) - void WindowPos3sMESA(short x, short y, short z) - void WindowPos3fMESA(float x, float y, float z) - void WindowPos3dMESA(double x, double y, double z) - void WindowPos3ivMESA(const int *p) - void WindowPos3svMESA(const short *p) - void WindowPos3fvMESA(const float *p) - void WindowPos3dvMESA(const double *p) - void WindowPos4iMESA(int x, int y, int z, int w) - void WindowPos4sMESA(short x, short y, short z, short w) - void WindowPos4fMESA(float x, float y, float z, float w) - void WindowPos4dMESA(double x, double y, double z, double ) - void WindowPos4ivMESA(const int *p) - void WindowPos4svMESA(const short *p) - void WindowPos4fvMESA(const float *p) - void WindowPos4dvMESA(const double *p) - -New Tokens - - none - -Additions to Chapter 2 of the OpenGL 1.2 Specification (OpenGL Operation) - - - (2.12, p. 41) Insert after third paragraph: - - Alternately, the current raster position may be set by one of the - WindowPosMESA commands: - - void WindowPos{234}{sidf}MESA( T coords ); - void WindowPos{234}{sidf}vMESA( T coords ); - - WindosPos4MESA takes four values indicating x, y, z, and w. - WindowPos3MESA (or WindowPos2MESA) is analaguos, but sets only - x, y, and z with w implicitly set to 1 (or only x and y with z - implicitly set to 0 and w implicitly set to 1). - - WindowPosMESA operates like RasterPos except that the current modelview - matrix, projection matrix and viewport parameters are ignored and the - clip test operation always passes. The current raster position values - are directly set to the parameters passed to WindowPosMESA. The current - color, color index and texture coordinate update the current raster - position's associated data. - -Additions to the AGL/GLX/WGL Specifications - - None - -GLX Protocol - - Not specified at this time. However, a protocol message very similar - to that of RasterPos is expected. - -Errors - - INVALID_OPERATION is generated if WindowPosMESA is called between - Begin and End. - -New State - - None. - -New Implementation Dependent State - - None. - -Revision History - - * Revision 1.0 - Initial specification - * Revision 1.1 - Minor clean-up (7 Jan 2000, Brian Paul) - +Name + + MESA_window_pos + +Name Strings + + GL_MESA_window_pos + +Contact + + Brian Paul, brian.paul 'at' tungstengraphics.com + +Status + + Shipping (since Mesa version 1.2.8) + +Version + + +Number + + 197 + +Dependencies + + OpenGL 1.0 is required. + The extension is written against the OpenGL 1.2 Specification + +Overview + + In order to set the current raster position to a specific window + coordinate with the RasterPos command, the modelview matrix, projection + matrix and viewport must be set very carefully. Furthermore, if the + desired window coordinate is outside of the window's bounds one must + rely on a subtle side-effect of the Bitmap command in order to circumvent + frustum clipping. + + This extension provides a set of functions to directly set the + current raster position, bypassing the modelview matrix, the + projection matrix and the viewport to window mapping. Furthermore, + clip testing is not performed. + + This greatly simplifies the process of setting the current raster + position to a specific window coordinate prior to calling DrawPixels, + CopyPixels or Bitmap. + +New Procedures and Functions + + void WindowPos2dMESA(double x, double y) + void WindowPos2fMESA(float x, float y) + void WindowPos2iMESA(int x, int y) + void WindowPos2sMESA(short x, short y) + void WindowPos2ivMESA(const int *p) + void WindowPos2svMESA(const short *p) + void WindowPos2fvMESA(const float *p) + void WindowPos2dvMESA(const double *p) + void WindowPos3iMESA(int x, int y, int z) + void WindowPos3sMESA(short x, short y, short z) + void WindowPos3fMESA(float x, float y, float z) + void WindowPos3dMESA(double x, double y, double z) + void WindowPos3ivMESA(const int *p) + void WindowPos3svMESA(const short *p) + void WindowPos3fvMESA(const float *p) + void WindowPos3dvMESA(const double *p) + void WindowPos4iMESA(int x, int y, int z, int w) + void WindowPos4sMESA(short x, short y, short z, short w) + void WindowPos4fMESA(float x, float y, float z, float w) + void WindowPos4dMESA(double x, double y, double z, double ) + void WindowPos4ivMESA(const int *p) + void WindowPos4svMESA(const short *p) + void WindowPos4fvMESA(const float *p) + void WindowPos4dvMESA(const double *p) + +New Tokens + + none + +Additions to Chapter 2 of the OpenGL 1.2 Specification (OpenGL Operation) + + - (2.12, p. 41) Insert after third paragraph: + + Alternately, the current raster position may be set by one of the + WindowPosMESA commands: + + void WindowPos{234}{sidf}MESA( T coords ); + void WindowPos{234}{sidf}vMESA( T coords ); + + WindosPos4MESA takes four values indicating x, y, z, and w. + WindowPos3MESA (or WindowPos2MESA) is analaguos, but sets only + x, y, and z with w implicitly set to 1 (or only x and y with z + implicitly set to 0 and w implicitly set to 1). + + WindowPosMESA operates like RasterPos except that the current modelview + matrix, projection matrix and viewport parameters are ignored and the + clip test operation always passes. The current raster position values + are directly set to the parameters passed to WindowPosMESA. The current + color, color index and texture coordinate update the current raster + position's associated data. + +Additions to the AGL/GLX/WGL Specifications + + None + +GLX Protocol + + Not specified at this time. However, a protocol message very similar + to that of RasterPos is expected. + +Errors + + INVALID_OPERATION is generated if WindowPosMESA is called between + Begin and End. + +New State + + None. + +New Implementation Dependent State + + None. + +Revision History + + * Revision 1.0 - Initial specification + * Revision 1.1 - Minor clean-up (7 Jan 2000, Brian Paul) + diff --git a/mesalib/docs/MESA_ycbcr_texture.spec b/mesalib/docs/MESA_ycbcr_texture.spec index e865039fb..6a730e81c 100644 --- a/mesalib/docs/MESA_ycbcr_texture.spec +++ b/mesalib/docs/MESA_ycbcr_texture.spec @@ -1,204 +1,204 @@ -Name - - MESA_ycbcr_texture - -Name Strings - - GL_MESA_ycbcr_texture - -Contact - - Brian Paul, Tungsten Graphics, Inc. (brian.paul 'at' tungstengraphics.com) - Keith Whitwell, Tungsten Graphics, Inc. (keith 'at' tungstengraphics.com) - -Status - - Shipping (Mesa 4.0.4 and later) - -Version - - 1.0 - -Number - - TBD - -Dependencies - - OpenGL 1.0 or later is required - This extension is written against the OpenGL 1.4 Specification. - NV_texture_rectangle effects the definition of this extension. - -Overview - - This extension supports texture images stored in the YCbCr format. - There is no support for converting YCbCr images to RGB or vice versa - during pixel transfer. The texture's YCbCr colors are converted to - RGB during texture sampling, after-which, all the usual per-fragment - operations take place. Only 2D texture images are supported (not - glDrawPixels, glReadPixels, etc). - - A YCbCr pixel (texel) is a 16-bit unsigned short with two components. - The first component is luminance (Y). For pixels in even-numbered - image columns, the second component is Cb. For pixels in odd-numbered - image columns, the second component is Cr. If one were to convert the - data to RGB one would need to examine two pixels from columns N and N+1 - (where N is even) to deduce the RGB color. - -IP Status - - None - -Issues - - None - -New Procedures and Functions - - None - -New Tokens - - Accepted by the and parameters of - TexImage2D and TexSubImage2D: - - YCBCR_MESA 0x8757 - - Accepted by the parameter of TexImage2D and TexSubImage2D: - - UNSIGNED_SHORT_8_8_MESA 0x85BA /* same as Apple's */ - UNSIGNED_SHORT_8_8_REV_MESA 0x85BB /* same as Apple's */ - -Additions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation) - - None - -Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization) - - In section 3.6.4, Rasterization of Pixel Rectangles, on page 101, - add the following to Table 3.8 (Packed pixel formats): - - type Parameter GL Data Number of Matching - Token Name Type Components Pixel Formats - -------------- ------- ---------- ------------- - UNSIGNED_SHORT_8_8_MESA ushort 2 YCBCR_MESA - UNSIGNED_SHORT_8_8_REV_MESA ushort 2 YCBCR_MESA - - - In section 3.6.4, Rasterization of Pixel Rectangles, on page 102, - add the following to Table 3.10 (UNSIGNED_SHORT formats): - - UNSIGNED_SHORT_8_8_MESA: - - 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - +-------------------------------+-------------------------------+ - | 1st | 2nd | - +-------------------------------+-------------------------------+ - - UNSIGNED_SHORT_8_8_REV_MESA: - - 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - +-------------------------------+-------------------------------+ - | 2nd | 1st | - +-------------------------------+-------------------------------+ - - - In section 3.6.4, Rasterization of Pixel Rectangles, on page 104, - add the following to Table 3.12 (Packed pixel field assignments): - - First Second Third Fourth - Format Element Element Element Element - ------ ------- ------- ------- ------- - YCBCR_MESA luminance chroma - - - In section 3.8.1, Texture Image Specification, on page 125, add - another item to the list of TexImage2D and TexImage3D equivalence - exceptions: - - * The value of internalformat and format may be YCBCR_MESA to - indicate that the image data is in YCbCr format. type must - be either UNSIGNED_SHORT_8_8_MESA or UNSIGNED_SHORT_8_8_REV_MESA - as seen in tables 3.8 and 3.10. Table 3.12 describes the mapping - between Y and Cb/Cr to the components. - If NV_texture_rectangle is supported target may also be - TEXTURE_RECTANGLE_NV or PROXY_TEXTURE_RECTANGLE_NV. - All pixel transfer operations are bypassed. The texture is stored as - YCbCr, not RGB. Queries of the texture's red, green and blue component - sizes will return zero. The YCbCr colors are converted to RGB during - texture sampling using an implementation dependent conversion. - - - In section 3.8.1, Texture Image Specification, on page 126, add - another item to the list of TexImage1D and TexImage2D equivalence - exceptions: - - * The value of internalformat and format can not be YCBCR_MESA. - - - In section 3.8.2, Alternate Texture Image Specification Commands, on - page 129, insert this paragraph after the first full paragraph on the - page: - - "If the internal storage format of the image being updated by - TexSubImage2D is YCBCR_MESA then format must be YCBCR_MESA. - The error INVALID_OPERATION will be generated otherwise." - - -Additions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment -Operations and the Frame Buffer) - - None - -Additions to Chapter 5 of the OpenGL 1.4 Specification (Special Functions) - - None - -Additions to Chapter 6 of the OpenGL 1.4 Specification (State and -State Requests) - - None - -Additions to Appendix A of the OpenGL 1.4 Specification (Invariance) - - None - -Additions to the AGL/GLX/WGL Specifications - - None - -GLX Protocol - - None - -Errors - - INVALID_ENUM is generated by TexImage2D if is - MESA_YCBCR but is not MESA_YCBCR. - - INVALID_ENUM is generated by TexImage2D if is MESA_YCBCR but - is not MESA_YCBCR. - - INVALID_VALUE is generated by TexImage2D if is MESA_YCBCR and - is MESA_YCBCR and is not zero. - - INVALID_OPERATION is generated by TexSubImage2D if the internal image - format is YCBCR_MESA and is not YCBCR_MESA. - - INVALID_OPERATION is generated by CopyTexSubImage2D if the internal - image is YCBCR_MESA. - -New State - - Edit table 6.16 on page 231: change the type of TEXTURE_INTERNAL_FORMAT - from n x Z42 to n x Z43 to indicate that internal format may also be - YCBCR_MESA. - -Revision History - - 20 September 2002 - Initial draft - 29 April 2003 - minor updates - 3 September 2003 - further clarify when YCbCr->RGB conversion takes place - 19 September 2003 - a few more updates prior to submitting to extension - registry. - 3 April 2004 - fix assorted inaccuracies +Name + + MESA_ycbcr_texture + +Name Strings + + GL_MESA_ycbcr_texture + +Contact + + Brian Paul, Tungsten Graphics, Inc. (brian.paul 'at' tungstengraphics.com) + Keith Whitwell, Tungsten Graphics, Inc. (keith 'at' tungstengraphics.com) + +Status + + Shipping (Mesa 4.0.4 and later) + +Version + + 1.0 + +Number + + TBD + +Dependencies + + OpenGL 1.0 or later is required + This extension is written against the OpenGL 1.4 Specification. + NV_texture_rectangle effects the definition of this extension. + +Overview + + This extension supports texture images stored in the YCbCr format. + There is no support for converting YCbCr images to RGB or vice versa + during pixel transfer. The texture's YCbCr colors are converted to + RGB during texture sampling, after-which, all the usual per-fragment + operations take place. Only 2D texture images are supported (not + glDrawPixels, glReadPixels, etc). + + A YCbCr pixel (texel) is a 16-bit unsigned short with two components. + The first component is luminance (Y). For pixels in even-numbered + image columns, the second component is Cb. For pixels in odd-numbered + image columns, the second component is Cr. If one were to convert the + data to RGB one would need to examine two pixels from columns N and N+1 + (where N is even) to deduce the RGB color. + +IP Status + + None + +Issues + + None + +New Procedures and Functions + + None + +New Tokens + + Accepted by the and parameters of + TexImage2D and TexSubImage2D: + + YCBCR_MESA 0x8757 + + Accepted by the parameter of TexImage2D and TexSubImage2D: + + UNSIGNED_SHORT_8_8_MESA 0x85BA /* same as Apple's */ + UNSIGNED_SHORT_8_8_REV_MESA 0x85BB /* same as Apple's */ + +Additions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation) + + None + +Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization) + + In section 3.6.4, Rasterization of Pixel Rectangles, on page 101, + add the following to Table 3.8 (Packed pixel formats): + + type Parameter GL Data Number of Matching + Token Name Type Components Pixel Formats + -------------- ------- ---------- ------------- + UNSIGNED_SHORT_8_8_MESA ushort 2 YCBCR_MESA + UNSIGNED_SHORT_8_8_REV_MESA ushort 2 YCBCR_MESA + + + In section 3.6.4, Rasterization of Pixel Rectangles, on page 102, + add the following to Table 3.10 (UNSIGNED_SHORT formats): + + UNSIGNED_SHORT_8_8_MESA: + + 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + +-------------------------------+-------------------------------+ + | 1st | 2nd | + +-------------------------------+-------------------------------+ + + UNSIGNED_SHORT_8_8_REV_MESA: + + 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + +-------------------------------+-------------------------------+ + | 2nd | 1st | + +-------------------------------+-------------------------------+ + + + In section 3.6.4, Rasterization of Pixel Rectangles, on page 104, + add the following to Table 3.12 (Packed pixel field assignments): + + First Second Third Fourth + Format Element Element Element Element + ------ ------- ------- ------- ------- + YCBCR_MESA luminance chroma + + + In section 3.8.1, Texture Image Specification, on page 125, add + another item to the list of TexImage2D and TexImage3D equivalence + exceptions: + + * The value of internalformat and format may be YCBCR_MESA to + indicate that the image data is in YCbCr format. type must + be either UNSIGNED_SHORT_8_8_MESA or UNSIGNED_SHORT_8_8_REV_MESA + as seen in tables 3.8 and 3.10. Table 3.12 describes the mapping + between Y and Cb/Cr to the components. + If NV_texture_rectangle is supported target may also be + TEXTURE_RECTANGLE_NV or PROXY_TEXTURE_RECTANGLE_NV. + All pixel transfer operations are bypassed. The texture is stored as + YCbCr, not RGB. Queries of the texture's red, green and blue component + sizes will return zero. The YCbCr colors are converted to RGB during + texture sampling using an implementation dependent conversion. + + + In section 3.8.1, Texture Image Specification, on page 126, add + another item to the list of TexImage1D and TexImage2D equivalence + exceptions: + + * The value of internalformat and format can not be YCBCR_MESA. + + + In section 3.8.2, Alternate Texture Image Specification Commands, on + page 129, insert this paragraph after the first full paragraph on the + page: + + "If the internal storage format of the image being updated by + TexSubImage2D is YCBCR_MESA then format must be YCBCR_MESA. + The error INVALID_OPERATION will be generated otherwise." + + +Additions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment +Operations and the Frame Buffer) + + None + +Additions to Chapter 5 of the OpenGL 1.4 Specification (Special Functions) + + None + +Additions to Chapter 6 of the OpenGL 1.4 Specification (State and +State Requests) + + None + +Additions to Appendix A of the OpenGL 1.4 Specification (Invariance) + + None + +Additions to the AGL/GLX/WGL Specifications + + None + +GLX Protocol + + None + +Errors + + INVALID_ENUM is generated by TexImage2D if is + MESA_YCBCR but is not MESA_YCBCR. + + INVALID_ENUM is generated by TexImage2D if is MESA_YCBCR but + is not MESA_YCBCR. + + INVALID_VALUE is generated by TexImage2D if is MESA_YCBCR and + is MESA_YCBCR and is not zero. + + INVALID_OPERATION is generated by TexSubImage2D if the internal image + format is YCBCR_MESA and is not YCBCR_MESA. + + INVALID_OPERATION is generated by CopyTexSubImage2D if the internal + image is YCBCR_MESA. + +New State + + Edit table 6.16 on page 231: change the type of TEXTURE_INTERNAL_FORMAT + from n x Z42 to n x Z43 to indicate that internal format may also be + YCBCR_MESA. + +Revision History + + 20 September 2002 - Initial draft + 29 April 2003 - minor updates + 3 September 2003 - further clarify when YCbCr->RGB conversion takes place + 19 September 2003 - a few more updates prior to submitting to extension + registry. + 3 April 2004 - fix assorted inaccuracies diff --git a/mesalib/docs/VERSIONS b/mesalib/docs/VERSIONS index f72679fbe..0ebcd1469 100644 --- a/mesalib/docs/VERSIONS +++ b/mesalib/docs/VERSIONS @@ -1,1514 +1,1514 @@ - - -Mesa Version History -==================== - -1.0 beta February 1995 - Initial release - -1.1 beta March 4, 1995 - Changes: - faster point and line drawing (2x faster) - more systems supported, better Makefiles - Renamed lib*.a files to avoid collisions - many small bug fixes - New: - pseudo-GLX functions added - new implementation of evaluators (eval2.c) - GLUT support - -1.1.1 beta March 7, 1995 - Changes: - Reverted from eval2.c to eval.c due to FPE on Linux - more speed improvements - more Makefile changes - -1.1.2 beta March 14, 1995 - New: - implementation of SGI's blending extensions - glXUseXFont implemented - added MESA_DEBUG environment variable support - Changes: - Using eval2.c again - more FPE-prevention checks (0-length normals are OK) - a few small bug fixes - much faster pixel logic ops! - faster transformation arithmetic - -1.1.3 beta March 31, 1995 - New: - gluScaleImage() and gluBuild2DMipMaps() implemented - Mesa widgets for Xt/Motif - blendEXT demos - added environment variables for selecting visuals - Changes: - almost all GLUT demos work correctly now - faster X device driver functions - more bug fixes - -1.1.4 beta April 20, 1995 - Bug fixes: - - missing #define SEEK_SET in src-tk/image.c - - compile glShadeModel into display lists - - fixed pow() domain error in src/light.c - - fixed "flickering bitmaps" in double buffer mode - - fixed tk.h and aux.h for C++ - - state of LIGHT_MODEL_LOCAL_VIEWER was inverted - New features: - - MUCH, MUCH nicer dithering in 8-bit RGB mode - - updated widgets and widget demos - - Implemented GLXPixmap functions - - Added GLU 1.1 and GLX 1.1 functions - - Changed the X/Mesa interface API, more versatile - - Implemented gluPartialDisk() - -1.2 May 22, 1995 - Bug fixes: - - IRIX 4.x makefile problem - - modified tk to share root colormap as needed - - gluLookAt normalization problem - - suppress Expose, NoExpose events in swapbuffers - - glBitmap() and glDrawPixels() clipping - New features: - - GL_BLEND, GL_MODULATE, GL_DECAL, and GL_REPLACE_EXT texture - modes implemented - - texture maps stored more efficiently - - texture maps can be compiled into display lists - - Bogdan Sikorski's GLU polygon tesselation code - - Linas Vepstas's sweep and extrusion library - - glXCreateContext()'s shareList parameter works as it's supposed to. - XMesaCreateContext() updated to accept a shareList parameter too. - - Mesa can be compiled with real OpenGL .h files - - MESA_BACK_BUFFER environment variable - - better GLX error checking - -1.2.1 June 22, 1995 - Bug fixes: - - X/Mesa double buffer window resize crash - - widgets now pass PointerMotion events - - X/Mesa incorrect default clear color and drawing color - - more robust X MIT-SHM support in X/Mesa - - glTexImage( format=GL_LUMINANCE ) didn't work - - GL_LINE mode polygons with line width > 1.0 could cause a crash - - numerous feedback bugs - - glReadPixels() from depth buffer was wrong - - error prone depth and stencil buffer allocation - New features: - - Preliminary Microsoft Windows driver - - Implemented a number of missing functions: glEvalCoord[12][df]v(), - glGet...(), etc. - - Added a few missing symbols to gl.h and glu.h - - Faster rendering of smooth-shaded, RGBA, depth-buffered polygons. - - Faster rendering of lines when width=2.0 - - Stencil-related functions now work in display lists - Changes: - - renamed aux.h as glaux.h (MS-DOS names can't start with aux) - - most filenames are in 8.3 format to accomodate MS-DOS - - use GLubytes to store arrays of colors instead of GLints - -1.2.2 August 2, 1995 - New features: - - texture mapped points and lines - - NURBS! (but not 100% complete) - - viewports may safely extend beyond window boundaries - - MESA_PRIVATE_CMAP environment variable - - Grayscale X display support - - two new demos: demos/gears.c and demos/shadow.c - - MachTen for Macintosh configuration - Bug fixes: - - glGet*(GL_DEPTH_BITS) returned bytes, not bits - - point, line, and bitmap rasterization suffered from roundoff errors - - fixed a division by zero error in line clippping - - occasional wrong default background color really fixed! - - glDepthFunc(GL_ALWAYS) with glDepthMask(GL_FALSE) didn't work - - gluBuild2DMipmaps malloc problem fixed - - view volume clipping of smooth shaded lines resulted in bad colors - Changes: - - new visual selection method in glXChooseVisual() - - improved GLU quadric functions - - call XSync for glFinish and XFlush for glFlush - - glVertex() calls now use a function pointer to avoid conditionals - - removed contrib directory from Mesa tar file (available on ftp site) - - AIX shared library support - - Removed GLUenum type as it's not in OpenGL - -1.2.3 September 26, 1995 - New features: - - Mesa header files now equivalent to SGI OpenGL headers - - Support for HP's Color Recovery dithering displays - - Faster vertex transformation - - Faster raster operations into X windows under certain conditions - - New configurations: HP w/ shared libs, Ultrix w/ GCC, Data General - - 4-bit visuals now supported - Bug fixes: - - glScissor bug fixed - - round-off errors in clipping lines against clip planes fixed - - byte swapping between hosts and display servers implemented - - glGetError() can be called without a current rendering context - - problem with accidentally culled polygons is fixed - - fixed some widget compilation problems - -1.2.4 November 17, 1995 - New features: - - More speed improvements (lighting, fogging, polygon drawing) - - Window system and OS-independent off-screen rendering - - Preliminary Fortran bindings - - glPolygonOffsetEXT implemented - - glColorMask and glIndexMask now fully implemented - - glPixelZoom implemented - - display lists fully implemented - - gamma correction - - dithering in 8-bit TrueColor/DirectColor visuals - Changes: - - Improved device driver interface - - tk.h renamed to gltk.h to avoid conflicts with Tcl's Tk - - Dithering support moved from core into device driver - Bug fixes: - - glEnable/Disable( GL_LIGHTING ) didn't always take effect - - glReadPixels byte swapping was broken - - glMaterial with pname==GL_AMBIENT_AND_DIFFUSE was broken - - duplicate glColor4b() prototype in GL/gl.h removed - - stripes in wave -ci demo fixed - - GL_LINEAR_MIPMAP_NEAREST had wrong value - - bugs in HP Color Recovery support fixed - - fixed bug when blending lines, points, bitmaps outside of window - -1.2.5 November 30, 1995 - New Features: - - updated MS Windows driver - - new implementation of StaticGray/GrayScale visual support - Bug fixes: - - pixelzooming with gamma correction or blending didn't work - - HP color recovery visual wasn't being picked by glXChooseVisual - - glClear didn't always observe glColorMask changes - - olympic and offset demos didn't compile on some Suns - - texcoord clamping wasn't correct - - a polygon optimization introduced an occasional sampling problem - -1.2.6 January 26, 1996 - New Features: - - faster line and polygon rendering under certain conditions. See - Performance Tips 9 and 10 in README - - profiling - - lighting is a bit faster - - better perspective corrected texture mapping - - Amiga AmiWin (X11) support - - preliminary Linux SVGA driver - Changes: - - now using a 16-bit depth buffer, faster, smaller - - GL_NORMALIZE is disabled by default - Bug fixes: - - projective texture mapping - - fixed a memory leak in the context destroy function - - GL_POLYGON with less than 3 vertices caused a crash - - glGet*() returned wrong result for GL_INDEX_MODE - - reading pixels from an unmapped X window caused a BadMatch error - -1.2.7 March 5, 1996 - New: - - faster lighting - - faster 16-bit TrueColor rendering on Linux - - faster 32-bit TrueColor rendering on Linux, HP, IBM - - non-depth-buffered XImage polygons are faster - - vertex array extension - - software alpha planes - - updated Macintosh driver - - new NeXT driver - - GLU quadric functions generate texture coordinates - - reflect.c demo - reflective, textured surface demo - Changes: - - gamma correction code moved into the X driver for better performance - Bug fixes: - - multiple glClipPlane()'s didn't work reliably - - glPolygonMode() didn't always work - - glCullFace( GL_FRONT_AND_BACK ) didn't work - - texture mapping with gamma correction was buggy - - floating point exceptions in texture coordinate interpolation - - XImage byte swapping didn't always work - - polygon edge flags weren't always used correctly - -1.2.8 May 22, 1996 - New: - - overlay planes on X servers with the SERVER_OVERLAY_VISUALS property - - better monochrome output - - more IRIX 6.x configurations - - more robust RGB mode color allocation - - added MESA_XSYNC environment variable - - GLX_MESA_pixmap_colormap and GLX_EXT_visual_info extensions - - GL_MESA_window_pos extension - - faster glReadPixels/glDrawPixels for GL_DEPTH and GL_UNSIGNED_SHORT - and GL_UNSIGNED_INT - - driver for prototype Cirrus Mondello 3-D board - - updated AmigaDOS driver - - a few small speed optimizations in polygon rendering - Changes: - - internal device driver interface modified to simplify device - driver implementations and to support hardware Z buffers - - several changes to the X/Mesa interface (xmesa.h) - Bug fixes: - - fixed pow(0,0) domain error triggered on some systems - - glStencilClear() in a display list caused an infinite loop - - glRasterPos*() was sometimes off by +/-0.5 in X and Y - - color masking and blending were performed in wrong order - - auxSolidCylinder() sometimes drew a wire-frame cylinder - - fixed file writing bug in osdemo.c - - pixel mapping didn't always work - - the GL_GEQUAL stencil func didn't work - - the GL_INVERT stencil op didn't work - - the stencil write mask didn't work - - glPush/PopAttrib() didn't do enough error checking - - glIsList() didn't always work correctly - -2.0 October 10, 1996 - New: - - Implements OpenGL 1.1 API functions - - all texture filtering modes supported (mipmapping) - - faster texture mapping, see Performance Tip 11 in README - - antialiased RGB points - - X support for line and polygon stippling - - glDrawBuffer( GL_FRONT_AND_BACK ) works - - util/ directory of useful stuff - - demos/texobj demo of texture objects - Changes: - - major internal changes for thread-safeness - - new device driver interface - - MESA_ALPHA env variable removed - - triangle rasterizer replaces polygon rasterizer - Bug fixes: - - glPopAttrib() bug - - glDrawBuffer(GL_NONE) works now - -2.1 December 14, 1996 - New: - - VMS support - - MS-DOS driver - - OpenStep support - - updated, combined Windows 95/NT driver - - implemented glGetLighti() and glGetTexGen*() - - GLX does garbage collection of ancillary buffers - Bug fixes: - - removed unused _EXT constants from gl.h - - fixed polygon offset bugs - - Z coordinates of clipped lines were incorrect - - glEdgeFlag() in display lists didn't always work - - glLight*() in display lists didn't work - - fixed X line stipple bugs (Michael Pichler) - - glXUseXfonts XFreeFont/XFreeFontInfo bug fixed - - fixed a feedback bug - - glTexGen*() now transforms GL_EYE_PLANE by inverse modelview matrix - - polygons were sometimes culled instead of clipped - - triangle rasterizer suffered from float/int overflow exceptions - - fixed FP underflow exception in lighting (specular exponent) - - glEnable/glDisable of GL_EXT_vertex_array enums didn't work - - fixed free(NULL) in GLU tesselator code - - using 24-bit color on some X servers resulted in garbage rendering - - 32-bit per pixel mode for XFree86 now works - - glRotate(a,0,0,0) gave unpredictable results - - GL_LINE_STRIP with > 480 vertices had occasional clipping problems - - 8-bit TrueColor GLXPixmap rendering incorrectly required a colormap - - glMaterial() wasn't ignored when GL_COLOR_MATERIAL was enabled - - glEnable(GL_COLOR_MATERIAL) followed by glColor() didn't work right - - accumulation buffer was limited to positive values - - projective textures didn't work - - selection buffer overflows weren't handled correctly - Changes: - - restored the GL_EXT_polygon_offset extension - - slightly faster RGB dithering - - the SVGA driver works again - - Amiga driver now distributed separately - - NeXT driver updated for Mesa 2.x - -2.2 March 14, 1997 - New: - - better color selection when dithering - - added GL_EXT_texture_object extension - - updated MS-DOS driver for DJGPP - - added openbsd make configuration - - faster dithered flat-shaded triangles - - various compilation problems with Motif widgets fixed - - gl.h, glx.h and glu.h name mangling option - - BeOS driver - - 3D texture mapping extension - - GL_MESA_resize_buffers extension - - morph3d, stex3d and spectex demos - - 3Dfx support - Bug fixes: - - glColorMaterial should finally work right in all respects - - linear interpolation of mipmap levels was incorrectly weighted - - readpix.c didn't compile on Macintosh - - GL_INVERT and related logic ops didn't work right - - glTexImage[12]D() didn't check its parameters consistantly - - fixed a memory leak in glTexImage[12]D() - - kludged around a SunOS 5.x/GCC compiler bug in the feedback code - - glReadPixels aborted instead of normally catching some errors - - a few 1.1 constants were missing or misnamed in gl.h - - glBegin(p); glBegin(q); didn't generate an error - - fixed a memory leak in GLX code - - clipping of concave polygons could cause a core dump - - 1-component alpha texture maps didn't work - - fixed a GLU polygon tesselator bug - - polygons with colinear vertices were sometimes culled - - feedback triangle colors were wrong when using smooth shading - - textures with borders didn't work correctly - - colors returned in feedback mode were wrong when using lighting - - spotlights didn't effect ambient lighting correctly - - gluPartialDisk() had a few bugs - Changes: - - device driver interface expanded to support texture mapping - - faster matrix inversion subroutine - - commented out #include "wmesa_extend.h" from src/wmesa.c - - fixed many compiler warnings in the demo programs - -2.3 June 30, 1997 - New: - - Mesa distribution divided into two pieces: library code and demos - - faster vertex transformation, clip testing, lighting - - faster line drawing - - TrueColor visuals how have dithering (for depths < 24 bits) - - added MESA_NO_DITHER environment variable - - new device driver function: NearFar(), RenderVB(), RasterSetup() - - added LynxOS configuration - - added cygnus Win32 configuration - - added texcyl.c GLUT demo - - added XMesaDitherColor() to X/Mesa interface - - new NURBS code from Bogdan Sikorski - - added demos/shape.c (non-rectangular X window!) - Bug fixes: - - glEnable/DisableClientState() were missing from GL/gl.h - - GL_SPHERE_MAP texcoord generation didn't work correctly - - glXGetConfig() returned wrong number of depth, stencil, accum bits - - glDrawPixels feedback/selection didn't examine RasterPos valid bit - - black and white were reversed on some monochrome displays - - fixed potential image memory leak (wasn't setting reference counter) - - glDrawPixels sometimes didn't recognize some GL state changes - - gluProject/UnProject() didn't check for divide by zero - - stex3d demo called random() and srandom(), not portable - - fixed memory leaks in context.c and drawpix.c - - fixed NULL dereferencing problem in gl_update_texture_state() - - glReadPixels between glBegin/glEnd didn't generate an error. - - fixed memory leak in polygon tesselator (Randy Frank) - - fixed seg fault bug drawing flat-shaded, depth-tested lines - - clipped GL_TRIANGLE_STRIPs sometimes had wrong color when flat-shaded - - glBindTexture sometimes didn't work - - fixed a bug deep in glXReleaseBuffersMESA() - - fog was mistakenly applied to alpha - - glPopMatrix didn't set "dirty matrix" flag - - glPolygonStipple pattern was sometimes wrong - - glClear wasn't disabled during feedback and selection - - fixed memory leak in glTexSubImage[123]D - Changes: - - many library source files reorganized - - faster X color allocation, colors also freed when finished with them - - new texture sampling function pointer in texture objects - - incorporated 3Dfx VooDoo driver v0.16 into main source tree - - many 3Dfx driver updates - - cygnus Makefiles now included - - updated DOS driver - - made a few changes to dosmesa.c and wmesa.c (VB->Unclipped) - - internally, colors now stored in GLubytes, not GLfixed - - optimized changing of GL_SHININESS parameter - -2.4 September 18, 1997 - New: - - updated 3Dfx Glide driver - - hacks for 3Dfx rendering into an X window or fullscreen - - added depth buffer access functions to X/Mesa and OS/Mesa interfaces - Bug fixes: - - pixel buffer could overflow with long, wide lines - - fixed FP underflow problems in lighting - - glTexSubImage1D() had an unitialized variable - - incomplete texture objects could cause a segfault - - glDrawPixels with GL_COMPILE_AND_EXECUTE caused infinite loop - - flat-shaded quads in a strip were miscolored if clipped - - mipmapped triangle lod computation now works correctly - - fixed a few under/overflow bugs in triangle rasterizer - - glArrayElement() assigned bad normal if normal array disabled - - changed argument to glXReleaseBuffersMESA() - - fixed small triangle underflow bugs in tritemp.h (hopefully) - - glBindTexture(target, 0) caused a crash - - glTexImage[123]D() with NULL image pointer caused crash - - glPixelStore parameters are now ignored during display list execution - - fixed a two-sided lighting w/ clipping bug (black vertices) - - textures with width!=height were sometimes mis-rendered - - "weird" projection matrices could cause div by 0, other fp errors - Changes: - - changed precompiled header symbol from PCH to PC_HEADER - - split api.c into api1.c and api2.c - - added hash.c source file (but not used yet) - - a few Sun and HP configuration file changes - - MESA_GLX_FX env var replaces MESA_FX_WINDOW and MESA_FX_FULLSCREEN - - fixed a few cygnus build problems (src/Makefile.cygnus, src/wmesa.c) - -2.5 November 20, 1997 - New: - - updated 3Dfx driver (v20) for GLQuake - - added GL_EXT_paletted_texture extension - - added GL_EXT_shared_texture_palette extension - - added GL_EXT_point_parameters extension - - now including Mark Kilgard's GLUT library v3.6 - - new GLUT-based demos in gdemos/ - - added a few more Unix config targets - - added Intel X86 assembly language vertex transformation code - - 3Dfx/Glide driver for Mesa now recognizes SST_SCREENREFRESH env var - - Windows 95 S3 Virge driver - Bug fixes: - - glCopyTexImage?D would crash due to uninitialized variable - - glColor w/ glColorMaterial in a display list caused a bug - - fixed several glDrawPixels() and ReadPixels() bugs in 3Dfx driver - - glVertex4*() vertices weren't always projected correctly - - trying to use mipmapped textured points or lines caused crash - - glColor[34][fd]() values now clamped to [0,1] before int conversion - Changes: - - new device driver functions for texture mapping - - hash tables used for display list and texture object lookup - - fixed GLX visual handling code to avoid saving redundant visuals - - 3Dfx Glide libraries automatically linked to libMesaGL.so - - dropped the Cirrus Logic Mondello code since it's obsolete - - updated Cygnus Makefiles (Stephane Rehel) - - updated Windows MSVC++ Makefiles (Oleg Letsinsky) - - procedure for making library files has changed: scripts now take - a major and minor version arguments. Make-config changed a lot. - - new implementation of glTexSubImage2D() - - updated widgets-mesa directory to create libMesaGLwM.a (Motif widget) - - separate linux-glide and linux-386-glide configurations - -2.6 February 12, 1998 - New: - - Windows WGL functions - - updated VMS, DOS, Windows, Cygnus, BeOS, Amiga compilation support - - v0.22 of 3Dfx Glide driver - - more X86 assembly language optimizations - - faster blending for some modes - - XMesaSetFXmode() to switch between 3Dfx window and full-screen mode - - added preliminary thread support - - added GLX_MESA_copy_sub_buffer extension - - some clipping optimizations - Bug fixes: - - fixed shading/material bug when drawing long primitive strips - - fixed clipping problem in long primitive strips - - fixed clipping bug when using 3Dfx driver - - fixed a problem when trying to use X fonts w/ 3Dfx driver - - fixed a texture filter bug in 3Dfx/Glide driver - - fixed bug in 3Dfx/Glide driver involving depth mask & clearing - - glLoadMatrix to set projection matrix confused the 3Dfx driver - - non-identity texture matrices didn't work with linux-386 configs - - glGenTextures() didn't reserve the returned texture IDs - - NULL proxy image sent to glTexImageXD() caused crash - - added texture state validation optimization (Henk Kok) - - fixed colormap reuse problem when using both RGB and CI windows - - 32bpp True/DirectColor X visuals weren't recognized - - fixed potential problem in evaluators memory allocation - - fixed assorted demo compilation bugs - Changes: - - replaced old Mesa/windows/ directory with Mesa/WIN32/ directory - - converted a few old glaux/gltk demos to GLUT - - renamed directories: demos -> xdemos, gdemos -> demos - - -3.0 September 17, 1998 - New: - - OpenGL 1.2 API - - GL_EXT_abgr pixel format extension - - GL_SGIS_texture_edge_clamp extension - - GL_SGIS_multitexture extension (to be replaced by GL_ARB_multitex) - - GL_EXT_multitexture extension (to be replaced by GL_ARB_multitex) - - GL_EXT_rescale_normal extension and renormal.c demo - - GLX_SGI_video_sync extension (a no-op) - - antialiased lines - - glGetTexImage() now implemented - - glDraw/Copy/ReadPixels() optimizations - - optimized textured triangle code (Marten Stromberg) - - more optimization of dithered TrueColor triangles in X driver - - Linux GGI driver - - updated MGL driver - Bug fixes: - - lots of assorted compilation fixes - - glInitNames didn't write initial hit record - - glBitmap didn't always check for invalid raster position - - switching between GLX and OSMesa contexts caused a crash - - fixed uninitialized variable in Mesa widget code - - fixed typo in texture code which caused book/texgen to crash - - fixed texture sampling bug when filter=GL_LINEAR and wrap=GL_CLAMP - - gluDisk() in POINT or LINE mode sometimes failed - - fixed texture + fog bug - - GL_COMPILE_AND_EXECUTE mode didn't work reliably - - glMultMatrix in projection matrix mode w/ 3Dfx driver could fail - - glDrawPixels(color index pixels) weren't converted to RGBA - - fixed possible getenv() buffer overflow security bug - - glBitmap in feedback mode was offset by xOrig, yOrig params - - device driver's DrawPixels hook was never used - - glDrawPixels with zoomY!=1 and top/bottom clipping didn't work - - glDrawPixels optimized for GL_LUMINANCE, GL_LUMINANCE_ALPHA, GLubyte - - fixed MakeCurrent bug in GLwRedrawObjects() in MesaWorkstation.c - - glCopyTexSubImage2D() didn't work with 3Dfx driver - - lines with width = 2 could cause crash - - glClear with scissor rect sometimes cleared whole buffer - - glTexSubImage2D( .. GL_COLOR_INDEX .. ) didn't work - - glTexImageXD( .. GL_ABGR_EXT .. ) didn't work - - computation of inverse modelview matrix sometimes failed - - fixed GL_CLAMP mode texture sampling bug - - textured line interpolation was somewhat broken - - textured triangle interpolation was also somewhat broken - - glGet(MODELVIEW/PROJECTION/TEXTURE_MATRIX_STACK_DEPTH) off by one - - evaluator state wasn't fully initialized - - texture coordinate clipping was buggy - - evaluator surfaces could be mis-colored - - glAccum(GL_RETURN, s) didn't obey glColorMask() settings - - zero area polygons shouldn't be culled if polygon mode is point/line - - clipped width and height of glReadPixels was sometimes off by one - - blending with alpha = 0 or 1.0 wasn't always exact - - reading of pixels from clipped region was buggy - - minor tweaking of X visual management in GLX emulator - - glPolygonStipple now obeys pixel unpacking parameters - - glGetPolygonStipple now obeys pixel packing parameters - - interleaved vertex array texture coordinates were broken - - query of proxy texture internal format was broken - - alpha channel wasn't reliably cleared - - fixed divide by zero error in gluScaleImage if dest size = 1 x 1 - Conformance bug fixes: - - GL_SELECTION_BUFFER_POINTER and GL_SELECTION_BUFFER_SIZE were missing - - GL_TEXTURE_INTERNAL_FORMAT was missing - - glGet*(GL_POLYGON_STIPPLE) was broken - - glPush/PopAttrib() didn't save/restore all texture state - - glBitmap in feedback mode didn't work - - feedback of texture coords didn't always work - - glDrawPixels w/ format=GL_DEPTH_COMPONENT, type=GLbyte was broke - - glDrawPixels w/ format=GL_DEPTH_COMPONENT, type=GLubyte was broke - - glDrawPixels w/ format=GL_STENCIL_INDEX, type=GL_BITMAP was broke - Changes: - - upgraded GLUT to version 3.7 - - only GL and GLU library code included in MesaLib.tar.gz - - GLUT and all demos now in MesaDemos.tar.gz - - glaux and gltk libraries removed - - IRIX -n32 and -64 libs go in lib32/ and lib64/ directories - - -3.1 beta 1 November 19, 1998 - New: - - GL_EXT_stencil_wrap extension - - GL_INGR_blend_func_separate extension - - GL_ARB_multitexture extension - - GL_NV_texgen_reflection extension - - newly optimized vertex transformation code - - updated GLUT 3.7 code - - better precision when using 32-bit Z buffer - - Allegro DJGPP driver - Bug fixes: - - glCopyPixels between front/back buffers didn't copy alpha correctly - - fixed out-of-bounds memory access in optimized 2-D texture code - - glPixelStorei didn't accept GL_PACK/UNPACK_IMAGE_HEIGHT parameter - - glGet*() didn't accept GL_MAX_3D_TEXTURE_SIZE parameter - - clipping of texture coordinates sometimes had bad R,Q values - - GL_CLAMP_TO_EDGE texture sampling was off by 0.5 texels - - glEdgeFlagPointer() now takes a GLvoid * instead of GLboolean * - - texture was sometimes applied twice with 3Dfx driver - - glPush/PopAttrib() fouled up texture object reference counts - - glDeleteLists(0, n) caused assertion failure - - bilinear texture sampling wasn't accurate enough - - glClear w/ glDepthMask(GL_FALSE) didn't work right on 3Dfx - - color components were reversed on big endian 32 bpp X visuals - Changes: - - removed GL_EXT_multitexture extension - - -3.1 beta 2 May 24, 1999 - New: - - multi-textured points and lines (mjk@nvidia.com) - - optimized 24bpp X rendering (bernd.paysan@gmx.de) - - added allegro support (bernie-t@geocities.com) - - cleaned-up Windows-related stuff (Ted Jump) - - minor stereo changes (KendallB@scitechsoft.com) - - new BeOS driver which implements BGLView class - - new Direct3D driver (see src/D3D) - - more efficient filled gluCylinder() function - - utilities: util/showbuffer.[ch] and util/glstate.[ch] - - fixed some IRIX compiler warnings - - added support for building Mesa in XFree86 with - SGI's GLX (kevin@precisioninsight.com) - Bug fixes: - - a variety of Windows/Mesa bug fixes (mjk@nvidia.com) - - packed pixel images weren't unpacked correctly - - patches some win32 files in GLUT (mjk@nvidia.com) - - glTexImage[123]D() didn't accept internalFormat == GL_COLOR_INDEX - - fixed lighting bug in Keith's new shading code - - fixed texture segfault seen in Lament screensaver - - fixed miscellaneous low-memory bugs - - glClear(GL_COLOR_BUFFER_BIT) with RGBA or CI masking was broken - - GL_LINEAR sampling of 3D textures was broken - - fixed SVR4 'cc' compiler macro problem (dawes@xfree86.org) - - added GL_TEXTURE_PRIORITY fix (keithh@netcomuk.co.uk) - - fixed wide point and wide line conformance bugs (brianp) - Changes: - - some device driver changes (see src/dd.h) - - new copyright on core Mesa code - - -3.1 beta 3 September 17, 1999 - New: - - optimized glAccum function - - optimized 24bpp rendering in XMesa driver - - GLU 1.2 polygon tessellator - Bug Fixes: - - glGetTexLevelParameter wasn't fully implemented - - glXUseXFont now handles multi-byte fonts - - glIsEnabled(GL_TEXTURE_2D / 3D) returned wrong result - - alpha channel of blending points, lines was sometimes incorrect - Changes: - - New library names: "libGL" instead of "libMesaGL" - - New library numbering: libGL.so.1.2.310 - - New subdirectories: docs/ and bin/ - - New Makefile-system (autoconf,automake,libtool) - - -3.1 final December 14, 1999 - New: - - added demos/gloss.c - - added xdemos/glxdpyinfo.c - - added GLX_ARB_get_proc_address extension - - rewritten glTexImage code paths (faster, less memory, bug fixes) - Bug Fixes: - - several vertex array bug fixes - - overlapping glCopyPixels with pixel zooming now works - - glXUseXFont() bitmaps were vertically shifted by one pixel - - glCopyPixels with pixel zooming now works - - -3.2 final April 24, 2000 - Bug fixes: - - fixed memcpy bugs in span.c - - fixed missing glEnd problem in demos/tessdemo.c - - fixed bug when clearing 24bpp Ximages - - fixed clipping problem found in Unreal Tournament - - fixed Loki's "ice bug" and "crazy triangles" seen in Heretic2 - - fixed Loki's 3dfx RGB vs BGR bug - - fixed Loki's 3dfx smooth/flat shading bug in SoF - Changes: - - updated docs/README file - - use bcopy() optimizations on FreeBSD - - re-enabled the optimized persp_textured_triangle() function - - -3.2.1 July 19, 2000 - Bug fixes: - - gluBuild2DMipmaps() didn't accept GL_BGRA - - Fixed compile/makefile problems on IRIX - - fixed segfault in 3dfx driver when using GL selection/feedback - - no longer cull very, very tiny triangles - - blending w/ drawbuffer==GL_FRONT_BACK caused segfault (sw rendering) - - fixed Motif detection code in widgets-mesa/configure.in - - glColorMaterial and glMaterial updates to emissive and ambient - didn't always work right - - Specular highlights weren't always in the right place - - clipped GL_LINE mode polygons had interior lines appear - - blend term GL_ONE_MINUS_CONSTANT_ALPHA was broken - - GL_NICEST fog didn't always work with flat shading - - glRect commands in display lists were sometimes miscolored - - Line Z offset didn't always work - - fixed texgen normal vector problem (gloss's teapot) - - numerous GL conformance bugs fixed - Changes: - - glColorMask(false, false, false, false) handled better/faster - - reverted to old GLU polygon tessellator, GLU 1.1 - - updated Win32 build files - - -3.3 July 21, 2000 - New: - - antialiased triangles now implemented - - GL_EXT_texture_env_add texture mode extension - - GLX 1.3 API - - support for separate draw/read buffers (ie GL_SGI_make_current_read) - - thread-safe API dispath - - improved glxinfo program - - demos/texdown program to measure texture download performance - - glext.h header file - - demos/geartrain program - - GL_EXT_texture_lod_bias extension - - demos/lodbias program - - further optimized glRead/DrawPixels for 16-bit TrueColor X visuals - - GLX_EXT_visual_rating extension (a no-op, however) - - GL_HP_occlusion_test extension (for X and OS/Mesa drivers) - - demos/occlude program - - GL_SGIS_pixel_texture and GL_SGIX_pixel_texture extensions - - demos/pixeltex program - - GL_SGI_color_matrix extension - - GL_SGI_color_table extension - - GL_EXT_histogram extension - - GL_ARB_texture_cube_map extension - - added xdemos/glxheads and xdemos/manywin - - demos/texenv.c demo - - GL_EXT_texture_env_combine extension (by Holger Waechtler) - - Xlib driver is now thread-safe (see xdemos/glthreads) - Bug Fixes: - - various GL conformance failures fixed since 3.2.1 - Changes: - - gl.h now uses #defines instead of C enums for all tokens - - glu.h now uses #defines instead of C enums for all tokens - - moved programs from 3Dfx/demos/ into demos/ directory - - -3.4 November 3, 2000 - New: - - optimized glDrawPixels for glPixelZoom(1,-1) - Bug Fixes: - - widgets-mesa/src/*.c files were missing from 3.3 distro - - include/GL/mesa_wgl.h file was missing from 3.3 distro - - fixed some Win32 compile problems - - texture object priorities weren't getting initialized to 1.0 - - glAreTexturesResident return value was wrong when using hardware - - glXUseXFont segfaulted when using 3dfx driver (via MESA_GLX_FX) - - glReadPixels with GLushort packed types was broken - - fixed a few bugs in the GL_EXT_texture_env_combine texture code - - glPush/PopAttrib(GL_ENABLE_BIT) mishandled multi-texture enables - - fixed some typos/bugs in the VB code - - glDrawPixels(GL_COLOR_INDEX) to RGB window didn't work - - optimized glDrawPixels paths weren't being used - - per-fragment fog calculation didn't work without a Z buffer - - improved blending accuracy, fixes Glean blendFunc test failures - - glPixelStore(GL_PACK/UNPACK_SKIP_IMAGES) wasn't handled correctly - - glXGetProcAddressARB() didn't always return the right address - - gluBuild[12]DMipmaps() didn't grok the GL_BGR pixel format - - texture matrix changes weren't always detected (GLUT projtex demo) - - fixed random color problem in vertex fog code - - fixed Glide-related bug that let Quake get a 24-bit Z buffer - Changes: - - finished internal support for compressed textures for DRI - - -3.4.1 February 14, 2001 - New: - - fixed some Linux build problems - - fixed some Windows build problems - - GL_EXT_texture_env_dot3 extension (Gareth Hughes) - Bug fixes: - - added RENDER_START/RENDER_FINISH macros for glCopyTexImage in DRI - - various state-update code changes needed for DRI bugs - - disabled pixel transfer ops in glColorTable commands, not needed - - fixed bugs in glCopyConvolutionFilter1D/2D, glGetConvolutionFilter - - updated sources and fixed compile problems in widgets-mesa/ - - GLX_PBUFFER enum value was wrong in glx.h - - fixed a glColorMaterial lighting bug - - fixed bad args to Read/WriteStencilSpan in h/w stencil clear function - - glXCopySubBufferMESA() Y position was off by one - - Error checking of glTexSubImage3D() was broken (bug 128775) - - glPopAttrib() didn't restore all derived Mesa state correctly - - Better glReadPixels accuracy for 16bpp color - fixes lots of OpenGL - conformance problems at 16bpp. - - clearing depth buffer with scissoring was broken, would segfault - - OSMesaGetDepthBuffer() returned bad bytesPerValue value - - fixed a line clipping bug (reported by Craig McDaniel) - - fixed RGB color over/underflow bug for very tiny triangles - Known problems: - - NURBS or evaluator surfaces inside display lists don't always work - - -3.4.2 May 17, 2001 - Bug fixes: - - deleting the currently bound texture could cause bad problems - - using fog could result in random vertex alpha values - - AA triangle rendering could touch pixels outside right window bound - - fixed byteswapping problem in clear_32bit_ximage() function - - fixed bugs in wglUseFontBitmapsA(), by Frank Warmerdam - - fixed memory leak in glXUseXFont() - - fragment sampling in AA triangle function was off by 1/2 pixel - - Windows: reading pixels from framebuffer didn't always work - - glConvolutionFilter2D could segfault or cause FP exception - - fixed segfaults in FX and X drivers when using tex unit 1 but not 0 - - GL_NAND logicop didn't work right in RGBA mode - - fixed a memory corruption bug in vertex buffer reset code - - clearing the softwara alpha buffer with scissoring was broken - - fixed a few color index mode fog bugs - - fixed some bad assertions in color index mode - - fixed FX line 'stipple' bug #420091 - - fixed stencil buffer clear width/height typo - - fixed GL error glitches in gl[Client]ActiveTextureARB() - - fixed Windows compilation problem in texutil.c - - fixed 1/8-pixel AA triangle sampling error - Changes: - - optimized writing mono-colored pixel spans to X pixmaps - - increased max viewport size to 2048 x 2048 - - -3.5 June 21, 2001 - New: - - internals of Mesa divided into modular pieces (Keith Whitwell) - - 100% OpenGL 1.2 conformance (passes all conformance tests) - - new AA line algorithm - - GL_EXT_convolution extension - - GL_ARB_imaging subset - - OSMesaCreateContextExt() function - - GL_ARB_texture_env_add extension (same as GL_EXT_texture_env_add) - - GL_MAX_TEXTURE_UNITS_ARB now defaults to eight - - GL_EXT_fog_coord extension (Keith Whitwell) - - GL_EXT_secondary_color extension (Keith Whitwell) - - GL_ARB_texture_env_add extension (same as GL_EXT_texture_env_add) - - GL_SGIX_depth_texture extension - - GL_SGIX_shadow and GL_SGIX_shadow_ambient extensions - - demos/shadowtex.c demo of GL_SGIX_depth_texture and GL_SGIX_shadow - - GL_ARB_texture_env_combine extension - - GL_ARB_texture_env_dot3 extension - - GL_ARB_texture_border_clamp (aka GL_SGIS_texture_border_clamp) - - OSMesaCreateContextExt() function - - libOSMesa.so library, contains the OSMesa driver interface - - GL/glxext.h header file for GLX extensions - - somewhat faster software texturing, fogging, depth testing - - all color-index conformance tests now pass (only 8bpp tested) - - SPARC assembly language TCL optimizations (David Miller) - - GL_SGIS_generate_mipmap extension - Bug Fixes: - - fbiRev and tmuRev were unitialized when using Glide3 - - fixed a few color index mode conformance failures; all pass now - - now appling antialiasing coverage to alpha after texturing - - colors weren't getting clamped to [0,1] before color table lookup - - fixed RISC alignment errors caused by COPY_4UBV macro - - drawing wide, flat-shaded lines could cause a segfault - - vertices now snapped to 1/16 pixel to fix rendering of tiny triangles - Changes: - - SGI's Sample Implementation (SI) 1.3 GLU library replaces Mesa GLU - - new libOSMesa.so library, contains the OSMesa driver interface - - -4.0 October 22, 2001 - New: - - Mesa 4.0 implements the OpenGL 1.3 specification - - GL_IBM_rasterpos_clip extension - - GL_EXT_texture_edge_clamp extension (aka GL_SGIS_texture_edge_clamp) - - GL_ARB_texture_mirrored_repeat extension - - WindML UGL driver (Stephane Raimbault) - - added OSMESA_MAX_WIDTH/HEIGHT queries - - attempted compiliation fixes for Solaris 5, 7 and 8 - - updated glext.h and glxext.h files - - updated Windows driver (Karl Schultz) - Bug fixes: - - added some missing GLX 1.3 tokens to include/GL/glx.h - - GL_COLOR_MATRIX changes weren't recognized by teximage functions - - glCopyPixels with scale and bias was broken - - glRasterPos with lighting could segfault - - glDeleteTextures could leave a dangling pointer - - Proxy textures for cube maps didn't work - - fixed a number of 16-bit color channel bugs - - fixed a few minor memory leaks - - GLX context sharing was broken in 3.5 - - fixed state-update bugs in glPopClientAttrib() - - fixed glDrawRangeElements() bug - - fixed a glPush/PopAttrib() bug related to texture binding - - flat-shaded, textured lines were broken - - fixed a dangling pointer problem in the XMesa code (Chris Burghart) - - lighting didn't always produce the correct alpha value - - fixed 3DNow! code to not read past end of arrays (Andrew Lewycky) - - -4.0.1 December 17, 2001 - New: - - better sub-pixel sample positions for AA triangles (Ray Tice) - - slightly faster blending for (GL_ZERO, GL_ONE) and (GL_ONE, GL_ZERO) - Bug fixes: - - added missing break statements in glGet*() for multisample cases - - fixed uninitialized hash table mutex bug (display lists / texobjs) - - fixed bad teximage error check conditional (bug 476846) - - fixed demos readtex.c compilation problem on Windows (Karl Schultz) - - added missing glGet() query for GL_MAX_TEXTURE_LOD_BIAS_EXT - - silence some compiler warnings (gcc 2.96) - - enable the #define GL_VERSION_1_3 in GL/gl.h - - added GL 1.3 and GLX 1.4 entries to gl_mangle.h and glx_mangle.h - - fixed glu.h typedef problem found with MSDev 6.0 - - build libGL.so with -Bsymbolic (fixes bug found with Chromium) - - added missing 'const' to glXGetContextIDEXT() in glxext.h - - fixed a few glXGetProcAddress() errors (texture compression, etc) - - fixed start index bug in compiled vertex arrays (Keith) - - fixed compilation problems in src/SPARC/glapi_sparc.S - - fixed triangle strip "parity" bug found in VTK medical1 demo (Keith) - - use glXGetProcAddressARB in GLUT to avoid extension linking problems - - provoking vertex of flat-shaded, color-index triangles was wrong - - fixed a few display list bugs (GLUT walker, molecule, etc) (Keith) - - glTexParameter didn't flush the vertex buffer (Ray Tice) - - feedback attributes for glDraw/CopyPixels and glBitmap were wrong - - fixed bug in normal length caching (ParaView lighting bug) - - fixed separate_specular color bug found in Chimera (18 Dec 2001) - - -4.0.2 April 2, 2002 - New: - - New DOS (DJGPP) driver written by Daniel Borca - - New driver interface functions for TCL drivers (such as Radeon DRI) - - GL_RENDERER string returns "Mesa Offscreen16" or "Mesa Offscreen32" - if using deep color channels - - latest GL/glext.h and GL/glxext.h headers from SGI - Bug fixes: - - GL_BLEND with non-black texture env color wasn't always correct - - GL_REPLACE with GL_RGB texture format wasn't always correct (alpha) - - glTexEnviv( pname != GL_TEXTURE_ENV_COLOR ) was broken - - glReadPixels was sometimes mistakenly clipped by the scissor box - - glDraw/ReadPixels didn't catch all the errors that they should have - - Fixed 24bpp rendering problem in Windows driver (Karl Schultz) - - 16-bit GLchan mode fixes (m_trans_tmp.h, s_triangle.c) - - Fixed 1-bit float->int conversion bug in glDrawPixels(GL_DEPTH_COMP) - - glColorMask as sometimes effecting glXSwapBuffers() - - fixed a potential bug in XMesaGarbageCollect() - - N threads rendering into one window didn't work reliably - - glCopyPixels didn't work for deep color channels - - improved 8 -> 16bit/channel texture image conversion (Gerk Huisma) - - glPopAttrib() didn't correctly restore user clip planes - - user clip planes failed for some perspective projections (Chromium) - Known bugs: - - mipmap LOD computation - - -4.0.3 June 25, 2002 - New: - - updated GL/glext.h file (version 15) - - corrected MMX blend code (Jose Fonseca) - - support for software-based alpha planes in Windows driver - - updated GGI driver (Filip Spacek) - Bug fixes: - - glext.h had wrong values for GL_DOT3_RGB[A]_EXT tokens - - OSMesaMakeCurrent() didn't recognize buffer size changes - - assorted conformance fixes for 16-bit/channel rendering - - texcombine alpha subtraction mode was broken - - fixed lighting bug with non-uniform scaling and display lists - - fixed bug when deleting shared display lists - - disabled SPARC cliptest assembly code (Mesa bug 544665) - - fixed a couple Solaris compilation/link problems - - blending clipped glDrawPixels didn't always work - - glGetTexImage() didn't accept packed pixel types - - glPixelMapu[is]v() could explode given too large of pixelmap - - glGetTexParameter[if]v() didn't accept GL_TEXTURE_MAX_ANISOTROPY_EXT - - glXCopyContext() could lead to segfaults - - glCullFace(GL_FRONT_AND_BACK) didn't work (bug 572665) - Changes: - - lots of C++ (g++) code clean-ups - - lots of T&L updates for the Radeon DRI driver - Known bugs: - - mipmap LOD computation (fixed for Mesa 4.1) - - -4.0.4 October 3, 2002 - New: - - GL_NV_texture_rectangle extension - - updated glext.h header (version 17) - - updated DOS driver (Daniel Borca) - - updated BeOS R5 driver (Philippe Houdoin) - - added GL_IBM_texture_mirror_repeat - - glxinfo now takes -l option to print interesting OpenGL limits info - - GL_MESA_ycbcr_texture extension - - GL_APPLE_client_storage extension (for some DRI drivers only) - - GL_MESA_pack_invert extension - Bug fixes: - - fixed GL_LINEAR fog bug by adding clamping - - fixed FP exceptions found using Alpha CPU - - 3dfx MESA_GLX_FX=window (render to window) didn't work - - fixed memory leak in wglCreateContest (Karl Schultz) - - define GLAPIENTRY and GLAPI if undefined in glu.h - - wglGetProcAddress didn't handle all API functions - - when testing for OpenGL 1.2 vs 1.3, check for GL_ARB_texture_cube_map - - removed GL_MAX_CONVOLUTION_WIDTH/HEIGHT from glGetInteger/Float/etc() - - error checking in compressed tex image functions had some glitches - - fixed AIX compile problem in src/config.c - - glGetTexImage was using pixel unpacking instead of packing params - - auto-mipmap generation for cube maps was incorrect - Changes: - - max texture units reduced to six to accomodate texture rectangles - - removed unfinished GL_MESA_sprite_point extension code - - -4.1 October 29, 2002 - New: - - GL_NV_vertex_program extension - - GL_NV_vertex_program1_1 extension - - GL_ARB_window_pos extension - - GL_ARB_depth_texture extension - - GL_ARB_shadow extension - - GL_ARB_shadow_ambient extension - - GL_EXT_shadow_funcs extension - - GL_ARB_point_parameters extension - - GL_ARB_texture_env_crossbar - - GL_NV_point_sprite extension - - GL_NV_texture_rectangle extension - - GL_EXT_multi_draw_arrays extension - - GL_EXT_stencil_two_side extension - - GLX_SGIX_fbconfig and GLX_SGIX_pbuffer extensions - - GL_ATI_texture_mirror_once extension (Ian Romanick) - - massive overhaul/simplification of software rasterizer module, - many contributions from Klaus Niederkrueger - - faster software texturing in some cases (i.e. trilinear filtering) - - new OSMesaGetProcAddress() function - - more blend modes implemented with MMX code (Jose Fonseca) - - added glutGetProcAddress() to GLUT - - added GLUT_FPS env var to compute frames/second in glutSwapBuffers() - - pbinfo and pbdemo PBuffer programs - - glxinfo -v prints transprent pixel info (Gerd Sussner) - Bug fixes: - - better mipmap LOD computation (prevents excessive blurriness) - - OSMesaMakeCurrent() didn't recognize buffer size changes - - assorted conformance fixes for 16-bit/channel rendering - - texcombine alpha subtraction mode was broken - - fixed some blend problems when GLchan==GLfloat (Gerk Huisma) - - clamp colors to [0,inf] in OSMesa if GLchan==GLfloat (Gerk Huisma) - - fixed divide by zero error in NURBS tessellator (Jon Perry) - - fixed GL_LINEAR fog bug by adding clamping - - fixed FP exceptions found using Alpha CPU - - 3dfx/glide driver render-to-window feature was broken - - added missing GLX_TRANSPARENT_RGB token to glx.h - - fixed error checking related to paletted textures - - fixed reference count error in glDeleteTextures (Randy Fayan) - Changes: - - New spec file and Python code to generate some GL dispatch files - - Glide driver defaults to "no" with autoconf/automake - - updated demos/stex3d with new options - - -5.0 November 13, 2002 - New: - - OpenGL 1.4 support (glGetString(GL_VERSION) returns "1.4") - - removed some overlooked debugging code - - glxinfo updated to support GLX_ARB_multisample - - GLUT now support GLX_ARB_multisample - - updated DOS driver (Daniel Borca) - Bug fixes: - - GL_POINT and GL_LINE-mode polygons didn't obey cull state - - fixed potential bug in _mesa_align_malloc/calloc() - - fixed missing triangle bug when running vertex programs - - fixed a few HPUX compilation problems - - FX (Glide) driver didn't compile - - setting GL_TEXTURE_BORDER_COLOR with glTexParameteriv() didn't work - - a few EXT functions, like glGenTexturesEXT, were no-ops - - a few OpenGL 1.4 functions like glFogCoord*, glBlendFuncSeparate, - glMultiDrawArrays and glMultiDrawElements were missing - - glGet*(GL_ACTIVE_STENCIL_FACE_EXT) was broken - - Pentium 4 Mobile was mistakenly identified as having 3DNow! - - fixed one-bit error in point/line fragment Z calculation - - fixed potential segfault in fakeglx code - - fixed color overflow problem in DOT3 texture env mode - - -5.0.1 March 30, 2003 - New: - - DOS driver updates from Daniel Borca - - updated GL/gl_mangle.h file (Bill Hoffman) - Bug fixes: - - auto mipmap generation for cube maps was broken (bug 641363) - - writing/clearing software alpha channels was unreliable - - minor compilation fixes for OS/2 (Evgeny Kotsuba) - - fixed some bad assertions found with shadowtex demo - - fixed error checking bug in glCopyTexSubImage2D (bug 659020) - - glRotate(angle, -x, 0, 0) was incorrect (bug 659677) - - fixed potential segfault in texture object validation (bug 659012) - - fixed some bogus code in _mesa_test_os_sse_exception_support (Linus) - - fix fog stride bug in tnl code for h/w drivers (Michel Danzer) - - fixed glActiveTexture / glMatrixMode(GL_TEXTURE) bug (#669080) - - glGet(GL_CURRENT_SECONDARY_COLOR) should return 4 values, not 3 - - fixed compilation problem on Solaris7/x86 (bug 536406) - - fixed prefetch bug in 3DNow! code (Felix Kuhling) - - fixed NeXT build problem (FABSF macro) - - glDrawPixels Z values when glPixelZoom!=1 were invalid (bug 687811) - - zoomed glDraw/CopyPixels with clipping sometimes failed (bug 689964) - - AA line and triangle Z values are now rounded, not truncated - - fixed color interpolation bug when GLchan==GLfloat (bug 694461) - - glArePrograms/TexturesResident() wasn't 100% correct (Jose Fonseca) - - fixed a minor GL_COLOR_MATERIAL bug - - NV vertex program EXP instruction was broken - - glColorMask misbehaved with X window / pixmap rendering - - fix autoconf/libtool GLU C++ linker problem on Linux (a total hack) - - attempt to fix GGI compilation problem when MesaDemos not present - - NV vertex program ARL-relative fetches didn't work - Changes: - - use glPolygonOffset in gloss demo to avoid z-fighting artifacts - - updated winpos and pointblast demos to use ARB extensions - - disable SPARC normal transformation code (bug 673938) - - GLU fixes for OS/2 (Evgeny Kotsuba) - - -5.0.2 September 5, 2003 - Bug fixes: - - fixed texgen problem causing texcoord's Q to be zero (stex3d) - - default GL_TEXTURE_COMPARE_MODE_ARB was wrong - - GL_CURRENT_MATRIX_NV query was wrong - - GL_CURRENT_MATRIX_STACK_DEPTH_NV query was off by one - - GL_LIST_MODE query wasn't correct - - GL_FOG_COORDINATE_SOURCE_EXT query wasn't supported - - GL_SECONDARY_COLOR_ARRAY_SIZE_EXT query returned wrong value - - blended, wide lines didn't always work correctly (bug 711595) - - glVertexAttrib4svNV w component was always 1 - - fixed bug in GL_IBM_rasterpos_clip (missing return) - - GL_DEPTH_TEXTURE_MODE = GL_ALPHA didn't work correctly - - a few Solaris compilation fixes - - fixed glClear() problem for DRI drivers (non-existant stencil, etc) - - fixed int/REAL mixup in GLU NURBS curve evaluator (Eric Cazeaux) - - fixed delete [] bug in SI GLU (bug 721765) (Diego Santa Cruz) - - glFog() didn't clamp fog colors - - fixed bad float/int conversion for GL_TEXTURE_PRIORITY in the - gl[Get]TexParameteri[v] functions - - fixed invalid memory references in glTexGen functions (bug 781602) - - integer-valued color arrays weren't handled correctly - - glDrawPixels(GL_DEPTH_COMPONENT) with glPixelZoom didn't work - - GL_EXT_texture_lod_bias is part of 1.4, overlooked in 5.0.1 - Changes: - - build GLUT with -fexceptions so C++ apps propogate exceptions - - -5.1 December 17, 2003 - New: - - reorganized directory tree - - GL_ARB_vertex/fragment_program extensions (Michal Krol & Karl Rasche) - - GL_ATI_texture_env_combine3 extension (Ian Romanick) - - GL_SGI_texture_color_table extension (Eric Plante) - - GL_NV_fragment_program extension - - GL_NV_light_max_exponent extension - - GL_EXT_texture_rectangle (identical to GL_NV_texture_rectangle) - - GL_ARB_occlusion_query extension - - GL_ARB_point_sprite extension - - GL_ARB_texture_non_power_of_two extension - - GL_IBM_multimode_draw_arrays extension - - GL_EXT_texture_mirror_clamp extension (Ian Romanick) - - GL_ARB_vertex_buffer_object extension - - new X86 feature detection code (Petr Sebor) - - less memory used for display lists and vertex buffers - - demo of per-pixel lighting with a fragment program (demos/fplight.c) - - new version (18) of glext.h header - - new spriteblast.c demo of GL_ARB_point_sprite - - faster glDrawPixels in X11 driver in some cases (see RELNOTES-5.1) - - faster glCopyPixels in X11 driver in some cases (see RELNOTES-5.1) - Bug fixes: - - really enable OpenGL 1.4 features in DOS driver. - - fixed issues in glDrawPixels and glCopyPixels for very wide images - - glPixelMapf/ui/usv()'s size parameter is GLsizei, not GLint - - fixed some texgen bugs reported by Daniel Borca - - fixed wglMakeCurrent(NULL, NULL) bug (#835861) - - fixed glTexSubImage3D z-offset bug (Cedric Gautier) - - fixed RGBA blend enable bug (Ville Syrjala) - - glAccum is supposed to be a no-op in selection/feedback mode - - fixed texgen bug #597589 (John Popplewell) - Changes: - - dropped API trace feature (src/Trace/) - - documentation overhaul. merged with website content. more html. - - glxgears.c demo updated to use GLX swap rate extensions - - glTexImage1/2/3D now allows width/height/depth = 0 - - disable SPARC asm code on Linux (bug 852204) - - -6.0 January 16, 2004 - New: - - full OpenGL 1.5 support - - updated GL/glext.h file to version 21 - Changes: - - changed max framebuffer size to 4Kx4K (MAX_WIDTH/HEIGHT in config.h) - Bug fixes: - - fixed bug in UNCLAMPED_FLOAT_TO_UBYTE macro; solves a color - clamping issue - - updated suno5-gcc configs - - glColor3 functions sometimes resulted in undefined alpha values - - fixed FP divide by zero error seen on VMS with xlockmore, others - - fixed vertex/fragment program debug problem (bug 873011) - - building on AIX with gcc works now - - glDeleteProgramsARB failed for ARB fragment programs (bug 876160) - - glDrawRangeElements tried to modify potentially read-only storage - - updated files for building on Windows - - -6.0.1 April 2, 2004 - New: - - upgraded glext.h to version 22 - - new build targets (Dan Schikore) - - new linux-x86-opteron build target (Heath Feather) - Bug fixes: - - glBindProgramARB didn't update all necessary state - - fixed build problems on OpenBSD - - omit CVS directories from tarballs - - glGetTexImage(GL_COLOR_INDEX) was broken - - fixed an infinite loop in t&l module - - silenced some valgrind warnings about using unitialized memory - - fixed some compilation/link glitches on IRIX (Mike Stephens) - - glBindProgram wasn't getting compiled into display lists - - GLX_FBCONFIG_ID wasn't recognized in glXChooseFBConfig() (bug 888079) - - two-sided lighting and vertex program didn't work (bug 887330) - - stores to program parameter registers in vertex state programs - didn't work. - - fixed glOrtho bug found with gcc 3.2.2 (RH9) - - glXCreateWindow() wasn't fully implemented (bug 890894) - - generic vertex attribute arrays didn't work in display lists - - vertex buffer objects' default usage and access fields were wrong - - glDrawArrays with start!=0 was broken - - fragment program PK2H, UP2H, UP4B and UP4UB instructions were broken - - linux-osmesa16-static config didn't work - - fixed a few color index rendering problems (bug 910687) - - glInterleavedArrays didn't respect GL_CLIENT_ACTIVE_TEXTURE - - OSMesa RGB and BGR modes were broken - - glProgramStringARB mistakenly required a null-terminated string - - fragment program XPD instruction was incorrect - - glGetMaterial() didn't work reliably - - ARB_fragment_program KIL instruction was incorrect - - -6.1 August 18, 2004 - New: - - Revamped Makefile system - - glXUseRotatedXFont() utility (see xdemos/xuserotfont.c) - - internal driver interface changes related to texture object - allocation, vertex/fragment programs, BlendEquationSeparate, etc. - - option to walk triangle edges with double-precision floats - (Justin Novosad of Discreet) (see config.h file) - - support for AUX buffers in software GLX driver - - updated glext.h to version 24 and glxext.h to version 6 - - new MESA_GLX_FORCE_ALPHA and MESA_GLX_DEPTH_BITS env vars - - updated BeOS support (Philippe Houdoin) - Changes: - - fragment fog interpolation is perspective corrected now - - new glTexImage code, much cleaner, may be a bit faster - Bug fixes: - - glArrayElement in display lists didn't handle generic vertex attribs - - glFogCoord didn't always work properly - - ARB_fragment_program fog options didn't work - - frag prog TEX instruction no longer incorrectly divides s,t,r by q - - ARB frag prog TEX and TEXP instructions now use LOD=0 - - glTexEnviv in display lists didn't work - - glRasterPos didn't do texgen or apply texture matrix - - GL_DOUBLE-valued vertex arrays were broken in some cases - - fixed texture rectangle edge/border sampling bugs - - sampling an incomplete texture in a fragment program would segfault - - glTexImage was missing a few error checks - - fixed some minor glGetTexParameter glitches - - GL_INTENSITY was mistakenly accepted as a to glTexImage - - fragment program writes to RC/HC register were broken - - fixed a few glitches in GL_HP_occlusion_test extension - - glBeginQueryARB and glEndQueryARB didn't work inside display lists - - vertex program state references were broken - - fixed triangle color interpolation bug on AIX (Shane Blackett) - - fixed a number of minor memory leaks (bug #1002030) - - -6.2 October 2, 2004 - New: - - enabled GL_ARB_texture_rectangle (same as GL_NV_texture_rectangle) - - updated Doxygen support (Jose Fonseca) - Changes: - - some GGI driver updates (Christoph Egger, bug 1025977) - Bug fixes: - - Omit GL_ARB_texture_non_power_of_two from list of OpenGL 1.5 features - - fixed a few compilation issues on IRIX - - fixed a matrix classification bug (reported by Wes Bethel) - - we weren't reseting the vertex/fragment program error state - before parsing (Dave Reveman) - - adjust texcoords for sampling texture rectangles (Dave Reveman) - - glGet*(GL_MAX_VERTEX_ATTRIBS_ARB) wasn't implemented - - repeated calls to glDeleteTexture(t) could lead to a crash - - fixed potential ref count bugs in VBOs and vertex/fragment programs - - spriteblast demo didn't handle window size changes correctly - - glTexSubImage didn't handle pixels=NULL correctly for PBOs - - fixed color index mode glDrawPixels bug (Karl Schultz) - - -6.2.1 December 9, 2004 - Bug fixes: - - don't apply regular fog or color sum when using a fragment program - - glProgramEnvParameter4fARB always generated an error on - GL_FRAGMENT_PROGRAM_ARB (fdo bug 1645) - - glVertexAttrib3svNV and glVertexAttrib3svARB were broken - - fixed width/height mix-up in glSeparableFilter2D() - - fixed regression in glCopyPixels + convolution - - glReadPixels from a clipped front color buffer didn't always work - - glTexImage didn't accept GL_RED/GREEN/BLUE as the format - - Attempting queries/accesses of VBO 0 weren't detected as errors - - paletted textures failed if the palette had fewer than 256 entries - Changes: - - fixed a bunch of compiler warnings found with gcc 3.4 - - bug reports should to go bugzilla.freedesktop.org - - -6.3 July 20, 2005 - New: - - GL_EXT_framebuffer_object extension - - GL_ARB_draw_buffers extension - - GL_ARB_pixel_buffer_object extension - - GL_OES_read_format extension (Ian Romanick) - - DirectFB driver (Claudio Ciccani) - - x86_64 vertex transformation code (Mikko T.) - - Updated GL/glext.h to version 29 - Changes: - - added -stereo option for glxgears demo (Jacek Rosik) - - updated the PBuffer demo code in xdemos/ directory - - glDeleteTextures/Programs/Buffers() now makes the object ID - available for immediate re-use - - assorted 64-bit clean-ups fixes (x86_64 and Win64) - - lots of internal changes for GL_EXT_framebuffer_object - Bug fixes: - - some functions didn't support PBO functionality - - glGetTexImage didn't convert color index images to RGBA as required - - fragment program texcoords were sometimes wrong for points and lines - - fixed problem with negative dot product in arbfplight, fplight demos - - fixed bug in perspective correction of antialiased, textured lines - - querying GL_POST_CONVOLUTION_ALPHA_BIAS_EXT returned wrong value - - fixed a couple per-pixel fog bugs (Soju Matsumoto) - - glGetBooleanv(GL_FRAGMENT_PROGRAM_BINDING_NV) was broken - - fixed float parsing bug in ARB frag/vert programs (bug 2520) - - XMesaGetDepthBuffer() returned incorrect value for bytesPerValue - - GL_COLOR_MATERIAL with glColor3 didn't properly set diffuse alpha - - glXChooseFBConfig() crashed if attribList pointer was NULL - - program state.light[n].spot.direction.w was wrong value (bug 3083) - - fragment program fog option required glEnable(GL_FOG) - wrong. - - glColorTable() could produce a Mesa implementation error (bug 3135) - - RasterPos could get corrupted by color index rendering path - - Removed bad XTranslateCoordinates call when rendering to Pixmaps - - glPopAttrib() didn't properly restore GL_TEXTURE_GEN enable state - - fixed a few Darwin compilation problems - - -6.3.1 - This was an intermediate release for X.org which wasn't otherwise released. - - -6.3.2 August 19, 2005 - New: - - The distribution now includes the DRI drivers and GLX code - Changes: - - Made the DRI "new" driver interface standard, remove old code - Bug fixes: - - GL_ARB_vertex/fragment_shader were mistakenly listed in the - extensions string - - negative relative addressing in vertex programs was broken - - update/fix SPARC assembly code for vertex transformation - - fixed memory leak when freeing GLX drawables/renderbuffers - - fixed display list memory leak - - the GL_PIXEL_MAP_I_TO_I table is now floating point, not integer - - wglGetProcAddress() didn't handle wgl-functions - - fixed glxext.h cross-compile issue (Colin Harrison) - - assorted DRI driver fixes - - -6.4 October 24, 2005 - New: - - Added a fast XOR line drawing function in Xlib driver - - Added support for GL_ARB_texture_mirrored_repeat to savage - driver (supported only on Savage4 hardware). - Changes: - - Mesa now packaged in three parts: Library, Demos and GLUT - Bug fixes: - - GLX_X_RENDERABLE token wasn't accepted by glXChooseFBConfig - - Some files were present multiple times in the 6.3.2 tarballs - - r200_vtxtmp_x86.S file was missing from 6.3.2 tarball (bug 4207) - - glxgears_fbconfig demo didn't work (bug 4237) - - fixed bug when bilinear sampling 2d textures with borders - - glXCreatePbuffer() could segfault instead of returning 0 (bug 4235) - - fixed undefined frexp and rand in X.org libGLcore.a (bug 4242) - - fixed a few problems with proxy color tables (bug 4270) - - fixed precision problem in Z clearing (bug 4395) - - glBitmap, glDraw/CopyPixels mistakenly generated selection hits - - fixed potential segfault caused by reading pixels outside - of renderbuffer bounds - - glGetTexLevelParameter didn't accept GL_TEXTURE_DEPTH_SIZE_ARB - - fixed memory corruption bug involving software alpha buffers - - glReadPixels clipped by window bounds was sometimes broken - - glDraw/CopyPixels of stencil data ignored the stencil write mask - - glReadPixels from a texture bound to a framebuffer object didn't work - - glIsRender/FramebufferEXT weren't totally correct - - fixed a number of point size attenuation/fade bugs - - fixed glFogCoord bug 4729 - - GLX encoding for transpose matrix functions was broken - - fixed broken fragment program KIL and SWZ instructions - - fragment programs that wrote result.depth.z didn't work - - -6.4.1 November 30, 2005 - Bug fixes: - - redefining a vertex program string didn't take effect in TNL module - - fixed occasional segfault upon vertex/fragment parsing error - - vertex program LIT instruction didn't handle 0^0=1 correctly - - fragment program fog option didn't work with glDrawPixels, glBitmap - - USE_MGL_NAMESPACE didn't work for x86-64 - - OSMesa demos were missing from previous release tarballs - - fixed problem with float->ushort conversion in glClear (bug 4992) - - popping of GL_EYE_PLANE texgen state was broken (bug 4996) - - popping of GL_SPOT_DIRECTION light state was broken (bug 5005) - - fixed occasional triangle color interpolation problem on VMS - - work around invalid free() call (bug 5131) - - fixed BSD X server compilation problem by including stdint.h - - -6.4.2 February 2, 2006 - New: - - added OSMesaColorClamp() function/feature - - added wglGetExtensionStringARB() function - Bug fixes: - - fixed some problems when building on Windows - - GLw header files weren't installed by installmesa script (bug 5396) - - GL/glfbdev.h file was missing from tarballs - - fixed TNL initialization bug which could lead to crash (bug 5791) - - -6.5 March 31, 2006 - New: - - OpenGL Shading Language support through GL_ARB_shader_objects, - GL_ARB_shading_language_100, GL_ARB_vertex_shader and - GL_ARB_fragment_shader (done by Michal Krol) - - GL_EXT_packed_depth_stencil extension - - GL_EXT_timer_query extension - - GL_EXT_framebuffer_blit extension - - GL_ARB_half_float_pixel - - reflect demo improved to support multiple windows - - singlebuffer demo (shows no/little-flicker single-buffered rendering) - - r200: enable GL_ARB_texture_env_crossbar, separate the texture - sampling unit bits from the texture env combine enable bits - - r200: add support for GL_ATI_fragment_shader - - added fast XOR-mode line drawing optimization - - radeon: add support for all 3 tmus, GL_ARB_texture_cube_map - and GL_EXT_fog_coord - - MESA_GLX_ALPHA_BITS env var for xlib driver - - many DRI driver updates (including screen rotation support - for the Intel DRI driver) - Changes: - - removed GL_HP_occlusion_test (use GL_ARB_occlusion_query instead) - - removed GL_SGIX/SGIS_pixel_texture extensions - Bug fixes: - - fixed glxcontextmodes.c datatype problem (bug 5835) - - fixed aix-gcc build/install bugs (bug 5874) - - fixed some bugs in texture env program generation - - glXCopyContext() didn't handle texture object bindings properly - - glXCopyContext() didn't copy all lighting state - - fixed FreeBSD config (Pedro Giffuni) - - fixed some minor framebuffer object bugs - - replaced dprintf() with _glu_printf() in GLU (bug 6244) - - fixed a number of thread safety bugs/regressions - - fixed a number of GLU tesselator bugs (John Shell, bug 6339) - - paletted texturing was broken w/ floating point palettes (K. Schultz) - - lots of assorted framebuffer object bug fixes - -6.5.1 August 31, 2006 - New: - - Intel i965 DRI driver - - GL_APPLE_vertex_array_object extension (Ian Romanick) - - GL_EXT_texture_sRGB extension - - GL_EXT_gpu_program_parameters (Ian Romanick) - - "engine" demo - - updated fbdev driver and GLUT for fbdev (Sean D'Epagnier) - - many updates to the DRI drivers - Changes: - - The glVertexAttribARB functions no longer alias the conventional - vertex attributes. - - glxinfo program prints more info with -l option - - GL_FRAGMENT_PROGRAM_NV and GL_FRAGMENT_PROGRAM_ARB are now - compatible, in terms of glBindProgramARB() - Bug fixes: - - fixed broken texture border handling for depth textures (bug 6498) - - removed the test for duplicated framebuffer attachments, per - version 117 of the GL_EXT_framebuffer_object specification - - fixed a few render-to-texture bugs, including render to depth texture - - clipping of lines against user-defined clip planes was broken (6512) - - assembly language dispatch for SPARC was broken (bug 6484) - - assorted compilation fixes on various Unix platforms (Dan Schikore) - - glPopAttrib could restore an invalid value for GL_DRAW_BUFFER - - assorted minor fixes for 16 and 32 bit/channel modes - - fixed assorted bugs in texture compression paths - - fixed indirect rendering vertex array crashes (bug 6863) - - glDrawPixels GL_INDEX_OFFSET didn't always work - - fixed convolution memory leak (bug 7077) - - rectangular depth textures didn't work - - invalid mode to glBegin didn't generate an error (bug 7142) - - 'normalized' parameter to glVertexAttribPointerARB didn't work - - disable bogus GLX_SGI_video_sync extension in xlib driver - - fixed R128 driver locking bug (Martijn van Oosterhout) - - using evaluators with vertex programs caused crashes (bug 7564) - - fragment.position wasn't set correctly for point/line primitives - - fixed parser bug for scalar sources for GL_NV_fragment_program - - max fragment program length was incorrectly 128, now 1024 - - writes to result.depth in fragment programs weren't clamped to [0,1] - - fixed potential dangling pointer bug in glBindProgram() - - fixed some memory leaks (and potential crashes) in Xlib driver + + +Mesa Version History +==================== + +1.0 beta February 1995 + Initial release + +1.1 beta March 4, 1995 + Changes: + faster point and line drawing (2x faster) + more systems supported, better Makefiles + Renamed lib*.a files to avoid collisions + many small bug fixes + New: + pseudo-GLX functions added + new implementation of evaluators (eval2.c) + GLUT support + +1.1.1 beta March 7, 1995 + Changes: + Reverted from eval2.c to eval.c due to FPE on Linux + more speed improvements + more Makefile changes + +1.1.2 beta March 14, 1995 + New: + implementation of SGI's blending extensions + glXUseXFont implemented + added MESA_DEBUG environment variable support + Changes: + Using eval2.c again + more FPE-prevention checks (0-length normals are OK) + a few small bug fixes + much faster pixel logic ops! + faster transformation arithmetic + +1.1.3 beta March 31, 1995 + New: + gluScaleImage() and gluBuild2DMipMaps() implemented + Mesa widgets for Xt/Motif + blendEXT demos + added environment variables for selecting visuals + Changes: + almost all GLUT demos work correctly now + faster X device driver functions + more bug fixes + +1.1.4 beta April 20, 1995 + Bug fixes: + - missing #define SEEK_SET in src-tk/image.c + - compile glShadeModel into display lists + - fixed pow() domain error in src/light.c + - fixed "flickering bitmaps" in double buffer mode + - fixed tk.h and aux.h for C++ + - state of LIGHT_MODEL_LOCAL_VIEWER was inverted + New features: + - MUCH, MUCH nicer dithering in 8-bit RGB mode + - updated widgets and widget demos + - Implemented GLXPixmap functions + - Added GLU 1.1 and GLX 1.1 functions + - Changed the X/Mesa interface API, more versatile + - Implemented gluPartialDisk() + +1.2 May 22, 1995 + Bug fixes: + - IRIX 4.x makefile problem + - modified tk to share root colormap as needed + - gluLookAt normalization problem + - suppress Expose, NoExpose events in swapbuffers + - glBitmap() and glDrawPixels() clipping + New features: + - GL_BLEND, GL_MODULATE, GL_DECAL, and GL_REPLACE_EXT texture + modes implemented + - texture maps stored more efficiently + - texture maps can be compiled into display lists + - Bogdan Sikorski's GLU polygon tesselation code + - Linas Vepstas's sweep and extrusion library + - glXCreateContext()'s shareList parameter works as it's supposed to. + XMesaCreateContext() updated to accept a shareList parameter too. + - Mesa can be compiled with real OpenGL .h files + - MESA_BACK_BUFFER environment variable + - better GLX error checking + +1.2.1 June 22, 1995 + Bug fixes: + - X/Mesa double buffer window resize crash + - widgets now pass PointerMotion events + - X/Mesa incorrect default clear color and drawing color + - more robust X MIT-SHM support in X/Mesa + - glTexImage( format=GL_LUMINANCE ) didn't work + - GL_LINE mode polygons with line width > 1.0 could cause a crash + - numerous feedback bugs + - glReadPixels() from depth buffer was wrong + - error prone depth and stencil buffer allocation + New features: + - Preliminary Microsoft Windows driver + - Implemented a number of missing functions: glEvalCoord[12][df]v(), + glGet...(), etc. + - Added a few missing symbols to gl.h and glu.h + - Faster rendering of smooth-shaded, RGBA, depth-buffered polygons. + - Faster rendering of lines when width=2.0 + - Stencil-related functions now work in display lists + Changes: + - renamed aux.h as glaux.h (MS-DOS names can't start with aux) + - most filenames are in 8.3 format to accomodate MS-DOS + - use GLubytes to store arrays of colors instead of GLints + +1.2.2 August 2, 1995 + New features: + - texture mapped points and lines + - NURBS! (but not 100% complete) + - viewports may safely extend beyond window boundaries + - MESA_PRIVATE_CMAP environment variable + - Grayscale X display support + - two new demos: demos/gears.c and demos/shadow.c + - MachTen for Macintosh configuration + Bug fixes: + - glGet*(GL_DEPTH_BITS) returned bytes, not bits + - point, line, and bitmap rasterization suffered from roundoff errors + - fixed a division by zero error in line clippping + - occasional wrong default background color really fixed! + - glDepthFunc(GL_ALWAYS) with glDepthMask(GL_FALSE) didn't work + - gluBuild2DMipmaps malloc problem fixed + - view volume clipping of smooth shaded lines resulted in bad colors + Changes: + - new visual selection method in glXChooseVisual() + - improved GLU quadric functions + - call XSync for glFinish and XFlush for glFlush + - glVertex() calls now use a function pointer to avoid conditionals + - removed contrib directory from Mesa tar file (available on ftp site) + - AIX shared library support + - Removed GLUenum type as it's not in OpenGL + +1.2.3 September 26, 1995 + New features: + - Mesa header files now equivalent to SGI OpenGL headers + - Support for HP's Color Recovery dithering displays + - Faster vertex transformation + - Faster raster operations into X windows under certain conditions + - New configurations: HP w/ shared libs, Ultrix w/ GCC, Data General + - 4-bit visuals now supported + Bug fixes: + - glScissor bug fixed + - round-off errors in clipping lines against clip planes fixed + - byte swapping between hosts and display servers implemented + - glGetError() can be called without a current rendering context + - problem with accidentally culled polygons is fixed + - fixed some widget compilation problems + +1.2.4 November 17, 1995 + New features: + - More speed improvements (lighting, fogging, polygon drawing) + - Window system and OS-independent off-screen rendering + - Preliminary Fortran bindings + - glPolygonOffsetEXT implemented + - glColorMask and glIndexMask now fully implemented + - glPixelZoom implemented + - display lists fully implemented + - gamma correction + - dithering in 8-bit TrueColor/DirectColor visuals + Changes: + - Improved device driver interface + - tk.h renamed to gltk.h to avoid conflicts with Tcl's Tk + - Dithering support moved from core into device driver + Bug fixes: + - glEnable/Disable( GL_LIGHTING ) didn't always take effect + - glReadPixels byte swapping was broken + - glMaterial with pname==GL_AMBIENT_AND_DIFFUSE was broken + - duplicate glColor4b() prototype in GL/gl.h removed + - stripes in wave -ci demo fixed + - GL_LINEAR_MIPMAP_NEAREST had wrong value + - bugs in HP Color Recovery support fixed + - fixed bug when blending lines, points, bitmaps outside of window + +1.2.5 November 30, 1995 + New Features: + - updated MS Windows driver + - new implementation of StaticGray/GrayScale visual support + Bug fixes: + - pixelzooming with gamma correction or blending didn't work + - HP color recovery visual wasn't being picked by glXChooseVisual + - glClear didn't always observe glColorMask changes + - olympic and offset demos didn't compile on some Suns + - texcoord clamping wasn't correct + - a polygon optimization introduced an occasional sampling problem + +1.2.6 January 26, 1996 + New Features: + - faster line and polygon rendering under certain conditions. See + Performance Tips 9 and 10 in README + - profiling + - lighting is a bit faster + - better perspective corrected texture mapping + - Amiga AmiWin (X11) support + - preliminary Linux SVGA driver + Changes: + - now using a 16-bit depth buffer, faster, smaller + - GL_NORMALIZE is disabled by default + Bug fixes: + - projective texture mapping + - fixed a memory leak in the context destroy function + - GL_POLYGON with less than 3 vertices caused a crash + - glGet*() returned wrong result for GL_INDEX_MODE + - reading pixels from an unmapped X window caused a BadMatch error + +1.2.7 March 5, 1996 + New: + - faster lighting + - faster 16-bit TrueColor rendering on Linux + - faster 32-bit TrueColor rendering on Linux, HP, IBM + - non-depth-buffered XImage polygons are faster + - vertex array extension + - software alpha planes + - updated Macintosh driver + - new NeXT driver + - GLU quadric functions generate texture coordinates + - reflect.c demo - reflective, textured surface demo + Changes: + - gamma correction code moved into the X driver for better performance + Bug fixes: + - multiple glClipPlane()'s didn't work reliably + - glPolygonMode() didn't always work + - glCullFace( GL_FRONT_AND_BACK ) didn't work + - texture mapping with gamma correction was buggy + - floating point exceptions in texture coordinate interpolation + - XImage byte swapping didn't always work + - polygon edge flags weren't always used correctly + +1.2.8 May 22, 1996 + New: + - overlay planes on X servers with the SERVER_OVERLAY_VISUALS property + - better monochrome output + - more IRIX 6.x configurations + - more robust RGB mode color allocation + - added MESA_XSYNC environment variable + - GLX_MESA_pixmap_colormap and GLX_EXT_visual_info extensions + - GL_MESA_window_pos extension + - faster glReadPixels/glDrawPixels for GL_DEPTH and GL_UNSIGNED_SHORT + and GL_UNSIGNED_INT + - driver for prototype Cirrus Mondello 3-D board + - updated AmigaDOS driver + - a few small speed optimizations in polygon rendering + Changes: + - internal device driver interface modified to simplify device + driver implementations and to support hardware Z buffers + - several changes to the X/Mesa interface (xmesa.h) + Bug fixes: + - fixed pow(0,0) domain error triggered on some systems + - glStencilClear() in a display list caused an infinite loop + - glRasterPos*() was sometimes off by +/-0.5 in X and Y + - color masking and blending were performed in wrong order + - auxSolidCylinder() sometimes drew a wire-frame cylinder + - fixed file writing bug in osdemo.c + - pixel mapping didn't always work + - the GL_GEQUAL stencil func didn't work + - the GL_INVERT stencil op didn't work + - the stencil write mask didn't work + - glPush/PopAttrib() didn't do enough error checking + - glIsList() didn't always work correctly + +2.0 October 10, 1996 + New: + - Implements OpenGL 1.1 API functions + - all texture filtering modes supported (mipmapping) + - faster texture mapping, see Performance Tip 11 in README + - antialiased RGB points + - X support for line and polygon stippling + - glDrawBuffer( GL_FRONT_AND_BACK ) works + - util/ directory of useful stuff + - demos/texobj demo of texture objects + Changes: + - major internal changes for thread-safeness + - new device driver interface + - MESA_ALPHA env variable removed + - triangle rasterizer replaces polygon rasterizer + Bug fixes: + - glPopAttrib() bug + - glDrawBuffer(GL_NONE) works now + +2.1 December 14, 1996 + New: + - VMS support + - MS-DOS driver + - OpenStep support + - updated, combined Windows 95/NT driver + - implemented glGetLighti() and glGetTexGen*() + - GLX does garbage collection of ancillary buffers + Bug fixes: + - removed unused _EXT constants from gl.h + - fixed polygon offset bugs + - Z coordinates of clipped lines were incorrect + - glEdgeFlag() in display lists didn't always work + - glLight*() in display lists didn't work + - fixed X line stipple bugs (Michael Pichler) + - glXUseXfonts XFreeFont/XFreeFontInfo bug fixed + - fixed a feedback bug + - glTexGen*() now transforms GL_EYE_PLANE by inverse modelview matrix + - polygons were sometimes culled instead of clipped + - triangle rasterizer suffered from float/int overflow exceptions + - fixed FP underflow exception in lighting (specular exponent) + - glEnable/glDisable of GL_EXT_vertex_array enums didn't work + - fixed free(NULL) in GLU tesselator code + - using 24-bit color on some X servers resulted in garbage rendering + - 32-bit per pixel mode for XFree86 now works + - glRotate(a,0,0,0) gave unpredictable results + - GL_LINE_STRIP with > 480 vertices had occasional clipping problems + - 8-bit TrueColor GLXPixmap rendering incorrectly required a colormap + - glMaterial() wasn't ignored when GL_COLOR_MATERIAL was enabled + - glEnable(GL_COLOR_MATERIAL) followed by glColor() didn't work right + - accumulation buffer was limited to positive values + - projective textures didn't work + - selection buffer overflows weren't handled correctly + Changes: + - restored the GL_EXT_polygon_offset extension + - slightly faster RGB dithering + - the SVGA driver works again + - Amiga driver now distributed separately + - NeXT driver updated for Mesa 2.x + +2.2 March 14, 1997 + New: + - better color selection when dithering + - added GL_EXT_texture_object extension + - updated MS-DOS driver for DJGPP + - added openbsd make configuration + - faster dithered flat-shaded triangles + - various compilation problems with Motif widgets fixed + - gl.h, glx.h and glu.h name mangling option + - BeOS driver + - 3D texture mapping extension + - GL_MESA_resize_buffers extension + - morph3d, stex3d and spectex demos + - 3Dfx support + Bug fixes: + - glColorMaterial should finally work right in all respects + - linear interpolation of mipmap levels was incorrectly weighted + - readpix.c didn't compile on Macintosh + - GL_INVERT and related logic ops didn't work right + - glTexImage[12]D() didn't check its parameters consistantly + - fixed a memory leak in glTexImage[12]D() + - kludged around a SunOS 5.x/GCC compiler bug in the feedback code + - glReadPixels aborted instead of normally catching some errors + - a few 1.1 constants were missing or misnamed in gl.h + - glBegin(p); glBegin(q); didn't generate an error + - fixed a memory leak in GLX code + - clipping of concave polygons could cause a core dump + - 1-component alpha texture maps didn't work + - fixed a GLU polygon tesselator bug + - polygons with colinear vertices were sometimes culled + - feedback triangle colors were wrong when using smooth shading + - textures with borders didn't work correctly + - colors returned in feedback mode were wrong when using lighting + - spotlights didn't effect ambient lighting correctly + - gluPartialDisk() had a few bugs + Changes: + - device driver interface expanded to support texture mapping + - faster matrix inversion subroutine + - commented out #include "wmesa_extend.h" from src/wmesa.c + - fixed many compiler warnings in the demo programs + +2.3 June 30, 1997 + New: + - Mesa distribution divided into two pieces: library code and demos + - faster vertex transformation, clip testing, lighting + - faster line drawing + - TrueColor visuals how have dithering (for depths < 24 bits) + - added MESA_NO_DITHER environment variable + - new device driver function: NearFar(), RenderVB(), RasterSetup() + - added LynxOS configuration + - added cygnus Win32 configuration + - added texcyl.c GLUT demo + - added XMesaDitherColor() to X/Mesa interface + - new NURBS code from Bogdan Sikorski + - added demos/shape.c (non-rectangular X window!) + Bug fixes: + - glEnable/DisableClientState() were missing from GL/gl.h + - GL_SPHERE_MAP texcoord generation didn't work correctly + - glXGetConfig() returned wrong number of depth, stencil, accum bits + - glDrawPixels feedback/selection didn't examine RasterPos valid bit + - black and white were reversed on some monochrome displays + - fixed potential image memory leak (wasn't setting reference counter) + - glDrawPixels sometimes didn't recognize some GL state changes + - gluProject/UnProject() didn't check for divide by zero + - stex3d demo called random() and srandom(), not portable + - fixed memory leaks in context.c and drawpix.c + - fixed NULL dereferencing problem in gl_update_texture_state() + - glReadPixels between glBegin/glEnd didn't generate an error. + - fixed memory leak in polygon tesselator (Randy Frank) + - fixed seg fault bug drawing flat-shaded, depth-tested lines + - clipped GL_TRIANGLE_STRIPs sometimes had wrong color when flat-shaded + - glBindTexture sometimes didn't work + - fixed a bug deep in glXReleaseBuffersMESA() + - fog was mistakenly applied to alpha + - glPopMatrix didn't set "dirty matrix" flag + - glPolygonStipple pattern was sometimes wrong + - glClear wasn't disabled during feedback and selection + - fixed memory leak in glTexSubImage[123]D + Changes: + - many library source files reorganized + - faster X color allocation, colors also freed when finished with them + - new texture sampling function pointer in texture objects + - incorporated 3Dfx VooDoo driver v0.16 into main source tree + - many 3Dfx driver updates + - cygnus Makefiles now included + - updated DOS driver + - made a few changes to dosmesa.c and wmesa.c (VB->Unclipped) + - internally, colors now stored in GLubytes, not GLfixed + - optimized changing of GL_SHININESS parameter + +2.4 September 18, 1997 + New: + - updated 3Dfx Glide driver + - hacks for 3Dfx rendering into an X window or fullscreen + - added depth buffer access functions to X/Mesa and OS/Mesa interfaces + Bug fixes: + - pixel buffer could overflow with long, wide lines + - fixed FP underflow problems in lighting + - glTexSubImage1D() had an unitialized variable + - incomplete texture objects could cause a segfault + - glDrawPixels with GL_COMPILE_AND_EXECUTE caused infinite loop + - flat-shaded quads in a strip were miscolored if clipped + - mipmapped triangle lod computation now works correctly + - fixed a few under/overflow bugs in triangle rasterizer + - glArrayElement() assigned bad normal if normal array disabled + - changed argument to glXReleaseBuffersMESA() + - fixed small triangle underflow bugs in tritemp.h (hopefully) + - glBindTexture(target, 0) caused a crash + - glTexImage[123]D() with NULL image pointer caused crash + - glPixelStore parameters are now ignored during display list execution + - fixed a two-sided lighting w/ clipping bug (black vertices) + - textures with width!=height were sometimes mis-rendered + - "weird" projection matrices could cause div by 0, other fp errors + Changes: + - changed precompiled header symbol from PCH to PC_HEADER + - split api.c into api1.c and api2.c + - added hash.c source file (but not used yet) + - a few Sun and HP configuration file changes + - MESA_GLX_FX env var replaces MESA_FX_WINDOW and MESA_FX_FULLSCREEN + - fixed a few cygnus build problems (src/Makefile.cygnus, src/wmesa.c) + +2.5 November 20, 1997 + New: + - updated 3Dfx driver (v20) for GLQuake + - added GL_EXT_paletted_texture extension + - added GL_EXT_shared_texture_palette extension + - added GL_EXT_point_parameters extension + - now including Mark Kilgard's GLUT library v3.6 + - new GLUT-based demos in gdemos/ + - added a few more Unix config targets + - added Intel X86 assembly language vertex transformation code + - 3Dfx/Glide driver for Mesa now recognizes SST_SCREENREFRESH env var + - Windows 95 S3 Virge driver + Bug fixes: + - glCopyTexImage?D would crash due to uninitialized variable + - glColor w/ glColorMaterial in a display list caused a bug + - fixed several glDrawPixels() and ReadPixels() bugs in 3Dfx driver + - glVertex4*() vertices weren't always projected correctly + - trying to use mipmapped textured points or lines caused crash + - glColor[34][fd]() values now clamped to [0,1] before int conversion + Changes: + - new device driver functions for texture mapping + - hash tables used for display list and texture object lookup + - fixed GLX visual handling code to avoid saving redundant visuals + - 3Dfx Glide libraries automatically linked to libMesaGL.so + - dropped the Cirrus Logic Mondello code since it's obsolete + - updated Cygnus Makefiles (Stephane Rehel) + - updated Windows MSVC++ Makefiles (Oleg Letsinsky) + - procedure for making library files has changed: scripts now take + a major and minor version arguments. Make-config changed a lot. + - new implementation of glTexSubImage2D() + - updated widgets-mesa directory to create libMesaGLwM.a (Motif widget) + - separate linux-glide and linux-386-glide configurations + +2.6 February 12, 1998 + New: + - Windows WGL functions + - updated VMS, DOS, Windows, Cygnus, BeOS, Amiga compilation support + - v0.22 of 3Dfx Glide driver + - more X86 assembly language optimizations + - faster blending for some modes + - XMesaSetFXmode() to switch between 3Dfx window and full-screen mode + - added preliminary thread support + - added GLX_MESA_copy_sub_buffer extension + - some clipping optimizations + Bug fixes: + - fixed shading/material bug when drawing long primitive strips + - fixed clipping problem in long primitive strips + - fixed clipping bug when using 3Dfx driver + - fixed a problem when trying to use X fonts w/ 3Dfx driver + - fixed a texture filter bug in 3Dfx/Glide driver + - fixed bug in 3Dfx/Glide driver involving depth mask & clearing + - glLoadMatrix to set projection matrix confused the 3Dfx driver + - non-identity texture matrices didn't work with linux-386 configs + - glGenTextures() didn't reserve the returned texture IDs + - NULL proxy image sent to glTexImageXD() caused crash + - added texture state validation optimization (Henk Kok) + - fixed colormap reuse problem when using both RGB and CI windows + - 32bpp True/DirectColor X visuals weren't recognized + - fixed potential problem in evaluators memory allocation + - fixed assorted demo compilation bugs + Changes: + - replaced old Mesa/windows/ directory with Mesa/WIN32/ directory + - converted a few old glaux/gltk demos to GLUT + - renamed directories: demos -> xdemos, gdemos -> demos + + +3.0 September 17, 1998 + New: + - OpenGL 1.2 API + - GL_EXT_abgr pixel format extension + - GL_SGIS_texture_edge_clamp extension + - GL_SGIS_multitexture extension (to be replaced by GL_ARB_multitex) + - GL_EXT_multitexture extension (to be replaced by GL_ARB_multitex) + - GL_EXT_rescale_normal extension and renormal.c demo + - GLX_SGI_video_sync extension (a no-op) + - antialiased lines + - glGetTexImage() now implemented + - glDraw/Copy/ReadPixels() optimizations + - optimized textured triangle code (Marten Stromberg) + - more optimization of dithered TrueColor triangles in X driver + - Linux GGI driver + - updated MGL driver + Bug fixes: + - lots of assorted compilation fixes + - glInitNames didn't write initial hit record + - glBitmap didn't always check for invalid raster position + - switching between GLX and OSMesa contexts caused a crash + - fixed uninitialized variable in Mesa widget code + - fixed typo in texture code which caused book/texgen to crash + - fixed texture sampling bug when filter=GL_LINEAR and wrap=GL_CLAMP + - gluDisk() in POINT or LINE mode sometimes failed + - fixed texture + fog bug + - GL_COMPILE_AND_EXECUTE mode didn't work reliably + - glMultMatrix in projection matrix mode w/ 3Dfx driver could fail + - glDrawPixels(color index pixels) weren't converted to RGBA + - fixed possible getenv() buffer overflow security bug + - glBitmap in feedback mode was offset by xOrig, yOrig params + - device driver's DrawPixels hook was never used + - glDrawPixels with zoomY!=1 and top/bottom clipping didn't work + - glDrawPixels optimized for GL_LUMINANCE, GL_LUMINANCE_ALPHA, GLubyte + - fixed MakeCurrent bug in GLwRedrawObjects() in MesaWorkstation.c + - glCopyTexSubImage2D() didn't work with 3Dfx driver + - lines with width = 2 could cause crash + - glClear with scissor rect sometimes cleared whole buffer + - glTexSubImage2D( .. GL_COLOR_INDEX .. ) didn't work + - glTexImageXD( .. GL_ABGR_EXT .. ) didn't work + - computation of inverse modelview matrix sometimes failed + - fixed GL_CLAMP mode texture sampling bug + - textured line interpolation was somewhat broken + - textured triangle interpolation was also somewhat broken + - glGet(MODELVIEW/PROJECTION/TEXTURE_MATRIX_STACK_DEPTH) off by one + - evaluator state wasn't fully initialized + - texture coordinate clipping was buggy + - evaluator surfaces could be mis-colored + - glAccum(GL_RETURN, s) didn't obey glColorMask() settings + - zero area polygons shouldn't be culled if polygon mode is point/line + - clipped width and height of glReadPixels was sometimes off by one + - blending with alpha = 0 or 1.0 wasn't always exact + - reading of pixels from clipped region was buggy + - minor tweaking of X visual management in GLX emulator + - glPolygonStipple now obeys pixel unpacking parameters + - glGetPolygonStipple now obeys pixel packing parameters + - interleaved vertex array texture coordinates were broken + - query of proxy texture internal format was broken + - alpha channel wasn't reliably cleared + - fixed divide by zero error in gluScaleImage if dest size = 1 x 1 + Conformance bug fixes: + - GL_SELECTION_BUFFER_POINTER and GL_SELECTION_BUFFER_SIZE were missing + - GL_TEXTURE_INTERNAL_FORMAT was missing + - glGet*(GL_POLYGON_STIPPLE) was broken + - glPush/PopAttrib() didn't save/restore all texture state + - glBitmap in feedback mode didn't work + - feedback of texture coords didn't always work + - glDrawPixels w/ format=GL_DEPTH_COMPONENT, type=GLbyte was broke + - glDrawPixels w/ format=GL_DEPTH_COMPONENT, type=GLubyte was broke + - glDrawPixels w/ format=GL_STENCIL_INDEX, type=GL_BITMAP was broke + Changes: + - upgraded GLUT to version 3.7 + - only GL and GLU library code included in MesaLib.tar.gz + - GLUT and all demos now in MesaDemos.tar.gz + - glaux and gltk libraries removed + - IRIX -n32 and -64 libs go in lib32/ and lib64/ directories + + +3.1 beta 1 November 19, 1998 + New: + - GL_EXT_stencil_wrap extension + - GL_INGR_blend_func_separate extension + - GL_ARB_multitexture extension + - GL_NV_texgen_reflection extension + - newly optimized vertex transformation code + - updated GLUT 3.7 code + - better precision when using 32-bit Z buffer + - Allegro DJGPP driver + Bug fixes: + - glCopyPixels between front/back buffers didn't copy alpha correctly + - fixed out-of-bounds memory access in optimized 2-D texture code + - glPixelStorei didn't accept GL_PACK/UNPACK_IMAGE_HEIGHT parameter + - glGet*() didn't accept GL_MAX_3D_TEXTURE_SIZE parameter + - clipping of texture coordinates sometimes had bad R,Q values + - GL_CLAMP_TO_EDGE texture sampling was off by 0.5 texels + - glEdgeFlagPointer() now takes a GLvoid * instead of GLboolean * + - texture was sometimes applied twice with 3Dfx driver + - glPush/PopAttrib() fouled up texture object reference counts + - glDeleteLists(0, n) caused assertion failure + - bilinear texture sampling wasn't accurate enough + - glClear w/ glDepthMask(GL_FALSE) didn't work right on 3Dfx + - color components were reversed on big endian 32 bpp X visuals + Changes: + - removed GL_EXT_multitexture extension + + +3.1 beta 2 May 24, 1999 + New: + - multi-textured points and lines (mjk@nvidia.com) + - optimized 24bpp X rendering (bernd.paysan@gmx.de) + - added allegro support (bernie-t@geocities.com) + - cleaned-up Windows-related stuff (Ted Jump) + - minor stereo changes (KendallB@scitechsoft.com) + - new BeOS driver which implements BGLView class + - new Direct3D driver (see src/D3D) + - more efficient filled gluCylinder() function + - utilities: util/showbuffer.[ch] and util/glstate.[ch] + - fixed some IRIX compiler warnings + - added support for building Mesa in XFree86 with + SGI's GLX (kevin@precisioninsight.com) + Bug fixes: + - a variety of Windows/Mesa bug fixes (mjk@nvidia.com) + - packed pixel images weren't unpacked correctly + - patches some win32 files in GLUT (mjk@nvidia.com) + - glTexImage[123]D() didn't accept internalFormat == GL_COLOR_INDEX + - fixed lighting bug in Keith's new shading code + - fixed texture segfault seen in Lament screensaver + - fixed miscellaneous low-memory bugs + - glClear(GL_COLOR_BUFFER_BIT) with RGBA or CI masking was broken + - GL_LINEAR sampling of 3D textures was broken + - fixed SVR4 'cc' compiler macro problem (dawes@xfree86.org) + - added GL_TEXTURE_PRIORITY fix (keithh@netcomuk.co.uk) + - fixed wide point and wide line conformance bugs (brianp) + Changes: + - some device driver changes (see src/dd.h) + - new copyright on core Mesa code + + +3.1 beta 3 September 17, 1999 + New: + - optimized glAccum function + - optimized 24bpp rendering in XMesa driver + - GLU 1.2 polygon tessellator + Bug Fixes: + - glGetTexLevelParameter wasn't fully implemented + - glXUseXFont now handles multi-byte fonts + - glIsEnabled(GL_TEXTURE_2D / 3D) returned wrong result + - alpha channel of blending points, lines was sometimes incorrect + Changes: + - New library names: "libGL" instead of "libMesaGL" + - New library numbering: libGL.so.1.2.310 + - New subdirectories: docs/ and bin/ + - New Makefile-system (autoconf,automake,libtool) + + +3.1 final December 14, 1999 + New: + - added demos/gloss.c + - added xdemos/glxdpyinfo.c + - added GLX_ARB_get_proc_address extension + - rewritten glTexImage code paths (faster, less memory, bug fixes) + Bug Fixes: + - several vertex array bug fixes + - overlapping glCopyPixels with pixel zooming now works + - glXUseXFont() bitmaps were vertically shifted by one pixel + - glCopyPixels with pixel zooming now works + + +3.2 final April 24, 2000 + Bug fixes: + - fixed memcpy bugs in span.c + - fixed missing glEnd problem in demos/tessdemo.c + - fixed bug when clearing 24bpp Ximages + - fixed clipping problem found in Unreal Tournament + - fixed Loki's "ice bug" and "crazy triangles" seen in Heretic2 + - fixed Loki's 3dfx RGB vs BGR bug + - fixed Loki's 3dfx smooth/flat shading bug in SoF + Changes: + - updated docs/README file + - use bcopy() optimizations on FreeBSD + - re-enabled the optimized persp_textured_triangle() function + + +3.2.1 July 19, 2000 + Bug fixes: + - gluBuild2DMipmaps() didn't accept GL_BGRA + - Fixed compile/makefile problems on IRIX + - fixed segfault in 3dfx driver when using GL selection/feedback + - no longer cull very, very tiny triangles + - blending w/ drawbuffer==GL_FRONT_BACK caused segfault (sw rendering) + - fixed Motif detection code in widgets-mesa/configure.in + - glColorMaterial and glMaterial updates to emissive and ambient + didn't always work right + - Specular highlights weren't always in the right place + - clipped GL_LINE mode polygons had interior lines appear + - blend term GL_ONE_MINUS_CONSTANT_ALPHA was broken + - GL_NICEST fog didn't always work with flat shading + - glRect commands in display lists were sometimes miscolored + - Line Z offset didn't always work + - fixed texgen normal vector problem (gloss's teapot) + - numerous GL conformance bugs fixed + Changes: + - glColorMask(false, false, false, false) handled better/faster + - reverted to old GLU polygon tessellator, GLU 1.1 + - updated Win32 build files + + +3.3 July 21, 2000 + New: + - antialiased triangles now implemented + - GL_EXT_texture_env_add texture mode extension + - GLX 1.3 API + - support for separate draw/read buffers (ie GL_SGI_make_current_read) + - thread-safe API dispath + - improved glxinfo program + - demos/texdown program to measure texture download performance + - glext.h header file + - demos/geartrain program + - GL_EXT_texture_lod_bias extension + - demos/lodbias program + - further optimized glRead/DrawPixels for 16-bit TrueColor X visuals + - GLX_EXT_visual_rating extension (a no-op, however) + - GL_HP_occlusion_test extension (for X and OS/Mesa drivers) + - demos/occlude program + - GL_SGIS_pixel_texture and GL_SGIX_pixel_texture extensions + - demos/pixeltex program + - GL_SGI_color_matrix extension + - GL_SGI_color_table extension + - GL_EXT_histogram extension + - GL_ARB_texture_cube_map extension + - added xdemos/glxheads and xdemos/manywin + - demos/texenv.c demo + - GL_EXT_texture_env_combine extension (by Holger Waechtler) + - Xlib driver is now thread-safe (see xdemos/glthreads) + Bug Fixes: + - various GL conformance failures fixed since 3.2.1 + Changes: + - gl.h now uses #defines instead of C enums for all tokens + - glu.h now uses #defines instead of C enums for all tokens + - moved programs from 3Dfx/demos/ into demos/ directory + + +3.4 November 3, 2000 + New: + - optimized glDrawPixels for glPixelZoom(1,-1) + Bug Fixes: + - widgets-mesa/src/*.c files were missing from 3.3 distro + - include/GL/mesa_wgl.h file was missing from 3.3 distro + - fixed some Win32 compile problems + - texture object priorities weren't getting initialized to 1.0 + - glAreTexturesResident return value was wrong when using hardware + - glXUseXFont segfaulted when using 3dfx driver (via MESA_GLX_FX) + - glReadPixels with GLushort packed types was broken + - fixed a few bugs in the GL_EXT_texture_env_combine texture code + - glPush/PopAttrib(GL_ENABLE_BIT) mishandled multi-texture enables + - fixed some typos/bugs in the VB code + - glDrawPixels(GL_COLOR_INDEX) to RGB window didn't work + - optimized glDrawPixels paths weren't being used + - per-fragment fog calculation didn't work without a Z buffer + - improved blending accuracy, fixes Glean blendFunc test failures + - glPixelStore(GL_PACK/UNPACK_SKIP_IMAGES) wasn't handled correctly + - glXGetProcAddressARB() didn't always return the right address + - gluBuild[12]DMipmaps() didn't grok the GL_BGR pixel format + - texture matrix changes weren't always detected (GLUT projtex demo) + - fixed random color problem in vertex fog code + - fixed Glide-related bug that let Quake get a 24-bit Z buffer + Changes: + - finished internal support for compressed textures for DRI + + +3.4.1 February 14, 2001 + New: + - fixed some Linux build problems + - fixed some Windows build problems + - GL_EXT_texture_env_dot3 extension (Gareth Hughes) + Bug fixes: + - added RENDER_START/RENDER_FINISH macros for glCopyTexImage in DRI + - various state-update code changes needed for DRI bugs + - disabled pixel transfer ops in glColorTable commands, not needed + - fixed bugs in glCopyConvolutionFilter1D/2D, glGetConvolutionFilter + - updated sources and fixed compile problems in widgets-mesa/ + - GLX_PBUFFER enum value was wrong in glx.h + - fixed a glColorMaterial lighting bug + - fixed bad args to Read/WriteStencilSpan in h/w stencil clear function + - glXCopySubBufferMESA() Y position was off by one + - Error checking of glTexSubImage3D() was broken (bug 128775) + - glPopAttrib() didn't restore all derived Mesa state correctly + - Better glReadPixels accuracy for 16bpp color - fixes lots of OpenGL + conformance problems at 16bpp. + - clearing depth buffer with scissoring was broken, would segfault + - OSMesaGetDepthBuffer() returned bad bytesPerValue value + - fixed a line clipping bug (reported by Craig McDaniel) + - fixed RGB color over/underflow bug for very tiny triangles + Known problems: + - NURBS or evaluator surfaces inside display lists don't always work + + +3.4.2 May 17, 2001 + Bug fixes: + - deleting the currently bound texture could cause bad problems + - using fog could result in random vertex alpha values + - AA triangle rendering could touch pixels outside right window bound + - fixed byteswapping problem in clear_32bit_ximage() function + - fixed bugs in wglUseFontBitmapsA(), by Frank Warmerdam + - fixed memory leak in glXUseXFont() + - fragment sampling in AA triangle function was off by 1/2 pixel + - Windows: reading pixels from framebuffer didn't always work + - glConvolutionFilter2D could segfault or cause FP exception + - fixed segfaults in FX and X drivers when using tex unit 1 but not 0 + - GL_NAND logicop didn't work right in RGBA mode + - fixed a memory corruption bug in vertex buffer reset code + - clearing the softwara alpha buffer with scissoring was broken + - fixed a few color index mode fog bugs + - fixed some bad assertions in color index mode + - fixed FX line 'stipple' bug #420091 + - fixed stencil buffer clear width/height typo + - fixed GL error glitches in gl[Client]ActiveTextureARB() + - fixed Windows compilation problem in texutil.c + - fixed 1/8-pixel AA triangle sampling error + Changes: + - optimized writing mono-colored pixel spans to X pixmaps + - increased max viewport size to 2048 x 2048 + + +3.5 June 21, 2001 + New: + - internals of Mesa divided into modular pieces (Keith Whitwell) + - 100% OpenGL 1.2 conformance (passes all conformance tests) + - new AA line algorithm + - GL_EXT_convolution extension + - GL_ARB_imaging subset + - OSMesaCreateContextExt() function + - GL_ARB_texture_env_add extension (same as GL_EXT_texture_env_add) + - GL_MAX_TEXTURE_UNITS_ARB now defaults to eight + - GL_EXT_fog_coord extension (Keith Whitwell) + - GL_EXT_secondary_color extension (Keith Whitwell) + - GL_ARB_texture_env_add extension (same as GL_EXT_texture_env_add) + - GL_SGIX_depth_texture extension + - GL_SGIX_shadow and GL_SGIX_shadow_ambient extensions + - demos/shadowtex.c demo of GL_SGIX_depth_texture and GL_SGIX_shadow + - GL_ARB_texture_env_combine extension + - GL_ARB_texture_env_dot3 extension + - GL_ARB_texture_border_clamp (aka GL_SGIS_texture_border_clamp) + - OSMesaCreateContextExt() function + - libOSMesa.so library, contains the OSMesa driver interface + - GL/glxext.h header file for GLX extensions + - somewhat faster software texturing, fogging, depth testing + - all color-index conformance tests now pass (only 8bpp tested) + - SPARC assembly language TCL optimizations (David Miller) + - GL_SGIS_generate_mipmap extension + Bug Fixes: + - fbiRev and tmuRev were unitialized when using Glide3 + - fixed a few color index mode conformance failures; all pass now + - now appling antialiasing coverage to alpha after texturing + - colors weren't getting clamped to [0,1] before color table lookup + - fixed RISC alignment errors caused by COPY_4UBV macro + - drawing wide, flat-shaded lines could cause a segfault + - vertices now snapped to 1/16 pixel to fix rendering of tiny triangles + Changes: + - SGI's Sample Implementation (SI) 1.3 GLU library replaces Mesa GLU + - new libOSMesa.so library, contains the OSMesa driver interface + + +4.0 October 22, 2001 + New: + - Mesa 4.0 implements the OpenGL 1.3 specification + - GL_IBM_rasterpos_clip extension + - GL_EXT_texture_edge_clamp extension (aka GL_SGIS_texture_edge_clamp) + - GL_ARB_texture_mirrored_repeat extension + - WindML UGL driver (Stephane Raimbault) + - added OSMESA_MAX_WIDTH/HEIGHT queries + - attempted compiliation fixes for Solaris 5, 7 and 8 + - updated glext.h and glxext.h files + - updated Windows driver (Karl Schultz) + Bug fixes: + - added some missing GLX 1.3 tokens to include/GL/glx.h + - GL_COLOR_MATRIX changes weren't recognized by teximage functions + - glCopyPixels with scale and bias was broken + - glRasterPos with lighting could segfault + - glDeleteTextures could leave a dangling pointer + - Proxy textures for cube maps didn't work + - fixed a number of 16-bit color channel bugs + - fixed a few minor memory leaks + - GLX context sharing was broken in 3.5 + - fixed state-update bugs in glPopClientAttrib() + - fixed glDrawRangeElements() bug + - fixed a glPush/PopAttrib() bug related to texture binding + - flat-shaded, textured lines were broken + - fixed a dangling pointer problem in the XMesa code (Chris Burghart) + - lighting didn't always produce the correct alpha value + - fixed 3DNow! code to not read past end of arrays (Andrew Lewycky) + + +4.0.1 December 17, 2001 + New: + - better sub-pixel sample positions for AA triangles (Ray Tice) + - slightly faster blending for (GL_ZERO, GL_ONE) and (GL_ONE, GL_ZERO) + Bug fixes: + - added missing break statements in glGet*() for multisample cases + - fixed uninitialized hash table mutex bug (display lists / texobjs) + - fixed bad teximage error check conditional (bug 476846) + - fixed demos readtex.c compilation problem on Windows (Karl Schultz) + - added missing glGet() query for GL_MAX_TEXTURE_LOD_BIAS_EXT + - silence some compiler warnings (gcc 2.96) + - enable the #define GL_VERSION_1_3 in GL/gl.h + - added GL 1.3 and GLX 1.4 entries to gl_mangle.h and glx_mangle.h + - fixed glu.h typedef problem found with MSDev 6.0 + - build libGL.so with -Bsymbolic (fixes bug found with Chromium) + - added missing 'const' to glXGetContextIDEXT() in glxext.h + - fixed a few glXGetProcAddress() errors (texture compression, etc) + - fixed start index bug in compiled vertex arrays (Keith) + - fixed compilation problems in src/SPARC/glapi_sparc.S + - fixed triangle strip "parity" bug found in VTK medical1 demo (Keith) + - use glXGetProcAddressARB in GLUT to avoid extension linking problems + - provoking vertex of flat-shaded, color-index triangles was wrong + - fixed a few display list bugs (GLUT walker, molecule, etc) (Keith) + - glTexParameter didn't flush the vertex buffer (Ray Tice) + - feedback attributes for glDraw/CopyPixels and glBitmap were wrong + - fixed bug in normal length caching (ParaView lighting bug) + - fixed separate_specular color bug found in Chimera (18 Dec 2001) + + +4.0.2 April 2, 2002 + New: + - New DOS (DJGPP) driver written by Daniel Borca + - New driver interface functions for TCL drivers (such as Radeon DRI) + - GL_RENDERER string returns "Mesa Offscreen16" or "Mesa Offscreen32" + if using deep color channels + - latest GL/glext.h and GL/glxext.h headers from SGI + Bug fixes: + - GL_BLEND with non-black texture env color wasn't always correct + - GL_REPLACE with GL_RGB texture format wasn't always correct (alpha) + - glTexEnviv( pname != GL_TEXTURE_ENV_COLOR ) was broken + - glReadPixels was sometimes mistakenly clipped by the scissor box + - glDraw/ReadPixels didn't catch all the errors that they should have + - Fixed 24bpp rendering problem in Windows driver (Karl Schultz) + - 16-bit GLchan mode fixes (m_trans_tmp.h, s_triangle.c) + - Fixed 1-bit float->int conversion bug in glDrawPixels(GL_DEPTH_COMP) + - glColorMask as sometimes effecting glXSwapBuffers() + - fixed a potential bug in XMesaGarbageCollect() + - N threads rendering into one window didn't work reliably + - glCopyPixels didn't work for deep color channels + - improved 8 -> 16bit/channel texture image conversion (Gerk Huisma) + - glPopAttrib() didn't correctly restore user clip planes + - user clip planes failed for some perspective projections (Chromium) + Known bugs: + - mipmap LOD computation + + +4.0.3 June 25, 2002 + New: + - updated GL/glext.h file (version 15) + - corrected MMX blend code (Jose Fonseca) + - support for software-based alpha planes in Windows driver + - updated GGI driver (Filip Spacek) + Bug fixes: + - glext.h had wrong values for GL_DOT3_RGB[A]_EXT tokens + - OSMesaMakeCurrent() didn't recognize buffer size changes + - assorted conformance fixes for 16-bit/channel rendering + - texcombine alpha subtraction mode was broken + - fixed lighting bug with non-uniform scaling and display lists + - fixed bug when deleting shared display lists + - disabled SPARC cliptest assembly code (Mesa bug 544665) + - fixed a couple Solaris compilation/link problems + - blending clipped glDrawPixels didn't always work + - glGetTexImage() didn't accept packed pixel types + - glPixelMapu[is]v() could explode given too large of pixelmap + - glGetTexParameter[if]v() didn't accept GL_TEXTURE_MAX_ANISOTROPY_EXT + - glXCopyContext() could lead to segfaults + - glCullFace(GL_FRONT_AND_BACK) didn't work (bug 572665) + Changes: + - lots of C++ (g++) code clean-ups + - lots of T&L updates for the Radeon DRI driver + Known bugs: + - mipmap LOD computation (fixed for Mesa 4.1) + + +4.0.4 October 3, 2002 + New: + - GL_NV_texture_rectangle extension + - updated glext.h header (version 17) + - updated DOS driver (Daniel Borca) + - updated BeOS R5 driver (Philippe Houdoin) + - added GL_IBM_texture_mirror_repeat + - glxinfo now takes -l option to print interesting OpenGL limits info + - GL_MESA_ycbcr_texture extension + - GL_APPLE_client_storage extension (for some DRI drivers only) + - GL_MESA_pack_invert extension + Bug fixes: + - fixed GL_LINEAR fog bug by adding clamping + - fixed FP exceptions found using Alpha CPU + - 3dfx MESA_GLX_FX=window (render to window) didn't work + - fixed memory leak in wglCreateContest (Karl Schultz) + - define GLAPIENTRY and GLAPI if undefined in glu.h + - wglGetProcAddress didn't handle all API functions + - when testing for OpenGL 1.2 vs 1.3, check for GL_ARB_texture_cube_map + - removed GL_MAX_CONVOLUTION_WIDTH/HEIGHT from glGetInteger/Float/etc() + - error checking in compressed tex image functions had some glitches + - fixed AIX compile problem in src/config.c + - glGetTexImage was using pixel unpacking instead of packing params + - auto-mipmap generation for cube maps was incorrect + Changes: + - max texture units reduced to six to accomodate texture rectangles + - removed unfinished GL_MESA_sprite_point extension code + + +4.1 October 29, 2002 + New: + - GL_NV_vertex_program extension + - GL_NV_vertex_program1_1 extension + - GL_ARB_window_pos extension + - GL_ARB_depth_texture extension + - GL_ARB_shadow extension + - GL_ARB_shadow_ambient extension + - GL_EXT_shadow_funcs extension + - GL_ARB_point_parameters extension + - GL_ARB_texture_env_crossbar + - GL_NV_point_sprite extension + - GL_NV_texture_rectangle extension + - GL_EXT_multi_draw_arrays extension + - GL_EXT_stencil_two_side extension + - GLX_SGIX_fbconfig and GLX_SGIX_pbuffer extensions + - GL_ATI_texture_mirror_once extension (Ian Romanick) + - massive overhaul/simplification of software rasterizer module, + many contributions from Klaus Niederkrueger + - faster software texturing in some cases (i.e. trilinear filtering) + - new OSMesaGetProcAddress() function + - more blend modes implemented with MMX code (Jose Fonseca) + - added glutGetProcAddress() to GLUT + - added GLUT_FPS env var to compute frames/second in glutSwapBuffers() + - pbinfo and pbdemo PBuffer programs + - glxinfo -v prints transprent pixel info (Gerd Sussner) + Bug fixes: + - better mipmap LOD computation (prevents excessive blurriness) + - OSMesaMakeCurrent() didn't recognize buffer size changes + - assorted conformance fixes for 16-bit/channel rendering + - texcombine alpha subtraction mode was broken + - fixed some blend problems when GLchan==GLfloat (Gerk Huisma) + - clamp colors to [0,inf] in OSMesa if GLchan==GLfloat (Gerk Huisma) + - fixed divide by zero error in NURBS tessellator (Jon Perry) + - fixed GL_LINEAR fog bug by adding clamping + - fixed FP exceptions found using Alpha CPU + - 3dfx/glide driver render-to-window feature was broken + - added missing GLX_TRANSPARENT_RGB token to glx.h + - fixed error checking related to paletted textures + - fixed reference count error in glDeleteTextures (Randy Fayan) + Changes: + - New spec file and Python code to generate some GL dispatch files + - Glide driver defaults to "no" with autoconf/automake + - updated demos/stex3d with new options + + +5.0 November 13, 2002 + New: + - OpenGL 1.4 support (glGetString(GL_VERSION) returns "1.4") + - removed some overlooked debugging code + - glxinfo updated to support GLX_ARB_multisample + - GLUT now support GLX_ARB_multisample + - updated DOS driver (Daniel Borca) + Bug fixes: + - GL_POINT and GL_LINE-mode polygons didn't obey cull state + - fixed potential bug in _mesa_align_malloc/calloc() + - fixed missing triangle bug when running vertex programs + - fixed a few HPUX compilation problems + - FX (Glide) driver didn't compile + - setting GL_TEXTURE_BORDER_COLOR with glTexParameteriv() didn't work + - a few EXT functions, like glGenTexturesEXT, were no-ops + - a few OpenGL 1.4 functions like glFogCoord*, glBlendFuncSeparate, + glMultiDrawArrays and glMultiDrawElements were missing + - glGet*(GL_ACTIVE_STENCIL_FACE_EXT) was broken + - Pentium 4 Mobile was mistakenly identified as having 3DNow! + - fixed one-bit error in point/line fragment Z calculation + - fixed potential segfault in fakeglx code + - fixed color overflow problem in DOT3 texture env mode + + +5.0.1 March 30, 2003 + New: + - DOS driver updates from Daniel Borca + - updated GL/gl_mangle.h file (Bill Hoffman) + Bug fixes: + - auto mipmap generation for cube maps was broken (bug 641363) + - writing/clearing software alpha channels was unreliable + - minor compilation fixes for OS/2 (Evgeny Kotsuba) + - fixed some bad assertions found with shadowtex demo + - fixed error checking bug in glCopyTexSubImage2D (bug 659020) + - glRotate(angle, -x, 0, 0) was incorrect (bug 659677) + - fixed potential segfault in texture object validation (bug 659012) + - fixed some bogus code in _mesa_test_os_sse_exception_support (Linus) + - fix fog stride bug in tnl code for h/w drivers (Michel Danzer) + - fixed glActiveTexture / glMatrixMode(GL_TEXTURE) bug (#669080) + - glGet(GL_CURRENT_SECONDARY_COLOR) should return 4 values, not 3 + - fixed compilation problem on Solaris7/x86 (bug 536406) + - fixed prefetch bug in 3DNow! code (Felix Kuhling) + - fixed NeXT build problem (FABSF macro) + - glDrawPixels Z values when glPixelZoom!=1 were invalid (bug 687811) + - zoomed glDraw/CopyPixels with clipping sometimes failed (bug 689964) + - AA line and triangle Z values are now rounded, not truncated + - fixed color interpolation bug when GLchan==GLfloat (bug 694461) + - glArePrograms/TexturesResident() wasn't 100% correct (Jose Fonseca) + - fixed a minor GL_COLOR_MATERIAL bug + - NV vertex program EXP instruction was broken + - glColorMask misbehaved with X window / pixmap rendering + - fix autoconf/libtool GLU C++ linker problem on Linux (a total hack) + - attempt to fix GGI compilation problem when MesaDemos not present + - NV vertex program ARL-relative fetches didn't work + Changes: + - use glPolygonOffset in gloss demo to avoid z-fighting artifacts + - updated winpos and pointblast demos to use ARB extensions + - disable SPARC normal transformation code (bug 673938) + - GLU fixes for OS/2 (Evgeny Kotsuba) + + +5.0.2 September 5, 2003 + Bug fixes: + - fixed texgen problem causing texcoord's Q to be zero (stex3d) + - default GL_TEXTURE_COMPARE_MODE_ARB was wrong + - GL_CURRENT_MATRIX_NV query was wrong + - GL_CURRENT_MATRIX_STACK_DEPTH_NV query was off by one + - GL_LIST_MODE query wasn't correct + - GL_FOG_COORDINATE_SOURCE_EXT query wasn't supported + - GL_SECONDARY_COLOR_ARRAY_SIZE_EXT query returned wrong value + - blended, wide lines didn't always work correctly (bug 711595) + - glVertexAttrib4svNV w component was always 1 + - fixed bug in GL_IBM_rasterpos_clip (missing return) + - GL_DEPTH_TEXTURE_MODE = GL_ALPHA didn't work correctly + - a few Solaris compilation fixes + - fixed glClear() problem for DRI drivers (non-existant stencil, etc) + - fixed int/REAL mixup in GLU NURBS curve evaluator (Eric Cazeaux) + - fixed delete [] bug in SI GLU (bug 721765) (Diego Santa Cruz) + - glFog() didn't clamp fog colors + - fixed bad float/int conversion for GL_TEXTURE_PRIORITY in the + gl[Get]TexParameteri[v] functions + - fixed invalid memory references in glTexGen functions (bug 781602) + - integer-valued color arrays weren't handled correctly + - glDrawPixels(GL_DEPTH_COMPONENT) with glPixelZoom didn't work + - GL_EXT_texture_lod_bias is part of 1.4, overlooked in 5.0.1 + Changes: + - build GLUT with -fexceptions so C++ apps propogate exceptions + + +5.1 December 17, 2003 + New: + - reorganized directory tree + - GL_ARB_vertex/fragment_program extensions (Michal Krol & Karl Rasche) + - GL_ATI_texture_env_combine3 extension (Ian Romanick) + - GL_SGI_texture_color_table extension (Eric Plante) + - GL_NV_fragment_program extension + - GL_NV_light_max_exponent extension + - GL_EXT_texture_rectangle (identical to GL_NV_texture_rectangle) + - GL_ARB_occlusion_query extension + - GL_ARB_point_sprite extension + - GL_ARB_texture_non_power_of_two extension + - GL_IBM_multimode_draw_arrays extension + - GL_EXT_texture_mirror_clamp extension (Ian Romanick) + - GL_ARB_vertex_buffer_object extension + - new X86 feature detection code (Petr Sebor) + - less memory used for display lists and vertex buffers + - demo of per-pixel lighting with a fragment program (demos/fplight.c) + - new version (18) of glext.h header + - new spriteblast.c demo of GL_ARB_point_sprite + - faster glDrawPixels in X11 driver in some cases (see RELNOTES-5.1) + - faster glCopyPixels in X11 driver in some cases (see RELNOTES-5.1) + Bug fixes: + - really enable OpenGL 1.4 features in DOS driver. + - fixed issues in glDrawPixels and glCopyPixels for very wide images + - glPixelMapf/ui/usv()'s size parameter is GLsizei, not GLint + - fixed some texgen bugs reported by Daniel Borca + - fixed wglMakeCurrent(NULL, NULL) bug (#835861) + - fixed glTexSubImage3D z-offset bug (Cedric Gautier) + - fixed RGBA blend enable bug (Ville Syrjala) + - glAccum is supposed to be a no-op in selection/feedback mode + - fixed texgen bug #597589 (John Popplewell) + Changes: + - dropped API trace feature (src/Trace/) + - documentation overhaul. merged with website content. more html. + - glxgears.c demo updated to use GLX swap rate extensions + - glTexImage1/2/3D now allows width/height/depth = 0 + - disable SPARC asm code on Linux (bug 852204) + + +6.0 January 16, 2004 + New: + - full OpenGL 1.5 support + - updated GL/glext.h file to version 21 + Changes: + - changed max framebuffer size to 4Kx4K (MAX_WIDTH/HEIGHT in config.h) + Bug fixes: + - fixed bug in UNCLAMPED_FLOAT_TO_UBYTE macro; solves a color + clamping issue + - updated suno5-gcc configs + - glColor3 functions sometimes resulted in undefined alpha values + - fixed FP divide by zero error seen on VMS with xlockmore, others + - fixed vertex/fragment program debug problem (bug 873011) + - building on AIX with gcc works now + - glDeleteProgramsARB failed for ARB fragment programs (bug 876160) + - glDrawRangeElements tried to modify potentially read-only storage + - updated files for building on Windows + + +6.0.1 April 2, 2004 + New: + - upgraded glext.h to version 22 + - new build targets (Dan Schikore) + - new linux-x86-opteron build target (Heath Feather) + Bug fixes: + - glBindProgramARB didn't update all necessary state + - fixed build problems on OpenBSD + - omit CVS directories from tarballs + - glGetTexImage(GL_COLOR_INDEX) was broken + - fixed an infinite loop in t&l module + - silenced some valgrind warnings about using unitialized memory + - fixed some compilation/link glitches on IRIX (Mike Stephens) + - glBindProgram wasn't getting compiled into display lists + - GLX_FBCONFIG_ID wasn't recognized in glXChooseFBConfig() (bug 888079) + - two-sided lighting and vertex program didn't work (bug 887330) + - stores to program parameter registers in vertex state programs + didn't work. + - fixed glOrtho bug found with gcc 3.2.2 (RH9) + - glXCreateWindow() wasn't fully implemented (bug 890894) + - generic vertex attribute arrays didn't work in display lists + - vertex buffer objects' default usage and access fields were wrong + - glDrawArrays with start!=0 was broken + - fragment program PK2H, UP2H, UP4B and UP4UB instructions were broken + - linux-osmesa16-static config didn't work + - fixed a few color index rendering problems (bug 910687) + - glInterleavedArrays didn't respect GL_CLIENT_ACTIVE_TEXTURE + - OSMesa RGB and BGR modes were broken + - glProgramStringARB mistakenly required a null-terminated string + - fragment program XPD instruction was incorrect + - glGetMaterial() didn't work reliably + - ARB_fragment_program KIL instruction was incorrect + + +6.1 August 18, 2004 + New: + - Revamped Makefile system + - glXUseRotatedXFont() utility (see xdemos/xuserotfont.c) + - internal driver interface changes related to texture object + allocation, vertex/fragment programs, BlendEquationSeparate, etc. + - option to walk triangle edges with double-precision floats + (Justin Novosad of Discreet) (see config.h file) + - support for AUX buffers in software GLX driver + - updated glext.h to version 24 and glxext.h to version 6 + - new MESA_GLX_FORCE_ALPHA and MESA_GLX_DEPTH_BITS env vars + - updated BeOS support (Philippe Houdoin) + Changes: + - fragment fog interpolation is perspective corrected now + - new glTexImage code, much cleaner, may be a bit faster + Bug fixes: + - glArrayElement in display lists didn't handle generic vertex attribs + - glFogCoord didn't always work properly + - ARB_fragment_program fog options didn't work + - frag prog TEX instruction no longer incorrectly divides s,t,r by q + - ARB frag prog TEX and TEXP instructions now use LOD=0 + - glTexEnviv in display lists didn't work + - glRasterPos didn't do texgen or apply texture matrix + - GL_DOUBLE-valued vertex arrays were broken in some cases + - fixed texture rectangle edge/border sampling bugs + - sampling an incomplete texture in a fragment program would segfault + - glTexImage was missing a few error checks + - fixed some minor glGetTexParameter glitches + - GL_INTENSITY was mistakenly accepted as a to glTexImage + - fragment program writes to RC/HC register were broken + - fixed a few glitches in GL_HP_occlusion_test extension + - glBeginQueryARB and glEndQueryARB didn't work inside display lists + - vertex program state references were broken + - fixed triangle color interpolation bug on AIX (Shane Blackett) + - fixed a number of minor memory leaks (bug #1002030) + + +6.2 October 2, 2004 + New: + - enabled GL_ARB_texture_rectangle (same as GL_NV_texture_rectangle) + - updated Doxygen support (Jose Fonseca) + Changes: + - some GGI driver updates (Christoph Egger, bug 1025977) + Bug fixes: + - Omit GL_ARB_texture_non_power_of_two from list of OpenGL 1.5 features + - fixed a few compilation issues on IRIX + - fixed a matrix classification bug (reported by Wes Bethel) + - we weren't reseting the vertex/fragment program error state + before parsing (Dave Reveman) + - adjust texcoords for sampling texture rectangles (Dave Reveman) + - glGet*(GL_MAX_VERTEX_ATTRIBS_ARB) wasn't implemented + - repeated calls to glDeleteTexture(t) could lead to a crash + - fixed potential ref count bugs in VBOs and vertex/fragment programs + - spriteblast demo didn't handle window size changes correctly + - glTexSubImage didn't handle pixels=NULL correctly for PBOs + - fixed color index mode glDrawPixels bug (Karl Schultz) + + +6.2.1 December 9, 2004 + Bug fixes: + - don't apply regular fog or color sum when using a fragment program + - glProgramEnvParameter4fARB always generated an error on + GL_FRAGMENT_PROGRAM_ARB (fdo bug 1645) + - glVertexAttrib3svNV and glVertexAttrib3svARB were broken + - fixed width/height mix-up in glSeparableFilter2D() + - fixed regression in glCopyPixels + convolution + - glReadPixels from a clipped front color buffer didn't always work + - glTexImage didn't accept GL_RED/GREEN/BLUE as the format + - Attempting queries/accesses of VBO 0 weren't detected as errors + - paletted textures failed if the palette had fewer than 256 entries + Changes: + - fixed a bunch of compiler warnings found with gcc 3.4 + - bug reports should to go bugzilla.freedesktop.org + + +6.3 July 20, 2005 + New: + - GL_EXT_framebuffer_object extension + - GL_ARB_draw_buffers extension + - GL_ARB_pixel_buffer_object extension + - GL_OES_read_format extension (Ian Romanick) + - DirectFB driver (Claudio Ciccani) + - x86_64 vertex transformation code (Mikko T.) + - Updated GL/glext.h to version 29 + Changes: + - added -stereo option for glxgears demo (Jacek Rosik) + - updated the PBuffer demo code in xdemos/ directory + - glDeleteTextures/Programs/Buffers() now makes the object ID + available for immediate re-use + - assorted 64-bit clean-ups fixes (x86_64 and Win64) + - lots of internal changes for GL_EXT_framebuffer_object + Bug fixes: + - some functions didn't support PBO functionality + - glGetTexImage didn't convert color index images to RGBA as required + - fragment program texcoords were sometimes wrong for points and lines + - fixed problem with negative dot product in arbfplight, fplight demos + - fixed bug in perspective correction of antialiased, textured lines + - querying GL_POST_CONVOLUTION_ALPHA_BIAS_EXT returned wrong value + - fixed a couple per-pixel fog bugs (Soju Matsumoto) + - glGetBooleanv(GL_FRAGMENT_PROGRAM_BINDING_NV) was broken + - fixed float parsing bug in ARB frag/vert programs (bug 2520) + - XMesaGetDepthBuffer() returned incorrect value for bytesPerValue + - GL_COLOR_MATERIAL with glColor3 didn't properly set diffuse alpha + - glXChooseFBConfig() crashed if attribList pointer was NULL + - program state.light[n].spot.direction.w was wrong value (bug 3083) + - fragment program fog option required glEnable(GL_FOG) - wrong. + - glColorTable() could produce a Mesa implementation error (bug 3135) + - RasterPos could get corrupted by color index rendering path + - Removed bad XTranslateCoordinates call when rendering to Pixmaps + - glPopAttrib() didn't properly restore GL_TEXTURE_GEN enable state + - fixed a few Darwin compilation problems + + +6.3.1 + This was an intermediate release for X.org which wasn't otherwise released. + + +6.3.2 August 19, 2005 + New: + - The distribution now includes the DRI drivers and GLX code + Changes: + - Made the DRI "new" driver interface standard, remove old code + Bug fixes: + - GL_ARB_vertex/fragment_shader were mistakenly listed in the + extensions string + - negative relative addressing in vertex programs was broken + - update/fix SPARC assembly code for vertex transformation + - fixed memory leak when freeing GLX drawables/renderbuffers + - fixed display list memory leak + - the GL_PIXEL_MAP_I_TO_I table is now floating point, not integer + - wglGetProcAddress() didn't handle wgl-functions + - fixed glxext.h cross-compile issue (Colin Harrison) + - assorted DRI driver fixes + + +6.4 October 24, 2005 + New: + - Added a fast XOR line drawing function in Xlib driver + - Added support for GL_ARB_texture_mirrored_repeat to savage + driver (supported only on Savage4 hardware). + Changes: + - Mesa now packaged in three parts: Library, Demos and GLUT + Bug fixes: + - GLX_X_RENDERABLE token wasn't accepted by glXChooseFBConfig + - Some files were present multiple times in the 6.3.2 tarballs + - r200_vtxtmp_x86.S file was missing from 6.3.2 tarball (bug 4207) + - glxgears_fbconfig demo didn't work (bug 4237) + - fixed bug when bilinear sampling 2d textures with borders + - glXCreatePbuffer() could segfault instead of returning 0 (bug 4235) + - fixed undefined frexp and rand in X.org libGLcore.a (bug 4242) + - fixed a few problems with proxy color tables (bug 4270) + - fixed precision problem in Z clearing (bug 4395) + - glBitmap, glDraw/CopyPixels mistakenly generated selection hits + - fixed potential segfault caused by reading pixels outside + of renderbuffer bounds + - glGetTexLevelParameter didn't accept GL_TEXTURE_DEPTH_SIZE_ARB + - fixed memory corruption bug involving software alpha buffers + - glReadPixels clipped by window bounds was sometimes broken + - glDraw/CopyPixels of stencil data ignored the stencil write mask + - glReadPixels from a texture bound to a framebuffer object didn't work + - glIsRender/FramebufferEXT weren't totally correct + - fixed a number of point size attenuation/fade bugs + - fixed glFogCoord bug 4729 + - GLX encoding for transpose matrix functions was broken + - fixed broken fragment program KIL and SWZ instructions + - fragment programs that wrote result.depth.z didn't work + + +6.4.1 November 30, 2005 + Bug fixes: + - redefining a vertex program string didn't take effect in TNL module + - fixed occasional segfault upon vertex/fragment parsing error + - vertex program LIT instruction didn't handle 0^0=1 correctly + - fragment program fog option didn't work with glDrawPixels, glBitmap + - USE_MGL_NAMESPACE didn't work for x86-64 + - OSMesa demos were missing from previous release tarballs + - fixed problem with float->ushort conversion in glClear (bug 4992) + - popping of GL_EYE_PLANE texgen state was broken (bug 4996) + - popping of GL_SPOT_DIRECTION light state was broken (bug 5005) + - fixed occasional triangle color interpolation problem on VMS + - work around invalid free() call (bug 5131) + - fixed BSD X server compilation problem by including stdint.h + + +6.4.2 February 2, 2006 + New: + - added OSMesaColorClamp() function/feature + - added wglGetExtensionStringARB() function + Bug fixes: + - fixed some problems when building on Windows + - GLw header files weren't installed by installmesa script (bug 5396) + - GL/glfbdev.h file was missing from tarballs + - fixed TNL initialization bug which could lead to crash (bug 5791) + + +6.5 March 31, 2006 + New: + - OpenGL Shading Language support through GL_ARB_shader_objects, + GL_ARB_shading_language_100, GL_ARB_vertex_shader and + GL_ARB_fragment_shader (done by Michal Krol) + - GL_EXT_packed_depth_stencil extension + - GL_EXT_timer_query extension + - GL_EXT_framebuffer_blit extension + - GL_ARB_half_float_pixel + - reflect demo improved to support multiple windows + - singlebuffer demo (shows no/little-flicker single-buffered rendering) + - r200: enable GL_ARB_texture_env_crossbar, separate the texture + sampling unit bits from the texture env combine enable bits + - r200: add support for GL_ATI_fragment_shader + - added fast XOR-mode line drawing optimization + - radeon: add support for all 3 tmus, GL_ARB_texture_cube_map + and GL_EXT_fog_coord + - MESA_GLX_ALPHA_BITS env var for xlib driver + - many DRI driver updates (including screen rotation support + for the Intel DRI driver) + Changes: + - removed GL_HP_occlusion_test (use GL_ARB_occlusion_query instead) + - removed GL_SGIX/SGIS_pixel_texture extensions + Bug fixes: + - fixed glxcontextmodes.c datatype problem (bug 5835) + - fixed aix-gcc build/install bugs (bug 5874) + - fixed some bugs in texture env program generation + - glXCopyContext() didn't handle texture object bindings properly + - glXCopyContext() didn't copy all lighting state + - fixed FreeBSD config (Pedro Giffuni) + - fixed some minor framebuffer object bugs + - replaced dprintf() with _glu_printf() in GLU (bug 6244) + - fixed a number of thread safety bugs/regressions + - fixed a number of GLU tesselator bugs (John Shell, bug 6339) + - paletted texturing was broken w/ floating point palettes (K. Schultz) + - lots of assorted framebuffer object bug fixes + +6.5.1 August 31, 2006 + New: + - Intel i965 DRI driver + - GL_APPLE_vertex_array_object extension (Ian Romanick) + - GL_EXT_texture_sRGB extension + - GL_EXT_gpu_program_parameters (Ian Romanick) + - "engine" demo + - updated fbdev driver and GLUT for fbdev (Sean D'Epagnier) + - many updates to the DRI drivers + Changes: + - The glVertexAttribARB functions no longer alias the conventional + vertex attributes. + - glxinfo program prints more info with -l option + - GL_FRAGMENT_PROGRAM_NV and GL_FRAGMENT_PROGRAM_ARB are now + compatible, in terms of glBindProgramARB() + Bug fixes: + - fixed broken texture border handling for depth textures (bug 6498) + - removed the test for duplicated framebuffer attachments, per + version 117 of the GL_EXT_framebuffer_object specification + - fixed a few render-to-texture bugs, including render to depth texture + - clipping of lines against user-defined clip planes was broken (6512) + - assembly language dispatch for SPARC was broken (bug 6484) + - assorted compilation fixes on various Unix platforms (Dan Schikore) + - glPopAttrib could restore an invalid value for GL_DRAW_BUFFER + - assorted minor fixes for 16 and 32 bit/channel modes + - fixed assorted bugs in texture compression paths + - fixed indirect rendering vertex array crashes (bug 6863) + - glDrawPixels GL_INDEX_OFFSET didn't always work + - fixed convolution memory leak (bug 7077) + - rectangular depth textures didn't work + - invalid mode to glBegin didn't generate an error (bug 7142) + - 'normalized' parameter to glVertexAttribPointerARB didn't work + - disable bogus GLX_SGI_video_sync extension in xlib driver + - fixed R128 driver locking bug (Martijn van Oosterhout) + - using evaluators with vertex programs caused crashes (bug 7564) + - fragment.position wasn't set correctly for point/line primitives + - fixed parser bug for scalar sources for GL_NV_fragment_program + - max fragment program length was incorrectly 128, now 1024 + - writes to result.depth in fragment programs weren't clamped to [0,1] + - fixed potential dangling pointer bug in glBindProgram() + - fixed some memory leaks (and potential crashes) in Xlib driver diff --git a/mesalib/docs/enums.txt b/mesalib/docs/enums.txt index cb97b5a31..b37768e20 100644 --- a/mesalib/docs/enums.txt +++ b/mesalib/docs/enums.txt @@ -1,57 +1,57 @@ - -See the OpenGL ARB enum registry at http://www.opengl.org/registry/api/enum.spec - -Blocks allocated to Mesa: - 0x8750-0x875F - 0x8BB0-0x8BBF - - -GL_MESA_packed_depth_stencil - GL_DEPTH_STENCIL_MESA 0x8750 - GL_UNSIGNED_INT_24_8_MESA 0x8751 - GL_UNSIGNED_INT_8_24_REV_MESA 0x8752 - GL_UNSIGNED_SHORT_15_1_MESA 0x8753 - GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754 - -GL_MESA_trace.spec: - GL_TRACE_ALL_BITS_MESA 0xFFFF - GL_TRACE_OPERATIONS_BIT_MESA 0x0001 - GL_TRACE_PRIMITIVES_BIT_MESA 0x0002 - GL_TRACE_ARRAYS_BIT_MESA 0x0004 - GL_TRACE_TEXTURES_BIT_MESA 0x0008 - GL_TRACE_PIXELS_BIT_MESA 0x0010 - GL_TRACE_ERRORS_BIT_MESA 0x0020 - GL_TRACE_MASK_MESA 0x8755 - GL_TRACE_NAME_MESA 0x8756 - -MESA_ycbcr_texture.spec: - GL_YCBCR_MESA 0x8757 - GL_UNSIGNED_SHORT_8_8_MESA 0x85BA /* same as Apple's */ - GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB /* same as Apple's */ - -GL_MESA_pack_invert.spec - GL_PACK_INVERT_MESA 0x8758 - -GL_MESA_shader_debug.spec: (obsolete) - GL_DEBUG_OBJECT_MESA 0x8759 - GL_DEBUG_PRINT_MESA 0x875A - GL_DEBUG_ASSERT_MESA 0x875B - -GL_MESA_program_debug.spec: (obsolete) - GL_FRAGMENT_PROGRAM_CALLBACK_MESA 0x???? - GL_VERTEX_PROGRAM_CALLBACK_MESA 0x???? - GL_FRAGMENT_PROGRAM_POSITION_MESA 0x???? - GL_VERTEX_PROGRAM_POSITION_MESA 0x???? - GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA 0x???? - GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA 0x???? - GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA 0x???? - GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA 0x???? - -GL_MESAX_texture_stack: - GL_TEXTURE_1D_STACK_MESAX 0x8759 - GL_TEXTURE_2D_STACK_MESAX 0x875A - GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B - GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C - GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D - GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E - + +See the OpenGL ARB enum registry at http://www.opengl.org/registry/api/enum.spec + +Blocks allocated to Mesa: + 0x8750-0x875F + 0x8BB0-0x8BBF + + +GL_MESA_packed_depth_stencil + GL_DEPTH_STENCIL_MESA 0x8750 + GL_UNSIGNED_INT_24_8_MESA 0x8751 + GL_UNSIGNED_INT_8_24_REV_MESA 0x8752 + GL_UNSIGNED_SHORT_15_1_MESA 0x8753 + GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754 + +GL_MESA_trace.spec: + GL_TRACE_ALL_BITS_MESA 0xFFFF + GL_TRACE_OPERATIONS_BIT_MESA 0x0001 + GL_TRACE_PRIMITIVES_BIT_MESA 0x0002 + GL_TRACE_ARRAYS_BIT_MESA 0x0004 + GL_TRACE_TEXTURES_BIT_MESA 0x0008 + GL_TRACE_PIXELS_BIT_MESA 0x0010 + GL_TRACE_ERRORS_BIT_MESA 0x0020 + GL_TRACE_MASK_MESA 0x8755 + GL_TRACE_NAME_MESA 0x8756 + +MESA_ycbcr_texture.spec: + GL_YCBCR_MESA 0x8757 + GL_UNSIGNED_SHORT_8_8_MESA 0x85BA /* same as Apple's */ + GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB /* same as Apple's */ + +GL_MESA_pack_invert.spec + GL_PACK_INVERT_MESA 0x8758 + +GL_MESA_shader_debug.spec: (obsolete) + GL_DEBUG_OBJECT_MESA 0x8759 + GL_DEBUG_PRINT_MESA 0x875A + GL_DEBUG_ASSERT_MESA 0x875B + +GL_MESA_program_debug.spec: (obsolete) + GL_FRAGMENT_PROGRAM_CALLBACK_MESA 0x???? + GL_VERTEX_PROGRAM_CALLBACK_MESA 0x???? + GL_FRAGMENT_PROGRAM_POSITION_MESA 0x???? + GL_VERTEX_PROGRAM_POSITION_MESA 0x???? + GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA 0x???? + GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA 0x???? + GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA 0x???? + GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA 0x???? + +GL_MESAX_texture_stack: + GL_TEXTURE_1D_STACK_MESAX 0x8759 + GL_TEXTURE_2D_STACK_MESAX 0x875A + GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B + GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C + GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D + GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E + diff --git a/mesalib/docs/install.html b/mesalib/docs/install.html index 2ba7cb867..a344c2ca7 100644 --- a/mesalib/docs/install.html +++ b/mesalib/docs/install.html @@ -16,8 +16,7 @@
  • For DRI and hardware acceleration
  • Building with autoconf (Linux/Unix/X11) -
  • Building with SCons (Windows) -
  • Building with legacy Makefiles (deprecated) +
  • Building with SCons (Windows/Linux)
  • Building for other systems
  • Library Information
  • Building OpenGL programs with pkg-config @@ -95,7 +94,7 @@ for more details. -

    3. Building with SCons (Windows)

    +

    3. Building with SCons (Windows/Linux)

    To build Mesa with SCons on Linux or Windows do @@ -129,118 +128,8 @@ Put them all in the same directory to test them. - -

    4. Building with legacy Makefiles (deprecated)

    - -

    -The legacy Mesa build system is based on a collection of pre-defined -system configurations. -Some of these might work for older systems not supported by autoconf. -

    -

    -To see the list of configurations, just type make. -Then choose a configuration from the list and type make -configname. -

    - -

    -Mesa may be built in several different ways using the predefined configurations: -

    -
      -
    • Stand-alone/Xlib mode - Mesa will be compiled as -a software renderer using Xlib to do all rendering. -The libGL.so library will be a self-contained rendering library that will -allow you to run OpenGL/GLX applications on any X server (regardless of -whether it supports the GLX X server extension). -You will not be able to use hardware 3D acceleration. -

      -To compile stand-alone Mesa type make in the top-level directory. -You'll see a list of supported system configurations. -Choose one from the list (such as linux-x86), and type: -

      -
      -    make linux-x86
      -
      -

      This will produce libGL.so and several other libraries

      -
    • - -
    • DRI/accelerated - The DRI hardware drivers for -accelerated OpenGL rendering (for ATI, Intel, Matrox, etc) will be built. -The libGL.so library will support the GLX extension and will load/use -the DRI hardware drivers. - - -

      -Build Mesa and the DRI hardware drivers by running -

      -
      -   make linux-dri
      -
      -

      -There are also linux-dri-x86, linux-dri-x86-64, -and linux-ppc configurations which are optimized for those -architectures. -

      -

      -Make sure you have the prerequisite versions of DRM and Xserver mentioned -above. -

      - -
    - - -

    -Later, if you want to rebuild for a different configuration run -make realclean before rebuilding. -

    - - - -
    -

    Installing the header and library files

    - -

    -The standard location for the OpenGL header files on Unix-type systems is -in /usr/include/GL/. -The standard location for the libraries is /usr/lib/. -For more information see, the - -Linux/OpenGL ABI specification. -

    - -

    -If you'd like Mesa to co-exist with another implementation of OpenGL that's -already installed, you'll have to choose different directories, like -/usr/local/include/GL/ and /usr/local/lib/. -

    - -

    -To install Mesa's headers and libraries, run make install. -But first, check the Mesa/configs/default file and examine the values -of the INSTALL_DIR and DRI_DRIVER_INSTALL_DIR variables. -Change them if needed, then run make install. -

    - -

    -The variable -DESTDIR may also be used to install the contents to a temporary -staging directory. -This can be useful for package management. -For example: make install DESTDIR=/somepath/ -

    - -

    -Note: at runtime you can use the LD_LIBRARY_PATH environment variable -(on Linux at least) to switch -between the Mesa libraries and other vendor's libraries whenever you want. -This is a handy way to compare multiple OpenGL implementations. -

    - - - - -

    5. Building for other systems

    +

    4. Building for other systems

    Documentation for other environments (some may be very out of date): @@ -255,7 +144,7 @@ Documentation for other environments (some may be very out of date): -

    6. Library Information

    +

    5. Library Information

    When compilation has finished, look in the top-level lib/ @@ -300,7 +189,7 @@ versions of libGL and device drivers. -

    7. Building OpenGL programs with pkg-config

    +

    6. Building OpenGL programs with pkg-config

    Running make install will install package configuration files diff --git a/mesalib/docs/mesa.css b/mesalib/docs/mesa.css index 8e4944e44..a53a9df8b 100644 --- a/mesalib/docs/mesa.css +++ b/mesalib/docs/mesa.css @@ -1,33 +1,33 @@ -/* Mesa CSS */ -body { - background-color: #ffffff; - font: 14px 'Lucida Grande', Geneva, Arial, Verdana, sans-serif; - color: black; - link: #111188; -} - -h1 { - font: 24px 'Lucida Grande', Geneva, Arial, Verdana, sans-serif; - font-weight: bold; - color: black; -} - -h2 { - font: 18px 'Lucida Grande', Geneva, Arial, Verdana, sans-serif, bold; - font-weight: bold; - color: black; -} - -code { - font-family: monospace; - font-size: 10pt; - color: black; -} - - -pre { - /*font-family: monospace;*/ - font-size: 10pt; - /*color: black;*/ -} - +/* Mesa CSS */ +body { + background-color: #ffffff; + font: 14px 'Lucida Grande', Geneva, Arial, Verdana, sans-serif; + color: black; + link: #111188; +} + +h1 { + font: 24px 'Lucida Grande', Geneva, Arial, Verdana, sans-serif; + font-weight: bold; + color: black; +} + +h2 { + font: 18px 'Lucida Grande', Geneva, Arial, Verdana, sans-serif, bold; + font-weight: bold; + color: black; +} + +code { + font-family: monospace; + font-size: 10pt; + color: black; +} + + +pre { + /*font-family: monospace;*/ + font-size: 10pt; + /*color: black;*/ +} + diff --git a/mesalib/docs/relnotes-7.10.html b/mesalib/docs/relnotes-7.10.html index bb73975b7..3f4f229b0 100644 --- a/mesalib/docs/relnotes-7.10.html +++ b/mesalib/docs/relnotes-7.10.html @@ -1,2795 +1,2795 @@ - - - -Mesa Release Notes - - - - - - - - -

    Mesa 7.10 Release Notes / January 7, 2011

    - -

    -Mesa 7.10 is a new development release. -People who are concerned with stability and reliability should stick -with a previous release or wait for Mesa 7.10.1. -

    -

    -Mesa 7.10 implements the OpenGL 2.1 API, but the version reported by -glGetString(GL_VERSION) depends on the particular driver being used. -Some drivers don't support all the features required in OpenGL 2.1. -

    -

    -See the Compiling/Installing page for prerequisites -for DRI hardware acceleration. -

    - - -

    MD5 checksums

    -
    -0a70c15c135561824bdcae92bf232e43  MesaLib-7.10.tar.gz
    -33fb94eccc02cbb4d8d1365615e38e46  MesaLib-7.10.tar.bz2
    -5cafdc0eda0f9bf370b95c98df3338fa  MesaLib-7.10.zip
    -bc644be551ed585fc4f66c16b64a91c9  MesaGLUT-7.10.tar.gz
    -5c2677a155672352d62b177e4f0f92e8  MesaGLUT-7.10.tar.bz2
    -2ce5001f74496d1ba719ef74d910a5cf  MesaGLUT-7.10.zip
    -
    - - -

    New features

    -
      -
    • GL_ARB_explicit_attrib_location extension (Intel and software drivers). -
    • GL_ARB_texture_rg (Intel, software drivers, gallium drivers). -
    • GL_EXT_separate_shader_objects extension (Intel and software drivers). -
    • GL_NV_primitive_restart extension (Gallium softpipe, llvmpipe). -
    • New fragment shader back-end for i965-class hardware. -
    • Support for Sandybridge chipset in i965 DRI driver. -
    - - -

    Bug fixes

    -

    This list is likely incomplete.

    -
      -
    • Bug 28800 - [r300c, r300g] Texture corruption with World of Warcraft
    • - -
    • Bug 29420 - Amnesia / HPL2 RendererFeatTest - not rendering correctly
    • - -
    • Bug 29946 - [swrast] piglit valgrind glsl-array-bounds-04 fails
    • - -
    • Bug 30261 - [GLSL 1.20] allowing inconsistent invariant declaration between two vertex shaders
    • - -
    • Bug 30632 - [softpipe] state_tracker/st_manager.c:489: st_context_notify_invalid_framebuffer: Assertion `stfb && stfb->iface == stfbi' failed.
    • - -
    • Bug 30694 - wincopy will crash on Gallium drivers when going to front buffer
    • - -
    • Bug 30771 - [r600g] vert-tex glsl demo
    • - -
    • Bug 30787 - Invalid asm shader does not generate draw-time error when used with GLSL shader
    • - -
    • Bug 30974 - [llvmpipe] SIGABRT src/gallium/drivers/llvmpipe/lp_state_fs.c:779
    • - -
    • Bug 30993 - getFramebufferAttachmentParameteriv wrongly generates error
    • - -
    • Bug 31101 - [glsl2] abort() in ir_validate::visit_enter(ir_assignment *ir)
    • - -
    • Bug 31193 - [regression] aa43176e break water reflections
    • - -
    • Bug 31194 - The mesa meta save/restore code doesn't ref the current GLSL program
    • - -
    • Bug 31371 - glslparsertest: ir.cpp:358: ir_constant::ir_constant(const glsl_type*, const ir_constant_data*): Assertion `(type->base_type >= 0) && (type->base_type <= 3)' failed.
    • - -
    • Bug 31439 - Crash in glBufferSubData() with size == 0
    • - -
    • Bug 31495 - [i965 gles2c bisected] OpenGL ES 2.0 conformance GL2Tests_GetBIFD_input.run regressed
    • - -
    • Bug 31514 - isBuffer returns true for unbound buffers
    • - -
    • Bug 31560 - [tdfx] tdfx_tex.c:702: error: ‘const struct gl_color_table’ has no member named ‘Format’
    • - -
    • Bug 31617 - Radeon/Compiz: 'failed to attach dri2 front buffer', error case not handled
    • - -
    • Bug 31648 - [GLSL] array-struct-array gets assertion: `(size >= 1) && (size <= 4)' failed.
    • - -
    • Bug 31650 - [GLSL] varying gl_TexCoord fails to be re-declared to different size in the second shader
    • - -
    • Bug 31673 - GL_FRAGMENT_PRECISION_HIGH preprocessor macro undefined in GLSL ES
    • - -
    • Bug 31690 - i915 shader compiler fails to flatten if in Aquarium webgl demo.
    • - -
    • Bug 31832 - [i915] Bad renderbuffer format: 21
    • - -
    • Bug 31841 - [drm:radeon_cs_ioctl] *ERROR* Invalid command stream !
    • - -
    • Bug 31894 - Writing to gl_PointSize with GLES2 corrupts other varyings
    • - -
    • Bug 31909 - [i965] brw_fs.cpp:1461: void fs_visitor::emit_bool_to_cond_code(ir_rvalue*): Assertion `expr->operands[i]->type->is_scalar()' failed.
    • - -
    • Bug 31934 - [gallium] Mapping empty buffer object causes SIGSEGV
    • - -
    • Bug 31983 - [i915 gles2] "if (expression with builtin/varying variables) discard" breaks linkage
    • - -
    • Bug 31985 - [GLSL 1.20] initialized uniform array considered as "unsized"
    • - -
    • Bug 31987 - [gles2] if input a wrong pname(GL_NONE) to glGetBoolean, it will not case GL_INVALID_ENUM
    • - -
    • Bug 32035 - [GLSL bisected] comparing unsized array gets segfault
    • - -
    • Bug 32070 - llvmpipe renders stencil demo incorrectly
    • - -
    • Bug 32273 - assertion fails when starting vdrift 2010 release with shaders enabled
    • - -
    • Bug 32287 - [bisected GLSL] float-int failure
    • - -
    • Bug 32311 - [965 bisected] Array look-ups broken on GM45
    • - -
    • Bug 32520 - [gles2] glBlendFunc(GL_ZERO, GL_DST_COLOR) will result in GL_INVALID_ENUM
    • - -
    • Bug 32825 - egl_glx driver completely broken in 7.9 branch [fix in master]
    • - -
    • Bug -
    • - -
    • Bug -
    • - -
    - - -

    Changes

    -

    Adam Jackson (2): -

      -
    • i965: Update renderer strings for sandybridge
    • -
    • drivers/x11: unifdef XFree86Server
    • -

    - -

    Alex Deucher (30): -

      -
    • r600c: fix mipmap stride on evergreen
    • -
    • r600c: add reloc for CB_COLOR0_ATTRIB
    • -
    • r600c: pull over 6xx/7xx vertex fixes for evergreen
    • -
    • r600c: fix segfault in evergreen stencil code
    • -
    • r100: revalidate after radeon_update_renderbuffers
    • -
    • r600c: add missing radeon_prepare_render() call on evergreen
    • -
    • r600c: properly align mipmaps to group size
    • -
    • egl_dri2: Add radeon chip ids
    • -
    • r600c/evergreen: texture align is group_bytes just like 6xx/7xx
    • -
    • r600g: fix buffer alignment
    • -
    • r600g: All EVENT_WRITE packets need the EVENT_INDEX field
    • -
    • r600g: translate ARR instruction for evergreen
    • -
    • r600g: use meaningful defines for chiprev
    • -
    • r600g: use full range of VS resources for vertex samplers
    • -
    • r600g: fix additional EVENT_WRITE packet
    • -
    • r600g: fix some winsys functions to deal properly with evergreen
    • -
    • r600c: add Ontario Fusion APU support
    • -
    • r600g: add support for ontario APUs
    • -
    • r600c: fix VC flush on cedar and palm
    • -
    • gallium/egl: fix r300 vs r600 loading
    • -
    • r600c: fix some opcodes on evergreen
    • -
    • r600c: bump texture limits to hw limits
    • -
    • r600g: bump texture/cb limits appropriately for evergreen
    • -
    • radeon: bump mip tree levels to 15
    • -
    • r600g: fix rendering with a vertex attrib having a zero stride
    • -
    • r600g: remove useless switch statements
    • -
    • r600g: add support for NI (northern islands) asics
    • -
    • r600c: add support for NI asics
    • -
    • r600g: support up to 64 shader constants
    • -
    • r600c: fix up SQ setup in blit code for Ontario/NI
    • -

    - -

    Andre Maasikas (3): -

      -
    • r600c: fix buffer height setting in dri2 case
    • -
    • r600g: break alu clause earlier
    • -
    • r600g: fix evergreen interpolation setup
    • -

    - -

    Andrew Randrianasulu (2): -

      -
    • dri/nv04: Don't expose ARB_texture_env_combine/dot3.
    • -
    • dri/nv04: Enable eng3dm for A8/L8 textures.
    • -

    - -

    Aras Pranckevicius (2): -

      -
    • glsl: fix crash in loop analysis when some controls can't be determined
    • -
    • glsl: fix matrix type check in ir_algebraic
    • -

    - -

    Bas Nieuwenhuizen (3): -

      -
    • r600g: set ENABLE_KILL in the shader state in the new design
    • -
    • r600g: set ENABLE_KILL on evergreen too
    • -
    • r600g: use dirty list to track dirty blocks
    • -

    - -

    Ben Skeggs (3): -

      -
    • nv50: DST
    • -
    • nv50: DPH
    • -
    • nv50: silence some unknown get_param warnings
    • -

    - -

    Benjamin Franzke (2): -

      -
    • st/egl image: multiply drm buf-stride with blocksize
    • -
    • r600g: implement texture_get_handle (needed for eglExportDRMImageMESA)
    • -

    - -

    Brian Paul (296): -

      -
    • glx: add const qualifiers to __indirect_glMultiDrawArraysEXT()
    • -
    • glsl2: fix signed/unsigned comparison warning
    • -
    • llvmpipe: cast to silence warning
    • -
    • llvmpipe: s/boolean/unsigned/ in bitfield to silence warning
    • -
    • nv50: use unsigned int for bitfields to silence warnings
    • -
    • tgsi: fix incorrect usage_mask for shadow tex instructions
    • -
    • gallivm: expand AoS sampling to cover all filtering modes
    • -
    • gallivm: fix incorrect vector shuffle datatype
    • -
    • gallivm: move i32_vec_type inside the #ifdef
    • -
    • mesa: include mfeatures.h in formats.c
    • -
    • gallivm: fix wrong return value in bitwise functions
    • -
    • tgsi/sse: fix aos_to_soa() loop to handle num_inputs==0
    • -
    • gallivm: added missing case for PIPE_TEXTURE_RECT
    • -
    • gallium: better docs for pipe_rasterizer_state::sprite_coord_enable
    • -
    • gallium: rework handling of sprite_coord_enable state
    • -
    • gallium/docs: added new pipeline.txt diagram
    • -
    • mesa: don't call valid_texture_object() in non-debug builds
    • -
    • glsl2: silence compiler warnings in printf() calls
    • -
    • docs: remove old broken link
    • -
    • docs: mark as obsolete, remove dead links
    • -
    • llvmpipe: fix query bug when no there's no scene
    • -
    • gallivm: remove debug code
    • -
    • llvmpipe: maintain fragment shader state for draw module
    • -
    • llvmpipe: indentation fix
    • -
    • llvmpipe: reformatting, remove trailing whitespace, etc
    • -
    • llvmpipe: clean-up, comments in setup_point_coefficient()
    • -
    • llvmpipe: rename sprite field, add sprite_coord_origin
    • -
    • llvmpipe: implement sprite coord origin modes
    • -
    • draw: fix test for using the wide-point stage
    • -
    • llvmpipe: check bitshift against PIPE_MAX_SHADER_OUTPUTS
    • -
    • draw: check bitshift against PIPE_MAX_SHADER_OUTPUS
    • -
    • Merge branch 'sprite-coord'
    • -
    • draw: new draw_fs.[ch] files
    • -
    • glsl2: fix typo in error msg
    • -
    • gallivm: fix lp_build_sample_compare()
    • -
    • softpipe: add missing calls to set draw vertex samplers/views
    • -
    • mesa: don't advertise bogus GL_ARB_shading_language_120 extension
    • -
    • configs: remove egl-swrast target from linux-dri config
    • -
    • llvmpipe: fix sprite texcoord setup for non-projective texturing
    • -
    • mesa: fix assertions to handle srgb formats
    • -
    • st/mesa: add missing MESA_FORMAT_S8 case in st_mesa_format_to_pipe_format()
    • -
    • st/mesa: use the wrapped renderbuffer in CopyPixels()
    • -
    • llvmpipe: make min/max lod and lod bias dynamic state
    • -
    • llvmpipe: make texture border_color dynamic state
    • -
    • softpipe: fix repeat() function for NPOT textures
    • -
    • gallivm: fix repeat() function for NPOT textures
    • -
    • swrast: update comments for REMAINDER() macro
    • -
    • softpipe: rename sp_state_fs.c -> sp_state_shader.c
    • -
    • softpipe: make shader-related functions static
    • -
    • softpipe: make blend/stencil/depth functions static
    • -
    • softpipe: make sampler state functions static
    • -
    • softpipe: make vertex state functions static
    • -
    • softpipe: make rasterizer state functions static
    • -
    • softpipe: make stream out state functions static
    • -
    • softpipe: make clip state functions static
    • -
    • softpipe: minor asst. clean-ups
    • -
    • softpipe: allocate tile data on demand
    • -
    • llvmpipe: fix swizzling of texture border color
    • -
    • softpipe: fix swizzling of texture border color
    • -
    • draw: pass sampler state down to llvm jit state
    • -
    • gallivm: check for level=0 case in lp_build_minify()
    • -
    • gallivm: added some comments
    • -
    • draw: check for null sampler pointers
    • -
    • swrast: fix choose_depth_texture_level() to respect mipmap filtering state
    • -
    • st/mesa: replace assertion w/ conditional in framebuffer invalidation
    • -
    • glsl2: fix signed/unsigned comparison warning
    • -
    • st/xlib: add some comments
    • -
    • ir_to_mesa: assorted clean-ups, const qualifiers, new comments
    • -
    • mesa: remove assertion w/ undeclared variable texelBytes
    • -
    • gallivm: remove newlines
    • -
    • draw/llvmpipe: replace DRAW_MAX_TEXTURE_LEVELS with PIPE_MAX_TEXTURE_LEVELS
    • -
    • mesa: reformatting, comments, code movement
    • -
    • x11: fix breakage from gl_config::visualType removal
    • -
    • gallivm: work-around trilinear mipmap filtering regression with LLVM 2.8
    • -
    • mesa: remove post-convolution width/height vars
    • -
    • gallivm: add compile-time option to emit inst addrs and/or line numbers
    • -
    • llvmpipe: code to dump bytecode to file (disabled)
    • -
    • gallivm: added lp_build_print_vec4()
    • -
    • gallivm: added lp_build_load_volatile()
    • -
    • glsl: add ir_unop_round_even case to silence unhandled enum warning
    • -
    • st/mesa: fix regressions in glDrawPixels(GL_STENCIL_INDEX)
    • -
    • st/mesa: reformatting in st_cb_drawpixels.c
    • -
    • st/mesa: use GLuint to avoid problem w/ uint not defined on mingw32
    • -
    • st/mesa: update function name, comments
    • -
    • gallivm: use util_snprintf()
    • -
    • llvmpipe: remove lp_setup_coef*.c files from Makefile
    • -
    • mesa: fix mesa version string construction
    • -
    • gallivm: fix incorrect type for zero vector in emit_kilp()
    • -
    • llvmpipe/draw: always enable LLVMAddInstructionCombiningPass()
    • -
    • draw: use float version of LLVM Mul/Add instructions
    • -
    • draw: fix typo in comment
    • -
    • mesa: add GL_RG case to _mesa_source_buffer_exists()
    • -
    • mesa: add missing cases for packing red/green images
    • -
    • st/mesa: added cases for GL_COMPRESSED_RED/RG in st_choose_format()
    • -
    • docs: update texture red/green support in GL3.txt
    • -
    • docs: add GL_ARB_texture_rg to release notes
    • -
    • mesa: driver hook for primitive restart
    • -
    • mesa: set/get primitive restart state
    • -
    • mesa: API spec for primitive restart
    • -
    • mesa: regenerated files with primitive restart
    • -
    • mesa: plug in primitive restart function
    • -
    • vbo: support for primitive restart
    • -
    • gallium: new CAP, state for primitive restart
    • -
    • st/mesa: support for primitive restart
    • -
    • draw: implement primitive splitting for primitive restart
    • -
    • softpipe: enable primitive restart
    • -
    • llvmpipe: enable primitive restart
    • -
    • docs: added GL_NV_primitive_restart extension
    • -
    • Merge branch 'primitive-restart-cleanup'
    • -
    • winsys/xlib: formatting fixes
    • -
    • winsys/xlib: use Bool type for shm field
    • -
    • winsys/xlib: fix up allocation/dealloction of XImage
    • -
    • winsys/xlib: rename xm->xlib
    • -
    • galahad: silence warnings
    • -
    • mesa: move declaration before code
    • -
    • docs: updated GL3 status for primitive restart
    • -
    • mesa: 80-column wrapping
    • -
    • mesa: simplify fbo format checking code
    • -
    • mesa: split up the image.c file
    • -
    • mesa: add pixel packing for unscaled integer types
    • -
    • mesa: _mesa_ClearColorIuiEXT() and _mesa_ClearColorIiEXT()
    • -
    • mesa: _mesa_is_format_integer() function
    • -
    • mesa: minor reformatting, clean-ups
    • -
    • mesa: added _mesa_is_fragment_shader_active() helper
    • -
    • mesa: new glDrawPixels error check for integer formats
    • -
    • softpipe: added some texture sample debug code (disabled)
    • -
    • mesa: added new gl_extensions::EXT_gpu_shader4 field
    • -
    • mesa: added new gl_framebuffer::_IntegerColor field
    • -
    • mesa: added glGet query for GL_RGBA_INTEGER_MODE_EXT
    • -
    • mesa: compute _IntegerColor field in _mesa_test_framebuffer_completeness()
    • -
    • mesa: added cases for GL_EXT_texture_integer formats
    • -
    • mesa: added cases for GL_EXT_texture_integer
    • -
    • st/mesa: add format selection for signed/unsigned integer formats
    • -
    • mesa: simplify target_can_be_compressed() function
    • -
    • glapi: GL_EXT_texture_integer API
    • -
    • glapi: include/build EXT_texture_integer.xml
    • -
    • mesa: regenerated API files for GL_EXT_texture_integer
    • -
    • mesa: plug in GL_EXT_texture_integer functions
    • -
    • mesa: display list support for GL_EXT_texture_integer
    • -
    • st/mesa: be smarter choosing texture format for glDrawPixels()
    • -
    • softpipe: remove >32bpp color restriction
    • -
    • mesa: silence enum comparison warning
    • -
    • mesa: fix uninitialized var warning
    • -
    • xlib: silence unused var warning
    • -
    • util: use pointer_to_func() to silence warning
    • -
    • rtasm: use pointer_to_func() to silence warning
    • -
    • translate: use function typedefs, casts to silence warnings
    • -
    • translate: remove unused prototypes
    • -
    • mesa: additional glReadPixels error checks for GL_EXT_texture_integer
    • -
    • mesa: additional switch cases for GL_EXT_texture_integer
    • -
    • mesa: additional teximage error checks for GL_EXT_texture_integer
    • -
    • mesa: do integer FB / shader validation check in _mesa_valid_to_render()
    • -
    • mesa: call _mesa_valid_to_render() in glDrawPixels, glCopyPixels, glBitmap
    • -
    • mesa: remove the unused _mesa_is_fragment_shader_active() function
    • -
    • mesa: fix bug in _mesa_is_format_integer()
    • -
    • mesa: rename function to _mesa_is_format_integer_color()
    • -
    • mesa: remove 'normalized' parameter from _mesa_VertexAttribIPointer()
    • -
    • vbo: re-indent file
    • -
    • glapi: xml spec file for GL_EXT_gpu_shader4
    • -
    • glapi: include EXT_gpu_shader4.xml
    • -
    • glapi: regenerated API files
    • -
    • mesa: plug in stubs for glBindFragDataLocation(), glGetFragDataLocation()
    • -
    • mesa: add glGetUniformuiv(), plug in uint glUniform funcs
    • -
    • mesa: plug in more GL_EXT_gpu_shader4 functions
    • -
    • mesa: add new GLvertexformat entries for integer-valued attributes
    • -
    • mesa: implement integer-valued vertex attribute functions
    • -
    • mesa: add gl_client_array::Integer field and related vertex array state code
    • -
    • mesa: consolidate glVertex/Color/etcPointer() code
    • -
    • mesa: state/queries for GL_MIN/MAX_PROGRAM_TEXEL_OFFSET_EXT
    • -
    • mesa: glArrayElement support for integer-valued arrays
    • -
    • mesa: clean-up array element code
    • -
    • mesa: add extension table entry for GL_EXT_gpu_shader4
    • -
    • mesa: remove obsolete comment
    • -
    • mesa: fix incorrect type in _mesa_texstore_rgba_int16()
    • -
    • mesa: fix integer cases in _mesa_is_legal_format_and_type()
    • -
    • mesa: add const qualifier to _mesa_is_legal_format_and_type()
    • -
    • mesa: additional integer formats in _mesa_bytes_per_pixel()
    • -
    • mesa: pixel transfer ops do not apply to integer-valued textures
    • -
    • mesa: remove dead code
    • -
    • osmesa: fix renderbuffer memleak in OSMesaMakeCurrent()
    • -
    • mesa: use GLubyte for edge flag arrays
    • -
    • mesa: move the gl_config struct declaration
    • -
    • dri/util: add a bunch of comments
    • -
    • mesa: remove always-false conditional in check_compatible()
    • -
    • mesa: fix aux/accum comment and error message mixups
    • -
    • llvmpipe: assign context's frag shader pointer before using it
    • -
    • llvmpipe: add a cast
    • -
    • mesa: silence new warnings in texobj.c
    • -
    • egl/gdi: fix typo: xsurf->gsurf
    • -
    • mesa: code to unpack RGBA as uints
    • -
    • gallivm: implement scatter stores into temp register file
    • -
    • gallivm: add some LLVM var labels
    • -
    • gallivm: added debug code to dump temp registers
    • -
    • gallivm: add pixel offsets in scatter stores
    • -
    • gallivm: added lp_elem_type()
    • -
    • gallivm: implement execution mask for scatter stores
    • -
    • tgsi: remove unused function
    • -
    • llvmpipe: added some debug assertions, but disabled
    • -
    • gallivm: alloca() was called too often for temporary arrays
    • -
    • gallivm: add const qualifiers, fix comment string
    • -
    • softpipe: disable vertex texturing with draw/llvm
    • -
    • mesa: consolidate pixel packing/unpacking code
    • -
    • mesa: rename vars in pixel pack/unpack code
    • -
    • mesa: implement uint texstore code
    • -
    • mesa: remove stray GL_FLOAT case in _mesa_is_legal_format_and_type()
    • -
    • mesa: make fixed-pt and byte-valued arrays a runtime feature
    • -
    • softpipe: can't no-op depth test stage when occlusion query is enabled
    • -
    • mesa: no-op glBufferSubData() on size==0
    • -
    • mesa: #include mfeatures.h in enums.h
    • -
    • mesa: improve error message
    • -
    • mesa: add missing formats in _mesa_format_to_type_and_comps()
    • -
    • mesa: handle more pixel types in mipmap generation code
    • -
    • mesa: make glIsBuffer() return false for never bound buffers
    • -
    • mesa: fix glDeleteBuffers() regression
    • -
    • tdfx: s/Format/_BaseFormat/
    • -
    • mesa: consolidate assertions in teximage code
    • -
    • radeon: set gl_texture_image::TexFormat field in radeonSetTexBuffer2()
    • -
    • r600: set gl_texture_image::TexFormat field in r600SetTexBuffer2()
    • -
    • r200: set gl_texture_image::TexFormat field in r200SetTexBuffer2()
    • -
    • r300: set gl_texture_image::TexFormat field in r300SetTexBuffer2()
    • -
    • evergreen: set gl_texture_image::TexFormat field in evergreenSetTexBuffer()
    • -
    • st/mesa: fix glDrawPixels(depth/stencil) bugs
    • -
    • glsl: fix assorted MSVC warnings
    • -
    • mesa: add more work-arounds for acoshf(), asinhf(), atahf()
    • -
    • glsl: remove opt_constant_expression.cpp from SConscript
    • -
    • mesa: fix error messages and minor reindenting
    • -
    • mesa: whitespace cleanups
    • -
    • mesa: 80-column wrapping
    • -
    • mesa: reorder texture_error_check() params
    • -
    • mesa: minor clean-ups in context code
    • -
    • mesa: upgrade to glext.h version 66
    • -
    • mesa: pass gl_format to _mesa_init_teximage_fields()
    • -
    • mesa: fix error msg typo
    • -
    • glapi: rename GL3.xml to GL3x.xml as it covers all GL 3.x versions
    • -
    • mesa: hook up GL 3.x entrypoints
    • -
    • docs: update some GL 3.0 status
    • -
    • mesa: fix get_texture_dimensions() for texture array targets
    • -
    • swrast: init alpha value to 1.0 in opt_sample_rgb_2d()
    • -
    • glsl: fix off by one in register index assertion
    • -
    • glsl: use gl_register_file in a few places
    • -
    • mesa: rename, make _mesa_register_file_name() non-static
    • -
    • mesa: _mesa_valid_register_index() to validate register indexes
    • -
    • mesa: replace #defines with new gl_shader_type enum
    • -
    • mesa: use gl_shader_type enum
    • -
    • glsl: better handling of linker failures
    • -
    • glsl: start restoring some geometry shader code
    • -
    • mesa: add assertion and update comment in _mesa_format_image_size()
    • -
    • mesa: added _mesa_format_image_size64()
    • -
    • x11: remove test_proxy_teximage() function
    • -
    • st/mesa: fix mapping of zero-sized buffer objects
    • -
    • gallivm/llvmpipe: squash merge of the llvm-context branch
    • -
    • mesa: raise max texture sizes to 16K
    • -
    • softpipe: increase max texture size to 16K
    • -
    • mesa: replace large/MAX_WIDTH stack allocations with heap allocations
    • -
    • mesa: replace large/MAX_WIDTH stack allocations with heap allocations
    • -
    • swrast: avoid large stack allocations in blend code
    • -
    • swrast: avoid large stack allocations in tex combine code
    • -
    • st/mesa: avoid large stack allocations in readpixels code
    • -
    • mesa: replace more MAX_WIDTH stack allocations with heap allocations
    • -
    • gallivm/llvmpipe: remove lp_build_context::builder
    • -
    • gallivm: fix null builder pointers
    • -
    • mesa: fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME query
    • -
    • mesa: return GL_FRAMEBUFFER_DEFAULT as FBO attachment type
    • -
    • llvmpipe: fix broken stencil writemask
    • -
    • mesa: consolidate some compiler -D flags
    • -
    • swrast: allow GL_RG format in glDrawPixels()
    • -
    • swrast: fix indentation
    • -
    • swrast: accept GL_RG in glReadPixels()
    • -
    • swrast: restructure some glReadPixels() code
    • -
    • mesa: make glGet*(GL_NONE) generate GL_INVALID_ENUM
    • -
    • mesa: remove unneeded cast
    • -
    • mesa: update comments, remove dead code
    • -
    • st/mesa: new comment about updating state vars
    • -
    • mesa: add error margin to clip mask debug/check code
    • -
    • gallium/util: minor formatting fixes
    • -
    • mesa/llvm: use llvm-config --cppflags
    • -
    • st/mesa: fix mipmap generation bug
    • -
    • mesa: test for cube map completeness in glGenerateMipmap()
    • -
    • mesa: set gl_texture_object::_Complete=FALSE in incomplete()
    • -
    • mesa: consolidate glTexImage1/2/3D() code
    • -
    • mesa: simplify proxy texture code in texture_error_check()
    • -
    • mesa: consolidate the glTexSubImage1/2/3D() functions
    • -
    • mesa: consolidate glCopyTexImage1/2D() code
    • -
    • mesa: consolidate glCopyTexSubImage1/2/3D() functions
    • -
    • mesa: consolidate glCompressedTexImage1/2/3D() functions
    • -
    • mesa: make _mesa_test_proxy_teximage() easier to read
    • -
    • configure: use llvm-config --cppflags instead of --cflags
    • -
    • mesa: revamp error checking for compressed texture images
    • -
    • mesa: simplify target checking for TexImage functions
    • -
    • draw/llvm: don't flush in vs_llvm_delete()
    • -
    • tnl: Initialize gl_program_machine memory in run_vp.
    • -
    • tnl: a better way to initialize the gl_program_machine memory
    • -
    • mesa, st/mesa: disable GL_ARB_geometry_shader4
    • -
    • mesa/meta: fix broken assertion, rename stack depth var
    • -
    • glsl: new glsl_strtod() wrapper to fix decimal point interpretation
    • -
    • st/mesa: fix renderbuffer pointer check in st_Clear()
    • -

    - -

    Brian Rogers (1): -

      -
    • mesa: Add missing else in do_row_3D
    • -

    - -

    Chad Versace (25): -

      -
    • intel_extensions: Add ability to set GLSL version via environment
    • -
    • glsl: Add glsl_type::uvecN_type for N=2,3
    • -
    • glsl: Add lexer rules for uint and uvecN (N=2..4)
    • -
    • glsl: Changes in generated file glsl_lexer.cpp
    • -
    • glsl: Add lexer rules for << and >> in GLSL 1.30
    • -
    • glsl: Change generated file glsl_lexer.cpp
    • -
    • glsl: Implement ast-to-hir for binary shifts in GLSL 1.30
    • -
    • glsl: Implement constant expr evaluation for bitwise-not
    • -
    • glsl: Implement constant expr evaluation for bit-shift ops
    • -
    • glsl: Implement constant expr evaluation for bitwise logic ops
    • -
    • glsl: Fix ir validation for bit logic ops
    • -
    • glsl: Define shift_result_type() in ast_to_hir.cpp
    • -
    • glsl: Implement ast-to-hir for bit-shift-assignment
    • -
    • glsl: Define bit_logic_result_type() in ast_to_hir.cpp
    • -
    • glsl: Implement ast-to-hir for bit-logic ops
    • -
    • glsl: Fix lexer rule for ^=
    • -
    • glsl: Commit generated file glsl_lexer.cpp
    • -
    • glsl: Fix ast-to-hir for ARB_fragment_coord_conventions
    • -
    • mesa: Fix C++ includes in sampler.cpp
    • -
    • glsl: Fix ir_expression::constant_expression_value()
    • -
    • glsl: Fix erroneous cast in ast_jump_statement::hir()
    • -
    • glsl: Fix Doxygen tag file in recently renamed files
    • -
    • glsl: Improve usage message for glsl_compiler
    • -
    • glsl: Fix linker bug in cross_validate_globals()
    • -
    • glsl: In ast_to_hir, check sampler array indexing
    • -

    - -

    Chia-I Wu (149): -

      -
    • glapi: Fix build errors for ES.
    • -
    • glapi: Fix ES build errors again.
    • -
    • mesa: Update ES APIspec.xml.
    • -
    • st/xlib: Notify the context when the front/back buffers are swapped.
    • -
    • targets/egl: Use C++ compiler to link GL/ES state trackers.
    • -
    • libgl-xlib: Remove unused st_api_create_OpenGL.
    • -
    • st/egl: Split modeset code support to modeset.c.
    • -
    • st/egl: Rename kms backend to drm.
    • -
    • st/egl: s/kms/drm/ on the drm backend.
    • -
    • egl: Enable drm platform by default.
    • -
    • egl: Check extensions.
    • -
    • st/egl: Skip single-buffered configs in EGL.
    • -
    • mapi: Fix compiler warnings.
    • -
    • st/egl: Drop context argument from egl_g3d_get_egl_image.
    • -
    • targets/egl: Fix linking with libdrm.
    • -
    • st/vega: Fix version check in context creation.
    • -
    • egl: Use attribute names as the _EGLConfig member names.
    • -
    • egl: Access config attributes directly.
    • -
    • st/egl: Access _EGLConfig directly.
    • -
    • st/egl: Do not finish a fence that is NULL.
    • -
    • mesa: Remove unused vtxfmt_tmp.h.
    • -
    • egl_dri2: Drop the use of _egl[SG]etConfigKey.
    • -
    • egl_glx: Drop the use of [SG]ET_CONFIG_ATTRIB.
    • -
    • egl_glx: Fix borken driver.
    • -
    • egl: Move attributes in _EGLImage to _EGLImageAttribs.
    • -
    • egl: Parse image attributes with _eglParseImageAttribList.
    • -
    • egl: Move fallback routines to eglfallbacks.c.
    • -
    • egl: Drop dpy argument from the link functions.
    • -
    • egl: Minor changes to the _EGLConfig interface.
    • -
    • egl: Minor changes to the _EGLScreen interface.
    • -
    • egl: Fix _eglModeLookup.
    • -
    • st/egl: Fix native_mode refresh mode.
    • -
    • egl: Add reference count for resources.
    • -
    • egl: Use reference counting to replace IsLinked or IsBound.
    • -
    • egl: Fix a false negative check in _eglCheckMakeCurrent.
    • -
    • st/egl: Use resource reference count for egl_g3d_sync.
    • -
    • egl_dri2: Fix a typo that make glFlush be called at wrong time.
    • -
    • glapi: Do not use glapidispatch.h.
    • -
    • glapi: Move glapidispatch.h to core mesa.
    • -
    • glapi: Do not use glapioffsets.h.
    • -
    • glapi: Merge glapioffsets.h into glapidispath.h.
    • -
    • vbo: Use CALL_* macros.
    • -
    • mesa: Remove unnecessary glapitable.h includes.
    • -
    • autoconf: Better client API selection.
    • -
    • docs: Update egl and openvg docs.
    • -
    • autoconf: Update configuration info.
    • -
    • Merge branch 'glapi-reorg'
    • -
    • targets: Add missing quotes to Makefile.xorg.
    • -
    • autoconf: st/vega requires --enable-openvg.
    • -
    • st/mesa: Unreference the sampler view in st_bind_surface.
    • -
    • autoconf: Tidy configure output for EGL.
    • -
    • targets/egl: Fix a warning with --disable-opengl build.
    • -
    • egl: Rework _eglGetSearchPath.
    • -
    • mesa: Select FEATURE_remap_table when multiple APIs are enabled.
    • -
    • mesa: Allow contexts of different APIs to coexist.
    • -
    • egl: Set up the pthread key even TLS is used.
    • -
    • st/egl: Add native_surface::present callback.
    • -
    • st/egl: Use native_surface::present callback.
    • -
    • d3d1x: Use native_surface::present.
    • -
    • st/egl: Remove flush_frontbuffer and swap_buffers.
    • -
    • st/egl: Add support for swap interval and swap behavior.
    • -
    • st/egl: Add support for EGL_MATCH_NATIVE_PIXMAP.
    • -
    • st/egl: Add extern "C" wrapper to native.h.
    • -
    • st/egl: Add native_display_buffer interface.
    • -
    • st/egl: Use native_display_buffer for EGL_MESA_drm_image.
    • -
    • autoconf: Add --enable-gallium-egl.
    • -
    • docs: Update egl docs.
    • -
    • st/dri: Add support for surfaceless current contexts.
    • -
    • egl_dri2: Fix __DRI_DRI2 version 1 support.
    • -
    • st/vega: Do not wait NULL fences.
    • -
    • gallium: Add st_api::name.
    • -
    • gallium: Add st_context_iface::share to st_api.
    • -
    • st/wgl: Use st_context_iface::share for DrvShareLists.
    • -
    • st/glx: Replace MESA_VERSION_STRING by xmesa_get_name.
    • -
    • mesa: Clean up core.h.
    • -
    • scons: Define IN_DRI_DRIVER.
    • -
    • tgsi: Add STENCIL to text parser.
    • -
    • st/vega: vegaLookupSingle should validate the state.
    • -
    • st/vega: Set wrap_r for mask and blend samplers.
    • -
    • st/vega: Fix vgReadPixels with a subrectangle.
    • -
    • egl_dri2: Fix one context, multiple surfaces.
    • -
    • auxiliary: util_blit_pixels_tex should restore the viewport.
    • -
    • st/vega: Fix a crash with empty paths.
    • -
    • st/vega: Masks and surfaces should share orientation.
    • -
    • st/vega: No flipping in vg_prepare_blend_surface.
    • -
    • st/vega: Fix a typo in EXTENDED_BLENDER_OVER_FUNC.
    • -
    • llvmpipe: Fix build errors on x86.
    • -
    • st/vega: Overhaul renderer with renderer states.
    • -
    • st/vega: Add DRAWTEX renderer state.
    • -
    • st/vega: Add SCISSOR renderer state.
    • -
    • st/vega: Add CLEAR renderer state for vgClear.
    • -
    • st/vega: Add FILTER renderer state for image filtering.
    • -
    • st/vega: Use the renderer for vgMask.
    • -
    • st/vega: Add POLYGON_STENCIL and POLYGON_FILL renderer state.
    • -
    • st/vega: Delay fb state update to vg_validate_state.
    • -
    • st/vega: Use st_framebuffer for fb width/height.
    • -
    • st/vega: Move g3d states to renderer.
    • -
    • st/vega: Make shader_bind call into the renderer.
    • -
    • st/vega: vg_manager should care about only the color buffer.
    • -
    • st/vega: Clean up vg_context fields and functions.
    • -
    • st/vega: Clean up renderer fields and functions.
    • -
    • st/vega: vg_copy_texture and vg_copy_surface should share code.
    • -
    • st/vega: Get rid of renderer_copy_texture.
    • -
    • st/vega: Update to latest headers.
    • -
    • st/vega: Fix image sampler views for alpha-only formats.
    • -
    • st/vega: Make path_render and path_stroke take a matrix.
    • -
    • st/vega: Make image_draw take a matrix.
    • -
    • st/vega: Add primitive text support.
    • -
    • st/vega: Revive mask layer support.
    • -
    • st/vega: More flexible shader selection.
    • -
    • st/vega: Add color transformation support.
    • -
    • st/vega: Bump version to 1.1.
    • -
    • st/vega: Fix paint coordinates transformations.
    • -
    • st/vega: Fix negated logic in image_draw.
    • -
    • st/vega: Fix degenerate paints.
    • -
    • st/vega: Simplify radial gradient.
    • -
    • st/vega: Remove st_inlines.h.
    • -
    • st/vega: Delay blend texture creation until needed.
    • -
    • st/vega: Create drawing surface mask as needed.
    • -
    • st/vega: Initialize pipe states with renderer.
    • -
    • st/vega: Avoid unnecessary constant bufer upload.
    • -
    • st/vega: Destroy the pipe context with vg_context.
    • -
    • st/vega: polygon_array requires a deep free.
    • -
    • st/egl: Set pipe_resource::array_size to 1.
    • -
    • st/vega: Set pipe_resource::array_size to 1.
    • -
    • st/vega: Move vertex transformation to shader.
    • -
    • st/vega: Add a missing break.
    • -
    • st/vega: Add some comments to pipeline shaders.
    • -
    • st/vega: Refactor blend shaders.
    • -
    • st/vega: Move masking after blending.
    • -
    • st/vega: Add support for per-channel alpha.
    • -
    • st/vega: Blending should use premultiplied alpha.
    • -
    • st/vega: Fix VG_BLEND_MULTIPLY.
    • -
    • st/vega: Add blend shaders for all blend modes.
    • -
    • st/vega: Fix pipe blend state for various blend modes.
    • -
    • egl: _eglFilterArray should not allocate.
    • -
    • mapi: Rewrite mapi_abi.py to get rid of preprocessor magic.
    • -
    • vbo: Drop second ATTR macro.
    • -
    • vbo: Fix GLES2 glVertexAttrib.
    • -
    • mesa: Do not advertise GL_OES_texture_3D.
    • -
    • mesa: Fix GL_FIXED arrays.
    • -
    • mesa: Fix glTexCoordPointer with type GL_FIXED.
    • -
    • st/egl: Plug pbuffer leaks.
    • -
    • st/egl: Fix eglCopyBuffers.
    • -
    • st/egl: Assorted fixes for dri2_display_get_configs.
    • -
    • docs/egl: Update egl.html.
    • -
    • st/egl: Fix eglChooseConfig when configs is NULL.
    • -
    • docs: Add an example for EGL_DRIVERS_PATH.
    • -
    • autoconf: Fix --with-driver=xlib --enable-openvg.
    • -

    - -

    Chris Wilson (2): -

      -
    • i915g: Fix closure of full batch buffers
    • -
    • intel: Check for unsupported texture when finishing using as a render target
    • -

    - -

    Christoph Bumiller (80): -

      -
    • nv50: import new compiler
    • -
    • nouveau: update nouveau_class.h
    • -
    • nv50: introduce the big formats table
    • -
    • nv50: don't produce MOV immediate to output reg in store opt
    • -
    • nv50: change back accidentally swapped UNORM,SNORM vertex type
    • -
    • nv50: add/fix some license headers
    • -
    • nv50: simple reload elimination and local CSE
    • -
    • nv50: fix constant_operand opt mul by 2 case
    • -
    • nv50: permit usage of undefined TGSI TEMPs
    • -
    • nv50: add missing 2nd source for POW multiplication
    • -
    • nv50: add signed RGTC1 to format table, allow 2_10_10_10 for vbufs
    • -
    • nv50: fix for empty BBs
    • -
    • nv50: insert MOVs also for PHI sources from dominating block
    • -
    • nv50: explicitly set src type for SET ops
    • -
    • nv50: fixes for nested IFs
    • -
    • nv50: don't eliminate loads to dedicated values
    • -
    • nv50: fix constbuf validation
    • -
    • nv50: build proper phi functions in the first place
    • -
    • nv50: fix reg count
    • -
    • nv50: begin implementing loops
    • -
    • nv50: more constant folding
    • -
    • nv50: loops part 2
    • -
    • nv50: flatten simple IF/ELSE/ENDIF constructs
    • -
    • nv50: fix thinko in store to output reg possible check
    • -
    • nv50: generate JOINs for outermost IF clauses
    • -
    • nv50: more TGSI opcodes (SIN, SCS, ARL, RET, KILP)
    • -
    • nv50: fix PSIZ and PRIMID mapping
    • -
    • nv50: check dst compatibility in CSE
    • -
    • nv50: initialize edgeflag input index
    • -
    • nv50: emit predicate for interp
    • -
    • Merge remote branch 'origin/master' into nv50-compiler
    • -
    • nv50: DP2, fix ARL
    • -
    • nv50: yet another case we need a nop.exit
    • -
    • nv50: fix check for sprite/point coord enable
    • -
    • nv50: handle TEXTURE_SWIZZLE and GEOMETRY_SHADER4 caps
    • -
    • nv50: set the FragDepth output index
    • -
    • nv50: turn off verbose debug output by default
    • -
    • nv50: attempt at making more complicated loops work
    • -
    • nv50: SSG
    • -
    • nv50: make FrontFacing -1 or +1
    • -
    • nv50: re-add proper TEXBIAS sequence
    • -
    • nv50: make use of TGSI immediate type
    • -
    • nv50: must join SELECT inputs before MOV inputs
    • -
    • nv50: fix XPD, was negated
    • -
    • nv50: fix find_dom_frontier
    • -
    • nv50: fix build-predicate function
    • -
    • Merge remote branch 'origin/master' into nv50-compiler
    • -
    • nv50: load address register before using it, not after
    • -
    • nv50: save tgsi instructions
    • -
    • nv50: prepare for having multiple functions
    • -
    • nv50: don't parse again in tgsi_2_nc
    • -
    • nv50: use actual loads/stores if TEMPs are accessed indirectly
    • -
    • nv50: create value references with the right type
    • -
    • nv50: duplicate interps in load_proj_tex_coords
    • -
    • nv50: address regs are 16 bit
    • -
    • nv50: fix can_load check for 3rd source
    • -
    • nv50: reduce bb_reachable_by runtime from pot to linear
    • -
    • nv50: minor compiler fixes and cleanups
    • -
    • nv50: cannot move from local mem to output reg directly
    • -
    • nv50: newlines in shader bincode printing
    • -
    • nv50: match TEMP limit with nv50 ir builder
    • -
    • nv50: handle TGSI EXP and LOG again
    • -
    • nv50: check for immediates when turning MUL ADD into MAD
    • -
    • nv50: interp cannot write flags reg
    • -
    • nv50: MOV TEMP[0], -CONST[0] must be float32 negation
    • -
    • nv50: fix indirect CONST access with large or negative offsets
    • -
    • nv50: fix TXP depth comparison value
    • -
    • nv50: consider address register in reload elimination
    • -
    • nv50: improve and fix modifier folding optimization
    • -
    • nv50: put low limit on REG_ALLOC_TEMP and FP_RESULT_COUNT
    • -
    • Merge remote branch 'origin/nv50-compiler'
    • -
    • nv50: don't segfault on shaders with 0 instructions
    • -
    • nv50: get shader fixups/relocations into working state
    • -
    • nv50: add relocs for stack and local mem buffers
    • -
    • nv50: emit constbuf relocs before uploading constants
    • -
    • nv50: fix typo in fifo packet length limit
    • -
    • nv50: use formats table in nv50_surface.c
    • -
    • nv50: use CLEAR_BUFFERS for surface fills
    • -
    • nv50: fix/handle a few more PIPE_CAPs
    • -
    • nv50: fix GP state bind and validate
    • -

    - -

    Corbin Simpson (8): -

      -
    • r600g: Use align() instead of handrolled code.
    • -
    • r600g: Trivially deobfuscate r600_hw_states.
    • -
    • r600g: Deobfuscate and comment a few more functions in r600_hw_states.
    • -
    • r600g: Clean up some indentation and |= vs. | usage.
    • -
    • r600g: Fix false and true.
    • -
    • r600g: "tmp" is such a bad name for a texture.
    • -
    • r600g: Clean up PS setup.
    • -
    • r600g: Cleanup viewport floats.
    • -

    - -

    Daniel Lichtenberger (1): -

      -
    • radeon: fix potential segfault in renderbuffer update
    • -

    - -

    Daniel Vetter (21): -

      -
    • r200: revalidate after radeon_update_renderbuffers
    • -
    • i915g: rip out ->sw_tiled
    • -
    • i915g: s/hw_tiled/tiling
    • -
    • i915g: add pineview pci ids
    • -
    • i915g: kill RGBA/X formats
    • -
    • i915g: kill buf->map_gtt
    • -
    • i915g: kill idws->pool
    • -
    • i915g: drop alignment parameter from iws->buffer_create
    • -
    • i915g: add winsys function to create tiled buffers
    • -
    • i915g: switch to tiled allocations, kill set_fence
    • -
    • i915g: prepare winsys/batchbuffer for execbuf2
    • -
    • i915g: return tiling in iws->buffer_from_handle
    • -
    • i915g: implement unfenced color&depth buffer using tiling bits
    • -
    • i915g: implement unfenced relocs for textures using tiling bits
    • -
    • i915g: postpone mipmap/face offset calculation
    • -
    • i915g: don't pot-align stride for tiled buffers
    • -
    • i915g: enable X-tiling for textures
    • -
    • i915g: switch rendering to mipmapped textures to (x,y) offsets
    • -
    • i915g: enable x-tiling for render targets
    • -
    • i915g: assert(depth_surface->offset == 0)
    • -
    • i915g: track TODO items
    • -

    - -

    Dave Airlie (182): -

      -
    • r300g: fix buffer reuse issue caused by previous commit
    • -
    • r600g: pull r600_draw struct out into header
    • -
    • r600g: use index min/max + index buffer offset.
    • -
    • r600g: add vgt dma src defines
    • -
    • r600g: fixup texture state on evergreen.
    • -
    • r600g: fix texture bos and avoid doing depth blit on evergreen
    • -
    • r600g: hide radeon_ctx inside winsys.
    • -
    • r600g: attempt to abstract kernel bos from pipe driver.
    • -
    • r600g: move constant buffer creation behind winsys abstraction.
    • -
    • r600g: use malloc bufmgr for constant buffers
    • -
    • r600g: add support for kernel bo
    • -
    • r600g: add winsys bo caching.
    • -
    • r600g: add upload manager support.
    • -
    • r600g: fixup map flushing.
    • -
    • r600g: use calloc for ctx bo allocations
    • -
    • r600g: oops got the use_mem_constant the wrong way around.
    • -
    • r600g; add uses waterfall to asm cf for r6xx.
    • -
    • r600g: only emit uses waterfall on r6xx hw.
    • -
    • util/r300g: split the r300 index buffer modifier functions out to util
    • -
    • r600g: modify index buffers for sizes the hw can't deal with.
    • -
    • r600g: send correct surface base update for multi-cbufs
    • -
    • r600g: fix fbo-drawbuffers-maxtargets
    • -
    • r600g: clean up valgrind issues on maxtargets test.
    • -
    • r600g: drop debugging that snuck in
    • -
    • r600g: fix tiling support for ddx supplied buffers
    • -
    • r600g: add z16 to color setup
    • -
    • r600g: add color/texture support for more depth formats.
    • -
    • r600g: fix r700 cube map sizing.
    • -
    • r600g: fixup r700 CB_SHADER_CONTROL register.
    • -
    • r600g: add missing BC_INST wrapper for evergreen
    • -
    • r600g: only flush for the correct colorbuffer, not all of them.
    • -
    • r600g: deal with overflow of VTX/TEX CF clauses.
    • -
    • r600g: set back to correct codepaths.
    • -
    • r600g: fixup evergreen miptree setup.
    • -
    • r600g: fix eg texture borders.
    • -
    • r600g: fix typo in struct member name
    • -
    • r600g: cleanup some of the DB blit code
    • -
    • r600g: make stencil readback work
    • -
    • r600g: disable dirty handling on texture from depth code.
    • -
    • r600g: use floats instead of hex for blit vbo
    • -
    • r600g: fix depth readback on rv610 and other quirky variants.
    • -
    • r600g: fix typo in evergreen register list
    • -
    • u_blitter: add a custom blitter call passing a dsa cso
    • -
    • r600g: use blitter to do db->cb flushing.
    • -
    • r600g: fix warnings since last commit.
    • -
    • egl: fix build since 17eace581d25a626a7d75d9d1205d012cbb14a6e
    • -
    • r300g: fix point sprite coord.
    • -
    • r600g: add vert support for 16/16 and 16/16/16 floats.
    • -
    • r600g: add some more vertex format support.
    • -
    • r600g: some more vertex formats
    • -
    • r600g: fix draw-elements and draw-elements-base-vertex
    • -
    • r600g: drop index_offset parameter to index buffer translate.
    • -
    • r600g: fixup tex wrapping.
    • -
    • r600g: fixup VP->FP output->input routing.
    • -
    • r600g: fix typo in r700 alu emit
    • -
    • r600g: fixup sprite coord enable.
    • -
    • r600g: fix polygon mode
    • -
    • mesa/mipmap: fix warning since 1acadebd6270d3604b026842b8a21360968618a0
    • -
    • r600g: add eg poly mode code.
    • -
    • r600g: make index bias fix for evergreen
    • -
    • r600g: add eg db count control register.
    • -
    • r300g: fix glsl-fs-pointcoord
    • -
    • r600g: add evergreen texture resource properly.
    • -
    • r600g: fix db flush breaking config state
    • -
    • r600g: on evergreen the centroid isn't set in this register.
    • -
    • r600g: add back evergreen name.
    • -
    • r600g: add evergreen texture border support to new path
    • -
    • r600g: move radeon.h members around to add back map flushing.
    • -
    • r600g: add initial vertex translate support.
    • -
    • r600g: remove old assert from new codepath
    • -
    • Revert "r600g: add initial vertex translate support."
    • -
    • r600g: port r300g fix for X* formats in texformat code
    • -
    • r600g: add L8A8 unorm.
    • -
    • r600g: clean up some code from move to new paths.
    • -
    • r600g: return string for chip family
    • -
    • r600g: use Elements macro instead of manual sizeofs
    • -
    • r600g: fix evergreen depth flushing.
    • -
    • r600g: add winsys support for CTL constants.
    • -
    • r600g: drop depth quirk on evergreen
    • -
    • r600g: add reloc for evergreen color attrib
    • -
    • r600g: realign evergreen code with r600 code.
    • -
    • r600g: add assembler support for other vtx fetch fields.
    • -
    • r600g: fixup vertex format picking.
    • -
    • r600g: sync vertex/texture cache on resources on evergreen
    • -
    • r600g: add cb flushing for extra buffers + depth buffer on r600/evergreen
    • -
    • r600g: fix evergreen draw-buffers
    • -
    • r600g: flush SH cache on constant change on evergreen
    • -
    • r600g: only set the Z export if shader exports it.
    • -
    • r600g: setup basic loop consts on r600 + evergreen.
    • -
    • mesa/st: initial attempt at RG support for gallium drivers
    • -
    • r600g: break out of search for reloc bo after finding it.
    • -
    • r600g: the code to check whether a new vertex shader is needed was wrong
    • -
    • r600g: fix wwarning in bo_map function
    • -
    • r600g: TODO domain management
    • -
    • r600g: add bo fenced list.
    • -
    • pb: don't keep checking buffers after first busy
    • -
    • r600g: add bo busy backoff.
    • -
    • r600g: drop mman allocator
    • -
    • r600g: drop use_mem_constant.
    • -
    • r600g: avoid unneeded bo wait
    • -
    • pb: fix numDelayed accounting
    • -
    • r600g: add evergreen stencil support.
    • -
    • r600g: use format from the sampler view not from the texture.
    • -
    • r600g: fix Z export enable bits.
    • -
    • r600g: add some RG texture format support.
    • -
    • r600g: drop width/height per level storage.
    • -
    • r600g: fix input/output Z export mixup for evergreen.
    • -
    • r600g: evergreen has no request size bit in texture word4
    • -
    • r600g: enable vertex samplers.
    • -
    • r600g: add TXL opcode support.
    • -
    • r600g: don't run with scissors.
    • -
    • r600g: fix typo in vertex sampling on r600
    • -
    • gallium/tgsi: add support for stencil writes.
    • -
    • gallium/format: add support for X24S8 and S8X24 formats.
    • -
    • gallium/format: add X32_S8X24_USCALED format.
    • -
    • gallium/util: add S8 tile sampling support.
    • -
    • mesa: add support for FRAG_RESULT_STENCIL.
    • -
    • mesa: improve texstore for 8/24 formats and add texstore for S8.
    • -
    • softpipe: add support for shader stencil export capability
    • -
    • st/mesa: add option to choose a texture format that we won't render to.
    • -
    • st/mesa: use shader stencil export to accelerate shader drawpixels.
    • -
    • r600g: add support for S8, X24S8 and S8X24 sampler formats.
    • -
    • r600g: add shader stencil export support.
    • -
    • glsl: add support for shader stencil export
    • -
    • st/mesa: enable stencil shader export extension if supported
    • -
    • r600g: fix depth0 setting
    • -
    • r600g: fix scissor/cliprect confusion
    • -
    • r600g: store samplers/views across blit when we need to modify them
    • -
    • r600g: reduce size of context structure.
    • -
    • r600g: the vs/ps const arrays weren't actually being used.
    • -
    • r600g: add copy into tiled texture
    • -
    • r600g: split out miptree setup like r300g
    • -
    • r600g: use common texture object create function
    • -
    • r600g: rename pitch in texture to pitch_in_bytes
    • -
    • r600g: remove bpt and start using pitch_in_bytes/pixels.
    • -
    • r600g: fix transfer stride.
    • -
    • r600g: drop all use of unsigned long
    • -
    • r600g: use blitter for hw copy region
    • -
    • r600g: evergreen add stencil export bit
    • -
    • r600g: add missing eg reg definition
    • -
    • r600g: fix stencil export for evergreen harder
    • -
    • r600g: drop unused context members
    • -
    • r600g: only pick centroid coordinate when asked.
    • -
    • r600g: fixup pos/face ena/address properly
    • -
    • r600g: fixup typo in macro name
    • -
    • r600g: select linear interpolate if tgsi input requests it
    • -
    • r300g: clean up warning due to unknown cap.
    • -
    • tgsi: add scanner support for centroid inputs
    • -
    • r600g: evergreen interpolation support.
    • -
    • r600g: add evergreen ARL support.
    • -
    • r600g: switch to a common formats.h file since they are in different regs
    • -
    • r600g: add defines for tiling
    • -
    • r600g: get tiling info from kernel
    • -
    • r600g: set tiling bits in hw state
    • -
    • r600g: do proper tracking of views/samplers.
    • -
    • r600g: fix typo in tiling setup cb code.
    • -
    • r600g: depth needs to bound to ds
    • -
    • r600g: attempt to cleanup depth blit
    • -
    • r600g: fix transfer function for tiling.
    • -
    • r600g: retrieve tiling info from kernel for shared buffers.
    • -
    • r600g: all non-0 mipmap levels need to be w/h aligned to POT.
    • -
    • r600g: move to per-miplevel array mode.
    • -
    • r600g: start adding hooks for aligning width/height for tiles.
    • -
    • r600g: add r600 surface to store the aligned height.
    • -
    • r600g: introduce a per-driver resource flag for transfers.
    • -
    • r600g: add texture tiling alignment support.
    • -
    • r600g: add texture tiling enable under a debug option.
    • -
    • r600g: initial translate state support
    • -
    • r600g: start splitting out common code from eg/r600.
    • -
    • r600g: not fatal if we can't get tiling info from kernel
    • -
    • r600g: merge more of the common r600/evergreen state handling
    • -
    • r600g: drop more common state handling code
    • -
    • r600g: fix magic 0x1 ->flat shade ena
    • -
    • r600g: add assembler support for all the kcache fields.
    • -
    • gallium/noop: report GL 2.1
    • -
    • r600g: pick correct color swap for A8 fbos.
    • -
    • r300g/r600g: bump cache manager timeouts to 1s
    • -
    • r600g: it looks like r600 can handle dword offsets in the indices.
    • -
    • r300g: try and use all of vertex constant space
    • -
    • r300g: fixup rs690 tiling stride alignment calculations.
    • -
    • r600g: fix evergreen segfaults.
    • -
    • r600g: hack around property unknown issues.
    • -

    - -

    Eric Anholt (300): -

      -
    • glsl: Add definition of gl_TextureMatrix inverse/transpose builtins.
    • -
    • i965: Share the KIL_NV implementation between glsl and non-glsl.
    • -
    • i965: Also enable CC statistics when doing OQs.
    • -
    • i965: Track the windowizer's dispatch for kill pixel, promoted, and OQ
    • -
    • glsl: Rework assignments with write_masks to have LHS chan count match RHS.
    • -
    • glsl: Fix copy'n'wasted ir_noop_swizzle conditions.
    • -
    • ir_to_mesa: Only compare vector_elements present for any_nequal/all_equal
    • -
    • i965: Fix the vector/expression splitting for the write_mask change.
    • -
    • i965: When splitting vector variable assignment, ignore unset channels.
    • -
    • i965: Update expression splitting for the vector-result change to compares.
    • -
    • i965: Warning fix for vector result any_nequal/all_equal change.
    • -
    • mesa: Remove the non-required ARB_imaging extension.
    • -
    • mesa: Remove EXT_histogram.
    • -
    • mesa: Remove SGI_color_table.
    • -
    • mesa: Remove SGI_color_matrix.
    • -
    • mesa: Remove EXT_convolution.
    • -
    • intel: Remove disabled stencil drawpixels acceleration.
    • -
    • intel: Remove unnecessary minimum pitch alignment to 32 bytes.
    • -
    • intel: Replace my intel_texture_bitmap code with _mesa_meta_Bitmap.
    • -
    • radeon: Remove copied minimum pitch alignment code.
    • -
    • unichrome: Mostly revert my convolution removal changes.
    • -
    • intel: Remove dead intelIsTextureResident().
    • -
    • i915: Remove a dead if (0) block.
    • -
    • intel: Dead comment removal.
    • -
    • intel: Corresponding FinishRenderTexture debug to BeginRenderTexture.
    • -
    • i965: Add support for rendering to SARGB8 FBOs.
    • -
    • intel: Fix segfault on INTEL_DEBUG=fbo with unsupported framebuffers.
    • -
    • intel: Add fallback debug to glGenerateMipmap.
    • -
    • intel: More reverting of the sw fallback for depth texture border color.
    • -
    • intel: Improve some of the miptree debugging.
    • -
    • mesa: Fix type typo in glGenerateMipmap handling of GL_UNSIGNED_INT data.
    • -
    • glsl: Fix broadcast_index of lower_variable_index_to_cond_assign.
    • -
    • glsl: Add validation that a swizzle only references valid channels.
    • -
    • i965: Fix up writemasked assignments in the new FS.
    • -
    • i965: Remove swizzling of assignment to vector-splitting single-channel LHS.
    • -
    • i965: Handle all_equal/any_nequal in the new FS.
    • -
    • i965: Fix vector splitting RHS channel selection with sparse writemasks.
    • -
    • i965: Add support for dFdx()/dFdy() to the FS backend.
    • -
    • i965: Add support for attribute interpolation on Sandybridge.
    • -
    • i965: Set up inputs to the fragment shader according to FP InputsRead.
    • -
    • i965: Add support for POW in gen6 FS.
    • -
    • i965: Fix negation in the new FS backend.
    • -
    • i965: Actually track the "if" depth in loop in the new FS backend.
    • -
    • i965: Apply the same set of lowering passes to new FS as to Mesa IR.
    • -
    • i965: Fix valgrind complaint about base_ir for new FS debugging.
    • -
    • i965: Fix up the FS backend for the variable array indexing pass.
    • -
    • i965: Set the variable type when dereferencing an array.
    • -
    • i965: Add support for dereferencing structs to the new FS backend.
    • -
    • i965: Add support for struct, array, and matrix uniforms to FS backend.
    • -
    • i965: Fix all non-snb regression in the snb attribute interpolation commit.
    • -
    • i965: Fix up part of my Sandybridge attributes support patch.
    • -
    • i965: Add support for gl_FrontFacing to the new FS backend.
    • -
    • i965: Subtract instead of adding when computing y delta in new FS backend.
    • -
    • mesa: Pull ir_to_mesa's sampler number fetcher out to shared code.
    • -
    • i965: Set up sampler numbers in the FS backend.
    • -
    • i965: Add support for non-color render target write data to new FS backend.
    • -
    • i965: Add support for MRT to the new FS backend.
    • -
    • i965: Add support for ir_loop counters to the new FS backend.
    • -
    • i965: Add support for ARB_fragment_coord_conventions to the new FS backend.
    • -
    • glsl: Also update implicit sizes of varyings at link time.
    • -
    • i965: Do interpolation for varying matrices and arrays in the FS backend.
    • -
    • i965: Don't try to emit interpolation for unused varying slots.
    • -
    • i965: Fix array indexing of arrays of matrices.
    • -
    • i965: Clean up obsolete FINISHME comment.
    • -
    • mesa: Move the list of builtin uniform info from ir_to_mesa to shared code.
    • -
    • i965: Add support for builtin uniforms to the new FS backend.
    • -
    • i965: Fix use of undefined mem_ctx in vector splitting.
    • -
    • i956: Make new FS discard do its work in a temp, not the null reg!
    • -
    • i965: Clean up the virtual GRF handling.
    • -
    • ra: First cut at a graph-coloring register allocator for mesa.
    • -
    • i965: First cut at register allocation using graph coloring.
    • -
    • i965: Add live interval analysis and hook it up to the register allocator.
    • -
    • i965: Remove my "safety counter" code from loops.
    • -
    • i965: Fix whole-structure/array assignment in new FS.
    • -
    • mesa: Don't reference a W component in setting up a vec3 uniform component.
    • -
    • i965: Fix new FS handling of builtin uniforms with packed scalars in structs.
    • -
    • glsl: Add a lowering pass for texture projection.
    • -
    • i965: Use the lowering pass for texture projection.
    • -
    • i965: Split the gen4 and gen5 sampler handling apart.
    • -
    • i965: Add gen6 attribute interpolation to new FS backend.
    • -
    • i965: Fix the gen6 jump size for BREAK/CONT in new FS.
    • -
    • i965: Also increment attribute location when skipping unused slots.
    • -
    • i965: Pre-gen6, map VS outputs (not FS inputs) to URB setup in the new FS.
    • -
    • i965: Add real support for pre-gen5 texture sampling to the new FS.
    • -
    • i965: Fix up copy'n'pasteo from moving coordinate setup around for gen4.
    • -
    • i965: Restore the forcing of aligned pairs for delta_xy on chips with PLN.
    • -
    • i965: When producing a single channel swizzle, don't make a temporary.
    • -
    • i965: Add a sanity check for register allocation sizes.
    • -
    • i965: Fix off-by-ones in handling the last members of register classes.
    • -
    • i965: Don't try to emit code if we failed register allocation.
    • -
    • i965: Add support for EXT_texture_swizzle to the new FS backend.
    • -
    • i965: Set up swizzling of shadow compare results for GL_DEPTH_TEXTURE_MODE.
    • -
    • i965: Fix glean/texSwizzle regression in previous commit.
    • -
    • i965: Be more conservative on live interval calculation.
    • -
    • i965: Add trivial dead code elimination in the new FS backend.
    • -
    • i965: Add initial folding of constants into operand immediate slots.
    • -
    • i965: In disasm, gen6 fb writes don't put msg reg # in destreg_conditionalmod.
    • -
    • i965: Add support for gen6 FB writes to the new FS.
    • -
    • i965: Enable the constant propagation code.
    • -
    • i965: Also do constant propagation for the second operand of CMP.
    • -
    • i965: Add back gen6 headerless FB writes to the new FS backend.
    • -
    • i965: Gen6 no longer has the IFF instruction; always use IF.
    • -
    • i965: Fix up IF/ELSE/ENDIF for gen6.
    • -
    • i965: Fix botch in the header_present case in the new FS.
    • -
    • i965: Add some clarification of the WECtrl field.
    • -
    • i965: Don't do 1/w multiplication in new FS for gen6
    • -
    • i965: Gen6's sampler messages are the same as Ironlake.
    • -
    • i965: Refactor gl_FrontFacing setup out of general variable setup.
    • -
    • i965: Add support for gl_FrontFacing on gen6.
    • -
    • i965: Don't assume that WPOS is always provided on gen6 in the new FS.
    • -
    • i965: Fix gen6 pointsize handling to match pre-gen6.
    • -
    • i965: Disable emitting if () statements on gen6 until we really fix them.
    • -
    • i965: Normalize cubemap coordinates like is done in the Mesa IR path.
    • -
    • mesa: Simplify a bit of _mesa_add_state_reference using memcmp.
    • -
    • i965: Drop the check for duplicate _mesa_add_state_reference.
    • -
    • i965: Drop the check for YUV constants in the param list.
    • -
    • i965: Handle swizzles in the addition of YUV texture constants.
    • -
    • i965: Fix gen6 WM push constants updates.
    • -
    • i965: Fix new FS gen6 interpolation for sparsely-populated arrays.
    • -
    • i965: Enable attribute swizzling (repositioning) in the gen6 SF.
    • -
    • i965: Add register coalescing to the new FS backend.
    • -
    • i965: Split FS_OPCODE_DISCARD into two steps.
    • -
    • i965: Reduce register interference checks for changed FS_OPCODE_DISCARD.
    • -
    • i965: Move FS backend structures to a header.
    • -
    • i965: Give the math opcodes information on base mrf/mrf len.
    • -
    • i965: Give the FB write and texture opcodes the info on base MRF, like math.
    • -
    • i965: Compute to MRF in the new FS backend.
    • -
    • i965: Don't consider gen6 math instructions to write to MRFs.
    • -
    • i965: Add a couple of checks for gen6 math instruction limits.
    • -
    • i965: Don't compute-to-MRF in gen6 math instructions.
    • -
    • i965: Expand uniform args to gen6 math to full registers to get hstride == 1.
    • -
    • i965: Don't compute-to-MRF in gen6 VS math.
    • -
    • i965: Fix gen6 pixel_[xy] setup to avoid mixing int and float src operands.
    • -
    • i965: Always use the new FS backend on gen6.
    • -
    • i965: Fix missing "break;" in i2b/f2b, and missing AND of CMP result.
    • -
    • intel: Allow CopyTexSubImage to InternalFormat 3/4 textures, like RGB/RGBA.
    • -
    • i965: Don't rebase the index buffer to min 0 if any arrays are in VBOs.
    • -
    • i965: Add support for rescaling GL_TEXTURE_RECTANGLE coords to new FS.
    • -
    • i965: Set class_sizes[] for the aligned reg pair class.
    • -
    • i965: Update the live interval when coalescing regs.
    • -
    • i965: Add a pass to the FS to split virtual GRFs to float channels.
    • -
    • i965: Add a function for handling the move of boolean values to flag regs.
    • -
    • i965: Add peepholing of conditional mod generation from expressions.
    • -
    • i965: Enable the new FS backend on pre-gen6 as well.
    • -
    • i965: Fix texturing on pre-gen5.
    • -
    • i965: Set the type of the null register to fix gen6 FS comparisons.
    • -
    • i965: Disable the debug printf I added for FS disasm.
    • -
    • i965: Fix a weirdness in NOT handling.
    • -
    • i965: Fix assertion failure on gen6 BufferSubData to busy BO.
    • -
    • i965: Assert out on gen6 VS constant buffer reads that hang the GPU for now.
    • -
    • i965: Fix scissor-offscreen on gen6 like we did pre-gen6.
    • -
    • i965: Avoid blits in BufferCopySubdata on gen6.
    • -
    • i965: Tell the shader compiler when we expect depth writes for gen6.
    • -
    • i965: Remove the gen6 emit_mi_flushes I sprinkled around the driver.
    • -
    • i965: Disable thread dispatch when the FS doesn't do any work.
    • -
    • i965: Add EU emit support for gen6's new IF instruction with comparison.
    • -
    • i965: Set the source operand types for gen6 if/else/endif to integer.
    • -
    • i965: Use the new style of IF statement with embedded comparison on gen6.
    • -
    • i965: Split register allocation out of the ever-growing brw_fs.cpp.
    • -
    • i965: Fix gl_FrontFacing emit on pre-gen6.
    • -
    • i965: Add support for register spilling.
    • -
    • i965: Don't emit register spill offsets directly into g0.
    • -
    • i965: Correct scratch space allocation.
    • -
    • i965: Be more aggressive in tracking live/dead intervals within loops.
    • -
    • i965: Move the FS disasm/annotation printout to codegen time.
    • -
    • i965: Add support for pull constants to the new FS backend.
    • -
    • i965: Add EU code for dword scattered reads (constant buffer array indexing).
    • -
    • i965: Clarify an XXX comment in FB writes with real info.
    • -
    • i965: Use SENDC on the first render target write on gen6.
    • -
    • i965: Clear some undefined fields of g0 when using them for gen6 FB writes.
    • -
    • i965: Add disasm for the flag register.
    • -
    • i965: Add support for discard instructions on gen6.
    • -
    • i965: Handle new ir_unop_round_even in channel expression splitting.
    • -
    • i965: Fix typo in comment about state flags.
    • -
    • i965: Set up the constant buffer on gen6 when it's needed.
    • -
    • i965: Add support for constant buffer loads on gen6.
    • -
    • i965: Drop the eot argument to read messages, which can never be set.
    • -
    • i965: Fix VS URB entry sizing.
    • -
    • i965: Disable register spilling on gen6 until it's fixed.
    • -
    • i965: Make FS uniforms be the actual type of the uniform at upload time.
    • -
    • i965: Add user clip planes support to gen6.
    • -
    • i965: Update gen6 SF state when point state (sprite or attenuation) changes.
    • -
    • i965: Upload required gen6 VS push constants even when using pull constants.
    • -
    • i965: Update the gen6 stencil ref state when stencil state changes.
    • -
    • mesa: Make metaops use program refcounts instead of names.
    • -
    • mesa: Don't compute an unused texture completeness debug string.
    • -
    • intel: For batch, use GTT mapping instead of writing to a malloc and copying.
    • -
    • intel: Annotate debug printout checks with unlikely().
    • -
    • intel: Remove the magic unaligned memcpy code.
    • -
    • i965: Remove dead intel_structs.h file.
    • -
    • intel: Avoid taking logbase2 of several things that we max.
    • -
    • intel: Remove duplicated teximage miptree to object miptree promotion.
    • -
    • intel: Remove leftover dri1 locking fields in the context.
    • -
    • mesa: Fix delayed state flagging for EXT_sso-related program changes.
    • -
    • intel: Fix the client-side swapbuffers throttling.
    • -
    • Revert "intel: Fix the client-side swapbuffers throttling."
    • -
    • i965: Allow OPCODE_SWZ to put immediates in the first arg.
    • -
    • i965: Add support for math on constants in gen6 brw_wm_glsl.c path.
    • -
    • i965: Work around strangeness in swizzling/masking of gen6 math.
    • -
    • i965: re-enable gen6 IF statements in the fragment shader.
    • -
    • glsl: Free the loop state context when we free the loop state.
    • -
    • i965: Fix gl_FragCoord inversion when drawing to an FBO.
    • -
    • i965: Shut up spurious gcc warning about GLSL_TYPE enums.
    • -
    • mesa: Don't spam the console in a debug build unless some spam is requested.
    • -
    • i965: Add state dumping for sampler state.
    • -
    • i965: Add dumping of the sampler default color.
    • -
    • i965: Fail on loops on gen6 for now until we write the EU emit code for it.
    • -
    • i965: Eliminate dead code more aggressively.
    • -
    • mesa: Include C++ files in the makedepend of DRI drivers.
    • -
    • i965: Fix compute_to_mrf to not move a MRF write up into another live range.
    • -
    • i965: Just use memset() to clear most members in FS constructors.
    • -
    • i965: Remove extra n at the end of every instruction in INTEL_DEBUG=wm.
    • -
    • i965: Fold constants into the second arg of BRW_SEL as well.
    • -
    • glsl: Add a helper function for determining if an rvalue could be a saturate.
    • -
    • i965: Recognize saturates and turn them into a saturated mov.
    • -
    • ir_to_mesa: Detect and emit MOV_SATs for saturate constructs.
    • -
    • i965: Improve compute-to-mrf.
    • -
    • i965: Remove duplicate MRF writes in the FS backend.
    • -
    • i965: Move gen4 blend constant color to the gen4 blending file.
    • -
    • i965: Don't upload polygon stipple unless required.
    • -
    • i965: Don't upload line stipple pattern unless we're stippling.
    • -
    • i965: Don't upload line smooth params unless we're line smoothing.
    • -
    • i965: Use the new embedded compare in SEL on gen6 for VS MIN and MAX opcodes.
    • -
    • i965: Fix type of gl_FragData[] dereference for FB write.
    • -
    • glsl: Make the symbol table's add_function just use the function's name.
    • -
    • glsl: Make the symbol table's add_variable just use the variable's name.
    • -
    • glsl: Add a helper constructor for expressions that works out result type.
    • -
    • glsl: Fix structure and array comparisions.
    • -
    • glsl: Quiet unreachable no-return-from-function warning.
    • -
    • i965: Dump the WHILE jump distance on gen6.
    • -
    • i965: Add support for gen6 DO/WHILE ISA emit.
    • -
    • i965: Add support for gen6 BREAK ISA emit.
    • -
    • i965: Add support for gen6 CONTINUE instruction emit.
    • -
    • i965: Enable IF statements in the VS.
    • -
    • i965: Add support for loops in the VS.
    • -
    • glsl: Mark the array access for whole-array comparisons.
    • -
    • glsl: Fix flipped return of has_value() for array constants.
    • -
    • mesa: Add getters for the rest of the supported draw buffers.
    • -
    • mesa: Add getters for ARB_copy_buffer's attachment points.
    • -
    • intel: Add an env var override to execute for a different GPU revision.
    • -
    • i965: Update gen6 WM state on compiled program change, not just FP change.
    • -
    • i965: Update gen6 SF state on fragment program change too.
    • -
    • i965: Fix compile warning about missing opcodes.
    • -
    • i965: Move payload reg setup to compile, not lookup time.
    • -
    • i965: Provide delta_xy reg to gen6 non-GLSL path PINTERP.
    • -
    • i965: Fix up 16-wide gen6 FB writes after various refactoring.
    • -
    • i965: Don't smash a group of coordinates doing gen6 16-wide sampler headers.
    • -
    • i965: Fix gen6 interpolation setup for 16-wide.
    • -
    • i965: Fix up gen6 samplers for their usage by brw_wm_emit.c
    • -
    • i965: Make the sampler's implied move on gen6 be a raw move.
    • -
    • i965: Align gen6 push constant size to dispatch width.
    • -
    • i965: Add support for the instruction compression bits on gen6.
    • -
    • i965: Nuke brw_wm_glsl.c.
    • -
    • i965: Remove INTEL_DEBUG=glsl_force now that there's no brw_wm_glsl.c
    • -
    • i965: Fix comment about gen6_wm_constants.
    • -
    • i965: Handle saturates on gen6 math instructions.
    • -
    • i965: Always hand the absolute value to RSQ.
    • -
    • i965: Add disabled debug code for dumping out the WM constant payload.
    • -
    • i965: Work around gen6 ignoring source modifiers on math instructions.
    • -
    • i965: Fix flipped value of the not-embedded-in-if on gen6.
    • -
    • i965: Don't try to store gen6 (float) blend constant color in bytes.
    • -
    • i965: Set up the color masking for the first drawbuffer on gen6.
    • -
    • i965: Set up the per-render-target blend state on gen6.
    • -
    • i965: Set the render target index in gen6 fixed-function/ARB_fp path.
    • -
    • i965: Use the new pixel mask location for gen6 ARB_fp KIL instructions.
    • -
    • i965: Drop KIL_NV from the ff/ARB_fp path since it was only used for GLSL.
    • -
    • i965: Drop push-mode reladdr constant loading and always use constant_map.
    • -
    • i965: Fix VS constants regression pre-gen6.
    • -
    • i965: Clean up VS constant buffer location setup.
    • -
    • i965: Set up the correct texture border color state struct for Ironlake.
    • -
    • i965: Set render_cache_read_write surface state bit on gen6 constant surfs.
    • -
    • i965: remove unused variable since brw_wm_glsl.c removal.
    • -
    • intel: Use plain R8 and RG8 for COMPRESSED_RED and COMPRESSED_RG.
    • -
    • intel: Set the swizzling for depth textures using the GL_RED depth mode.
    • -
    • glsl: Correct the marking of InputsRead/OutputsWritten on in/out matrices.
    • -
    • i965: Correct the dp_read message descriptor setup on g4x.
    • -
    • intel: Include stdbool so we can stop using GLboolean when we want to.
    • -
    • i965: Fix ARL to work on gen6.
    • -
    • i956: Fix the old FP path fragment position setup on gen6.
    • -
    • i965: Fix gl_FragCoord.z setup on gen6.
    • -
    • i965: Add support for using the BLT ring on gen6.
    • -
    • intel: Update renderbuffers before looking up CopyTexImage's read buffer.
    • -
    • intel: Drop commented intel_flush from copy_teximage.
    • -
    • intel: Try to sanely check that formats match for CopyTexImage.
    • -
    • intel: Support glCopyTexImage() from XRGB8888 to ARGB8888.
    • -
    • i965: Avoid using float type for raw moves, to work around SNB issue.
    • -
    • i965: Set the alternative floating point mode on gen6 VS and WM.
    • -
    • i965: Add support for gen6 constant-index constant loading.
    • -
    • i965: Add support for gen6 reladdr VS constant loading.
    • -
    • i965: Improve the hacks for ARB_fp scalar^scalar POW on gen6.
    • -
    • i965: Factor out the ir comparision to BRW_CONDITIONAL_* code.
    • -
    • i965: Fix regression in FS comparisons on original gen4 due to gen6 changes.
    • -
    • i965: Do lowering of array indexing of a vector in the FS.
    • -
    • intel: Only do frame throttling at glFlush time when using frontbuffer.
    • -
    • intel: Handle forced swrast clears before other clear bits.
    • -
    • intel: Use tri clears when we don't know how to blit clear the format.
    • -
    • intel: Add spans code for the ARB_texture_rg support.
    • -
    • intel: Add a couple of helper functions to reduce rb code duplication.
    • -
    • intel: Fix segfaults from trying to use _ColorDrawBuffers in FBO validation.
    • -
    • intel: When validating an FBO's combined depth/stencil, use the given FBO.
    • -

    - -

    Fabian Bieler (2): -

      -
    • r600g: set address of pop instructions to next instruction
    • -
    • glsl: fix lowering conditional returns in subroutines
    • -

    - -

    Francisco Jerez (51): -

      -
    • dri/nv04: Fix PGRAPH_ERRORs when running OA.
    • -
    • dri/nv04: Mipmapping fixes.
    • -
    • dri/nv04: Align SIFM transfer dimensions.
    • -
    • dri/nv04: Fix up color mask.
    • -
    • dri/nv04: Fix maximum texture size.
    • -
    • dri/nv04: Fix provoking vertex.
    • -
    • dri/nouveau: Update nouveau_class.h.
    • -
    • dri/nouveau: Add some more extensions.
    • -
    • dri/nouveau: Fix glRenderbufferStorage with DEPTH_COMPONENT as internal format.
    • -
    • dri/nouveau: Don't request a fake front unnecessarily.
    • -
    • dri/nouveau: Don't reemit the BO state in nouveau_state_emit().
    • -
    • dri/nouveau: Cleanup references to the old FBOs on glMakeCurrent().
    • -
    • meta: Don't bind the created texture object in init_temp_texture().
    • -
    • dri/nv10: Fix the CLAMP texture wrap mode.
    • -
    • dri/nv04: Use nvgl_wrap_mode().
    • -
    • dri/nouveau: Remove unnecessary assertion.
    • -
    • dri/nouveau: Cleanup more references to old FBOs and VBOs.
    • -
    • dri/nv10-nv20: Fix texturing in some cases after a base level change.
    • -
    • dri/nouveau: Fix software mipmap generation on 1x1 textures.
    • -
    • dri/nouveau: Have a smaller amount of larger scratch buffers.
    • -
    • dri/nouveau: Remove unnecessary flush.
    • -
    • dri/nv10: Use fast Z clears.
    • -
    • dri/nouveau: Minor cleanup.
    • -
    • dri/nv10: Fake fast Z clears for pre-nv17 cards.
    • -
    • dri/nouveau: Initialize tile_flags when allocating a render target.
    • -
    • nouveau: Get larger push buffers.
    • -
    • dri/nouveau: Force a "slow" Z clear if we're getting a new depth buffer.
    • -
    • dri/nv20: Clear with the 3D engine.
    • -
    • dri/nouveau: Don't assert(0) on compressed internal formats.
    • -
    • dri/nv25: Bind a hierarchical depth buffer.
    • -
    • dri/nouveau: Call _mesa_update_state() after framebuffer invalidation.
    • -
    • dri/nouveau: Honor the access flags in nouveau_bufferobj_map_range.
    • -
    • dri/nouveau: Tell the vbo module we want real hardware BOs.
    • -
    • dri/nouveau: Split out the scratch helpers to a separate file.
    • -
    • dri/nouveau: Avoid recursion in nouveau_bo_context_reset().
    • -
    • dri/nouveau: Use a macro to iterate over the bound vertex attributes.
    • -
    • dri/nouveau: Split out array handling to its own file.
    • -
    • dri/nouveau: Optimize VBO binding re-emission.
    • -
    • dri/nouveau: Keep small DYNAMIC_DRAW vertex buffers in system ram.
    • -
    • dri/nouveau: Pipeline glTexSubImage texture transfers.
    • -
    • dri/nouveau: Fix type promotion issue on 32bit platforms.
    • -
    • dri/nouveau: Validate the framebuffer state on read buffer changes.
    • -
    • dri/nouveau: Re-emit the BO state when coming back from a software fallback.
    • -
    • meta: Don't leak alpha function/reference value changes.
    • -
    • meta: Fix incorrect rendering of the bitmap alpha component.
    • -
    • vbo: Avoid unnecessary copy to/from current in vertex format upgrade.
    • -
    • meta: Don't try to disable cube maps if the driver doesn't expose the extension.
    • -
    • meta: Handle bitmaps with alpha test enabled.
    • -
    • dri/nouveau: Split hardware/software TNL instantiation more cleanly.
    • -
    • dri/nouveau: Fix typo.
    • -
    • dri/nouveau: Kill a bunch of ternary operators.
    • -

    - -

    Fredrik Höglund (2): -

      -
    • r600g: Fix texture sampling with swizzled coords
    • -
    • r600g: fix pow(0, 0) evaluating to NaN
    • -

    - -

    Guillermo S. Romero (1): -

      -
    • r300g: Do not use buf param before checking for NULL.
    • -

    - -

    Henri Verbeet (19): -

      -
    • r600g: Flush upload buffers before draws instead of before flushes.
    • -
    • r600g: Check for other references before checking for existing mappings in radeon_bo_pb_map_internal().
    • -
    • r600g: Remove a redundant flush in r600_texture_transfer_map().
    • -
    • r600g: Buffer object maps imply a wait.
    • -
    • r600g: Respect PB_USAGE_UNSYNCHRONIZED in radeon_bo_pb_map_internal().
    • -
    • Revert "r600g: Flush upload buffers before draws instead of before flushes."
    • -
    • r600g: fix exports_ps to export a number not a mask.
    • -
    • r600g: Mention AMD in the renderer string.
    • -
    • r600g: Cleanup the fenced_bo list in r600_context_fini().
    • -
    • r600g: Evergreen has two extra frac_bits for the sampler LOD state.
    • -
    • r600: Evergreen has two extra frac_bits for the sampler LOD state.
    • -
    • r600g: Add PIPE_FORMAT_L8A8_UNORM for Evergreen as well.
    • -
    • r600g: Swizzle vertex data only once.
    • -
    • r600g: Synchronize supported color formats between Evergreen and r600/r700.
    • -
    • r600g: Fix the PIPE_FORMAT_L8A8_UNORM color swaps.
    • -
    • r600g: Fix the PIPE_FORMAT_A8_UNORM color swap for Evergreen as well.
    • -
    • r600g: Cleanup block bo references in r600_context_fini().
    • -
    • r600g: Cleanup fetch shader resources in r600_pipe_shader_destroy().
    • -
    • st/mesa: Handle wrapped depth buffers in st_copy_texsubimage().
    • -

    - -

    Hui Qi Tay (10): -

      -
    • llvmpipe: minor changes in llvm coefficient calcs
    • -
    • draw: cliptest and viewport done in a single loop in vertex shader
    • -
    • draw: added viewport and cliptest flags
    • -
    • draw: sanitize llvm variant key
    • -
    • draw: corrections for w coordinate
    • -
    • draw: corrections to allow for different cliptest cases
    • -
    • llvmpipe: Moved draw pipeline twoside function to llvm setup code
    • -
    • llvmpipe: added llvm offset setup code
    • -
    • llvmpipe: clean up polygon offset function in lp setup code
    • -
    • llvmpipe: fix such that offset/twoside function only does in-place modification
    • -

    - -

    Ian Romanick (102): -

      -
    • glsl2: Refactor testing for whether a deref is of a matrix or array
    • -
    • glsl2: Add flags to enable variable index lowering
    • -
    • glsl: Add doxygen comments
    • -
    • EGL DRI2: Silence piles of 'unused variable' warnings
    • -
    • EGL DRI2: Silence 'missing initializer' warnings
    • -
    • egl_glx: Silence piles of 'unused variable' warnings
    • -
    • egl: Fix several 'comparison between signed and unsigned integer' warnings
    • -
    • dri: Ensure that DRI driver cpp files are in tarballs
    • -
    • mesa: Force GL_ARB_copy_buffer to always be enabled
    • -
    • mesa: Force GL_SGIS_generate_mipmap to always be enabled
    • -
    • Remove GL_MESA_packed_depth_stencil
    • -
    • Remove GL_EXT_cull_vertex
    • -
    • Regenerate files changed by previous commit
    • -
    • Remove unnescessary initializations of UpdateTexturePalette
    • -
    • ARB_texture_rg: Add GLX protocol support
    • -
    • ARB_texture_rg: Correct some errors in RED / RG internal format handling
    • -
    • ARB_texture_rg: Add GL_TEXTURE_{RED,GREEN}_SIZE query support
    • -
    • ARB_texture_rg: Add GL_RED as a valid GL_DEPTH_TEXTURE_MODE
    • -
    • ARB_texture_rg: Handle RED and RG the same as RGB for tex env
    • -
    • ARB_texture_rg: Add R8, R16, RG88, and RG1616 internal formats
    • -
    • ARB_texture_rg: Allow RED and RG textures as FBO color buffer attachments
    • -
    • mesa: Enable GL_ARB_texture_rg in software paths
    • -
    • i965: Enable GL_ARB_texture_rg
    • -
    • mesa: Add ARB_texture_compression_rgtc as an alias for EXT_texture_compression_rgtc
    • -
    • ARB_texture_rg: Add GL_COMPRESSED_{RED,RG} cases in _mesa_is_color_format
    • -
    • mesa: Fix misplaced #endif
    • -
    • mesa: Trivial correction to comment
    • -
    • rgtc: Detect RGTC formats as color formats and as compressed formats
    • -
    • docs: Add list of bugs fixed in 7.9
    • -
    • docs: Import 7.9 release notes from 7.9 branch.
    • -
    • docs: Import 7.8.x release notes from 7.8 branch.
    • -
    • docs: download.html does not need to be updated for each release
    • -
    • docs: Update mailing lines from sf.net to freedesktop.org
    • -
    • docs: Import news updates from 7.9 branch
    • -
    • docs: added news item for 7.9 release
    • -
    • glsl: Fail linking if assign_attribute_locations fails
    • -
    • glsl: Refactor 'layout' grammar to match GLSL 1.60 spec grammar
    • -
    • glsl: Slight refactor of error / warning checking for ARB_fcc layout
    • -
    • glsl: Clear type_qualifier using memset
    • -
    • glsl: Wrap ast_type_qualifier contents in a struct in a union
    • -
    • glsl: Regenerate files modified by previous commits
    • -
    • glcpp: Add the define for ARB_explicit_attrib_location when present
    • -
    • glcpp: Regenerate files changes by previous commit
    • -
    • glsl: Add parser support for GL_ARB_explicit_attrib_location layouts
    • -
    • glsl: Regenerate files changes by previous commit
    • -
    • glsl: Track explicit location in AST to IR translation
    • -
    • glsl: Add linker support for explicit attribute locations
    • -
    • main: Enable GL_ARB_explicit_attrib_location for swrast
    • -
    • intel: Enable GL_ARB_explicit_attrib_location
    • -
    • glsl: Remove const decoration from inlined function parameters
    • -
    • docs: skeleton for 7.10 release notes
    • -
    • docs: Update status of GL 3.x related extensions
    • -
    • mesa: Validate assembly shaders when GLSL shaders are used
    • -
    • glsl: Fix incorrect assertion
    • -
    • linker: Reject shaders that have unresolved function calls
    • -
    • mesa: Silence unused variable warning
    • -
    • mesa: Refactor validation of shader targets
    • -
    • mesa: Clean up two 'comparison between signed and unsigned' warnings
    • -
    • mesa: Clean up various 'unused parameter' warnings in shaderapi
    • -
    • glsl: Slightly change the semantic of _LinkedShaders
    • -
    • linker: Trivial indention fix
    • -
    • i965: Fix indentation after commit 3322fbaf
    • -
    • linker: Improve handling of unread/unwritten shader inputs/outputs
    • -
    • glapi: Add GL_EXT_separate_shader_objects
    • -
    • glapi: Commit files changed by previous commit
    • -
    • mesa: Add infrastructure to track GL_EXT_separate_shader_objects
    • -
    • mesa: Skeletal support for GL_EXT_separate_shader_objects
    • -
    • mesa: Add display list support for GL_EXT_separate_shader_objects functions
    • -
    • mesa: Track an ActiveProgram distinct from CurrentProgram
    • -
    • Track separate programs for each stage
    • -
    • swrast: Enable GL_EXT_separate_shader_objects in software paths
    • -
    • intel: Enable GL_EXT_separate_shader_objects in Intel drivers
    • -
    • docs: add GL_EXT_separate_shader_objects to release notes
    • -
    • glsl: Fix incorrect gl_type of sampler2DArray and sampler1DArrayShadow
    • -
    • ir_to_mesa: Refactor code for emitting DP instructions
    • -
    • mesa: Allow query of MAX_SAMPLES with EXT_framebuffer_multisample
    • -
    • glsl: Refactor is_vec_{zero,one} to be methods of ir_constant
    • -
    • glsl: Simplify generation of swizzle for vector constructors
    • -
    • glsl: Make is_zero and is_one virtual methods of ir_rvalue
    • -
    • ir_to_mesa: Generate smarter code for some conditional moves
    • -
    • glsl: Add ir_unop_sin_reduced and ir_unop_cos_reduced
    • -
    • glsl: Eliminate assumptions about size of ir_expression::operands
    • -
    • glsl: Add ir_rvalue::is_negative_one predicate
    • -
    • glsl: Add unary ir_expression constructor
    • -
    • glsl: Add ir_quadop_vector expression
    • -
    • glsl: Fix matrix constructors with vector parameters
    • -
    • i915: Disallow alpha, red, RG, and sRGB as render targets
    • -
    • glsl: Use M_LOG2E constant instead of calling log2
    • -
    • glsl: Lower ir_binop_pow to a sequence of EXP2 and LOG2
    • -
    • i915: Request that POW instructions be lowered
    • -
    • i915: Correctly generate unconditional KIL instructions
    • -
    • glsl: Ensure that equality comparisons don't return a NULL IR tree
    • -
    • i965: Correctly emit constants for aggregate types (array, matrix, struct)
    • -
    • glsl: Inherrit type of declared variable from initializer
    • -
    • linker: Ensure that unsized arrays have a size after linking
    • -
    • linker: Fix regressions caused by previous commit
    • -
    • glsl: Inherrit type of declared variable from initializer after processing assignment
    • -
    • linker: Allow built-in arrays to have different sizes between shader stages
    • -
    • ir_to_mesa: Don't generate swizzles for record derefs of non-scalar/vectors
    • -
    • Refresh autogenerated file builtin_function.cpp.
    • -
    • glsl: Allow less restrictive uses of sampler array indexing in GLSL <= 1.20
    • -
    • docs: Import 7.9.1 release notes from 7.9 branch
    • -

    - -

    Jakob Bornecrantz (27): -

      -
    • rbug: Cast opcode to corrent int size
    • -
    • rbug: Add function to get opcode name string
    • -
    • scons: Link against talloc in the Gallium DRI drivers
    • -
    • i915g: Link with wrapper sw winsys with scons
    • -
    • tgsi: Actually care what check_soa_dependencies says
    • -
    • tgsi: Fix missing test before check
    • -
    • llvmpipe: Move makefile include to before targets
    • -
    • wrapper: Fix spelling
    • -
    • wrapper: Add a way to dewrap a pipe screen without destroying it
    • -
    • egl: Remove unnecessary headers
    • -
    • target-helpers: Remove per target software wrapper check
    • -
    • graw: Tidy graw xlib scons file a bit
    • -
    • scons: Remove old pipebuffer SConscript
    • -
    • scons: Detabify
    • -
    • scons: Check for pkg-config before trying to use it
    • -
    • scons: Check for libdrm_[intel|radeon] as well
    • -
    • scons: Move dependancy checks to the main gallium scons file
    • -
    • scons: Unify state tracker SConscripts
    • -
    • galahad: Correct the name of the scons library
    • -
    • graw: Use inline sw helper instead of roll your own loader
    • -
    • libgl-xlib: Use sw helper instead of roll your own
    • -
    • libgl-xlib: Use inline debug helper instead of non-inline version
    • -
    • graw: Use inline debug helper instead of non-inline version
    • -
    • gallium: Remove redundant sw and debug target helpers
    • -
    • i915g: Improve debug printing for textures
    • -
    • i915g: Make sure that new vbo gets updated
    • -
    • st/mesa: Unbind all constant buffers
    • -

    - -

    Jerome Glisse (75): -

      -
    • r600g: alternative command stream building from context
    • -
    • r600g: move chip class to radeon common structure
    • -
    • r600g: use pipe context for flushing inside map
    • -
    • r600g: add back reference check when mapping buffer
    • -
    • r600g: directly allocate bo for user buffer
    • -
    • r600g: fix multi buffer rendering
    • -
    • r600g: occlusion query for new design
    • -
    • r600g: flush color buffer after draw command
    • -
    • r600g: disable shader rebuild optimization & account cb flush packet
    • -
    • r600g: fix multiple occlusion query on same id
    • -
    • r600g: initial evergreen support in new path
    • -
    • r600g: fix typo in evergreen define (resource are in x range)
    • -
    • r600g: move use_mem_constants flags for new designs structure alignment
    • -
    • r600g: evergreen fix for new design
    • -
    • r600g: fix compilation after change to evergreend.h
    • -
    • r600g: fixup some evergreen register definitions
    • -
    • r600g: fix evergreen new path
    • -
    • r600g: fix reg definition
    • -
    • r600g: fix evergreen new path
    • -
    • r600g: bring over fix from old path to new path
    • -
    • r600g: fix vertex resource & polygon offset
    • -
    • r600g: disable early cull optimization when occlusion query running
    • -
    • r600g: move around variables to share depth uncompression code
    • -
    • r600g: use depth decompression in new path
    • -
    • r600g: fix index buffer drawing
    • -
    • r600g: build packet header once
    • -
    • r600g: fix pointsprite & resource unbinding
    • -
    • r600g: fix routing btw vertex & pixel shader
    • -
    • r600g: fix occlusion query after change to block structure
    • -
    • r600g: use ptr for blit depth uncompress function
    • -
    • r600g: fix remaining piglit issue in new design
    • -
    • r600g: switch to new design
    • -
    • r600g: suspend/resume occlusion query around clear/copy
    • -
    • r600g: avoid rebuilding the vertex shader if no change to input format
    • -
    • r600g: use a hash table instead of group
    • -
    • r600g: delete old path
    • -
    • r600g: cleanup
    • -
    • r600g: more cleanup
    • -
    • r600g: use constant buffer instead of register for constant
    • -
    • r600g: fix constant & literal src splitting, also fix mplayer gl2 shader
    • -
    • evergreeng: avoid overlapping border color btw VS & PS
    • -
    • r600g: indentation fixes
    • -
    • r600g: rename radeon_ws_bo to r600_bo
    • -
    • r600g: allow r600_bo to be a sub allocation of a big bo
    • -
    • r600g: use r600_bo for relocation argument, simplify code
    • -
    • r600g: rename radeon_ws_bo to r600_bo
    • -
    • r600g: remove dead label & fix indentation
    • -
    • r600g: store reloc information in bo structure
    • -
    • r600g: improve bo flushing
    • -
    • r600g: simplify block relocation
    • -
    • r600g: userspace fence to avoid kernel call for testing bo busy status
    • -
    • r600g: avoid segfault due to unintialized list pointer
    • -
    • r600g: fix dirty state handling
    • -
    • r600g: allow driver to work without submitting cmd to GPU
    • -
    • gallium/noop: no operation gallium driver
    • -
    • r600g: code cleanup (indent, trailing space, empty line ...)
    • -
    • r600g: fix occlusion query on evergreen (avoid lockup)
    • -
    • r600g: add fetch shader capabilities
    • -
    • r600g: dump raw shader output for debugging
    • -
    • r600g: update polygon offset only when rasterizer or zbuffer change
    • -
    • r600g: indentation fix
    • -
    • r600g: more indentation fix + warning silencing + dead code removal
    • -
    • r600g: build fetch shader from vertex elements
    • -
    • r600g: avoid useless shader rebuild at draw call
    • -
    • r600g: remove useless flush map
    • -
    • r600g: remove dead code
    • -
    • r600g: fix userspace fence against lastest kernel
    • -
    • r600g: avoid using pb* helper we are loosing previous cpu cycle with it
    • -
    • r600g: specialized upload manager
    • -
    • r600g: indentation cleanup
    • -
    • r600g: fix bo size when creating bo from handle
    • -
    • r600g: fix segfault when translating vertex buffer
    • -
    • r600g: need to reference upload buffer as the might still live accross flush
    • -
    • r600g: properly unset vertex buffer
    • -
    • r600g: avoid segfault
    • -

    - -

    Joakim Sindholt (3): -

      -
    • util/u_blitter: fix leak
    • -
    • radeong: fix leaks
    • -
    • r300g: silence guard band cap errors
    • -

    - -

    Johann Rudloff (3): -

      -
    • radeon: Implement EGL_MESA_no_surface_extension
    • -
    • radeon: Implement __DRI_IMAGE and EGL_MESA_image_drm
    • -
    • radeon: Implement GL_OES_EGL_image
    • -

    - -

    John Doe (3): -

      -
    • r600g: misc cleanup
    • -
    • r600g: don't double count dirty block
    • -
    • r600g: keep a mapping around for each bo
    • -

    - -

    Jon TURNEY (1): -

      -
    • Ensure -L$(TOP)/$(LIB_DIR) appears in link line before any -L in $LDFLAGS
    • -

    - -

    José Fonseca (128): -

      -
    • gallivm: Fix address register swizzle.
    • -
    • gallivm: Start collecting bitwise arithmetic helpers in a new module.
    • -
    • gallivm: Clamp indirect register indices to file_max.
    • -
    • util: linearized sRGB values don't fit into 8bits
    • -
    • llvmpipe: Default to no threading on single processor systems.
    • -
    • tgsi: Don't ignore indirect registers in tgsi_check_soa_dependencies
    • -
    • llvmpipe: Describe how to profile llvmpipe.
    • -
    • llvmpipe: When failing free fs shader too.
    • -
    • util: Flush stdout on util_format.
    • -
    • gallivm: Add unorm support to lp_build_lerp()
    • -
    • llvmpipe: Special case complementary and identify blend factors in SoA.
    • -
    • llvmpipe: Make rgb/alpha bland func/factors match, when there is no alpha.
    • -
    • draw: Prevent clipped vertices overflow.
    • -
    • draw: Fullfil the new min_lod/max_lod/lod_bias/border_color dynamic state
    • -
    • gallivm: Fetch the lod from the dynamic state when min_lod == max_lod.
    • -
    • gallivm: Remove dead experimental code.
    • -
    • llvmpipe: Decouple sampler view and sampler state updates.
    • -
    • scons: New build= option, with support for checked builds.
    • -
    • scons: New build= option, with support for checked builds.
    • -
    • trace: Fix set_index_buffer and draw_vbo tracing.
    • -
    • python/retrace: Handle set_index_buffer and draw_vbo.
    • -
    • gallivm: Use SSE4.1's ROUNDSS/ROUNDSD for scalar rounding.
    • -
    • gallivm: More comprehensive border usage logic.
    • -
    • retrace: Handle clear_render_target and clear_depth_stencil.
    • -
    • llvmpipe: Dump a few missing shader key flags.
    • -
    • llvmpipe: Fix perspective interpolation for point sprites.
    • -
    • llvmpipe: Fix sprite coord perspective interpolation of Q.
    • -
    • gallivm: Take the type signedness in consideration in round/ceil/floor.
    • -
    • gallivm: Use a faster (and less accurate) log2 in lod computation.
    • -
    • gallivm: Fast implementation of iround(log2(x))
    • -
    • gallivm: Combined ifloor & fract helper.
    • -
    • gallivm: Only apply min/max_lod when necessary.
    • -
    • gallivm: Compute lod as integer whenever possible.
    • -
    • util: Cleanup util_pack_z_stencil and friends.
    • -
    • llvmpipe: Cleanup depth-stencil clears.
    • -
    • gallivm: Vectorize the rho computation.
    • -
    • gallivm: Do not do mipfiltering when magnifying.
    • -
    • gallivm: Simplify lp_build_mipmap_level_sizes' interface.
    • -
    • gallivm: Don't compute the second mipmap level when frac(lod) == 0
    • -
    • gallivm: Use lp_build_ifloor_fract for lod computation.
    • -
    • gallivm: Clamp mipmap level and zero mip weight simultaneously.
    • -
    • gallivm: Fix copy'n'paste typo in previous commit.
    • -
    • gallivm: Implement brilinear filtering.
    • -
    • gallivm: Use the wrappers for SSE pack intrinsics.
    • -
    • gallivm: Avoid control flow for two-sided stencil test.
    • -
    • gallivm: Warn when doing inefficient integer comparisons.
    • -
    • gallivm: Move into the as much of the second level code as possible.
    • -
    • llvmpipe: First minify the texture size, then broadcast.
    • -
    • gallivm: Help for combined extraction and broadcasting.
    • -
    • gallivm: Do size computations simultanously for all dimensions (AoS).
    • -
    • llvmpipe: Prevent z > 1.0
    • -
    • llvmpipe: Fix MSVC build. Enable the new SSE2 code on non SSE3 systems.
    • -
    • gallivm: Handle code have ret correctly.
    • -
    • util: Defined M_SQRT2 when not available.
    • -
    • gallivm: Less code duplication in log computation.
    • -
    • gallivm: Special bri-linear computation path for unmodified rho.
    • -
    • gallivm: Don't generate Phis for execution mask.
    • -
    • gallivm: Use varilables instead of Phis for cubemap selection.
    • -
    • gallivm: Remove support for Phi generation.
    • -
    • gallivm: Factor out the SI->FP texture size conversion for SoA path too
    • -
    • gallivm: Simplify if/then/else implementation.
    • -
    • gallivm: Cleanup the rest of the flow module.
    • -
    • gallivm: Fix a long standing bug with nested if-then-else emission.
    • -
    • gallivm: Allow to disable bri-linear filtering with GALLIVM_DEBUG=no_brilinear runtime option
    • -
    • gallivm: Use variables instead of Phis in loops.
    • -
    • gallivm: Pass texture coords derivates as scalars.
    • -
    • llvmpipe: Remove outdated comment about stencil testing.
    • -
    • gallivm: Eliminate unsigned integer arithmetic from texture coordinates.
    • -
    • gallium: Define C99 restrict keyword where absent.
    • -
    • tgsi: Export some names for some tgsi enums.
    • -
    • gallivm: More detailed analysis of tgsi shaders.
    • -
    • llvmpipe: Use lp_tgsi_info.
    • -
    • llvmpipe: Do not dispose the execution engine.
    • -
    • llvmpipe: Fix MSVC build.
    • -
    • llmvpipe: improve mm_mullo_epi32
    • -
    • gallivm: Name anonymous union.
    • -
    • llvmpipe: Unbreak Z32_FLOAT.
    • -
    • gallivm: More accurate float -> 24bit & 32bit unorm conversion.
    • -
    • llvmpipe: Generalize the x8z24 fast path to all depth formats.
    • -
    • llvmpipe: Fix depth-stencil regression.
    • -
    • llvmpipe: Ensure z_shift and z_width is initialized.
    • -
    • gallivm: Fix SoA cubemap derivative computation.
    • -
    • llvmpipe: Fix bad refactoring.
    • -
    • llvmpipe: Initialize bld ctx via lp_build_context_init instead of ad-hoc and broken code.
    • -
    • gallivm: Comment lp_build_insert_new_block().
    • -
    • gallivm: Add a note about SSE4.1's nearest mode rounding.
    • -
    • llvmpipe: Don't test rounding of x.5 numbers.
    • -
    • gallium: Avoid using __doc__ in python scripts.
    • -
    • gallivm: always enable LLVMAddInstructionCombiningPass()
    • -
    • gallivm: Remove the EMMS opcodes.
    • -
    • mesa: Fix windows build (uint -> GLuint).
    • -
    • scons: Revamp how to specify targets to build.
    • -
    • scons: Fix MinGW cross-compilation.
    • -
    • scons: Some pipe drivers are not portable for MSVC
    • -
    • scons: Restore x11 tool behavior for backwards compatability.
    • -
    • scons: Disable python state tracker when swig is not present.
    • -
    • r600g: List recently added files in SConscript.
    • -
    • scons: Add aliases for several pipe drivers.
    • -
    • scons: i915 can't build on MSVC either.
    • -
    • scons: Propagate installation targets.
    • -
    • xorg/vmwgfx: Add missing source file to SConscript.
    • -
    • st/xorg: Add missing n to error message.
    • -
    • st/xorg: Detect libkms with scons too.
    • -
    • xorg/vmwgfx: Link libkms when available.
    • -
    • r600g: Swap the util_blitter_destroy call order.
    • -
    • gallivm: Allocate TEMP/OUT arrays only once.
    • -
    • libgl-gdi: Allow to pick softpipe/llvmpipe on runtime.
    • -
    • scons: Use inline wrap helpers more consistently.
    • -
    • svga: Use consistent hexadecimal representation on debug output.
    • -
    • scons: Alias for svga
    • -
    • wgl: Stub WGL_ARB_pbuffer support.
    • -
    • wgl: More complete WGL_ARB_pbuffer support.
    • -
    • svga: Silence debug printf.
    • -
    • scons: Move MSVS_VERSION option to common module.
    • -
    • vega: Remove extraneous ;
    • -
    • retrace: Some fixes.
    • -
    • util: C++ safe.
    • -
    • wgl: Fix double free. Remove dead code.
    • -
    • util: Plug leaks in util_destroy_gen_mipmap.
    • -
    • util: __builtin_frame_address() doesn't work on mingw.
    • -
    • util: Don't try to use imagehlp on mingw.
    • -
    • wgl: Unreference the current framebuffer after the make_current call.
    • -
    • WIN32_THREADS -> WIN32
    • -
    • mapi: Hack to avoid vgCreateFont being generated as vgCreateFontA.
    • -
    • wgl: Fix visual's buffer_mask configuration.
    • -
    • mesa: Temporary hack to prevent stack overflow on windows
    • -
    • mesa: Bump the number of bits in the register index.
    • -
    • llvmpipe: Plug fence leaks.
    • -

    - -

    Julien Cristau (1): -

      -
    • Makefile: don't include the same files twice in the tarball
    • -

    - -

    Keith Whitwell (89): -

      -
    • llvmpipe: brackets around macro arg
    • -
    • llvmpipe: remove duplicate code
    • -
    • llvmpipe: return zero from floor_pot(zero)
    • -
    • gallivm: make lp_build_sample_nop public
    • -
    • llvmpipe: add LP_PERF flag to disable various aspects of rasterization
    • -
    • llvmpipe: add DEBUG_FS to dump variant information
    • -
    • llvmpipe: use llvm for attribute interpolant calculation
    • -
    • graw: add frag-face shader
    • -
    • llvmpipe: fix flatshading in new line code
    • -
    • draw: don't apply flatshading to clipped tris with <3 verts
    • -
    • llvmpipe: handle FACING interpolants in line and point setup
    • -
    • llvmpipe: handle up to 8 planes in triangle binner
    • -
    • llvmpipe: make debug_fs_variant respect variant->nr_samplers
    • -
    • gallivm: don't apply zero lod_bias
    • -
    • llvmpipe: fail gracefully on oom in scene creation
    • -
    • llvmpipe: avoid overflow in triangle culling
    • -
    • gallivm: special case conversion 4x4f to 1x16ub
    • -
    • gallivm: round rather than truncate in new 4x4f->1x16ub conversion path
    • -
    • llvmpipe: clean up setup_tri a little
    • -
    • llvmpipe: add rast_tri_4_16 for small lines and points
    • -
    • llvmpipe: fix off-by-one in tri_16
    • -
    • llvmpipe: defer attribute interpolation until after mask and ztest
    • -
    • llvmpipe: use alloca for fs color outputs
    • -
    • llvmpipe: store zero into all alloca'd values
    • -
    • llvmpipe: dump fragment shader ir and asm when LP_DEBUG=fs
    • -
    • gallivm: specialized x8z24 depthtest path
    • -
    • gallivm: prefer blendvb for integer arguments
    • -
    • gallivm: simpler uint8->float conversions
    • -
    • llvmpipe: try to be sensible about whether to branch after mask updates
    • -
    • llvmpipe: clean up shader pre/postamble, try to catch more early-z
    • -
    • llvmpipe: simplified SSE2 swz/unswz routines
    • -
    • llvmpipe: try to do more of rast_tri_3_16 with intrinsics
    • -
    • llvmpipe: add debug helpers for epi32 etc
    • -
    • llvmpipe: try to keep plane c values small
    • -
    • llvmpipe: fix typo in last commit
    • -
    • gallium: move sse intrinsics debug helpers to u_sse.h
    • -
    • r600g: add missing file to sconscript
    • -
    • gallivm: don't branch on KILLs near end of shader
    • -
    • Revert "llvmpipe: try to keep plane c values small"
    • -
    • llvmpipe: make sure intrinsics code is guarded with PIPE_ARCH_SSE
    • -
    • llvmpipe: don't try to emit non-existent color outputs
    • -
    • r600/drm: fix segfaults in winsys create failure path
    • -
    • r600g: emit hardware linewidth
    • -
    • r600g: handle absolute modifier in shader translator
    • -
    • llvmpipe: reintroduce SET_STATE binner command
    • -
    • llvmpipe: don't pass frontfacing as a float
    • -
    • llvmpipe: slightly shrink the size of a binned triangle
    • -
    • llvmpipe: don't store plane.ei value in binned data
    • -
    • gallium: move some intrinsics helpers to u_sse.h
    • -
    • llvmpipe: do plane calculations with intrinsics
    • -
    • llvmpipe: use aligned loads/stores for plane values
    • -
    • llvmpipe: fix non-sse build after recent changes
    • -
    • llvmpipe: check shader outputs are non-null before using
    • -
    • llvmpipe: validate color outputs against key->nr_cbufs
    • -
    • llvmpipe: clean up fields in draw_llvm_variant_key
    • -
    • llvmpipe: remove setup fallback path
    • -
    • llvmpipe: fail cleanly on malloc failure in lp_setup_alloc_triangle
    • -
    • Merge remote branch 'origin/master' into lp-setup-llvm
    • -
    • llvmpipe: remove unused file
    • -
    • llvmpipe: remove unused arg from jit_setup_tri function
    • -
    • Merge branch 'llvm-cliptest-viewport'
    • -
    • draw: make sure viewport gets updated in draw llvm shader
    • -
    • llvmpipe: turn off draw offset/twoside when we can handle it
    • -
    • llvmpipe: avoid generating tri_16 for tris which extend past tile bounds
    • -
    • llvmpipe: guard against NULL task->query pointer
    • -
    • st/mesa: unbind constant buffer when not in use
    • -
    • r600g: propagate usage flags in texture transfers
    • -
    • r600g: propogate resource usage flags to winsys, use to choose bo domains
    • -
    • r600g: use a buffer in GTT as intermediate on texture up and downloads
    • -
    • r600g: remove unused flink, domain fields from r600_resource
    • -
    • r600g: set hardware pixel centers according to gl_rasterization_rules
    • -
    • evergreeng: protect against null constant buffers
    • -
    • r600g: don't call debug_get_bool_option for tiling more than once
    • -
    • evergreeng: respect linewidth state, use integer widths only
    • -
    • evergreeng: set hardware pixelcenters according to gl_rasterization_rules
    • -
    • r600g: avoid recursion with staged uploads
    • -
    • r600g: attempt to turn on DXTn formats
    • -
    • r600g: translate ARR instruction
    • -
    • r600: fix my pessimism about PIPE_TRANSFER_x flags
    • -
    • ws/r600: match bo_busy shared/fence logic in bo_wait
    • -
    • r600g: guard experimental s3tc code with R600_ENABLE_S3TC
    • -
    • r600g: do not try to use staging resource for depth textures
    • -
    • r600g: enforce minimum stride on render target texture images
    • -
    • llvmpipe: fix up twoside after recent changes
    • -
    • llvmpipe: twoside for specular color also
    • -
    • Merge branch 'lp-offset-twoside'
    • -
    • llvmpipe: raise dirty flag on transfers to bound constbuf
    • -
    • llvmpipe: remove misleading debug string
    • -
    • llvmpipe: shortcircuit some calls to set_scene_state
    • -

    - -

    Kenneth Graunke (94): -

      -
    • glsl: Change from has_builtin_signature to has_user_signature.
    • -
    • glsl: Don't print blank (function ...) headers for built-ins.
    • -
    • glsl: Properly handle nested structure types.
    • -
    • glsl/builtins: Fix equal and notEqual builtins.
    • -
    • glsl/builtins: Switch comparison functions to just return an expression.
    • -
    • glsl: Add comments to clarify the types of comparison binops.
    • -
    • glsl: Fix broken handling of ir_binop_equal and ir_binop_nequal.
    • -
    • glsl: "Copyright", not "Constantright"
    • -
    • i965: Fix incorrect batchbuffer size in gen6 clip state command.
    • -
    • i965: Use logical-not when emitting ir_unop_ceil.
    • -
    • glsl: Add front-end support for the "trunc" built-in.
    • -
    • glsl: Refresh autogenerated file builtin_function.cpp.
    • -
    • i965: Use RNDZ for ir_unop_trunc in the new FS.
    • -
    • i965: Correctly emit the RNDZ instruction.
    • -
    • i965: Clean up a warning in the old fragment backend.
    • -
    • glsl: Add a new ir_unop_round_even opcode for GLSL 1.30's roundEven.
    • -
    • glsl: Add front-end support for GLSL 1.30's roundEven built-in.
    • -
    • i965: Add support for ir_unop_round_even via the RNDE instruction.
    • -
    • glsl: Add support for the 1.30 round() built-in.
    • -
    • glsl: Refresh autogenerated file builtin_function.cpp.
    • -
    • glsl: Don't return NULL IR for erroneous bit-shift operators.
    • -
    • i965: Add missing "break" statement.
    • -
    • glsl: Fix copy and paste error in ast_bit_and node creation.
    • -
    • glsl: Regenerate parser files.
    • -
    • i965: Remove unused variable.
    • -
    • glsl: Remove useless ir_shader enumeration value.
    • -
    • mesa: Remove FEATURE_ARB_shading_language_120 macro.
    • -
    • glcpp: Return NEWLINE token for newlines inside multi-line comments.
    • -
    • glcpp: Refresh autogenerated lexer file.
    • -
    • glsl: Add support for GLSL 1.30's modf built-in.
    • -
    • glsl: Refresh autogenerated file builtin_function.cpp.
    • -
    • generate_builtins.py: Output large strings as arrays of characters.
    • -
    • Refresh autogenerated file builtin_function.cpp.
    • -
    • glsl: Fix constant component count in vector constructor emitting.
    • -
    • Fix build on systems where "python" is python 3.
    • -
    • i965: Add bit operation support to the fragment shader backend.
    • -
    • glsl: Remove unused ARRAY_SIZE macro.
    • -
    • glsl/builtins: Rename 'x' to 'y_over_x' in atan(float) implementation.
    • -
    • glsl/builtins: Clean up some ugly autogenerated code in atan.
    • -
    • Refresh autogenerated file builtin_function.cpp.
    • -
    • glsl: Don't print a useless space at the end of an S-Expression list.
    • -
    • ir_reader: Return a specific ir_dereference variant.
    • -
    • ir_reader: Remove useless error check.
    • -
    • ir_reader: Fix some potential NULL pointer dereferences.
    • -
    • ir_dead_functions: Actually free dead functions and signatures.
    • -
    • glsl: Remove unnecessary "unused variable" warning suppression.
    • -
    • glsl: Remove GLSL_TYPE_FUNCTION define.
    • -
    • glsl: Convert glsl_type::base_type from #define'd constants to an enum.
    • -
    • glsl: Rework reserved word/keyword handling in the lexer.
    • -
    • glsl: Add new keywords and reserved words for GLSL 1.30.
    • -
    • glsl: Add support for the 'u' and 'U' unsigned integer suffixes.
    • -
    • glsl: Refresh autogenerated lexer and parser files.
    • -
    • generate_builtins.py: Fix inconsistent use of tabs and spaces warning.
    • -
    • glsl: Implement the asinh, acosh, and atanh built-in functions.
    • -
    • glsl: Refresh autogenerated file builtin_function.cpp.
    • -
    • glsl: Add constant expression handling for asinh, acosh, and atanh.
    • -
    • glsl: Remove unused and out of date Makefile.am.
    • -
    • glsl: Rename various ir_* files to lower_* and opt_*.
    • -
    • glcpp: Define GL_FRAGMENT_PRECISION_HIGH if GLSL version >= 1.30.
    • -
    • Refresh autogenerated glcpp parser.
    • -
    • glsl: Fix constant expression handling for <, >, <=, >= on vectors.
    • -
    • glsl: Unconditionally define GL_FRAGMENT_PRECISION_HIGH in ES2 shaders.
    • -
    • Regenerate glcpp parser.
    • -
    • glsl: Reimplement the "cross" built-in without ir_binop_cross.
    • -
    • Refresh autogenerated file builtin_function.cpp.
    • -
    • glsl: Remove the ir_binop_cross opcode.
    • -
    • glsl: Refactor get_num_operands.
    • -
    • glsl: Simplify a type check by using type->is_integer().
    • -
    • glsl: Combine many instruction lowering passes into one.
    • -
    • mesa: Fix glGet of ES2's GL_MAX_*_VECTORS properties.
    • -
    • glsl: Don't inline function prototypes.
    • -
    • glsl: Use do_common_optimization in the standalone compiler.
    • -
    • glsl: Add a virtual as_discard() method.
    • -
    • glsl: Refactor out cloning of function prototypes.
    • -
    • glsl: Lazily import built-in function prototypes.
    • -
    • glsl: Remove anti-built-in hacks from the print visitor.
    • -
    • glsl/linker: Free any IR discarded by optimization passes.
    • -
    • glsl: Add an optimization pass to simplify discards.
    • -
    • glsl: Add a lowering pass to move discards out of if-statements.
    • -
    • glsl: Remove "discard" support from lower_jumps.
    • -
    • glsl: Add comments to lower_jumps (from the commit message).
    • -
    • ir_print_visitor: Print out constant structure values.
    • -
    • glsl: Factor out code which emits a new function into the IR stream.
    • -
    • symbol_table: Add support for adding a symbol at top-level/global scope.
    • -
    • glsl: Properly add functions during lazy built-in prototype importing.
    • -
    • glcpp: Don't emit SPACE tokens in conditional_tokens production.
    • -
    • Refresh autogenerated glcpp parser.
    • -
    • glsl: Clean up code by adding a new is_break() function.
    • -
    • glsl: Consider the "else" branch when looking for loop breaks.
    • -
    • Remove OES_compressed_paletted_texture from the ES2 extension list.
    • -
    • glsl/builtins: Compute the correct value for smoothstep(vec, vec, vec).
    • -
    • glsl: Support if-flattening beyond a given maximum nesting depth.
    • -
    • i965: Flatten if-statements beyond depth 16 on pre-gen6.
    • -
    • i965: Internally enable GL_NV_blend_square on ES2.
    • -

    - -

    Kristian Høgsberg (16): -

      -
    • glx: Hold on to drawables if we're just switching to another context
    • -
    • intel: Fix GL_ARB_shading_language_120 commit
    • -
    • dri2: Make createImageFromName() take a __DRIscreen instead of __DRIcontext
    • -
    • glx: Invalidate buffers after binding a drawable
    • -
    • dri: Pass the __DRIscreen and the __DRIscreen private back to image lookup
    • -
    • glx: Only remove drawables from the hash when we actually delete them
    • -
    • gles2: Add GL_EXT_texture_format_BGRA8888 support
    • -
    • Get rid of GL/internal/glcore.h
    • -
    • gl: Remove unused GLcontextModes fields
    • -
    • Rename GLvisual and __GLcontextModes to struct gl_config
    • -
    • Drop GLframebuffer typedef and just use struct gl_framebuffer
    • -
    • Drop GLcontext typedef and use struct gl_context instead
    • -
    • Drop the "neutral" tnl module
    • -
    • Only install vtxfmt tables for OpenGL
    • -
    • i965: Don't write mrf assignment for pointsize output
    • -
    • docs: Fix MESA_drm_image typo
    • -

    - -

    Krzysztof Smiechowicz (1): -

      -
    • nvfx: Pair os_malloc_aligned() with os_free_aligned().
    • -

    - -

    Luca Barbieri (84): -

      -
    • auxiliary: fix unintended fallthrough
    • -
    • glsl: add pass to lower variable array indexing to conditional assignments
    • -
    • auxiliary: fix depth-only and stencil-only clears
    • -
    • gallium: avoid the C++ keyword "template" in sw_winsys.h
    • -
    • softpipe: make z/s test always pass if no zsbuf, instead of crashing
    • -
    • tgsi: add switch/case opcodes to tgsi_opcode_tmp.h
    • -
    • softpipe: fix whitespace
    • -
    • d3d1x: add new Direct3D 10/11 COM state tracker for Gallium
    • -
    • d3d1x: add blob and signature extraction APIs
    • -
    • d3d1x: fix compilation with recent Wine versions installed
    • -
    • d3d1x: add missing file
    • -
    • d3d1x: actually enable and fix blob apis
    • -
    • d3d1x: fix build with compilers other than GCC 4.5
    • -
    • d3d1x: add template parameters to base class ctor calls for GCC 4.4
    • -
    • d3d1x: fix GCC 4.1/4.2 build
    • -
    • d3d1x: ignore errors while building docs
    • -
    • d3d1x: attempt to fix/workaround bug #30322
    • -
    • nvfx: remove gl_PointCoord hack
    • -
    • glx: decouple dri2.c and GLX, fixing Gallium EGL and d3d1x build
    • -
    • winsys: automatically build sw winsys needed by EGL and d3d1x
    • -
    • d3d1x: don't build progs automatically
    • -
    • d3d1x: add missing memory barrier
    • -
    • d3d1x: link with CXXFLAGS
    • -
    • d3d1x: fix cf analysis
    • -
    • d3d1x: fix warning
    • -
    • d3d1x: fix segfault when hashing
    • -
    • d3d1x: destroy native_display on adapter destruction
    • -
    • d3d1x: fix GUID declarations
    • -
    • d3d1x: redesign the HWND resolver interface
    • -
    • d3d1x: fix API name
    • -
    • d3d1x: define GUIDs in the normal way
    • -
    • d3d1x: add Wine dlls (tri, tex working, but no other testing)
    • -
    • d3d1x: properly reference count the backend
    • -
    • d3d1x: fix deadlocks on non-recursive mutex
    • -
    • d3d1x: bind NULL CSOs before destroying default CSOs on context dtor
    • -
    • d3d1x: initialize the mutex
    • -
    • d3d1x: autogenerate shader enums and text from def files
    • -
    • d3d1x: s/tpf/sm4/g
    • -
    • d3d1x: normalize whitespace
    • -
    • d3d1x: remove specstrings
    • -
    • d3d1x: minifix
    • -
    • d3d1x: rename context params
    • -
    • d3d11: rename screen params
    • -
    • d3d1x: rename params in misc and objects
    • -
    • d3d1x: rename parameters in dxgi
    • -
    • d3d11: obliterate IDL parameter names
    • -
    • d3d1x: remove specstrings.h include
    • -
    • d3d1x: flush the pipe context when presenting
    • -
    • d3d1x: remove another include specstrings.h
    • -
    • d3d1x: flush properly
    • -
    • d3d1x: add missing guid.cpp
    • -
    • d3d1x: fix build without system EGL/egl.h
    • -
    • d3d1x: add autogenerated files as prerequisites, so make builds them
    • -
    • d3d1x: obliterate IDL parameter names from d3d10.idl from Wine too
    • -
    • d3d1x: add shader dumping
    • -
    • d3d1x: add untested support for geometry shader translation
    • -
    • d3d1x: don't assert on unsupported resource types
    • -
    • d3d1x: fix CheckMultisampleQualityLevels
    • -
    • d3d1x: draw to the correct buffer
    • -
    • d3d1x: fix linking of dxbc2tgsi
    • -
    • nvfx: allow setting NULL constant buffers
    • -
    • nvfx: add RGB framebuffer format support in addition to BGR
    • -
    • d3d1x: don't crash on drivers not supporting vertex or geometry sampling
    • -
    • d3d1x: assert if X visual is not among enumerated visuals
    • -
    • d3d1x: stop using GLX in demos, just use the default visual
    • -
    • d3d1x: CRLF -> LF in progs
    • -
    • mesa: make makedepend an hard requirement
    • -
    • gallium: add $(PROGS_DEPS) as dependencies for $(PROGS)
    • -
    • d3d1x: fix parallel build
    • -
    • d3d1x: add private gitignore file
    • -
    • d3d1x: fix progs linking if not all EGL platforms are enabled
    • -
    • d3d1x: link progs with CXXFLAGS
    • -
    • d3d11: advertise IDXGIDevice1, not just IDXGIDevice
    • -
    • d3d11: ignore StructureByteStride
    • -
    • d3d1x: link to libdrm for X11 platform too
    • -
    • ureg: support centroid interpolation
    • -
    • d3d1x: support centroid interpolation
    • -
    • d3d1x: properly support specifying MipLevels as 0
    • -
    • d3d1x: put proper calling convention in headers, fixes 64-bit builds
    • -
    • d3d1x: rework DXGI for occlusion testing and default width/height
    • -
    • d3d1x: fix Map
    • -
    • d3d11: fix reference counting so devices get freed
    • -
    • d3d1x: work around crash in widl
    • -
    • glsl: Unroll loops with conditional breaks anywhere (not just the end)
    • -

    - -

    Lucas Stach (1): -

      -
    • nvfx: fill PIPE_CAP_PRIMITIVE_RESTART and PIPE_CAP_SHADER_STENCIL_EXPORT
    • -

    - -

    Marek Olšák (100): -

      -
    • r300g: prevent creating multiple winsys BOs for the same handle
    • -
    • r300g/swtcl: fix CS overrun
    • -
    • st/mesa: fix assertion failure in GetTexImage for cubemaps
    • -
    • util: make calling remove_from_list multiple times in a row safe
    • -
    • r300g: fixup long-lived BO maps being incorrectly unmapped when flushing
    • -
    • r300g: make accessing map_list and buffer_handles thread-safe
    • -
    • r300g: fix a copy-paste typo for logging
    • -
    • r300g: fix the border color for every format other than PIPE_FORMAT_B8G8R8A8
    • -
    • Build r300g by default
    • -
    • util: fix util_pack_color for B4G4R4A4
    • -
    • r300g: fix macrotiling on R350
    • -
    • r300g: code cleanups
    • -
    • r300/compiler: fix projective mapping of 2D NPOT textures
    • -
    • r300/compiler: do not use copy propagation if SaturateMode is used
    • -
    • r300/compiler: fix shadow sampling with swizzled coords
    • -
    • r300g: add support for 3D NPOT textures without mipmapping
    • -
    • r300g: fix swizzling of texture border color
    • -
    • configure.ac: look for libdrm_radeon before building gallium/r300,r600
    • -
    • configure.ac: do not build xorg-r300g by default
    • -
    • Makefile: ensure Gallium's Makefile.xorg and SConscript.dri are in the tarball
    • -
    • r300g: add support for formats beginning with X, like X8R8G8B8
    • -
    • r300g: fix conditional rendering in non-wait path
    • -
    • r300g: add support for R8G8 colorbuffers
    • -
    • r300g: add support for L8A8 colorbuffers
    • -
    • update release notes for Gallium
    • -
    • r300g: fix microtiling for 16-bits-per-channel formats
    • -
    • r300g: do not print get_param errors in non-debug build
    • -
    • r300g: say no to PIPE_CAP_STREAM_OUTPUT and PIPE_CAP_PRIMITIVE_RESTART
    • -
    • mesa: allow FBO attachments of formats LUMINANCE, LUMINANCE_ALPHA, and INTENSITY
    • -
    • r300g: fix texture border for 16-bits-per-channel formats
    • -
    • st/mesa: support RGBA16 and use it for RGBA12 as well
    • -
    • r300g: add a default channel ordering of texture border for unhandled formats
    • -
    • r300g: mention ATI in the renderer string
    • -
    • r300g: rename has_hyperz -> can_hyperz
    • -
    • r300g: turn magic numbers into names in the hyperz code
    • -
    • gallium: add CAPs for indirect addressing and lower it in st/mesa when needed
    • -
    • tgsi: fill out CAPs for indirect addressing
    • -
    • i915g: fill out CAPs for indirect addressing
    • -
    • i965g: fill out CAPs for indirect addressing
    • -
    • nv50: fill out CAPs for indirect addressing
    • -
    • nvfx: fill out CAPs for indirect addressing
    • -
    • r300g: fill out CAPs for indirect addressing
    • -
    • r600g: fill out CAPs for indirect addressing
    • -
    • svga: fill out CAPs for indirect addressing
    • -
    • r300g: fix texture border color for all texture formats
    • -
    • r300g: clean up redundancy in draw functions
    • -
    • r300g: return shader caps from Draw for SWTCL vertex shaders
    • -
    • r300g: remove the hack with OPCODE_RET
    • -
    • r300g: print FS inputs uninitialized due to hardware limits to stderr
    • -
    • r300g: fix rendering with no vertex elements
    • -
    • st/mesa: enable ARB_explicit_attrib_location and EXT_separate_shader_objects
    • -
    • docs: add GL 4.1 status
    • -
    • gallium: add PIPE_SHADER_CAP_SUBROUTINES
    • -
    • st/mesa: set MaxUniformComponents
    • -
    • u_blitter: use PIPE_TRANSFER_DISCARD to prevent cpu/gpu stall
    • -
    • r300/compiler: fix rc_rewrite_depth_out for it to work with any instruction
    • -
    • r300/compiler: remove duplicate function rc_mask_to_swz
    • -
    • r300/compiler: add a function for swizzling a mask
    • -
    • r300/compiler: move util functions to radeon_compiler_util
    • -
    • u_blitter: interpolate clear color using a GENERIC varying instead of COLOR
    • -
    • st/mesa: fix texture border color for RED and RG base formats
    • -
    • util: rename u_mempool -> u_slab
    • -
    • r300g: fix texture border color once again
    • -
    • r300/compiler: implement and lower OPCODE_CLAMP
    • -
    • ir_to_mesa: Add support for conditional discards.
    • -
    • r300g: fix texture swizzling with compressed textures on r400-r500
    • -
    • r300g: disable ARB_texture_swizzle if S3TC is enabled on r3xx-only
    • -
    • r300g: fix up cubemap texture offset computation
    • -
    • r300/compiler: disable the swizzle lowering pass in vertex shaders
    • -
    • r300g: fix build
    • -
    • r300g: use internal BO handle for add_buffer and write_reloc
    • -
    • r300g: implement simple transfer_inline_write for buffers
    • -
    • mesa, st/mesa: fix gl_FragCoord with FBOs in Gallium
    • -
    • r300g: fix pointer arithmetic with void* in transfer_inline_write
    • -
    • r300g: do not remove unused constants if we are not near the limit
    • -
    • r300g: add capability bit index_bias_supported
    • -
    • r300g: one more r500_index_bias_supported leftover
    • -
    • r300g: do not use the index parameter in set_constant_buffer
    • -
    • r300g: cleanup winsys
    • -
    • r300g: optimize looping over atoms
    • -
    • st/mesa: initialize key in st_vp_varient
    • -
    • u_blitter: use util_is_format_compatible in the assert
    • -
    • r300g: cache packet dwords of 3D_LOAD_VBPNTR in a command buffer if possible
    • -
    • r300g: validate buffers only if any of bound buffers is changed
    • -
    • r300g: also revalidate the SWTCL vertex buffer after its reallocation
    • -
    • r300/compiler: don't terminate regalloc if we surpass max temps limit
    • -
    • r300/compiler: add a function to query program stats (alu, tex, temps..)
    • -
    • r300/compiler: cleanup rc_run_compiler
    • -
    • r300/compiler: do not print pair/tex/presub program stats for vertex shaders
    • -
    • r300/compiler: handle DPH and XPD in rc_compute_sources_for_writemask
    • -
    • r300/compiler: make lowering passes possibly use up to two less temps
    • -
    • r300/compiler: remove at least unused immediates if externals cannot be removed
    • -
    • r300/compiler: fix LIT in VS
    • -
    • r300/compiler: fix swizzle lowering with a presubtract source operand
    • -
    • r300g: fix rendering with a vertex attrib having a zero stride
    • -
    • r300g: finally fix the texture corruption on r3xx-r4xx
    • -
    • r300g/swtcl: re-enable LLVM
    • -
    • r300g: mark vertex arrays as dirty after a buffer_offset change
    • -
    • mesa: fix texel store functions for some float formats
    • -
    • r300/compiler: disable the rename_regs pass for loops
    • -

    - -

    Mario Kleiner (1): -

      -
    • mesa/r300classic: Fix dri2Invalidate/radeon_prepare_render for page flipping.
    • -

    - -

    Mathias Fröhlich (3): -

      -
    • r300g: Avoid returning values in a static array, fixing a potential race
    • -
    • r600g: Only compare active vertex elements
    • -
    • st/mesa: Set PIPE_TRANSFER_DISCARD for GL_MAP_INVALIDATE_RANGE/BUFFFER_BIT
    • -

    - -

    Michal Krol (10): -

      -
    • svga: Fix relative addressing translation for pixel shaders.
    • -
    • svga: Integer constant register file has a separate namespace.
    • -
    • tgsi/exec: Cleanup the remaining arithmetic instructions.
    • -
    • tgsi/exec: Get rid of obsolete condition codes.
    • -
    • tgsi/build: Reduce interface clutter.
    • -
    • graw/gdi: Initial commit.
    • -
    • scons: Hook-up graw-gdi target.
    • -
    • graw/gdi: Fix window dimensions.
    • -
    • os: Open file streams in binary mode.
    • -
    • graw: Export graw_save_surface_to_file().
    • -

    - -

    Nicolas Kaiser (26): -

      -
    • swrast: remove duplicated include
    • -
    • egl: remove duplicated include
    • -
    • gallium/rtasm: remove duplicated include
    • -
    • gallium/util: remove duplicated include
    • -
    • gallium/i915: remove duplicated include
    • -
    • gallium/llvmpipe: remove duplicated include
    • -
    • gallium/softpipe: remove duplicated include
    • -
    • gallium/st: remove duplicated includes
    • -
    • gallium/winsys: remove duplicated include
    • -
    • glx: remove duplicated include
    • -
    • dri/common: remove duplicated include
    • -
    • dri/i810: remove duplicated include
    • -
    • dri/i915: remove duplicated include
    • -
    • dri/i965: remove duplicated include
    • -
    • dri/intel: remove duplicated include
    • -
    • dri/mga: remove duplicated include
    • -
    • dri/r128: remove duplicated include
    • -
    • dri/r300: remove duplicated include
    • -
    • dri/r600: remove duplicated include
    • -
    • dri/radeon: remove duplicated includes
    • -
    • dri/savage: remove duplicated include
    • -
    • main: remove duplicated includes
    • -
    • math: remove duplicated includes
    • -
    • st: remove duplicated include
    • -
    • i965g: use Elements macro instead of manual sizeofs
    • -
    • nv50: fix always true conditional in shader optimization
    • -

    - -

    Orion Poplawski (1): -

      -
    • osmesa: link against libtalloc
    • -

    - -

    Owen W. Taylor (1): -

      -
    • r600g: Fix location for clip plane registers
    • -

    - -

    Peter Clifton (3): -

      -
    • intel: Fix emit_linear_blit to use DWORD aligned width blits
    • -
    • intel: Add assert check for blitting alignment.
    • -
    • meta: Mask Stencil.Clear against stencilMax in _mesa_meta_Clear
    • -

    - -

    Robert Hooker (2): -

      -
    • intel: Add a new B43 pci id.
    • -
    • egl_dri2: Add missing intel chip ids.
    • -

    - -

    Roland Scheidegger (16): -

      -
    • gallivm: fix copy&paste bug
    • -
    • gallivm: don't use URem/UDiv when calculating offsets for blocks
    • -
    • gallivm: optimize yuv decoding
    • -
    • gallivm: fix trunc/itrunc comment
    • -
    • gallivm: faster iround implementation for sse2
    • -
    • gallivm: replace sub/floor/ifloor combo with ifloor_fract
    • -
    • gallivm: optimize some tex wrap mode calculations a bit
    • -
    • gallivm: more linear tex wrap mode calculation simplification
    • -
    • gallivm: avoid unnecessary URem in linear wrap repeat case
    • -
    • gallivm: optimize soa linear clamp to edge wrap mode a bit
    • -
    • gallivm: make use of new iround code in lp_bld_conv.
    • -
    • gallivm: fix different handling of [non]normalized coords in linear soa path
    • -
    • gallivm: only use lp_build_conv 4x4f -> 1x16 ub fastpath with sse2
    • -
    • r200: fix r200 large points
    • -
    • mesa: remove unneeded DD_POINT_SIZE and DD_LINE_WIDTH tricaps
    • -
    • gallium: support for array textures and related changes
    • -

    - -

    Shuang He (1): -

      -
    • mesa: allow GLfixed arrays for OpenGL ES 2.0
    • -

    - -

    Stephan Schmid (1): -

      -
    • r600g: fix relative addressing when splitting constant accesses
    • -

    - -

    Thomas Hellstrom (21): -

      -
    • st/xorg: Don't try to use option values before processing options
    • -
    • xorg/vmwgfx: Make vmwarectrl work also on 64-bit servers
    • -
    • st/xorg: Add a customizer option to get rid of annoying cursor update flicker
    • -
    • xorg/vmwgfx: Don't hide HW cursors when updating them
    • -
    • st/xorg: Don't try to remove invalid fbs
    • -
    • st/xorg: Fix typo
    • -
    • st/xorg, xorg/vmwgfx: Be a bit more frendly towards cross-compiling environments
    • -
    • st/xorg: Fix compilation errors for Xservers compiled without Composite
    • -
    • st/xorg: Don't use deprecated x*alloc / xfree functions
    • -
    • xorg/vmwgfx: Don't use deprecated x*alloc / xfree functions
    • -
    • st/xorg: Fix compilation for Xservers >= 1.10
    • -
    • mesa: Make sure we have the talloc cflags when using the talloc headers
    • -
    • egl: Add an include for size_t
    • -
    • mesa: Add talloc includes for gles
    • -
    • st/egl: Fix build for include files in nonstandard places
    • -
    • svga/drm: Optionally resolve calls to powf during link-time
    • -
    • gallium/targets: Trivial crosscompiling fix
    • -
    • st/xorg: Add a function to flush pending rendering and damage
    • -
    • gallium/targets/xorg-vmwgfx: Xv fixes
    • -
    • xorg/vmwgfx: Flush even if we don't autopaint the color key
    • -
    • xorg/vmwgfx: Don't clip video to viewport
    • -

    - -

    Tilman Sauerbeck (35): -

      -
    • r600g: Fixed a bo leak in r600_blit_state_ps_shader().
    • -
    • r600g: Use clamped math for RCP and RSQ.
    • -
    • r600g: Formatting fixes.
    • -
    • r600g: Added DB_SHADER_CONTROL defines.
    • -
    • r600g: Only set PA_SC_EDGERULE on rv770 and greater.
    • -
    • r600g: Enable PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED.
    • -
    • r600g: Fixed the shift in S_02880C_KILL_ENABLE.
    • -
    • glsl2: Empty functions can be inlined.
    • -
    • glsl2: Fixed cloning of ir_call error instructions.
    • -
    • r600g: Added support for TGSI_SEMANTIC_FACE.
    • -
    • gallium/docs: Fixed a typo in the SCS opcode description.
    • -
    • r600g: Honour destination operand's writemask in the SCS implementation.
    • -
    • r600g: Implemented the Z and W component write for the SCS opcode.
    • -
    • python/tests: Fixed tri.py for API and TGSI syntax changes.
    • -
    • r600g: Removed debug code.
    • -
    • gallium/docs: The RET opcode may appear anywhere in a subroutine.
    • -
    • r600g: Destroy the blitter.
    • -
    • r600g: Fixed two texture surface leaks in r600_blit_uncompress_depth().
    • -
    • r600g: Cleaned up index buffer reference handling in the draw module.
    • -
    • r600g: Fixed r600_vertex_element leak.
    • -
    • r600g: Added r600_pipe_shader_destroy().
    • -
    • r600g: Also clear bc data when we're destroying a shader.
    • -
    • r600g: In radeon_bo(), call LIST_INITHEAD early.
    • -
    • r600g: Destroy the blitter.
    • -
    • r600g: Removed unused 'ptr' argument from radeon_bo().
    • -
    • r600g: Made radeon_bo_pb_map_internal() actually call radeon_bo_map().
    • -
    • r600g: Fixed unmap condition in radeon_bo_pb_destroy().
    • -
    • r600g: Made radeon_bo::map_count signed.
    • -
    • r600g: We don't support PIPE_CAP_PRIMITIVE_RESTART.
    • -
    • r600g: Delete custom_dsa_flush on shutdown.
    • -
    • r600g: Fixed two memory leaks in winsys.
    • -
    • r600g: Destroy the winsys in r600_destroy_screen().
    • -
    • st/mesa: Reset the index buffer before destroying the pipe context.
    • -
    • st/mesa: Reset the constant buffers before destroying the pipe context.
    • -
    • r600g: Removed duplicated call to tgsi_split_literal_constant().
    • -

    - -

    Timo Wiren (1): -

      -
    • Fix typos in comments and debug output strings.
    • -

    - -

    Tom Fogal (3): -

      -
    • Implement x86_64 atomics for compilers w/o intrinsics.
    • -
    • Prefer intrinsics to handrolled atomic ops.
    • -
    • Revert "Prefer intrinsics to handrolled atomic ops."
    • -

    - -

    Tom Stellard (32): -

      -
    • r300/compiler: Refactor the pair instruction data structures
    • -
    • r300g: Always try to build libr300compiler.a
    • -
    • r300/compiler: Fix two mistakes in the presubtract optimization pass.
    • -
    • r300/compiler: Add more helper functions for iterating through sources
    • -
    • r300/compiler: Print immediate values after "dead constants" pass
    • -
    • r300/compiler: radeon_remove_constants.c: fix indentation
    • -
    • r300/compiler: Use rc_for_all_reads_src() in "dead constants" pass
    • -
    • r300/compiler: Fix segfault in error path
    • -
    • r300/compiler: Don't use rc_error() unless the error is unrecoverable
    • -
    • r300/compiler: Don't merge instructions that write output regs and ALU result
    • -
    • r300/compiler: Create a helper function for merging presubtract sources
    • -
    • r300/compiler: Fix incorrect assumption
    • -
    • r300/compiler: Clear empty registers after constant folding
    • -
    • r300/compiler: Add a new function for more efficient dataflow analysis
    • -
    • r300g: Add new debug option for logging vertex/fragment program stats
    • -
    • r300/compiler: Use rc_get_readers_normal() for presubtract optimizations
    • -
    • r300/compiler: Don't clobber presubtract sources during optimizations
    • -
    • r300/compiler: Don't track readers into an IF block.
    • -
    • r300/compiler: Make sure presubtract sources use supported swizzles
    • -
    • r300/compiler: Fix register allocator's handling of loops
    • -
    • r300/compiler: Fix instruction scheduling within IF blocks
    • -
    • r300/compiler: Use zero as the register index for unused sources
    • -
    • r300/compiler: Ignore alpha dest register when replicating the result
    • -
    • r300/compiler: Add rc_get_readers()
    • -
    • r300/compiler: Handle BREAK and CONTINUE in rc_get_readers()
    • -
    • r300/compiler: Track readers through branches in rc_get_readers()
    • -
    • r300/compiler: Convert RGB to alpha in the scheduler
    • -
    • r300/compiler: Use presubtract operations as much as possible
    • -
    • r300/compiler: Enable rename_reg pass for r500 cards
    • -
    • r300/compiler: Add a more efficient version of rc_find_free_temporary()
    • -
    • r300/compiler: Don't allow presubtract sources to be remapped twice
    • -
    • r300/compiler: Fix black terrain in Civ4
    • -

    - -

    Victor Tseng (1): -

      -
    • egl/i965: include inline_wrapper_sw_helper.h
    • -

    - -

    Viktor Novotný (6): -

      -
    • dri/nouveau: Import headers from rules-ng-ng
    • -
    • dri/nouveau: nv04: Use rules-ng-ng headers
    • -
    • dri/nouveau: nv10: Use rules-ng-ng headers
    • -
    • dri/nouveau nv20: Use rules-ng-ng headers
    • -
    • dri/nouveau: Remove nouveau_class.h, finishing switch to rules-ng-ng headers
    • -
    • dri/nouveau: Clean up magic numbers in get_rt_format
    • -

    - -

    Vinson Lee (214): -

      -
    • llvmpipe: Remove unnecessary header.
    • -
    • r600g: Remove unnecessary headers.
    • -
    • mesa: Include missing header in program.h.
    • -
    • glsl: Fix 'format not a string literal and no format arguments' warning.
    • -
    • r600g: Silence uninitialized variable warning.
    • -
    • r600g: Silence uninitialized variable warning.
    • -
    • nvfx: Silence uninitialized variable warnings.
    • -
    • r600g: Silence uninitialized variable warning.
    • -
    • r600g: Silence uninitialized variable warning.
    • -
    • r600g: Silence uninitialized variable warning.
    • -
    • r600g: Silence unused variable warning.
    • -
    • nv50: Update files in SConscript to match Makefile.
    • -
    • nv50: Remove unnecessary headers.
    • -
    • nv50: Silence uninitialized variable warning.
    • -
    • nv50: Silence uninitialized variable warning.
    • -
    • nv50: Silence uninitialized variable warning.
    • -
    • gallivm: Remove unnecessary headers.
    • -
    • draw: Remove unnecessary header.
    • -
    • nv50: Silence uninitialized variable warnings.
    • -
    • nv50: Fix 'control reaches end of non-void function' warning.
    • -
    • mesa/st: Silence uninitialized variable warning.
    • -
    • gallivm: Remove unnecessary header.
    • -
    • r600g: Remove unnecessary header.
    • -
    • r600g: Remove unnecessary headers.
    • -
    • r600g: Fix implicit declaration warning.
    • -
    • r600g: Fix memory leak on error path.
    • -
    • r600g: Silence uninitialized variable warning.
    • -
    • r600g: Silence unused variable warnings.
    • -
    • mesa: bump version to 7.10
    • -
    • ir_to_mesa: Remove unused member array_indexed from struct statevar_element.
    • -
    • mesa: Silence "'valid_texture_object' defined but not used" warning.
    • -
    • x86: Silence unused variable warning on Mac OS X.
    • -
    • glsl: Fix 'control reaches end of non-void function' warning.
    • -
    • nvfx: Remove const qualifer from nvfx_vertprog_translate.
    • -
    • nvfx: Silence uninitialized variable warnings.
    • -
    • r600g: Remove unused variable.
    • -
    • nv50: Silence missing initializer warning.
    • -
    • nv50: Remove dead initialization.
    • -
    • nv50: Remove dead initialization.
    • -
    • tgsi: Remove duplicate case value.
    • -
    • glut: Define markWindowHidden for non-Windows only.
    • -
    • glut: Define eventParser for non-Windows only.
    • -
    • r300g: Silence uninitialized variable warning.
    • -
    • intel: Fix implicit declaration of function '_mesa_meta_Bitmap' warning.
    • -
    • mesa: Remove unnecessary headers.
    • -
    • r600g: Remove unnecessary header.
    • -
    • unichrome: Remove unnecessary header.
    • -
    • intel: Remove unnecessary headers.
    • -
    • r600g: Remove unused variable.
    • -
    • r600g: Disable unused variables.
    • -
    • r600g: Remove unused variable.
    • -
    • r600g: Silence 'control reaches end of non-void function' warning.
    • -
    • r600g: Remove unused variable.
    • -
    • r600g: Remove unused variable.
    • -
    • r600g: Disable unused variables.
    • -
    • intel: Remove unnecessary header.
    • -
    • st/dri: Remove unnecessary header.
    • -
    • r600g: Remove unused variable.
    • -
    • r300g: Remove unused variable.
    • -
    • r600g: Don't return a value in function returning void.
    • -
    • r600g: Remove unused variables.
    • -
    • r600g: Include p_compiler.h instead of malloc.h.
    • -
    • r600g: Silence uninitialized variable warnings.
    • -
    • scons: Add MinGW-w64 prefixes for MinGW build.
    • -
    • dri: Add GET_PROGRAM_NAME definition for Mac OS X.
    • -
    • scons: Add program/sampler.cpp to SCons build.
    • -
    • mesa: Fix printf format warning.
    • -
    • mesa: Fix printf format warning.
    • -
    • mesa: Fix printf format warning.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • r600g: Update SConscript.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • r600g: Update SConscript.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • r600g: Update SConscript.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • r600g: Fix SCons build.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • r300/compiler: Remove declaration before code.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • glsl: Remove unnecessary header.
    • -
    • savage: Remove unnecessary header.
    • -
    • r600g: Remove unused variable.
    • -
    • r600g: Remove unnecessary headers.
    • -
    • r600g: Fix SCons build.
    • -
    • r600g: Remove unnecessary header.
    • -
    • gallivm: Remove unnecessary header.
    • -
    • r600g: Silence uninitialized variable warning.
    • -
    • r600g: Silence uninitialized variable warning.
    • -
    • r600g: Silence uninitialized variable warning.
    • -
    • i915: Silence unused variable warning in non-debug builds.
    • -
    • i915: Silence unused variable warning in non-debug builds.
    • -
    • i965: Silence unused variable warning on non-debug builds.
    • -
    • i965: Silence unused variable warning on non-debug builds.
    • -
    • i965: Initialize member variables.
    • -
    • r300: Silence uninitialized variable warning.
    • -
    • tdfx: Silence unused variable warning on non-debug builds.
    • -
    • gallivm: Remove unnecessary header.
    • -
    • glsl: Initialize variable in ir_derefence_array::constant_expression_value
    • -
    • mesa: Add missing header to shaderobj.h.
    • -
    • llvmpipe: Return non-zero exit code for lp_test_round failures.
    • -
    • r300/compiler: Remove unused variable.
    • -
    • st/xorg: Fix memory leak on error path.
    • -
    • llvmpipe: Initialize state variable in debug_bin function.
    • -
    • llvmpipe: Initialize variable.
    • -
    • draw: Move loop variable declaration outside for loop.
    • -
    • r600g: Ensure r600_src is initialized in tgsi_exp function.
    • -
    • glsl: Add assert for unhandled ir_shader case.
    • -
    • swrast: Print out format on unexpected failure in _swrast_DrawPixels.
    • -
    • llvmpipe: Remove unnecessary header.
    • -
    • draw: Remove unnecessary header.
    • -
    • gallivm: Silence uninitialized variable warnings.
    • -
    • gallivm: Silence uninitialized variable warnings.
    • -
    • gallivm: Silence uninitialized variable warning.
    • -
    • r300g: Silence uninitialized variable warning.
    • -
    • mesa: Remove unnecessary headers.
    • -
    • r600g: Silence uninitialized variable warnings.
    • -
    • st/mesa: Remove unnecessary header.
    • -
    • mesa: Remove unnecessary header.
    • -
    • egl: Remove unnecessary headers.
    • -
    • swrast: Print out format on unexpected failure in _swrast_ReadPixels.
    • -
    • st/mesa: Silence uninitialized variable warning.
    • -
    • savage: Remove unnecessary header.
    • -
    • st/vega: Remove unnecessary headers.
    • -
    • dri/nouveau: Silence uninitialized variable warning.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • i965: Silence uninitialized variable warning.
    • -
    • i965: Silence uninitialized variable warning.
    • -
    • mesa: Clean up header file inclusion in accum.h.
    • -
    • mesa: Clean up header file inclusion in version.h.
    • -
    • mesa: Clean up header file inclusion in api_loopback.h.
    • -
    • mesa: Clean up header file inclusion in api_validate.h.
    • -
    • mesa: Include mfeatures.h in api_loopback for FEATURE_beginend.
    • -
    • mesa: Include mfeatures.h in api_validate.c for FEATURE_* symbols.
    • -
    • mesa: Clean up header file inclusion in arrayobj.h.
    • -
    • mesa: Clean up header file inclusion in atifragshader.h.
    • -
    • mesa: Clean up header file inclusion in attrib.h.
    • -
    • mesa: Clean up header file inclusion in blend.h.
    • -
    • mesa: Clean up header file inclusion in buffers.h.
    • -
    • mesa: Clean up header file inclusion in colortab.h.
    • -
    • mesa: Clean up header file inclusion in convolve.h.
    • -
    • mesa: Clean up header file inclusion in debug.h.
    • -
    • mesa: Clean up header file inclusion in depth.h.
    • -
    • mesa: Clean up header file inclusion in depthstencil.h.
    • -
    • mesa: Clean up header file inclusion in drawpix.h.
    • -
    • mesa: Clean up header file inclusion in drawtex.h.
    • -
    • mesa: Clean up header file inclusion in enable.h.
    • -
    • mesa: Clean up header file inclusion in extensions.h.
    • -
    • graw: Add struct pipe_surface forward declaration.
    • -
    • mesa: Clean up header file inclusion in fbobject.h.
    • -
    • mesa: Clean up header file inclusion in ffvertex_prog.h.
    • -
    • mesa: Clean up header file inclusion in fog.h.
    • -
    • mesa: Clean up header file inclusion in framebuffer.h.
    • -
    • mesa: Clean up header file inclusion in hint.h.
    • -
    • mesa: Clean up header file inclusion in histogram.h.
    • -
    • mesa: Clean up header file inclusion in image.h.
    • -
    • mesa: Add missing header and forward declarations in dd.h.
    • -
    • mesa: Clean up header file inclusion in light.h.
    • -
    • mesa: Clean up header file inclusion in lines.h.
    • -
    • mesa: Clean up header file inclusion in matrix.h.
    • -
    • mesa: Clean up header file inclusion in multisample.h.
    • -
    • mesa: Clean up header file inclusion in nvprogram.h.
    • -
    • winsys/xlib: Add cygwin to SConscript.
    • -
    • mesa: Clean up header file inclusion in pixel.h.
    • -
    • mesa: Clean up header file inclusion in pixelstore.h.
    • -
    • mesa: Fix printf format warnings.
    • -
    • mesa: Clean up header file inclusion in points.h.
    • -
    • i965: Silence uninitialized variable warning.
    • -
    • glsl: Add ir_constant_expression.cpp to SConscript.
    • -
    • mesa: Add definitions for inverse hyperbolic function on MSVC.
    • -
    • glsl: Fix 'control reaches end of non-void function' warning.
    • -
    • glsl: Add lower_vector.cpp to SConscript.
    • -
    • glsl: Fix type of label 'default' in switch statement.
    • -
    • st/mesa: Remove unnecessary headers.
    • -
    • swrast: Remove unnecessary header.
    • -
    • r600: Remove unnecesary header.
    • -
    • intel: Remove unnecessary header.
    • -
    • mesa: Clean up header file inclusion in polygon.h.
    • -
    • mesa: Clean up header file inclusion in rastpos.h.
    • -
    • mesa: Clean up header file inclusion in readpix.h.
    • -
    • mesa: Clean up header file inclusion in renderbuffer.h.
    • -
    • mesa: Clean up header file inclusion in scissor.h.
    • -
    • mesa: Clean up header file inclusion in shaderapi.h.
    • -
    • mesa: Clean up header file inclusion in shared.h.
    • -
    • mesa: Clean up header file inclusion in stencil.h.
    • -
    • r600: Remove unnecessary header.
    • -
    • llvmpipe: Remove unnecessary headers.
    • -
    • mesa: Clean up header file inclusion in syncobj.h.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • r300/compiler: Move declaration before code.
    • -
    • mesa: Clean up header file inclusion in texcompress.h.
    • -
    • st/vega: Silence uninitialized variable warning.
    • -
    • mesa: Clean up header file inclusion in texcompress_s3tc.h.
    • -
    • mesa: Clean up header file inclusion in texenvprogram.h.
    • -
    • mesa: Clean up header file inclusion in texformat.h.
    • -
    • mesa: Clean up header file inclusion in texgetimage.h.
    • -
    • mesa: Clean up header file inclusion in texobj.h.
    • -
    • gallium/noop: Add prototype for noop_init_state_functions.
    • -
    • mesa: Clean up header file inclusion in texrender.h.
    • -
    • mesa: Clean up header file inclusion in transformfeedback.h.
    • -
    • mesa: Clean up header file inclusion in varray.h.
    • -
    • mesa: Clean up header file inclusion in viewport.h.
    • -
    • r200: Silence uninitialized variable warning.
    • -
    • r600g: Fix SCons build.
    • -
    • i965: Silence uninitialized variable warning.
    • -

    - -

    Xavier Chantry (8): -

      -
    • nv50: fix size of outputs_written array
    • -
    • nv50: apply layout_mask to tile_flags
    • -
    • nvfx: only expose one rt on nv30
    • -
    • nvfx: fb->nr_cbufs <= 1 on nv30
    • -
    • nvfx: reset nvfx->hw_zeta
    • -
    • nvfx: fixes after array textures merge
    • -
    • init ps->context with util_surfaces_get and do_get
    • -
    • gallium/trace: check bind_vertex_sampler_states and set_vertex_sampler_views
    • -

    - -

    Xiang, Haihao (10): -

      -
    • mesa: fix regression from b4bb6680200b5a898583392f4c831c02f41e63f7
    • -
    • i965: add support for polygon mode on Sandybridge.
    • -
    • i965: fix for flat shading on Sandybridge
    • -
    • i965: set minimum/maximum Point Width on Sandybridge
    • -
    • meta: allow nested meta operations
    • -
    • i965: support for two-sided lighting on Sandybridge
    • -
    • i965: fix register region description
    • -
    • i965: use align1 access mode for instructions with execSize=1 in VS
    • -
    • i965: don't spawn GS thread for LINELOOP on Sandybridge
    • -
    • i965: use BLT to clear buffer if possible on Sandybridge
    • -

    - -

    Zack Rusin (8): -

      -
    • rbug: fix rbug when contexts are being destroyed
    • -
    • llvmpipe: fix rasterization of vertical lines on pixel boundaries
    • -
    • scons: build the xorg state trackers only when env includes drm
    • -
    • gallivm: implement indirect addressing of the output registers
    • -
    • gallivm: implement indirect addressing over inputs
    • -
    • gallivm: fix storing of the addr register
    • -
    • scons: add alias for identity
    • -
    • gallium/util: add states relevant to geometry shaders
    • -

    - -

    Zhenyu Wang (40): -

      -
    • i965: disasm quarter and write enable instruction control on sandybridge
    • -
    • i965: new state dump for sandybridge
    • -
    • i965: enable accumulator update in PS kernel too on sandybridge
    • -
    • i965: Fix color interpolation on sandybridge
    • -
    • i965: force zero in clipper to ignore RTAIndex on sandybridge
    • -
    • i965: fix point size setting in header on sandybridge
    • -
    • i965: ff sync message change for sandybridge
    • -
    • i965: ignore quads for GS kernel on sandybridge
    • -
    • i965: add sandybridge viewport state bo into validation list
    • -
    • i965: VS use SPF mode on sandybridge for now
    • -
    • i965: fix jump count on sandybridge
    • -
    • i965: Fix sampler on sandybridge
    • -
    • i965: fix const register count for sandybridge
    • -
    • i965: Add all device ids for sandybridge
    • -
    • i965: sandybridge pipe control workaround before write cache flush
    • -
    • i965: only allow SIMD8 kernel on sandybridge now
    • -
    • i965: don't do calculation for delta_xy on sandybridge
    • -
    • i965: fix pixel w interpolation on sandybridge
    • -
    • i965: enable polygon offset on sandybridge
    • -
    • i965: fix scissor state on sandybridge
    • -
    • i965: fix point sprite on sandybridge
    • -
    • i965: fix occlusion query on sandybridge
    • -
    • i965: fallback bitmap operation on sandybridge
    • -
    • i965: Always set tiling for depth buffer on sandybridge
    • -
    • i965: fallback lineloop on sandybridge for now
    • -
    • Revert "i965: Always set tiling for depth buffer on sandybridge"
    • -
    • i965: always set tiling for fbo depth buffer on sandybridge
    • -
    • i965: Fix GS hang on Sandybridge
    • -
    • Revert "i965: fallback lineloop on sandybridge for now"
    • -
    • i965: refresh wm push constant also for BRW_NEW_FRAMENT_PROGRAM on gen6
    • -
    • i965: fix dest type of 'endif' on sandybridge
    • -
    • Revert "i965: VS use SPF mode on sandybridge for now"
    • -
    • i965: also using align1 mode for math2 on sandybridge
    • -
    • i965: Fix GS state uploading on Sandybridge
    • -
    • i965: upload WM state for _NEW_POLYGON on sandybridge
    • -
    • i965: Use MI_FLUSH_DW for blt ring flush on sandybridge
    • -
    • i965: explicit tell header present for fb write on sandybridge
    • -
    • i965: Fix occlusion query on sandybridge
    • -
    • i965: Use last vertex convention for quad provoking vertex on sandybridge
    • -
    • i965: Fix provoking vertex select in clip state for sandybridge
    • -

    - -

    Zou Nan hai (1): -

      -
    • i965: skip too small size mipmap
    • -

    - -

    delphi (2): -

      -
    • draw: added userclip planes and updated variant_key
    • -
    • draw: some changes to allow for runtime changes to userclip planes
    • -

    - -

    nobled (3): -

      -
    • r300g: Abort if atom allocations fail
    • -
    • r300g: Abort if draw_create() fails
    • -
    • r300g: Drop unnecessary cast
    • -

    - -

    pontus lidman (1): -

      -
    • mesa: check for posix_memalign() errors
    • -

    - -

    richard (2): -

      -
    • evergreen : fix z format setting, enable stencil.
    • -
    • r600c : inline vertex format is not updated in an app, switch to use vfetch constants. For the 7.9 and 7.10 branches as well.
    • -

    - - - + + + +Mesa Release Notes + + + + + + + + +

    Mesa 7.10 Release Notes / January 7, 2011

    + +

    +Mesa 7.10 is a new development release. +People who are concerned with stability and reliability should stick +with a previous release or wait for Mesa 7.10.1. +

    +

    +Mesa 7.10 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    + + +

    MD5 checksums

    +
    +0a70c15c135561824bdcae92bf232e43  MesaLib-7.10.tar.gz
    +33fb94eccc02cbb4d8d1365615e38e46  MesaLib-7.10.tar.bz2
    +5cafdc0eda0f9bf370b95c98df3338fa  MesaLib-7.10.zip
    +bc644be551ed585fc4f66c16b64a91c9  MesaGLUT-7.10.tar.gz
    +5c2677a155672352d62b177e4f0f92e8  MesaGLUT-7.10.tar.bz2
    +2ce5001f74496d1ba719ef74d910a5cf  MesaGLUT-7.10.zip
    +
    + + +

    New features

    +
      +
    • GL_ARB_explicit_attrib_location extension (Intel and software drivers). +
    • GL_ARB_texture_rg (Intel, software drivers, gallium drivers). +
    • GL_EXT_separate_shader_objects extension (Intel and software drivers). +
    • GL_NV_primitive_restart extension (Gallium softpipe, llvmpipe). +
    • New fragment shader back-end for i965-class hardware. +
    • Support for Sandybridge chipset in i965 DRI driver. +
    + + +

    Bug fixes

    +

    This list is likely incomplete.

    +
      +
    • Bug 28800 - [r300c, r300g] Texture corruption with World of Warcraft
    • + +
    • Bug 29420 - Amnesia / HPL2 RendererFeatTest - not rendering correctly
    • + +
    • Bug 29946 - [swrast] piglit valgrind glsl-array-bounds-04 fails
    • + +
    • Bug 30261 - [GLSL 1.20] allowing inconsistent invariant declaration between two vertex shaders
    • + +
    • Bug 30632 - [softpipe] state_tracker/st_manager.c:489: st_context_notify_invalid_framebuffer: Assertion `stfb && stfb->iface == stfbi' failed.
    • + +
    • Bug 30694 - wincopy will crash on Gallium drivers when going to front buffer
    • + +
    • Bug 30771 - [r600g] vert-tex glsl demo
    • + +
    • Bug 30787 - Invalid asm shader does not generate draw-time error when used with GLSL shader
    • + +
    • Bug 30974 - [llvmpipe] SIGABRT src/gallium/drivers/llvmpipe/lp_state_fs.c:779
    • + +
    • Bug 30993 - getFramebufferAttachmentParameteriv wrongly generates error
    • + +
    • Bug 31101 - [glsl2] abort() in ir_validate::visit_enter(ir_assignment *ir)
    • + +
    • Bug 31193 - [regression] aa43176e break water reflections
    • + +
    • Bug 31194 - The mesa meta save/restore code doesn't ref the current GLSL program
    • + +
    • Bug 31371 - glslparsertest: ir.cpp:358: ir_constant::ir_constant(const glsl_type*, const ir_constant_data*): Assertion `(type->base_type >= 0) && (type->base_type <= 3)' failed.
    • + +
    • Bug 31439 - Crash in glBufferSubData() with size == 0
    • + +
    • Bug 31495 - [i965 gles2c bisected] OpenGL ES 2.0 conformance GL2Tests_GetBIFD_input.run regressed
    • + +
    • Bug 31514 - isBuffer returns true for unbound buffers
    • + +
    • Bug 31560 - [tdfx] tdfx_tex.c:702: error: ‘const struct gl_color_table’ has no member named ‘Format’
    • + +
    • Bug 31617 - Radeon/Compiz: 'failed to attach dri2 front buffer', error case not handled
    • + +
    • Bug 31648 - [GLSL] array-struct-array gets assertion: `(size >= 1) && (size <= 4)' failed.
    • + +
    • Bug 31650 - [GLSL] varying gl_TexCoord fails to be re-declared to different size in the second shader
    • + +
    • Bug 31673 - GL_FRAGMENT_PRECISION_HIGH preprocessor macro undefined in GLSL ES
    • + +
    • Bug 31690 - i915 shader compiler fails to flatten if in Aquarium webgl demo.
    • + +
    • Bug 31832 - [i915] Bad renderbuffer format: 21
    • + +
    • Bug 31841 - [drm:radeon_cs_ioctl] *ERROR* Invalid command stream !
    • + +
    • Bug 31894 - Writing to gl_PointSize with GLES2 corrupts other varyings
    • + +
    • Bug 31909 - [i965] brw_fs.cpp:1461: void fs_visitor::emit_bool_to_cond_code(ir_rvalue*): Assertion `expr->operands[i]->type->is_scalar()' failed.
    • + +
    • Bug 31934 - [gallium] Mapping empty buffer object causes SIGSEGV
    • + +
    • Bug 31983 - [i915 gles2] "if (expression with builtin/varying variables) discard" breaks linkage
    • + +
    • Bug 31985 - [GLSL 1.20] initialized uniform array considered as "unsized"
    • + +
    • Bug 31987 - [gles2] if input a wrong pname(GL_NONE) to glGetBoolean, it will not case GL_INVALID_ENUM
    • + +
    • Bug 32035 - [GLSL bisected] comparing unsized array gets segfault
    • + +
    • Bug 32070 - llvmpipe renders stencil demo incorrectly
    • + +
    • Bug 32273 - assertion fails when starting vdrift 2010 release with shaders enabled
    • + +
    • Bug 32287 - [bisected GLSL] float-int failure
    • + +
    • Bug 32311 - [965 bisected] Array look-ups broken on GM45
    • + +
    • Bug 32520 - [gles2] glBlendFunc(GL_ZERO, GL_DST_COLOR) will result in GL_INVALID_ENUM
    • + +
    • Bug 32825 - egl_glx driver completely broken in 7.9 branch [fix in master]
    • + +
    • Bug -
    • + +
    • Bug -
    • + +
    + + +

    Changes

    +

    Adam Jackson (2): +

      +
    • i965: Update renderer strings for sandybridge
    • +
    • drivers/x11: unifdef XFree86Server
    • +

    + +

    Alex Deucher (30): +

      +
    • r600c: fix mipmap stride on evergreen
    • +
    • r600c: add reloc for CB_COLOR0_ATTRIB
    • +
    • r600c: pull over 6xx/7xx vertex fixes for evergreen
    • +
    • r600c: fix segfault in evergreen stencil code
    • +
    • r100: revalidate after radeon_update_renderbuffers
    • +
    • r600c: add missing radeon_prepare_render() call on evergreen
    • +
    • r600c: properly align mipmaps to group size
    • +
    • egl_dri2: Add radeon chip ids
    • +
    • r600c/evergreen: texture align is group_bytes just like 6xx/7xx
    • +
    • r600g: fix buffer alignment
    • +
    • r600g: All EVENT_WRITE packets need the EVENT_INDEX field
    • +
    • r600g: translate ARR instruction for evergreen
    • +
    • r600g: use meaningful defines for chiprev
    • +
    • r600g: use full range of VS resources for vertex samplers
    • +
    • r600g: fix additional EVENT_WRITE packet
    • +
    • r600g: fix some winsys functions to deal properly with evergreen
    • +
    • r600c: add Ontario Fusion APU support
    • +
    • r600g: add support for ontario APUs
    • +
    • r600c: fix VC flush on cedar and palm
    • +
    • gallium/egl: fix r300 vs r600 loading
    • +
    • r600c: fix some opcodes on evergreen
    • +
    • r600c: bump texture limits to hw limits
    • +
    • r600g: bump texture/cb limits appropriately for evergreen
    • +
    • radeon: bump mip tree levels to 15
    • +
    • r600g: fix rendering with a vertex attrib having a zero stride
    • +
    • r600g: remove useless switch statements
    • +
    • r600g: add support for NI (northern islands) asics
    • +
    • r600c: add support for NI asics
    • +
    • r600g: support up to 64 shader constants
    • +
    • r600c: fix up SQ setup in blit code for Ontario/NI
    • +

    + +

    Andre Maasikas (3): +

      +
    • r600c: fix buffer height setting in dri2 case
    • +
    • r600g: break alu clause earlier
    • +
    • r600g: fix evergreen interpolation setup
    • +

    + +

    Andrew Randrianasulu (2): +

      +
    • dri/nv04: Don't expose ARB_texture_env_combine/dot3.
    • +
    • dri/nv04: Enable eng3dm for A8/L8 textures.
    • +

    + +

    Aras Pranckevicius (2): +

      +
    • glsl: fix crash in loop analysis when some controls can't be determined
    • +
    • glsl: fix matrix type check in ir_algebraic
    • +

    + +

    Bas Nieuwenhuizen (3): +

      +
    • r600g: set ENABLE_KILL in the shader state in the new design
    • +
    • r600g: set ENABLE_KILL on evergreen too
    • +
    • r600g: use dirty list to track dirty blocks
    • +

    + +

    Ben Skeggs (3): +

      +
    • nv50: DST
    • +
    • nv50: DPH
    • +
    • nv50: silence some unknown get_param warnings
    • +

    + +

    Benjamin Franzke (2): +

      +
    • st/egl image: multiply drm buf-stride with blocksize
    • +
    • r600g: implement texture_get_handle (needed for eglExportDRMImageMESA)
    • +

    + +

    Brian Paul (296): +

      +
    • glx: add const qualifiers to __indirect_glMultiDrawArraysEXT()
    • +
    • glsl2: fix signed/unsigned comparison warning
    • +
    • llvmpipe: cast to silence warning
    • +
    • llvmpipe: s/boolean/unsigned/ in bitfield to silence warning
    • +
    • nv50: use unsigned int for bitfields to silence warnings
    • +
    • tgsi: fix incorrect usage_mask for shadow tex instructions
    • +
    • gallivm: expand AoS sampling to cover all filtering modes
    • +
    • gallivm: fix incorrect vector shuffle datatype
    • +
    • gallivm: move i32_vec_type inside the #ifdef
    • +
    • mesa: include mfeatures.h in formats.c
    • +
    • gallivm: fix wrong return value in bitwise functions
    • +
    • tgsi/sse: fix aos_to_soa() loop to handle num_inputs==0
    • +
    • gallivm: added missing case for PIPE_TEXTURE_RECT
    • +
    • gallium: better docs for pipe_rasterizer_state::sprite_coord_enable
    • +
    • gallium: rework handling of sprite_coord_enable state
    • +
    • gallium/docs: added new pipeline.txt diagram
    • +
    • mesa: don't call valid_texture_object() in non-debug builds
    • +
    • glsl2: silence compiler warnings in printf() calls
    • +
    • docs: remove old broken link
    • +
    • docs: mark as obsolete, remove dead links
    • +
    • llvmpipe: fix query bug when no there's no scene
    • +
    • gallivm: remove debug code
    • +
    • llvmpipe: maintain fragment shader state for draw module
    • +
    • llvmpipe: indentation fix
    • +
    • llvmpipe: reformatting, remove trailing whitespace, etc
    • +
    • llvmpipe: clean-up, comments in setup_point_coefficient()
    • +
    • llvmpipe: rename sprite field, add sprite_coord_origin
    • +
    • llvmpipe: implement sprite coord origin modes
    • +
    • draw: fix test for using the wide-point stage
    • +
    • llvmpipe: check bitshift against PIPE_MAX_SHADER_OUTPUTS
    • +
    • draw: check bitshift against PIPE_MAX_SHADER_OUTPUS
    • +
    • Merge branch 'sprite-coord'
    • +
    • draw: new draw_fs.[ch] files
    • +
    • glsl2: fix typo in error msg
    • +
    • gallivm: fix lp_build_sample_compare()
    • +
    • softpipe: add missing calls to set draw vertex samplers/views
    • +
    • mesa: don't advertise bogus GL_ARB_shading_language_120 extension
    • +
    • configs: remove egl-swrast target from linux-dri config
    • +
    • llvmpipe: fix sprite texcoord setup for non-projective texturing
    • +
    • mesa: fix assertions to handle srgb formats
    • +
    • st/mesa: add missing MESA_FORMAT_S8 case in st_mesa_format_to_pipe_format()
    • +
    • st/mesa: use the wrapped renderbuffer in CopyPixels()
    • +
    • llvmpipe: make min/max lod and lod bias dynamic state
    • +
    • llvmpipe: make texture border_color dynamic state
    • +
    • softpipe: fix repeat() function for NPOT textures
    • +
    • gallivm: fix repeat() function for NPOT textures
    • +
    • swrast: update comments for REMAINDER() macro
    • +
    • softpipe: rename sp_state_fs.c -> sp_state_shader.c
    • +
    • softpipe: make shader-related functions static
    • +
    • softpipe: make blend/stencil/depth functions static
    • +
    • softpipe: make sampler state functions static
    • +
    • softpipe: make vertex state functions static
    • +
    • softpipe: make rasterizer state functions static
    • +
    • softpipe: make stream out state functions static
    • +
    • softpipe: make clip state functions static
    • +
    • softpipe: minor asst. clean-ups
    • +
    • softpipe: allocate tile data on demand
    • +
    • llvmpipe: fix swizzling of texture border color
    • +
    • softpipe: fix swizzling of texture border color
    • +
    • draw: pass sampler state down to llvm jit state
    • +
    • gallivm: check for level=0 case in lp_build_minify()
    • +
    • gallivm: added some comments
    • +
    • draw: check for null sampler pointers
    • +
    • swrast: fix choose_depth_texture_level() to respect mipmap filtering state
    • +
    • st/mesa: replace assertion w/ conditional in framebuffer invalidation
    • +
    • glsl2: fix signed/unsigned comparison warning
    • +
    • st/xlib: add some comments
    • +
    • ir_to_mesa: assorted clean-ups, const qualifiers, new comments
    • +
    • mesa: remove assertion w/ undeclared variable texelBytes
    • +
    • gallivm: remove newlines
    • +
    • draw/llvmpipe: replace DRAW_MAX_TEXTURE_LEVELS with PIPE_MAX_TEXTURE_LEVELS
    • +
    • mesa: reformatting, comments, code movement
    • +
    • x11: fix breakage from gl_config::visualType removal
    • +
    • gallivm: work-around trilinear mipmap filtering regression with LLVM 2.8
    • +
    • mesa: remove post-convolution width/height vars
    • +
    • gallivm: add compile-time option to emit inst addrs and/or line numbers
    • +
    • llvmpipe: code to dump bytecode to file (disabled)
    • +
    • gallivm: added lp_build_print_vec4()
    • +
    • gallivm: added lp_build_load_volatile()
    • +
    • glsl: add ir_unop_round_even case to silence unhandled enum warning
    • +
    • st/mesa: fix regressions in glDrawPixels(GL_STENCIL_INDEX)
    • +
    • st/mesa: reformatting in st_cb_drawpixels.c
    • +
    • st/mesa: use GLuint to avoid problem w/ uint not defined on mingw32
    • +
    • st/mesa: update function name, comments
    • +
    • gallivm: use util_snprintf()
    • +
    • llvmpipe: remove lp_setup_coef*.c files from Makefile
    • +
    • mesa: fix mesa version string construction
    • +
    • gallivm: fix incorrect type for zero vector in emit_kilp()
    • +
    • llvmpipe/draw: always enable LLVMAddInstructionCombiningPass()
    • +
    • draw: use float version of LLVM Mul/Add instructions
    • +
    • draw: fix typo in comment
    • +
    • mesa: add GL_RG case to _mesa_source_buffer_exists()
    • +
    • mesa: add missing cases for packing red/green images
    • +
    • st/mesa: added cases for GL_COMPRESSED_RED/RG in st_choose_format()
    • +
    • docs: update texture red/green support in GL3.txt
    • +
    • docs: add GL_ARB_texture_rg to release notes
    • +
    • mesa: driver hook for primitive restart
    • +
    • mesa: set/get primitive restart state
    • +
    • mesa: API spec for primitive restart
    • +
    • mesa: regenerated files with primitive restart
    • +
    • mesa: plug in primitive restart function
    • +
    • vbo: support for primitive restart
    • +
    • gallium: new CAP, state for primitive restart
    • +
    • st/mesa: support for primitive restart
    • +
    • draw: implement primitive splitting for primitive restart
    • +
    • softpipe: enable primitive restart
    • +
    • llvmpipe: enable primitive restart
    • +
    • docs: added GL_NV_primitive_restart extension
    • +
    • Merge branch 'primitive-restart-cleanup'
    • +
    • winsys/xlib: formatting fixes
    • +
    • winsys/xlib: use Bool type for shm field
    • +
    • winsys/xlib: fix up allocation/dealloction of XImage
    • +
    • winsys/xlib: rename xm->xlib
    • +
    • galahad: silence warnings
    • +
    • mesa: move declaration before code
    • +
    • docs: updated GL3 status for primitive restart
    • +
    • mesa: 80-column wrapping
    • +
    • mesa: simplify fbo format checking code
    • +
    • mesa: split up the image.c file
    • +
    • mesa: add pixel packing for unscaled integer types
    • +
    • mesa: _mesa_ClearColorIuiEXT() and _mesa_ClearColorIiEXT()
    • +
    • mesa: _mesa_is_format_integer() function
    • +
    • mesa: minor reformatting, clean-ups
    • +
    • mesa: added _mesa_is_fragment_shader_active() helper
    • +
    • mesa: new glDrawPixels error check for integer formats
    • +
    • softpipe: added some texture sample debug code (disabled)
    • +
    • mesa: added new gl_extensions::EXT_gpu_shader4 field
    • +
    • mesa: added new gl_framebuffer::_IntegerColor field
    • +
    • mesa: added glGet query for GL_RGBA_INTEGER_MODE_EXT
    • +
    • mesa: compute _IntegerColor field in _mesa_test_framebuffer_completeness()
    • +
    • mesa: added cases for GL_EXT_texture_integer formats
    • +
    • mesa: added cases for GL_EXT_texture_integer
    • +
    • st/mesa: add format selection for signed/unsigned integer formats
    • +
    • mesa: simplify target_can_be_compressed() function
    • +
    • glapi: GL_EXT_texture_integer API
    • +
    • glapi: include/build EXT_texture_integer.xml
    • +
    • mesa: regenerated API files for GL_EXT_texture_integer
    • +
    • mesa: plug in GL_EXT_texture_integer functions
    • +
    • mesa: display list support for GL_EXT_texture_integer
    • +
    • st/mesa: be smarter choosing texture format for glDrawPixels()
    • +
    • softpipe: remove >32bpp color restriction
    • +
    • mesa: silence enum comparison warning
    • +
    • mesa: fix uninitialized var warning
    • +
    • xlib: silence unused var warning
    • +
    • util: use pointer_to_func() to silence warning
    • +
    • rtasm: use pointer_to_func() to silence warning
    • +
    • translate: use function typedefs, casts to silence warnings
    • +
    • translate: remove unused prototypes
    • +
    • mesa: additional glReadPixels error checks for GL_EXT_texture_integer
    • +
    • mesa: additional switch cases for GL_EXT_texture_integer
    • +
    • mesa: additional teximage error checks for GL_EXT_texture_integer
    • +
    • mesa: do integer FB / shader validation check in _mesa_valid_to_render()
    • +
    • mesa: call _mesa_valid_to_render() in glDrawPixels, glCopyPixels, glBitmap
    • +
    • mesa: remove the unused _mesa_is_fragment_shader_active() function
    • +
    • mesa: fix bug in _mesa_is_format_integer()
    • +
    • mesa: rename function to _mesa_is_format_integer_color()
    • +
    • mesa: remove 'normalized' parameter from _mesa_VertexAttribIPointer()
    • +
    • vbo: re-indent file
    • +
    • glapi: xml spec file for GL_EXT_gpu_shader4
    • +
    • glapi: include EXT_gpu_shader4.xml
    • +
    • glapi: regenerated API files
    • +
    • mesa: plug in stubs for glBindFragDataLocation(), glGetFragDataLocation()
    • +
    • mesa: add glGetUniformuiv(), plug in uint glUniform funcs
    • +
    • mesa: plug in more GL_EXT_gpu_shader4 functions
    • +
    • mesa: add new GLvertexformat entries for integer-valued attributes
    • +
    • mesa: implement integer-valued vertex attribute functions
    • +
    • mesa: add gl_client_array::Integer field and related vertex array state code
    • +
    • mesa: consolidate glVertex/Color/etcPointer() code
    • +
    • mesa: state/queries for GL_MIN/MAX_PROGRAM_TEXEL_OFFSET_EXT
    • +
    • mesa: glArrayElement support for integer-valued arrays
    • +
    • mesa: clean-up array element code
    • +
    • mesa: add extension table entry for GL_EXT_gpu_shader4
    • +
    • mesa: remove obsolete comment
    • +
    • mesa: fix incorrect type in _mesa_texstore_rgba_int16()
    • +
    • mesa: fix integer cases in _mesa_is_legal_format_and_type()
    • +
    • mesa: add const qualifier to _mesa_is_legal_format_and_type()
    • +
    • mesa: additional integer formats in _mesa_bytes_per_pixel()
    • +
    • mesa: pixel transfer ops do not apply to integer-valued textures
    • +
    • mesa: remove dead code
    • +
    • osmesa: fix renderbuffer memleak in OSMesaMakeCurrent()
    • +
    • mesa: use GLubyte for edge flag arrays
    • +
    • mesa: move the gl_config struct declaration
    • +
    • dri/util: add a bunch of comments
    • +
    • mesa: remove always-false conditional in check_compatible()
    • +
    • mesa: fix aux/accum comment and error message mixups
    • +
    • llvmpipe: assign context's frag shader pointer before using it
    • +
    • llvmpipe: add a cast
    • +
    • mesa: silence new warnings in texobj.c
    • +
    • egl/gdi: fix typo: xsurf->gsurf
    • +
    • mesa: code to unpack RGBA as uints
    • +
    • gallivm: implement scatter stores into temp register file
    • +
    • gallivm: add some LLVM var labels
    • +
    • gallivm: added debug code to dump temp registers
    • +
    • gallivm: add pixel offsets in scatter stores
    • +
    • gallivm: added lp_elem_type()
    • +
    • gallivm: implement execution mask for scatter stores
    • +
    • tgsi: remove unused function
    • +
    • llvmpipe: added some debug assertions, but disabled
    • +
    • gallivm: alloca() was called too often for temporary arrays
    • +
    • gallivm: add const qualifiers, fix comment string
    • +
    • softpipe: disable vertex texturing with draw/llvm
    • +
    • mesa: consolidate pixel packing/unpacking code
    • +
    • mesa: rename vars in pixel pack/unpack code
    • +
    • mesa: implement uint texstore code
    • +
    • mesa: remove stray GL_FLOAT case in _mesa_is_legal_format_and_type()
    • +
    • mesa: make fixed-pt and byte-valued arrays a runtime feature
    • +
    • softpipe: can't no-op depth test stage when occlusion query is enabled
    • +
    • mesa: no-op glBufferSubData() on size==0
    • +
    • mesa: #include mfeatures.h in enums.h
    • +
    • mesa: improve error message
    • +
    • mesa: add missing formats in _mesa_format_to_type_and_comps()
    • +
    • mesa: handle more pixel types in mipmap generation code
    • +
    • mesa: make glIsBuffer() return false for never bound buffers
    • +
    • mesa: fix glDeleteBuffers() regression
    • +
    • tdfx: s/Format/_BaseFormat/
    • +
    • mesa: consolidate assertions in teximage code
    • +
    • radeon: set gl_texture_image::TexFormat field in radeonSetTexBuffer2()
    • +
    • r600: set gl_texture_image::TexFormat field in r600SetTexBuffer2()
    • +
    • r200: set gl_texture_image::TexFormat field in r200SetTexBuffer2()
    • +
    • r300: set gl_texture_image::TexFormat field in r300SetTexBuffer2()
    • +
    • evergreen: set gl_texture_image::TexFormat field in evergreenSetTexBuffer()
    • +
    • st/mesa: fix glDrawPixels(depth/stencil) bugs
    • +
    • glsl: fix assorted MSVC warnings
    • +
    • mesa: add more work-arounds for acoshf(), asinhf(), atahf()
    • +
    • glsl: remove opt_constant_expression.cpp from SConscript
    • +
    • mesa: fix error messages and minor reindenting
    • +
    • mesa: whitespace cleanups
    • +
    • mesa: 80-column wrapping
    • +
    • mesa: reorder texture_error_check() params
    • +
    • mesa: minor clean-ups in context code
    • +
    • mesa: upgrade to glext.h version 66
    • +
    • mesa: pass gl_format to _mesa_init_teximage_fields()
    • +
    • mesa: fix error msg typo
    • +
    • glapi: rename GL3.xml to GL3x.xml as it covers all GL 3.x versions
    • +
    • mesa: hook up GL 3.x entrypoints
    • +
    • docs: update some GL 3.0 status
    • +
    • mesa: fix get_texture_dimensions() for texture array targets
    • +
    • swrast: init alpha value to 1.0 in opt_sample_rgb_2d()
    • +
    • glsl: fix off by one in register index assertion
    • +
    • glsl: use gl_register_file in a few places
    • +
    • mesa: rename, make _mesa_register_file_name() non-static
    • +
    • mesa: _mesa_valid_register_index() to validate register indexes
    • +
    • mesa: replace #defines with new gl_shader_type enum
    • +
    • mesa: use gl_shader_type enum
    • +
    • glsl: better handling of linker failures
    • +
    • glsl: start restoring some geometry shader code
    • +
    • mesa: add assertion and update comment in _mesa_format_image_size()
    • +
    • mesa: added _mesa_format_image_size64()
    • +
    • x11: remove test_proxy_teximage() function
    • +
    • st/mesa: fix mapping of zero-sized buffer objects
    • +
    • gallivm/llvmpipe: squash merge of the llvm-context branch
    • +
    • mesa: raise max texture sizes to 16K
    • +
    • softpipe: increase max texture size to 16K
    • +
    • mesa: replace large/MAX_WIDTH stack allocations with heap allocations
    • +
    • mesa: replace large/MAX_WIDTH stack allocations with heap allocations
    • +
    • swrast: avoid large stack allocations in blend code
    • +
    • swrast: avoid large stack allocations in tex combine code
    • +
    • st/mesa: avoid large stack allocations in readpixels code
    • +
    • mesa: replace more MAX_WIDTH stack allocations with heap allocations
    • +
    • gallivm/llvmpipe: remove lp_build_context::builder
    • +
    • gallivm: fix null builder pointers
    • +
    • mesa: fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME query
    • +
    • mesa: return GL_FRAMEBUFFER_DEFAULT as FBO attachment type
    • +
    • llvmpipe: fix broken stencil writemask
    • +
    • mesa: consolidate some compiler -D flags
    • +
    • swrast: allow GL_RG format in glDrawPixels()
    • +
    • swrast: fix indentation
    • +
    • swrast: accept GL_RG in glReadPixels()
    • +
    • swrast: restructure some glReadPixels() code
    • +
    • mesa: make glGet*(GL_NONE) generate GL_INVALID_ENUM
    • +
    • mesa: remove unneeded cast
    • +
    • mesa: update comments, remove dead code
    • +
    • st/mesa: new comment about updating state vars
    • +
    • mesa: add error margin to clip mask debug/check code
    • +
    • gallium/util: minor formatting fixes
    • +
    • mesa/llvm: use llvm-config --cppflags
    • +
    • st/mesa: fix mipmap generation bug
    • +
    • mesa: test for cube map completeness in glGenerateMipmap()
    • +
    • mesa: set gl_texture_object::_Complete=FALSE in incomplete()
    • +
    • mesa: consolidate glTexImage1/2/3D() code
    • +
    • mesa: simplify proxy texture code in texture_error_check()
    • +
    • mesa: consolidate the glTexSubImage1/2/3D() functions
    • +
    • mesa: consolidate glCopyTexImage1/2D() code
    • +
    • mesa: consolidate glCopyTexSubImage1/2/3D() functions
    • +
    • mesa: consolidate glCompressedTexImage1/2/3D() functions
    • +
    • mesa: make _mesa_test_proxy_teximage() easier to read
    • +
    • configure: use llvm-config --cppflags instead of --cflags
    • +
    • mesa: revamp error checking for compressed texture images
    • +
    • mesa: simplify target checking for TexImage functions
    • +
    • draw/llvm: don't flush in vs_llvm_delete()
    • +
    • tnl: Initialize gl_program_machine memory in run_vp.
    • +
    • tnl: a better way to initialize the gl_program_machine memory
    • +
    • mesa, st/mesa: disable GL_ARB_geometry_shader4
    • +
    • mesa/meta: fix broken assertion, rename stack depth var
    • +
    • glsl: new glsl_strtod() wrapper to fix decimal point interpretation
    • +
    • st/mesa: fix renderbuffer pointer check in st_Clear()
    • +

    + +

    Brian Rogers (1): +

      +
    • mesa: Add missing else in do_row_3D
    • +

    + +

    Chad Versace (25): +

      +
    • intel_extensions: Add ability to set GLSL version via environment
    • +
    • glsl: Add glsl_type::uvecN_type for N=2,3
    • +
    • glsl: Add lexer rules for uint and uvecN (N=2..4)
    • +
    • glsl: Changes in generated file glsl_lexer.cpp
    • +
    • glsl: Add lexer rules for << and >> in GLSL 1.30
    • +
    • glsl: Change generated file glsl_lexer.cpp
    • +
    • glsl: Implement ast-to-hir for binary shifts in GLSL 1.30
    • +
    • glsl: Implement constant expr evaluation for bitwise-not
    • +
    • glsl: Implement constant expr evaluation for bit-shift ops
    • +
    • glsl: Implement constant expr evaluation for bitwise logic ops
    • +
    • glsl: Fix ir validation for bit logic ops
    • +
    • glsl: Define shift_result_type() in ast_to_hir.cpp
    • +
    • glsl: Implement ast-to-hir for bit-shift-assignment
    • +
    • glsl: Define bit_logic_result_type() in ast_to_hir.cpp
    • +
    • glsl: Implement ast-to-hir for bit-logic ops
    • +
    • glsl: Fix lexer rule for ^=
    • +
    • glsl: Commit generated file glsl_lexer.cpp
    • +
    • glsl: Fix ast-to-hir for ARB_fragment_coord_conventions
    • +
    • mesa: Fix C++ includes in sampler.cpp
    • +
    • glsl: Fix ir_expression::constant_expression_value()
    • +
    • glsl: Fix erroneous cast in ast_jump_statement::hir()
    • +
    • glsl: Fix Doxygen tag file in recently renamed files
    • +
    • glsl: Improve usage message for glsl_compiler
    • +
    • glsl: Fix linker bug in cross_validate_globals()
    • +
    • glsl: In ast_to_hir, check sampler array indexing
    • +

    + +

    Chia-I Wu (149): +

      +
    • glapi: Fix build errors for ES.
    • +
    • glapi: Fix ES build errors again.
    • +
    • mesa: Update ES APIspec.xml.
    • +
    • st/xlib: Notify the context when the front/back buffers are swapped.
    • +
    • targets/egl: Use C++ compiler to link GL/ES state trackers.
    • +
    • libgl-xlib: Remove unused st_api_create_OpenGL.
    • +
    • st/egl: Split modeset code support to modeset.c.
    • +
    • st/egl: Rename kms backend to drm.
    • +
    • st/egl: s/kms/drm/ on the drm backend.
    • +
    • egl: Enable drm platform by default.
    • +
    • egl: Check extensions.
    • +
    • st/egl: Skip single-buffered configs in EGL.
    • +
    • mapi: Fix compiler warnings.
    • +
    • st/egl: Drop context argument from egl_g3d_get_egl_image.
    • +
    • targets/egl: Fix linking with libdrm.
    • +
    • st/vega: Fix version check in context creation.
    • +
    • egl: Use attribute names as the _EGLConfig member names.
    • +
    • egl: Access config attributes directly.
    • +
    • st/egl: Access _EGLConfig directly.
    • +
    • st/egl: Do not finish a fence that is NULL.
    • +
    • mesa: Remove unused vtxfmt_tmp.h.
    • +
    • egl_dri2: Drop the use of _egl[SG]etConfigKey.
    • +
    • egl_glx: Drop the use of [SG]ET_CONFIG_ATTRIB.
    • +
    • egl_glx: Fix borken driver.
    • +
    • egl: Move attributes in _EGLImage to _EGLImageAttribs.
    • +
    • egl: Parse image attributes with _eglParseImageAttribList.
    • +
    • egl: Move fallback routines to eglfallbacks.c.
    • +
    • egl: Drop dpy argument from the link functions.
    • +
    • egl: Minor changes to the _EGLConfig interface.
    • +
    • egl: Minor changes to the _EGLScreen interface.
    • +
    • egl: Fix _eglModeLookup.
    • +
    • st/egl: Fix native_mode refresh mode.
    • +
    • egl: Add reference count for resources.
    • +
    • egl: Use reference counting to replace IsLinked or IsBound.
    • +
    • egl: Fix a false negative check in _eglCheckMakeCurrent.
    • +
    • st/egl: Use resource reference count for egl_g3d_sync.
    • +
    • egl_dri2: Fix a typo that make glFlush be called at wrong time.
    • +
    • glapi: Do not use glapidispatch.h.
    • +
    • glapi: Move glapidispatch.h to core mesa.
    • +
    • glapi: Do not use glapioffsets.h.
    • +
    • glapi: Merge glapioffsets.h into glapidispath.h.
    • +
    • vbo: Use CALL_* macros.
    • +
    • mesa: Remove unnecessary glapitable.h includes.
    • +
    • autoconf: Better client API selection.
    • +
    • docs: Update egl and openvg docs.
    • +
    • autoconf: Update configuration info.
    • +
    • Merge branch 'glapi-reorg'
    • +
    • targets: Add missing quotes to Makefile.xorg.
    • +
    • autoconf: st/vega requires --enable-openvg.
    • +
    • st/mesa: Unreference the sampler view in st_bind_surface.
    • +
    • autoconf: Tidy configure output for EGL.
    • +
    • targets/egl: Fix a warning with --disable-opengl build.
    • +
    • egl: Rework _eglGetSearchPath.
    • +
    • mesa: Select FEATURE_remap_table when multiple APIs are enabled.
    • +
    • mesa: Allow contexts of different APIs to coexist.
    • +
    • egl: Set up the pthread key even TLS is used.
    • +
    • st/egl: Add native_surface::present callback.
    • +
    • st/egl: Use native_surface::present callback.
    • +
    • d3d1x: Use native_surface::present.
    • +
    • st/egl: Remove flush_frontbuffer and swap_buffers.
    • +
    • st/egl: Add support for swap interval and swap behavior.
    • +
    • st/egl: Add support for EGL_MATCH_NATIVE_PIXMAP.
    • +
    • st/egl: Add extern "C" wrapper to native.h.
    • +
    • st/egl: Add native_display_buffer interface.
    • +
    • st/egl: Use native_display_buffer for EGL_MESA_drm_image.
    • +
    • autoconf: Add --enable-gallium-egl.
    • +
    • docs: Update egl docs.
    • +
    • st/dri: Add support for surfaceless current contexts.
    • +
    • egl_dri2: Fix __DRI_DRI2 version 1 support.
    • +
    • st/vega: Do not wait NULL fences.
    • +
    • gallium: Add st_api::name.
    • +
    • gallium: Add st_context_iface::share to st_api.
    • +
    • st/wgl: Use st_context_iface::share for DrvShareLists.
    • +
    • st/glx: Replace MESA_VERSION_STRING by xmesa_get_name.
    • +
    • mesa: Clean up core.h.
    • +
    • scons: Define IN_DRI_DRIVER.
    • +
    • tgsi: Add STENCIL to text parser.
    • +
    • st/vega: vegaLookupSingle should validate the state.
    • +
    • st/vega: Set wrap_r for mask and blend samplers.
    • +
    • st/vega: Fix vgReadPixels with a subrectangle.
    • +
    • egl_dri2: Fix one context, multiple surfaces.
    • +
    • auxiliary: util_blit_pixels_tex should restore the viewport.
    • +
    • st/vega: Fix a crash with empty paths.
    • +
    • st/vega: Masks and surfaces should share orientation.
    • +
    • st/vega: No flipping in vg_prepare_blend_surface.
    • +
    • st/vega: Fix a typo in EXTENDED_BLENDER_OVER_FUNC.
    • +
    • llvmpipe: Fix build errors on x86.
    • +
    • st/vega: Overhaul renderer with renderer states.
    • +
    • st/vega: Add DRAWTEX renderer state.
    • +
    • st/vega: Add SCISSOR renderer state.
    • +
    • st/vega: Add CLEAR renderer state for vgClear.
    • +
    • st/vega: Add FILTER renderer state for image filtering.
    • +
    • st/vega: Use the renderer for vgMask.
    • +
    • st/vega: Add POLYGON_STENCIL and POLYGON_FILL renderer state.
    • +
    • st/vega: Delay fb state update to vg_validate_state.
    • +
    • st/vega: Use st_framebuffer for fb width/height.
    • +
    • st/vega: Move g3d states to renderer.
    • +
    • st/vega: Make shader_bind call into the renderer.
    • +
    • st/vega: vg_manager should care about only the color buffer.
    • +
    • st/vega: Clean up vg_context fields and functions.
    • +
    • st/vega: Clean up renderer fields and functions.
    • +
    • st/vega: vg_copy_texture and vg_copy_surface should share code.
    • +
    • st/vega: Get rid of renderer_copy_texture.
    • +
    • st/vega: Update to latest headers.
    • +
    • st/vega: Fix image sampler views for alpha-only formats.
    • +
    • st/vega: Make path_render and path_stroke take a matrix.
    • +
    • st/vega: Make image_draw take a matrix.
    • +
    • st/vega: Add primitive text support.
    • +
    • st/vega: Revive mask layer support.
    • +
    • st/vega: More flexible shader selection.
    • +
    • st/vega: Add color transformation support.
    • +
    • st/vega: Bump version to 1.1.
    • +
    • st/vega: Fix paint coordinates transformations.
    • +
    • st/vega: Fix negated logic in image_draw.
    • +
    • st/vega: Fix degenerate paints.
    • +
    • st/vega: Simplify radial gradient.
    • +
    • st/vega: Remove st_inlines.h.
    • +
    • st/vega: Delay blend texture creation until needed.
    • +
    • st/vega: Create drawing surface mask as needed.
    • +
    • st/vega: Initialize pipe states with renderer.
    • +
    • st/vega: Avoid unnecessary constant bufer upload.
    • +
    • st/vega: Destroy the pipe context with vg_context.
    • +
    • st/vega: polygon_array requires a deep free.
    • +
    • st/egl: Set pipe_resource::array_size to 1.
    • +
    • st/vega: Set pipe_resource::array_size to 1.
    • +
    • st/vega: Move vertex transformation to shader.
    • +
    • st/vega: Add a missing break.
    • +
    • st/vega: Add some comments to pipeline shaders.
    • +
    • st/vega: Refactor blend shaders.
    • +
    • st/vega: Move masking after blending.
    • +
    • st/vega: Add support for per-channel alpha.
    • +
    • st/vega: Blending should use premultiplied alpha.
    • +
    • st/vega: Fix VG_BLEND_MULTIPLY.
    • +
    • st/vega: Add blend shaders for all blend modes.
    • +
    • st/vega: Fix pipe blend state for various blend modes.
    • +
    • egl: _eglFilterArray should not allocate.
    • +
    • mapi: Rewrite mapi_abi.py to get rid of preprocessor magic.
    • +
    • vbo: Drop second ATTR macro.
    • +
    • vbo: Fix GLES2 glVertexAttrib.
    • +
    • mesa: Do not advertise GL_OES_texture_3D.
    • +
    • mesa: Fix GL_FIXED arrays.
    • +
    • mesa: Fix glTexCoordPointer with type GL_FIXED.
    • +
    • st/egl: Plug pbuffer leaks.
    • +
    • st/egl: Fix eglCopyBuffers.
    • +
    • st/egl: Assorted fixes for dri2_display_get_configs.
    • +
    • docs/egl: Update egl.html.
    • +
    • st/egl: Fix eglChooseConfig when configs is NULL.
    • +
    • docs: Add an example for EGL_DRIVERS_PATH.
    • +
    • autoconf: Fix --with-driver=xlib --enable-openvg.
    • +

    + +

    Chris Wilson (2): +

      +
    • i915g: Fix closure of full batch buffers
    • +
    • intel: Check for unsupported texture when finishing using as a render target
    • +

    + +

    Christoph Bumiller (80): +

      +
    • nv50: import new compiler
    • +
    • nouveau: update nouveau_class.h
    • +
    • nv50: introduce the big formats table
    • +
    • nv50: don't produce MOV immediate to output reg in store opt
    • +
    • nv50: change back accidentally swapped UNORM,SNORM vertex type
    • +
    • nv50: add/fix some license headers
    • +
    • nv50: simple reload elimination and local CSE
    • +
    • nv50: fix constant_operand opt mul by 2 case
    • +
    • nv50: permit usage of undefined TGSI TEMPs
    • +
    • nv50: add missing 2nd source for POW multiplication
    • +
    • nv50: add signed RGTC1 to format table, allow 2_10_10_10 for vbufs
    • +
    • nv50: fix for empty BBs
    • +
    • nv50: insert MOVs also for PHI sources from dominating block
    • +
    • nv50: explicitly set src type for SET ops
    • +
    • nv50: fixes for nested IFs
    • +
    • nv50: don't eliminate loads to dedicated values
    • +
    • nv50: fix constbuf validation
    • +
    • nv50: build proper phi functions in the first place
    • +
    • nv50: fix reg count
    • +
    • nv50: begin implementing loops
    • +
    • nv50: more constant folding
    • +
    • nv50: loops part 2
    • +
    • nv50: flatten simple IF/ELSE/ENDIF constructs
    • +
    • nv50: fix thinko in store to output reg possible check
    • +
    • nv50: generate JOINs for outermost IF clauses
    • +
    • nv50: more TGSI opcodes (SIN, SCS, ARL, RET, KILP)
    • +
    • nv50: fix PSIZ and PRIMID mapping
    • +
    • nv50: check dst compatibility in CSE
    • +
    • nv50: initialize edgeflag input index
    • +
    • nv50: emit predicate for interp
    • +
    • Merge remote branch 'origin/master' into nv50-compiler
    • +
    • nv50: DP2, fix ARL
    • +
    • nv50: yet another case we need a nop.exit
    • +
    • nv50: fix check for sprite/point coord enable
    • +
    • nv50: handle TEXTURE_SWIZZLE and GEOMETRY_SHADER4 caps
    • +
    • nv50: set the FragDepth output index
    • +
    • nv50: turn off verbose debug output by default
    • +
    • nv50: attempt at making more complicated loops work
    • +
    • nv50: SSG
    • +
    • nv50: make FrontFacing -1 or +1
    • +
    • nv50: re-add proper TEXBIAS sequence
    • +
    • nv50: make use of TGSI immediate type
    • +
    • nv50: must join SELECT inputs before MOV inputs
    • +
    • nv50: fix XPD, was negated
    • +
    • nv50: fix find_dom_frontier
    • +
    • nv50: fix build-predicate function
    • +
    • Merge remote branch 'origin/master' into nv50-compiler
    • +
    • nv50: load address register before using it, not after
    • +
    • nv50: save tgsi instructions
    • +
    • nv50: prepare for having multiple functions
    • +
    • nv50: don't parse again in tgsi_2_nc
    • +
    • nv50: use actual loads/stores if TEMPs are accessed indirectly
    • +
    • nv50: create value references with the right type
    • +
    • nv50: duplicate interps in load_proj_tex_coords
    • +
    • nv50: address regs are 16 bit
    • +
    • nv50: fix can_load check for 3rd source
    • +
    • nv50: reduce bb_reachable_by runtime from pot to linear
    • +
    • nv50: minor compiler fixes and cleanups
    • +
    • nv50: cannot move from local mem to output reg directly
    • +
    • nv50: newlines in shader bincode printing
    • +
    • nv50: match TEMP limit with nv50 ir builder
    • +
    • nv50: handle TGSI EXP and LOG again
    • +
    • nv50: check for immediates when turning MUL ADD into MAD
    • +
    • nv50: interp cannot write flags reg
    • +
    • nv50: MOV TEMP[0], -CONST[0] must be float32 negation
    • +
    • nv50: fix indirect CONST access with large or negative offsets
    • +
    • nv50: fix TXP depth comparison value
    • +
    • nv50: consider address register in reload elimination
    • +
    • nv50: improve and fix modifier folding optimization
    • +
    • nv50: put low limit on REG_ALLOC_TEMP and FP_RESULT_COUNT
    • +
    • Merge remote branch 'origin/nv50-compiler'
    • +
    • nv50: don't segfault on shaders with 0 instructions
    • +
    • nv50: get shader fixups/relocations into working state
    • +
    • nv50: add relocs for stack and local mem buffers
    • +
    • nv50: emit constbuf relocs before uploading constants
    • +
    • nv50: fix typo in fifo packet length limit
    • +
    • nv50: use formats table in nv50_surface.c
    • +
    • nv50: use CLEAR_BUFFERS for surface fills
    • +
    • nv50: fix/handle a few more PIPE_CAPs
    • +
    • nv50: fix GP state bind and validate
    • +

    + +

    Corbin Simpson (8): +

      +
    • r600g: Use align() instead of handrolled code.
    • +
    • r600g: Trivially deobfuscate r600_hw_states.
    • +
    • r600g: Deobfuscate and comment a few more functions in r600_hw_states.
    • +
    • r600g: Clean up some indentation and |= vs. | usage.
    • +
    • r600g: Fix false and true.
    • +
    • r600g: "tmp" is such a bad name for a texture.
    • +
    • r600g: Clean up PS setup.
    • +
    • r600g: Cleanup viewport floats.
    • +

    + +

    Daniel Lichtenberger (1): +

      +
    • radeon: fix potential segfault in renderbuffer update
    • +

    + +

    Daniel Vetter (21): +

      +
    • r200: revalidate after radeon_update_renderbuffers
    • +
    • i915g: rip out ->sw_tiled
    • +
    • i915g: s/hw_tiled/tiling
    • +
    • i915g: add pineview pci ids
    • +
    • i915g: kill RGBA/X formats
    • +
    • i915g: kill buf->map_gtt
    • +
    • i915g: kill idws->pool
    • +
    • i915g: drop alignment parameter from iws->buffer_create
    • +
    • i915g: add winsys function to create tiled buffers
    • +
    • i915g: switch to tiled allocations, kill set_fence
    • +
    • i915g: prepare winsys/batchbuffer for execbuf2
    • +
    • i915g: return tiling in iws->buffer_from_handle
    • +
    • i915g: implement unfenced color&depth buffer using tiling bits
    • +
    • i915g: implement unfenced relocs for textures using tiling bits
    • +
    • i915g: postpone mipmap/face offset calculation
    • +
    • i915g: don't pot-align stride for tiled buffers
    • +
    • i915g: enable X-tiling for textures
    • +
    • i915g: switch rendering to mipmapped textures to (x,y) offsets
    • +
    • i915g: enable x-tiling for render targets
    • +
    • i915g: assert(depth_surface->offset == 0)
    • +
    • i915g: track TODO items
    • +

    + +

    Dave Airlie (182): +

      +
    • r300g: fix buffer reuse issue caused by previous commit
    • +
    • r600g: pull r600_draw struct out into header
    • +
    • r600g: use index min/max + index buffer offset.
    • +
    • r600g: add vgt dma src defines
    • +
    • r600g: fixup texture state on evergreen.
    • +
    • r600g: fix texture bos and avoid doing depth blit on evergreen
    • +
    • r600g: hide radeon_ctx inside winsys.
    • +
    • r600g: attempt to abstract kernel bos from pipe driver.
    • +
    • r600g: move constant buffer creation behind winsys abstraction.
    • +
    • r600g: use malloc bufmgr for constant buffers
    • +
    • r600g: add support for kernel bo
    • +
    • r600g: add winsys bo caching.
    • +
    • r600g: add upload manager support.
    • +
    • r600g: fixup map flushing.
    • +
    • r600g: use calloc for ctx bo allocations
    • +
    • r600g: oops got the use_mem_constant the wrong way around.
    • +
    • r600g; add uses waterfall to asm cf for r6xx.
    • +
    • r600g: only emit uses waterfall on r6xx hw.
    • +
    • util/r300g: split the r300 index buffer modifier functions out to util
    • +
    • r600g: modify index buffers for sizes the hw can't deal with.
    • +
    • r600g: send correct surface base update for multi-cbufs
    • +
    • r600g: fix fbo-drawbuffers-maxtargets
    • +
    • r600g: clean up valgrind issues on maxtargets test.
    • +
    • r600g: drop debugging that snuck in
    • +
    • r600g: fix tiling support for ddx supplied buffers
    • +
    • r600g: add z16 to color setup
    • +
    • r600g: add color/texture support for more depth formats.
    • +
    • r600g: fix r700 cube map sizing.
    • +
    • r600g: fixup r700 CB_SHADER_CONTROL register.
    • +
    • r600g: add missing BC_INST wrapper for evergreen
    • +
    • r600g: only flush for the correct colorbuffer, not all of them.
    • +
    • r600g: deal with overflow of VTX/TEX CF clauses.
    • +
    • r600g: set back to correct codepaths.
    • +
    • r600g: fixup evergreen miptree setup.
    • +
    • r600g: fix eg texture borders.
    • +
    • r600g: fix typo in struct member name
    • +
    • r600g: cleanup some of the DB blit code
    • +
    • r600g: make stencil readback work
    • +
    • r600g: disable dirty handling on texture from depth code.
    • +
    • r600g: use floats instead of hex for blit vbo
    • +
    • r600g: fix depth readback on rv610 and other quirky variants.
    • +
    • r600g: fix typo in evergreen register list
    • +
    • u_blitter: add a custom blitter call passing a dsa cso
    • +
    • r600g: use blitter to do db->cb flushing.
    • +
    • r600g: fix warnings since last commit.
    • +
    • egl: fix build since 17eace581d25a626a7d75d9d1205d012cbb14a6e
    • +
    • r300g: fix point sprite coord.
    • +
    • r600g: add vert support for 16/16 and 16/16/16 floats.
    • +
    • r600g: add some more vertex format support.
    • +
    • r600g: some more vertex formats
    • +
    • r600g: fix draw-elements and draw-elements-base-vertex
    • +
    • r600g: drop index_offset parameter to index buffer translate.
    • +
    • r600g: fixup tex wrapping.
    • +
    • r600g: fixup VP->FP output->input routing.
    • +
    • r600g: fix typo in r700 alu emit
    • +
    • r600g: fixup sprite coord enable.
    • +
    • r600g: fix polygon mode
    • +
    • mesa/mipmap: fix warning since 1acadebd6270d3604b026842b8a21360968618a0
    • +
    • r600g: add eg poly mode code.
    • +
    • r600g: make index bias fix for evergreen
    • +
    • r600g: add eg db count control register.
    • +
    • r300g: fix glsl-fs-pointcoord
    • +
    • r600g: add evergreen texture resource properly.
    • +
    • r600g: fix db flush breaking config state
    • +
    • r600g: on evergreen the centroid isn't set in this register.
    • +
    • r600g: add back evergreen name.
    • +
    • r600g: add evergreen texture border support to new path
    • +
    • r600g: move radeon.h members around to add back map flushing.
    • +
    • r600g: add initial vertex translate support.
    • +
    • r600g: remove old assert from new codepath
    • +
    • Revert "r600g: add initial vertex translate support."
    • +
    • r600g: port r300g fix for X* formats in texformat code
    • +
    • r600g: add L8A8 unorm.
    • +
    • r600g: clean up some code from move to new paths.
    • +
    • r600g: return string for chip family
    • +
    • r600g: use Elements macro instead of manual sizeofs
    • +
    • r600g: fix evergreen depth flushing.
    • +
    • r600g: add winsys support for CTL constants.
    • +
    • r600g: drop depth quirk on evergreen
    • +
    • r600g: add reloc for evergreen color attrib
    • +
    • r600g: realign evergreen code with r600 code.
    • +
    • r600g: add assembler support for other vtx fetch fields.
    • +
    • r600g: fixup vertex format picking.
    • +
    • r600g: sync vertex/texture cache on resources on evergreen
    • +
    • r600g: add cb flushing for extra buffers + depth buffer on r600/evergreen
    • +
    • r600g: fix evergreen draw-buffers
    • +
    • r600g: flush SH cache on constant change on evergreen
    • +
    • r600g: only set the Z export if shader exports it.
    • +
    • r600g: setup basic loop consts on r600 + evergreen.
    • +
    • mesa/st: initial attempt at RG support for gallium drivers
    • +
    • r600g: break out of search for reloc bo after finding it.
    • +
    • r600g: the code to check whether a new vertex shader is needed was wrong
    • +
    • r600g: fix wwarning in bo_map function
    • +
    • r600g: TODO domain management
    • +
    • r600g: add bo fenced list.
    • +
    • pb: don't keep checking buffers after first busy
    • +
    • r600g: add bo busy backoff.
    • +
    • r600g: drop mman allocator
    • +
    • r600g: drop use_mem_constant.
    • +
    • r600g: avoid unneeded bo wait
    • +
    • pb: fix numDelayed accounting
    • +
    • r600g: add evergreen stencil support.
    • +
    • r600g: use format from the sampler view not from the texture.
    • +
    • r600g: fix Z export enable bits.
    • +
    • r600g: add some RG texture format support.
    • +
    • r600g: drop width/height per level storage.
    • +
    • r600g: fix input/output Z export mixup for evergreen.
    • +
    • r600g: evergreen has no request size bit in texture word4
    • +
    • r600g: enable vertex samplers.
    • +
    • r600g: add TXL opcode support.
    • +
    • r600g: don't run with scissors.
    • +
    • r600g: fix typo in vertex sampling on r600
    • +
    • gallium/tgsi: add support for stencil writes.
    • +
    • gallium/format: add support for X24S8 and S8X24 formats.
    • +
    • gallium/format: add X32_S8X24_USCALED format.
    • +
    • gallium/util: add S8 tile sampling support.
    • +
    • mesa: add support for FRAG_RESULT_STENCIL.
    • +
    • mesa: improve texstore for 8/24 formats and add texstore for S8.
    • +
    • softpipe: add support for shader stencil export capability
    • +
    • st/mesa: add option to choose a texture format that we won't render to.
    • +
    • st/mesa: use shader stencil export to accelerate shader drawpixels.
    • +
    • r600g: add support for S8, X24S8 and S8X24 sampler formats.
    • +
    • r600g: add shader stencil export support.
    • +
    • glsl: add support for shader stencil export
    • +
    • st/mesa: enable stencil shader export extension if supported
    • +
    • r600g: fix depth0 setting
    • +
    • r600g: fix scissor/cliprect confusion
    • +
    • r600g: store samplers/views across blit when we need to modify them
    • +
    • r600g: reduce size of context structure.
    • +
    • r600g: the vs/ps const arrays weren't actually being used.
    • +
    • r600g: add copy into tiled texture
    • +
    • r600g: split out miptree setup like r300g
    • +
    • r600g: use common texture object create function
    • +
    • r600g: rename pitch in texture to pitch_in_bytes
    • +
    • r600g: remove bpt and start using pitch_in_bytes/pixels.
    • +
    • r600g: fix transfer stride.
    • +
    • r600g: drop all use of unsigned long
    • +
    • r600g: use blitter for hw copy region
    • +
    • r600g: evergreen add stencil export bit
    • +
    • r600g: add missing eg reg definition
    • +
    • r600g: fix stencil export for evergreen harder
    • +
    • r600g: drop unused context members
    • +
    • r600g: only pick centroid coordinate when asked.
    • +
    • r600g: fixup pos/face ena/address properly
    • +
    • r600g: fixup typo in macro name
    • +
    • r600g: select linear interpolate if tgsi input requests it
    • +
    • r300g: clean up warning due to unknown cap.
    • +
    • tgsi: add scanner support for centroid inputs
    • +
    • r600g: evergreen interpolation support.
    • +
    • r600g: add evergreen ARL support.
    • +
    • r600g: switch to a common formats.h file since they are in different regs
    • +
    • r600g: add defines for tiling
    • +
    • r600g: get tiling info from kernel
    • +
    • r600g: set tiling bits in hw state
    • +
    • r600g: do proper tracking of views/samplers.
    • +
    • r600g: fix typo in tiling setup cb code.
    • +
    • r600g: depth needs to bound to ds
    • +
    • r600g: attempt to cleanup depth blit
    • +
    • r600g: fix transfer function for tiling.
    • +
    • r600g: retrieve tiling info from kernel for shared buffers.
    • +
    • r600g: all non-0 mipmap levels need to be w/h aligned to POT.
    • +
    • r600g: move to per-miplevel array mode.
    • +
    • r600g: start adding hooks for aligning width/height for tiles.
    • +
    • r600g: add r600 surface to store the aligned height.
    • +
    • r600g: introduce a per-driver resource flag for transfers.
    • +
    • r600g: add texture tiling alignment support.
    • +
    • r600g: add texture tiling enable under a debug option.
    • +
    • r600g: initial translate state support
    • +
    • r600g: start splitting out common code from eg/r600.
    • +
    • r600g: not fatal if we can't get tiling info from kernel
    • +
    • r600g: merge more of the common r600/evergreen state handling
    • +
    • r600g: drop more common state handling code
    • +
    • r600g: fix magic 0x1 ->flat shade ena
    • +
    • r600g: add assembler support for all the kcache fields.
    • +
    • gallium/noop: report GL 2.1
    • +
    • r600g: pick correct color swap for A8 fbos.
    • +
    • r300g/r600g: bump cache manager timeouts to 1s
    • +
    • r600g: it looks like r600 can handle dword offsets in the indices.
    • +
    • r300g: try and use all of vertex constant space
    • +
    • r300g: fixup rs690 tiling stride alignment calculations.
    • +
    • r600g: fix evergreen segfaults.
    • +
    • r600g: hack around property unknown issues.
    • +

    + +

    Eric Anholt (300): +

      +
    • glsl: Add definition of gl_TextureMatrix inverse/transpose builtins.
    • +
    • i965: Share the KIL_NV implementation between glsl and non-glsl.
    • +
    • i965: Also enable CC statistics when doing OQs.
    • +
    • i965: Track the windowizer's dispatch for kill pixel, promoted, and OQ
    • +
    • glsl: Rework assignments with write_masks to have LHS chan count match RHS.
    • +
    • glsl: Fix copy'n'wasted ir_noop_swizzle conditions.
    • +
    • ir_to_mesa: Only compare vector_elements present for any_nequal/all_equal
    • +
    • i965: Fix the vector/expression splitting for the write_mask change.
    • +
    • i965: When splitting vector variable assignment, ignore unset channels.
    • +
    • i965: Update expression splitting for the vector-result change to compares.
    • +
    • i965: Warning fix for vector result any_nequal/all_equal change.
    • +
    • mesa: Remove the non-required ARB_imaging extension.
    • +
    • mesa: Remove EXT_histogram.
    • +
    • mesa: Remove SGI_color_table.
    • +
    • mesa: Remove SGI_color_matrix.
    • +
    • mesa: Remove EXT_convolution.
    • +
    • intel: Remove disabled stencil drawpixels acceleration.
    • +
    • intel: Remove unnecessary minimum pitch alignment to 32 bytes.
    • +
    • intel: Replace my intel_texture_bitmap code with _mesa_meta_Bitmap.
    • +
    • radeon: Remove copied minimum pitch alignment code.
    • +
    • unichrome: Mostly revert my convolution removal changes.
    • +
    • intel: Remove dead intelIsTextureResident().
    • +
    • i915: Remove a dead if (0) block.
    • +
    • intel: Dead comment removal.
    • +
    • intel: Corresponding FinishRenderTexture debug to BeginRenderTexture.
    • +
    • i965: Add support for rendering to SARGB8 FBOs.
    • +
    • intel: Fix segfault on INTEL_DEBUG=fbo with unsupported framebuffers.
    • +
    • intel: Add fallback debug to glGenerateMipmap.
    • +
    • intel: More reverting of the sw fallback for depth texture border color.
    • +
    • intel: Improve some of the miptree debugging.
    • +
    • mesa: Fix type typo in glGenerateMipmap handling of GL_UNSIGNED_INT data.
    • +
    • glsl: Fix broadcast_index of lower_variable_index_to_cond_assign.
    • +
    • glsl: Add validation that a swizzle only references valid channels.
    • +
    • i965: Fix up writemasked assignments in the new FS.
    • +
    • i965: Remove swizzling of assignment to vector-splitting single-channel LHS.
    • +
    • i965: Handle all_equal/any_nequal in the new FS.
    • +
    • i965: Fix vector splitting RHS channel selection with sparse writemasks.
    • +
    • i965: Add support for dFdx()/dFdy() to the FS backend.
    • +
    • i965: Add support for attribute interpolation on Sandybridge.
    • +
    • i965: Set up inputs to the fragment shader according to FP InputsRead.
    • +
    • i965: Add support for POW in gen6 FS.
    • +
    • i965: Fix negation in the new FS backend.
    • +
    • i965: Actually track the "if" depth in loop in the new FS backend.
    • +
    • i965: Apply the same set of lowering passes to new FS as to Mesa IR.
    • +
    • i965: Fix valgrind complaint about base_ir for new FS debugging.
    • +
    • i965: Fix up the FS backend for the variable array indexing pass.
    • +
    • i965: Set the variable type when dereferencing an array.
    • +
    • i965: Add support for dereferencing structs to the new FS backend.
    • +
    • i965: Add support for struct, array, and matrix uniforms to FS backend.
    • +
    • i965: Fix all non-snb regression in the snb attribute interpolation commit.
    • +
    • i965: Fix up part of my Sandybridge attributes support patch.
    • +
    • i965: Add support for gl_FrontFacing to the new FS backend.
    • +
    • i965: Subtract instead of adding when computing y delta in new FS backend.
    • +
    • mesa: Pull ir_to_mesa's sampler number fetcher out to shared code.
    • +
    • i965: Set up sampler numbers in the FS backend.
    • +
    • i965: Add support for non-color render target write data to new FS backend.
    • +
    • i965: Add support for MRT to the new FS backend.
    • +
    • i965: Add support for ir_loop counters to the new FS backend.
    • +
    • i965: Add support for ARB_fragment_coord_conventions to the new FS backend.
    • +
    • glsl: Also update implicit sizes of varyings at link time.
    • +
    • i965: Do interpolation for varying matrices and arrays in the FS backend.
    • +
    • i965: Don't try to emit interpolation for unused varying slots.
    • +
    • i965: Fix array indexing of arrays of matrices.
    • +
    • i965: Clean up obsolete FINISHME comment.
    • +
    • mesa: Move the list of builtin uniform info from ir_to_mesa to shared code.
    • +
    • i965: Add support for builtin uniforms to the new FS backend.
    • +
    • i965: Fix use of undefined mem_ctx in vector splitting.
    • +
    • i956: Make new FS discard do its work in a temp, not the null reg!
    • +
    • i965: Clean up the virtual GRF handling.
    • +
    • ra: First cut at a graph-coloring register allocator for mesa.
    • +
    • i965: First cut at register allocation using graph coloring.
    • +
    • i965: Add live interval analysis and hook it up to the register allocator.
    • +
    • i965: Remove my "safety counter" code from loops.
    • +
    • i965: Fix whole-structure/array assignment in new FS.
    • +
    • mesa: Don't reference a W component in setting up a vec3 uniform component.
    • +
    • i965: Fix new FS handling of builtin uniforms with packed scalars in structs.
    • +
    • glsl: Add a lowering pass for texture projection.
    • +
    • i965: Use the lowering pass for texture projection.
    • +
    • i965: Split the gen4 and gen5 sampler handling apart.
    • +
    • i965: Add gen6 attribute interpolation to new FS backend.
    • +
    • i965: Fix the gen6 jump size for BREAK/CONT in new FS.
    • +
    • i965: Also increment attribute location when skipping unused slots.
    • +
    • i965: Pre-gen6, map VS outputs (not FS inputs) to URB setup in the new FS.
    • +
    • i965: Add real support for pre-gen5 texture sampling to the new FS.
    • +
    • i965: Fix up copy'n'pasteo from moving coordinate setup around for gen4.
    • +
    • i965: Restore the forcing of aligned pairs for delta_xy on chips with PLN.
    • +
    • i965: When producing a single channel swizzle, don't make a temporary.
    • +
    • i965: Add a sanity check for register allocation sizes.
    • +
    • i965: Fix off-by-ones in handling the last members of register classes.
    • +
    • i965: Don't try to emit code if we failed register allocation.
    • +
    • i965: Add support for EXT_texture_swizzle to the new FS backend.
    • +
    • i965: Set up swizzling of shadow compare results for GL_DEPTH_TEXTURE_MODE.
    • +
    • i965: Fix glean/texSwizzle regression in previous commit.
    • +
    • i965: Be more conservative on live interval calculation.
    • +
    • i965: Add trivial dead code elimination in the new FS backend.
    • +
    • i965: Add initial folding of constants into operand immediate slots.
    • +
    • i965: In disasm, gen6 fb writes don't put msg reg # in destreg_conditionalmod.
    • +
    • i965: Add support for gen6 FB writes to the new FS.
    • +
    • i965: Enable the constant propagation code.
    • +
    • i965: Also do constant propagation for the second operand of CMP.
    • +
    • i965: Add back gen6 headerless FB writes to the new FS backend.
    • +
    • i965: Gen6 no longer has the IFF instruction; always use IF.
    • +
    • i965: Fix up IF/ELSE/ENDIF for gen6.
    • +
    • i965: Fix botch in the header_present case in the new FS.
    • +
    • i965: Add some clarification of the WECtrl field.
    • +
    • i965: Don't do 1/w multiplication in new FS for gen6
    • +
    • i965: Gen6's sampler messages are the same as Ironlake.
    • +
    • i965: Refactor gl_FrontFacing setup out of general variable setup.
    • +
    • i965: Add support for gl_FrontFacing on gen6.
    • +
    • i965: Don't assume that WPOS is always provided on gen6 in the new FS.
    • +
    • i965: Fix gen6 pointsize handling to match pre-gen6.
    • +
    • i965: Disable emitting if () statements on gen6 until we really fix them.
    • +
    • i965: Normalize cubemap coordinates like is done in the Mesa IR path.
    • +
    • mesa: Simplify a bit of _mesa_add_state_reference using memcmp.
    • +
    • i965: Drop the check for duplicate _mesa_add_state_reference.
    • +
    • i965: Drop the check for YUV constants in the param list.
    • +
    • i965: Handle swizzles in the addition of YUV texture constants.
    • +
    • i965: Fix gen6 WM push constants updates.
    • +
    • i965: Fix new FS gen6 interpolation for sparsely-populated arrays.
    • +
    • i965: Enable attribute swizzling (repositioning) in the gen6 SF.
    • +
    • i965: Add register coalescing to the new FS backend.
    • +
    • i965: Split FS_OPCODE_DISCARD into two steps.
    • +
    • i965: Reduce register interference checks for changed FS_OPCODE_DISCARD.
    • +
    • i965: Move FS backend structures to a header.
    • +
    • i965: Give the math opcodes information on base mrf/mrf len.
    • +
    • i965: Give the FB write and texture opcodes the info on base MRF, like math.
    • +
    • i965: Compute to MRF in the new FS backend.
    • +
    • i965: Don't consider gen6 math instructions to write to MRFs.
    • +
    • i965: Add a couple of checks for gen6 math instruction limits.
    • +
    • i965: Don't compute-to-MRF in gen6 math instructions.
    • +
    • i965: Expand uniform args to gen6 math to full registers to get hstride == 1.
    • +
    • i965: Don't compute-to-MRF in gen6 VS math.
    • +
    • i965: Fix gen6 pixel_[xy] setup to avoid mixing int and float src operands.
    • +
    • i965: Always use the new FS backend on gen6.
    • +
    • i965: Fix missing "break;" in i2b/f2b, and missing AND of CMP result.
    • +
    • intel: Allow CopyTexSubImage to InternalFormat 3/4 textures, like RGB/RGBA.
    • +
    • i965: Don't rebase the index buffer to min 0 if any arrays are in VBOs.
    • +
    • i965: Add support for rescaling GL_TEXTURE_RECTANGLE coords to new FS.
    • +
    • i965: Set class_sizes[] for the aligned reg pair class.
    • +
    • i965: Update the live interval when coalescing regs.
    • +
    • i965: Add a pass to the FS to split virtual GRFs to float channels.
    • +
    • i965: Add a function for handling the move of boolean values to flag regs.
    • +
    • i965: Add peepholing of conditional mod generation from expressions.
    • +
    • i965: Enable the new FS backend on pre-gen6 as well.
    • +
    • i965: Fix texturing on pre-gen5.
    • +
    • i965: Set the type of the null register to fix gen6 FS comparisons.
    • +
    • i965: Disable the debug printf I added for FS disasm.
    • +
    • i965: Fix a weirdness in NOT handling.
    • +
    • i965: Fix assertion failure on gen6 BufferSubData to busy BO.
    • +
    • i965: Assert out on gen6 VS constant buffer reads that hang the GPU for now.
    • +
    • i965: Fix scissor-offscreen on gen6 like we did pre-gen6.
    • +
    • i965: Avoid blits in BufferCopySubdata on gen6.
    • +
    • i965: Tell the shader compiler when we expect depth writes for gen6.
    • +
    • i965: Remove the gen6 emit_mi_flushes I sprinkled around the driver.
    • +
    • i965: Disable thread dispatch when the FS doesn't do any work.
    • +
    • i965: Add EU emit support for gen6's new IF instruction with comparison.
    • +
    • i965: Set the source operand types for gen6 if/else/endif to integer.
    • +
    • i965: Use the new style of IF statement with embedded comparison on gen6.
    • +
    • i965: Split register allocation out of the ever-growing brw_fs.cpp.
    • +
    • i965: Fix gl_FrontFacing emit on pre-gen6.
    • +
    • i965: Add support for register spilling.
    • +
    • i965: Don't emit register spill offsets directly into g0.
    • +
    • i965: Correct scratch space allocation.
    • +
    • i965: Be more aggressive in tracking live/dead intervals within loops.
    • +
    • i965: Move the FS disasm/annotation printout to codegen time.
    • +
    • i965: Add support for pull constants to the new FS backend.
    • +
    • i965: Add EU code for dword scattered reads (constant buffer array indexing).
    • +
    • i965: Clarify an XXX comment in FB writes with real info.
    • +
    • i965: Use SENDC on the first render target write on gen6.
    • +
    • i965: Clear some undefined fields of g0 when using them for gen6 FB writes.
    • +
    • i965: Add disasm for the flag register.
    • +
    • i965: Add support for discard instructions on gen6.
    • +
    • i965: Handle new ir_unop_round_even in channel expression splitting.
    • +
    • i965: Fix typo in comment about state flags.
    • +
    • i965: Set up the constant buffer on gen6 when it's needed.
    • +
    • i965: Add support for constant buffer loads on gen6.
    • +
    • i965: Drop the eot argument to read messages, which can never be set.
    • +
    • i965: Fix VS URB entry sizing.
    • +
    • i965: Disable register spilling on gen6 until it's fixed.
    • +
    • i965: Make FS uniforms be the actual type of the uniform at upload time.
    • +
    • i965: Add user clip planes support to gen6.
    • +
    • i965: Update gen6 SF state when point state (sprite or attenuation) changes.
    • +
    • i965: Upload required gen6 VS push constants even when using pull constants.
    • +
    • i965: Update the gen6 stencil ref state when stencil state changes.
    • +
    • mesa: Make metaops use program refcounts instead of names.
    • +
    • mesa: Don't compute an unused texture completeness debug string.
    • +
    • intel: For batch, use GTT mapping instead of writing to a malloc and copying.
    • +
    • intel: Annotate debug printout checks with unlikely().
    • +
    • intel: Remove the magic unaligned memcpy code.
    • +
    • i965: Remove dead intel_structs.h file.
    • +
    • intel: Avoid taking logbase2 of several things that we max.
    • +
    • intel: Remove duplicated teximage miptree to object miptree promotion.
    • +
    • intel: Remove leftover dri1 locking fields in the context.
    • +
    • mesa: Fix delayed state flagging for EXT_sso-related program changes.
    • +
    • intel: Fix the client-side swapbuffers throttling.
    • +
    • Revert "intel: Fix the client-side swapbuffers throttling."
    • +
    • i965: Allow OPCODE_SWZ to put immediates in the first arg.
    • +
    • i965: Add support for math on constants in gen6 brw_wm_glsl.c path.
    • +
    • i965: Work around strangeness in swizzling/masking of gen6 math.
    • +
    • i965: re-enable gen6 IF statements in the fragment shader.
    • +
    • glsl: Free the loop state context when we free the loop state.
    • +
    • i965: Fix gl_FragCoord inversion when drawing to an FBO.
    • +
    • i965: Shut up spurious gcc warning about GLSL_TYPE enums.
    • +
    • mesa: Don't spam the console in a debug build unless some spam is requested.
    • +
    • i965: Add state dumping for sampler state.
    • +
    • i965: Add dumping of the sampler default color.
    • +
    • i965: Fail on loops on gen6 for now until we write the EU emit code for it.
    • +
    • i965: Eliminate dead code more aggressively.
    • +
    • mesa: Include C++ files in the makedepend of DRI drivers.
    • +
    • i965: Fix compute_to_mrf to not move a MRF write up into another live range.
    • +
    • i965: Just use memset() to clear most members in FS constructors.
    • +
    • i965: Remove extra n at the end of every instruction in INTEL_DEBUG=wm.
    • +
    • i965: Fold constants into the second arg of BRW_SEL as well.
    • +
    • glsl: Add a helper function for determining if an rvalue could be a saturate.
    • +
    • i965: Recognize saturates and turn them into a saturated mov.
    • +
    • ir_to_mesa: Detect and emit MOV_SATs for saturate constructs.
    • +
    • i965: Improve compute-to-mrf.
    • +
    • i965: Remove duplicate MRF writes in the FS backend.
    • +
    • i965: Move gen4 blend constant color to the gen4 blending file.
    • +
    • i965: Don't upload polygon stipple unless required.
    • +
    • i965: Don't upload line stipple pattern unless we're stippling.
    • +
    • i965: Don't upload line smooth params unless we're line smoothing.
    • +
    • i965: Use the new embedded compare in SEL on gen6 for VS MIN and MAX opcodes.
    • +
    • i965: Fix type of gl_FragData[] dereference for FB write.
    • +
    • glsl: Make the symbol table's add_function just use the function's name.
    • +
    • glsl: Make the symbol table's add_variable just use the variable's name.
    • +
    • glsl: Add a helper constructor for expressions that works out result type.
    • +
    • glsl: Fix structure and array comparisions.
    • +
    • glsl: Quiet unreachable no-return-from-function warning.
    • +
    • i965: Dump the WHILE jump distance on gen6.
    • +
    • i965: Add support for gen6 DO/WHILE ISA emit.
    • +
    • i965: Add support for gen6 BREAK ISA emit.
    • +
    • i965: Add support for gen6 CONTINUE instruction emit.
    • +
    • i965: Enable IF statements in the VS.
    • +
    • i965: Add support for loops in the VS.
    • +
    • glsl: Mark the array access for whole-array comparisons.
    • +
    • glsl: Fix flipped return of has_value() for array constants.
    • +
    • mesa: Add getters for the rest of the supported draw buffers.
    • +
    • mesa: Add getters for ARB_copy_buffer's attachment points.
    • +
    • intel: Add an env var override to execute for a different GPU revision.
    • +
    • i965: Update gen6 WM state on compiled program change, not just FP change.
    • +
    • i965: Update gen6 SF state on fragment program change too.
    • +
    • i965: Fix compile warning about missing opcodes.
    • +
    • i965: Move payload reg setup to compile, not lookup time.
    • +
    • i965: Provide delta_xy reg to gen6 non-GLSL path PINTERP.
    • +
    • i965: Fix up 16-wide gen6 FB writes after various refactoring.
    • +
    • i965: Don't smash a group of coordinates doing gen6 16-wide sampler headers.
    • +
    • i965: Fix gen6 interpolation setup for 16-wide.
    • +
    • i965: Fix up gen6 samplers for their usage by brw_wm_emit.c
    • +
    • i965: Make the sampler's implied move on gen6 be a raw move.
    • +
    • i965: Align gen6 push constant size to dispatch width.
    • +
    • i965: Add support for the instruction compression bits on gen6.
    • +
    • i965: Nuke brw_wm_glsl.c.
    • +
    • i965: Remove INTEL_DEBUG=glsl_force now that there's no brw_wm_glsl.c
    • +
    • i965: Fix comment about gen6_wm_constants.
    • +
    • i965: Handle saturates on gen6 math instructions.
    • +
    • i965: Always hand the absolute value to RSQ.
    • +
    • i965: Add disabled debug code for dumping out the WM constant payload.
    • +
    • i965: Work around gen6 ignoring source modifiers on math instructions.
    • +
    • i965: Fix flipped value of the not-embedded-in-if on gen6.
    • +
    • i965: Don't try to store gen6 (float) blend constant color in bytes.
    • +
    • i965: Set up the color masking for the first drawbuffer on gen6.
    • +
    • i965: Set up the per-render-target blend state on gen6.
    • +
    • i965: Set the render target index in gen6 fixed-function/ARB_fp path.
    • +
    • i965: Use the new pixel mask location for gen6 ARB_fp KIL instructions.
    • +
    • i965: Drop KIL_NV from the ff/ARB_fp path since it was only used for GLSL.
    • +
    • i965: Drop push-mode reladdr constant loading and always use constant_map.
    • +
    • i965: Fix VS constants regression pre-gen6.
    • +
    • i965: Clean up VS constant buffer location setup.
    • +
    • i965: Set up the correct texture border color state struct for Ironlake.
    • +
    • i965: Set render_cache_read_write surface state bit on gen6 constant surfs.
    • +
    • i965: remove unused variable since brw_wm_glsl.c removal.
    • +
    • intel: Use plain R8 and RG8 for COMPRESSED_RED and COMPRESSED_RG.
    • +
    • intel: Set the swizzling for depth textures using the GL_RED depth mode.
    • +
    • glsl: Correct the marking of InputsRead/OutputsWritten on in/out matrices.
    • +
    • i965: Correct the dp_read message descriptor setup on g4x.
    • +
    • intel: Include stdbool so we can stop using GLboolean when we want to.
    • +
    • i965: Fix ARL to work on gen6.
    • +
    • i956: Fix the old FP path fragment position setup on gen6.
    • +
    • i965: Fix gl_FragCoord.z setup on gen6.
    • +
    • i965: Add support for using the BLT ring on gen6.
    • +
    • intel: Update renderbuffers before looking up CopyTexImage's read buffer.
    • +
    • intel: Drop commented intel_flush from copy_teximage.
    • +
    • intel: Try to sanely check that formats match for CopyTexImage.
    • +
    • intel: Support glCopyTexImage() from XRGB8888 to ARGB8888.
    • +
    • i965: Avoid using float type for raw moves, to work around SNB issue.
    • +
    • i965: Set the alternative floating point mode on gen6 VS and WM.
    • +
    • i965: Add support for gen6 constant-index constant loading.
    • +
    • i965: Add support for gen6 reladdr VS constant loading.
    • +
    • i965: Improve the hacks for ARB_fp scalar^scalar POW on gen6.
    • +
    • i965: Factor out the ir comparision to BRW_CONDITIONAL_* code.
    • +
    • i965: Fix regression in FS comparisons on original gen4 due to gen6 changes.
    • +
    • i965: Do lowering of array indexing of a vector in the FS.
    • +
    • intel: Only do frame throttling at glFlush time when using frontbuffer.
    • +
    • intel: Handle forced swrast clears before other clear bits.
    • +
    • intel: Use tri clears when we don't know how to blit clear the format.
    • +
    • intel: Add spans code for the ARB_texture_rg support.
    • +
    • intel: Add a couple of helper functions to reduce rb code duplication.
    • +
    • intel: Fix segfaults from trying to use _ColorDrawBuffers in FBO validation.
    • +
    • intel: When validating an FBO's combined depth/stencil, use the given FBO.
    • +

    + +

    Fabian Bieler (2): +

      +
    • r600g: set address of pop instructions to next instruction
    • +
    • glsl: fix lowering conditional returns in subroutines
    • +

    + +

    Francisco Jerez (51): +

      +
    • dri/nv04: Fix PGRAPH_ERRORs when running OA.
    • +
    • dri/nv04: Mipmapping fixes.
    • +
    • dri/nv04: Align SIFM transfer dimensions.
    • +
    • dri/nv04: Fix up color mask.
    • +
    • dri/nv04: Fix maximum texture size.
    • +
    • dri/nv04: Fix provoking vertex.
    • +
    • dri/nouveau: Update nouveau_class.h.
    • +
    • dri/nouveau: Add some more extensions.
    • +
    • dri/nouveau: Fix glRenderbufferStorage with DEPTH_COMPONENT as internal format.
    • +
    • dri/nouveau: Don't request a fake front unnecessarily.
    • +
    • dri/nouveau: Don't reemit the BO state in nouveau_state_emit().
    • +
    • dri/nouveau: Cleanup references to the old FBOs on glMakeCurrent().
    • +
    • meta: Don't bind the created texture object in init_temp_texture().
    • +
    • dri/nv10: Fix the CLAMP texture wrap mode.
    • +
    • dri/nv04: Use nvgl_wrap_mode().
    • +
    • dri/nouveau: Remove unnecessary assertion.
    • +
    • dri/nouveau: Cleanup more references to old FBOs and VBOs.
    • +
    • dri/nv10-nv20: Fix texturing in some cases after a base level change.
    • +
    • dri/nouveau: Fix software mipmap generation on 1x1 textures.
    • +
    • dri/nouveau: Have a smaller amount of larger scratch buffers.
    • +
    • dri/nouveau: Remove unnecessary flush.
    • +
    • dri/nv10: Use fast Z clears.
    • +
    • dri/nouveau: Minor cleanup.
    • +
    • dri/nv10: Fake fast Z clears for pre-nv17 cards.
    • +
    • dri/nouveau: Initialize tile_flags when allocating a render target.
    • +
    • nouveau: Get larger push buffers.
    • +
    • dri/nouveau: Force a "slow" Z clear if we're getting a new depth buffer.
    • +
    • dri/nv20: Clear with the 3D engine.
    • +
    • dri/nouveau: Don't assert(0) on compressed internal formats.
    • +
    • dri/nv25: Bind a hierarchical depth buffer.
    • +
    • dri/nouveau: Call _mesa_update_state() after framebuffer invalidation.
    • +
    • dri/nouveau: Honor the access flags in nouveau_bufferobj_map_range.
    • +
    • dri/nouveau: Tell the vbo module we want real hardware BOs.
    • +
    • dri/nouveau: Split out the scratch helpers to a separate file.
    • +
    • dri/nouveau: Avoid recursion in nouveau_bo_context_reset().
    • +
    • dri/nouveau: Use a macro to iterate over the bound vertex attributes.
    • +
    • dri/nouveau: Split out array handling to its own file.
    • +
    • dri/nouveau: Optimize VBO binding re-emission.
    • +
    • dri/nouveau: Keep small DYNAMIC_DRAW vertex buffers in system ram.
    • +
    • dri/nouveau: Pipeline glTexSubImage texture transfers.
    • +
    • dri/nouveau: Fix type promotion issue on 32bit platforms.
    • +
    • dri/nouveau: Validate the framebuffer state on read buffer changes.
    • +
    • dri/nouveau: Re-emit the BO state when coming back from a software fallback.
    • +
    • meta: Don't leak alpha function/reference value changes.
    • +
    • meta: Fix incorrect rendering of the bitmap alpha component.
    • +
    • vbo: Avoid unnecessary copy to/from current in vertex format upgrade.
    • +
    • meta: Don't try to disable cube maps if the driver doesn't expose the extension.
    • +
    • meta: Handle bitmaps with alpha test enabled.
    • +
    • dri/nouveau: Split hardware/software TNL instantiation more cleanly.
    • +
    • dri/nouveau: Fix typo.
    • +
    • dri/nouveau: Kill a bunch of ternary operators.
    • +

    + +

    Fredrik Höglund (2): +

      +
    • r600g: Fix texture sampling with swizzled coords
    • +
    • r600g: fix pow(0, 0) evaluating to NaN
    • +

    + +

    Guillermo S. Romero (1): +

      +
    • r300g: Do not use buf param before checking for NULL.
    • +

    + +

    Henri Verbeet (19): +

      +
    • r600g: Flush upload buffers before draws instead of before flushes.
    • +
    • r600g: Check for other references before checking for existing mappings in radeon_bo_pb_map_internal().
    • +
    • r600g: Remove a redundant flush in r600_texture_transfer_map().
    • +
    • r600g: Buffer object maps imply a wait.
    • +
    • r600g: Respect PB_USAGE_UNSYNCHRONIZED in radeon_bo_pb_map_internal().
    • +
    • Revert "r600g: Flush upload buffers before draws instead of before flushes."
    • +
    • r600g: fix exports_ps to export a number not a mask.
    • +
    • r600g: Mention AMD in the renderer string.
    • +
    • r600g: Cleanup the fenced_bo list in r600_context_fini().
    • +
    • r600g: Evergreen has two extra frac_bits for the sampler LOD state.
    • +
    • r600: Evergreen has two extra frac_bits for the sampler LOD state.
    • +
    • r600g: Add PIPE_FORMAT_L8A8_UNORM for Evergreen as well.
    • +
    • r600g: Swizzle vertex data only once.
    • +
    • r600g: Synchronize supported color formats between Evergreen and r600/r700.
    • +
    • r600g: Fix the PIPE_FORMAT_L8A8_UNORM color swaps.
    • +
    • r600g: Fix the PIPE_FORMAT_A8_UNORM color swap for Evergreen as well.
    • +
    • r600g: Cleanup block bo references in r600_context_fini().
    • +
    • r600g: Cleanup fetch shader resources in r600_pipe_shader_destroy().
    • +
    • st/mesa: Handle wrapped depth buffers in st_copy_texsubimage().
    • +

    + +

    Hui Qi Tay (10): +

      +
    • llvmpipe: minor changes in llvm coefficient calcs
    • +
    • draw: cliptest and viewport done in a single loop in vertex shader
    • +
    • draw: added viewport and cliptest flags
    • +
    • draw: sanitize llvm variant key
    • +
    • draw: corrections for w coordinate
    • +
    • draw: corrections to allow for different cliptest cases
    • +
    • llvmpipe: Moved draw pipeline twoside function to llvm setup code
    • +
    • llvmpipe: added llvm offset setup code
    • +
    • llvmpipe: clean up polygon offset function in lp setup code
    • +
    • llvmpipe: fix such that offset/twoside function only does in-place modification
    • +

    + +

    Ian Romanick (102): +

      +
    • glsl2: Refactor testing for whether a deref is of a matrix or array
    • +
    • glsl2: Add flags to enable variable index lowering
    • +
    • glsl: Add doxygen comments
    • +
    • EGL DRI2: Silence piles of 'unused variable' warnings
    • +
    • EGL DRI2: Silence 'missing initializer' warnings
    • +
    • egl_glx: Silence piles of 'unused variable' warnings
    • +
    • egl: Fix several 'comparison between signed and unsigned integer' warnings
    • +
    • dri: Ensure that DRI driver cpp files are in tarballs
    • +
    • mesa: Force GL_ARB_copy_buffer to always be enabled
    • +
    • mesa: Force GL_SGIS_generate_mipmap to always be enabled
    • +
    • Remove GL_MESA_packed_depth_stencil
    • +
    • Remove GL_EXT_cull_vertex
    • +
    • Regenerate files changed by previous commit
    • +
    • Remove unnescessary initializations of UpdateTexturePalette
    • +
    • ARB_texture_rg: Add GLX protocol support
    • +
    • ARB_texture_rg: Correct some errors in RED / RG internal format handling
    • +
    • ARB_texture_rg: Add GL_TEXTURE_{RED,GREEN}_SIZE query support
    • +
    • ARB_texture_rg: Add GL_RED as a valid GL_DEPTH_TEXTURE_MODE
    • +
    • ARB_texture_rg: Handle RED and RG the same as RGB for tex env
    • +
    • ARB_texture_rg: Add R8, R16, RG88, and RG1616 internal formats
    • +
    • ARB_texture_rg: Allow RED and RG textures as FBO color buffer attachments
    • +
    • mesa: Enable GL_ARB_texture_rg in software paths
    • +
    • i965: Enable GL_ARB_texture_rg
    • +
    • mesa: Add ARB_texture_compression_rgtc as an alias for EXT_texture_compression_rgtc
    • +
    • ARB_texture_rg: Add GL_COMPRESSED_{RED,RG} cases in _mesa_is_color_format
    • +
    • mesa: Fix misplaced #endif
    • +
    • mesa: Trivial correction to comment
    • +
    • rgtc: Detect RGTC formats as color formats and as compressed formats
    • +
    • docs: Add list of bugs fixed in 7.9
    • +
    • docs: Import 7.9 release notes from 7.9 branch.
    • +
    • docs: Import 7.8.x release notes from 7.8 branch.
    • +
    • docs: download.html does not need to be updated for each release
    • +
    • docs: Update mailing lines from sf.net to freedesktop.org
    • +
    • docs: Import news updates from 7.9 branch
    • +
    • docs: added news item for 7.9 release
    • +
    • glsl: Fail linking if assign_attribute_locations fails
    • +
    • glsl: Refactor 'layout' grammar to match GLSL 1.60 spec grammar
    • +
    • glsl: Slight refactor of error / warning checking for ARB_fcc layout
    • +
    • glsl: Clear type_qualifier using memset
    • +
    • glsl: Wrap ast_type_qualifier contents in a struct in a union
    • +
    • glsl: Regenerate files modified by previous commits
    • +
    • glcpp: Add the define for ARB_explicit_attrib_location when present
    • +
    • glcpp: Regenerate files changes by previous commit
    • +
    • glsl: Add parser support for GL_ARB_explicit_attrib_location layouts
    • +
    • glsl: Regenerate files changes by previous commit
    • +
    • glsl: Track explicit location in AST to IR translation
    • +
    • glsl: Add linker support for explicit attribute locations
    • +
    • main: Enable GL_ARB_explicit_attrib_location for swrast
    • +
    • intel: Enable GL_ARB_explicit_attrib_location
    • +
    • glsl: Remove const decoration from inlined function parameters
    • +
    • docs: skeleton for 7.10 release notes
    • +
    • docs: Update status of GL 3.x related extensions
    • +
    • mesa: Validate assembly shaders when GLSL shaders are used
    • +
    • glsl: Fix incorrect assertion
    • +
    • linker: Reject shaders that have unresolved function calls
    • +
    • mesa: Silence unused variable warning
    • +
    • mesa: Refactor validation of shader targets
    • +
    • mesa: Clean up two 'comparison between signed and unsigned' warnings
    • +
    • mesa: Clean up various 'unused parameter' warnings in shaderapi
    • +
    • glsl: Slightly change the semantic of _LinkedShaders
    • +
    • linker: Trivial indention fix
    • +
    • i965: Fix indentation after commit 3322fbaf
    • +
    • linker: Improve handling of unread/unwritten shader inputs/outputs
    • +
    • glapi: Add GL_EXT_separate_shader_objects
    • +
    • glapi: Commit files changed by previous commit
    • +
    • mesa: Add infrastructure to track GL_EXT_separate_shader_objects
    • +
    • mesa: Skeletal support for GL_EXT_separate_shader_objects
    • +
    • mesa: Add display list support for GL_EXT_separate_shader_objects functions
    • +
    • mesa: Track an ActiveProgram distinct from CurrentProgram
    • +
    • Track separate programs for each stage
    • +
    • swrast: Enable GL_EXT_separate_shader_objects in software paths
    • +
    • intel: Enable GL_EXT_separate_shader_objects in Intel drivers
    • +
    • docs: add GL_EXT_separate_shader_objects to release notes
    • +
    • glsl: Fix incorrect gl_type of sampler2DArray and sampler1DArrayShadow
    • +
    • ir_to_mesa: Refactor code for emitting DP instructions
    • +
    • mesa: Allow query of MAX_SAMPLES with EXT_framebuffer_multisample
    • +
    • glsl: Refactor is_vec_{zero,one} to be methods of ir_constant
    • +
    • glsl: Simplify generation of swizzle for vector constructors
    • +
    • glsl: Make is_zero and is_one virtual methods of ir_rvalue
    • +
    • ir_to_mesa: Generate smarter code for some conditional moves
    • +
    • glsl: Add ir_unop_sin_reduced and ir_unop_cos_reduced
    • +
    • glsl: Eliminate assumptions about size of ir_expression::operands
    • +
    • glsl: Add ir_rvalue::is_negative_one predicate
    • +
    • glsl: Add unary ir_expression constructor
    • +
    • glsl: Add ir_quadop_vector expression
    • +
    • glsl: Fix matrix constructors with vector parameters
    • +
    • i915: Disallow alpha, red, RG, and sRGB as render targets
    • +
    • glsl: Use M_LOG2E constant instead of calling log2
    • +
    • glsl: Lower ir_binop_pow to a sequence of EXP2 and LOG2
    • +
    • i915: Request that POW instructions be lowered
    • +
    • i915: Correctly generate unconditional KIL instructions
    • +
    • glsl: Ensure that equality comparisons don't return a NULL IR tree
    • +
    • i965: Correctly emit constants for aggregate types (array, matrix, struct)
    • +
    • glsl: Inherrit type of declared variable from initializer
    • +
    • linker: Ensure that unsized arrays have a size after linking
    • +
    • linker: Fix regressions caused by previous commit
    • +
    • glsl: Inherrit type of declared variable from initializer after processing assignment
    • +
    • linker: Allow built-in arrays to have different sizes between shader stages
    • +
    • ir_to_mesa: Don't generate swizzles for record derefs of non-scalar/vectors
    • +
    • Refresh autogenerated file builtin_function.cpp.
    • +
    • glsl: Allow less restrictive uses of sampler array indexing in GLSL <= 1.20
    • +
    • docs: Import 7.9.1 release notes from 7.9 branch
    • +

    + +

    Jakob Bornecrantz (27): +

      +
    • rbug: Cast opcode to corrent int size
    • +
    • rbug: Add function to get opcode name string
    • +
    • scons: Link against talloc in the Gallium DRI drivers
    • +
    • i915g: Link with wrapper sw winsys with scons
    • +
    • tgsi: Actually care what check_soa_dependencies says
    • +
    • tgsi: Fix missing test before check
    • +
    • llvmpipe: Move makefile include to before targets
    • +
    • wrapper: Fix spelling
    • +
    • wrapper: Add a way to dewrap a pipe screen without destroying it
    • +
    • egl: Remove unnecessary headers
    • +
    • target-helpers: Remove per target software wrapper check
    • +
    • graw: Tidy graw xlib scons file a bit
    • +
    • scons: Remove old pipebuffer SConscript
    • +
    • scons: Detabify
    • +
    • scons: Check for pkg-config before trying to use it
    • +
    • scons: Check for libdrm_[intel|radeon] as well
    • +
    • scons: Move dependancy checks to the main gallium scons file
    • +
    • scons: Unify state tracker SConscripts
    • +
    • galahad: Correct the name of the scons library
    • +
    • graw: Use inline sw helper instead of roll your own loader
    • +
    • libgl-xlib: Use sw helper instead of roll your own
    • +
    • libgl-xlib: Use inline debug helper instead of non-inline version
    • +
    • graw: Use inline debug helper instead of non-inline version
    • +
    • gallium: Remove redundant sw and debug target helpers
    • +
    • i915g: Improve debug printing for textures
    • +
    • i915g: Make sure that new vbo gets updated
    • +
    • st/mesa: Unbind all constant buffers
    • +

    + +

    Jerome Glisse (75): +

      +
    • r600g: alternative command stream building from context
    • +
    • r600g: move chip class to radeon common structure
    • +
    • r600g: use pipe context for flushing inside map
    • +
    • r600g: add back reference check when mapping buffer
    • +
    • r600g: directly allocate bo for user buffer
    • +
    • r600g: fix multi buffer rendering
    • +
    • r600g: occlusion query for new design
    • +
    • r600g: flush color buffer after draw command
    • +
    • r600g: disable shader rebuild optimization & account cb flush packet
    • +
    • r600g: fix multiple occlusion query on same id
    • +
    • r600g: initial evergreen support in new path
    • +
    • r600g: fix typo in evergreen define (resource are in x range)
    • +
    • r600g: move use_mem_constants flags for new designs structure alignment
    • +
    • r600g: evergreen fix for new design
    • +
    • r600g: fix compilation after change to evergreend.h
    • +
    • r600g: fixup some evergreen register definitions
    • +
    • r600g: fix evergreen new path
    • +
    • r600g: fix reg definition
    • +
    • r600g: fix evergreen new path
    • +
    • r600g: bring over fix from old path to new path
    • +
    • r600g: fix vertex resource & polygon offset
    • +
    • r600g: disable early cull optimization when occlusion query running
    • +
    • r600g: move around variables to share depth uncompression code
    • +
    • r600g: use depth decompression in new path
    • +
    • r600g: fix index buffer drawing
    • +
    • r600g: build packet header once
    • +
    • r600g: fix pointsprite & resource unbinding
    • +
    • r600g: fix routing btw vertex & pixel shader
    • +
    • r600g: fix occlusion query after change to block structure
    • +
    • r600g: use ptr for blit depth uncompress function
    • +
    • r600g: fix remaining piglit issue in new design
    • +
    • r600g: switch to new design
    • +
    • r600g: suspend/resume occlusion query around clear/copy
    • +
    • r600g: avoid rebuilding the vertex shader if no change to input format
    • +
    • r600g: use a hash table instead of group
    • +
    • r600g: delete old path
    • +
    • r600g: cleanup
    • +
    • r600g: more cleanup
    • +
    • r600g: use constant buffer instead of register for constant
    • +
    • r600g: fix constant & literal src splitting, also fix mplayer gl2 shader
    • +
    • evergreeng: avoid overlapping border color btw VS & PS
    • +
    • r600g: indentation fixes
    • +
    • r600g: rename radeon_ws_bo to r600_bo
    • +
    • r600g: allow r600_bo to be a sub allocation of a big bo
    • +
    • r600g: use r600_bo for relocation argument, simplify code
    • +
    • r600g: rename radeon_ws_bo to r600_bo
    • +
    • r600g: remove dead label & fix indentation
    • +
    • r600g: store reloc information in bo structure
    • +
    • r600g: improve bo flushing
    • +
    • r600g: simplify block relocation
    • +
    • r600g: userspace fence to avoid kernel call for testing bo busy status
    • +
    • r600g: avoid segfault due to unintialized list pointer
    • +
    • r600g: fix dirty state handling
    • +
    • r600g: allow driver to work without submitting cmd to GPU
    • +
    • gallium/noop: no operation gallium driver
    • +
    • r600g: code cleanup (indent, trailing space, empty line ...)
    • +
    • r600g: fix occlusion query on evergreen (avoid lockup)
    • +
    • r600g: add fetch shader capabilities
    • +
    • r600g: dump raw shader output for debugging
    • +
    • r600g: update polygon offset only when rasterizer or zbuffer change
    • +
    • r600g: indentation fix
    • +
    • r600g: more indentation fix + warning silencing + dead code removal
    • +
    • r600g: build fetch shader from vertex elements
    • +
    • r600g: avoid useless shader rebuild at draw call
    • +
    • r600g: remove useless flush map
    • +
    • r600g: remove dead code
    • +
    • r600g: fix userspace fence against lastest kernel
    • +
    • r600g: avoid using pb* helper we are loosing previous cpu cycle with it
    • +
    • r600g: specialized upload manager
    • +
    • r600g: indentation cleanup
    • +
    • r600g: fix bo size when creating bo from handle
    • +
    • r600g: fix segfault when translating vertex buffer
    • +
    • r600g: need to reference upload buffer as the might still live accross flush
    • +
    • r600g: properly unset vertex buffer
    • +
    • r600g: avoid segfault
    • +

    + +

    Joakim Sindholt (3): +

      +
    • util/u_blitter: fix leak
    • +
    • radeong: fix leaks
    • +
    • r300g: silence guard band cap errors
    • +

    + +

    Johann Rudloff (3): +

      +
    • radeon: Implement EGL_MESA_no_surface_extension
    • +
    • radeon: Implement __DRI_IMAGE and EGL_MESA_image_drm
    • +
    • radeon: Implement GL_OES_EGL_image
    • +

    + +

    John Doe (3): +

      +
    • r600g: misc cleanup
    • +
    • r600g: don't double count dirty block
    • +
    • r600g: keep a mapping around for each bo
    • +

    + +

    Jon TURNEY (1): +

      +
    • Ensure -L$(TOP)/$(LIB_DIR) appears in link line before any -L in $LDFLAGS
    • +

    + +

    José Fonseca (128): +

      +
    • gallivm: Fix address register swizzle.
    • +
    • gallivm: Start collecting bitwise arithmetic helpers in a new module.
    • +
    • gallivm: Clamp indirect register indices to file_max.
    • +
    • util: linearized sRGB values don't fit into 8bits
    • +
    • llvmpipe: Default to no threading on single processor systems.
    • +
    • tgsi: Don't ignore indirect registers in tgsi_check_soa_dependencies
    • +
    • llvmpipe: Describe how to profile llvmpipe.
    • +
    • llvmpipe: When failing free fs shader too.
    • +
    • util: Flush stdout on util_format.
    • +
    • gallivm: Add unorm support to lp_build_lerp()
    • +
    • llvmpipe: Special case complementary and identify blend factors in SoA.
    • +
    • llvmpipe: Make rgb/alpha bland func/factors match, when there is no alpha.
    • +
    • draw: Prevent clipped vertices overflow.
    • +
    • draw: Fullfil the new min_lod/max_lod/lod_bias/border_color dynamic state
    • +
    • gallivm: Fetch the lod from the dynamic state when min_lod == max_lod.
    • +
    • gallivm: Remove dead experimental code.
    • +
    • llvmpipe: Decouple sampler view and sampler state updates.
    • +
    • scons: New build= option, with support for checked builds.
    • +
    • scons: New build= option, with support for checked builds.
    • +
    • trace: Fix set_index_buffer and draw_vbo tracing.
    • +
    • python/retrace: Handle set_index_buffer and draw_vbo.
    • +
    • gallivm: Use SSE4.1's ROUNDSS/ROUNDSD for scalar rounding.
    • +
    • gallivm: More comprehensive border usage logic.
    • +
    • retrace: Handle clear_render_target and clear_depth_stencil.
    • +
    • llvmpipe: Dump a few missing shader key flags.
    • +
    • llvmpipe: Fix perspective interpolation for point sprites.
    • +
    • llvmpipe: Fix sprite coord perspective interpolation of Q.
    • +
    • gallivm: Take the type signedness in consideration in round/ceil/floor.
    • +
    • gallivm: Use a faster (and less accurate) log2 in lod computation.
    • +
    • gallivm: Fast implementation of iround(log2(x))
    • +
    • gallivm: Combined ifloor & fract helper.
    • +
    • gallivm: Only apply min/max_lod when necessary.
    • +
    • gallivm: Compute lod as integer whenever possible.
    • +
    • util: Cleanup util_pack_z_stencil and friends.
    • +
    • llvmpipe: Cleanup depth-stencil clears.
    • +
    • gallivm: Vectorize the rho computation.
    • +
    • gallivm: Do not do mipfiltering when magnifying.
    • +
    • gallivm: Simplify lp_build_mipmap_level_sizes' interface.
    • +
    • gallivm: Don't compute the second mipmap level when frac(lod) == 0
    • +
    • gallivm: Use lp_build_ifloor_fract for lod computation.
    • +
    • gallivm: Clamp mipmap level and zero mip weight simultaneously.
    • +
    • gallivm: Fix copy'n'paste typo in previous commit.
    • +
    • gallivm: Implement brilinear filtering.
    • +
    • gallivm: Use the wrappers for SSE pack intrinsics.
    • +
    • gallivm: Avoid control flow for two-sided stencil test.
    • +
    • gallivm: Warn when doing inefficient integer comparisons.
    • +
    • gallivm: Move into the as much of the second level code as possible.
    • +
    • llvmpipe: First minify the texture size, then broadcast.
    • +
    • gallivm: Help for combined extraction and broadcasting.
    • +
    • gallivm: Do size computations simultanously for all dimensions (AoS).
    • +
    • llvmpipe: Prevent z > 1.0
    • +
    • llvmpipe: Fix MSVC build. Enable the new SSE2 code on non SSE3 systems.
    • +
    • gallivm: Handle code have ret correctly.
    • +
    • util: Defined M_SQRT2 when not available.
    • +
    • gallivm: Less code duplication in log computation.
    • +
    • gallivm: Special bri-linear computation path for unmodified rho.
    • +
    • gallivm: Don't generate Phis for execution mask.
    • +
    • gallivm: Use varilables instead of Phis for cubemap selection.
    • +
    • gallivm: Remove support for Phi generation.
    • +
    • gallivm: Factor out the SI->FP texture size conversion for SoA path too
    • +
    • gallivm: Simplify if/then/else implementation.
    • +
    • gallivm: Cleanup the rest of the flow module.
    • +
    • gallivm: Fix a long standing bug with nested if-then-else emission.
    • +
    • gallivm: Allow to disable bri-linear filtering with GALLIVM_DEBUG=no_brilinear runtime option
    • +
    • gallivm: Use variables instead of Phis in loops.
    • +
    • gallivm: Pass texture coords derivates as scalars.
    • +
    • llvmpipe: Remove outdated comment about stencil testing.
    • +
    • gallivm: Eliminate unsigned integer arithmetic from texture coordinates.
    • +
    • gallium: Define C99 restrict keyword where absent.
    • +
    • tgsi: Export some names for some tgsi enums.
    • +
    • gallivm: More detailed analysis of tgsi shaders.
    • +
    • llvmpipe: Use lp_tgsi_info.
    • +
    • llvmpipe: Do not dispose the execution engine.
    • +
    • llvmpipe: Fix MSVC build.
    • +
    • llmvpipe: improve mm_mullo_epi32
    • +
    • gallivm: Name anonymous union.
    • +
    • llvmpipe: Unbreak Z32_FLOAT.
    • +
    • gallivm: More accurate float -> 24bit & 32bit unorm conversion.
    • +
    • llvmpipe: Generalize the x8z24 fast path to all depth formats.
    • +
    • llvmpipe: Fix depth-stencil regression.
    • +
    • llvmpipe: Ensure z_shift and z_width is initialized.
    • +
    • gallivm: Fix SoA cubemap derivative computation.
    • +
    • llvmpipe: Fix bad refactoring.
    • +
    • llvmpipe: Initialize bld ctx via lp_build_context_init instead of ad-hoc and broken code.
    • +
    • gallivm: Comment lp_build_insert_new_block().
    • +
    • gallivm: Add a note about SSE4.1's nearest mode rounding.
    • +
    • llvmpipe: Don't test rounding of x.5 numbers.
    • +
    • gallium: Avoid using __doc__ in python scripts.
    • +
    • gallivm: always enable LLVMAddInstructionCombiningPass()
    • +
    • gallivm: Remove the EMMS opcodes.
    • +
    • mesa: Fix windows build (uint -> GLuint).
    • +
    • scons: Revamp how to specify targets to build.
    • +
    • scons: Fix MinGW cross-compilation.
    • +
    • scons: Some pipe drivers are not portable for MSVC
    • +
    • scons: Restore x11 tool behavior for backwards compatability.
    • +
    • scons: Disable python state tracker when swig is not present.
    • +
    • r600g: List recently added files in SConscript.
    • +
    • scons: Add aliases for several pipe drivers.
    • +
    • scons: i915 can't build on MSVC either.
    • +
    • scons: Propagate installation targets.
    • +
    • xorg/vmwgfx: Add missing source file to SConscript.
    • +
    • st/xorg: Add missing n to error message.
    • +
    • st/xorg: Detect libkms with scons too.
    • +
    • xorg/vmwgfx: Link libkms when available.
    • +
    • r600g: Swap the util_blitter_destroy call order.
    • +
    • gallivm: Allocate TEMP/OUT arrays only once.
    • +
    • libgl-gdi: Allow to pick softpipe/llvmpipe on runtime.
    • +
    • scons: Use inline wrap helpers more consistently.
    • +
    • svga: Use consistent hexadecimal representation on debug output.
    • +
    • scons: Alias for svga
    • +
    • wgl: Stub WGL_ARB_pbuffer support.
    • +
    • wgl: More complete WGL_ARB_pbuffer support.
    • +
    • svga: Silence debug printf.
    • +
    • scons: Move MSVS_VERSION option to common module.
    • +
    • vega: Remove extraneous ;
    • +
    • retrace: Some fixes.
    • +
    • util: C++ safe.
    • +
    • wgl: Fix double free. Remove dead code.
    • +
    • util: Plug leaks in util_destroy_gen_mipmap.
    • +
    • util: __builtin_frame_address() doesn't work on mingw.
    • +
    • util: Don't try to use imagehlp on mingw.
    • +
    • wgl: Unreference the current framebuffer after the make_current call.
    • +
    • WIN32_THREADS -> WIN32
    • +
    • mapi: Hack to avoid vgCreateFont being generated as vgCreateFontA.
    • +
    • wgl: Fix visual's buffer_mask configuration.
    • +
    • mesa: Temporary hack to prevent stack overflow on windows
    • +
    • mesa: Bump the number of bits in the register index.
    • +
    • llvmpipe: Plug fence leaks.
    • +

    + +

    Julien Cristau (1): +

      +
    • Makefile: don't include the same files twice in the tarball
    • +

    + +

    Keith Whitwell (89): +

      +
    • llvmpipe: brackets around macro arg
    • +
    • llvmpipe: remove duplicate code
    • +
    • llvmpipe: return zero from floor_pot(zero)
    • +
    • gallivm: make lp_build_sample_nop public
    • +
    • llvmpipe: add LP_PERF flag to disable various aspects of rasterization
    • +
    • llvmpipe: add DEBUG_FS to dump variant information
    • +
    • llvmpipe: use llvm for attribute interpolant calculation
    • +
    • graw: add frag-face shader
    • +
    • llvmpipe: fix flatshading in new line code
    • +
    • draw: don't apply flatshading to clipped tris with <3 verts
    • +
    • llvmpipe: handle FACING interpolants in line and point setup
    • +
    • llvmpipe: handle up to 8 planes in triangle binner
    • +
    • llvmpipe: make debug_fs_variant respect variant->nr_samplers
    • +
    • gallivm: don't apply zero lod_bias
    • +
    • llvmpipe: fail gracefully on oom in scene creation
    • +
    • llvmpipe: avoid overflow in triangle culling
    • +
    • gallivm: special case conversion 4x4f to 1x16ub
    • +
    • gallivm: round rather than truncate in new 4x4f->1x16ub conversion path
    • +
    • llvmpipe: clean up setup_tri a little
    • +
    • llvmpipe: add rast_tri_4_16 for small lines and points
    • +
    • llvmpipe: fix off-by-one in tri_16
    • +
    • llvmpipe: defer attribute interpolation until after mask and ztest
    • +
    • llvmpipe: use alloca for fs color outputs
    • +
    • llvmpipe: store zero into all alloca'd values
    • +
    • llvmpipe: dump fragment shader ir and asm when LP_DEBUG=fs
    • +
    • gallivm: specialized x8z24 depthtest path
    • +
    • gallivm: prefer blendvb for integer arguments
    • +
    • gallivm: simpler uint8->float conversions
    • +
    • llvmpipe: try to be sensible about whether to branch after mask updates
    • +
    • llvmpipe: clean up shader pre/postamble, try to catch more early-z
    • +
    • llvmpipe: simplified SSE2 swz/unswz routines
    • +
    • llvmpipe: try to do more of rast_tri_3_16 with intrinsics
    • +
    • llvmpipe: add debug helpers for epi32 etc
    • +
    • llvmpipe: try to keep plane c values small
    • +
    • llvmpipe: fix typo in last commit
    • +
    • gallium: move sse intrinsics debug helpers to u_sse.h
    • +
    • r600g: add missing file to sconscript
    • +
    • gallivm: don't branch on KILLs near end of shader
    • +
    • Revert "llvmpipe: try to keep plane c values small"
    • +
    • llvmpipe: make sure intrinsics code is guarded with PIPE_ARCH_SSE
    • +
    • llvmpipe: don't try to emit non-existent color outputs
    • +
    • r600/drm: fix segfaults in winsys create failure path
    • +
    • r600g: emit hardware linewidth
    • +
    • r600g: handle absolute modifier in shader translator
    • +
    • llvmpipe: reintroduce SET_STATE binner command
    • +
    • llvmpipe: don't pass frontfacing as a float
    • +
    • llvmpipe: slightly shrink the size of a binned triangle
    • +
    • llvmpipe: don't store plane.ei value in binned data
    • +
    • gallium: move some intrinsics helpers to u_sse.h
    • +
    • llvmpipe: do plane calculations with intrinsics
    • +
    • llvmpipe: use aligned loads/stores for plane values
    • +
    • llvmpipe: fix non-sse build after recent changes
    • +
    • llvmpipe: check shader outputs are non-null before using
    • +
    • llvmpipe: validate color outputs against key->nr_cbufs
    • +
    • llvmpipe: clean up fields in draw_llvm_variant_key
    • +
    • llvmpipe: remove setup fallback path
    • +
    • llvmpipe: fail cleanly on malloc failure in lp_setup_alloc_triangle
    • +
    • Merge remote branch 'origin/master' into lp-setup-llvm
    • +
    • llvmpipe: remove unused file
    • +
    • llvmpipe: remove unused arg from jit_setup_tri function
    • +
    • Merge branch 'llvm-cliptest-viewport'
    • +
    • draw: make sure viewport gets updated in draw llvm shader
    • +
    • llvmpipe: turn off draw offset/twoside when we can handle it
    • +
    • llvmpipe: avoid generating tri_16 for tris which extend past tile bounds
    • +
    • llvmpipe: guard against NULL task->query pointer
    • +
    • st/mesa: unbind constant buffer when not in use
    • +
    • r600g: propagate usage flags in texture transfers
    • +
    • r600g: propogate resource usage flags to winsys, use to choose bo domains
    • +
    • r600g: use a buffer in GTT as intermediate on texture up and downloads
    • +
    • r600g: remove unused flink, domain fields from r600_resource
    • +
    • r600g: set hardware pixel centers according to gl_rasterization_rules
    • +
    • evergreeng: protect against null constant buffers
    • +
    • r600g: don't call debug_get_bool_option for tiling more than once
    • +
    • evergreeng: respect linewidth state, use integer widths only
    • +
    • evergreeng: set hardware pixelcenters according to gl_rasterization_rules
    • +
    • r600g: avoid recursion with staged uploads
    • +
    • r600g: attempt to turn on DXTn formats
    • +
    • r600g: translate ARR instruction
    • +
    • r600: fix my pessimism about PIPE_TRANSFER_x flags
    • +
    • ws/r600: match bo_busy shared/fence logic in bo_wait
    • +
    • r600g: guard experimental s3tc code with R600_ENABLE_S3TC
    • +
    • r600g: do not try to use staging resource for depth textures
    • +
    • r600g: enforce minimum stride on render target texture images
    • +
    • llvmpipe: fix up twoside after recent changes
    • +
    • llvmpipe: twoside for specular color also
    • +
    • Merge branch 'lp-offset-twoside'
    • +
    • llvmpipe: raise dirty flag on transfers to bound constbuf
    • +
    • llvmpipe: remove misleading debug string
    • +
    • llvmpipe: shortcircuit some calls to set_scene_state
    • +

    + +

    Kenneth Graunke (94): +

      +
    • glsl: Change from has_builtin_signature to has_user_signature.
    • +
    • glsl: Don't print blank (function ...) headers for built-ins.
    • +
    • glsl: Properly handle nested structure types.
    • +
    • glsl/builtins: Fix equal and notEqual builtins.
    • +
    • glsl/builtins: Switch comparison functions to just return an expression.
    • +
    • glsl: Add comments to clarify the types of comparison binops.
    • +
    • glsl: Fix broken handling of ir_binop_equal and ir_binop_nequal.
    • +
    • glsl: "Copyright", not "Constantright"
    • +
    • i965: Fix incorrect batchbuffer size in gen6 clip state command.
    • +
    • i965: Use logical-not when emitting ir_unop_ceil.
    • +
    • glsl: Add front-end support for the "trunc" built-in.
    • +
    • glsl: Refresh autogenerated file builtin_function.cpp.
    • +
    • i965: Use RNDZ for ir_unop_trunc in the new FS.
    • +
    • i965: Correctly emit the RNDZ instruction.
    • +
    • i965: Clean up a warning in the old fragment backend.
    • +
    • glsl: Add a new ir_unop_round_even opcode for GLSL 1.30's roundEven.
    • +
    • glsl: Add front-end support for GLSL 1.30's roundEven built-in.
    • +
    • i965: Add support for ir_unop_round_even via the RNDE instruction.
    • +
    • glsl: Add support for the 1.30 round() built-in.
    • +
    • glsl: Refresh autogenerated file builtin_function.cpp.
    • +
    • glsl: Don't return NULL IR for erroneous bit-shift operators.
    • +
    • i965: Add missing "break" statement.
    • +
    • glsl: Fix copy and paste error in ast_bit_and node creation.
    • +
    • glsl: Regenerate parser files.
    • +
    • i965: Remove unused variable.
    • +
    • glsl: Remove useless ir_shader enumeration value.
    • +
    • mesa: Remove FEATURE_ARB_shading_language_120 macro.
    • +
    • glcpp: Return NEWLINE token for newlines inside multi-line comments.
    • +
    • glcpp: Refresh autogenerated lexer file.
    • +
    • glsl: Add support for GLSL 1.30's modf built-in.
    • +
    • glsl: Refresh autogenerated file builtin_function.cpp.
    • +
    • generate_builtins.py: Output large strings as arrays of characters.
    • +
    • Refresh autogenerated file builtin_function.cpp.
    • +
    • glsl: Fix constant component count in vector constructor emitting.
    • +
    • Fix build on systems where "python" is python 3.
    • +
    • i965: Add bit operation support to the fragment shader backend.
    • +
    • glsl: Remove unused ARRAY_SIZE macro.
    • +
    • glsl/builtins: Rename 'x' to 'y_over_x' in atan(float) implementation.
    • +
    • glsl/builtins: Clean up some ugly autogenerated code in atan.
    • +
    • Refresh autogenerated file builtin_function.cpp.
    • +
    • glsl: Don't print a useless space at the end of an S-Expression list.
    • +
    • ir_reader: Return a specific ir_dereference variant.
    • +
    • ir_reader: Remove useless error check.
    • +
    • ir_reader: Fix some potential NULL pointer dereferences.
    • +
    • ir_dead_functions: Actually free dead functions and signatures.
    • +
    • glsl: Remove unnecessary "unused variable" warning suppression.
    • +
    • glsl: Remove GLSL_TYPE_FUNCTION define.
    • +
    • glsl: Convert glsl_type::base_type from #define'd constants to an enum.
    • +
    • glsl: Rework reserved word/keyword handling in the lexer.
    • +
    • glsl: Add new keywords and reserved words for GLSL 1.30.
    • +
    • glsl: Add support for the 'u' and 'U' unsigned integer suffixes.
    • +
    • glsl: Refresh autogenerated lexer and parser files.
    • +
    • generate_builtins.py: Fix inconsistent use of tabs and spaces warning.
    • +
    • glsl: Implement the asinh, acosh, and atanh built-in functions.
    • +
    • glsl: Refresh autogenerated file builtin_function.cpp.
    • +
    • glsl: Add constant expression handling for asinh, acosh, and atanh.
    • +
    • glsl: Remove unused and out of date Makefile.am.
    • +
    • glsl: Rename various ir_* files to lower_* and opt_*.
    • +
    • glcpp: Define GL_FRAGMENT_PRECISION_HIGH if GLSL version >= 1.30.
    • +
    • Refresh autogenerated glcpp parser.
    • +
    • glsl: Fix constant expression handling for <, >, <=, >= on vectors.
    • +
    • glsl: Unconditionally define GL_FRAGMENT_PRECISION_HIGH in ES2 shaders.
    • +
    • Regenerate glcpp parser.
    • +
    • glsl: Reimplement the "cross" built-in without ir_binop_cross.
    • +
    • Refresh autogenerated file builtin_function.cpp.
    • +
    • glsl: Remove the ir_binop_cross opcode.
    • +
    • glsl: Refactor get_num_operands.
    • +
    • glsl: Simplify a type check by using type->is_integer().
    • +
    • glsl: Combine many instruction lowering passes into one.
    • +
    • mesa: Fix glGet of ES2's GL_MAX_*_VECTORS properties.
    • +
    • glsl: Don't inline function prototypes.
    • +
    • glsl: Use do_common_optimization in the standalone compiler.
    • +
    • glsl: Add a virtual as_discard() method.
    • +
    • glsl: Refactor out cloning of function prototypes.
    • +
    • glsl: Lazily import built-in function prototypes.
    • +
    • glsl: Remove anti-built-in hacks from the print visitor.
    • +
    • glsl/linker: Free any IR discarded by optimization passes.
    • +
    • glsl: Add an optimization pass to simplify discards.
    • +
    • glsl: Add a lowering pass to move discards out of if-statements.
    • +
    • glsl: Remove "discard" support from lower_jumps.
    • +
    • glsl: Add comments to lower_jumps (from the commit message).
    • +
    • ir_print_visitor: Print out constant structure values.
    • +
    • glsl: Factor out code which emits a new function into the IR stream.
    • +
    • symbol_table: Add support for adding a symbol at top-level/global scope.
    • +
    • glsl: Properly add functions during lazy built-in prototype importing.
    • +
    • glcpp: Don't emit SPACE tokens in conditional_tokens production.
    • +
    • Refresh autogenerated glcpp parser.
    • +
    • glsl: Clean up code by adding a new is_break() function.
    • +
    • glsl: Consider the "else" branch when looking for loop breaks.
    • +
    • Remove OES_compressed_paletted_texture from the ES2 extension list.
    • +
    • glsl/builtins: Compute the correct value for smoothstep(vec, vec, vec).
    • +
    • glsl: Support if-flattening beyond a given maximum nesting depth.
    • +
    • i965: Flatten if-statements beyond depth 16 on pre-gen6.
    • +
    • i965: Internally enable GL_NV_blend_square on ES2.
    • +

    + +

    Kristian Høgsberg (16): +

      +
    • glx: Hold on to drawables if we're just switching to another context
    • +
    • intel: Fix GL_ARB_shading_language_120 commit
    • +
    • dri2: Make createImageFromName() take a __DRIscreen instead of __DRIcontext
    • +
    • glx: Invalidate buffers after binding a drawable
    • +
    • dri: Pass the __DRIscreen and the __DRIscreen private back to image lookup
    • +
    • glx: Only remove drawables from the hash when we actually delete them
    • +
    • gles2: Add GL_EXT_texture_format_BGRA8888 support
    • +
    • Get rid of GL/internal/glcore.h
    • +
    • gl: Remove unused GLcontextModes fields
    • +
    • Rename GLvisual and __GLcontextModes to struct gl_config
    • +
    • Drop GLframebuffer typedef and just use struct gl_framebuffer
    • +
    • Drop GLcontext typedef and use struct gl_context instead
    • +
    • Drop the "neutral" tnl module
    • +
    • Only install vtxfmt tables for OpenGL
    • +
    • i965: Don't write mrf assignment for pointsize output
    • +
    • docs: Fix MESA_drm_image typo
    • +

    + +

    Krzysztof Smiechowicz (1): +

      +
    • nvfx: Pair os_malloc_aligned() with os_free_aligned().
    • +

    + +

    Luca Barbieri (84): +

      +
    • auxiliary: fix unintended fallthrough
    • +
    • glsl: add pass to lower variable array indexing to conditional assignments
    • +
    • auxiliary: fix depth-only and stencil-only clears
    • +
    • gallium: avoid the C++ keyword "template" in sw_winsys.h
    • +
    • softpipe: make z/s test always pass if no zsbuf, instead of crashing
    • +
    • tgsi: add switch/case opcodes to tgsi_opcode_tmp.h
    • +
    • softpipe: fix whitespace
    • +
    • d3d1x: add new Direct3D 10/11 COM state tracker for Gallium
    • +
    • d3d1x: add blob and signature extraction APIs
    • +
    • d3d1x: fix compilation with recent Wine versions installed
    • +
    • d3d1x: add missing file
    • +
    • d3d1x: actually enable and fix blob apis
    • +
    • d3d1x: fix build with compilers other than GCC 4.5
    • +
    • d3d1x: add template parameters to base class ctor calls for GCC 4.4
    • +
    • d3d1x: fix GCC 4.1/4.2 build
    • +
    • d3d1x: ignore errors while building docs
    • +
    • d3d1x: attempt to fix/workaround bug #30322
    • +
    • nvfx: remove gl_PointCoord hack
    • +
    • glx: decouple dri2.c and GLX, fixing Gallium EGL and d3d1x build
    • +
    • winsys: automatically build sw winsys needed by EGL and d3d1x
    • +
    • d3d1x: don't build progs automatically
    • +
    • d3d1x: add missing memory barrier
    • +
    • d3d1x: link with CXXFLAGS
    • +
    • d3d1x: fix cf analysis
    • +
    • d3d1x: fix warning
    • +
    • d3d1x: fix segfault when hashing
    • +
    • d3d1x: destroy native_display on adapter destruction
    • +
    • d3d1x: fix GUID declarations
    • +
    • d3d1x: redesign the HWND resolver interface
    • +
    • d3d1x: fix API name
    • +
    • d3d1x: define GUIDs in the normal way
    • +
    • d3d1x: add Wine dlls (tri, tex working, but no other testing)
    • +
    • d3d1x: properly reference count the backend
    • +
    • d3d1x: fix deadlocks on non-recursive mutex
    • +
    • d3d1x: bind NULL CSOs before destroying default CSOs on context dtor
    • +
    • d3d1x: initialize the mutex
    • +
    • d3d1x: autogenerate shader enums and text from def files
    • +
    • d3d1x: s/tpf/sm4/g
    • +
    • d3d1x: normalize whitespace
    • +
    • d3d1x: remove specstrings
    • +
    • d3d1x: minifix
    • +
    • d3d1x: rename context params
    • +
    • d3d11: rename screen params
    • +
    • d3d1x: rename params in misc and objects
    • +
    • d3d1x: rename parameters in dxgi
    • +
    • d3d11: obliterate IDL parameter names
    • +
    • d3d1x: remove specstrings.h include
    • +
    • d3d1x: flush the pipe context when presenting
    • +
    • d3d1x: remove another include specstrings.h
    • +
    • d3d1x: flush properly
    • +
    • d3d1x: add missing guid.cpp
    • +
    • d3d1x: fix build without system EGL/egl.h
    • +
    • d3d1x: add autogenerated files as prerequisites, so make builds them
    • +
    • d3d1x: obliterate IDL parameter names from d3d10.idl from Wine too
    • +
    • d3d1x: add shader dumping
    • +
    • d3d1x: add untested support for geometry shader translation
    • +
    • d3d1x: don't assert on unsupported resource types
    • +
    • d3d1x: fix CheckMultisampleQualityLevels
    • +
    • d3d1x: draw to the correct buffer
    • +
    • d3d1x: fix linking of dxbc2tgsi
    • +
    • nvfx: allow setting NULL constant buffers
    • +
    • nvfx: add RGB framebuffer format support in addition to BGR
    • +
    • d3d1x: don't crash on drivers not supporting vertex or geometry sampling
    • +
    • d3d1x: assert if X visual is not among enumerated visuals
    • +
    • d3d1x: stop using GLX in demos, just use the default visual
    • +
    • d3d1x: CRLF -> LF in progs
    • +
    • mesa: make makedepend an hard requirement
    • +
    • gallium: add $(PROGS_DEPS) as dependencies for $(PROGS)
    • +
    • d3d1x: fix parallel build
    • +
    • d3d1x: add private gitignore file
    • +
    • d3d1x: fix progs linking if not all EGL platforms are enabled
    • +
    • d3d1x: link progs with CXXFLAGS
    • +
    • d3d11: advertise IDXGIDevice1, not just IDXGIDevice
    • +
    • d3d11: ignore StructureByteStride
    • +
    • d3d1x: link to libdrm for X11 platform too
    • +
    • ureg: support centroid interpolation
    • +
    • d3d1x: support centroid interpolation
    • +
    • d3d1x: properly support specifying MipLevels as 0
    • +
    • d3d1x: put proper calling convention in headers, fixes 64-bit builds
    • +
    • d3d1x: rework DXGI for occlusion testing and default width/height
    • +
    • d3d1x: fix Map
    • +
    • d3d11: fix reference counting so devices get freed
    • +
    • d3d1x: work around crash in widl
    • +
    • glsl: Unroll loops with conditional breaks anywhere (not just the end)
    • +

    + +

    Lucas Stach (1): +

      +
    • nvfx: fill PIPE_CAP_PRIMITIVE_RESTART and PIPE_CAP_SHADER_STENCIL_EXPORT
    • +

    + +

    Marek Olšák (100): +

      +
    • r300g: prevent creating multiple winsys BOs for the same handle
    • +
    • r300g/swtcl: fix CS overrun
    • +
    • st/mesa: fix assertion failure in GetTexImage for cubemaps
    • +
    • util: make calling remove_from_list multiple times in a row safe
    • +
    • r300g: fixup long-lived BO maps being incorrectly unmapped when flushing
    • +
    • r300g: make accessing map_list and buffer_handles thread-safe
    • +
    • r300g: fix a copy-paste typo for logging
    • +
    • r300g: fix the border color for every format other than PIPE_FORMAT_B8G8R8A8
    • +
    • Build r300g by default
    • +
    • util: fix util_pack_color for B4G4R4A4
    • +
    • r300g: fix macrotiling on R350
    • +
    • r300g: code cleanups
    • +
    • r300/compiler: fix projective mapping of 2D NPOT textures
    • +
    • r300/compiler: do not use copy propagation if SaturateMode is used
    • +
    • r300/compiler: fix shadow sampling with swizzled coords
    • +
    • r300g: add support for 3D NPOT textures without mipmapping
    • +
    • r300g: fix swizzling of texture border color
    • +
    • configure.ac: look for libdrm_radeon before building gallium/r300,r600
    • +
    • configure.ac: do not build xorg-r300g by default
    • +
    • Makefile: ensure Gallium's Makefile.xorg and SConscript.dri are in the tarball
    • +
    • r300g: add support for formats beginning with X, like X8R8G8B8
    • +
    • r300g: fix conditional rendering in non-wait path
    • +
    • r300g: add support for R8G8 colorbuffers
    • +
    • r300g: add support for L8A8 colorbuffers
    • +
    • update release notes for Gallium
    • +
    • r300g: fix microtiling for 16-bits-per-channel formats
    • +
    • r300g: do not print get_param errors in non-debug build
    • +
    • r300g: say no to PIPE_CAP_STREAM_OUTPUT and PIPE_CAP_PRIMITIVE_RESTART
    • +
    • mesa: allow FBO attachments of formats LUMINANCE, LUMINANCE_ALPHA, and INTENSITY
    • +
    • r300g: fix texture border for 16-bits-per-channel formats
    • +
    • st/mesa: support RGBA16 and use it for RGBA12 as well
    • +
    • r300g: add a default channel ordering of texture border for unhandled formats
    • +
    • r300g: mention ATI in the renderer string
    • +
    • r300g: rename has_hyperz -> can_hyperz
    • +
    • r300g: turn magic numbers into names in the hyperz code
    • +
    • gallium: add CAPs for indirect addressing and lower it in st/mesa when needed
    • +
    • tgsi: fill out CAPs for indirect addressing
    • +
    • i915g: fill out CAPs for indirect addressing
    • +
    • i965g: fill out CAPs for indirect addressing
    • +
    • nv50: fill out CAPs for indirect addressing
    • +
    • nvfx: fill out CAPs for indirect addressing
    • +
    • r300g: fill out CAPs for indirect addressing
    • +
    • r600g: fill out CAPs for indirect addressing
    • +
    • svga: fill out CAPs for indirect addressing
    • +
    • r300g: fix texture border color for all texture formats
    • +
    • r300g: clean up redundancy in draw functions
    • +
    • r300g: return shader caps from Draw for SWTCL vertex shaders
    • +
    • r300g: remove the hack with OPCODE_RET
    • +
    • r300g: print FS inputs uninitialized due to hardware limits to stderr
    • +
    • r300g: fix rendering with no vertex elements
    • +
    • st/mesa: enable ARB_explicit_attrib_location and EXT_separate_shader_objects
    • +
    • docs: add GL 4.1 status
    • +
    • gallium: add PIPE_SHADER_CAP_SUBROUTINES
    • +
    • st/mesa: set MaxUniformComponents
    • +
    • u_blitter: use PIPE_TRANSFER_DISCARD to prevent cpu/gpu stall
    • +
    • r300/compiler: fix rc_rewrite_depth_out for it to work with any instruction
    • +
    • r300/compiler: remove duplicate function rc_mask_to_swz
    • +
    • r300/compiler: add a function for swizzling a mask
    • +
    • r300/compiler: move util functions to radeon_compiler_util
    • +
    • u_blitter: interpolate clear color using a GENERIC varying instead of COLOR
    • +
    • st/mesa: fix texture border color for RED and RG base formats
    • +
    • util: rename u_mempool -> u_slab
    • +
    • r300g: fix texture border color once again
    • +
    • r300/compiler: implement and lower OPCODE_CLAMP
    • +
    • ir_to_mesa: Add support for conditional discards.
    • +
    • r300g: fix texture swizzling with compressed textures on r400-r500
    • +
    • r300g: disable ARB_texture_swizzle if S3TC is enabled on r3xx-only
    • +
    • r300g: fix up cubemap texture offset computation
    • +
    • r300/compiler: disable the swizzle lowering pass in vertex shaders
    • +
    • r300g: fix build
    • +
    • r300g: use internal BO handle for add_buffer and write_reloc
    • +
    • r300g: implement simple transfer_inline_write for buffers
    • +
    • mesa, st/mesa: fix gl_FragCoord with FBOs in Gallium
    • +
    • r300g: fix pointer arithmetic with void* in transfer_inline_write
    • +
    • r300g: do not remove unused constants if we are not near the limit
    • +
    • r300g: add capability bit index_bias_supported
    • +
    • r300g: one more r500_index_bias_supported leftover
    • +
    • r300g: do not use the index parameter in set_constant_buffer
    • +
    • r300g: cleanup winsys
    • +
    • r300g: optimize looping over atoms
    • +
    • st/mesa: initialize key in st_vp_varient
    • +
    • u_blitter: use util_is_format_compatible in the assert
    • +
    • r300g: cache packet dwords of 3D_LOAD_VBPNTR in a command buffer if possible
    • +
    • r300g: validate buffers only if any of bound buffers is changed
    • +
    • r300g: also revalidate the SWTCL vertex buffer after its reallocation
    • +
    • r300/compiler: don't terminate regalloc if we surpass max temps limit
    • +
    • r300/compiler: add a function to query program stats (alu, tex, temps..)
    • +
    • r300/compiler: cleanup rc_run_compiler
    • +
    • r300/compiler: do not print pair/tex/presub program stats for vertex shaders
    • +
    • r300/compiler: handle DPH and XPD in rc_compute_sources_for_writemask
    • +
    • r300/compiler: make lowering passes possibly use up to two less temps
    • +
    • r300/compiler: remove at least unused immediates if externals cannot be removed
    • +
    • r300/compiler: fix LIT in VS
    • +
    • r300/compiler: fix swizzle lowering with a presubtract source operand
    • +
    • r300g: fix rendering with a vertex attrib having a zero stride
    • +
    • r300g: finally fix the texture corruption on r3xx-r4xx
    • +
    • r300g/swtcl: re-enable LLVM
    • +
    • r300g: mark vertex arrays as dirty after a buffer_offset change
    • +
    • mesa: fix texel store functions for some float formats
    • +
    • r300/compiler: disable the rename_regs pass for loops
    • +

    + +

    Mario Kleiner (1): +

      +
    • mesa/r300classic: Fix dri2Invalidate/radeon_prepare_render for page flipping.
    • +

    + +

    Mathias Fröhlich (3): +

      +
    • r300g: Avoid returning values in a static array, fixing a potential race
    • +
    • r600g: Only compare active vertex elements
    • +
    • st/mesa: Set PIPE_TRANSFER_DISCARD for GL_MAP_INVALIDATE_RANGE/BUFFFER_BIT
    • +

    + +

    Michal Krol (10): +

      +
    • svga: Fix relative addressing translation for pixel shaders.
    • +
    • svga: Integer constant register file has a separate namespace.
    • +
    • tgsi/exec: Cleanup the remaining arithmetic instructions.
    • +
    • tgsi/exec: Get rid of obsolete condition codes.
    • +
    • tgsi/build: Reduce interface clutter.
    • +
    • graw/gdi: Initial commit.
    • +
    • scons: Hook-up graw-gdi target.
    • +
    • graw/gdi: Fix window dimensions.
    • +
    • os: Open file streams in binary mode.
    • +
    • graw: Export graw_save_surface_to_file().
    • +

    + +

    Nicolas Kaiser (26): +

      +
    • swrast: remove duplicated include
    • +
    • egl: remove duplicated include
    • +
    • gallium/rtasm: remove duplicated include
    • +
    • gallium/util: remove duplicated include
    • +
    • gallium/i915: remove duplicated include
    • +
    • gallium/llvmpipe: remove duplicated include
    • +
    • gallium/softpipe: remove duplicated include
    • +
    • gallium/st: remove duplicated includes
    • +
    • gallium/winsys: remove duplicated include
    • +
    • glx: remove duplicated include
    • +
    • dri/common: remove duplicated include
    • +
    • dri/i810: remove duplicated include
    • +
    • dri/i915: remove duplicated include
    • +
    • dri/i965: remove duplicated include
    • +
    • dri/intel: remove duplicated include
    • +
    • dri/mga: remove duplicated include
    • +
    • dri/r128: remove duplicated include
    • +
    • dri/r300: remove duplicated include
    • +
    • dri/r600: remove duplicated include
    • +
    • dri/radeon: remove duplicated includes
    • +
    • dri/savage: remove duplicated include
    • +
    • main: remove duplicated includes
    • +
    • math: remove duplicated includes
    • +
    • st: remove duplicated include
    • +
    • i965g: use Elements macro instead of manual sizeofs
    • +
    • nv50: fix always true conditional in shader optimization
    • +

    + +

    Orion Poplawski (1): +

      +
    • osmesa: link against libtalloc
    • +

    + +

    Owen W. Taylor (1): +

      +
    • r600g: Fix location for clip plane registers
    • +

    + +

    Peter Clifton (3): +

      +
    • intel: Fix emit_linear_blit to use DWORD aligned width blits
    • +
    • intel: Add assert check for blitting alignment.
    • +
    • meta: Mask Stencil.Clear against stencilMax in _mesa_meta_Clear
    • +

    + +

    Robert Hooker (2): +

      +
    • intel: Add a new B43 pci id.
    • +
    • egl_dri2: Add missing intel chip ids.
    • +

    + +

    Roland Scheidegger (16): +

      +
    • gallivm: fix copy&paste bug
    • +
    • gallivm: don't use URem/UDiv when calculating offsets for blocks
    • +
    • gallivm: optimize yuv decoding
    • +
    • gallivm: fix trunc/itrunc comment
    • +
    • gallivm: faster iround implementation for sse2
    • +
    • gallivm: replace sub/floor/ifloor combo with ifloor_fract
    • +
    • gallivm: optimize some tex wrap mode calculations a bit
    • +
    • gallivm: more linear tex wrap mode calculation simplification
    • +
    • gallivm: avoid unnecessary URem in linear wrap repeat case
    • +
    • gallivm: optimize soa linear clamp to edge wrap mode a bit
    • +
    • gallivm: make use of new iround code in lp_bld_conv.
    • +
    • gallivm: fix different handling of [non]normalized coords in linear soa path
    • +
    • gallivm: only use lp_build_conv 4x4f -> 1x16 ub fastpath with sse2
    • +
    • r200: fix r200 large points
    • +
    • mesa: remove unneeded DD_POINT_SIZE and DD_LINE_WIDTH tricaps
    • +
    • gallium: support for array textures and related changes
    • +

    + +

    Shuang He (1): +

      +
    • mesa: allow GLfixed arrays for OpenGL ES 2.0
    • +

    + +

    Stephan Schmid (1): +

      +
    • r600g: fix relative addressing when splitting constant accesses
    • +

    + +

    Thomas Hellstrom (21): +

      +
    • st/xorg: Don't try to use option values before processing options
    • +
    • xorg/vmwgfx: Make vmwarectrl work also on 64-bit servers
    • +
    • st/xorg: Add a customizer option to get rid of annoying cursor update flicker
    • +
    • xorg/vmwgfx: Don't hide HW cursors when updating them
    • +
    • st/xorg: Don't try to remove invalid fbs
    • +
    • st/xorg: Fix typo
    • +
    • st/xorg, xorg/vmwgfx: Be a bit more frendly towards cross-compiling environments
    • +
    • st/xorg: Fix compilation errors for Xservers compiled without Composite
    • +
    • st/xorg: Don't use deprecated x*alloc / xfree functions
    • +
    • xorg/vmwgfx: Don't use deprecated x*alloc / xfree functions
    • +
    • st/xorg: Fix compilation for Xservers >= 1.10
    • +
    • mesa: Make sure we have the talloc cflags when using the talloc headers
    • +
    • egl: Add an include for size_t
    • +
    • mesa: Add talloc includes for gles
    • +
    • st/egl: Fix build for include files in nonstandard places
    • +
    • svga/drm: Optionally resolve calls to powf during link-time
    • +
    • gallium/targets: Trivial crosscompiling fix
    • +
    • st/xorg: Add a function to flush pending rendering and damage
    • +
    • gallium/targets/xorg-vmwgfx: Xv fixes
    • +
    • xorg/vmwgfx: Flush even if we don't autopaint the color key
    • +
    • xorg/vmwgfx: Don't clip video to viewport
    • +

    + +

    Tilman Sauerbeck (35): +

      +
    • r600g: Fixed a bo leak in r600_blit_state_ps_shader().
    • +
    • r600g: Use clamped math for RCP and RSQ.
    • +
    • r600g: Formatting fixes.
    • +
    • r600g: Added DB_SHADER_CONTROL defines.
    • +
    • r600g: Only set PA_SC_EDGERULE on rv770 and greater.
    • +
    • r600g: Enable PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED.
    • +
    • r600g: Fixed the shift in S_02880C_KILL_ENABLE.
    • +
    • glsl2: Empty functions can be inlined.
    • +
    • glsl2: Fixed cloning of ir_call error instructions.
    • +
    • r600g: Added support for TGSI_SEMANTIC_FACE.
    • +
    • gallium/docs: Fixed a typo in the SCS opcode description.
    • +
    • r600g: Honour destination operand's writemask in the SCS implementation.
    • +
    • r600g: Implemented the Z and W component write for the SCS opcode.
    • +
    • python/tests: Fixed tri.py for API and TGSI syntax changes.
    • +
    • r600g: Removed debug code.
    • +
    • gallium/docs: The RET opcode may appear anywhere in a subroutine.
    • +
    • r600g: Destroy the blitter.
    • +
    • r600g: Fixed two texture surface leaks in r600_blit_uncompress_depth().
    • +
    • r600g: Cleaned up index buffer reference handling in the draw module.
    • +
    • r600g: Fixed r600_vertex_element leak.
    • +
    • r600g: Added r600_pipe_shader_destroy().
    • +
    • r600g: Also clear bc data when we're destroying a shader.
    • +
    • r600g: In radeon_bo(), call LIST_INITHEAD early.
    • +
    • r600g: Destroy the blitter.
    • +
    • r600g: Removed unused 'ptr' argument from radeon_bo().
    • +
    • r600g: Made radeon_bo_pb_map_internal() actually call radeon_bo_map().
    • +
    • r600g: Fixed unmap condition in radeon_bo_pb_destroy().
    • +
    • r600g: Made radeon_bo::map_count signed.
    • +
    • r600g: We don't support PIPE_CAP_PRIMITIVE_RESTART.
    • +
    • r600g: Delete custom_dsa_flush on shutdown.
    • +
    • r600g: Fixed two memory leaks in winsys.
    • +
    • r600g: Destroy the winsys in r600_destroy_screen().
    • +
    • st/mesa: Reset the index buffer before destroying the pipe context.
    • +
    • st/mesa: Reset the constant buffers before destroying the pipe context.
    • +
    • r600g: Removed duplicated call to tgsi_split_literal_constant().
    • +

    + +

    Timo Wiren (1): +

      +
    • Fix typos in comments and debug output strings.
    • +

    + +

    Tom Fogal (3): +

      +
    • Implement x86_64 atomics for compilers w/o intrinsics.
    • +
    • Prefer intrinsics to handrolled atomic ops.
    • +
    • Revert "Prefer intrinsics to handrolled atomic ops."
    • +

    + +

    Tom Stellard (32): +

      +
    • r300/compiler: Refactor the pair instruction data structures
    • +
    • r300g: Always try to build libr300compiler.a
    • +
    • r300/compiler: Fix two mistakes in the presubtract optimization pass.
    • +
    • r300/compiler: Add more helper functions for iterating through sources
    • +
    • r300/compiler: Print immediate values after "dead constants" pass
    • +
    • r300/compiler: radeon_remove_constants.c: fix indentation
    • +
    • r300/compiler: Use rc_for_all_reads_src() in "dead constants" pass
    • +
    • r300/compiler: Fix segfault in error path
    • +
    • r300/compiler: Don't use rc_error() unless the error is unrecoverable
    • +
    • r300/compiler: Don't merge instructions that write output regs and ALU result
    • +
    • r300/compiler: Create a helper function for merging presubtract sources
    • +
    • r300/compiler: Fix incorrect assumption
    • +
    • r300/compiler: Clear empty registers after constant folding
    • +
    • r300/compiler: Add a new function for more efficient dataflow analysis
    • +
    • r300g: Add new debug option for logging vertex/fragment program stats
    • +
    • r300/compiler: Use rc_get_readers_normal() for presubtract optimizations
    • +
    • r300/compiler: Don't clobber presubtract sources during optimizations
    • +
    • r300/compiler: Don't track readers into an IF block.
    • +
    • r300/compiler: Make sure presubtract sources use supported swizzles
    • +
    • r300/compiler: Fix register allocator's handling of loops
    • +
    • r300/compiler: Fix instruction scheduling within IF blocks
    • +
    • r300/compiler: Use zero as the register index for unused sources
    • +
    • r300/compiler: Ignore alpha dest register when replicating the result
    • +
    • r300/compiler: Add rc_get_readers()
    • +
    • r300/compiler: Handle BREAK and CONTINUE in rc_get_readers()
    • +
    • r300/compiler: Track readers through branches in rc_get_readers()
    • +
    • r300/compiler: Convert RGB to alpha in the scheduler
    • +
    • r300/compiler: Use presubtract operations as much as possible
    • +
    • r300/compiler: Enable rename_reg pass for r500 cards
    • +
    • r300/compiler: Add a more efficient version of rc_find_free_temporary()
    • +
    • r300/compiler: Don't allow presubtract sources to be remapped twice
    • +
    • r300/compiler: Fix black terrain in Civ4
    • +

    + +

    Victor Tseng (1): +

      +
    • egl/i965: include inline_wrapper_sw_helper.h
    • +

    + +

    Viktor Novotný (6): +

      +
    • dri/nouveau: Import headers from rules-ng-ng
    • +
    • dri/nouveau: nv04: Use rules-ng-ng headers
    • +
    • dri/nouveau: nv10: Use rules-ng-ng headers
    • +
    • dri/nouveau nv20: Use rules-ng-ng headers
    • +
    • dri/nouveau: Remove nouveau_class.h, finishing switch to rules-ng-ng headers
    • +
    • dri/nouveau: Clean up magic numbers in get_rt_format
    • +

    + +

    Vinson Lee (214): +

      +
    • llvmpipe: Remove unnecessary header.
    • +
    • r600g: Remove unnecessary headers.
    • +
    • mesa: Include missing header in program.h.
    • +
    • glsl: Fix 'format not a string literal and no format arguments' warning.
    • +
    • r600g: Silence uninitialized variable warning.
    • +
    • r600g: Silence uninitialized variable warning.
    • +
    • nvfx: Silence uninitialized variable warnings.
    • +
    • r600g: Silence uninitialized variable warning.
    • +
    • r600g: Silence uninitialized variable warning.
    • +
    • r600g: Silence uninitialized variable warning.
    • +
    • r600g: Silence unused variable warning.
    • +
    • nv50: Update files in SConscript to match Makefile.
    • +
    • nv50: Remove unnecessary headers.
    • +
    • nv50: Silence uninitialized variable warning.
    • +
    • nv50: Silence uninitialized variable warning.
    • +
    • nv50: Silence uninitialized variable warning.
    • +
    • gallivm: Remove unnecessary headers.
    • +
    • draw: Remove unnecessary header.
    • +
    • nv50: Silence uninitialized variable warnings.
    • +
    • nv50: Fix 'control reaches end of non-void function' warning.
    • +
    • mesa/st: Silence uninitialized variable warning.
    • +
    • gallivm: Remove unnecessary header.
    • +
    • r600g: Remove unnecessary header.
    • +
    • r600g: Remove unnecessary headers.
    • +
    • r600g: Fix implicit declaration warning.
    • +
    • r600g: Fix memory leak on error path.
    • +
    • r600g: Silence uninitialized variable warning.
    • +
    • r600g: Silence unused variable warnings.
    • +
    • mesa: bump version to 7.10
    • +
    • ir_to_mesa: Remove unused member array_indexed from struct statevar_element.
    • +
    • mesa: Silence "'valid_texture_object' defined but not used" warning.
    • +
    • x86: Silence unused variable warning on Mac OS X.
    • +
    • glsl: Fix 'control reaches end of non-void function' warning.
    • +
    • nvfx: Remove const qualifer from nvfx_vertprog_translate.
    • +
    • nvfx: Silence uninitialized variable warnings.
    • +
    • r600g: Remove unused variable.
    • +
    • nv50: Silence missing initializer warning.
    • +
    • nv50: Remove dead initialization.
    • +
    • nv50: Remove dead initialization.
    • +
    • tgsi: Remove duplicate case value.
    • +
    • glut: Define markWindowHidden for non-Windows only.
    • +
    • glut: Define eventParser for non-Windows only.
    • +
    • r300g: Silence uninitialized variable warning.
    • +
    • intel: Fix implicit declaration of function '_mesa_meta_Bitmap' warning.
    • +
    • mesa: Remove unnecessary headers.
    • +
    • r600g: Remove unnecessary header.
    • +
    • unichrome: Remove unnecessary header.
    • +
    • intel: Remove unnecessary headers.
    • +
    • r600g: Remove unused variable.
    • +
    • r600g: Disable unused variables.
    • +
    • r600g: Remove unused variable.
    • +
    • r600g: Silence 'control reaches end of non-void function' warning.
    • +
    • r600g: Remove unused variable.
    • +
    • r600g: Remove unused variable.
    • +
    • r600g: Disable unused variables.
    • +
    • intel: Remove unnecessary header.
    • +
    • st/dri: Remove unnecessary header.
    • +
    • r600g: Remove unused variable.
    • +
    • r300g: Remove unused variable.
    • +
    • r600g: Don't return a value in function returning void.
    • +
    • r600g: Remove unused variables.
    • +
    • r600g: Include p_compiler.h instead of malloc.h.
    • +
    • r600g: Silence uninitialized variable warnings.
    • +
    • scons: Add MinGW-w64 prefixes for MinGW build.
    • +
    • dri: Add GET_PROGRAM_NAME definition for Mac OS X.
    • +
    • scons: Add program/sampler.cpp to SCons build.
    • +
    • mesa: Fix printf format warning.
    • +
    • mesa: Fix printf format warning.
    • +
    • mesa: Fix printf format warning.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • r600g: Update SConscript.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • r600g: Update SConscript.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • r600g: Update SConscript.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • r600g: Fix SCons build.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • r300/compiler: Remove declaration before code.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • glsl: Remove unnecessary header.
    • +
    • savage: Remove unnecessary header.
    • +
    • r600g: Remove unused variable.
    • +
    • r600g: Remove unnecessary headers.
    • +
    • r600g: Fix SCons build.
    • +
    • r600g: Remove unnecessary header.
    • +
    • gallivm: Remove unnecessary header.
    • +
    • r600g: Silence uninitialized variable warning.
    • +
    • r600g: Silence uninitialized variable warning.
    • +
    • r600g: Silence uninitialized variable warning.
    • +
    • i915: Silence unused variable warning in non-debug builds.
    • +
    • i915: Silence unused variable warning in non-debug builds.
    • +
    • i965: Silence unused variable warning on non-debug builds.
    • +
    • i965: Silence unused variable warning on non-debug builds.
    • +
    • i965: Initialize member variables.
    • +
    • r300: Silence uninitialized variable warning.
    • +
    • tdfx: Silence unused variable warning on non-debug builds.
    • +
    • gallivm: Remove unnecessary header.
    • +
    • glsl: Initialize variable in ir_derefence_array::constant_expression_value
    • +
    • mesa: Add missing header to shaderobj.h.
    • +
    • llvmpipe: Return non-zero exit code for lp_test_round failures.
    • +
    • r300/compiler: Remove unused variable.
    • +
    • st/xorg: Fix memory leak on error path.
    • +
    • llvmpipe: Initialize state variable in debug_bin function.
    • +
    • llvmpipe: Initialize variable.
    • +
    • draw: Move loop variable declaration outside for loop.
    • +
    • r600g: Ensure r600_src is initialized in tgsi_exp function.
    • +
    • glsl: Add assert for unhandled ir_shader case.
    • +
    • swrast: Print out format on unexpected failure in _swrast_DrawPixels.
    • +
    • llvmpipe: Remove unnecessary header.
    • +
    • draw: Remove unnecessary header.
    • +
    • gallivm: Silence uninitialized variable warnings.
    • +
    • gallivm: Silence uninitialized variable warnings.
    • +
    • gallivm: Silence uninitialized variable warning.
    • +
    • r300g: Silence uninitialized variable warning.
    • +
    • mesa: Remove unnecessary headers.
    • +
    • r600g: Silence uninitialized variable warnings.
    • +
    • st/mesa: Remove unnecessary header.
    • +
    • mesa: Remove unnecessary header.
    • +
    • egl: Remove unnecessary headers.
    • +
    • swrast: Print out format on unexpected failure in _swrast_ReadPixels.
    • +
    • st/mesa: Silence uninitialized variable warning.
    • +
    • savage: Remove unnecessary header.
    • +
    • st/vega: Remove unnecessary headers.
    • +
    • dri/nouveau: Silence uninitialized variable warning.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • i965: Silence uninitialized variable warning.
    • +
    • i965: Silence uninitialized variable warning.
    • +
    • mesa: Clean up header file inclusion in accum.h.
    • +
    • mesa: Clean up header file inclusion in version.h.
    • +
    • mesa: Clean up header file inclusion in api_loopback.h.
    • +
    • mesa: Clean up header file inclusion in api_validate.h.
    • +
    • mesa: Include mfeatures.h in api_loopback for FEATURE_beginend.
    • +
    • mesa: Include mfeatures.h in api_validate.c for FEATURE_* symbols.
    • +
    • mesa: Clean up header file inclusion in arrayobj.h.
    • +
    • mesa: Clean up header file inclusion in atifragshader.h.
    • +
    • mesa: Clean up header file inclusion in attrib.h.
    • +
    • mesa: Clean up header file inclusion in blend.h.
    • +
    • mesa: Clean up header file inclusion in buffers.h.
    • +
    • mesa: Clean up header file inclusion in colortab.h.
    • +
    • mesa: Clean up header file inclusion in convolve.h.
    • +
    • mesa: Clean up header file inclusion in debug.h.
    • +
    • mesa: Clean up header file inclusion in depth.h.
    • +
    • mesa: Clean up header file inclusion in depthstencil.h.
    • +
    • mesa: Clean up header file inclusion in drawpix.h.
    • +
    • mesa: Clean up header file inclusion in drawtex.h.
    • +
    • mesa: Clean up header file inclusion in enable.h.
    • +
    • mesa: Clean up header file inclusion in extensions.h.
    • +
    • graw: Add struct pipe_surface forward declaration.
    • +
    • mesa: Clean up header file inclusion in fbobject.h.
    • +
    • mesa: Clean up header file inclusion in ffvertex_prog.h.
    • +
    • mesa: Clean up header file inclusion in fog.h.
    • +
    • mesa: Clean up header file inclusion in framebuffer.h.
    • +
    • mesa: Clean up header file inclusion in hint.h.
    • +
    • mesa: Clean up header file inclusion in histogram.h.
    • +
    • mesa: Clean up header file inclusion in image.h.
    • +
    • mesa: Add missing header and forward declarations in dd.h.
    • +
    • mesa: Clean up header file inclusion in light.h.
    • +
    • mesa: Clean up header file inclusion in lines.h.
    • +
    • mesa: Clean up header file inclusion in matrix.h.
    • +
    • mesa: Clean up header file inclusion in multisample.h.
    • +
    • mesa: Clean up header file inclusion in nvprogram.h.
    • +
    • winsys/xlib: Add cygwin to SConscript.
    • +
    • mesa: Clean up header file inclusion in pixel.h.
    • +
    • mesa: Clean up header file inclusion in pixelstore.h.
    • +
    • mesa: Fix printf format warnings.
    • +
    • mesa: Clean up header file inclusion in points.h.
    • +
    • i965: Silence uninitialized variable warning.
    • +
    • glsl: Add ir_constant_expression.cpp to SConscript.
    • +
    • mesa: Add definitions for inverse hyperbolic function on MSVC.
    • +
    • glsl: Fix 'control reaches end of non-void function' warning.
    • +
    • glsl: Add lower_vector.cpp to SConscript.
    • +
    • glsl: Fix type of label 'default' in switch statement.
    • +
    • st/mesa: Remove unnecessary headers.
    • +
    • swrast: Remove unnecessary header.
    • +
    • r600: Remove unnecesary header.
    • +
    • intel: Remove unnecessary header.
    • +
    • mesa: Clean up header file inclusion in polygon.h.
    • +
    • mesa: Clean up header file inclusion in rastpos.h.
    • +
    • mesa: Clean up header file inclusion in readpix.h.
    • +
    • mesa: Clean up header file inclusion in renderbuffer.h.
    • +
    • mesa: Clean up header file inclusion in scissor.h.
    • +
    • mesa: Clean up header file inclusion in shaderapi.h.
    • +
    • mesa: Clean up header file inclusion in shared.h.
    • +
    • mesa: Clean up header file inclusion in stencil.h.
    • +
    • r600: Remove unnecessary header.
    • +
    • llvmpipe: Remove unnecessary headers.
    • +
    • mesa: Clean up header file inclusion in syncobj.h.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • r300/compiler: Move declaration before code.
    • +
    • mesa: Clean up header file inclusion in texcompress.h.
    • +
    • st/vega: Silence uninitialized variable warning.
    • +
    • mesa: Clean up header file inclusion in texcompress_s3tc.h.
    • +
    • mesa: Clean up header file inclusion in texenvprogram.h.
    • +
    • mesa: Clean up header file inclusion in texformat.h.
    • +
    • mesa: Clean up header file inclusion in texgetimage.h.
    • +
    • mesa: Clean up header file inclusion in texobj.h.
    • +
    • gallium/noop: Add prototype for noop_init_state_functions.
    • +
    • mesa: Clean up header file inclusion in texrender.h.
    • +
    • mesa: Clean up header file inclusion in transformfeedback.h.
    • +
    • mesa: Clean up header file inclusion in varray.h.
    • +
    • mesa: Clean up header file inclusion in viewport.h.
    • +
    • r200: Silence uninitialized variable warning.
    • +
    • r600g: Fix SCons build.
    • +
    • i965: Silence uninitialized variable warning.
    • +

    + +

    Xavier Chantry (8): +

      +
    • nv50: fix size of outputs_written array
    • +
    • nv50: apply layout_mask to tile_flags
    • +
    • nvfx: only expose one rt on nv30
    • +
    • nvfx: fb->nr_cbufs <= 1 on nv30
    • +
    • nvfx: reset nvfx->hw_zeta
    • +
    • nvfx: fixes after array textures merge
    • +
    • init ps->context with util_surfaces_get and do_get
    • +
    • gallium/trace: check bind_vertex_sampler_states and set_vertex_sampler_views
    • +

    + +

    Xiang, Haihao (10): +

      +
    • mesa: fix regression from b4bb6680200b5a898583392f4c831c02f41e63f7
    • +
    • i965: add support for polygon mode on Sandybridge.
    • +
    • i965: fix for flat shading on Sandybridge
    • +
    • i965: set minimum/maximum Point Width on Sandybridge
    • +
    • meta: allow nested meta operations
    • +
    • i965: support for two-sided lighting on Sandybridge
    • +
    • i965: fix register region description
    • +
    • i965: use align1 access mode for instructions with execSize=1 in VS
    • +
    • i965: don't spawn GS thread for LINELOOP on Sandybridge
    • +
    • i965: use BLT to clear buffer if possible on Sandybridge
    • +

    + +

    Zack Rusin (8): +

      +
    • rbug: fix rbug when contexts are being destroyed
    • +
    • llvmpipe: fix rasterization of vertical lines on pixel boundaries
    • +
    • scons: build the xorg state trackers only when env includes drm
    • +
    • gallivm: implement indirect addressing of the output registers
    • +
    • gallivm: implement indirect addressing over inputs
    • +
    • gallivm: fix storing of the addr register
    • +
    • scons: add alias for identity
    • +
    • gallium/util: add states relevant to geometry shaders
    • +

    + +

    Zhenyu Wang (40): +

      +
    • i965: disasm quarter and write enable instruction control on sandybridge
    • +
    • i965: new state dump for sandybridge
    • +
    • i965: enable accumulator update in PS kernel too on sandybridge
    • +
    • i965: Fix color interpolation on sandybridge
    • +
    • i965: force zero in clipper to ignore RTAIndex on sandybridge
    • +
    • i965: fix point size setting in header on sandybridge
    • +
    • i965: ff sync message change for sandybridge
    • +
    • i965: ignore quads for GS kernel on sandybridge
    • +
    • i965: add sandybridge viewport state bo into validation list
    • +
    • i965: VS use SPF mode on sandybridge for now
    • +
    • i965: fix jump count on sandybridge
    • +
    • i965: Fix sampler on sandybridge
    • +
    • i965: fix const register count for sandybridge
    • +
    • i965: Add all device ids for sandybridge
    • +
    • i965: sandybridge pipe control workaround before write cache flush
    • +
    • i965: only allow SIMD8 kernel on sandybridge now
    • +
    • i965: don't do calculation for delta_xy on sandybridge
    • +
    • i965: fix pixel w interpolation on sandybridge
    • +
    • i965: enable polygon offset on sandybridge
    • +
    • i965: fix scissor state on sandybridge
    • +
    • i965: fix point sprite on sandybridge
    • +
    • i965: fix occlusion query on sandybridge
    • +
    • i965: fallback bitmap operation on sandybridge
    • +
    • i965: Always set tiling for depth buffer on sandybridge
    • +
    • i965: fallback lineloop on sandybridge for now
    • +
    • Revert "i965: Always set tiling for depth buffer on sandybridge"
    • +
    • i965: always set tiling for fbo depth buffer on sandybridge
    • +
    • i965: Fix GS hang on Sandybridge
    • +
    • Revert "i965: fallback lineloop on sandybridge for now"
    • +
    • i965: refresh wm push constant also for BRW_NEW_FRAMENT_PROGRAM on gen6
    • +
    • i965: fix dest type of 'endif' on sandybridge
    • +
    • Revert "i965: VS use SPF mode on sandybridge for now"
    • +
    • i965: also using align1 mode for math2 on sandybridge
    • +
    • i965: Fix GS state uploading on Sandybridge
    • +
    • i965: upload WM state for _NEW_POLYGON on sandybridge
    • +
    • i965: Use MI_FLUSH_DW for blt ring flush on sandybridge
    • +
    • i965: explicit tell header present for fb write on sandybridge
    • +
    • i965: Fix occlusion query on sandybridge
    • +
    • i965: Use last vertex convention for quad provoking vertex on sandybridge
    • +
    • i965: Fix provoking vertex select in clip state for sandybridge
    • +

    + +

    Zou Nan hai (1): +

      +
    • i965: skip too small size mipmap
    • +

    + +

    delphi (2): +

      +
    • draw: added userclip planes and updated variant_key
    • +
    • draw: some changes to allow for runtime changes to userclip planes
    • +

    + +

    nobled (3): +

      +
    • r300g: Abort if atom allocations fail
    • +
    • r300g: Abort if draw_create() fails
    • +
    • r300g: Drop unnecessary cast
    • +

    + +

    pontus lidman (1): +

      +
    • mesa: check for posix_memalign() errors
    • +

    + +

    richard (2): +

      +
    • evergreen : fix z format setting, enable stencil.
    • +
    • r600c : inline vertex format is not updated in an app, switch to use vfetch constants. For the 7.9 and 7.10 branches as well.
    • +

    + + + diff --git a/mesalib/docs/relnotes-7.8.2.html b/mesalib/docs/relnotes-7.8.2.html index 5ee7e12d2..1393b2ede 100644 --- a/mesalib/docs/relnotes-7.8.2.html +++ b/mesalib/docs/relnotes-7.8.2.html @@ -1,146 +1,146 @@ - - -Mesa Release Notes - - - - - - - -

    Mesa 7.8.2 Release Notes / (date tbd)

    - -

    -Mesa 7.8.2 is a bug fix release which fixes bugs found since the 7.8.1 release. -

    -

    -Mesa 7.8.2 implements the OpenGL 2.1 API, but the version reported by -glGetString(GL_VERSION) depends on the particular driver being used. -Some drivers don't support all the features required in OpenGL 2.1. -

    -

    -See the Compiling/Installing page for prerequisites -for DRI hardware acceleration. -

    - - -

    MD5 checksums

    -
    -c89b63d253605ed40e8ac370d25a833c  MesaLib-7.8.2.tar.gz
    -6be2d343a0089bfd395ce02aaf8adb57  MesaLib-7.8.2.tar.bz2
    -a04ad3b06ac5ff3969a003fa7bbf7d5b  MesaLib-7.8.2.zip
    -7c213f92efeb471f0331670d5079d4c0  MesaDemos-7.8.2.tar.gz
    -757d9e2e06f48b1a52848be9b0307ced  MesaDemos-7.8.2.tar.bz2
    -8d0e5cfe68b8ebf90265d350ae2c48b1  MesaDemos-7.8.2.zip
    -b74482e3f44f35ed395c4aada4fd8240  MesaGLUT-7.8.2.tar.gz
    -a471807b65e49c325808ba4551be93ed  MesaGLUT-7.8.2.tar.bz2
    -9f190268c42be582ef66e47365ee61e3  MesaGLUT-7.8.2.zip
    -
    - - -

    New features

    -

    None.

    - - -

    Changes

    -
      -
    • Upgraded glext.h to version 61, and upgraded glxext.h -
    - - -

    Bug fixes

    -
      -
    • Fixed Gallium glDrawPixels(GL_DEPTH_COMPONENT). -
    • Fixed Gallium Cell driver to buildable, runable state -
    • Fixed bad error checking for glFramebufferRenderbuffer(attachment=GL_DEPTH_STENCIL_ATTACHMENT). -
    • Fixed incorrect Z coordinate handling in "meta" glDraw/CopyPixels. - Bug - #23670.
    • - -
    • Assorted i965 driver fixes. - Including but not limited to: -
        -
      • Fix scissoring when width or height is - 0. Bug - #27643. -
      • Fix bit allocation for number of color regions for - ARB_draw_buffers.
      • -
      • Set the correct provoking vertex for clipped first-mode - trifans. Bug - #24470.
      • -
      • Use R16G16B16A16_FLOAT for 3-component half-float.
      • -
      • Fix assertion for surface tile offset usage on Ironlake.
      • -
      • Fix cube map layouts on Ironlake.
      • -
      • When an RB gets a new region, clear the old from the state - cache. Bug - #24119.
      • -
      • Reject shaders with uninlined function calls instead of hanging.
      • -
      -
    • - -
    • Assorted i915 driver fixes. Including but not limited to: -
        -
      • Fixed texture LOD clamping in i915 driver. - Bug - #24846.
      • -
      • Fix off-by-one for drawing rectangle. - Bug - #27408.
      • -
      -
    • - -
    • Fixed hangs in etracer on 830 and 845 - chipsets. Bug - #26557.
    • -
    • Fixed tiling of small textures on all Intel drivers.
    • -
    • Fixed crash in Savage driver when using _mesa_CopyTexImage2D. - Bug - #27652.
    • - -
    • Assorted GLX fixes. Including but not limited to: -
        -
      • Fixed __glXInitializeVisualConfigFromTags's handling of - unrecognized fbconfig tags.
      • -
      • Fixed regression with GLX_USE_GL. -
      • Fixed config chooser logic for 'mask' matching.
      • -
      • Report swap events correctly in direct rendered case (DRI2)
      • -
      • Fixed build with dri2proto which doesn't define - X_DRI2SwapInterval.
      • -
      • Get GLX_SCREEN first in __glXQueryContextInfo. - Bug - #14245.
      • -
      -
    • - -
    • Assorted GLSL fixes. Including but not limited to: -
        -
      • Change variable declared assertion into conditional in GLSL - compiler. Bug - #27921.
      • -
      • Fix instruction indexing - bugs. Bug - #27566.
      • -
      • Updated uniform location / offset encoding to be more like - other implementations.
      • -
      • Don't overwrite a driver's shader infolog with generic failure - message.
      • -
      -
    • - -
    • Fixed OSMesa build for 16 and 32-bit color channel depth. -
    • Fixed OSMesa build with hidden symbol visibility. libOSMesa no longer links to libGL. - Bug - #28305. -
    • Fixed handling of multiple render targets in fixed-function - texture envrionmnent programs.
    • -
    • Fixed conversion errors in signed_rgba8888[rev] texel - fetch.
    • -
    • Don't set srcLevel on GL_TEXTURE_RECTANGLE_ARB targets.
    • -
    • Various build fixes for OpenBSD.
    • -
    • Various build fixes for OS X.
    • -
    • Various build fixes for GCC 3.3.
    • -
    - - - - + + +Mesa Release Notes + + + + + + + +

    Mesa 7.8.2 Release Notes / (date tbd)

    + +

    +Mesa 7.8.2 is a bug fix release which fixes bugs found since the 7.8.1 release. +

    +

    +Mesa 7.8.2 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    + + +

    MD5 checksums

    +
    +c89b63d253605ed40e8ac370d25a833c  MesaLib-7.8.2.tar.gz
    +6be2d343a0089bfd395ce02aaf8adb57  MesaLib-7.8.2.tar.bz2
    +a04ad3b06ac5ff3969a003fa7bbf7d5b  MesaLib-7.8.2.zip
    +7c213f92efeb471f0331670d5079d4c0  MesaDemos-7.8.2.tar.gz
    +757d9e2e06f48b1a52848be9b0307ced  MesaDemos-7.8.2.tar.bz2
    +8d0e5cfe68b8ebf90265d350ae2c48b1  MesaDemos-7.8.2.zip
    +b74482e3f44f35ed395c4aada4fd8240  MesaGLUT-7.8.2.tar.gz
    +a471807b65e49c325808ba4551be93ed  MesaGLUT-7.8.2.tar.bz2
    +9f190268c42be582ef66e47365ee61e3  MesaGLUT-7.8.2.zip
    +
    + + +

    New features

    +

    None.

    + + +

    Changes

    +
      +
    • Upgraded glext.h to version 61, and upgraded glxext.h +
    + + +

    Bug fixes

    +
      +
    • Fixed Gallium glDrawPixels(GL_DEPTH_COMPONENT). +
    • Fixed Gallium Cell driver to buildable, runable state +
    • Fixed bad error checking for glFramebufferRenderbuffer(attachment=GL_DEPTH_STENCIL_ATTACHMENT). +
    • Fixed incorrect Z coordinate handling in "meta" glDraw/CopyPixels. + Bug + #23670.
    • + +
    • Assorted i965 driver fixes. + Including but not limited to: +
        +
      • Fix scissoring when width or height is + 0. Bug + #27643. +
      • Fix bit allocation for number of color regions for + ARB_draw_buffers.
      • +
      • Set the correct provoking vertex for clipped first-mode + trifans. Bug + #24470.
      • +
      • Use R16G16B16A16_FLOAT for 3-component half-float.
      • +
      • Fix assertion for surface tile offset usage on Ironlake.
      • +
      • Fix cube map layouts on Ironlake.
      • +
      • When an RB gets a new region, clear the old from the state + cache. Bug + #24119.
      • +
      • Reject shaders with uninlined function calls instead of hanging.
      • +
      +
    • + +
    • Assorted i915 driver fixes. Including but not limited to: +
        +
      • Fixed texture LOD clamping in i915 driver. + Bug + #24846.
      • +
      • Fix off-by-one for drawing rectangle. + Bug + #27408.
      • +
      +
    • + +
    • Fixed hangs in etracer on 830 and 845 + chipsets. Bug + #26557.
    • +
    • Fixed tiling of small textures on all Intel drivers.
    • +
    • Fixed crash in Savage driver when using _mesa_CopyTexImage2D. + Bug + #27652.
    • + +
    • Assorted GLX fixes. Including but not limited to: +
        +
      • Fixed __glXInitializeVisualConfigFromTags's handling of + unrecognized fbconfig tags.
      • +
      • Fixed regression with GLX_USE_GL. +
      • Fixed config chooser logic for 'mask' matching.
      • +
      • Report swap events correctly in direct rendered case (DRI2)
      • +
      • Fixed build with dri2proto which doesn't define + X_DRI2SwapInterval.
      • +
      • Get GLX_SCREEN first in __glXQueryContextInfo. + Bug + #14245.
      • +
      +
    • + +
    • Assorted GLSL fixes. Including but not limited to: +
        +
      • Change variable declared assertion into conditional in GLSL + compiler. Bug + #27921.
      • +
      • Fix instruction indexing + bugs. Bug + #27566.
      • +
      • Updated uniform location / offset encoding to be more like + other implementations.
      • +
      • Don't overwrite a driver's shader infolog with generic failure + message.
      • +
      +
    • + +
    • Fixed OSMesa build for 16 and 32-bit color channel depth. +
    • Fixed OSMesa build with hidden symbol visibility. libOSMesa no longer links to libGL. + Bug + #28305. +
    • Fixed handling of multiple render targets in fixed-function + texture envrionmnent programs.
    • +
    • Fixed conversion errors in signed_rgba8888[rev] texel + fetch.
    • +
    • Don't set srcLevel on GL_TEXTURE_RECTANGLE_ARB targets.
    • +
    • Various build fixes for OpenBSD.
    • +
    • Various build fixes for OS X.
    • +
    • Various build fixes for GCC 3.3.
    • +
    + + + + diff --git a/mesalib/docs/relnotes-7.8.3.html b/mesalib/docs/relnotes-7.8.3.html index e729ee820..1e9f43313 100644 --- a/mesalib/docs/relnotes-7.8.3.html +++ b/mesalib/docs/relnotes-7.8.3.html @@ -1,89 +1,89 @@ - - -Mesa Release Notes - - - - - - - -

    Mesa 7.8.3 Release Notes / (date tbd)

    - -

    -Mesa 7.8.3 is a bug fix release which fixes bugs found since the 7.8.2 release. -

    -

    -Mesa 7.8.3 implements the OpenGL 2.1 API, but the version reported by -glGetString(GL_VERSION) depends on the particular driver being used. -Some drivers don't support all the features required in OpenGL 2.1. -

    -

    -See the Compiling/Installing page for prerequisites -for DRI hardware acceleration. -

    - - -

    MD5 checksums

    -
    -x  MesaLib-7.8.3.tar.gz
    -x  MesaLib-7.8.3.tar.bz2
    -x  MesaLib-7.8.3.zip
    -x  MesaDemos-7.8.3.tar.gz
    -x  MesaDemos-7.8.3.tar.bz2
    -x  MesaDemos-7.8.3.zip
    -x  MesaGLUT-7.8.3.tar.gz
    -x  MesaGLUT-7.8.3.tar.bz2
    -x  MesaGLUT-7.8.3.zip
    -
    - - -

    New features

    -

    None.

    - - -

    Changes

    -
      -
    • The radeon driver should use less memory when searching for a valid mip -image.
    • -
    - - -

    Bug fixes

    -
      -
    • Fix unsupported FB with D24S8 (bug - 29116)
    • -
    • Fix ReadPixels crash when reading depth/stencil from an FBO
    • -
    • Fixed a bug rendering to 16-bit buffers using swrast.
    • -
    • Fixed a state tracker/TGSI bug that caused crashes when using Windows' - memory debugging features.
    • -
    • Fixed an issue rendering to 32-bit channels with swrast (bug - 29487)
    • -
    • GLSL: fix indirect gl_TextureMatrix addressing (bug - 28967)
    • -
    • GLSL: fix for bug - 27216
    • -
    • GLSL: fix zw fragcoord entries in some cases (bug - 29183)
    • -
    • Fix texture env generation in some cases (bug - 28169)
    • -
    • osmesa: a fix for calling OSMesaMakeCurrent twice was applied (bug - 10966
    • -
    • A bug was fixed which could cause Mesa to ignore the - MESA_EXTENSION_OVERRIDE environment variable.
    • -
    • A bug related to specular highlights on backfaces was fixed.
    • -
    • A radeon-specific issue with glCopyTex(Sub)Image was - corrected.
    • -
    • radeon/wine: flush command stream in more cases, fixing wine d3d9 - tests.
    • -
    • r600: fix sin+cos normalization.
    • -
    • r600: (properly) ignore GL_COORD_REPLACE when point sprites are - disabled.
    • -
    • radeon: avoid flushing when the context is not current.
    • -
    • r300c: a bug affecting unaligned BOs was fixed.
    • -
    • r300c: a hardlock caused by ARB_half_float_vertex incorrectly advertised on some chipsets.
    • -
    - - - - + + +Mesa Release Notes + + + + + + + +

    Mesa 7.8.3 Release Notes / (date tbd)

    + +

    +Mesa 7.8.3 is a bug fix release which fixes bugs found since the 7.8.2 release. +

    +

    +Mesa 7.8.3 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    + + +

    MD5 checksums

    +
    +x  MesaLib-7.8.3.tar.gz
    +x  MesaLib-7.8.3.tar.bz2
    +x  MesaLib-7.8.3.zip
    +x  MesaDemos-7.8.3.tar.gz
    +x  MesaDemos-7.8.3.tar.bz2
    +x  MesaDemos-7.8.3.zip
    +x  MesaGLUT-7.8.3.tar.gz
    +x  MesaGLUT-7.8.3.tar.bz2
    +x  MesaGLUT-7.8.3.zip
    +
    + + +

    New features

    +

    None.

    + + +

    Changes

    +
      +
    • The radeon driver should use less memory when searching for a valid mip +image.
    • +
    + + +

    Bug fixes

    +
      +
    • Fix unsupported FB with D24S8 (bug + 29116)
    • +
    • Fix ReadPixels crash when reading depth/stencil from an FBO
    • +
    • Fixed a bug rendering to 16-bit buffers using swrast.
    • +
    • Fixed a state tracker/TGSI bug that caused crashes when using Windows' + memory debugging features.
    • +
    • Fixed an issue rendering to 32-bit channels with swrast (bug + 29487)
    • +
    • GLSL: fix indirect gl_TextureMatrix addressing (bug + 28967)
    • +
    • GLSL: fix for bug + 27216
    • +
    • GLSL: fix zw fragcoord entries in some cases (bug + 29183)
    • +
    • Fix texture env generation in some cases (bug + 28169)
    • +
    • osmesa: a fix for calling OSMesaMakeCurrent twice was applied (bug + 10966
    • +
    • A bug was fixed which could cause Mesa to ignore the + MESA_EXTENSION_OVERRIDE environment variable.
    • +
    • A bug related to specular highlights on backfaces was fixed.
    • +
    • A radeon-specific issue with glCopyTex(Sub)Image was + corrected.
    • +
    • radeon/wine: flush command stream in more cases, fixing wine d3d9 + tests.
    • +
    • r600: fix sin+cos normalization.
    • +
    • r600: (properly) ignore GL_COORD_REPLACE when point sprites are + disabled.
    • +
    • radeon: avoid flushing when the context is not current.
    • +
    • r300c: a bug affecting unaligned BOs was fixed.
    • +
    • r300c: a hardlock caused by ARB_half_float_vertex incorrectly advertised on some chipsets.
    • +
    + + + + diff --git a/mesalib/docs/relnotes-7.9.1.html b/mesalib/docs/relnotes-7.9.1.html index c12db4a50..bef4ef1dd 100644 --- a/mesalib/docs/relnotes-7.9.1.html +++ b/mesalib/docs/relnotes-7.9.1.html @@ -1,406 +1,406 @@ - - - -Mesa Release Notes - - - - - - - - -

    Mesa 7.9.1 Release Notes / January 7, 2011

    - -

    -Mesa 7.9.1 is a bug fix release which fixes bugs found since the 7.9 release. -

    -

    -Mesa 7.9.1 implements the OpenGL 2.1 API, but the version reported by -glGetString(GL_VERSION) depends on the particular driver being used. -Some drivers don't support all the features required in OpenGL 2.1. -

    -

    -See the Compiling/Installing page for prerequisites -for DRI hardware acceleration. -

    - - -

    MD5 checksums

    -
    -78422843ea875ad4eac35b9b8584032b  MesaLib-7.9.1.tar.gz
    -07dc6cfb5928840b8b9df5bd1b3ae434  MesaLib-7.9.1.tar.bz2
    -c8eaea5b3c3d6dee784bd8c2db91c80f  MesaLib-7.9.1.zip
    -ee9ecae4ca56fbb2d14dc15e3a0a7640  MesaGLUT-7.9.1.tar.gz
    -41fc477d524e7dc5c84da8ef22422bea  MesaGLUT-7.9.1.tar.bz2
    -90b287229afdf19317aa989d19462e7a  MesaGLUT-7.9.1.zip
    -
    - - -

    New features

    -

    None.

    - -

    Bug fixes

    -

    This list is likely incomplete.

    -
      -
    • Bug 28800 - [r300c, r300g] Texture corruption with World of Warcraft
    • - -
    • Bug 29420 - Amnesia / HPL2 RendererFeatTest - not rendering correctly
    • - -
    • Bug 29946 - [swrast] piglit valgrind glsl-array-bounds-04 fails
    • - -
    • Bug 30261 - [GLSL 1.20] allowing inconsistent invariant declaration between two vertex shaders
    • - -
    • Bug 30632 - [softpipe] state_tracker/st_manager.c:489: st_context_notify_invalid_framebuffer: Assertion `stfb && stfb->iface == stfbi' failed.
    • - -
    • Bug 30694 - wincopy will crash on Gallium drivers when going to front buffer
    • - -
    • Bug 30787 - Invalid asm shader does not generate draw-time error when used with GLSL shader
    • - -
    • Bug 30993 - getFramebufferAttachmentParameteriv wrongly generates error
    • - -
    • Bug 31101 - [glsl2] abort() in ir_validate::visit_enter(ir_assignment *ir)
    • - -
    • Bug 31193 - [regression] aa43176e break water reflections
    • - -
    • Bug 31194 - The mesa meta save/restore code doesn't ref the current GLSL program
    • - -
    • Bug 31371 - glslparsertest: ir.cpp:358: ir_constant::ir_constant(const glsl_type*, const ir_constant_data*): Assertion `(type->base_type >= 0) && (type->base_type <= 3)' failed.
    • - -
    • Bug 31439 - Crash in glBufferSubData() with size == 0
    • - -
    • Bug 31495 - [i965 gles2c bisected] OpenGL ES 2.0 conformance GL2Tests_GetBIFD_input.run regressed
    • - -
    • Bug 31514 - isBuffer returns true for unbound buffers
    • - -
    • Bug 31560 - [tdfx] tdfx_tex.c:702: error: ‘const struct gl_color_table’ has no member named ‘Format’
    • - -
    • Bug 31617 - Radeon/Compiz: 'failed to attach dri2 front buffer', error case not handled
    • - -
    • Bug 31648 - [GLSL] array-struct-array gets assertion: `(size >= 1) && (size <= 4)' failed.
    • - -
    • Bug 31650 - [GLSL] varying gl_TexCoord fails to be re-declared to different size in the second shader
    • - -
    • Bug 31673 - GL_FRAGMENT_PRECISION_HIGH preprocessor macro undefined in GLSL ES
    • - -
    • Bug 31690 - i915 shader compiler fails to flatten if in Aquarium webgl demo.
    • - -
    • Bug 31832 - [i915] Bad renderbuffer format: 21
    • - -
    • Bug 31841 - [drm:radeon_cs_ioctl] *ERROR* Invalid command stream !
    • - -
    • Bug 31894 - Writing to gl_PointSize with GLES2 corrupts other varyings
    • - -
    • Bug 31909 - [i965] brw_fs.cpp:1461: void fs_visitor::emit_bool_to_cond_code(ir_rvalue*): Assertion `expr->operands[i]->type->is_scalar()' failed.
    • - -
    • Bug 31934 - [gallium] Mapping empty buffer object causes SIGSEGV
    • - -
    • Bug 31983 - [i915 gles2] "if (expression with builtin/varying variables) discard" breaks linkage
    • - -
    • Bug 31985 - [GLSL 1.20] initialized uniform array considered as "unsized"
    • - -
    • Bug 31987 - [gles2] if input a wrong pname(GL_NONE) to glGetBoolean, it will not case GL_INVALID_ENUM
    • - -
    • Bug 32035 - [GLSL bisected] comparing unsized array gets segfault
    • - -
    • Bug 32070 - llvmpipe renders stencil demo incorrectly
    • - -
    • Bug 32273 - assertion fails when starting vdrift 2010 release with shaders enabled
    • - -
    • Bug 32287 - [bisected GLSL] float-int failure
    • - -
    • Bug 32311 - [965 bisected] Array look-ups broken on GM45
    • - -
    • Bug 32520 - [gles2] glBlendFunc(GL_ZERO, GL_DST_COLOR) will result in GL_INVALID_ENUM
    • - -
    • Bug 32825 - egl_glx driver completely broken in 7.9 branch [fix in master]
    • -
    - - -

    Changes

    -

    The full set of changes can be viewed by using the following GIT command:

    - -
    -  git log mesa-7.9..mesa-7.9.1
    -
    - -

    Alex Deucher (5): -

      -
    • r100: revalidate after radeon_update_renderbuffers
    • -
    • r600c: add missing radeon_prepare_render() call on evergreen
    • -
    • r600c: properly align mipmaps to group size
    • -
    • gallium/egl: fix r300 vs r600 loading
    • -
    • r600c: fix some opcodes on evergreen
    • -

    - -

    Aras Pranckevicius (2): -

      -
    • glsl: fix crash in loop analysis when some controls can't be determined
    • -
    • glsl: fix matrix type check in ir_algebraic
    • -

    - -

    Brian Paul (27): -

      -
    • swrast: fix choose_depth_texture_level() to respect mipmap filtering state
    • -
    • st/mesa: replace assertion w/ conditional in framebuffer invalidation
    • -
    • egl/i965: include inline_wrapper_sw_helper.h
    • -
    • mesa: Add missing else in do_row_3D
    • -
    • mesa: add missing formats in _mesa_format_to_type_and_comps()
    • -
    • mesa: handle more pixel types in mipmap generation code
    • -
    • mesa: make glIsBuffer() return false for never bound buffers
    • -
    • mesa: fix glDeleteBuffers() regression
    • -
    • swrast: init alpha value to 1.0 in opt_sample_rgb_2d()
    • -
    • meta: Mask Stencil.Clear against stencilMax in _mesa_meta_Clear
    • -
    • st/mesa: fix mapping of zero-sized buffer objects
    • -
    • mesa: check for posix_memalign() errors
    • -
    • llvmpipe: fix broken stencil writemask
    • -
    • mesa: fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME query
    • -
    • mesa: return GL_FRAMEBUFFER_DEFAULT as FBO attachment type
    • -
    • mesa: make glGet*(GL_NONE) generate GL_INVALID_ENUM
    • -
    • mesa: test for cube map completeness in glGenerateMipmap()
    • -
    • tnl: Initialize gl_program_machine memory in run_vp.
    • -
    • tnl: a better way to initialize the gl_program_machine memory
    • -
    • mesa, st/mesa: disable GL_ARB_geometry_shader4
    • -
    • glsl: fix off by one in register index assertion
    • -
    • st/mesa: fix mipmap generation bug
    • -
    • glsl: new glsl_strtod() wrapper to fix decimal point interpretation
    • -
    • mesa: no-op glBufferSubData() on size==0
    • -
    • tdfx: s/Format/_BaseFormat/
    • -
    • st/mesa: fix renderbuffer pointer check in st_Clear()
    • -
    • mesa: Bump the number of bits in the register index.
    • -

    - -

    Chad Versace (5): -

      -
    • glsl: Fix lexer rule for ^=
    • -
    • glsl: Fix ast-to-hir for ARB_fragment_coord_conventions
    • -
    • glsl: Fix ir_expression::constant_expression_value()
    • -
    • glsl: Fix erroneous cast in ast_jump_statement::hir()
    • -
    • glsl: Fix linker bug in cross_validate_globals()
    • -

    - -

    Chia-I Wu (10): -

      -
    • targets/egl: Fix linking with libdrm.
    • -
    • st/vega: Fix version check in context creation.
    • -
    • st/egl: Do not finish a fence that is NULL.
    • -
    • egl: Fix a false negative check in _eglCheckMakeCurrent.
    • -
    • st/mesa: Unreference the sampler view in st_bind_surface.
    • -
    • egl_dri2: Fix __DRI_DRI2 version 1 support.
    • -
    • st/vega: Do not wait NULL fences.
    • -
    • mesa: Do not advertise GL_OES_texture_3D.
    • -
    • egl_glx: Fix borken driver.
    • -
    • egl: Check extensions.
    • -

    - -

    Daniel Lichtenberger (1): -

      -
    • radeon: fix potential segfault in renderbuffer update
    • -

    - -

    Daniel Vetter (1): -

      -
    • r200: revalidate after radeon_update_renderbuffers
    • -

    - -

    Dave Airlie (1): -

      -
    • r300g: fixup rs690 tiling stride alignment calculations.
    • -

    - -

    Eric Anholt (13): -

      -
    • intel: Allow CopyTexSubImage to InternalFormat 3/4 textures, like RGB/RGBA.
    • -
    • glsl: Free the loop state context when we free the loop state.
    • -
    • i965: Allow OPCODE_SWZ to put immediates in the first arg.
    • -
    • i965: Add support for rendering to SARGB8 FBOs.
    • -
    • glsl: Add a helper constructor for expressions that works out result type.
    • -
    • glsl: Fix structure and array comparisions.
    • -
    • glsl: Quiet unreachable no-return-from-function warning.
    • -
    • glsl: Mark the array access for whole-array comparisons.
    • -
    • glsl: Fix flipped return of has_value() for array constants.
    • -
    • mesa: Add getters for the rest of the supported draw buffers.
    • -
    • mesa: Add getters for ARB_copy_buffer's attachment points.
    • -
    • i965: Correct the dp_read message descriptor setup on g4x.
    • -
    • glsl: Correct the marking of InputsRead/OutputsWritten on in/out matrices.
    • -

    - -

    Fabian Bieler (1): -

      -
    • glsl: fix lowering conditional returns in subroutines
    • -

    - -

    Francisco Jerez (3): -

      -
    • meta: Don't leak alpha function/reference value changes.
    • -
    • meta: Fix incorrect rendering of the bitmap alpha component.
    • -
    • meta: Don't try to disable cube maps if the driver doesn't expose the extension.
    • -

    - -

    Henri Verbeet (2): -

      -
    • r600: Evergreen has two extra frac_bits for the sampler LOD state.
    • -
    • st/mesa: Handle wrapped depth buffers in st_copy_texsubimage().
    • -

    - -

    Ian Romanick (33): -

      -
    • Add 7.9 md5sums
    • -
    • docs: Import 7.8.x release notes from 7.8 branch.
    • -
    • docs: download.html does not need to be updated for each release
    • -
    • docs: Update mailing lines from sf.net to freedesktop.org
    • -
    • docs: added news item for 7.9 release
    • -
    • mesa: Validate assembly shaders when GLSL shaders are used
    • -
    • linker: Reject shaders that have unresolved function calls
    • -
    • mesa: Refactor validation of shader targets
    • -
    • glsl: Slightly change the semantic of _LinkedShaders
    • -
    • linker: Improve handling of unread/unwritten shader inputs/outputs
    • -
    • glsl: Commit lexer files changed by previous cherry picking
    • -
    • mesa: Make metaops use program refcounts instead of names.
    • -
    • glsl: Fix incorrect gl_type of sampler2DArray and sampler1DArrayShadow
    • -
    • mesa: Allow query of MAX_SAMPLES with EXT_framebuffer_multisample
    • -
    • glsl: better handling of linker failures
    • -
    • mesa: Fix glGet of ES2's GL_MAX_*_VECTORS properties.
    • -
    • i915: Disallow alpha, red, RG, and sRGB as render targets
    • -
    • glsl/linker: Free any IR discarded by optimization passes.
    • -
    • glsl: Add an optimization pass to simplify discards.
    • -
    • glsl: Add a lowering pass to move discards out of if-statements.
    • -
    • i915: Correctly generate unconditional KIL instructions
    • -
    • glsl: Add unary ir_expression constructor
    • -
    • glsl: Ensure that equality comparisons don't return a NULL IR tree
    • -
    • glcpp: Commit changes in generated files cause by previous commit
    • -
    • glsl: Inherrit type of declared variable from initializer
    • -
    • glsl: Inherrit type of declared variable from initializer after processing assignment
    • -
    • linker: Ensure that unsized arrays have a size after linking
    • -
    • linker: Fix regressions caused by previous commit
    • -
    • linker: Allow built-in arrays to have different sizes between shader stages
    • -
    • ir_to_mesa: Don't generate swizzles for record derefs of non-scalar/vectors
    • -
    • Refresh autogenerated file builtin_function.cpp.
    • -
    • docs: Initial set of release notes for 7.9.1
    • -
    • mesa: set version string to 7.9.1
    • -

    - -

    Julien Cristau (1): -

      -
    • Makefile: don't include the same files twice in the tarball
    • -

    - -

    Kenneth Graunke (19): -

      -
    • glcpp: Return NEWLINE token for newlines inside multi-line comments.
    • -
    • generate_builtins.py: Output large strings as arrays of characters.
    • -
    • glsl: Fix constant component count in vector constructor emitting.
    • -
    • ir_dead_functions: Actually free dead functions and signatures.
    • -
    • glcpp: Define GL_FRAGMENT_PRECISION_HIGH if GLSL version >= 1.30.
    • -
    • glsl: Unconditionally define GL_FRAGMENT_PRECISION_HIGH in ES2 shaders.
    • -
    • glsl: Fix constant expression handling for <, >, <=, >= on vectors.
    • -
    • glsl: Use do_common_optimization in the standalone compiler.
    • -
    • glsl: Don't inline function prototypes.
    • -
    • glsl: Add a virtual as_discard() method.
    • -
    • glsl: Remove "discard" support from lower_jumps.
    • -
    • glsl: Refactor get_num_operands.
    • -
    • glcpp: Don't emit SPACE tokens in conditional_tokens production.
    • -
    • glsl: Clean up code by adding a new is_break() function.
    • -
    • glsl: Consider the "else" branch when looking for loop breaks.
    • -
    • Remove OES_compressed_paletted_texture from the ES2 extension list.
    • -
    • glsl/builtins: Compute the correct value for smoothstep(vec, vec, vec).
    • -
    • Fix build on systems where "python" is python 3.
    • -
    • i965: Internally enable GL_NV_blend_square on ES2.
    • -

    - -

    Kristian Høgsberg (1): -

      -
    • i965: Don't write mrf assignment for pointsize output
    • -

    - -

    Luca Barbieri (1): -

      -
    • glsl: Unroll loops with conditional breaks anywhere (not just the end)
    • -

    - -

    Marek Olšák (17): -

      -
    • r300g: fix microtiling for 16-bits-per-channel formats
    • -
    • r300g: fix texture border for 16-bits-per-channel formats
    • -
    • r300g: add a default channel ordering of texture border for unhandled formats
    • -
    • r300g: fix texture border color for all texture formats
    • -
    • r300g: fix rendering with no vertex elements
    • -
    • r300/compiler: fix rc_rewrite_depth_out for it to work with any instruction
    • -
    • r300g: fix texture border color once again
    • -
    • r300g: fix texture swizzling with compressed textures on r400-r500
    • -
    • r300g: disable ARB_texture_swizzle if S3TC is enabled on r3xx-only
    • -
    • mesa, st/mesa: fix gl_FragCoord with FBOs in Gallium
    • -
    • st/mesa: initialize key in st_vp_varient
    • -
    • r300/compiler: fix swizzle lowering with a presubtract source operand
    • -
    • r300g: fix rendering with a vertex attrib having a zero stride
    • -
    • ir_to_mesa: Add support for conditional discards.
    • -
    • r300g: finally fix the texture corruption on r3xx-r4xx
    • -
    • mesa: fix texel store functions for some float formats
    • -
    • r300/compiler: disable the rename_regs pass for loops
    • -

    - -

    Mario Kleiner (1): -

      -
    • mesa/r300classic: Fix dri2Invalidate/radeon_prepare_render for page flipping.
    • -

    - -

    Peter Clifton (1): -

      -
    • intel: Fix emit_linear_blit to use DWORD aligned width blits
    • -

    - -

    Robert Hooker (2): -

      -
    • intel: Add a new B43 pci id.
    • -
    • egl_dri2: Add missing intel chip ids.
    • -

    - -

    Roland Scheidegger (1): -

      -
    • r200: fix r200 large points
    • -

    - -

    Thomas Hellstrom (17): -

      -
    • st/xorg: Don't try to use option values before processing options
    • -
    • xorg/vmwgfx: Make vmwarectrl work also on 64-bit servers
    • -
    • st/xorg: Add a customizer option to get rid of annoying cursor update flicker
    • -
    • xorg/vmwgfx: Don't hide HW cursors when updating them
    • -
    • st/xorg: Don't try to remove invalid fbs
    • -
    • st/xorg: Fix typo
    • -
    • st/xorg, xorg/vmwgfx: Be a bit more frendly towards cross-compiling environments
    • -
    • st/xorg: Fix compilation errors for Xservers compiled without Composite
    • -
    • st/xorg: Don't use deprecated x*alloc / xfree functions
    • -
    • xorg/vmwgfx: Don't use deprecated x*alloc / xfree functions
    • -
    • st/xorg: Fix compilation for Xservers >= 1.10
    • -
    • mesa: Make sure we have the talloc cflags when using the talloc headers
    • -
    • egl: Add an include for size_t
    • -
    • mesa: Add talloc includes for gles
    • -
    • st/egl: Fix build for include files in nonstandard places
    • -
    • svga/drm: Optionally resolve calls to powf during link-time
    • -
    • gallium/targets: Trivial crosscompiling fix
    • -

    - -

    Tom Stellard (7): -

      -
    • r300/compiler: Make sure presubtract sources use supported swizzles
    • -
    • r300/compiler: Fix register allocator's handling of loops
    • -
    • r300/compiler: Fix instruction scheduling within IF blocks
    • -
    • r300/compiler: Use zero as the register index for unused sources
    • -
    • r300/compiler: Ignore alpha dest register when replicating the result
    • -
    • r300/compiler: Use correct swizzles for all presubtract sources
    • -
    • r300/compiler: Don't allow presubtract sources to be remapped twice
    • -

    - -

    Vinson Lee (1): -

      -
    • glsl: Fix 'control reaches end of non-void function' warning.
    • -

    - -

    richard (1): -

      -
    • r600c : inline vertex format is not updated in an app, switch to use vfetch constants. For the 7.9 and 7.10 branches as well.
    • -

    - - - + + + +Mesa Release Notes + + + + + + + + +

    Mesa 7.9.1 Release Notes / January 7, 2011

    + +

    +Mesa 7.9.1 is a bug fix release which fixes bugs found since the 7.9 release. +

    +

    +Mesa 7.9.1 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    + + +

    MD5 checksums

    +
    +78422843ea875ad4eac35b9b8584032b  MesaLib-7.9.1.tar.gz
    +07dc6cfb5928840b8b9df5bd1b3ae434  MesaLib-7.9.1.tar.bz2
    +c8eaea5b3c3d6dee784bd8c2db91c80f  MesaLib-7.9.1.zip
    +ee9ecae4ca56fbb2d14dc15e3a0a7640  MesaGLUT-7.9.1.tar.gz
    +41fc477d524e7dc5c84da8ef22422bea  MesaGLUT-7.9.1.tar.bz2
    +90b287229afdf19317aa989d19462e7a  MesaGLUT-7.9.1.zip
    +
    + + +

    New features

    +

    None.

    + +

    Bug fixes

    +

    This list is likely incomplete.

    +
      +
    • Bug 28800 - [r300c, r300g] Texture corruption with World of Warcraft
    • + +
    • Bug 29420 - Amnesia / HPL2 RendererFeatTest - not rendering correctly
    • + +
    • Bug 29946 - [swrast] piglit valgrind glsl-array-bounds-04 fails
    • + +
    • Bug 30261 - [GLSL 1.20] allowing inconsistent invariant declaration between two vertex shaders
    • + +
    • Bug 30632 - [softpipe] state_tracker/st_manager.c:489: st_context_notify_invalid_framebuffer: Assertion `stfb && stfb->iface == stfbi' failed.
    • + +
    • Bug 30694 - wincopy will crash on Gallium drivers when going to front buffer
    • + +
    • Bug 30787 - Invalid asm shader does not generate draw-time error when used with GLSL shader
    • + +
    • Bug 30993 - getFramebufferAttachmentParameteriv wrongly generates error
    • + +
    • Bug 31101 - [glsl2] abort() in ir_validate::visit_enter(ir_assignment *ir)
    • + +
    • Bug 31193 - [regression] aa43176e break water reflections
    • + +
    • Bug 31194 - The mesa meta save/restore code doesn't ref the current GLSL program
    • + +
    • Bug 31371 - glslparsertest: ir.cpp:358: ir_constant::ir_constant(const glsl_type*, const ir_constant_data*): Assertion `(type->base_type >= 0) && (type->base_type <= 3)' failed.
    • + +
    • Bug 31439 - Crash in glBufferSubData() with size == 0
    • + +
    • Bug 31495 - [i965 gles2c bisected] OpenGL ES 2.0 conformance GL2Tests_GetBIFD_input.run regressed
    • + +
    • Bug 31514 - isBuffer returns true for unbound buffers
    • + +
    • Bug 31560 - [tdfx] tdfx_tex.c:702: error: ‘const struct gl_color_table’ has no member named ‘Format’
    • + +
    • Bug 31617 - Radeon/Compiz: 'failed to attach dri2 front buffer', error case not handled
    • + +
    • Bug 31648 - [GLSL] array-struct-array gets assertion: `(size >= 1) && (size <= 4)' failed.
    • + +
    • Bug 31650 - [GLSL] varying gl_TexCoord fails to be re-declared to different size in the second shader
    • + +
    • Bug 31673 - GL_FRAGMENT_PRECISION_HIGH preprocessor macro undefined in GLSL ES
    • + +
    • Bug 31690 - i915 shader compiler fails to flatten if in Aquarium webgl demo.
    • + +
    • Bug 31832 - [i915] Bad renderbuffer format: 21
    • + +
    • Bug 31841 - [drm:radeon_cs_ioctl] *ERROR* Invalid command stream !
    • + +
    • Bug 31894 - Writing to gl_PointSize with GLES2 corrupts other varyings
    • + +
    • Bug 31909 - [i965] brw_fs.cpp:1461: void fs_visitor::emit_bool_to_cond_code(ir_rvalue*): Assertion `expr->operands[i]->type->is_scalar()' failed.
    • + +
    • Bug 31934 - [gallium] Mapping empty buffer object causes SIGSEGV
    • + +
    • Bug 31983 - [i915 gles2] "if (expression with builtin/varying variables) discard" breaks linkage
    • + +
    • Bug 31985 - [GLSL 1.20] initialized uniform array considered as "unsized"
    • + +
    • Bug 31987 - [gles2] if input a wrong pname(GL_NONE) to glGetBoolean, it will not case GL_INVALID_ENUM
    • + +
    • Bug 32035 - [GLSL bisected] comparing unsized array gets segfault
    • + +
    • Bug 32070 - llvmpipe renders stencil demo incorrectly
    • + +
    • Bug 32273 - assertion fails when starting vdrift 2010 release with shaders enabled
    • + +
    • Bug 32287 - [bisected GLSL] float-int failure
    • + +
    • Bug 32311 - [965 bisected] Array look-ups broken on GM45
    • + +
    • Bug 32520 - [gles2] glBlendFunc(GL_ZERO, GL_DST_COLOR) will result in GL_INVALID_ENUM
    • + +
    • Bug 32825 - egl_glx driver completely broken in 7.9 branch [fix in master]
    • +
    + + +

    Changes

    +

    The full set of changes can be viewed by using the following GIT command:

    + +
    +  git log mesa-7.9..mesa-7.9.1
    +
    + +

    Alex Deucher (5): +

      +
    • r100: revalidate after radeon_update_renderbuffers
    • +
    • r600c: add missing radeon_prepare_render() call on evergreen
    • +
    • r600c: properly align mipmaps to group size
    • +
    • gallium/egl: fix r300 vs r600 loading
    • +
    • r600c: fix some opcodes on evergreen
    • +

    + +

    Aras Pranckevicius (2): +

      +
    • glsl: fix crash in loop analysis when some controls can't be determined
    • +
    • glsl: fix matrix type check in ir_algebraic
    • +

    + +

    Brian Paul (27): +

      +
    • swrast: fix choose_depth_texture_level() to respect mipmap filtering state
    • +
    • st/mesa: replace assertion w/ conditional in framebuffer invalidation
    • +
    • egl/i965: include inline_wrapper_sw_helper.h
    • +
    • mesa: Add missing else in do_row_3D
    • +
    • mesa: add missing formats in _mesa_format_to_type_and_comps()
    • +
    • mesa: handle more pixel types in mipmap generation code
    • +
    • mesa: make glIsBuffer() return false for never bound buffers
    • +
    • mesa: fix glDeleteBuffers() regression
    • +
    • swrast: init alpha value to 1.0 in opt_sample_rgb_2d()
    • +
    • meta: Mask Stencil.Clear against stencilMax in _mesa_meta_Clear
    • +
    • st/mesa: fix mapping of zero-sized buffer objects
    • +
    • mesa: check for posix_memalign() errors
    • +
    • llvmpipe: fix broken stencil writemask
    • +
    • mesa: fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME query
    • +
    • mesa: return GL_FRAMEBUFFER_DEFAULT as FBO attachment type
    • +
    • mesa: make glGet*(GL_NONE) generate GL_INVALID_ENUM
    • +
    • mesa: test for cube map completeness in glGenerateMipmap()
    • +
    • tnl: Initialize gl_program_machine memory in run_vp.
    • +
    • tnl: a better way to initialize the gl_program_machine memory
    • +
    • mesa, st/mesa: disable GL_ARB_geometry_shader4
    • +
    • glsl: fix off by one in register index assertion
    • +
    • st/mesa: fix mipmap generation bug
    • +
    • glsl: new glsl_strtod() wrapper to fix decimal point interpretation
    • +
    • mesa: no-op glBufferSubData() on size==0
    • +
    • tdfx: s/Format/_BaseFormat/
    • +
    • st/mesa: fix renderbuffer pointer check in st_Clear()
    • +
    • mesa: Bump the number of bits in the register index.
    • +

    + +

    Chad Versace (5): +

      +
    • glsl: Fix lexer rule for ^=
    • +
    • glsl: Fix ast-to-hir for ARB_fragment_coord_conventions
    • +
    • glsl: Fix ir_expression::constant_expression_value()
    • +
    • glsl: Fix erroneous cast in ast_jump_statement::hir()
    • +
    • glsl: Fix linker bug in cross_validate_globals()
    • +

    + +

    Chia-I Wu (10): +

      +
    • targets/egl: Fix linking with libdrm.
    • +
    • st/vega: Fix version check in context creation.
    • +
    • st/egl: Do not finish a fence that is NULL.
    • +
    • egl: Fix a false negative check in _eglCheckMakeCurrent.
    • +
    • st/mesa: Unreference the sampler view in st_bind_surface.
    • +
    • egl_dri2: Fix __DRI_DRI2 version 1 support.
    • +
    • st/vega: Do not wait NULL fences.
    • +
    • mesa: Do not advertise GL_OES_texture_3D.
    • +
    • egl_glx: Fix borken driver.
    • +
    • egl: Check extensions.
    • +

    + +

    Daniel Lichtenberger (1): +

      +
    • radeon: fix potential segfault in renderbuffer update
    • +

    + +

    Daniel Vetter (1): +

      +
    • r200: revalidate after radeon_update_renderbuffers
    • +

    + +

    Dave Airlie (1): +

      +
    • r300g: fixup rs690 tiling stride alignment calculations.
    • +

    + +

    Eric Anholt (13): +

      +
    • intel: Allow CopyTexSubImage to InternalFormat 3/4 textures, like RGB/RGBA.
    • +
    • glsl: Free the loop state context when we free the loop state.
    • +
    • i965: Allow OPCODE_SWZ to put immediates in the first arg.
    • +
    • i965: Add support for rendering to SARGB8 FBOs.
    • +
    • glsl: Add a helper constructor for expressions that works out result type.
    • +
    • glsl: Fix structure and array comparisions.
    • +
    • glsl: Quiet unreachable no-return-from-function warning.
    • +
    • glsl: Mark the array access for whole-array comparisons.
    • +
    • glsl: Fix flipped return of has_value() for array constants.
    • +
    • mesa: Add getters for the rest of the supported draw buffers.
    • +
    • mesa: Add getters for ARB_copy_buffer's attachment points.
    • +
    • i965: Correct the dp_read message descriptor setup on g4x.
    • +
    • glsl: Correct the marking of InputsRead/OutputsWritten on in/out matrices.
    • +

    + +

    Fabian Bieler (1): +

      +
    • glsl: fix lowering conditional returns in subroutines
    • +

    + +

    Francisco Jerez (3): +

      +
    • meta: Don't leak alpha function/reference value changes.
    • +
    • meta: Fix incorrect rendering of the bitmap alpha component.
    • +
    • meta: Don't try to disable cube maps if the driver doesn't expose the extension.
    • +

    + +

    Henri Verbeet (2): +

      +
    • r600: Evergreen has two extra frac_bits for the sampler LOD state.
    • +
    • st/mesa: Handle wrapped depth buffers in st_copy_texsubimage().
    • +

    + +

    Ian Romanick (33): +

      +
    • Add 7.9 md5sums
    • +
    • docs: Import 7.8.x release notes from 7.8 branch.
    • +
    • docs: download.html does not need to be updated for each release
    • +
    • docs: Update mailing lines from sf.net to freedesktop.org
    • +
    • docs: added news item for 7.9 release
    • +
    • mesa: Validate assembly shaders when GLSL shaders are used
    • +
    • linker: Reject shaders that have unresolved function calls
    • +
    • mesa: Refactor validation of shader targets
    • +
    • glsl: Slightly change the semantic of _LinkedShaders
    • +
    • linker: Improve handling of unread/unwritten shader inputs/outputs
    • +
    • glsl: Commit lexer files changed by previous cherry picking
    • +
    • mesa: Make metaops use program refcounts instead of names.
    • +
    • glsl: Fix incorrect gl_type of sampler2DArray and sampler1DArrayShadow
    • +
    • mesa: Allow query of MAX_SAMPLES with EXT_framebuffer_multisample
    • +
    • glsl: better handling of linker failures
    • +
    • mesa: Fix glGet of ES2's GL_MAX_*_VECTORS properties.
    • +
    • i915: Disallow alpha, red, RG, and sRGB as render targets
    • +
    • glsl/linker: Free any IR discarded by optimization passes.
    • +
    • glsl: Add an optimization pass to simplify discards.
    • +
    • glsl: Add a lowering pass to move discards out of if-statements.
    • +
    • i915: Correctly generate unconditional KIL instructions
    • +
    • glsl: Add unary ir_expression constructor
    • +
    • glsl: Ensure that equality comparisons don't return a NULL IR tree
    • +
    • glcpp: Commit changes in generated files cause by previous commit
    • +
    • glsl: Inherrit type of declared variable from initializer
    • +
    • glsl: Inherrit type of declared variable from initializer after processing assignment
    • +
    • linker: Ensure that unsized arrays have a size after linking
    • +
    • linker: Fix regressions caused by previous commit
    • +
    • linker: Allow built-in arrays to have different sizes between shader stages
    • +
    • ir_to_mesa: Don't generate swizzles for record derefs of non-scalar/vectors
    • +
    • Refresh autogenerated file builtin_function.cpp.
    • +
    • docs: Initial set of release notes for 7.9.1
    • +
    • mesa: set version string to 7.9.1
    • +

    + +

    Julien Cristau (1): +

      +
    • Makefile: don't include the same files twice in the tarball
    • +

    + +

    Kenneth Graunke (19): +

      +
    • glcpp: Return NEWLINE token for newlines inside multi-line comments.
    • +
    • generate_builtins.py: Output large strings as arrays of characters.
    • +
    • glsl: Fix constant component count in vector constructor emitting.
    • +
    • ir_dead_functions: Actually free dead functions and signatures.
    • +
    • glcpp: Define GL_FRAGMENT_PRECISION_HIGH if GLSL version >= 1.30.
    • +
    • glsl: Unconditionally define GL_FRAGMENT_PRECISION_HIGH in ES2 shaders.
    • +
    • glsl: Fix constant expression handling for <, >, <=, >= on vectors.
    • +
    • glsl: Use do_common_optimization in the standalone compiler.
    • +
    • glsl: Don't inline function prototypes.
    • +
    • glsl: Add a virtual as_discard() method.
    • +
    • glsl: Remove "discard" support from lower_jumps.
    • +
    • glsl: Refactor get_num_operands.
    • +
    • glcpp: Don't emit SPACE tokens in conditional_tokens production.
    • +
    • glsl: Clean up code by adding a new is_break() function.
    • +
    • glsl: Consider the "else" branch when looking for loop breaks.
    • +
    • Remove OES_compressed_paletted_texture from the ES2 extension list.
    • +
    • glsl/builtins: Compute the correct value for smoothstep(vec, vec, vec).
    • +
    • Fix build on systems where "python" is python 3.
    • +
    • i965: Internally enable GL_NV_blend_square on ES2.
    • +

    + +

    Kristian Høgsberg (1): +

      +
    • i965: Don't write mrf assignment for pointsize output
    • +

    + +

    Luca Barbieri (1): +

      +
    • glsl: Unroll loops with conditional breaks anywhere (not just the end)
    • +

    + +

    Marek Olšák (17): +

      +
    • r300g: fix microtiling for 16-bits-per-channel formats
    • +
    • r300g: fix texture border for 16-bits-per-channel formats
    • +
    • r300g: add a default channel ordering of texture border for unhandled formats
    • +
    • r300g: fix texture border color for all texture formats
    • +
    • r300g: fix rendering with no vertex elements
    • +
    • r300/compiler: fix rc_rewrite_depth_out for it to work with any instruction
    • +
    • r300g: fix texture border color once again
    • +
    • r300g: fix texture swizzling with compressed textures on r400-r500
    • +
    • r300g: disable ARB_texture_swizzle if S3TC is enabled on r3xx-only
    • +
    • mesa, st/mesa: fix gl_FragCoord with FBOs in Gallium
    • +
    • st/mesa: initialize key in st_vp_varient
    • +
    • r300/compiler: fix swizzle lowering with a presubtract source operand
    • +
    • r300g: fix rendering with a vertex attrib having a zero stride
    • +
    • ir_to_mesa: Add support for conditional discards.
    • +
    • r300g: finally fix the texture corruption on r3xx-r4xx
    • +
    • mesa: fix texel store functions for some float formats
    • +
    • r300/compiler: disable the rename_regs pass for loops
    • +

    + +

    Mario Kleiner (1): +

      +
    • mesa/r300classic: Fix dri2Invalidate/radeon_prepare_render for page flipping.
    • +

    + +

    Peter Clifton (1): +

      +
    • intel: Fix emit_linear_blit to use DWORD aligned width blits
    • +

    + +

    Robert Hooker (2): +

      +
    • intel: Add a new B43 pci id.
    • +
    • egl_dri2: Add missing intel chip ids.
    • +

    + +

    Roland Scheidegger (1): +

      +
    • r200: fix r200 large points
    • +

    + +

    Thomas Hellstrom (17): +

      +
    • st/xorg: Don't try to use option values before processing options
    • +
    • xorg/vmwgfx: Make vmwarectrl work also on 64-bit servers
    • +
    • st/xorg: Add a customizer option to get rid of annoying cursor update flicker
    • +
    • xorg/vmwgfx: Don't hide HW cursors when updating them
    • +
    • st/xorg: Don't try to remove invalid fbs
    • +
    • st/xorg: Fix typo
    • +
    • st/xorg, xorg/vmwgfx: Be a bit more frendly towards cross-compiling environments
    • +
    • st/xorg: Fix compilation errors for Xservers compiled without Composite
    • +
    • st/xorg: Don't use deprecated x*alloc / xfree functions
    • +
    • xorg/vmwgfx: Don't use deprecated x*alloc / xfree functions
    • +
    • st/xorg: Fix compilation for Xservers >= 1.10
    • +
    • mesa: Make sure we have the talloc cflags when using the talloc headers
    • +
    • egl: Add an include for size_t
    • +
    • mesa: Add talloc includes for gles
    • +
    • st/egl: Fix build for include files in nonstandard places
    • +
    • svga/drm: Optionally resolve calls to powf during link-time
    • +
    • gallium/targets: Trivial crosscompiling fix
    • +

    + +

    Tom Stellard (7): +

      +
    • r300/compiler: Make sure presubtract sources use supported swizzles
    • +
    • r300/compiler: Fix register allocator's handling of loops
    • +
    • r300/compiler: Fix instruction scheduling within IF blocks
    • +
    • r300/compiler: Use zero as the register index for unused sources
    • +
    • r300/compiler: Ignore alpha dest register when replicating the result
    • +
    • r300/compiler: Use correct swizzles for all presubtract sources
    • +
    • r300/compiler: Don't allow presubtract sources to be remapped twice
    • +

    + +

    Vinson Lee (1): +

      +
    • glsl: Fix 'control reaches end of non-void function' warning.
    • +

    + +

    richard (1): +

      +
    • r600c : inline vertex format is not updated in an app, switch to use vfetch constants. For the 7.9 and 7.10 branches as well.
    • +

    + + + diff --git a/mesalib/docs/relnotes-7.9.html b/mesalib/docs/relnotes-7.9.html index c94ebeef5..fe1fd5e41 100644 --- a/mesalib/docs/relnotes-7.9.html +++ b/mesalib/docs/relnotes-7.9.html @@ -1,137 +1,137 @@ - - -Mesa Release Notes - - - - - - - -

    Mesa 7.9 Release Notes / October 4, 2010

    - -

    -Mesa 7.9 is a new development release. -People who are concerned with stability and reliability should stick -with a previous release or wait for Mesa 7.9.1. -

    -

    -Mesa 7.9 implements the OpenGL 2.1 API, but the version reported by -glGetString(GL_VERSION) depends on the particular driver being used. -Some drivers don't support all the features required in OpenGL 2.1. -

    -

    -See the Compiling/Installing page for prerequisites -for DRI hardware acceleration. -

    - - -

    MD5 checksums

    -
    -ed65ab425b25895c7f473d0a5e6e64f8  MesaLib-7.9.tar.gz
    -82c740c49d572baa6da2b1a1eee90bca  MesaLib-7.9.tar.bz2
    -cd2b6ecec759b0457475e94bbb38fedb  MesaLib-7.9.zip
    -7b54af9fb9b1f6a1a65db2520f50848f  MesaGLUT-7.9.tar.gz
    -20d07419d1929f833fdb36bced290ad5  MesaGLUT-7.9.tar.bz2
    -62a7edecd7c92675cd6029b05217eb0a  MesaGLUT-7.9.zip
    -
    - - -

    New features

    -
      -
    • New, improved GLSL compiler written by Intel. - See the Shading Language page for - more information. -
    • New, very experimental Gallium driver for R600-R700 Radeons. -
    • Support for AMD Evergreen-based Radeons (HD 5xxx) -
    • GL_EXT_timer_query extension (i965 driver and softpipe only) -
    • GL_EXT_framebuffer_multisample extension (intel drivers, MAX_SAMPLES = 1) -
    • GL_ARB_texture_swizzle extension (alias of GL_EXT_texture_swizzle) -
    • GL_ARB_draw_elements_base_vertex, GL_ARB_fragment_program_shadow, - GL_ARB_window_pos, GL_EXT_gpu_program_parameters, - GL_ATI_texture_env_combine3, GL_MESA_pack_invert, and GL_OES_EGL_image - extensions in Gallium drivers -
    • GL_ARB_depth_clamp and GL_NV_depth_clamp extensions (in nv50 and r600 - Gallium drivers) -
    • GL_ARB_half_float_vertex extension (in nvfx, r300, r600, softpipe, - and llvmpipe Gallium drivers) -
    • GL_EXT_draw_buffers2 (in nv50, r600, softpipe, and llvmpipe Gallium - drivers) -
    • GL_EXT_texture_swizzle (in nvfx, r300, r600, softpipe, and llvmpipe - Gallium drivers) -
    • GL_ATI_texture_mirror_once (in nvfx, nv50, r300, r600, softpipe, and - llvmpipe Gallium drivers) -
    • GL_NV_conditional_render (in r300 Gallium driver) -
    • Initial "signs of life" support for Sandybridge hardware in i965 DRI - driver. -
    - - -

    Bug fixes

    -

    This list is likely incomplete.

    -
      -
    • Massive improvements to the Gallium driver for R300-R500 Radeons; this - driver is now considered stable for use as a DRI (OpenGL) driver. -
    • Bug 10908 - GLSL: gl_FogParamaters gl_Fog built-in uniform not functioning
    • -
    • Bug 13753 - Numerous bugs in GLSL uniform handling
    • -
    • Bug 16854 - GLSL function call at global scope causes SEGV
    • -
    • Bug 16856 - GLSL indexing of unsized array results in assertion failure
    • -
    • Bug 18659 - Crash in shader/slang/slang_codegen.c _slang_gen_function_call_name()
    • -
    • Bug 19089 - [GLSL] glsl1/shadow2D() cases fail
    • -
    • Bug 22622 - [GM965 GLSL] noise*() cause GPU lockup
    • -
    • Bug 23743 - For loop from 0 to 0 not optimized out
    • -
    • Bug 24553 - shader compilation times explode when using more () pairs
    • -
    • Bug 25664 - [GLSL] re-declaring an empty array fails to compile
    • -
    • Bug 25769 - [GLSL] "float" can be implicitly converted to "int"
    • -
    • Bug 25808 - [GLSL] const variable is modified successfully
    • -
    • Bug 25826 - [GLSL] declaring an unsized array then re-declaring with a size fails
    • -
    • Bug 25827 - [GLSL] vector constructor accepts too many arguments successfully
    • -
    • Bug 25829 - [GLSL] allowing non-void function without returning value
    • -
    • Bug 25830 - [GLSL] allowing non-constant-expression as const declaration initializer
    • -
    • Bug 25877 - [GLSL 1.10] implicit conversion from "int" to "float" should not be allowed
    • -
    • Bug 25878 - [GLSL] sampler is converted to int successfully
    • -
    • Bug 25994 - [GM45][GLSL] 'return' statement in vertex shader unsupported
    • -
    • Bug 25999 - [GLSL] embedded structure constructor fails to compile
    • -
    • Bug 26000 - [GLSL] allowing different parameter qualifier between the function definition and declaration
    • -
    • Bug 26001 - [GLSL 1.10] constructing matrix from matrix succeeds
    • -
    • Bug 26224 - [GLSL] Cannot get location of a uniform struct member
    • -
    • Bug 26990 - [GLSL] variable declaration in "while" fails to compile
    • -
    • Bug 27004 - [GLSL] allowing macro redefinition
    • -
    • Bug 27060 - [965] piglit glsl-fs-raytrace failure due to lack of function calls.
    • -
    • Bug 27216 - Assignment with a function call in an if statement causes an assertion failure
    • -
    • Bug 27261 - GLSL Compiler fails on the following vertex shader
    • -
    • Bug 27265 - GLSL Compiler doesnt link the attached vertex shader
    • -
    • Bug 27388 - [i965] piglit glsl-vs-arrays failure
    • -
    • Bug 27403 - GLSL struct causing "Invalid src register file ..." error
    • -
    • Bug 27914 - GLSL compiler uses MUL+ADD where it could use MAD
    • -
    • Bug 28055 - glsl-texcoord-array fails GLSL compilation
    • -
    • Bug 28374 - SIGSEGV shader/slang/slang_typeinfo.c:534
    • -
    • Bug 28748 - [i965] uninlined function calls support
    • -
    • Bug 28833 - piglit/shaders/glsl-texcoord-array fail
    • -
    • Bug 28834 - Add support for system fpclassify to GL_OES_query_matrix function for OpenBSD / NetBSD
    • -
    • Bug 28837 - varying vec4 index support
    • -
    • Bug 28845 - The GLU tesselator code has some warnings
    • -
    • Bug 28889 - [regression] wine game crash
    • -
    • Bug 28894 - slang build fails if absolute path contains spaces
    • -
    • Bug 28913 - [GLSL] allowing two version statements
    • -
    • Bug 28931 - Floating Point Exception in Warzone2100 Trunk version
    • -
    • Bug 28966 - [r300g] Dynamic branching 3 demo does not run
    • -
    • Bug 28967 - slang/slang_emit.c:350: storage_to_src_reg: Assertion `index >= 0' failed.
    • -
    • Bug 29013 - [r300g] translate_rgb_op: unknown opcode ILLEGAL OPCODE
    • -
    • Bug 29020 - [r300g] Wine d3d9 tests hardlock
    • -
    • Bug 29910 - Mesa advertises bogus GL_ARB_shading_language_120
    • -
    • Bug 30196 - [GLSL] gl_TextureMatrix{Inverse,Transpose,InverseTranspose} unsupported
    • -
    - - -

    Changes

    -
      -
    • The Mesa demo/test programs have been moved into a separate git -repository. -
    • GL/glext.h file upgraded to version 64 -
    • GL/glxext.h file upgraded to version 32 -
    • GL/wglext.h file upgraded to version 22 -
    - - - + + +Mesa Release Notes + + + + + + + +

    Mesa 7.9 Release Notes / October 4, 2010

    + +

    +Mesa 7.9 is a new development release. +People who are concerned with stability and reliability should stick +with a previous release or wait for Mesa 7.9.1. +

    +

    +Mesa 7.9 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    + + +

    MD5 checksums

    +
    +ed65ab425b25895c7f473d0a5e6e64f8  MesaLib-7.9.tar.gz
    +82c740c49d572baa6da2b1a1eee90bca  MesaLib-7.9.tar.bz2
    +cd2b6ecec759b0457475e94bbb38fedb  MesaLib-7.9.zip
    +7b54af9fb9b1f6a1a65db2520f50848f  MesaGLUT-7.9.tar.gz
    +20d07419d1929f833fdb36bced290ad5  MesaGLUT-7.9.tar.bz2
    +62a7edecd7c92675cd6029b05217eb0a  MesaGLUT-7.9.zip
    +
    + + +

    New features

    +
      +
    • New, improved GLSL compiler written by Intel. + See the Shading Language page for + more information. +
    • New, very experimental Gallium driver for R600-R700 Radeons. +
    • Support for AMD Evergreen-based Radeons (HD 5xxx) +
    • GL_EXT_timer_query extension (i965 driver and softpipe only) +
    • GL_EXT_framebuffer_multisample extension (intel drivers, MAX_SAMPLES = 1) +
    • GL_ARB_texture_swizzle extension (alias of GL_EXT_texture_swizzle) +
    • GL_ARB_draw_elements_base_vertex, GL_ARB_fragment_program_shadow, + GL_ARB_window_pos, GL_EXT_gpu_program_parameters, + GL_ATI_texture_env_combine3, GL_MESA_pack_invert, and GL_OES_EGL_image + extensions in Gallium drivers +
    • GL_ARB_depth_clamp and GL_NV_depth_clamp extensions (in nv50 and r600 + Gallium drivers) +
    • GL_ARB_half_float_vertex extension (in nvfx, r300, r600, softpipe, + and llvmpipe Gallium drivers) +
    • GL_EXT_draw_buffers2 (in nv50, r600, softpipe, and llvmpipe Gallium + drivers) +
    • GL_EXT_texture_swizzle (in nvfx, r300, r600, softpipe, and llvmpipe + Gallium drivers) +
    • GL_ATI_texture_mirror_once (in nvfx, nv50, r300, r600, softpipe, and + llvmpipe Gallium drivers) +
    • GL_NV_conditional_render (in r300 Gallium driver) +
    • Initial "signs of life" support for Sandybridge hardware in i965 DRI + driver. +
    + + +

    Bug fixes

    +

    This list is likely incomplete.

    +
      +
    • Massive improvements to the Gallium driver for R300-R500 Radeons; this + driver is now considered stable for use as a DRI (OpenGL) driver. +
    • Bug 10908 - GLSL: gl_FogParamaters gl_Fog built-in uniform not functioning
    • +
    • Bug 13753 - Numerous bugs in GLSL uniform handling
    • +
    • Bug 16854 - GLSL function call at global scope causes SEGV
    • +
    • Bug 16856 - GLSL indexing of unsized array results in assertion failure
    • +
    • Bug 18659 - Crash in shader/slang/slang_codegen.c _slang_gen_function_call_name()
    • +
    • Bug 19089 - [GLSL] glsl1/shadow2D() cases fail
    • +
    • Bug 22622 - [GM965 GLSL] noise*() cause GPU lockup
    • +
    • Bug 23743 - For loop from 0 to 0 not optimized out
    • +
    • Bug 24553 - shader compilation times explode when using more () pairs
    • +
    • Bug 25664 - [GLSL] re-declaring an empty array fails to compile
    • +
    • Bug 25769 - [GLSL] "float" can be implicitly converted to "int"
    • +
    • Bug 25808 - [GLSL] const variable is modified successfully
    • +
    • Bug 25826 - [GLSL] declaring an unsized array then re-declaring with a size fails
    • +
    • Bug 25827 - [GLSL] vector constructor accepts too many arguments successfully
    • +
    • Bug 25829 - [GLSL] allowing non-void function without returning value
    • +
    • Bug 25830 - [GLSL] allowing non-constant-expression as const declaration initializer
    • +
    • Bug 25877 - [GLSL 1.10] implicit conversion from "int" to "float" should not be allowed
    • +
    • Bug 25878 - [GLSL] sampler is converted to int successfully
    • +
    • Bug 25994 - [GM45][GLSL] 'return' statement in vertex shader unsupported
    • +
    • Bug 25999 - [GLSL] embedded structure constructor fails to compile
    • +
    • Bug 26000 - [GLSL] allowing different parameter qualifier between the function definition and declaration
    • +
    • Bug 26001 - [GLSL 1.10] constructing matrix from matrix succeeds
    • +
    • Bug 26224 - [GLSL] Cannot get location of a uniform struct member
    • +
    • Bug 26990 - [GLSL] variable declaration in "while" fails to compile
    • +
    • Bug 27004 - [GLSL] allowing macro redefinition
    • +
    • Bug 27060 - [965] piglit glsl-fs-raytrace failure due to lack of function calls.
    • +
    • Bug 27216 - Assignment with a function call in an if statement causes an assertion failure
    • +
    • Bug 27261 - GLSL Compiler fails on the following vertex shader
    • +
    • Bug 27265 - GLSL Compiler doesnt link the attached vertex shader
    • +
    • Bug 27388 - [i965] piglit glsl-vs-arrays failure
    • +
    • Bug 27403 - GLSL struct causing "Invalid src register file ..." error
    • +
    • Bug 27914 - GLSL compiler uses MUL+ADD where it could use MAD
    • +
    • Bug 28055 - glsl-texcoord-array fails GLSL compilation
    • +
    • Bug 28374 - SIGSEGV shader/slang/slang_typeinfo.c:534
    • +
    • Bug 28748 - [i965] uninlined function calls support
    • +
    • Bug 28833 - piglit/shaders/glsl-texcoord-array fail
    • +
    • Bug 28834 - Add support for system fpclassify to GL_OES_query_matrix function for OpenBSD / NetBSD
    • +
    • Bug 28837 - varying vec4 index support
    • +
    • Bug 28845 - The GLU tesselator code has some warnings
    • +
    • Bug 28889 - [regression] wine game crash
    • +
    • Bug 28894 - slang build fails if absolute path contains spaces
    • +
    • Bug 28913 - [GLSL] allowing two version statements
    • +
    • Bug 28931 - Floating Point Exception in Warzone2100 Trunk version
    • +
    • Bug 28966 - [r300g] Dynamic branching 3 demo does not run
    • +
    • Bug 28967 - slang/slang_emit.c:350: storage_to_src_reg: Assertion `index >= 0' failed.
    • +
    • Bug 29013 - [r300g] translate_rgb_op: unknown opcode ILLEGAL OPCODE
    • +
    • Bug 29020 - [r300g] Wine d3d9 tests hardlock
    • +
    • Bug 29910 - Mesa advertises bogus GL_ARB_shading_language_120
    • +
    • Bug 30196 - [GLSL] gl_TextureMatrix{Inverse,Transpose,InverseTranspose} unsupported
    • +
    + + +

    Changes

    +
      +
    • The Mesa demo/test programs have been moved into a separate git +repository. +
    • GL/glext.h file upgraded to version 64 +
    • GL/glxext.h file upgraded to version 32 +
    • GL/wglext.h file upgraded to version 22 +
    + + + diff --git a/mesalib/docs/shading.html b/mesalib/docs/shading.html index cc1f9f1ec..aba395974 100644 --- a/mesalib/docs/shading.html +++ b/mesalib/docs/shading.html @@ -1,268 +1,268 @@ - - -Shading Language Support - - - - - -

    Shading Language Support

    - -

    -This page describes the features and status of Mesa's support for the - -OpenGL Shading Language. -

    - -

    -Contents -

    - - - - - -

    Environment Variables

    - -

    -The MESA_GLSL environment variable can be set to a comma-separated -list of keywords to control some aspects of the GLSL compiler and shader -execution. These are generally used for debugging. -

    -
      -
    • dump - print GLSL shader code to stdout at link time -
    • log - log all GLSL shaders to files. - The filenames will be "shader_X.vert" or "shader_X.frag" where X - the shader ID. -
    • nopt - disable compiler optimizations -
    • opt - force compiler optimizations -
    • uniform - print message to stdout when glUniform is called -
    • nopvert - force vertex shaders to be a simple shader that just transforms - the vertex position with ftransform() and passes through the color and - texcoord[0] attributes. -
    • nopfrag - force fragment shader to be a simple shader that passes - through the color attribute. -
    • useprog - log glUseProgram calls to stderr -
    -

    -Example: export MESA_GLSL=dump,nopt -

    - - -
    -

    GLSL Version

    - -

    -The GLSL compiler currently supports version 1.20 of the shading language. -

    - -

    -Several GLSL extensions are also supported: -

    -
      -
    • GL_ARB_draw_buffers -
    • GL_ARB_texture_rectangle -
    • GL_ARB_fragment_coord_conventions -
    • GL_EXT_texture_array -
    - - -
    -

    Unsupported Features

    - -

    XXX update this section

    - -

    -The following features of the shading language are not yet fully supported -in Mesa: -

    - -
      -
    • Linking of multiple shaders does not always work. Currently, linking - is implemented through shader concatenation and re-compiling. This - doesn't always work because of some #pragma and preprocessor issues. -
    • gl_ClipVertex -
    • The gl_Color and gl_SecondaryColor varying vars are interpolated - without perspective correction -
    - -

    -All other major features of the shading language should function. -

    - - -
    -

    Implementation Notes

    - -
      -
    • Shading language programs are compiled into low-level programs - very similar to those of GL_ARB_vertex/fragment_program. -
    • All vector types (vec2, vec3, vec4, bvec2, etc) currently occupy full - float[4] registers. -
    • Float constants and variables are packed so that up to four floats - can occupy one program parameter/register. -
    • All function calls are inlined. -
    • Shaders which use too many registers will not compile. -
    • The quality of generated code is pretty good, register usage is fair. -
    • Shader error detection and reporting of errors (InfoLog) is not - very good yet. -
    • The ftransform() function doesn't necessarily match the results of - fixed-function transformation. -
    - -

    -These issues will be addressed/resolved in the future. -

    - - -
    -

    Programming Hints

    - -
      -
    • Use the built-in library functions whenever possible. - For example, instead of writing this: -
      -        float x = 1.0 / sqrt(y);
      -
      - Write this: -
      -        float x = inversesqrt(y);
      -
      -
    • -
    - - -
    -

    Stand-alone GLSL Compiler

    - -

    -The stand-alone GLSL compiler program can be used to compile GLSL shaders -into low-level GPU code. -

    - -

    -This tool is useful for: -

    -

      -
    • Inspecting GPU code to gain insight into compilation -
    • Generating initial GPU code for subsequent hand-tuning -
    • Debugging the GLSL compiler itself -
    - -

    -After building Mesa, the compiler can be found at src/glsl/glsl_compiler -

    - -

    -Here's an example of using the compiler to compile a vertex shader and -emit GL_ARB_vertex_program-style instructions: -

    -
    -    src/glsl/glsl_compiler --dump-ast myshader.vert
    -
    - -Options include -
      -
    • --dump-ast - dump GPU code -
    • --dump-hir - dump high-level IR code -
    • --dump-lir - dump low-level IR code -
    • --link - ??? -
    - - - - -
    -

    Compiler Implementation

    - -

    -The source code for Mesa's shading language compiler is in the -src/glsl/ directory. -

    - -

    -XXX provide some info about the compiler.... -

    - -

    -The final vertex and fragment programs may be interpreted in software -(see prog_execute.c) or translated into a specific hardware architecture -(see drivers/dri/i915/i915_fragprog.c for example). -

    - -

    Code Generation Options

    - -

    -Internally, there are several options that control the compiler's code -generation and instruction selection. -These options are seen in the gl_shader_state struct and may be set -by the device driver to indicate its preferences: - -

    -struct gl_shader_state
    -{
    -   ...
    -   /** Driver-selectable options: */
    -   GLboolean EmitHighLevelInstructions;
    -   GLboolean EmitCondCodes;
    -   GLboolean EmitComments;
    -};
    -
    - -
      -
    • EmitHighLevelInstructions -
      -This option controls instruction selection for loops and conditionals. -If the option is set high-level IF/ELSE/ENDIF, LOOP/ENDLOOP, CONT/BRK -instructions will be emitted. -Otherwise, those constructs will be implemented with BRA instructions. -
    • - -
    • EmitCondCodes -
      -If set, condition codes (ala GL_NV_fragment_program) will be used for -branching and looping. -Otherwise, ordinary registers will be used (the IF instruction will -examine the first operand's X component and do the if-part if non-zero). -This option is only relevant if EmitHighLevelInstructions is set. -
    • - -
    • EmitComments -
      -If set, instructions will be annoted with comments to help with debugging. -Extra NOP instructions will also be inserted. -
      - -
    - - -
    -

    Compiler Validation

    - -

    -Developers working on the GLSL compiler should test frequently to avoid -regressions. -

    - -

    -The Piglit project -has many GLSL tests and the -Glean glsl1 test -tests GLSL features. -

    - -

    -The Mesa demos repository also has some good GLSL tests. -

    - - - + + +Shading Language Support + + + + + +

    Shading Language Support

    + +

    +This page describes the features and status of Mesa's support for the + +OpenGL Shading Language. +

    + +

    +Contents +

    + + + + + +

    Environment Variables

    + +

    +The MESA_GLSL environment variable can be set to a comma-separated +list of keywords to control some aspects of the GLSL compiler and shader +execution. These are generally used for debugging. +

    +
      +
    • dump - print GLSL shader code to stdout at link time +
    • log - log all GLSL shaders to files. + The filenames will be "shader_X.vert" or "shader_X.frag" where X + the shader ID. +
    • nopt - disable compiler optimizations +
    • opt - force compiler optimizations +
    • uniform - print message to stdout when glUniform is called +
    • nopvert - force vertex shaders to be a simple shader that just transforms + the vertex position with ftransform() and passes through the color and + texcoord[0] attributes. +
    • nopfrag - force fragment shader to be a simple shader that passes + through the color attribute. +
    • useprog - log glUseProgram calls to stderr +
    +

    +Example: export MESA_GLSL=dump,nopt +

    + + +
    +

    GLSL Version

    + +

    +The GLSL compiler currently supports version 1.20 of the shading language. +

    + +

    +Several GLSL extensions are also supported: +

    +
      +
    • GL_ARB_draw_buffers +
    • GL_ARB_texture_rectangle +
    • GL_ARB_fragment_coord_conventions +
    • GL_EXT_texture_array +
    + + +
    +

    Unsupported Features

    + +

    XXX update this section

    + +

    +The following features of the shading language are not yet fully supported +in Mesa: +

    + +
      +
    • Linking of multiple shaders does not always work. Currently, linking + is implemented through shader concatenation and re-compiling. This + doesn't always work because of some #pragma and preprocessor issues. +
    • gl_ClipVertex +
    • The gl_Color and gl_SecondaryColor varying vars are interpolated + without perspective correction +
    + +

    +All other major features of the shading language should function. +

    + + +
    +

    Implementation Notes

    + +
      +
    • Shading language programs are compiled into low-level programs + very similar to those of GL_ARB_vertex/fragment_program. +
    • All vector types (vec2, vec3, vec4, bvec2, etc) currently occupy full + float[4] registers. +
    • Float constants and variables are packed so that up to four floats + can occupy one program parameter/register. +
    • All function calls are inlined. +
    • Shaders which use too many registers will not compile. +
    • The quality of generated code is pretty good, register usage is fair. +
    • Shader error detection and reporting of errors (InfoLog) is not + very good yet. +
    • The ftransform() function doesn't necessarily match the results of + fixed-function transformation. +
    + +

    +These issues will be addressed/resolved in the future. +

    + + +
    +

    Programming Hints

    + +
      +
    • Use the built-in library functions whenever possible. + For example, instead of writing this: +
      +        float x = 1.0 / sqrt(y);
      +
      + Write this: +
      +        float x = inversesqrt(y);
      +
      +
    • +
    + + +
    +

    Stand-alone GLSL Compiler

    + +

    +The stand-alone GLSL compiler program can be used to compile GLSL shaders +into low-level GPU code. +

    + +

    +This tool is useful for: +

    +

      +
    • Inspecting GPU code to gain insight into compilation +
    • Generating initial GPU code for subsequent hand-tuning +
    • Debugging the GLSL compiler itself +
    + +

    +After building Mesa, the compiler can be found at src/glsl/glsl_compiler +

    + +

    +Here's an example of using the compiler to compile a vertex shader and +emit GL_ARB_vertex_program-style instructions: +

    +
    +    src/glsl/glsl_compiler --dump-ast myshader.vert
    +
    + +Options include +
      +
    • --dump-ast - dump GPU code +
    • --dump-hir - dump high-level IR code +
    • --dump-lir - dump low-level IR code +
    • --link - ??? +
    + + + + +
    +

    Compiler Implementation

    + +

    +The source code for Mesa's shading language compiler is in the +src/glsl/ directory. +

    + +

    +XXX provide some info about the compiler.... +

    + +

    +The final vertex and fragment programs may be interpreted in software +(see prog_execute.c) or translated into a specific hardware architecture +(see drivers/dri/i915/i915_fragprog.c for example). +

    + +

    Code Generation Options

    + +

    +Internally, there are several options that control the compiler's code +generation and instruction selection. +These options are seen in the gl_shader_state struct and may be set +by the device driver to indicate its preferences: + +

    +struct gl_shader_state
    +{
    +   ...
    +   /** Driver-selectable options: */
    +   GLboolean EmitHighLevelInstructions;
    +   GLboolean EmitCondCodes;
    +   GLboolean EmitComments;
    +};
    +
    + +
      +
    • EmitHighLevelInstructions +
      +This option controls instruction selection for loops and conditionals. +If the option is set high-level IF/ELSE/ENDIF, LOOP/ENDLOOP, CONT/BRK +instructions will be emitted. +Otherwise, those constructs will be implemented with BRA instructions. +
    • + +
    • EmitCondCodes +
      +If set, condition codes (ala GL_NV_fragment_program) will be used for +branching and looping. +Otherwise, ordinary registers will be used (the IF instruction will +examine the first operand's X component and do the if-part if non-zero). +This option is only relevant if EmitHighLevelInstructions is set. +
    • + +
    • EmitComments +
      +If set, instructions will be annoted with comments to help with debugging. +Extra NOP instructions will also be inserted. +
      + +
    + + +
    +

    Compiler Validation

    + +

    +Developers working on the GLSL compiler should test frequently to avoid +regressions. +

    + +

    +The Piglit project +has many GLSL tests and the +Glean glsl1 test +tests GLSL features. +

    + +

    +The Mesa demos repository also has some good GLSL tests. +

    + + + diff --git a/mesalib/include/GL/gl_mangle.h b/mesalib/include/GL/gl_mangle.h index 9047ee6ff..368480338 100644 --- a/mesalib/include/GL/gl_mangle.h +++ b/mesalib/include/GL/gl_mangle.h @@ -1,2311 +1,2311 @@ -#if 0 -#define GL_MANGLE_C1 "DO NOT EDIT!!! - TO REGENERATE from gl.h, EXECUTE THIS FILE IN SHELL (/bin/sh) and save the output" -#define GL_MANGLE_C2 "This file is used to create GL function protypes and aliases for the function names" - files="gl.h glext.h" -#define GL_MANGLE_C3 "get regeneration header - copy everything in this file above the 'REGENERATE_TO_END' line" - awk '!done; /^\/\*REGENERATE_TO_END/ {done=1}' $0 - echo "" -#define GL_MANGLE_C4 get aliases - grep '^GLAPI' $files | sed -e 's/.*ENTRY gl\([^( ]*\).*$/#define gl\1 MANGLE(\1)/' | sort | uniq - echo "" - echo "#endif /* GL_MANGLE_H */" - exit -#endif /* REGENERATION */ - -/* - * If you compile Mesa with USE_MGL_NAMESPACE defined then you can link - * your application both with OpenGL and Mesa. The Mesa functions will - * be redefined so they are prefixed with "mgl" instead of "gl". - * Mgl contributed by Randy Frank (rfrank@rsinc.com) - * Regneration code contributed by Ray Tice (rayt@ma.ultra.net) - */ - -#ifndef GL_MANGLE_H -#define GL_MANGLE_H - -#ifndef MANGLE -#define MANGLE(x) mgl##x -#endif /*MANGLE*/ - -/*REGENERATE_TO_END-----------ALL LINES BELOW HERE GET REPLACED ON REGENERATION */ - -#define glAccum MANGLE(Accum) -#define glActiveProgramEXT MANGLE(ActiveProgramEXT) -#define glActiveShaderProgram MANGLE(ActiveShaderProgram) -#define glActiveStencilFaceEXT MANGLE(ActiveStencilFaceEXT) -#define glActiveTextureARB MANGLE(ActiveTextureARB) -#define glActiveTexture MANGLE(ActiveTexture) -#define glActiveVaryingNV MANGLE(ActiveVaryingNV) -#define glAlphaFragmentOp1ATI MANGLE(AlphaFragmentOp1ATI) -#define glAlphaFragmentOp2ATI MANGLE(AlphaFragmentOp2ATI) -#define glAlphaFragmentOp3ATI MANGLE(AlphaFragmentOp3ATI) -#define glAlphaFunc MANGLE(AlphaFunc) -#define glApplyTextureEXT MANGLE(ApplyTextureEXT) -#define glAreProgramsResidentNV MANGLE(AreProgramsResidentNV) -#define glAreTexturesResidentEXT MANGLE(AreTexturesResidentEXT) -#define glAreTexturesResident MANGLE(AreTexturesResident) -#define glArrayElementEXT MANGLE(ArrayElementEXT) -#define glArrayElement MANGLE(ArrayElement) -#define glArrayObjectATI MANGLE(ArrayObjectATI) -#define glAsyncMarkerSGIX MANGLE(AsyncMarkerSGIX) -#define glAttachObjectARB MANGLE(AttachObjectARB) -#define glAttachShader MANGLE(AttachShader) -#define glBeginConditionalRender MANGLE(BeginConditionalRender) -#define glBeginConditionalRenderNV MANGLE(BeginConditionalRenderNV) -#define glBeginFragmentShaderATI MANGLE(BeginFragmentShaderATI) -#define glBegin MANGLE(Begin) -#define glBeginOcclusionQueryNV MANGLE(BeginOcclusionQueryNV) -#define glBeginPerfMonitorAMD MANGLE(BeginPerfMonitorAMD) -#define glBeginQueryARB MANGLE(BeginQueryARB) -#define glBeginQueryIndexed MANGLE(BeginQueryIndexed) -#define glBeginQuery MANGLE(BeginQuery) -#define glBeginTransformFeedbackEXT MANGLE(BeginTransformFeedbackEXT) -#define glBeginTransformFeedback MANGLE(BeginTransformFeedback) -#define glBeginTransformFeedbackNV MANGLE(BeginTransformFeedbackNV) -#define glBeginVertexShaderEXT MANGLE(BeginVertexShaderEXT) -#define glBeginVideoCaptureNV MANGLE(BeginVideoCaptureNV) -#define glBindAttribLocationARB MANGLE(BindAttribLocationARB) -#define glBindAttribLocation MANGLE(BindAttribLocation) -#define glBindBufferARB MANGLE(BindBufferARB) -#define glBindBufferBaseEXT MANGLE(BindBufferBaseEXT) -#define glBindBufferBase MANGLE(BindBufferBase) -#define glBindBufferBaseNV MANGLE(BindBufferBaseNV) -#define glBindBuffer MANGLE(BindBuffer) -#define glBindBufferOffsetEXT MANGLE(BindBufferOffsetEXT) -#define glBindBufferOffsetNV MANGLE(BindBufferOffsetNV) -#define glBindBufferRangeEXT MANGLE(BindBufferRangeEXT) -#define glBindBufferRange MANGLE(BindBufferRange) -#define glBindBufferRangeNV MANGLE(BindBufferRangeNV) -#define glBindFragDataLocationEXT MANGLE(BindFragDataLocationEXT) -#define glBindFragDataLocationIndexed MANGLE(BindFragDataLocationIndexed) -#define glBindFragDataLocation MANGLE(BindFragDataLocation) -#define glBindFragmentShaderATI MANGLE(BindFragmentShaderATI) -#define glBindFramebufferEXT MANGLE(BindFramebufferEXT) -#define glBindFramebuffer MANGLE(BindFramebuffer) -#define glBindImageTextureEXT MANGLE(BindImageTextureEXT) -#define glBindLightParameterEXT MANGLE(BindLightParameterEXT) -#define glBindMaterialParameterEXT MANGLE(BindMaterialParameterEXT) -#define glBindMultiTextureEXT MANGLE(BindMultiTextureEXT) -#define glBindParameterEXT MANGLE(BindParameterEXT) -#define glBindProgramARB MANGLE(BindProgramARB) -#define glBindProgramNV MANGLE(BindProgramNV) -#define glBindProgramPipeline MANGLE(BindProgramPipeline) -#define glBindRenderbufferEXT MANGLE(BindRenderbufferEXT) -#define glBindRenderbuffer MANGLE(BindRenderbuffer) -#define glBindSampler MANGLE(BindSampler) -#define glBindTexGenParameterEXT MANGLE(BindTexGenParameterEXT) -#define glBindTextureEXT MANGLE(BindTextureEXT) -#define glBindTexture MANGLE(BindTexture) -#define glBindTextureUnitParameterEXT MANGLE(BindTextureUnitParameterEXT) -#define glBindTransformFeedback MANGLE(BindTransformFeedback) -#define glBindTransformFeedbackNV MANGLE(BindTransformFeedbackNV) -#define glBindVertexArrayAPPLE MANGLE(BindVertexArrayAPPLE) -#define glBindVertexArray MANGLE(BindVertexArray) -#define glBindVertexShaderEXT MANGLE(BindVertexShaderEXT) -#define glBindVideoCaptureStreamBufferNV MANGLE(BindVideoCaptureStreamBufferNV) -#define glBindVideoCaptureStreamTextureNV MANGLE(BindVideoCaptureStreamTextureNV) -#define glBinormal3bEXT MANGLE(Binormal3bEXT) -#define glBinormal3bvEXT MANGLE(Binormal3bvEXT) -#define glBinormal3dEXT MANGLE(Binormal3dEXT) -#define glBinormal3dvEXT MANGLE(Binormal3dvEXT) -#define glBinormal3fEXT MANGLE(Binormal3fEXT) -#define glBinormal3fvEXT MANGLE(Binormal3fvEXT) -#define glBinormal3iEXT MANGLE(Binormal3iEXT) -#define glBinormal3ivEXT MANGLE(Binormal3ivEXT) -#define glBinormal3sEXT MANGLE(Binormal3sEXT) -#define glBinormal3svEXT MANGLE(Binormal3svEXT) -#define glBinormalPointerEXT MANGLE(BinormalPointerEXT) -#define glBitmap MANGLE(Bitmap) -#define glBlendColorEXT MANGLE(BlendColorEXT) -#define glBlendColor MANGLE(BlendColor) -#define glBlendEquationEXT MANGLE(BlendEquationEXT) -#define glBlendEquationiARB MANGLE(BlendEquationiARB) -#define glBlendEquationi MANGLE(BlendEquationi) -#define glBlendEquationIndexedAMD MANGLE(BlendEquationIndexedAMD) -#define glBlendEquation MANGLE(BlendEquation) -#define glBlendEquationSeparateATI MANGLE(BlendEquationSeparateATI) -#define glBlendEquationSeparateEXT MANGLE(BlendEquationSeparateEXT) -#define glBlendEquationSeparateiARB MANGLE(BlendEquationSeparateiARB) -#define glBlendEquationSeparatei MANGLE(BlendEquationSeparatei) -#define glBlendEquationSeparateIndexedAMD MANGLE(BlendEquationSeparateIndexedAMD) -#define glBlendEquationSeparate MANGLE(BlendEquationSeparate) -#define glBlendFunciARB MANGLE(BlendFunciARB) -#define glBlendFunci MANGLE(BlendFunci) -#define glBlendFuncIndexedAMD MANGLE(BlendFuncIndexedAMD) -#define glBlendFunc MANGLE(BlendFunc) -#define glBlendFuncSeparateEXT MANGLE(BlendFuncSeparateEXT) -#define glBlendFuncSeparateiARB MANGLE(BlendFuncSeparateiARB) -#define glBlendFuncSeparatei MANGLE(BlendFuncSeparatei) -#define glBlendFuncSeparateIndexedAMD MANGLE(BlendFuncSeparateIndexedAMD) -#define glBlendFuncSeparateINGR MANGLE(BlendFuncSeparateINGR) -#define glBlendFuncSeparate MANGLE(BlendFuncSeparate) -#define glBlitFramebufferEXT MANGLE(BlitFramebufferEXT) -#define glBlitFramebuffer MANGLE(BlitFramebuffer) -#define glBufferAddressRangeNV MANGLE(BufferAddressRangeNV) -#define glBufferDataARB MANGLE(BufferDataARB) -#define glBufferData MANGLE(BufferData) -#define glBufferParameteriAPPLE MANGLE(BufferParameteriAPPLE) -#define glBufferSubDataARB MANGLE(BufferSubDataARB) -#define glBufferSubData MANGLE(BufferSubData) -#define glCallList MANGLE(CallList) -#define glCallLists MANGLE(CallLists) -#define glCheckFramebufferStatusEXT MANGLE(CheckFramebufferStatusEXT) -#define glCheckFramebufferStatus MANGLE(CheckFramebufferStatus) -#define glCheckNamedFramebufferStatusEXT MANGLE(CheckNamedFramebufferStatusEXT) -#define glClampColorARB MANGLE(ClampColorARB) -#define glClampColor MANGLE(ClampColor) -#define glClearAccum MANGLE(ClearAccum) -#define glClearBufferfi MANGLE(ClearBufferfi) -#define glClearBufferfv MANGLE(ClearBufferfv) -#define glClearBufferiv MANGLE(ClearBufferiv) -#define glClearBufferuiv MANGLE(ClearBufferuiv) -#define glClearColorIiEXT MANGLE(ClearColorIiEXT) -#define glClearColorIuiEXT MANGLE(ClearColorIuiEXT) -#define glClearColor MANGLE(ClearColor) -#define glClearDebugLogMESA MANGLE(ClearDebugLogMESA) -#define glClearDepthdNV MANGLE(ClearDepthdNV) -#define glClearDepthf MANGLE(ClearDepthf) -#define glClearDepth MANGLE(ClearDepth) -#define glClearIndex MANGLE(ClearIndex) -#define glClear MANGLE(Clear) -#define glClearStencil MANGLE(ClearStencil) -#define glClientActiveTextureARB MANGLE(ClientActiveTextureARB) -#define glClientActiveTexture MANGLE(ClientActiveTexture) -#define glClientActiveVertexStreamATI MANGLE(ClientActiveVertexStreamATI) -#define glClientAttribDefaultEXT MANGLE(ClientAttribDefaultEXT) -#define glClientWaitSync MANGLE(ClientWaitSync) -#define glClipPlane MANGLE(ClipPlane) -#define glColor3b MANGLE(Color3b) -#define glColor3bv MANGLE(Color3bv) -#define glColor3d MANGLE(Color3d) -#define glColor3dv MANGLE(Color3dv) -#define glColor3f MANGLE(Color3f) -#define glColor3fVertex3fSUN MANGLE(Color3fVertex3fSUN) -#define glColor3fVertex3fvSUN MANGLE(Color3fVertex3fvSUN) -#define glColor3fv MANGLE(Color3fv) -#define glColor3hNV MANGLE(Color3hNV) -#define glColor3hvNV MANGLE(Color3hvNV) -#define glColor3i MANGLE(Color3i) -#define glColor3iv MANGLE(Color3iv) -#define glColor3s MANGLE(Color3s) -#define glColor3sv MANGLE(Color3sv) -#define glColor3ub MANGLE(Color3ub) -#define glColor3ubv MANGLE(Color3ubv) -#define glColor3ui MANGLE(Color3ui) -#define glColor3uiv MANGLE(Color3uiv) -#define glColor3us MANGLE(Color3us) -#define glColor3usv MANGLE(Color3usv) -#define glColor4b MANGLE(Color4b) -#define glColor4bv MANGLE(Color4bv) -#define glColor4d MANGLE(Color4d) -#define glColor4dv MANGLE(Color4dv) -#define glColor4f MANGLE(Color4f) -#define glColor4fNormal3fVertex3fSUN MANGLE(Color4fNormal3fVertex3fSUN) -#define glColor4fNormal3fVertex3fvSUN MANGLE(Color4fNormal3fVertex3fvSUN) -#define glColor4fv MANGLE(Color4fv) -#define glColor4hNV MANGLE(Color4hNV) -#define glColor4hvNV MANGLE(Color4hvNV) -#define glColor4i MANGLE(Color4i) -#define glColor4iv MANGLE(Color4iv) -#define glColor4s MANGLE(Color4s) -#define glColor4sv MANGLE(Color4sv) -#define glColor4ub MANGLE(Color4ub) -#define glColor4ubVertex2fSUN MANGLE(Color4ubVertex2fSUN) -#define glColor4ubVertex2fvSUN MANGLE(Color4ubVertex2fvSUN) -#define glColor4ubVertex3fSUN MANGLE(Color4ubVertex3fSUN) -#define glColor4ubVertex3fvSUN MANGLE(Color4ubVertex3fvSUN) -#define glColor4ubv MANGLE(Color4ubv) -#define glColor4ui MANGLE(Color4ui) -#define glColor4uiv MANGLE(Color4uiv) -#define glColor4us MANGLE(Color4us) -#define glColor4usv MANGLE(Color4usv) -#define glColorFormatNV MANGLE(ColorFormatNV) -#define glColorFragmentOp1ATI MANGLE(ColorFragmentOp1ATI) -#define glColorFragmentOp2ATI MANGLE(ColorFragmentOp2ATI) -#define glColorFragmentOp3ATI MANGLE(ColorFragmentOp3ATI) -#define glColorMaski MANGLE(ColorMaski) -#define glColorMaskIndexedEXT MANGLE(ColorMaskIndexedEXT) -#define glColorMask MANGLE(ColorMask) -#define glColorMaterial MANGLE(ColorMaterial) -#define glColorP3ui MANGLE(ColorP3ui) -#define glColorP3uiv MANGLE(ColorP3uiv) -#define glColorP4ui MANGLE(ColorP4ui) -#define glColorP4uiv MANGLE(ColorP4uiv) -#define glColorPointerEXT MANGLE(ColorPointerEXT) -#define glColorPointerListIBM MANGLE(ColorPointerListIBM) -#define glColorPointer MANGLE(ColorPointer) -#define glColorPointervINTEL MANGLE(ColorPointervINTEL) -#define glColorSubTableEXT MANGLE(ColorSubTableEXT) -#define glColorSubTable MANGLE(ColorSubTable) -#define glColorTableEXT MANGLE(ColorTableEXT) -#define glColorTable MANGLE(ColorTable) -#define glColorTableParameterfv MANGLE(ColorTableParameterfv) -#define glColorTableParameterfvSGI MANGLE(ColorTableParameterfvSGI) -#define glColorTableParameteriv MANGLE(ColorTableParameteriv) -#define glColorTableParameterivSGI MANGLE(ColorTableParameterivSGI) -#define glColorTableSGI MANGLE(ColorTableSGI) -#define glCombinerInputNV MANGLE(CombinerInputNV) -#define glCombinerOutputNV MANGLE(CombinerOutputNV) -#define glCombinerParameterfNV MANGLE(CombinerParameterfNV) -#define glCombinerParameterfvNV MANGLE(CombinerParameterfvNV) -#define glCombinerParameteriNV MANGLE(CombinerParameteriNV) -#define glCombinerParameterivNV MANGLE(CombinerParameterivNV) -#define glCombinerStageParameterfvNV MANGLE(CombinerStageParameterfvNV) -#define glCompileShaderARB MANGLE(CompileShaderARB) -#define glCompileShaderIncludeARB MANGLE(CompileShaderIncludeARB) -#define glCompileShader MANGLE(CompileShader) -#define glCompressedMultiTexImage1DEXT MANGLE(CompressedMultiTexImage1DEXT) -#define glCompressedMultiTexImage2DEXT MANGLE(CompressedMultiTexImage2DEXT) -#define glCompressedMultiTexImage3DEXT MANGLE(CompressedMultiTexImage3DEXT) -#define glCompressedMultiTexSubImage1DEXT MANGLE(CompressedMultiTexSubImage1DEXT) -#define glCompressedMultiTexSubImage2DEXT MANGLE(CompressedMultiTexSubImage2DEXT) -#define glCompressedMultiTexSubImage3DEXT MANGLE(CompressedMultiTexSubImage3DEXT) -#define glCompressedTexImage1DARB MANGLE(CompressedTexImage1DARB) -#define glCompressedTexImage1D MANGLE(CompressedTexImage1D) -#define glCompressedTexImage2DARB MANGLE(CompressedTexImage2DARB) -#define glCompressedTexImage2D MANGLE(CompressedTexImage2D) -#define glCompressedTexImage3DARB MANGLE(CompressedTexImage3DARB) -#define glCompressedTexImage3D MANGLE(CompressedTexImage3D) -#define glCompressedTexSubImage1DARB MANGLE(CompressedTexSubImage1DARB) -#define glCompressedTexSubImage1D MANGLE(CompressedTexSubImage1D) -#define glCompressedTexSubImage2DARB MANGLE(CompressedTexSubImage2DARB) -#define glCompressedTexSubImage2D MANGLE(CompressedTexSubImage2D) -#define glCompressedTexSubImage3DARB MANGLE(CompressedTexSubImage3DARB) -#define glCompressedTexSubImage3D MANGLE(CompressedTexSubImage3D) -#define glCompressedTextureImage1DEXT MANGLE(CompressedTextureImage1DEXT) -#define glCompressedTextureImage2DEXT MANGLE(CompressedTextureImage2DEXT) -#define glCompressedTextureImage3DEXT MANGLE(CompressedTextureImage3DEXT) -#define glCompressedTextureSubImage1DEXT MANGLE(CompressedTextureSubImage1DEXT) -#define glCompressedTextureSubImage2DEXT MANGLE(CompressedTextureSubImage2DEXT) -#define glCompressedTextureSubImage3DEXT MANGLE(CompressedTextureSubImage3DEXT) -#define glConvolutionFilter1DEXT MANGLE(ConvolutionFilter1DEXT) -#define glConvolutionFilter1D MANGLE(ConvolutionFilter1D) -#define glConvolutionFilter2DEXT MANGLE(ConvolutionFilter2DEXT) -#define glConvolutionFilter2D MANGLE(ConvolutionFilter2D) -#define glConvolutionParameterfEXT MANGLE(ConvolutionParameterfEXT) -#define glConvolutionParameterf MANGLE(ConvolutionParameterf) -#define glConvolutionParameterfvEXT MANGLE(ConvolutionParameterfvEXT) -#define glConvolutionParameterfv MANGLE(ConvolutionParameterfv) -#define glConvolutionParameteriEXT MANGLE(ConvolutionParameteriEXT) -#define glConvolutionParameteri MANGLE(ConvolutionParameteri) -#define glConvolutionParameterivEXT MANGLE(ConvolutionParameterivEXT) -#define glConvolutionParameteriv MANGLE(ConvolutionParameteriv) -#define glCopyBufferSubData MANGLE(CopyBufferSubData) -#define glCopyColorSubTableEXT MANGLE(CopyColorSubTableEXT) -#define glCopyColorSubTable MANGLE(CopyColorSubTable) -#define glCopyColorTable MANGLE(CopyColorTable) -#define glCopyColorTableSGI MANGLE(CopyColorTableSGI) -#define glCopyConvolutionFilter1DEXT MANGLE(CopyConvolutionFilter1DEXT) -#define glCopyConvolutionFilter1D MANGLE(CopyConvolutionFilter1D) -#define glCopyConvolutionFilter2DEXT MANGLE(CopyConvolutionFilter2DEXT) -#define glCopyConvolutionFilter2D MANGLE(CopyConvolutionFilter2D) -#define glCopyImageSubDataNV MANGLE(CopyImageSubDataNV) -#define glCopyMultiTexImage1DEXT MANGLE(CopyMultiTexImage1DEXT) -#define glCopyMultiTexImage2DEXT MANGLE(CopyMultiTexImage2DEXT) -#define glCopyMultiTexSubImage1DEXT MANGLE(CopyMultiTexSubImage1DEXT) -#define glCopyMultiTexSubImage2DEXT MANGLE(CopyMultiTexSubImage2DEXT) -#define glCopyMultiTexSubImage3DEXT MANGLE(CopyMultiTexSubImage3DEXT) -#define glCopyPixels MANGLE(CopyPixels) -#define glCopyTexImage1DEXT MANGLE(CopyTexImage1DEXT) -#define glCopyTexImage1D MANGLE(CopyTexImage1D) -#define glCopyTexImage2DEXT MANGLE(CopyTexImage2DEXT) -#define glCopyTexImage2D MANGLE(CopyTexImage2D) -#define glCopyTexSubImage1DEXT MANGLE(CopyTexSubImage1DEXT) -#define glCopyTexSubImage1D MANGLE(CopyTexSubImage1D) -#define glCopyTexSubImage2DEXT MANGLE(CopyTexSubImage2DEXT) -#define glCopyTexSubImage2D MANGLE(CopyTexSubImage2D) -#define glCopyTexSubImage3DEXT MANGLE(CopyTexSubImage3DEXT) -#define glCopyTexSubImage3D MANGLE(CopyTexSubImage3D) -#define glCopyTextureImage1DEXT MANGLE(CopyTextureImage1DEXT) -#define glCopyTextureImage2DEXT MANGLE(CopyTextureImage2DEXT) -#define glCopyTextureSubImage1DEXT MANGLE(CopyTextureSubImage1DEXT) -#define glCopyTextureSubImage2DEXT MANGLE(CopyTextureSubImage2DEXT) -#define glCopyTextureSubImage3DEXT MANGLE(CopyTextureSubImage3DEXT) -#define glCreateDebugObjectMESA MANGLE(CreateDebugObjectMESA) -#define glCreateProgram MANGLE(CreateProgram) -#define glCreateProgramObjectARB MANGLE(CreateProgramObjectARB) -#define glCreateShader MANGLE(CreateShader) -#define glCreateShaderObjectARB MANGLE(CreateShaderObjectARB) -#define glCreateShaderProgramEXT MANGLE(CreateShaderProgramEXT) -#define glCreateShaderProgramv MANGLE(CreateShaderProgramv) -#define glCreateSyncFromCLeventARB MANGLE(CreateSyncFromCLeventARB) -#define glCullFace MANGLE(CullFace) -#define glCullParameterdvEXT MANGLE(CullParameterdvEXT) -#define glCullParameterfvEXT MANGLE(CullParameterfvEXT) -#define glCurrentPaletteMatrixARB MANGLE(CurrentPaletteMatrixARB) -#define glDebugMessageCallbackAMD MANGLE(DebugMessageCallbackAMD) -#define glDebugMessageCallbackARB MANGLE(DebugMessageCallbackARB) -#define glDebugMessageControlARB MANGLE(DebugMessageControlARB) -#define glDebugMessageEnableAMD MANGLE(DebugMessageEnableAMD) -#define glDebugMessageInsertAMD MANGLE(DebugMessageInsertAMD) -#define glDebugMessageInsertARB MANGLE(DebugMessageInsertARB) -#define glDeformationMap3dSGIX MANGLE(DeformationMap3dSGIX) -#define glDeformationMap3fSGIX MANGLE(DeformationMap3fSGIX) -#define glDeformSGIX MANGLE(DeformSGIX) -#define glDeleteAsyncMarkersSGIX MANGLE(DeleteAsyncMarkersSGIX) -#define glDeleteBuffersARB MANGLE(DeleteBuffersARB) -#define glDeleteBuffers MANGLE(DeleteBuffers) -#define glDeleteFencesAPPLE MANGLE(DeleteFencesAPPLE) -#define glDeleteFencesNV MANGLE(DeleteFencesNV) -#define glDeleteFragmentShaderATI MANGLE(DeleteFragmentShaderATI) -#define glDeleteFramebuffersEXT MANGLE(DeleteFramebuffersEXT) -#define glDeleteFramebuffers MANGLE(DeleteFramebuffers) -#define glDeleteLists MANGLE(DeleteLists) -#define glDeleteNamedStringARB MANGLE(DeleteNamedStringARB) -#define glDeleteNamesAMD MANGLE(DeleteNamesAMD) -#define glDeleteObjectARB MANGLE(DeleteObjectARB) -#define glDeleteOcclusionQueriesNV MANGLE(DeleteOcclusionQueriesNV) -#define glDeletePerfMonitorsAMD MANGLE(DeletePerfMonitorsAMD) -#define glDeleteProgram MANGLE(DeleteProgram) -#define glDeleteProgramPipelines MANGLE(DeleteProgramPipelines) -#define glDeleteProgramsARB MANGLE(DeleteProgramsARB) -#define glDeleteProgramsNV MANGLE(DeleteProgramsNV) -#define glDeleteQueriesARB MANGLE(DeleteQueriesARB) -#define glDeleteQueries MANGLE(DeleteQueries) -#define glDeleteRenderbuffersEXT MANGLE(DeleteRenderbuffersEXT) -#define glDeleteRenderbuffers MANGLE(DeleteRenderbuffers) -#define glDeleteSamplers MANGLE(DeleteSamplers) -#define glDeleteShader MANGLE(DeleteShader) -#define glDeleteSync MANGLE(DeleteSync) -#define glDeleteTexturesEXT MANGLE(DeleteTexturesEXT) -#define glDeleteTextures MANGLE(DeleteTextures) -#define glDeleteTransformFeedbacks MANGLE(DeleteTransformFeedbacks) -#define glDeleteTransformFeedbacksNV MANGLE(DeleteTransformFeedbacksNV) -#define glDeleteVertexArraysAPPLE MANGLE(DeleteVertexArraysAPPLE) -#define glDeleteVertexArrays MANGLE(DeleteVertexArrays) -#define glDeleteVertexShaderEXT MANGLE(DeleteVertexShaderEXT) -#define glDepthBoundsdNV MANGLE(DepthBoundsdNV) -#define glDepthBoundsEXT MANGLE(DepthBoundsEXT) -#define glDepthFunc MANGLE(DepthFunc) -#define glDepthMask MANGLE(DepthMask) -#define glDepthRangeArrayv MANGLE(DepthRangeArrayv) -#define glDepthRangedNV MANGLE(DepthRangedNV) -#define glDepthRangef MANGLE(DepthRangef) -#define glDepthRangeIndexed MANGLE(DepthRangeIndexed) -#define glDepthRange MANGLE(DepthRange) -#define glDetachObjectARB MANGLE(DetachObjectARB) -#define glDetachShader MANGLE(DetachShader) -#define glDetailTexFuncSGIS MANGLE(DetailTexFuncSGIS) -#define glDisableClientStateIndexedEXT MANGLE(DisableClientStateIndexedEXT) -#define glDisableClientState MANGLE(DisableClientState) -#define glDisablei MANGLE(Disablei) -#define glDisableIndexedEXT MANGLE(DisableIndexedEXT) -#define glDisable MANGLE(Disable) -#define glDisableVariantClientStateEXT MANGLE(DisableVariantClientStateEXT) -#define glDisableVertexAttribAPPLE MANGLE(DisableVertexAttribAPPLE) -#define glDisableVertexAttribArrayARB MANGLE(DisableVertexAttribArrayARB) -#define glDisableVertexAttribArray MANGLE(DisableVertexAttribArray) -#define glDrawArraysEXT MANGLE(DrawArraysEXT) -#define glDrawArraysIndirect MANGLE(DrawArraysIndirect) -#define glDrawArraysInstancedARB MANGLE(DrawArraysInstancedARB) -#define glDrawArraysInstancedEXT MANGLE(DrawArraysInstancedEXT) -#define glDrawArraysInstanced MANGLE(DrawArraysInstanced) -#define glDrawArrays MANGLE(DrawArrays) -#define glDrawBuffer MANGLE(DrawBuffer) -#define glDrawBuffersARB MANGLE(DrawBuffersARB) -#define glDrawBuffersATI MANGLE(DrawBuffersATI) -#define glDrawBuffers MANGLE(DrawBuffers) -#define glDrawElementArrayAPPLE MANGLE(DrawElementArrayAPPLE) -#define glDrawElementArrayATI MANGLE(DrawElementArrayATI) -#define glDrawElementsBaseVertex MANGLE(DrawElementsBaseVertex) -#define glDrawElementsIndirect MANGLE(DrawElementsIndirect) -#define glDrawElementsInstancedARB MANGLE(DrawElementsInstancedARB) -#define glDrawElementsInstancedBaseVertex MANGLE(DrawElementsInstancedBaseVertex) -#define glDrawElementsInstancedEXT MANGLE(DrawElementsInstancedEXT) -#define glDrawElementsInstanced MANGLE(DrawElementsInstanced) -#define glDrawElements MANGLE(DrawElements) -#define glDrawMeshArraysSUN MANGLE(DrawMeshArraysSUN) -#define glDrawPixels MANGLE(DrawPixels) -#define glDrawRangeElementArrayAPPLE MANGLE(DrawRangeElementArrayAPPLE) -#define glDrawRangeElementArrayATI MANGLE(DrawRangeElementArrayATI) -#define glDrawRangeElementsBaseVertex MANGLE(DrawRangeElementsBaseVertex) -#define glDrawRangeElementsEXT MANGLE(DrawRangeElementsEXT) -#define glDrawRangeElements MANGLE(DrawRangeElements) -#define glDrawTransformFeedback MANGLE(DrawTransformFeedback) -#define glDrawTransformFeedbackNV MANGLE(DrawTransformFeedbackNV) -#define glDrawTransformFeedbackStream MANGLE(DrawTransformFeedbackStream) -#define glEdgeFlagFormatNV MANGLE(EdgeFlagFormatNV) -#define glEdgeFlag MANGLE(EdgeFlag) -#define glEdgeFlagPointerEXT MANGLE(EdgeFlagPointerEXT) -#define glEdgeFlagPointerListIBM MANGLE(EdgeFlagPointerListIBM) -#define glEdgeFlagPointer MANGLE(EdgeFlagPointer) -#define glEdgeFlagv MANGLE(EdgeFlagv) -#define glEGLImageTargetRenderbufferStorageOES MANGLE(EGLImageTargetRenderbufferStorageOES) -#define glEGLImageTargetTexture2DOES MANGLE(EGLImageTargetTexture2DOES) -#define glElementPointerAPPLE MANGLE(ElementPointerAPPLE) -#define glElementPointerATI MANGLE(ElementPointerATI) -#define glEnableClientStateIndexedEXT MANGLE(EnableClientStateIndexedEXT) -#define glEnableClientState MANGLE(EnableClientState) -#define glEnablei MANGLE(Enablei) -#define glEnableIndexedEXT MANGLE(EnableIndexedEXT) -#define glEnable MANGLE(Enable) -#define glEnableVariantClientStateEXT MANGLE(EnableVariantClientStateEXT) -#define glEnableVertexAttribAPPLE MANGLE(EnableVertexAttribAPPLE) -#define glEnableVertexAttribArrayARB MANGLE(EnableVertexAttribArrayARB) -#define glEnableVertexAttribArray MANGLE(EnableVertexAttribArray) -#define glEndConditionalRender MANGLE(EndConditionalRender) -#define glEndConditionalRenderNV MANGLE(EndConditionalRenderNV) -#define glEndFragmentShaderATI MANGLE(EndFragmentShaderATI) -#define glEndList MANGLE(EndList) -#define glEnd MANGLE(End) -#define glEndOcclusionQueryNV MANGLE(EndOcclusionQueryNV) -#define glEndPerfMonitorAMD MANGLE(EndPerfMonitorAMD) -#define glEndQueryARB MANGLE(EndQueryARB) -#define glEndQueryIndexed MANGLE(EndQueryIndexed) -#define glEndQuery MANGLE(EndQuery) -#define glEndTransformFeedbackEXT MANGLE(EndTransformFeedbackEXT) -#define glEndTransformFeedback MANGLE(EndTransformFeedback) -#define glEndTransformFeedbackNV MANGLE(EndTransformFeedbackNV) -#define glEndVertexShaderEXT MANGLE(EndVertexShaderEXT) -#define glEndVideoCaptureNV MANGLE(EndVideoCaptureNV) -#define glEvalCoord1d MANGLE(EvalCoord1d) -#define glEvalCoord1dv MANGLE(EvalCoord1dv) -#define glEvalCoord1f MANGLE(EvalCoord1f) -#define glEvalCoord1fv MANGLE(EvalCoord1fv) -#define glEvalCoord2d MANGLE(EvalCoord2d) -#define glEvalCoord2dv MANGLE(EvalCoord2dv) -#define glEvalCoord2f MANGLE(EvalCoord2f) -#define glEvalCoord2fv MANGLE(EvalCoord2fv) -#define glEvalMapsNV MANGLE(EvalMapsNV) -#define glEvalMesh1 MANGLE(EvalMesh1) -#define glEvalMesh2 MANGLE(EvalMesh2) -#define glEvalPoint1 MANGLE(EvalPoint1) -#define glEvalPoint2 MANGLE(EvalPoint2) -#define glExecuteProgramNV MANGLE(ExecuteProgramNV) -#define glExtractComponentEXT MANGLE(ExtractComponentEXT) -#define glFeedbackBuffer MANGLE(FeedbackBuffer) -#define glFenceSync MANGLE(FenceSync) -#define glFinalCombinerInputNV MANGLE(FinalCombinerInputNV) -#define glFinishAsyncSGIX MANGLE(FinishAsyncSGIX) -#define glFinishFenceAPPLE MANGLE(FinishFenceAPPLE) -#define glFinishFenceNV MANGLE(FinishFenceNV) -#define glFinish MANGLE(Finish) -#define glFinishObjectAPPLE MANGLE(FinishObjectAPPLE) -#define glFinishTextureSUNX MANGLE(FinishTextureSUNX) -#define glFlush MANGLE(Flush) -#define glFlushMappedBufferRangeAPPLE MANGLE(FlushMappedBufferRangeAPPLE) -#define glFlushMappedBufferRange MANGLE(FlushMappedBufferRange) -#define glFlushMappedNamedBufferRangeEXT MANGLE(FlushMappedNamedBufferRangeEXT) -#define glFlushPixelDataRangeNV MANGLE(FlushPixelDataRangeNV) -#define glFlushRasterSGIX MANGLE(FlushRasterSGIX) -#define glFlushVertexArrayRangeAPPLE MANGLE(FlushVertexArrayRangeAPPLE) -#define glFlushVertexArrayRangeNV MANGLE(FlushVertexArrayRangeNV) -#define glFogCoorddEXT MANGLE(FogCoorddEXT) -#define glFogCoordd MANGLE(FogCoordd) -#define glFogCoorddvEXT MANGLE(FogCoorddvEXT) -#define glFogCoorddv MANGLE(FogCoorddv) -#define glFogCoordfEXT MANGLE(FogCoordfEXT) -#define glFogCoordf MANGLE(FogCoordf) -#define glFogCoordFormatNV MANGLE(FogCoordFormatNV) -#define glFogCoordfvEXT MANGLE(FogCoordfvEXT) -#define glFogCoordfv MANGLE(FogCoordfv) -#define glFogCoordhNV MANGLE(FogCoordhNV) -#define glFogCoordhvNV MANGLE(FogCoordhvNV) -#define glFogCoordPointerEXT MANGLE(FogCoordPointerEXT) -#define glFogCoordPointerListIBM MANGLE(FogCoordPointerListIBM) -#define glFogCoordPointer MANGLE(FogCoordPointer) -#define glFogf MANGLE(Fogf) -#define glFogFuncSGIS MANGLE(FogFuncSGIS) -#define glFogfv MANGLE(Fogfv) -#define glFogi MANGLE(Fogi) -#define glFogiv MANGLE(Fogiv) -#define glFragmentColorMaterialSGIX MANGLE(FragmentColorMaterialSGIX) -#define glFragmentLightfSGIX MANGLE(FragmentLightfSGIX) -#define glFragmentLightfvSGIX MANGLE(FragmentLightfvSGIX) -#define glFragmentLightiSGIX MANGLE(FragmentLightiSGIX) -#define glFragmentLightivSGIX MANGLE(FragmentLightivSGIX) -#define glFragmentLightModelfSGIX MANGLE(FragmentLightModelfSGIX) -#define glFragmentLightModelfvSGIX MANGLE(FragmentLightModelfvSGIX) -#define glFragmentLightModeliSGIX MANGLE(FragmentLightModeliSGIX) -#define glFragmentLightModelivSGIX MANGLE(FragmentLightModelivSGIX) -#define glFragmentMaterialfSGIX MANGLE(FragmentMaterialfSGIX) -#define glFragmentMaterialfvSGIX MANGLE(FragmentMaterialfvSGIX) -#define glFragmentMaterialiSGIX MANGLE(FragmentMaterialiSGIX) -#define glFragmentMaterialivSGIX MANGLE(FragmentMaterialivSGIX) -#define glFramebufferDrawBufferEXT MANGLE(FramebufferDrawBufferEXT) -#define glFramebufferDrawBuffersEXT MANGLE(FramebufferDrawBuffersEXT) -#define glFramebufferReadBufferEXT MANGLE(FramebufferReadBufferEXT) -#define glFramebufferRenderbufferEXT MANGLE(FramebufferRenderbufferEXT) -#define glFramebufferRenderbuffer MANGLE(FramebufferRenderbuffer) -#define glFramebufferTexture1DEXT MANGLE(FramebufferTexture1DEXT) -#define glFramebufferTexture1D MANGLE(FramebufferTexture1D) -#define glFramebufferTexture2DEXT MANGLE(FramebufferTexture2DEXT) -#define glFramebufferTexture2D MANGLE(FramebufferTexture2D) -#define glFramebufferTexture3DEXT MANGLE(FramebufferTexture3DEXT) -#define glFramebufferTexture3D MANGLE(FramebufferTexture3D) -#define glFramebufferTextureARB MANGLE(FramebufferTextureARB) -#define glFramebufferTextureEXT MANGLE(FramebufferTextureEXT) -#define glFramebufferTextureFaceARB MANGLE(FramebufferTextureFaceARB) -#define glFramebufferTextureFaceEXT MANGLE(FramebufferTextureFaceEXT) -#define glFramebufferTextureLayerARB MANGLE(FramebufferTextureLayerARB) -#define glFramebufferTextureLayerEXT MANGLE(FramebufferTextureLayerEXT) -#define glFramebufferTextureLayer MANGLE(FramebufferTextureLayer) -#define glFramebufferTexture MANGLE(FramebufferTexture) -#define glFrameTerminatorGREMEDY MANGLE(FrameTerminatorGREMEDY) -#define glFrameZoomSGIX MANGLE(FrameZoomSGIX) -#define glFreeObjectBufferATI MANGLE(FreeObjectBufferATI) -#define glFrontFace MANGLE(FrontFace) -#define glFrustum MANGLE(Frustum) -#define glGenAsyncMarkersSGIX MANGLE(GenAsyncMarkersSGIX) -#define glGenBuffersARB MANGLE(GenBuffersARB) -#define glGenBuffers MANGLE(GenBuffers) -#define glGenerateMipmapEXT MANGLE(GenerateMipmapEXT) -#define glGenerateMipmap MANGLE(GenerateMipmap) -#define glGenerateMultiTexMipmapEXT MANGLE(GenerateMultiTexMipmapEXT) -#define glGenerateTextureMipmapEXT MANGLE(GenerateTextureMipmapEXT) -#define glGenFencesAPPLE MANGLE(GenFencesAPPLE) -#define glGenFencesNV MANGLE(GenFencesNV) -#define glGenFragmentShadersATI MANGLE(GenFragmentShadersATI) -#define glGenFramebuffersEXT MANGLE(GenFramebuffersEXT) -#define glGenFramebuffers MANGLE(GenFramebuffers) -#define glGenLists MANGLE(GenLists) -#define glGenNamesAMD MANGLE(GenNamesAMD) -#define glGenOcclusionQueriesNV MANGLE(GenOcclusionQueriesNV) -#define glGenPerfMonitorsAMD MANGLE(GenPerfMonitorsAMD) -#define glGenProgramPipelines MANGLE(GenProgramPipelines) -#define glGenProgramsARB MANGLE(GenProgramsARB) -#define glGenProgramsNV MANGLE(GenProgramsNV) -#define glGenQueriesARB MANGLE(GenQueriesARB) -#define glGenQueries MANGLE(GenQueries) -#define glGenRenderbuffersEXT MANGLE(GenRenderbuffersEXT) -#define glGenRenderbuffers MANGLE(GenRenderbuffers) -#define glGenSamplers MANGLE(GenSamplers) -#define glGenSymbolsEXT MANGLE(GenSymbolsEXT) -#define glGenTexturesEXT MANGLE(GenTexturesEXT) -#define glGenTextures MANGLE(GenTextures) -#define glGenTransformFeedbacks MANGLE(GenTransformFeedbacks) -#define glGenTransformFeedbacksNV MANGLE(GenTransformFeedbacksNV) -#define glGenVertexArraysAPPLE MANGLE(GenVertexArraysAPPLE) -#define glGenVertexArrays MANGLE(GenVertexArrays) -#define glGenVertexShadersEXT MANGLE(GenVertexShadersEXT) -#define glGetActiveAttribARB MANGLE(GetActiveAttribARB) -#define glGetActiveAttrib MANGLE(GetActiveAttrib) -#define glGetActiveSubroutineName MANGLE(GetActiveSubroutineName) -#define glGetActiveSubroutineUniformiv MANGLE(GetActiveSubroutineUniformiv) -#define glGetActiveSubroutineUniformName MANGLE(GetActiveSubroutineUniformName) -#define glGetActiveUniformARB MANGLE(GetActiveUniformARB) -#define glGetActiveUniformBlockiv MANGLE(GetActiveUniformBlockiv) -#define glGetActiveUniformBlockName MANGLE(GetActiveUniformBlockName) -#define glGetActiveUniform MANGLE(GetActiveUniform) -#define glGetActiveUniformName MANGLE(GetActiveUniformName) -#define glGetActiveUniformsiv MANGLE(GetActiveUniformsiv) -#define glGetActiveVaryingNV MANGLE(GetActiveVaryingNV) -#define glGetArrayObjectfvATI MANGLE(GetArrayObjectfvATI) -#define glGetArrayObjectivATI MANGLE(GetArrayObjectivATI) -#define glGetAttachedObjectsARB MANGLE(GetAttachedObjectsARB) -#define glGetAttachedShaders MANGLE(GetAttachedShaders) -#define glGetAttribLocationARB MANGLE(GetAttribLocationARB) -#define glGetAttribLocation MANGLE(GetAttribLocation) -#define glGetBooleanIndexedvEXT MANGLE(GetBooleanIndexedvEXT) -#define glGetBooleani_v MANGLE(GetBooleani_v) -#define glGetBooleanv MANGLE(GetBooleanv) -#define glGetBufferParameteri64v MANGLE(GetBufferParameteri64v) -#define glGetBufferParameterivARB MANGLE(GetBufferParameterivARB) -#define glGetBufferParameteriv MANGLE(GetBufferParameteriv) -#define glGetBufferParameterui64vNV MANGLE(GetBufferParameterui64vNV) -#define glGetBufferPointervARB MANGLE(GetBufferPointervARB) -#define glGetBufferPointerv MANGLE(GetBufferPointerv) -#define glGetBufferSubDataARB MANGLE(GetBufferSubDataARB) -#define glGetBufferSubData MANGLE(GetBufferSubData) -#define glGetClipPlane MANGLE(GetClipPlane) -#define glGetColorTableEXT MANGLE(GetColorTableEXT) -#define glGetColorTable MANGLE(GetColorTable) -#define glGetColorTableParameterfvEXT MANGLE(GetColorTableParameterfvEXT) -#define glGetColorTableParameterfv MANGLE(GetColorTableParameterfv) -#define glGetColorTableParameterfvSGI MANGLE(GetColorTableParameterfvSGI) -#define glGetColorTableParameterivEXT MANGLE(GetColorTableParameterivEXT) -#define glGetColorTableParameteriv MANGLE(GetColorTableParameteriv) -#define glGetColorTableParameterivSGI MANGLE(GetColorTableParameterivSGI) -#define glGetColorTableSGI MANGLE(GetColorTableSGI) -#define glGetCombinerInputParameterfvNV MANGLE(GetCombinerInputParameterfvNV) -#define glGetCombinerInputParameterivNV MANGLE(GetCombinerInputParameterivNV) -#define glGetCombinerOutputParameterfvNV MANGLE(GetCombinerOutputParameterfvNV) -#define glGetCombinerOutputParameterivNV MANGLE(GetCombinerOutputParameterivNV) -#define glGetCombinerStageParameterfvNV MANGLE(GetCombinerStageParameterfvNV) -#define glGetCompressedMultiTexImageEXT MANGLE(GetCompressedMultiTexImageEXT) -#define glGetCompressedTexImageARB MANGLE(GetCompressedTexImageARB) -#define glGetCompressedTexImage MANGLE(GetCompressedTexImage) -#define glGetCompressedTextureImageEXT MANGLE(GetCompressedTextureImageEXT) -#define glGetConvolutionFilterEXT MANGLE(GetConvolutionFilterEXT) -#define glGetConvolutionFilter MANGLE(GetConvolutionFilter) -#define glGetConvolutionParameterfvEXT MANGLE(GetConvolutionParameterfvEXT) -#define glGetConvolutionParameterfv MANGLE(GetConvolutionParameterfv) -#define glGetConvolutionParameterivEXT MANGLE(GetConvolutionParameterivEXT) -#define glGetConvolutionParameteriv MANGLE(GetConvolutionParameteriv) -#define glGetDebugLogLengthMESA MANGLE(GetDebugLogLengthMESA) -#define glGetDebugLogMESA MANGLE(GetDebugLogMESA) -#define glGetDebugMessageLogAMD MANGLE(GetDebugMessageLogAMD) -#define glGetDebugMessageLogARB MANGLE(GetDebugMessageLogARB) -#define glGetDetailTexFuncSGIS MANGLE(GetDetailTexFuncSGIS) -#define glGetDoubleIndexedvEXT MANGLE(GetDoubleIndexedvEXT) -#define glGetDoublei_v MANGLE(GetDoublei_v) -#define glGetDoublev MANGLE(GetDoublev) -#define glGetError MANGLE(GetError) -#define glGetFenceivNV MANGLE(GetFenceivNV) -#define glGetFinalCombinerInputParameterfvNV MANGLE(GetFinalCombinerInputParameterfvNV) -#define glGetFinalCombinerInputParameterivNV MANGLE(GetFinalCombinerInputParameterivNV) -#define glGetFloatIndexedvEXT MANGLE(GetFloatIndexedvEXT) -#define glGetFloati_v MANGLE(GetFloati_v) -#define glGetFloatv MANGLE(GetFloatv) -#define glGetFogFuncSGIS MANGLE(GetFogFuncSGIS) -#define glGetFragDataIndex MANGLE(GetFragDataIndex) -#define glGetFragDataLocationEXT MANGLE(GetFragDataLocationEXT) -#define glGetFragDataLocation MANGLE(GetFragDataLocation) -#define glGetFragmentLightfvSGIX MANGLE(GetFragmentLightfvSGIX) -#define glGetFragmentLightivSGIX MANGLE(GetFragmentLightivSGIX) -#define glGetFragmentMaterialfvSGIX MANGLE(GetFragmentMaterialfvSGIX) -#define glGetFragmentMaterialivSGIX MANGLE(GetFragmentMaterialivSGIX) -#define glGetFramebufferAttachmentParameterivEXT MANGLE(GetFramebufferAttachmentParameterivEXT) -#define glGetFramebufferAttachmentParameteriv MANGLE(GetFramebufferAttachmentParameteriv) -#define glGetFramebufferParameterivEXT MANGLE(GetFramebufferParameterivEXT) -#define glGetGraphicsResetStatusARB MANGLE(GetGraphicsResetStatusARB) -#define glGetHandleARB MANGLE(GetHandleARB) -#define glGetHistogramEXT MANGLE(GetHistogramEXT) -#define glGetHistogram MANGLE(GetHistogram) -#define glGetHistogramParameterfvEXT MANGLE(GetHistogramParameterfvEXT) -#define glGetHistogramParameterfv MANGLE(GetHistogramParameterfv) -#define glGetHistogramParameterivEXT MANGLE(GetHistogramParameterivEXT) -#define glGetHistogramParameteriv MANGLE(GetHistogramParameteriv) -#define glGetImageTransformParameterfvHP MANGLE(GetImageTransformParameterfvHP) -#define glGetImageTransformParameterivHP MANGLE(GetImageTransformParameterivHP) -#define glGetInfoLogARB MANGLE(GetInfoLogARB) -#define glGetInstrumentsSGIX MANGLE(GetInstrumentsSGIX) -#define glGetInteger64i_v MANGLE(GetInteger64i_v) -#define glGetInteger64v MANGLE(GetInteger64v) -#define glGetIntegerIndexedvEXT MANGLE(GetIntegerIndexedvEXT) -#define glGetIntegeri_v MANGLE(GetIntegeri_v) -#define glGetIntegerui64i_vNV MANGLE(GetIntegerui64i_vNV) -#define glGetIntegerui64vNV MANGLE(GetIntegerui64vNV) -#define glGetIntegerv MANGLE(GetIntegerv) -#define glGetInvariantBooleanvEXT MANGLE(GetInvariantBooleanvEXT) -#define glGetInvariantFloatvEXT MANGLE(GetInvariantFloatvEXT) -#define glGetInvariantIntegervEXT MANGLE(GetInvariantIntegervEXT) -#define glGetLightfv MANGLE(GetLightfv) -#define glGetLightiv MANGLE(GetLightiv) -#define glGetListParameterfvSGIX MANGLE(GetListParameterfvSGIX) -#define glGetListParameterivSGIX MANGLE(GetListParameterivSGIX) -#define glGetLocalConstantBooleanvEXT MANGLE(GetLocalConstantBooleanvEXT) -#define glGetLocalConstantFloatvEXT MANGLE(GetLocalConstantFloatvEXT) -#define glGetLocalConstantIntegervEXT MANGLE(GetLocalConstantIntegervEXT) -#define glGetMapAttribParameterfvNV MANGLE(GetMapAttribParameterfvNV) -#define glGetMapAttribParameterivNV MANGLE(GetMapAttribParameterivNV) -#define glGetMapControlPointsNV MANGLE(GetMapControlPointsNV) -#define glGetMapdv MANGLE(GetMapdv) -#define glGetMapfv MANGLE(GetMapfv) -#define glGetMapiv MANGLE(GetMapiv) -#define glGetMapParameterfvNV MANGLE(GetMapParameterfvNV) -#define glGetMapParameterivNV MANGLE(GetMapParameterivNV) -#define glGetMaterialfv MANGLE(GetMaterialfv) -#define glGetMaterialiv MANGLE(GetMaterialiv) -#define glGetMinmaxEXT MANGLE(GetMinmaxEXT) -#define glGetMinmax MANGLE(GetMinmax) -#define glGetMinmaxParameterfvEXT MANGLE(GetMinmaxParameterfvEXT) -#define glGetMinmaxParameterfv MANGLE(GetMinmaxParameterfv) -#define glGetMinmaxParameterivEXT MANGLE(GetMinmaxParameterivEXT) -#define glGetMinmaxParameteriv MANGLE(GetMinmaxParameteriv) -#define glGetMultisamplefv MANGLE(GetMultisamplefv) -#define glGetMultisamplefvNV MANGLE(GetMultisamplefvNV) -#define glGetMultiTexEnvfvEXT MANGLE(GetMultiTexEnvfvEXT) -#define glGetMultiTexEnvivEXT MANGLE(GetMultiTexEnvivEXT) -#define glGetMultiTexGendvEXT MANGLE(GetMultiTexGendvEXT) -#define glGetMultiTexGenfvEXT MANGLE(GetMultiTexGenfvEXT) -#define glGetMultiTexGenivEXT MANGLE(GetMultiTexGenivEXT) -#define glGetMultiTexImageEXT MANGLE(GetMultiTexImageEXT) -#define glGetMultiTexLevelParameterfvEXT MANGLE(GetMultiTexLevelParameterfvEXT) -#define glGetMultiTexLevelParameterivEXT MANGLE(GetMultiTexLevelParameterivEXT) -#define glGetMultiTexParameterfvEXT MANGLE(GetMultiTexParameterfvEXT) -#define glGetMultiTexParameterIivEXT MANGLE(GetMultiTexParameterIivEXT) -#define glGetMultiTexParameterIuivEXT MANGLE(GetMultiTexParameterIuivEXT) -#define glGetMultiTexParameterivEXT MANGLE(GetMultiTexParameterivEXT) -#define glGetNamedBufferParameterivEXT MANGLE(GetNamedBufferParameterivEXT) -#define glGetNamedBufferParameterui64vNV MANGLE(GetNamedBufferParameterui64vNV) -#define glGetNamedBufferPointervEXT MANGLE(GetNamedBufferPointervEXT) -#define glGetNamedBufferSubDataEXT MANGLE(GetNamedBufferSubDataEXT) -#define glGetNamedFramebufferAttachmentParameterivEXT MANGLE(GetNamedFramebufferAttachmentParameterivEXT) -#define glGetNamedProgramivEXT MANGLE(GetNamedProgramivEXT) -#define glGetNamedProgramLocalParameterdvEXT MANGLE(GetNamedProgramLocalParameterdvEXT) -#define glGetNamedProgramLocalParameterfvEXT MANGLE(GetNamedProgramLocalParameterfvEXT) -#define glGetNamedProgramLocalParameterIivEXT MANGLE(GetNamedProgramLocalParameterIivEXT) -#define glGetNamedProgramLocalParameterIuivEXT MANGLE(GetNamedProgramLocalParameterIuivEXT) -#define glGetNamedProgramStringEXT MANGLE(GetNamedProgramStringEXT) -#define glGetNamedRenderbufferParameterivEXT MANGLE(GetNamedRenderbufferParameterivEXT) -#define glGetNamedStringARB MANGLE(GetNamedStringARB) -#define glGetNamedStringivARB MANGLE(GetNamedStringivARB) -#define glGetnColorTableARB MANGLE(GetnColorTableARB) -#define glGetnCompressedTexImageARB MANGLE(GetnCompressedTexImageARB) -#define glGetnConvolutionFilterARB MANGLE(GetnConvolutionFilterARB) -#define glGetnHistogramARB MANGLE(GetnHistogramARB) -#define glGetnMapdvARB MANGLE(GetnMapdvARB) -#define glGetnMapfvARB MANGLE(GetnMapfvARB) -#define glGetnMapivARB MANGLE(GetnMapivARB) -#define glGetnMinmaxARB MANGLE(GetnMinmaxARB) -#define glGetnPixelMapfvARB MANGLE(GetnPixelMapfvARB) -#define glGetnPixelMapuivARB MANGLE(GetnPixelMapuivARB) -#define glGetnPixelMapusvARB MANGLE(GetnPixelMapusvARB) -#define glGetnPolygonStippleARB MANGLE(GetnPolygonStippleARB) -#define glGetnSeparableFilterARB MANGLE(GetnSeparableFilterARB) -#define glGetnTexImageARB MANGLE(GetnTexImageARB) -#define glGetnUniformdvARB MANGLE(GetnUniformdvARB) -#define glGetnUniformfvARB MANGLE(GetnUniformfvARB) -#define glGetnUniformivARB MANGLE(GetnUniformivARB) -#define glGetnUniformuivARB MANGLE(GetnUniformuivARB) -#define glGetObjectBufferfvATI MANGLE(GetObjectBufferfvATI) -#define glGetObjectBufferivATI MANGLE(GetObjectBufferivATI) -#define glGetObjectParameterfvARB MANGLE(GetObjectParameterfvARB) -#define glGetObjectParameterivAPPLE MANGLE(GetObjectParameterivAPPLE) -#define glGetObjectParameterivARB MANGLE(GetObjectParameterivARB) -#define glGetOcclusionQueryivNV MANGLE(GetOcclusionQueryivNV) -#define glGetOcclusionQueryuivNV MANGLE(GetOcclusionQueryuivNV) -#define glGetPerfMonitorCounterDataAMD MANGLE(GetPerfMonitorCounterDataAMD) -#define glGetPerfMonitorCounterInfoAMD MANGLE(GetPerfMonitorCounterInfoAMD) -#define glGetPerfMonitorCountersAMD MANGLE(GetPerfMonitorCountersAMD) -#define glGetPerfMonitorCounterStringAMD MANGLE(GetPerfMonitorCounterStringAMD) -#define glGetPerfMonitorGroupsAMD MANGLE(GetPerfMonitorGroupsAMD) -#define glGetPerfMonitorGroupStringAMD MANGLE(GetPerfMonitorGroupStringAMD) -#define glGetPixelMapfv MANGLE(GetPixelMapfv) -#define glGetPixelMapuiv MANGLE(GetPixelMapuiv) -#define glGetPixelMapusv MANGLE(GetPixelMapusv) -#define glGetPixelTexGenParameterfvSGIS MANGLE(GetPixelTexGenParameterfvSGIS) -#define glGetPixelTexGenParameterivSGIS MANGLE(GetPixelTexGenParameterivSGIS) -#define glGetPointerIndexedvEXT MANGLE(GetPointerIndexedvEXT) -#define glGetPointervEXT MANGLE(GetPointervEXT) -#define glGetPointerv MANGLE(GetPointerv) -#define glGetPolygonStipple MANGLE(GetPolygonStipple) -#define glGetProgramBinary MANGLE(GetProgramBinary) -#define glGetProgramEnvParameterdvARB MANGLE(GetProgramEnvParameterdvARB) -#define glGetProgramEnvParameterfvARB MANGLE(GetProgramEnvParameterfvARB) -#define glGetProgramEnvParameterIivNV MANGLE(GetProgramEnvParameterIivNV) -#define glGetProgramEnvParameterIuivNV MANGLE(GetProgramEnvParameterIuivNV) -#define glGetProgramInfoLog MANGLE(GetProgramInfoLog) -#define glGetProgramivARB MANGLE(GetProgramivARB) -#define glGetProgramiv MANGLE(GetProgramiv) -#define glGetProgramivNV MANGLE(GetProgramivNV) -#define glGetProgramLocalParameterdvARB MANGLE(GetProgramLocalParameterdvARB) -#define glGetProgramLocalParameterfvARB MANGLE(GetProgramLocalParameterfvARB) -#define glGetProgramLocalParameterIivNV MANGLE(GetProgramLocalParameterIivNV) -#define glGetProgramLocalParameterIuivNV MANGLE(GetProgramLocalParameterIuivNV) -#define glGetProgramNamedParameterdvNV MANGLE(GetProgramNamedParameterdvNV) -#define glGetProgramNamedParameterfvNV MANGLE(GetProgramNamedParameterfvNV) -#define glGetProgramParameterdvNV MANGLE(GetProgramParameterdvNV) -#define glGetProgramParameterfvNV MANGLE(GetProgramParameterfvNV) -#define glGetProgramPipelineInfoLog MANGLE(GetProgramPipelineInfoLog) -#define glGetProgramPipelineiv MANGLE(GetProgramPipelineiv) -#define glGetProgramRegisterfvMESA MANGLE(GetProgramRegisterfvMESA) -#define glGetProgramStageiv MANGLE(GetProgramStageiv) -#define glGetProgramStringARB MANGLE(GetProgramStringARB) -#define glGetProgramStringNV MANGLE(GetProgramStringNV) -#define glGetProgramSubroutineParameteruivNV MANGLE(GetProgramSubroutineParameteruivNV) -#define glGetQueryIndexediv MANGLE(GetQueryIndexediv) -#define glGetQueryivARB MANGLE(GetQueryivARB) -#define glGetQueryiv MANGLE(GetQueryiv) -#define glGetQueryObjecti64vEXT MANGLE(GetQueryObjecti64vEXT) -#define glGetQueryObjecti64v MANGLE(GetQueryObjecti64v) -#define glGetQueryObjectivARB MANGLE(GetQueryObjectivARB) -#define glGetQueryObjectiv MANGLE(GetQueryObjectiv) -#define glGetQueryObjectui64vEXT MANGLE(GetQueryObjectui64vEXT) -#define glGetQueryObjectui64v MANGLE(GetQueryObjectui64v) -#define glGetQueryObjectuivARB MANGLE(GetQueryObjectuivARB) -#define glGetQueryObjectuiv MANGLE(GetQueryObjectuiv) -#define glGetRenderbufferParameterivEXT MANGLE(GetRenderbufferParameterivEXT) -#define glGetRenderbufferParameteriv MANGLE(GetRenderbufferParameteriv) -#define glGetSamplerParameterfv MANGLE(GetSamplerParameterfv) -#define glGetSamplerParameterIiv MANGLE(GetSamplerParameterIiv) -#define glGetSamplerParameterIuiv MANGLE(GetSamplerParameterIuiv) -#define glGetSamplerParameteriv MANGLE(GetSamplerParameteriv) -#define glGetSeparableFilterEXT MANGLE(GetSeparableFilterEXT) -#define glGetSeparableFilter MANGLE(GetSeparableFilter) -#define glGetShaderInfoLog MANGLE(GetShaderInfoLog) -#define glGetShaderiv MANGLE(GetShaderiv) -#define glGetShaderPrecisionFormat MANGLE(GetShaderPrecisionFormat) -#define glGetShaderSourceARB MANGLE(GetShaderSourceARB) -#define glGetShaderSource MANGLE(GetShaderSource) -#define glGetSharpenTexFuncSGIS MANGLE(GetSharpenTexFuncSGIS) -#define glGetStringi MANGLE(GetStringi) -#define glGetString MANGLE(GetString) -#define glGetSubroutineIndex MANGLE(GetSubroutineIndex) -#define glGetSubroutineUniformLocation MANGLE(GetSubroutineUniformLocation) -#define glGetSynciv MANGLE(GetSynciv) -#define glGetTexBumpParameterfvATI MANGLE(GetTexBumpParameterfvATI) -#define glGetTexBumpParameterivATI MANGLE(GetTexBumpParameterivATI) -#define glGetTexEnvfv MANGLE(GetTexEnvfv) -#define glGetTexEnviv MANGLE(GetTexEnviv) -#define glGetTexFilterFuncSGIS MANGLE(GetTexFilterFuncSGIS) -#define glGetTexGendv MANGLE(GetTexGendv) -#define glGetTexGenfv MANGLE(GetTexGenfv) -#define glGetTexGeniv MANGLE(GetTexGeniv) -#define glGetTexImage MANGLE(GetTexImage) -#define glGetTexLevelParameterfv MANGLE(GetTexLevelParameterfv) -#define glGetTexLevelParameteriv MANGLE(GetTexLevelParameteriv) -#define glGetTexParameterfv MANGLE(GetTexParameterfv) -#define glGetTexParameterIivEXT MANGLE(GetTexParameterIivEXT) -#define glGetTexParameterIiv MANGLE(GetTexParameterIiv) -#define glGetTexParameterIuivEXT MANGLE(GetTexParameterIuivEXT) -#define glGetTexParameterIuiv MANGLE(GetTexParameterIuiv) -#define glGetTexParameteriv MANGLE(GetTexParameteriv) -#define glGetTexParameterPointervAPPLE MANGLE(GetTexParameterPointervAPPLE) -#define glGetTextureImageEXT MANGLE(GetTextureImageEXT) -#define glGetTextureLevelParameterfvEXT MANGLE(GetTextureLevelParameterfvEXT) -#define glGetTextureLevelParameterivEXT MANGLE(GetTextureLevelParameterivEXT) -#define glGetTextureParameterfvEXT MANGLE(GetTextureParameterfvEXT) -#define glGetTextureParameterIivEXT MANGLE(GetTextureParameterIivEXT) -#define glGetTextureParameterIuivEXT MANGLE(GetTextureParameterIuivEXT) -#define glGetTextureParameterivEXT MANGLE(GetTextureParameterivEXT) -#define glGetTrackMatrixivNV MANGLE(GetTrackMatrixivNV) -#define glGetTransformFeedbackVaryingEXT MANGLE(GetTransformFeedbackVaryingEXT) -#define glGetTransformFeedbackVarying MANGLE(GetTransformFeedbackVarying) -#define glGetTransformFeedbackVaryingNV MANGLE(GetTransformFeedbackVaryingNV) -#define glGetUniformBlockIndex MANGLE(GetUniformBlockIndex) -#define glGetUniformBufferSizeEXT MANGLE(GetUniformBufferSizeEXT) -#define glGetUniformdv MANGLE(GetUniformdv) -#define glGetUniformfvARB MANGLE(GetUniformfvARB) -#define glGetUniformfv MANGLE(GetUniformfv) -#define glGetUniformi64vNV MANGLE(GetUniformi64vNV) -#define glGetUniformIndices MANGLE(GetUniformIndices) -#define glGetUniformivARB MANGLE(GetUniformivARB) -#define glGetUniformiv MANGLE(GetUniformiv) -#define glGetUniformLocationARB MANGLE(GetUniformLocationARB) -#define glGetUniformLocation MANGLE(GetUniformLocation) -#define glGetUniformOffsetEXT MANGLE(GetUniformOffsetEXT) -#define glGetUniformSubroutineuiv MANGLE(GetUniformSubroutineuiv) -#define glGetUniformui64vNV MANGLE(GetUniformui64vNV) -#define glGetUniformuivEXT MANGLE(GetUniformuivEXT) -#define glGetUniformuiv MANGLE(GetUniformuiv) -#define glGetVariantArrayObjectfvATI MANGLE(GetVariantArrayObjectfvATI) -#define glGetVariantArrayObjectivATI MANGLE(GetVariantArrayObjectivATI) -#define glGetVariantBooleanvEXT MANGLE(GetVariantBooleanvEXT) -#define glGetVariantFloatvEXT MANGLE(GetVariantFloatvEXT) -#define glGetVariantIntegervEXT MANGLE(GetVariantIntegervEXT) -#define glGetVariantPointervEXT MANGLE(GetVariantPointervEXT) -#define glGetVaryingLocationNV MANGLE(GetVaryingLocationNV) -#define glGetVertexAttribArrayObjectfvATI MANGLE(GetVertexAttribArrayObjectfvATI) -#define glGetVertexAttribArrayObjectivATI MANGLE(GetVertexAttribArrayObjectivATI) -#define glGetVertexAttribdvARB MANGLE(GetVertexAttribdvARB) -#define glGetVertexAttribdv MANGLE(GetVertexAttribdv) -#define glGetVertexAttribdvNV MANGLE(GetVertexAttribdvNV) -#define glGetVertexAttribfvARB MANGLE(GetVertexAttribfvARB) -#define glGetVertexAttribfv MANGLE(GetVertexAttribfv) -#define glGetVertexAttribfvNV MANGLE(GetVertexAttribfvNV) -#define glGetVertexAttribIivEXT MANGLE(GetVertexAttribIivEXT) -#define glGetVertexAttribIiv MANGLE(GetVertexAttribIiv) -#define glGetVertexAttribIuivEXT MANGLE(GetVertexAttribIuivEXT) -#define glGetVertexAttribIuiv MANGLE(GetVertexAttribIuiv) -#define glGetVertexAttribivARB MANGLE(GetVertexAttribivARB) -#define glGetVertexAttribiv MANGLE(GetVertexAttribiv) -#define glGetVertexAttribivNV MANGLE(GetVertexAttribivNV) -#define glGetVertexAttribLdvEXT MANGLE(GetVertexAttribLdvEXT) -#define glGetVertexAttribLdv MANGLE(GetVertexAttribLdv) -#define glGetVertexAttribLi64vNV MANGLE(GetVertexAttribLi64vNV) -#define glGetVertexAttribLui64vNV MANGLE(GetVertexAttribLui64vNV) -#define glGetVertexAttribPointervARB MANGLE(GetVertexAttribPointervARB) -#define glGetVertexAttribPointerv MANGLE(GetVertexAttribPointerv) -#define glGetVertexAttribPointervNV MANGLE(GetVertexAttribPointervNV) -#define glGetVideoCaptureivNV MANGLE(GetVideoCaptureivNV) -#define glGetVideoCaptureStreamdvNV MANGLE(GetVideoCaptureStreamdvNV) -#define glGetVideoCaptureStreamfvNV MANGLE(GetVideoCaptureStreamfvNV) -#define glGetVideoCaptureStreamivNV MANGLE(GetVideoCaptureStreamivNV) -#define glGetVideoi64vNV MANGLE(GetVideoi64vNV) -#define glGetVideoivNV MANGLE(GetVideoivNV) -#define glGetVideoui64vNV MANGLE(GetVideoui64vNV) -#define glGetVideouivNV MANGLE(GetVideouivNV) -#define glGlobalAlphaFactorbSUN MANGLE(GlobalAlphaFactorbSUN) -#define glGlobalAlphaFactordSUN MANGLE(GlobalAlphaFactordSUN) -#define glGlobalAlphaFactorfSUN MANGLE(GlobalAlphaFactorfSUN) -#define glGlobalAlphaFactoriSUN MANGLE(GlobalAlphaFactoriSUN) -#define glGlobalAlphaFactorsSUN MANGLE(GlobalAlphaFactorsSUN) -#define glGlobalAlphaFactorubSUN MANGLE(GlobalAlphaFactorubSUN) -#define glGlobalAlphaFactoruiSUN MANGLE(GlobalAlphaFactoruiSUN) -#define glGlobalAlphaFactorusSUN MANGLE(GlobalAlphaFactorusSUN) -#define glHint MANGLE(Hint) -#define glHintPGI MANGLE(HintPGI) -#define glHistogramEXT MANGLE(HistogramEXT) -#define glHistogram MANGLE(Histogram) -#define glIglooInterfaceSGIX MANGLE(IglooInterfaceSGIX) -#define glImageTransformParameterfHP MANGLE(ImageTransformParameterfHP) -#define glImageTransformParameterfvHP MANGLE(ImageTransformParameterfvHP) -#define glImageTransformParameteriHP MANGLE(ImageTransformParameteriHP) -#define glImageTransformParameterivHP MANGLE(ImageTransformParameterivHP) -#define glIndexd MANGLE(Indexd) -#define glIndexdv MANGLE(Indexdv) -#define glIndexf MANGLE(Indexf) -#define glIndexFormatNV MANGLE(IndexFormatNV) -#define glIndexFuncEXT MANGLE(IndexFuncEXT) -#define glIndexfv MANGLE(Indexfv) -#define glIndexi MANGLE(Indexi) -#define glIndexiv MANGLE(Indexiv) -#define glIndexMask MANGLE(IndexMask) -#define glIndexMaterialEXT MANGLE(IndexMaterialEXT) -#define glIndexPointerEXT MANGLE(IndexPointerEXT) -#define glIndexPointerListIBM MANGLE(IndexPointerListIBM) -#define glIndexPointer MANGLE(IndexPointer) -#define glIndexs MANGLE(Indexs) -#define glIndexsv MANGLE(Indexsv) -#define glIndexub MANGLE(Indexub) -#define glIndexubv MANGLE(Indexubv) -#define glInitNames MANGLE(InitNames) -#define glInsertComponentEXT MANGLE(InsertComponentEXT) -#define glInstrumentsBufferSGIX MANGLE(InstrumentsBufferSGIX) -#define glInterleavedArrays MANGLE(InterleavedArrays) -#define glIsAsyncMarkerSGIX MANGLE(IsAsyncMarkerSGIX) -#define glIsBufferARB MANGLE(IsBufferARB) -#define glIsBuffer MANGLE(IsBuffer) -#define glIsBufferResidentNV MANGLE(IsBufferResidentNV) -#define glIsEnabledi MANGLE(IsEnabledi) -#define glIsEnabledIndexedEXT MANGLE(IsEnabledIndexedEXT) -#define glIsEnabled MANGLE(IsEnabled) -#define glIsFenceAPPLE MANGLE(IsFenceAPPLE) -#define glIsFenceNV MANGLE(IsFenceNV) -#define glIsFramebufferEXT MANGLE(IsFramebufferEXT) -#define glIsFramebuffer MANGLE(IsFramebuffer) -#define glIsList MANGLE(IsList) -#define glIsNameAMD MANGLE(IsNameAMD) -#define glIsNamedBufferResidentNV MANGLE(IsNamedBufferResidentNV) -#define glIsNamedStringARB MANGLE(IsNamedStringARB) -#define glIsObjectBufferATI MANGLE(IsObjectBufferATI) -#define glIsOcclusionQueryNV MANGLE(IsOcclusionQueryNV) -#define glIsProgramARB MANGLE(IsProgramARB) -#define glIsProgram MANGLE(IsProgram) -#define glIsProgramNV MANGLE(IsProgramNV) -#define glIsProgramPipeline MANGLE(IsProgramPipeline) -#define glIsQueryARB MANGLE(IsQueryARB) -#define glIsQuery MANGLE(IsQuery) -#define glIsRenderbufferEXT MANGLE(IsRenderbufferEXT) -#define glIsRenderbuffer MANGLE(IsRenderbuffer) -#define glIsSampler MANGLE(IsSampler) -#define glIsShader MANGLE(IsShader) -#define glIsSync MANGLE(IsSync) -#define glIsTextureEXT MANGLE(IsTextureEXT) -#define glIsTexture MANGLE(IsTexture) -#define glIsTransformFeedback MANGLE(IsTransformFeedback) -#define glIsTransformFeedbackNV MANGLE(IsTransformFeedbackNV) -#define glIsVariantEnabledEXT MANGLE(IsVariantEnabledEXT) -#define glIsVertexArrayAPPLE MANGLE(IsVertexArrayAPPLE) -#define glIsVertexArray MANGLE(IsVertexArray) -#define glIsVertexAttribEnabledAPPLE MANGLE(IsVertexAttribEnabledAPPLE) -#define glLightEnviSGIX MANGLE(LightEnviSGIX) -#define glLightf MANGLE(Lightf) -#define glLightfv MANGLE(Lightfv) -#define glLighti MANGLE(Lighti) -#define glLightiv MANGLE(Lightiv) -#define glLightModelf MANGLE(LightModelf) -#define glLightModelfv MANGLE(LightModelfv) -#define glLightModeli MANGLE(LightModeli) -#define glLightModeliv MANGLE(LightModeliv) -#define glLineStipple MANGLE(LineStipple) -#define glLineWidth MANGLE(LineWidth) -#define glLinkProgramARB MANGLE(LinkProgramARB) -#define glLinkProgram MANGLE(LinkProgram) -#define glListBase MANGLE(ListBase) -#define glListParameterfSGIX MANGLE(ListParameterfSGIX) -#define glListParameterfvSGIX MANGLE(ListParameterfvSGIX) -#define glListParameteriSGIX MANGLE(ListParameteriSGIX) -#define glListParameterivSGIX MANGLE(ListParameterivSGIX) -#define glLoadIdentityDeformationMapSGIX MANGLE(LoadIdentityDeformationMapSGIX) -#define glLoadIdentity MANGLE(LoadIdentity) -#define glLoadMatrixd MANGLE(LoadMatrixd) -#define glLoadMatrixf MANGLE(LoadMatrixf) -#define glLoadName MANGLE(LoadName) -#define glLoadProgramNV MANGLE(LoadProgramNV) -#define glLoadTransposeMatrixdARB MANGLE(LoadTransposeMatrixdARB) -#define glLoadTransposeMatrixd MANGLE(LoadTransposeMatrixd) -#define glLoadTransposeMatrixfARB MANGLE(LoadTransposeMatrixfARB) -#define glLoadTransposeMatrixf MANGLE(LoadTransposeMatrixf) -#define glLockArraysEXT MANGLE(LockArraysEXT) -#define glLogicOp MANGLE(LogicOp) -#define glMakeBufferNonResidentNV MANGLE(MakeBufferNonResidentNV) -#define glMakeBufferResidentNV MANGLE(MakeBufferResidentNV) -#define glMakeNamedBufferNonResidentNV MANGLE(MakeNamedBufferNonResidentNV) -#define glMakeNamedBufferResidentNV MANGLE(MakeNamedBufferResidentNV) -#define glMap1d MANGLE(Map1d) -#define glMap1f MANGLE(Map1f) -#define glMap2d MANGLE(Map2d) -#define glMap2f MANGLE(Map2f) -#define glMapBufferARB MANGLE(MapBufferARB) -#define glMapBuffer MANGLE(MapBuffer) -#define glMapBufferRange MANGLE(MapBufferRange) -#define glMapControlPointsNV MANGLE(MapControlPointsNV) -#define glMapGrid1d MANGLE(MapGrid1d) -#define glMapGrid1f MANGLE(MapGrid1f) -#define glMapGrid2d MANGLE(MapGrid2d) -#define glMapGrid2f MANGLE(MapGrid2f) -#define glMapNamedBufferEXT MANGLE(MapNamedBufferEXT) -#define glMapNamedBufferRangeEXT MANGLE(MapNamedBufferRangeEXT) -#define glMapObjectBufferATI MANGLE(MapObjectBufferATI) -#define glMapParameterfvNV MANGLE(MapParameterfvNV) -#define glMapParameterivNV MANGLE(MapParameterivNV) -#define glMapVertexAttrib1dAPPLE MANGLE(MapVertexAttrib1dAPPLE) -#define glMapVertexAttrib1fAPPLE MANGLE(MapVertexAttrib1fAPPLE) -#define glMapVertexAttrib2dAPPLE MANGLE(MapVertexAttrib2dAPPLE) -#define glMapVertexAttrib2fAPPLE MANGLE(MapVertexAttrib2fAPPLE) -#define glMaterialf MANGLE(Materialf) -#define glMaterialfv MANGLE(Materialfv) -#define glMateriali MANGLE(Materiali) -#define glMaterialiv MANGLE(Materialiv) -#define glMatrixFrustumEXT MANGLE(MatrixFrustumEXT) -#define glMatrixIndexPointerARB MANGLE(MatrixIndexPointerARB) -#define glMatrixIndexubvARB MANGLE(MatrixIndexubvARB) -#define glMatrixIndexuivARB MANGLE(MatrixIndexuivARB) -#define glMatrixIndexusvARB MANGLE(MatrixIndexusvARB) -#define glMatrixLoaddEXT MANGLE(MatrixLoaddEXT) -#define glMatrixLoadfEXT MANGLE(MatrixLoadfEXT) -#define glMatrixLoadIdentityEXT MANGLE(MatrixLoadIdentityEXT) -#define glMatrixLoadTransposedEXT MANGLE(MatrixLoadTransposedEXT) -#define glMatrixLoadTransposefEXT MANGLE(MatrixLoadTransposefEXT) -#define glMatrixMode MANGLE(MatrixMode) -#define glMatrixMultdEXT MANGLE(MatrixMultdEXT) -#define glMatrixMultfEXT MANGLE(MatrixMultfEXT) -#define glMatrixMultTransposedEXT MANGLE(MatrixMultTransposedEXT) -#define glMatrixMultTransposefEXT MANGLE(MatrixMultTransposefEXT) -#define glMatrixOrthoEXT MANGLE(MatrixOrthoEXT) -#define glMatrixPopEXT MANGLE(MatrixPopEXT) -#define glMatrixPushEXT MANGLE(MatrixPushEXT) -#define glMatrixRotatedEXT MANGLE(MatrixRotatedEXT) -#define glMatrixRotatefEXT MANGLE(MatrixRotatefEXT) -#define glMatrixScaledEXT MANGLE(MatrixScaledEXT) -#define glMatrixScalefEXT MANGLE(MatrixScalefEXT) -#define glMatrixTranslatedEXT MANGLE(MatrixTranslatedEXT) -#define glMatrixTranslatefEXT MANGLE(MatrixTranslatefEXT) -#define glMemoryBarrierEXT MANGLE(MemoryBarrierEXT) -#define glMinmaxEXT MANGLE(MinmaxEXT) -#define glMinmax MANGLE(Minmax) -#define glMinSampleShadingARB MANGLE(MinSampleShadingARB) -#define glMinSampleShading MANGLE(MinSampleShading) -#define glMultiDrawArraysEXT MANGLE(MultiDrawArraysEXT) -#define glMultiDrawArrays MANGLE(MultiDrawArrays) -#define glMultiDrawElementArrayAPPLE MANGLE(MultiDrawElementArrayAPPLE) -#define glMultiDrawElementsBaseVertex MANGLE(MultiDrawElementsBaseVertex) -#define glMultiDrawElementsEXT MANGLE(MultiDrawElementsEXT) -#define glMultiDrawElements MANGLE(MultiDrawElements) -#define glMultiDrawRangeElementArrayAPPLE MANGLE(MultiDrawRangeElementArrayAPPLE) -#define glMultiModeDrawArraysIBM MANGLE(MultiModeDrawArraysIBM) -#define glMultiModeDrawElementsIBM MANGLE(MultiModeDrawElementsIBM) -#define glMultiTexBufferEXT MANGLE(MultiTexBufferEXT) -#define glMultiTexCoord1dARB MANGLE(MultiTexCoord1dARB) -#define glMultiTexCoord1d MANGLE(MultiTexCoord1d) -#define glMultiTexCoord1dvARB MANGLE(MultiTexCoord1dvARB) -#define glMultiTexCoord1dv MANGLE(MultiTexCoord1dv) -#define glMultiTexCoord1fARB MANGLE(MultiTexCoord1fARB) -#define glMultiTexCoord1f MANGLE(MultiTexCoord1f) -#define glMultiTexCoord1fvARB MANGLE(MultiTexCoord1fvARB) -#define glMultiTexCoord1fv MANGLE(MultiTexCoord1fv) -#define glMultiTexCoord1hNV MANGLE(MultiTexCoord1hNV) -#define glMultiTexCoord1hvNV MANGLE(MultiTexCoord1hvNV) -#define glMultiTexCoord1iARB MANGLE(MultiTexCoord1iARB) -#define glMultiTexCoord1i MANGLE(MultiTexCoord1i) -#define glMultiTexCoord1ivARB MANGLE(MultiTexCoord1ivARB) -#define glMultiTexCoord1iv MANGLE(MultiTexCoord1iv) -#define glMultiTexCoord1sARB MANGLE(MultiTexCoord1sARB) -#define glMultiTexCoord1s MANGLE(MultiTexCoord1s) -#define glMultiTexCoord1svARB MANGLE(MultiTexCoord1svARB) -#define glMultiTexCoord1sv MANGLE(MultiTexCoord1sv) -#define glMultiTexCoord2dARB MANGLE(MultiTexCoord2dARB) -#define glMultiTexCoord2d MANGLE(MultiTexCoord2d) -#define glMultiTexCoord2dvARB MANGLE(MultiTexCoord2dvARB) -#define glMultiTexCoord2dv MANGLE(MultiTexCoord2dv) -#define glMultiTexCoord2fARB MANGLE(MultiTexCoord2fARB) -#define glMultiTexCoord2f MANGLE(MultiTexCoord2f) -#define glMultiTexCoord2fvARB MANGLE(MultiTexCoord2fvARB) -#define glMultiTexCoord2fv MANGLE(MultiTexCoord2fv) -#define glMultiTexCoord2hNV MANGLE(MultiTexCoord2hNV) -#define glMultiTexCoord2hvNV MANGLE(MultiTexCoord2hvNV) -#define glMultiTexCoord2iARB MANGLE(MultiTexCoord2iARB) -#define glMultiTexCoord2i MANGLE(MultiTexCoord2i) -#define glMultiTexCoord2ivARB MANGLE(MultiTexCoord2ivARB) -#define glMultiTexCoord2iv MANGLE(MultiTexCoord2iv) -#define glMultiTexCoord2sARB MANGLE(MultiTexCoord2sARB) -#define glMultiTexCoord2s MANGLE(MultiTexCoord2s) -#define glMultiTexCoord2svARB MANGLE(MultiTexCoord2svARB) -#define glMultiTexCoord2sv MANGLE(MultiTexCoord2sv) -#define glMultiTexCoord3dARB MANGLE(MultiTexCoord3dARB) -#define glMultiTexCoord3d MANGLE(MultiTexCoord3d) -#define glMultiTexCoord3dvARB MANGLE(MultiTexCoord3dvARB) -#define glMultiTexCoord3dv MANGLE(MultiTexCoord3dv) -#define glMultiTexCoord3fARB MANGLE(MultiTexCoord3fARB) -#define glMultiTexCoord3f MANGLE(MultiTexCoord3f) -#define glMultiTexCoord3fvARB MANGLE(MultiTexCoord3fvARB) -#define glMultiTexCoord3fv MANGLE(MultiTexCoord3fv) -#define glMultiTexCoord3hNV MANGLE(MultiTexCoord3hNV) -#define glMultiTexCoord3hvNV MANGLE(MultiTexCoord3hvNV) -#define glMultiTexCoord3iARB MANGLE(MultiTexCoord3iARB) -#define glMultiTexCoord3i MANGLE(MultiTexCoord3i) -#define glMultiTexCoord3ivARB MANGLE(MultiTexCoord3ivARB) -#define glMultiTexCoord3iv MANGLE(MultiTexCoord3iv) -#define glMultiTexCoord3sARB MANGLE(MultiTexCoord3sARB) -#define glMultiTexCoord3s MANGLE(MultiTexCoord3s) -#define glMultiTexCoord3svARB MANGLE(MultiTexCoord3svARB) -#define glMultiTexCoord3sv MANGLE(MultiTexCoord3sv) -#define glMultiTexCoord4dARB MANGLE(MultiTexCoord4dARB) -#define glMultiTexCoord4d MANGLE(MultiTexCoord4d) -#define glMultiTexCoord4dvARB MANGLE(MultiTexCoord4dvARB) -#define glMultiTexCoord4dv MANGLE(MultiTexCoord4dv) -#define glMultiTexCoord4fARB MANGLE(MultiTexCoord4fARB) -#define glMultiTexCoord4f MANGLE(MultiTexCoord4f) -#define glMultiTexCoord4fvARB MANGLE(MultiTexCoord4fvARB) -#define glMultiTexCoord4fv MANGLE(MultiTexCoord4fv) -#define glMultiTexCoord4hNV MANGLE(MultiTexCoord4hNV) -#define glMultiTexCoord4hvNV MANGLE(MultiTexCoord4hvNV) -#define glMultiTexCoord4iARB MANGLE(MultiTexCoord4iARB) -#define glMultiTexCoord4i MANGLE(MultiTexCoord4i) -#define glMultiTexCoord4ivARB MANGLE(MultiTexCoord4ivARB) -#define glMultiTexCoord4iv MANGLE(MultiTexCoord4iv) -#define glMultiTexCoord4sARB MANGLE(MultiTexCoord4sARB) -#define glMultiTexCoord4s MANGLE(MultiTexCoord4s) -#define glMultiTexCoord4svARB MANGLE(MultiTexCoord4svARB) -#define glMultiTexCoord4sv MANGLE(MultiTexCoord4sv) -#define glMultiTexCoordP1ui MANGLE(MultiTexCoordP1ui) -#define glMultiTexCoordP1uiv MANGLE(MultiTexCoordP1uiv) -#define glMultiTexCoordP2ui MANGLE(MultiTexCoordP2ui) -#define glMultiTexCoordP2uiv MANGLE(MultiTexCoordP2uiv) -#define glMultiTexCoordP3ui MANGLE(MultiTexCoordP3ui) -#define glMultiTexCoordP3uiv MANGLE(MultiTexCoordP3uiv) -#define glMultiTexCoordP4ui MANGLE(MultiTexCoordP4ui) -#define glMultiTexCoordP4uiv MANGLE(MultiTexCoordP4uiv) -#define glMultiTexCoordPointerEXT MANGLE(MultiTexCoordPointerEXT) -#define glMultiTexEnvfEXT MANGLE(MultiTexEnvfEXT) -#define glMultiTexEnvfvEXT MANGLE(MultiTexEnvfvEXT) -#define glMultiTexEnviEXT MANGLE(MultiTexEnviEXT) -#define glMultiTexEnvivEXT MANGLE(MultiTexEnvivEXT) -#define glMultiTexGendEXT MANGLE(MultiTexGendEXT) -#define glMultiTexGendvEXT MANGLE(MultiTexGendvEXT) -#define glMultiTexGenfEXT MANGLE(MultiTexGenfEXT) -#define glMultiTexGenfvEXT MANGLE(MultiTexGenfvEXT) -#define glMultiTexGeniEXT MANGLE(MultiTexGeniEXT) -#define glMultiTexGenivEXT MANGLE(MultiTexGenivEXT) -#define glMultiTexImage1DEXT MANGLE(MultiTexImage1DEXT) -#define glMultiTexImage2DEXT MANGLE(MultiTexImage2DEXT) -#define glMultiTexImage3DEXT MANGLE(MultiTexImage3DEXT) -#define glMultiTexParameterfEXT MANGLE(MultiTexParameterfEXT) -#define glMultiTexParameterfvEXT MANGLE(MultiTexParameterfvEXT) -#define glMultiTexParameteriEXT MANGLE(MultiTexParameteriEXT) -#define glMultiTexParameterIivEXT MANGLE(MultiTexParameterIivEXT) -#define glMultiTexParameterIuivEXT MANGLE(MultiTexParameterIuivEXT) -#define glMultiTexParameterivEXT MANGLE(MultiTexParameterivEXT) -#define glMultiTexRenderbufferEXT MANGLE(MultiTexRenderbufferEXT) -#define glMultiTexSubImage1DEXT MANGLE(MultiTexSubImage1DEXT) -#define glMultiTexSubImage2DEXT MANGLE(MultiTexSubImage2DEXT) -#define glMultiTexSubImage3DEXT MANGLE(MultiTexSubImage3DEXT) -#define glMultMatrixd MANGLE(MultMatrixd) -#define glMultMatrixf MANGLE(MultMatrixf) -#define glMultTransposeMatrixdARB MANGLE(MultTransposeMatrixdARB) -#define glMultTransposeMatrixd MANGLE(MultTransposeMatrixd) -#define glMultTransposeMatrixfARB MANGLE(MultTransposeMatrixfARB) -#define glMultTransposeMatrixf MANGLE(MultTransposeMatrixf) -#define glNamedBufferDataEXT MANGLE(NamedBufferDataEXT) -#define glNamedBufferSubDataEXT MANGLE(NamedBufferSubDataEXT) -#define glNamedCopyBufferSubDataEXT MANGLE(NamedCopyBufferSubDataEXT) -#define glNamedFramebufferRenderbufferEXT MANGLE(NamedFramebufferRenderbufferEXT) -#define glNamedFramebufferTexture1DEXT MANGLE(NamedFramebufferTexture1DEXT) -#define glNamedFramebufferTexture2DEXT MANGLE(NamedFramebufferTexture2DEXT) -#define glNamedFramebufferTexture3DEXT MANGLE(NamedFramebufferTexture3DEXT) -#define glNamedFramebufferTextureEXT MANGLE(NamedFramebufferTextureEXT) -#define glNamedFramebufferTextureFaceEXT MANGLE(NamedFramebufferTextureFaceEXT) -#define glNamedFramebufferTextureLayerEXT MANGLE(NamedFramebufferTextureLayerEXT) -#define glNamedProgramLocalParameter4dEXT MANGLE(NamedProgramLocalParameter4dEXT) -#define glNamedProgramLocalParameter4dvEXT MANGLE(NamedProgramLocalParameter4dvEXT) -#define glNamedProgramLocalParameter4fEXT MANGLE(NamedProgramLocalParameter4fEXT) -#define glNamedProgramLocalParameter4fvEXT MANGLE(NamedProgramLocalParameter4fvEXT) -#define glNamedProgramLocalParameterI4iEXT MANGLE(NamedProgramLocalParameterI4iEXT) -#define glNamedProgramLocalParameterI4ivEXT MANGLE(NamedProgramLocalParameterI4ivEXT) -#define glNamedProgramLocalParameterI4uiEXT MANGLE(NamedProgramLocalParameterI4uiEXT) -#define glNamedProgramLocalParameterI4uivEXT MANGLE(NamedProgramLocalParameterI4uivEXT) -#define glNamedProgramLocalParameters4fvEXT MANGLE(NamedProgramLocalParameters4fvEXT) -#define glNamedProgramLocalParametersI4ivEXT MANGLE(NamedProgramLocalParametersI4ivEXT) -#define glNamedProgramLocalParametersI4uivEXT MANGLE(NamedProgramLocalParametersI4uivEXT) -#define glNamedProgramStringEXT MANGLE(NamedProgramStringEXT) -#define glNamedRenderbufferStorageEXT MANGLE(NamedRenderbufferStorageEXT) -#define glNamedRenderbufferStorageMultisampleCoverageEXT MANGLE(NamedRenderbufferStorageMultisampleCoverageEXT) -#define glNamedRenderbufferStorageMultisampleEXT MANGLE(NamedRenderbufferStorageMultisampleEXT) -#define glNamedStringARB MANGLE(NamedStringARB) -#define glNewList MANGLE(NewList) -#define glNewObjectBufferATI MANGLE(NewObjectBufferATI) -#define glNormal3b MANGLE(Normal3b) -#define glNormal3bv MANGLE(Normal3bv) -#define glNormal3d MANGLE(Normal3d) -#define glNormal3dv MANGLE(Normal3dv) -#define glNormal3f MANGLE(Normal3f) -#define glNormal3fVertex3fSUN MANGLE(Normal3fVertex3fSUN) -#define glNormal3fVertex3fvSUN MANGLE(Normal3fVertex3fvSUN) -#define glNormal3fv MANGLE(Normal3fv) -#define glNormal3hNV MANGLE(Normal3hNV) -#define glNormal3hvNV MANGLE(Normal3hvNV) -#define glNormal3i MANGLE(Normal3i) -#define glNormal3iv MANGLE(Normal3iv) -#define glNormal3s MANGLE(Normal3s) -#define glNormal3sv MANGLE(Normal3sv) -#define glNormalFormatNV MANGLE(NormalFormatNV) -#define glNormalP3ui MANGLE(NormalP3ui) -#define glNormalP3uiv MANGLE(NormalP3uiv) -#define glNormalPointerEXT MANGLE(NormalPointerEXT) -#define glNormalPointerListIBM MANGLE(NormalPointerListIBM) -#define glNormalPointer MANGLE(NormalPointer) -#define glNormalPointervINTEL MANGLE(NormalPointervINTEL) -#define glNormalStream3bATI MANGLE(NormalStream3bATI) -#define glNormalStream3bvATI MANGLE(NormalStream3bvATI) -#define glNormalStream3dATI MANGLE(NormalStream3dATI) -#define glNormalStream3dvATI MANGLE(NormalStream3dvATI) -#define glNormalStream3fATI MANGLE(NormalStream3fATI) -#define glNormalStream3fvATI MANGLE(NormalStream3fvATI) -#define glNormalStream3iATI MANGLE(NormalStream3iATI) -#define glNormalStream3ivATI MANGLE(NormalStream3ivATI) -#define glNormalStream3sATI MANGLE(NormalStream3sATI) -#define glNormalStream3svATI MANGLE(NormalStream3svATI) -#define glObjectPurgeableAPPLE MANGLE(ObjectPurgeableAPPLE) -#define glObjectUnpurgeableAPPLE MANGLE(ObjectUnpurgeableAPPLE) -#define glOrtho MANGLE(Ortho) -#define glPassTexCoordATI MANGLE(PassTexCoordATI) -#define glPassThrough MANGLE(PassThrough) -#define glPatchParameterfv MANGLE(PatchParameterfv) -#define glPatchParameteri MANGLE(PatchParameteri) -#define glPauseTransformFeedback MANGLE(PauseTransformFeedback) -#define glPauseTransformFeedbackNV MANGLE(PauseTransformFeedbackNV) -#define glPixelDataRangeNV MANGLE(PixelDataRangeNV) -#define glPixelMapfv MANGLE(PixelMapfv) -#define glPixelMapuiv MANGLE(PixelMapuiv) -#define glPixelMapusv MANGLE(PixelMapusv) -#define glPixelStoref MANGLE(PixelStoref) -#define glPixelStorei MANGLE(PixelStorei) -#define glPixelTexGenParameterfSGIS MANGLE(PixelTexGenParameterfSGIS) -#define glPixelTexGenParameterfvSGIS MANGLE(PixelTexGenParameterfvSGIS) -#define glPixelTexGenParameteriSGIS MANGLE(PixelTexGenParameteriSGIS) -#define glPixelTexGenParameterivSGIS MANGLE(PixelTexGenParameterivSGIS) -#define glPixelTexGenSGIX MANGLE(PixelTexGenSGIX) -#define glPixelTransferf MANGLE(PixelTransferf) -#define glPixelTransferi MANGLE(PixelTransferi) -#define glPixelTransformParameterfEXT MANGLE(PixelTransformParameterfEXT) -#define glPixelTransformParameterfvEXT MANGLE(PixelTransformParameterfvEXT) -#define glPixelTransformParameteriEXT MANGLE(PixelTransformParameteriEXT) -#define glPixelTransformParameterivEXT MANGLE(PixelTransformParameterivEXT) -#define glPixelZoom MANGLE(PixelZoom) -#define glPNTrianglesfATI MANGLE(PNTrianglesfATI) -#define glPNTrianglesiATI MANGLE(PNTrianglesiATI) -#define glPointParameterfARB MANGLE(PointParameterfARB) -#define glPointParameterfEXT MANGLE(PointParameterfEXT) -#define glPointParameterf MANGLE(PointParameterf) -#define glPointParameterfSGIS MANGLE(PointParameterfSGIS) -#define glPointParameterfvARB MANGLE(PointParameterfvARB) -#define glPointParameterfvEXT MANGLE(PointParameterfvEXT) -#define glPointParameterfv MANGLE(PointParameterfv) -#define glPointParameterfvSGIS MANGLE(PointParameterfvSGIS) -#define glPointParameteri MANGLE(PointParameteri) -#define glPointParameteriNV MANGLE(PointParameteriNV) -#define glPointParameteriv MANGLE(PointParameteriv) -#define glPointParameterivNV MANGLE(PointParameterivNV) -#define glPointSize MANGLE(PointSize) -#define glPollAsyncSGIX MANGLE(PollAsyncSGIX) -#define glPollInstrumentsSGIX MANGLE(PollInstrumentsSGIX) -#define glPolygonMode MANGLE(PolygonMode) -#define glPolygonOffsetEXT MANGLE(PolygonOffsetEXT) -#define glPolygonOffset MANGLE(PolygonOffset) -#define glPolygonStipple MANGLE(PolygonStipple) -#define glPopAttrib MANGLE(PopAttrib) -#define glPopClientAttrib MANGLE(PopClientAttrib) -#define glPopMatrix MANGLE(PopMatrix) -#define glPopName MANGLE(PopName) -#define glPresentFrameDualFillNV MANGLE(PresentFrameDualFillNV) -#define glPresentFrameKeyedNV MANGLE(PresentFrameKeyedNV) -#define glPrimitiveRestartIndex MANGLE(PrimitiveRestartIndex) -#define glPrimitiveRestartIndexNV MANGLE(PrimitiveRestartIndexNV) -#define glPrimitiveRestartNV MANGLE(PrimitiveRestartNV) -#define glPrioritizeTexturesEXT MANGLE(PrioritizeTexturesEXT) -#define glPrioritizeTextures MANGLE(PrioritizeTextures) -#define glProgramBinary MANGLE(ProgramBinary) -#define glProgramBufferParametersfvNV MANGLE(ProgramBufferParametersfvNV) -#define glProgramBufferParametersIivNV MANGLE(ProgramBufferParametersIivNV) -#define glProgramBufferParametersIuivNV MANGLE(ProgramBufferParametersIuivNV) -#define glProgramCallbackMESA MANGLE(ProgramCallbackMESA) -#define glProgramEnvParameter4dARB MANGLE(ProgramEnvParameter4dARB) -#define glProgramEnvParameter4dvARB MANGLE(ProgramEnvParameter4dvARB) -#define glProgramEnvParameter4fARB MANGLE(ProgramEnvParameter4fARB) -#define glProgramEnvParameter4fvARB MANGLE(ProgramEnvParameter4fvARB) -#define glProgramEnvParameterI4iNV MANGLE(ProgramEnvParameterI4iNV) -#define glProgramEnvParameterI4ivNV MANGLE(ProgramEnvParameterI4ivNV) -#define glProgramEnvParameterI4uiNV MANGLE(ProgramEnvParameterI4uiNV) -#define glProgramEnvParameterI4uivNV MANGLE(ProgramEnvParameterI4uivNV) -#define glProgramEnvParameters4fvEXT MANGLE(ProgramEnvParameters4fvEXT) -#define glProgramEnvParametersI4ivNV MANGLE(ProgramEnvParametersI4ivNV) -#define glProgramEnvParametersI4uivNV MANGLE(ProgramEnvParametersI4uivNV) -#define glProgramLocalParameter4dARB MANGLE(ProgramLocalParameter4dARB) -#define glProgramLocalParameter4dvARB MANGLE(ProgramLocalParameter4dvARB) -#define glProgramLocalParameter4fARB MANGLE(ProgramLocalParameter4fARB) -#define glProgramLocalParameter4fvARB MANGLE(ProgramLocalParameter4fvARB) -#define glProgramLocalParameterI4iNV MANGLE(ProgramLocalParameterI4iNV) -#define glProgramLocalParameterI4ivNV MANGLE(ProgramLocalParameterI4ivNV) -#define glProgramLocalParameterI4uiNV MANGLE(ProgramLocalParameterI4uiNV) -#define glProgramLocalParameterI4uivNV MANGLE(ProgramLocalParameterI4uivNV) -#define glProgramLocalParameters4fvEXT MANGLE(ProgramLocalParameters4fvEXT) -#define glProgramLocalParametersI4ivNV MANGLE(ProgramLocalParametersI4ivNV) -#define glProgramLocalParametersI4uivNV MANGLE(ProgramLocalParametersI4uivNV) -#define glProgramNamedParameter4dNV MANGLE(ProgramNamedParameter4dNV) -#define glProgramNamedParameter4dvNV MANGLE(ProgramNamedParameter4dvNV) -#define glProgramNamedParameter4fNV MANGLE(ProgramNamedParameter4fNV) -#define glProgramNamedParameter4fvNV MANGLE(ProgramNamedParameter4fvNV) -#define glProgramParameter4dNV MANGLE(ProgramParameter4dNV) -#define glProgramParameter4dvNV MANGLE(ProgramParameter4dvNV) -#define glProgramParameter4fNV MANGLE(ProgramParameter4fNV) -#define glProgramParameter4fvNV MANGLE(ProgramParameter4fvNV) -#define glProgramParameteriARB MANGLE(ProgramParameteriARB) -#define glProgramParameteriEXT MANGLE(ProgramParameteriEXT) -#define glProgramParameteri MANGLE(ProgramParameteri) -#define glProgramParameters4dvNV MANGLE(ProgramParameters4dvNV) -#define glProgramParameters4fvNV MANGLE(ProgramParameters4fvNV) -#define glProgramStringARB MANGLE(ProgramStringARB) -#define glProgramSubroutineParametersuivNV MANGLE(ProgramSubroutineParametersuivNV) -#define glProgramUniform1dEXT MANGLE(ProgramUniform1dEXT) -#define glProgramUniform1d MANGLE(ProgramUniform1d) -#define glProgramUniform1dvEXT MANGLE(ProgramUniform1dvEXT) -#define glProgramUniform1dv MANGLE(ProgramUniform1dv) -#define glProgramUniform1fEXT MANGLE(ProgramUniform1fEXT) -#define glProgramUniform1f MANGLE(ProgramUniform1f) -#define glProgramUniform1fvEXT MANGLE(ProgramUniform1fvEXT) -#define glProgramUniform1fv MANGLE(ProgramUniform1fv) -#define glProgramUniform1i64NV MANGLE(ProgramUniform1i64NV) -#define glProgramUniform1i64vNV MANGLE(ProgramUniform1i64vNV) -#define glProgramUniform1iEXT MANGLE(ProgramUniform1iEXT) -#define glProgramUniform1i MANGLE(ProgramUniform1i) -#define glProgramUniform1ivEXT MANGLE(ProgramUniform1ivEXT) -#define glProgramUniform1iv MANGLE(ProgramUniform1iv) -#define glProgramUniform1ui64NV MANGLE(ProgramUniform1ui64NV) -#define glProgramUniform1ui64vNV MANGLE(ProgramUniform1ui64vNV) -#define glProgramUniform1uiEXT MANGLE(ProgramUniform1uiEXT) -#define glProgramUniform1ui MANGLE(ProgramUniform1ui) -#define glProgramUniform1uivEXT MANGLE(ProgramUniform1uivEXT) -#define glProgramUniform1uiv MANGLE(ProgramUniform1uiv) -#define glProgramUniform2dEXT MANGLE(ProgramUniform2dEXT) -#define glProgramUniform2d MANGLE(ProgramUniform2d) -#define glProgramUniform2dvEXT MANGLE(ProgramUniform2dvEXT) -#define glProgramUniform2dv MANGLE(ProgramUniform2dv) -#define glProgramUniform2fEXT MANGLE(ProgramUniform2fEXT) -#define glProgramUniform2f MANGLE(ProgramUniform2f) -#define glProgramUniform2fvEXT MANGLE(ProgramUniform2fvEXT) -#define glProgramUniform2fv MANGLE(ProgramUniform2fv) -#define glProgramUniform2i64NV MANGLE(ProgramUniform2i64NV) -#define glProgramUniform2i64vNV MANGLE(ProgramUniform2i64vNV) -#define glProgramUniform2iEXT MANGLE(ProgramUniform2iEXT) -#define glProgramUniform2i MANGLE(ProgramUniform2i) -#define glProgramUniform2ivEXT MANGLE(ProgramUniform2ivEXT) -#define glProgramUniform2iv MANGLE(ProgramUniform2iv) -#define glProgramUniform2ui64NV MANGLE(ProgramUniform2ui64NV) -#define glProgramUniform2ui64vNV MANGLE(ProgramUniform2ui64vNV) -#define glProgramUniform2uiEXT MANGLE(ProgramUniform2uiEXT) -#define glProgramUniform2ui MANGLE(ProgramUniform2ui) -#define glProgramUniform2uivEXT MANGLE(ProgramUniform2uivEXT) -#define glProgramUniform2uiv MANGLE(ProgramUniform2uiv) -#define glProgramUniform3dEXT MANGLE(ProgramUniform3dEXT) -#define glProgramUniform3d MANGLE(ProgramUniform3d) -#define glProgramUniform3dvEXT MANGLE(ProgramUniform3dvEXT) -#define glProgramUniform3dv MANGLE(ProgramUniform3dv) -#define glProgramUniform3fEXT MANGLE(ProgramUniform3fEXT) -#define glProgramUniform3f MANGLE(ProgramUniform3f) -#define glProgramUniform3fvEXT MANGLE(ProgramUniform3fvEXT) -#define glProgramUniform3fv MANGLE(ProgramUniform3fv) -#define glProgramUniform3i64NV MANGLE(ProgramUniform3i64NV) -#define glProgramUniform3i64vNV MANGLE(ProgramUniform3i64vNV) -#define glProgramUniform3iEXT MANGLE(ProgramUniform3iEXT) -#define glProgramUniform3i MANGLE(ProgramUniform3i) -#define glProgramUniform3ivEXT MANGLE(ProgramUniform3ivEXT) -#define glProgramUniform3iv MANGLE(ProgramUniform3iv) -#define glProgramUniform3ui64NV MANGLE(ProgramUniform3ui64NV) -#define glProgramUniform3ui64vNV MANGLE(ProgramUniform3ui64vNV) -#define glProgramUniform3uiEXT MANGLE(ProgramUniform3uiEXT) -#define glProgramUniform3ui MANGLE(ProgramUniform3ui) -#define glProgramUniform3uivEXT MANGLE(ProgramUniform3uivEXT) -#define glProgramUniform3uiv MANGLE(ProgramUniform3uiv) -#define glProgramUniform4dEXT MANGLE(ProgramUniform4dEXT) -#define glProgramUniform4d MANGLE(ProgramUniform4d) -#define glProgramUniform4dvEXT MANGLE(ProgramUniform4dvEXT) -#define glProgramUniform4dv MANGLE(ProgramUniform4dv) -#define glProgramUniform4fEXT MANGLE(ProgramUniform4fEXT) -#define glProgramUniform4f MANGLE(ProgramUniform4f) -#define glProgramUniform4fvEXT MANGLE(ProgramUniform4fvEXT) -#define glProgramUniform4fv MANGLE(ProgramUniform4fv) -#define glProgramUniform4i64NV MANGLE(ProgramUniform4i64NV) -#define glProgramUniform4i64vNV MANGLE(ProgramUniform4i64vNV) -#define glProgramUniform4iEXT MANGLE(ProgramUniform4iEXT) -#define glProgramUniform4i MANGLE(ProgramUniform4i) -#define glProgramUniform4ivEXT MANGLE(ProgramUniform4ivEXT) -#define glProgramUniform4iv MANGLE(ProgramUniform4iv) -#define glProgramUniform4ui64NV MANGLE(ProgramUniform4ui64NV) -#define glProgramUniform4ui64vNV MANGLE(ProgramUniform4ui64vNV) -#define glProgramUniform4uiEXT MANGLE(ProgramUniform4uiEXT) -#define glProgramUniform4ui MANGLE(ProgramUniform4ui) -#define glProgramUniform4uivEXT MANGLE(ProgramUniform4uivEXT) -#define glProgramUniform4uiv MANGLE(ProgramUniform4uiv) -#define glProgramUniformMatrix2dvEXT MANGLE(ProgramUniformMatrix2dvEXT) -#define glProgramUniformMatrix2dv MANGLE(ProgramUniformMatrix2dv) -#define glProgramUniformMatrix2fvEXT MANGLE(ProgramUniformMatrix2fvEXT) -#define glProgramUniformMatrix2fv MANGLE(ProgramUniformMatrix2fv) -#define glProgramUniformMatrix2x3dvEXT MANGLE(ProgramUniformMatrix2x3dvEXT) -#define glProgramUniformMatrix2x3dv MANGLE(ProgramUniformMatrix2x3dv) -#define glProgramUniformMatrix2x3fvEXT MANGLE(ProgramUniformMatrix2x3fvEXT) -#define glProgramUniformMatrix2x3fv MANGLE(ProgramUniformMatrix2x3fv) -#define glProgramUniformMatrix2x4dvEXT MANGLE(ProgramUniformMatrix2x4dvEXT) -#define glProgramUniformMatrix2x4dv MANGLE(ProgramUniformMatrix2x4dv) -#define glProgramUniformMatrix2x4fvEXT MANGLE(ProgramUniformMatrix2x4fvEXT) -#define glProgramUniformMatrix2x4fv MANGLE(ProgramUniformMatrix2x4fv) -#define glProgramUniformMatrix3dvEXT MANGLE(ProgramUniformMatrix3dvEXT) -#define glProgramUniformMatrix3dv MANGLE(ProgramUniformMatrix3dv) -#define glProgramUniformMatrix3fvEXT MANGLE(ProgramUniformMatrix3fvEXT) -#define glProgramUniformMatrix3fv MANGLE(ProgramUniformMatrix3fv) -#define glProgramUniformMatrix3x2dvEXT MANGLE(ProgramUniformMatrix3x2dvEXT) -#define glProgramUniformMatrix3x2dv MANGLE(ProgramUniformMatrix3x2dv) -#define glProgramUniformMatrix3x2fvEXT MANGLE(ProgramUniformMatrix3x2fvEXT) -#define glProgramUniformMatrix3x2fv MANGLE(ProgramUniformMatrix3x2fv) -#define glProgramUniformMatrix3x4dvEXT MANGLE(ProgramUniformMatrix3x4dvEXT) -#define glProgramUniformMatrix3x4dv MANGLE(ProgramUniformMatrix3x4dv) -#define glProgramUniformMatrix3x4fvEXT MANGLE(ProgramUniformMatrix3x4fvEXT) -#define glProgramUniformMatrix3x4fv MANGLE(ProgramUniformMatrix3x4fv) -#define glProgramUniformMatrix4dvEXT MANGLE(ProgramUniformMatrix4dvEXT) -#define glProgramUniformMatrix4dv MANGLE(ProgramUniformMatrix4dv) -#define glProgramUniformMatrix4fvEXT MANGLE(ProgramUniformMatrix4fvEXT) -#define glProgramUniformMatrix4fv MANGLE(ProgramUniformMatrix4fv) -#define glProgramUniformMatrix4x2dvEXT MANGLE(ProgramUniformMatrix4x2dvEXT) -#define glProgramUniformMatrix4x2dv MANGLE(ProgramUniformMatrix4x2dv) -#define glProgramUniformMatrix4x2fvEXT MANGLE(ProgramUniformMatrix4x2fvEXT) -#define glProgramUniformMatrix4x2fv MANGLE(ProgramUniformMatrix4x2fv) -#define glProgramUniformMatrix4x3dvEXT MANGLE(ProgramUniformMatrix4x3dvEXT) -#define glProgramUniformMatrix4x3dv MANGLE(ProgramUniformMatrix4x3dv) -#define glProgramUniformMatrix4x3fvEXT MANGLE(ProgramUniformMatrix4x3fvEXT) -#define glProgramUniformMatrix4x3fv MANGLE(ProgramUniformMatrix4x3fv) -#define glProgramUniformui64NV MANGLE(ProgramUniformui64NV) -#define glProgramUniformui64vNV MANGLE(ProgramUniformui64vNV) -#define glProgramVertexLimitNV MANGLE(ProgramVertexLimitNV) -#define glProvokingVertexEXT MANGLE(ProvokingVertexEXT) -#define glProvokingVertex MANGLE(ProvokingVertex) -#define glPushAttrib MANGLE(PushAttrib) -#define glPushClientAttribDefaultEXT MANGLE(PushClientAttribDefaultEXT) -#define glPushClientAttrib MANGLE(PushClientAttrib) -#define glPushMatrix MANGLE(PushMatrix) -#define glPushName MANGLE(PushName) -#define glQueryCounter MANGLE(QueryCounter) -#define glRasterPos2d MANGLE(RasterPos2d) -#define glRasterPos2dv MANGLE(RasterPos2dv) -#define glRasterPos2f MANGLE(RasterPos2f) -#define glRasterPos2fv MANGLE(RasterPos2fv) -#define glRasterPos2i MANGLE(RasterPos2i) -#define glRasterPos2iv MANGLE(RasterPos2iv) -#define glRasterPos2s MANGLE(RasterPos2s) -#define glRasterPos2sv MANGLE(RasterPos2sv) -#define glRasterPos3d MANGLE(RasterPos3d) -#define glRasterPos3dv MANGLE(RasterPos3dv) -#define glRasterPos3f MANGLE(RasterPos3f) -#define glRasterPos3fv MANGLE(RasterPos3fv) -#define glRasterPos3i MANGLE(RasterPos3i) -#define glRasterPos3iv MANGLE(RasterPos3iv) -#define glRasterPos3s MANGLE(RasterPos3s) -#define glRasterPos3sv MANGLE(RasterPos3sv) -#define glRasterPos4d MANGLE(RasterPos4d) -#define glRasterPos4dv MANGLE(RasterPos4dv) -#define glRasterPos4f MANGLE(RasterPos4f) -#define glRasterPos4fv MANGLE(RasterPos4fv) -#define glRasterPos4i MANGLE(RasterPos4i) -#define glRasterPos4iv MANGLE(RasterPos4iv) -#define glRasterPos4s MANGLE(RasterPos4s) -#define glRasterPos4sv MANGLE(RasterPos4sv) -#define glReadBuffer MANGLE(ReadBuffer) -#define glReadInstrumentsSGIX MANGLE(ReadInstrumentsSGIX) -#define glReadnPixelsARB MANGLE(ReadnPixelsARB) -#define glReadPixels MANGLE(ReadPixels) -#define glRectd MANGLE(Rectd) -#define glRectdv MANGLE(Rectdv) -#define glRectf MANGLE(Rectf) -#define glRectfv MANGLE(Rectfv) -#define glRecti MANGLE(Recti) -#define glRectiv MANGLE(Rectiv) -#define glRects MANGLE(Rects) -#define glRectsv MANGLE(Rectsv) -#define glReferencePlaneSGIX MANGLE(ReferencePlaneSGIX) -#define glReleaseShaderCompiler MANGLE(ReleaseShaderCompiler) -#define glRenderbufferStorageEXT MANGLE(RenderbufferStorageEXT) -#define glRenderbufferStorage MANGLE(RenderbufferStorage) -#define glRenderbufferStorageMultisampleCoverageNV MANGLE(RenderbufferStorageMultisampleCoverageNV) -#define glRenderbufferStorageMultisampleEXT MANGLE(RenderbufferStorageMultisampleEXT) -#define glRenderbufferStorageMultisample MANGLE(RenderbufferStorageMultisample) -#define glRenderMode MANGLE(RenderMode) -#define glReplacementCodePointerSUN MANGLE(ReplacementCodePointerSUN) -#define glReplacementCodeubSUN MANGLE(ReplacementCodeubSUN) -#define glReplacementCodeubvSUN MANGLE(ReplacementCodeubvSUN) -#define glReplacementCodeuiColor3fVertex3fSUN MANGLE(ReplacementCodeuiColor3fVertex3fSUN) -#define glReplacementCodeuiColor3fVertex3fvSUN MANGLE(ReplacementCodeuiColor3fVertex3fvSUN) -#define glReplacementCodeuiColor4fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiColor4fNormal3fVertex3fSUN) -#define glReplacementCodeuiColor4fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiColor4fNormal3fVertex3fvSUN) -#define glReplacementCodeuiColor4ubVertex3fSUN MANGLE(ReplacementCodeuiColor4ubVertex3fSUN) -#define glReplacementCodeuiColor4ubVertex3fvSUN MANGLE(ReplacementCodeuiColor4ubVertex3fvSUN) -#define glReplacementCodeuiNormal3fVertex3fSUN MANGLE(ReplacementCodeuiNormal3fVertex3fSUN) -#define glReplacementCodeuiNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiNormal3fVertex3fvSUN) -#define glReplacementCodeuiSUN MANGLE(ReplacementCodeuiSUN) -#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN) -#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN) -#define glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN) -#define glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN) -#define glReplacementCodeuiTexCoord2fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fVertex3fSUN) -#define glReplacementCodeuiTexCoord2fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fVertex3fvSUN) -#define glReplacementCodeuiVertex3fSUN MANGLE(ReplacementCodeuiVertex3fSUN) -#define glReplacementCodeuiVertex3fvSUN MANGLE(ReplacementCodeuiVertex3fvSUN) -#define glReplacementCodeuivSUN MANGLE(ReplacementCodeuivSUN) -#define glReplacementCodeusSUN MANGLE(ReplacementCodeusSUN) -#define glReplacementCodeusvSUN MANGLE(ReplacementCodeusvSUN) -#define glRequestResidentProgramsNV MANGLE(RequestResidentProgramsNV) -#define glResetHistogramEXT MANGLE(ResetHistogramEXT) -#define glResetHistogram MANGLE(ResetHistogram) -#define glResetMinmaxEXT MANGLE(ResetMinmaxEXT) -#define glResetMinmax MANGLE(ResetMinmax) -#define glResizeBuffersMESA MANGLE(ResizeBuffersMESA) -#define glResumeTransformFeedback MANGLE(ResumeTransformFeedback) -#define glResumeTransformFeedbackNV MANGLE(ResumeTransformFeedbackNV) -#define glRotated MANGLE(Rotated) -#define glRotatef MANGLE(Rotatef) -#define glSampleCoverageARB MANGLE(SampleCoverageARB) -#define glSampleCoverage MANGLE(SampleCoverage) -#define glSampleMapATI MANGLE(SampleMapATI) -#define glSampleMaskEXT MANGLE(SampleMaskEXT) -#define glSampleMaski MANGLE(SampleMaski) -#define glSampleMaskIndexedNV MANGLE(SampleMaskIndexedNV) -#define glSampleMaskSGIS MANGLE(SampleMaskSGIS) -#define glSamplePatternEXT MANGLE(SamplePatternEXT) -#define glSamplePatternSGIS MANGLE(SamplePatternSGIS) -#define glSamplerParameterf MANGLE(SamplerParameterf) -#define glSamplerParameterfv MANGLE(SamplerParameterfv) -#define glSamplerParameterIiv MANGLE(SamplerParameterIiv) -#define glSamplerParameteri MANGLE(SamplerParameteri) -#define glSamplerParameterIuiv MANGLE(SamplerParameterIuiv) -#define glSamplerParameteriv MANGLE(SamplerParameteriv) -#define glScaled MANGLE(Scaled) -#define glScalef MANGLE(Scalef) -#define glScissorArrayv MANGLE(ScissorArrayv) -#define glScissorIndexed MANGLE(ScissorIndexed) -#define glScissorIndexedv MANGLE(ScissorIndexedv) -#define glScissor MANGLE(Scissor) -#define glSecondaryColor3bEXT MANGLE(SecondaryColor3bEXT) -#define glSecondaryColor3b MANGLE(SecondaryColor3b) -#define glSecondaryColor3bvEXT MANGLE(SecondaryColor3bvEXT) -#define glSecondaryColor3bv MANGLE(SecondaryColor3bv) -#define glSecondaryColor3dEXT MANGLE(SecondaryColor3dEXT) -#define glSecondaryColor3d MANGLE(SecondaryColor3d) -#define glSecondaryColor3dvEXT MANGLE(SecondaryColor3dvEXT) -#define glSecondaryColor3dv MANGLE(SecondaryColor3dv) -#define glSecondaryColor3fEXT MANGLE(SecondaryColor3fEXT) -#define glSecondaryColor3f MANGLE(SecondaryColor3f) -#define glSecondaryColor3fvEXT MANGLE(SecondaryColor3fvEXT) -#define glSecondaryColor3fv MANGLE(SecondaryColor3fv) -#define glSecondaryColor3hNV MANGLE(SecondaryColor3hNV) -#define glSecondaryColor3hvNV MANGLE(SecondaryColor3hvNV) -#define glSecondaryColor3iEXT MANGLE(SecondaryColor3iEXT) -#define glSecondaryColor3i MANGLE(SecondaryColor3i) -#define glSecondaryColor3ivEXT MANGLE(SecondaryColor3ivEXT) -#define glSecondaryColor3iv MANGLE(SecondaryColor3iv) -#define glSecondaryColor3sEXT MANGLE(SecondaryColor3sEXT) -#define glSecondaryColor3s MANGLE(SecondaryColor3s) -#define glSecondaryColor3svEXT MANGLE(SecondaryColor3svEXT) -#define glSecondaryColor3sv MANGLE(SecondaryColor3sv) -#define glSecondaryColor3ubEXT MANGLE(SecondaryColor3ubEXT) -#define glSecondaryColor3ub MANGLE(SecondaryColor3ub) -#define glSecondaryColor3ubvEXT MANGLE(SecondaryColor3ubvEXT) -#define glSecondaryColor3ubv MANGLE(SecondaryColor3ubv) -#define glSecondaryColor3uiEXT MANGLE(SecondaryColor3uiEXT) -#define glSecondaryColor3ui MANGLE(SecondaryColor3ui) -#define glSecondaryColor3uivEXT MANGLE(SecondaryColor3uivEXT) -#define glSecondaryColor3uiv MANGLE(SecondaryColor3uiv) -#define glSecondaryColor3usEXT MANGLE(SecondaryColor3usEXT) -#define glSecondaryColor3us MANGLE(SecondaryColor3us) -#define glSecondaryColor3usvEXT MANGLE(SecondaryColor3usvEXT) -#define glSecondaryColor3usv MANGLE(SecondaryColor3usv) -#define glSecondaryColorFormatNV MANGLE(SecondaryColorFormatNV) -#define glSecondaryColorP3ui MANGLE(SecondaryColorP3ui) -#define glSecondaryColorP3uiv MANGLE(SecondaryColorP3uiv) -#define glSecondaryColorPointerEXT MANGLE(SecondaryColorPointerEXT) -#define glSecondaryColorPointerListIBM MANGLE(SecondaryColorPointerListIBM) -#define glSecondaryColorPointer MANGLE(SecondaryColorPointer) -#define glSelectBuffer MANGLE(SelectBuffer) -#define glSelectPerfMonitorCountersAMD MANGLE(SelectPerfMonitorCountersAMD) -#define glSeparableFilter2DEXT MANGLE(SeparableFilter2DEXT) -#define glSeparableFilter2D MANGLE(SeparableFilter2D) -#define glSetFenceAPPLE MANGLE(SetFenceAPPLE) -#define glSetFenceNV MANGLE(SetFenceNV) -#define glSetFragmentShaderConstantATI MANGLE(SetFragmentShaderConstantATI) -#define glSetInvariantEXT MANGLE(SetInvariantEXT) -#define glSetLocalConstantEXT MANGLE(SetLocalConstantEXT) -#define glShadeModel MANGLE(ShadeModel) -#define glShaderBinary MANGLE(ShaderBinary) -#define glShaderOp1EXT MANGLE(ShaderOp1EXT) -#define glShaderOp2EXT MANGLE(ShaderOp2EXT) -#define glShaderOp3EXT MANGLE(ShaderOp3EXT) -#define glShaderSourceARB MANGLE(ShaderSourceARB) -#define glShaderSource MANGLE(ShaderSource) -#define glSharpenTexFuncSGIS MANGLE(SharpenTexFuncSGIS) -#define glSpriteParameterfSGIX MANGLE(SpriteParameterfSGIX) -#define glSpriteParameterfvSGIX MANGLE(SpriteParameterfvSGIX) -#define glSpriteParameteriSGIX MANGLE(SpriteParameteriSGIX) -#define glSpriteParameterivSGIX MANGLE(SpriteParameterivSGIX) -#define glStartInstrumentsSGIX MANGLE(StartInstrumentsSGIX) -#define glStencilClearTagEXT MANGLE(StencilClearTagEXT) -#define glStencilFunc MANGLE(StencilFunc) -#define glStencilFuncSeparateATI MANGLE(StencilFuncSeparateATI) -#define glStencilFuncSeparate MANGLE(StencilFuncSeparate) -#define glStencilMask MANGLE(StencilMask) -#define glStencilMaskSeparate MANGLE(StencilMaskSeparate) -#define glStencilOp MANGLE(StencilOp) -#define glStencilOpSeparateATI MANGLE(StencilOpSeparateATI) -#define glStencilOpSeparate MANGLE(StencilOpSeparate) -#define glStopInstrumentsSGIX MANGLE(StopInstrumentsSGIX) -#define glStringMarkerGREMEDY MANGLE(StringMarkerGREMEDY) -#define glSwizzleEXT MANGLE(SwizzleEXT) -#define glTagSampleBufferSGIX MANGLE(TagSampleBufferSGIX) -#define glTangent3bEXT MANGLE(Tangent3bEXT) -#define glTangent3bvEXT MANGLE(Tangent3bvEXT) -#define glTangent3dEXT MANGLE(Tangent3dEXT) -#define glTangent3dvEXT MANGLE(Tangent3dvEXT) -#define glTangent3fEXT MANGLE(Tangent3fEXT) -#define glTangent3fvEXT MANGLE(Tangent3fvEXT) -#define glTangent3iEXT MANGLE(Tangent3iEXT) -#define glTangent3ivEXT MANGLE(Tangent3ivEXT) -#define glTangent3sEXT MANGLE(Tangent3sEXT) -#define glTangent3svEXT MANGLE(Tangent3svEXT) -#define glTangentPointerEXT MANGLE(TangentPointerEXT) -#define glTbufferMask3DFX MANGLE(TbufferMask3DFX) -#define glTessellationFactorAMD MANGLE(TessellationFactorAMD) -#define glTessellationModeAMD MANGLE(TessellationModeAMD) -#define glTestFenceAPPLE MANGLE(TestFenceAPPLE) -#define glTestFenceNV MANGLE(TestFenceNV) -#define glTestObjectAPPLE MANGLE(TestObjectAPPLE) -#define glTexBufferARB MANGLE(TexBufferARB) -#define glTexBufferEXT MANGLE(TexBufferEXT) -#define glTexBuffer MANGLE(TexBuffer) -#define glTexBumpParameterfvATI MANGLE(TexBumpParameterfvATI) -#define glTexBumpParameterivATI MANGLE(TexBumpParameterivATI) -#define glTexCoord1d MANGLE(TexCoord1d) -#define glTexCoord1dv MANGLE(TexCoord1dv) -#define glTexCoord1f MANGLE(TexCoord1f) -#define glTexCoord1fv MANGLE(TexCoord1fv) -#define glTexCoord1hNV MANGLE(TexCoord1hNV) -#define glTexCoord1hvNV MANGLE(TexCoord1hvNV) -#define glTexCoord1i MANGLE(TexCoord1i) -#define glTexCoord1iv MANGLE(TexCoord1iv) -#define glTexCoord1s MANGLE(TexCoord1s) -#define glTexCoord1sv MANGLE(TexCoord1sv) -#define glTexCoord2d MANGLE(TexCoord2d) -#define glTexCoord2dv MANGLE(TexCoord2dv) -#define glTexCoord2fColor3fVertex3fSUN MANGLE(TexCoord2fColor3fVertex3fSUN) -#define glTexCoord2fColor3fVertex3fvSUN MANGLE(TexCoord2fColor3fVertex3fvSUN) -#define glTexCoord2fColor4fNormal3fVertex3fSUN MANGLE(TexCoord2fColor4fNormal3fVertex3fSUN) -#define glTexCoord2fColor4fNormal3fVertex3fvSUN MANGLE(TexCoord2fColor4fNormal3fVertex3fvSUN) -#define glTexCoord2fColor4ubVertex3fSUN MANGLE(TexCoord2fColor4ubVertex3fSUN) -#define glTexCoord2fColor4ubVertex3fvSUN MANGLE(TexCoord2fColor4ubVertex3fvSUN) -#define glTexCoord2f MANGLE(TexCoord2f) -#define glTexCoord2fNormal3fVertex3fSUN MANGLE(TexCoord2fNormal3fVertex3fSUN) -#define glTexCoord2fNormal3fVertex3fvSUN MANGLE(TexCoord2fNormal3fVertex3fvSUN) -#define glTexCoord2fVertex3fSUN MANGLE(TexCoord2fVertex3fSUN) -#define glTexCoord2fVertex3fvSUN MANGLE(TexCoord2fVertex3fvSUN) -#define glTexCoord2fv MANGLE(TexCoord2fv) -#define glTexCoord2hNV MANGLE(TexCoord2hNV) -#define glTexCoord2hvNV MANGLE(TexCoord2hvNV) -#define glTexCoord2i MANGLE(TexCoord2i) -#define glTexCoord2iv MANGLE(TexCoord2iv) -#define glTexCoord2s MANGLE(TexCoord2s) -#define glTexCoord2sv MANGLE(TexCoord2sv) -#define glTexCoord3d MANGLE(TexCoord3d) -#define glTexCoord3dv MANGLE(TexCoord3dv) -#define glTexCoord3f MANGLE(TexCoord3f) -#define glTexCoord3fv MANGLE(TexCoord3fv) -#define glTexCoord3hNV MANGLE(TexCoord3hNV) -#define glTexCoord3hvNV MANGLE(TexCoord3hvNV) -#define glTexCoord3i MANGLE(TexCoord3i) -#define glTexCoord3iv MANGLE(TexCoord3iv) -#define glTexCoord3s MANGLE(TexCoord3s) -#define glTexCoord3sv MANGLE(TexCoord3sv) -#define glTexCoord4d MANGLE(TexCoord4d) -#define glTexCoord4dv MANGLE(TexCoord4dv) -#define glTexCoord4fColor4fNormal3fVertex4fSUN MANGLE(TexCoord4fColor4fNormal3fVertex4fSUN) -#define glTexCoord4fColor4fNormal3fVertex4fvSUN MANGLE(TexCoord4fColor4fNormal3fVertex4fvSUN) -#define glTexCoord4f MANGLE(TexCoord4f) -#define glTexCoord4fVertex4fSUN MANGLE(TexCoord4fVertex4fSUN) -#define glTexCoord4fVertex4fvSUN MANGLE(TexCoord4fVertex4fvSUN) -#define glTexCoord4fv MANGLE(TexCoord4fv) -#define glTexCoord4hNV MANGLE(TexCoord4hNV) -#define glTexCoord4hvNV MANGLE(TexCoord4hvNV) -#define glTexCoord4i MANGLE(TexCoord4i) -#define glTexCoord4iv MANGLE(TexCoord4iv) -#define glTexCoord4s MANGLE(TexCoord4s) -#define glTexCoord4sv MANGLE(TexCoord4sv) -#define glTexCoordFormatNV MANGLE(TexCoordFormatNV) -#define glTexCoordP1ui MANGLE(TexCoordP1ui) -#define glTexCoordP1uiv MANGLE(TexCoordP1uiv) -#define glTexCoordP2ui MANGLE(TexCoordP2ui) -#define glTexCoordP2uiv MANGLE(TexCoordP2uiv) -#define glTexCoordP3ui MANGLE(TexCoordP3ui) -#define glTexCoordP3uiv MANGLE(TexCoordP3uiv) -#define glTexCoordP4ui MANGLE(TexCoordP4ui) -#define glTexCoordP4uiv MANGLE(TexCoordP4uiv) -#define glTexCoordPointerEXT MANGLE(TexCoordPointerEXT) -#define glTexCoordPointerListIBM MANGLE(TexCoordPointerListIBM) -#define glTexCoordPointer MANGLE(TexCoordPointer) -#define glTexCoordPointervINTEL MANGLE(TexCoordPointervINTEL) -#define glTexEnvf MANGLE(TexEnvf) -#define glTexEnvfv MANGLE(TexEnvfv) -#define glTexEnvi MANGLE(TexEnvi) -#define glTexEnviv MANGLE(TexEnviv) -#define glTexFilterFuncSGIS MANGLE(TexFilterFuncSGIS) -#define glTexGend MANGLE(TexGend) -#define glTexGendv MANGLE(TexGendv) -#define glTexGenf MANGLE(TexGenf) -#define glTexGenfv MANGLE(TexGenfv) -#define glTexGeni MANGLE(TexGeni) -#define glTexGeniv MANGLE(TexGeniv) -#define glTexImage1D MANGLE(TexImage1D) -#define glTexImage2D MANGLE(TexImage2D) -#define glTexImage2DMultisample MANGLE(TexImage2DMultisample) -#define glTexImage3DEXT MANGLE(TexImage3DEXT) -#define glTexImage3D MANGLE(TexImage3D) -#define glTexImage3DMultisample MANGLE(TexImage3DMultisample) -#define glTexImage4DSGIS MANGLE(TexImage4DSGIS) -#define glTexParameterf MANGLE(TexParameterf) -#define glTexParameterfv MANGLE(TexParameterfv) -#define glTexParameterIivEXT MANGLE(TexParameterIivEXT) -#define glTexParameterIiv MANGLE(TexParameterIiv) -#define glTexParameteri MANGLE(TexParameteri) -#define glTexParameterIuivEXT MANGLE(TexParameterIuivEXT) -#define glTexParameterIuiv MANGLE(TexParameterIuiv) -#define glTexParameteriv MANGLE(TexParameteriv) -#define glTexRenderbufferNV MANGLE(TexRenderbufferNV) -#define glTexSubImage1DEXT MANGLE(TexSubImage1DEXT) -#define glTexSubImage1D MANGLE(TexSubImage1D) -#define glTexSubImage2DEXT MANGLE(TexSubImage2DEXT) -#define glTexSubImage2D MANGLE(TexSubImage2D) -#define glTexSubImage3DEXT MANGLE(TexSubImage3DEXT) -#define glTexSubImage3D MANGLE(TexSubImage3D) -#define glTexSubImage4DSGIS MANGLE(TexSubImage4DSGIS) -#define glTextureBarrierNV MANGLE(TextureBarrierNV) -#define glTextureBufferEXT MANGLE(TextureBufferEXT) -#define glTextureColorMaskSGIS MANGLE(TextureColorMaskSGIS) -#define glTextureImage1DEXT MANGLE(TextureImage1DEXT) -#define glTextureImage2DEXT MANGLE(TextureImage2DEXT) -#define glTextureImage3DEXT MANGLE(TextureImage3DEXT) -#define glTextureLightEXT MANGLE(TextureLightEXT) -#define glTextureMaterialEXT MANGLE(TextureMaterialEXT) -#define glTextureNormalEXT MANGLE(TextureNormalEXT) -#define glTextureParameterfEXT MANGLE(TextureParameterfEXT) -#define glTextureParameterfvEXT MANGLE(TextureParameterfvEXT) -#define glTextureParameteriEXT MANGLE(TextureParameteriEXT) -#define glTextureParameterIivEXT MANGLE(TextureParameterIivEXT) -#define glTextureParameterIuivEXT MANGLE(TextureParameterIuivEXT) -#define glTextureParameterivEXT MANGLE(TextureParameterivEXT) -#define glTextureRangeAPPLE MANGLE(TextureRangeAPPLE) -#define glTextureRenderbufferEXT MANGLE(TextureRenderbufferEXT) -#define glTextureSubImage1DEXT MANGLE(TextureSubImage1DEXT) -#define glTextureSubImage2DEXT MANGLE(TextureSubImage2DEXT) -#define glTextureSubImage3DEXT MANGLE(TextureSubImage3DEXT) -#define glTrackMatrixNV MANGLE(TrackMatrixNV) -#define glTransformFeedbackAttribsNV MANGLE(TransformFeedbackAttribsNV) -#define glTransformFeedbackStreamAttribsNV MANGLE(TransformFeedbackStreamAttribsNV) -#define glTransformFeedbackVaryingsEXT MANGLE(TransformFeedbackVaryingsEXT) -#define glTransformFeedbackVaryings MANGLE(TransformFeedbackVaryings) -#define glTransformFeedbackVaryingsNV MANGLE(TransformFeedbackVaryingsNV) -#define glTranslated MANGLE(Translated) -#define glTranslatef MANGLE(Translatef) -#define glUniform1d MANGLE(Uniform1d) -#define glUniform1dv MANGLE(Uniform1dv) -#define glUniform1fARB MANGLE(Uniform1fARB) -#define glUniform1f MANGLE(Uniform1f) -#define glUniform1fvARB MANGLE(Uniform1fvARB) -#define glUniform1fv MANGLE(Uniform1fv) -#define glUniform1i64NV MANGLE(Uniform1i64NV) -#define glUniform1i64vNV MANGLE(Uniform1i64vNV) -#define glUniform1iARB MANGLE(Uniform1iARB) -#define glUniform1i MANGLE(Uniform1i) -#define glUniform1ivARB MANGLE(Uniform1ivARB) -#define glUniform1iv MANGLE(Uniform1iv) -#define glUniform1ui64NV MANGLE(Uniform1ui64NV) -#define glUniform1ui64vNV MANGLE(Uniform1ui64vNV) -#define glUniform1uiEXT MANGLE(Uniform1uiEXT) -#define glUniform1ui MANGLE(Uniform1ui) -#define glUniform1uivEXT MANGLE(Uniform1uivEXT) -#define glUniform1uiv MANGLE(Uniform1uiv) -#define glUniform2d MANGLE(Uniform2d) -#define glUniform2dv MANGLE(Uniform2dv) -#define glUniform2fARB MANGLE(Uniform2fARB) -#define glUniform2f MANGLE(Uniform2f) -#define glUniform2fvARB MANGLE(Uniform2fvARB) -#define glUniform2fv MANGLE(Uniform2fv) -#define glUniform2i64NV MANGLE(Uniform2i64NV) -#define glUniform2i64vNV MANGLE(Uniform2i64vNV) -#define glUniform2iARB MANGLE(Uniform2iARB) -#define glUniform2i MANGLE(Uniform2i) -#define glUniform2ivARB MANGLE(Uniform2ivARB) -#define glUniform2iv MANGLE(Uniform2iv) -#define glUniform2ui64NV MANGLE(Uniform2ui64NV) -#define glUniform2ui64vNV MANGLE(Uniform2ui64vNV) -#define glUniform2uiEXT MANGLE(Uniform2uiEXT) -#define glUniform2ui MANGLE(Uniform2ui) -#define glUniform2uivEXT MANGLE(Uniform2uivEXT) -#define glUniform2uiv MANGLE(Uniform2uiv) -#define glUniform3d MANGLE(Uniform3d) -#define glUniform3dv MANGLE(Uniform3dv) -#define glUniform3fARB MANGLE(Uniform3fARB) -#define glUniform3f MANGLE(Uniform3f) -#define glUniform3fvARB MANGLE(Uniform3fvARB) -#define glUniform3fv MANGLE(Uniform3fv) -#define glUniform3i64NV MANGLE(Uniform3i64NV) -#define glUniform3i64vNV MANGLE(Uniform3i64vNV) -#define glUniform3iARB MANGLE(Uniform3iARB) -#define glUniform3i MANGLE(Uniform3i) -#define glUniform3ivARB MANGLE(Uniform3ivARB) -#define glUniform3iv MANGLE(Uniform3iv) -#define glUniform3ui64NV MANGLE(Uniform3ui64NV) -#define glUniform3ui64vNV MANGLE(Uniform3ui64vNV) -#define glUniform3uiEXT MANGLE(Uniform3uiEXT) -#define glUniform3ui MANGLE(Uniform3ui) -#define glUniform3uivEXT MANGLE(Uniform3uivEXT) -#define glUniform3uiv MANGLE(Uniform3uiv) -#define glUniform4d MANGLE(Uniform4d) -#define glUniform4dv MANGLE(Uniform4dv) -#define glUniform4fARB MANGLE(Uniform4fARB) -#define glUniform4f MANGLE(Uniform4f) -#define glUniform4fvARB MANGLE(Uniform4fvARB) -#define glUniform4fv MANGLE(Uniform4fv) -#define glUniform4i64NV MANGLE(Uniform4i64NV) -#define glUniform4i64vNV MANGLE(Uniform4i64vNV) -#define glUniform4iARB MANGLE(Uniform4iARB) -#define glUniform4i MANGLE(Uniform4i) -#define glUniform4ivARB MANGLE(Uniform4ivARB) -#define glUniform4iv MANGLE(Uniform4iv) -#define glUniform4ui64NV MANGLE(Uniform4ui64NV) -#define glUniform4ui64vNV MANGLE(Uniform4ui64vNV) -#define glUniform4uiEXT MANGLE(Uniform4uiEXT) -#define glUniform4ui MANGLE(Uniform4ui) -#define glUniform4uivEXT MANGLE(Uniform4uivEXT) -#define glUniform4uiv MANGLE(Uniform4uiv) -#define glUniformBlockBinding MANGLE(UniformBlockBinding) -#define glUniformBufferEXT MANGLE(UniformBufferEXT) -#define glUniformMatrix2dv MANGLE(UniformMatrix2dv) -#define glUniformMatrix2fvARB MANGLE(UniformMatrix2fvARB) -#define glUniformMatrix2fv MANGLE(UniformMatrix2fv) -#define glUniformMatrix2x3dv MANGLE(UniformMatrix2x3dv) -#define glUniformMatrix2x3fv MANGLE(UniformMatrix2x3fv) -#define glUniformMatrix2x4dv MANGLE(UniformMatrix2x4dv) -#define glUniformMatrix2x4fv MANGLE(UniformMatrix2x4fv) -#define glUniformMatrix3dv MANGLE(UniformMatrix3dv) -#define glUniformMatrix3fvARB MANGLE(UniformMatrix3fvARB) -#define glUniformMatrix3fv MANGLE(UniformMatrix3fv) -#define glUniformMatrix3x2dv MANGLE(UniformMatrix3x2dv) -#define glUniformMatrix3x2fv MANGLE(UniformMatrix3x2fv) -#define glUniformMatrix3x4dv MANGLE(UniformMatrix3x4dv) -#define glUniformMatrix3x4fv MANGLE(UniformMatrix3x4fv) -#define glUniformMatrix4dv MANGLE(UniformMatrix4dv) -#define glUniformMatrix4fvARB MANGLE(UniformMatrix4fvARB) -#define glUniformMatrix4fv MANGLE(UniformMatrix4fv) -#define glUniformMatrix4x2dv MANGLE(UniformMatrix4x2dv) -#define glUniformMatrix4x2fv MANGLE(UniformMatrix4x2fv) -#define glUniformMatrix4x3dv MANGLE(UniformMatrix4x3dv) -#define glUniformMatrix4x3fv MANGLE(UniformMatrix4x3fv) -#define glUniformSubroutinesuiv MANGLE(UniformSubroutinesuiv) -#define glUniformui64NV MANGLE(Uniformui64NV) -#define glUniformui64vNV MANGLE(Uniformui64vNV) -#define glUnlockArraysEXT MANGLE(UnlockArraysEXT) -#define glUnmapBufferARB MANGLE(UnmapBufferARB) -#define glUnmapBuffer MANGLE(UnmapBuffer) -#define glUnmapNamedBufferEXT MANGLE(UnmapNamedBufferEXT) -#define glUnmapObjectBufferATI MANGLE(UnmapObjectBufferATI) -#define glUpdateObjectBufferATI MANGLE(UpdateObjectBufferATI) -#define glUseProgram MANGLE(UseProgram) -#define glUseProgramObjectARB MANGLE(UseProgramObjectARB) -#define glUseProgramStages MANGLE(UseProgramStages) -#define glUseShaderProgramEXT MANGLE(UseShaderProgramEXT) -#define glValidateProgramARB MANGLE(ValidateProgramARB) -#define glValidateProgram MANGLE(ValidateProgram) -#define glValidateProgramPipeline MANGLE(ValidateProgramPipeline) -#define glVariantArrayObjectATI MANGLE(VariantArrayObjectATI) -#define glVariantbvEXT MANGLE(VariantbvEXT) -#define glVariantdvEXT MANGLE(VariantdvEXT) -#define glVariantfvEXT MANGLE(VariantfvEXT) -#define glVariantivEXT MANGLE(VariantivEXT) -#define glVariantPointerEXT MANGLE(VariantPointerEXT) -#define glVariantsvEXT MANGLE(VariantsvEXT) -#define glVariantubvEXT MANGLE(VariantubvEXT) -#define glVariantuivEXT MANGLE(VariantuivEXT) -#define glVariantusvEXT MANGLE(VariantusvEXT) -#define glVDPAUFiniNV MANGLE(VDPAUFiniNV) -#define glVDPAUGetSurfaceivNV MANGLE(VDPAUGetSurfaceivNV) -#define glVDPAUInitNV MANGLE(VDPAUInitNV) -#define glVDPAUIsSurfaceNV MANGLE(VDPAUIsSurfaceNV) -#define glVDPAUMapSurfacesNV MANGLE(VDPAUMapSurfacesNV) -#define glVDPAURegisterOutputSurfaceNV MANGLE(VDPAURegisterOutputSurfaceNV) -#define glVDPAURegisterVideoSurfaceNV MANGLE(VDPAURegisterVideoSurfaceNV) -#define glVDPAUSurfaceAccessNV MANGLE(VDPAUSurfaceAccessNV) -#define glVDPAUUnmapSurfacesNV MANGLE(VDPAUUnmapSurfacesNV) -#define glVDPAUUnregisterSurfaceNV MANGLE(VDPAUUnregisterSurfaceNV) -#define glVertex2d MANGLE(Vertex2d) -#define glVertex2dv MANGLE(Vertex2dv) -#define glVertex2f MANGLE(Vertex2f) -#define glVertex2fv MANGLE(Vertex2fv) -#define glVertex2hNV MANGLE(Vertex2hNV) -#define glVertex2hvNV MANGLE(Vertex2hvNV) -#define glVertex2i MANGLE(Vertex2i) -#define glVertex2iv MANGLE(Vertex2iv) -#define glVertex2s MANGLE(Vertex2s) -#define glVertex2sv MANGLE(Vertex2sv) -#define glVertex3d MANGLE(Vertex3d) -#define glVertex3dv MANGLE(Vertex3dv) -#define glVertex3f MANGLE(Vertex3f) -#define glVertex3fv MANGLE(Vertex3fv) -#define glVertex3hNV MANGLE(Vertex3hNV) -#define glVertex3hvNV MANGLE(Vertex3hvNV) -#define glVertex3i MANGLE(Vertex3i) -#define glVertex3iv MANGLE(Vertex3iv) -#define glVertex3s MANGLE(Vertex3s) -#define glVertex3sv MANGLE(Vertex3sv) -#define glVertex4d MANGLE(Vertex4d) -#define glVertex4dv MANGLE(Vertex4dv) -#define glVertex4f MANGLE(Vertex4f) -#define glVertex4fv MANGLE(Vertex4fv) -#define glVertex4hNV MANGLE(Vertex4hNV) -#define glVertex4hvNV MANGLE(Vertex4hvNV) -#define glVertex4i MANGLE(Vertex4i) -#define glVertex4iv MANGLE(Vertex4iv) -#define glVertex4s MANGLE(Vertex4s) -#define glVertex4sv MANGLE(Vertex4sv) -#define glVertexArrayParameteriAPPLE MANGLE(VertexArrayParameteriAPPLE) -#define glVertexArrayRangeAPPLE MANGLE(VertexArrayRangeAPPLE) -#define glVertexArrayRangeNV MANGLE(VertexArrayRangeNV) -#define glVertexArrayVertexAttribLOffsetEXT MANGLE(VertexArrayVertexAttribLOffsetEXT) -#define glVertexAttrib1dARB MANGLE(VertexAttrib1dARB) -#define glVertexAttrib1d MANGLE(VertexAttrib1d) -#define glVertexAttrib1dNV MANGLE(VertexAttrib1dNV) -#define glVertexAttrib1dvARB MANGLE(VertexAttrib1dvARB) -#define glVertexAttrib1dv MANGLE(VertexAttrib1dv) -#define glVertexAttrib1dvNV MANGLE(VertexAttrib1dvNV) -#define glVertexAttrib1fARB MANGLE(VertexAttrib1fARB) -#define glVertexAttrib1f MANGLE(VertexAttrib1f) -#define glVertexAttrib1fNV MANGLE(VertexAttrib1fNV) -#define glVertexAttrib1fvARB MANGLE(VertexAttrib1fvARB) -#define glVertexAttrib1fv MANGLE(VertexAttrib1fv) -#define glVertexAttrib1fvNV MANGLE(VertexAttrib1fvNV) -#define glVertexAttrib1hNV MANGLE(VertexAttrib1hNV) -#define glVertexAttrib1hvNV MANGLE(VertexAttrib1hvNV) -#define glVertexAttrib1sARB MANGLE(VertexAttrib1sARB) -#define glVertexAttrib1s MANGLE(VertexAttrib1s) -#define glVertexAttrib1sNV MANGLE(VertexAttrib1sNV) -#define glVertexAttrib1svARB MANGLE(VertexAttrib1svARB) -#define glVertexAttrib1sv MANGLE(VertexAttrib1sv) -#define glVertexAttrib1svNV MANGLE(VertexAttrib1svNV) -#define glVertexAttrib2dARB MANGLE(VertexAttrib2dARB) -#define glVertexAttrib2d MANGLE(VertexAttrib2d) -#define glVertexAttrib2dNV MANGLE(VertexAttrib2dNV) -#define glVertexAttrib2dvARB MANGLE(VertexAttrib2dvARB) -#define glVertexAttrib2dv MANGLE(VertexAttrib2dv) -#define glVertexAttrib2dvNV MANGLE(VertexAttrib2dvNV) -#define glVertexAttrib2fARB MANGLE(VertexAttrib2fARB) -#define glVertexAttrib2f MANGLE(VertexAttrib2f) -#define glVertexAttrib2fNV MANGLE(VertexAttrib2fNV) -#define glVertexAttrib2fvARB MANGLE(VertexAttrib2fvARB) -#define glVertexAttrib2fv MANGLE(VertexAttrib2fv) -#define glVertexAttrib2fvNV MANGLE(VertexAttrib2fvNV) -#define glVertexAttrib2hNV MANGLE(VertexAttrib2hNV) -#define glVertexAttrib2hvNV MANGLE(VertexAttrib2hvNV) -#define glVertexAttrib2sARB MANGLE(VertexAttrib2sARB) -#define glVertexAttrib2s MANGLE(VertexAttrib2s) -#define glVertexAttrib2sNV MANGLE(VertexAttrib2sNV) -#define glVertexAttrib2svARB MANGLE(VertexAttrib2svARB) -#define glVertexAttrib2sv MANGLE(VertexAttrib2sv) -#define glVertexAttrib2svNV MANGLE(VertexAttrib2svNV) -#define glVertexAttrib3dARB MANGLE(VertexAttrib3dARB) -#define glVertexAttrib3d MANGLE(VertexAttrib3d) -#define glVertexAttrib3dNV MANGLE(VertexAttrib3dNV) -#define glVertexAttrib3dvARB MANGLE(VertexAttrib3dvARB) -#define glVertexAttrib3dv MANGLE(VertexAttrib3dv) -#define glVertexAttrib3dvNV MANGLE(VertexAttrib3dvNV) -#define glVertexAttrib3fARB MANGLE(VertexAttrib3fARB) -#define glVertexAttrib3f MANGLE(VertexAttrib3f) -#define glVertexAttrib3fNV MANGLE(VertexAttrib3fNV) -#define glVertexAttrib3fvARB MANGLE(VertexAttrib3fvARB) -#define glVertexAttrib3fv MANGLE(VertexAttrib3fv) -#define glVertexAttrib3fvNV MANGLE(VertexAttrib3fvNV) -#define glVertexAttrib3hNV MANGLE(VertexAttrib3hNV) -#define glVertexAttrib3hvNV MANGLE(VertexAttrib3hvNV) -#define glVertexAttrib3sARB MANGLE(VertexAttrib3sARB) -#define glVertexAttrib3s MANGLE(VertexAttrib3s) -#define glVertexAttrib3sNV MANGLE(VertexAttrib3sNV) -#define glVertexAttrib3svARB MANGLE(VertexAttrib3svARB) -#define glVertexAttrib3sv MANGLE(VertexAttrib3sv) -#define glVertexAttrib3svNV MANGLE(VertexAttrib3svNV) -#define glVertexAttrib4bvARB MANGLE(VertexAttrib4bvARB) -#define glVertexAttrib4bv MANGLE(VertexAttrib4bv) -#define glVertexAttrib4dARB MANGLE(VertexAttrib4dARB) -#define glVertexAttrib4d MANGLE(VertexAttrib4d) -#define glVertexAttrib4dNV MANGLE(VertexAttrib4dNV) -#define glVertexAttrib4dvARB MANGLE(VertexAttrib4dvARB) -#define glVertexAttrib4dv MANGLE(VertexAttrib4dv) -#define glVertexAttrib4dvNV MANGLE(VertexAttrib4dvNV) -#define glVertexAttrib4fARB MANGLE(VertexAttrib4fARB) -#define glVertexAttrib4f MANGLE(VertexAttrib4f) -#define glVertexAttrib4fNV MANGLE(VertexAttrib4fNV) -#define glVertexAttrib4fvARB MANGLE(VertexAttrib4fvARB) -#define glVertexAttrib4fv MANGLE(VertexAttrib4fv) -#define glVertexAttrib4fvNV MANGLE(VertexAttrib4fvNV) -#define glVertexAttrib4hNV MANGLE(VertexAttrib4hNV) -#define glVertexAttrib4hvNV MANGLE(VertexAttrib4hvNV) -#define glVertexAttrib4ivARB MANGLE(VertexAttrib4ivARB) -#define glVertexAttrib4iv MANGLE(VertexAttrib4iv) -#define glVertexAttrib4NbvARB MANGLE(VertexAttrib4NbvARB) -#define glVertexAttrib4Nbv MANGLE(VertexAttrib4Nbv) -#define glVertexAttrib4NivARB MANGLE(VertexAttrib4NivARB) -#define glVertexAttrib4Niv MANGLE(VertexAttrib4Niv) -#define glVertexAttrib4NsvARB MANGLE(VertexAttrib4NsvARB) -#define glVertexAttrib4Nsv MANGLE(VertexAttrib4Nsv) -#define glVertexAttrib4NubARB MANGLE(VertexAttrib4NubARB) -#define glVertexAttrib4Nub MANGLE(VertexAttrib4Nub) -#define glVertexAttrib4NubvARB MANGLE(VertexAttrib4NubvARB) -#define glVertexAttrib4Nubv MANGLE(VertexAttrib4Nubv) -#define glVertexAttrib4NuivARB MANGLE(VertexAttrib4NuivARB) -#define glVertexAttrib4Nuiv MANGLE(VertexAttrib4Nuiv) -#define glVertexAttrib4NusvARB MANGLE(VertexAttrib4NusvARB) -#define glVertexAttrib4Nusv MANGLE(VertexAttrib4Nusv) -#define glVertexAttrib4sARB MANGLE(VertexAttrib4sARB) -#define glVertexAttrib4s MANGLE(VertexAttrib4s) -#define glVertexAttrib4sNV MANGLE(VertexAttrib4sNV) -#define glVertexAttrib4svARB MANGLE(VertexAttrib4svARB) -#define glVertexAttrib4sv MANGLE(VertexAttrib4sv) -#define glVertexAttrib4svNV MANGLE(VertexAttrib4svNV) -#define glVertexAttrib4ubNV MANGLE(VertexAttrib4ubNV) -#define glVertexAttrib4ubvARB MANGLE(VertexAttrib4ubvARB) -#define glVertexAttrib4ubv MANGLE(VertexAttrib4ubv) -#define glVertexAttrib4ubvNV MANGLE(VertexAttrib4ubvNV) -#define glVertexAttrib4uivARB MANGLE(VertexAttrib4uivARB) -#define glVertexAttrib4uiv MANGLE(VertexAttrib4uiv) -#define glVertexAttrib4usvARB MANGLE(VertexAttrib4usvARB) -#define glVertexAttrib4usv MANGLE(VertexAttrib4usv) -#define glVertexAttribArrayObjectATI MANGLE(VertexAttribArrayObjectATI) -#define glVertexAttribDivisorARB MANGLE(VertexAttribDivisorARB) -#define glVertexAttribDivisor MANGLE(VertexAttribDivisor) -#define glVertexAttribFormatNV MANGLE(VertexAttribFormatNV) -#define glVertexAttribI1iEXT MANGLE(VertexAttribI1iEXT) -#define glVertexAttribI1i MANGLE(VertexAttribI1i) -#define glVertexAttribI1ivEXT MANGLE(VertexAttribI1ivEXT) -#define glVertexAttribI1iv MANGLE(VertexAttribI1iv) -#define glVertexAttribI1uiEXT MANGLE(VertexAttribI1uiEXT) -#define glVertexAttribI1ui MANGLE(VertexAttribI1ui) -#define glVertexAttribI1uivEXT MANGLE(VertexAttribI1uivEXT) -#define glVertexAttribI1uiv MANGLE(VertexAttribI1uiv) -#define glVertexAttribI2iEXT MANGLE(VertexAttribI2iEXT) -#define glVertexAttribI2i MANGLE(VertexAttribI2i) -#define glVertexAttribI2ivEXT MANGLE(VertexAttribI2ivEXT) -#define glVertexAttribI2iv MANGLE(VertexAttribI2iv) -#define glVertexAttribI2uiEXT MANGLE(VertexAttribI2uiEXT) -#define glVertexAttribI2ui MANGLE(VertexAttribI2ui) -#define glVertexAttribI2uivEXT MANGLE(VertexAttribI2uivEXT) -#define glVertexAttribI2uiv MANGLE(VertexAttribI2uiv) -#define glVertexAttribI3iEXT MANGLE(VertexAttribI3iEXT) -#define glVertexAttribI3i MANGLE(VertexAttribI3i) -#define glVertexAttribI3ivEXT MANGLE(VertexAttribI3ivEXT) -#define glVertexAttribI3iv MANGLE(VertexAttribI3iv) -#define glVertexAttribI3uiEXT MANGLE(VertexAttribI3uiEXT) -#define glVertexAttribI3ui MANGLE(VertexAttribI3ui) -#define glVertexAttribI3uivEXT MANGLE(VertexAttribI3uivEXT) -#define glVertexAttribI3uiv MANGLE(VertexAttribI3uiv) -#define glVertexAttribI4bvEXT MANGLE(VertexAttribI4bvEXT) -#define glVertexAttribI4bv MANGLE(VertexAttribI4bv) -#define glVertexAttribI4iEXT MANGLE(VertexAttribI4iEXT) -#define glVertexAttribI4i MANGLE(VertexAttribI4i) -#define glVertexAttribI4ivEXT MANGLE(VertexAttribI4ivEXT) -#define glVertexAttribI4iv MANGLE(VertexAttribI4iv) -#define glVertexAttribI4svEXT MANGLE(VertexAttribI4svEXT) -#define glVertexAttribI4sv MANGLE(VertexAttribI4sv) -#define glVertexAttribI4ubvEXT MANGLE(VertexAttribI4ubvEXT) -#define glVertexAttribI4ubv MANGLE(VertexAttribI4ubv) -#define glVertexAttribI4uiEXT MANGLE(VertexAttribI4uiEXT) -#define glVertexAttribI4ui MANGLE(VertexAttribI4ui) -#define glVertexAttribI4uivEXT MANGLE(VertexAttribI4uivEXT) -#define glVertexAttribI4uiv MANGLE(VertexAttribI4uiv) -#define glVertexAttribI4usvEXT MANGLE(VertexAttribI4usvEXT) -#define glVertexAttribI4usv MANGLE(VertexAttribI4usv) -#define glVertexAttribIFormatNV MANGLE(VertexAttribIFormatNV) -#define glVertexAttribIPointerEXT MANGLE(VertexAttribIPointerEXT) -#define glVertexAttribIPointer MANGLE(VertexAttribIPointer) -#define glVertexAttribL1dEXT MANGLE(VertexAttribL1dEXT) -#define glVertexAttribL1d MANGLE(VertexAttribL1d) -#define glVertexAttribL1dvEXT MANGLE(VertexAttribL1dvEXT) -#define glVertexAttribL1dv MANGLE(VertexAttribL1dv) -#define glVertexAttribL1i64NV MANGLE(VertexAttribL1i64NV) -#define glVertexAttribL1i64vNV MANGLE(VertexAttribL1i64vNV) -#define glVertexAttribL1ui64NV MANGLE(VertexAttribL1ui64NV) -#define glVertexAttribL1ui64vNV MANGLE(VertexAttribL1ui64vNV) -#define glVertexAttribL2dEXT MANGLE(VertexAttribL2dEXT) -#define glVertexAttribL2d MANGLE(VertexAttribL2d) -#define glVertexAttribL2dvEXT MANGLE(VertexAttribL2dvEXT) -#define glVertexAttribL2dv MANGLE(VertexAttribL2dv) -#define glVertexAttribL2i64NV MANGLE(VertexAttribL2i64NV) -#define glVertexAttribL2i64vNV MANGLE(VertexAttribL2i64vNV) -#define glVertexAttribL2ui64NV MANGLE(VertexAttribL2ui64NV) -#define glVertexAttribL2ui64vNV MANGLE(VertexAttribL2ui64vNV) -#define glVertexAttribL3dEXT MANGLE(VertexAttribL3dEXT) -#define glVertexAttribL3d MANGLE(VertexAttribL3d) -#define glVertexAttribL3dvEXT MANGLE(VertexAttribL3dvEXT) -#define glVertexAttribL3dv MANGLE(VertexAttribL3dv) -#define glVertexAttribL3i64NV MANGLE(VertexAttribL3i64NV) -#define glVertexAttribL3i64vNV MANGLE(VertexAttribL3i64vNV) -#define glVertexAttribL3ui64NV MANGLE(VertexAttribL3ui64NV) -#define glVertexAttribL3ui64vNV MANGLE(VertexAttribL3ui64vNV) -#define glVertexAttribL4dEXT MANGLE(VertexAttribL4dEXT) -#define glVertexAttribL4d MANGLE(VertexAttribL4d) -#define glVertexAttribL4dvEXT MANGLE(VertexAttribL4dvEXT) -#define glVertexAttribL4dv MANGLE(VertexAttribL4dv) -#define glVertexAttribL4i64NV MANGLE(VertexAttribL4i64NV) -#define glVertexAttribL4i64vNV MANGLE(VertexAttribL4i64vNV) -#define glVertexAttribL4ui64NV MANGLE(VertexAttribL4ui64NV) -#define glVertexAttribL4ui64vNV MANGLE(VertexAttribL4ui64vNV) -#define glVertexAttribLFormatNV MANGLE(VertexAttribLFormatNV) -#define glVertexAttribLPointerEXT MANGLE(VertexAttribLPointerEXT) -#define glVertexAttribLPointer MANGLE(VertexAttribLPointer) -#define glVertexAttribP1ui MANGLE(VertexAttribP1ui) -#define glVertexAttribP1uiv MANGLE(VertexAttribP1uiv) -#define glVertexAttribP2ui MANGLE(VertexAttribP2ui) -#define glVertexAttribP2uiv MANGLE(VertexAttribP2uiv) -#define glVertexAttribP3ui MANGLE(VertexAttribP3ui) -#define glVertexAttribP3uiv MANGLE(VertexAttribP3uiv) -#define glVertexAttribP4ui MANGLE(VertexAttribP4ui) -#define glVertexAttribP4uiv MANGLE(VertexAttribP4uiv) -#define glVertexAttribPointerARB MANGLE(VertexAttribPointerARB) -#define glVertexAttribPointer MANGLE(VertexAttribPointer) -#define glVertexAttribPointerNV MANGLE(VertexAttribPointerNV) -#define glVertexAttribs1dvNV MANGLE(VertexAttribs1dvNV) -#define glVertexAttribs1fvNV MANGLE(VertexAttribs1fvNV) -#define glVertexAttribs1hvNV MANGLE(VertexAttribs1hvNV) -#define glVertexAttribs1svNV MANGLE(VertexAttribs1svNV) -#define glVertexAttribs2dvNV MANGLE(VertexAttribs2dvNV) -#define glVertexAttribs2fvNV MANGLE(VertexAttribs2fvNV) -#define glVertexAttribs2hvNV MANGLE(VertexAttribs2hvNV) -#define glVertexAttribs2svNV MANGLE(VertexAttribs2svNV) -#define glVertexAttribs3dvNV MANGLE(VertexAttribs3dvNV) -#define glVertexAttribs3fvNV MANGLE(VertexAttribs3fvNV) -#define glVertexAttribs3hvNV MANGLE(VertexAttribs3hvNV) -#define glVertexAttribs3svNV MANGLE(VertexAttribs3svNV) -#define glVertexAttribs4dvNV MANGLE(VertexAttribs4dvNV) -#define glVertexAttribs4fvNV MANGLE(VertexAttribs4fvNV) -#define glVertexAttribs4hvNV MANGLE(VertexAttribs4hvNV) -#define glVertexAttribs4svNV MANGLE(VertexAttribs4svNV) -#define glVertexAttribs4ubvNV MANGLE(VertexAttribs4ubvNV) -#define glVertexBlendARB MANGLE(VertexBlendARB) -#define glVertexBlendEnvfATI MANGLE(VertexBlendEnvfATI) -#define glVertexBlendEnviATI MANGLE(VertexBlendEnviATI) -#define glVertexFormatNV MANGLE(VertexFormatNV) -#define glVertexP2ui MANGLE(VertexP2ui) -#define glVertexP2uiv MANGLE(VertexP2uiv) -#define glVertexP3ui MANGLE(VertexP3ui) -#define glVertexP3uiv MANGLE(VertexP3uiv) -#define glVertexP4ui MANGLE(VertexP4ui) -#define glVertexP4uiv MANGLE(VertexP4uiv) -#define glVertexPointerEXT MANGLE(VertexPointerEXT) -#define glVertexPointerListIBM MANGLE(VertexPointerListIBM) -#define glVertexPointer MANGLE(VertexPointer) -#define glVertexPointervINTEL MANGLE(VertexPointervINTEL) -#define glVertexStream1dATI MANGLE(VertexStream1dATI) -#define glVertexStream1dvATI MANGLE(VertexStream1dvATI) -#define glVertexStream1fATI MANGLE(VertexStream1fATI) -#define glVertexStream1fvATI MANGLE(VertexStream1fvATI) -#define glVertexStream1iATI MANGLE(VertexStream1iATI) -#define glVertexStream1ivATI MANGLE(VertexStream1ivATI) -#define glVertexStream1sATI MANGLE(VertexStream1sATI) -#define glVertexStream1svATI MANGLE(VertexStream1svATI) -#define glVertexStream2dATI MANGLE(VertexStream2dATI) -#define glVertexStream2dvATI MANGLE(VertexStream2dvATI) -#define glVertexStream2fATI MANGLE(VertexStream2fATI) -#define glVertexStream2fvATI MANGLE(VertexStream2fvATI) -#define glVertexStream2iATI MANGLE(VertexStream2iATI) -#define glVertexStream2ivATI MANGLE(VertexStream2ivATI) -#define glVertexStream2sATI MANGLE(VertexStream2sATI) -#define glVertexStream2svATI MANGLE(VertexStream2svATI) -#define glVertexStream3dATI MANGLE(VertexStream3dATI) -#define glVertexStream3dvATI MANGLE(VertexStream3dvATI) -#define glVertexStream3fATI MANGLE(VertexStream3fATI) -#define glVertexStream3fvATI MANGLE(VertexStream3fvATI) -#define glVertexStream3iATI MANGLE(VertexStream3iATI) -#define glVertexStream3ivATI MANGLE(VertexStream3ivATI) -#define glVertexStream3sATI MANGLE(VertexStream3sATI) -#define glVertexStream3svATI MANGLE(VertexStream3svATI) -#define glVertexStream4dATI MANGLE(VertexStream4dATI) -#define glVertexStream4dvATI MANGLE(VertexStream4dvATI) -#define glVertexStream4fATI MANGLE(VertexStream4fATI) -#define glVertexStream4fvATI MANGLE(VertexStream4fvATI) -#define glVertexStream4iATI MANGLE(VertexStream4iATI) -#define glVertexStream4ivATI MANGLE(VertexStream4ivATI) -#define glVertexStream4sATI MANGLE(VertexStream4sATI) -#define glVertexStream4svATI MANGLE(VertexStream4svATI) -#define glVertexWeightfEXT MANGLE(VertexWeightfEXT) -#define glVertexWeightfvEXT MANGLE(VertexWeightfvEXT) -#define glVertexWeighthNV MANGLE(VertexWeighthNV) -#define glVertexWeighthvNV MANGLE(VertexWeighthvNV) -#define glVertexWeightPointerEXT MANGLE(VertexWeightPointerEXT) -#define glVideoCaptureNV MANGLE(VideoCaptureNV) -#define glVideoCaptureStreamParameterdvNV MANGLE(VideoCaptureStreamParameterdvNV) -#define glVideoCaptureStreamParameterfvNV MANGLE(VideoCaptureStreamParameterfvNV) -#define glVideoCaptureStreamParameterivNV MANGLE(VideoCaptureStreamParameterivNV) -#define glViewportArrayv MANGLE(ViewportArrayv) -#define glViewportIndexedf MANGLE(ViewportIndexedf) -#define glViewportIndexedfv MANGLE(ViewportIndexedfv) -#define glViewport MANGLE(Viewport) -#define glWaitSync MANGLE(WaitSync) -#define glWeightbvARB MANGLE(WeightbvARB) -#define glWeightdvARB MANGLE(WeightdvARB) -#define glWeightfvARB MANGLE(WeightfvARB) -#define glWeightivARB MANGLE(WeightivARB) -#define glWeightPointerARB MANGLE(WeightPointerARB) -#define glWeightsvARB MANGLE(WeightsvARB) -#define glWeightubvARB MANGLE(WeightubvARB) -#define glWeightuivARB MANGLE(WeightuivARB) -#define glWeightusvARB MANGLE(WeightusvARB) -#define glWindowPos2dARB MANGLE(WindowPos2dARB) -#define glWindowPos2d MANGLE(WindowPos2d) -#define glWindowPos2dMESA MANGLE(WindowPos2dMESA) -#define glWindowPos2dvARB MANGLE(WindowPos2dvARB) -#define glWindowPos2dv MANGLE(WindowPos2dv) -#define glWindowPos2dvMESA MANGLE(WindowPos2dvMESA) -#define glWindowPos2fARB MANGLE(WindowPos2fARB) -#define glWindowPos2f MANGLE(WindowPos2f) -#define glWindowPos2fMESA MANGLE(WindowPos2fMESA) -#define glWindowPos2fvARB MANGLE(WindowPos2fvARB) -#define glWindowPos2fv MANGLE(WindowPos2fv) -#define glWindowPos2fvMESA MANGLE(WindowPos2fvMESA) -#define glWindowPos2iARB MANGLE(WindowPos2iARB) -#define glWindowPos2i MANGLE(WindowPos2i) -#define glWindowPos2iMESA MANGLE(WindowPos2iMESA) -#define glWindowPos2ivARB MANGLE(WindowPos2ivARB) -#define glWindowPos2iv MANGLE(WindowPos2iv) -#define glWindowPos2ivMESA MANGLE(WindowPos2ivMESA) -#define glWindowPos2sARB MANGLE(WindowPos2sARB) -#define glWindowPos2s MANGLE(WindowPos2s) -#define glWindowPos2sMESA MANGLE(WindowPos2sMESA) -#define glWindowPos2svARB MANGLE(WindowPos2svARB) -#define glWindowPos2sv MANGLE(WindowPos2sv) -#define glWindowPos2svMESA MANGLE(WindowPos2svMESA) -#define glWindowPos3dARB MANGLE(WindowPos3dARB) -#define glWindowPos3d MANGLE(WindowPos3d) -#define glWindowPos3dMESA MANGLE(WindowPos3dMESA) -#define glWindowPos3dvARB MANGLE(WindowPos3dvARB) -#define glWindowPos3dv MANGLE(WindowPos3dv) -#define glWindowPos3dvMESA MANGLE(WindowPos3dvMESA) -#define glWindowPos3fARB MANGLE(WindowPos3fARB) -#define glWindowPos3f MANGLE(WindowPos3f) -#define glWindowPos3fMESA MANGLE(WindowPos3fMESA) -#define glWindowPos3fvARB MANGLE(WindowPos3fvARB) -#define glWindowPos3fv MANGLE(WindowPos3fv) -#define glWindowPos3fvMESA MANGLE(WindowPos3fvMESA) -#define glWindowPos3iARB MANGLE(WindowPos3iARB) -#define glWindowPos3i MANGLE(WindowPos3i) -#define glWindowPos3iMESA MANGLE(WindowPos3iMESA) -#define glWindowPos3ivARB MANGLE(WindowPos3ivARB) -#define glWindowPos3iv MANGLE(WindowPos3iv) -#define glWindowPos3ivMESA MANGLE(WindowPos3ivMESA) -#define glWindowPos3sARB MANGLE(WindowPos3sARB) -#define glWindowPos3s MANGLE(WindowPos3s) -#define glWindowPos3sMESA MANGLE(WindowPos3sMESA) -#define glWindowPos3svARB MANGLE(WindowPos3svARB) -#define glWindowPos3sv MANGLE(WindowPos3sv) -#define glWindowPos3svMESA MANGLE(WindowPos3svMESA) -#define glWindowPos4dMESA MANGLE(WindowPos4dMESA) -#define glWindowPos4dvMESA MANGLE(WindowPos4dvMESA) -#define glWindowPos4fMESA MANGLE(WindowPos4fMESA) -#define glWindowPos4fvMESA MANGLE(WindowPos4fvMESA) -#define glWindowPos4iMESA MANGLE(WindowPos4iMESA) -#define glWindowPos4ivMESA MANGLE(WindowPos4ivMESA) -#define glWindowPos4sMESA MANGLE(WindowPos4sMESA) -#define glWindowPos4svMESA MANGLE(WindowPos4svMESA) -#define glWriteMaskEXT MANGLE(WriteMaskEXT) - -#endif /* GL_MANGLE_H */ +#if 0 +#define GL_MANGLE_C1 "DO NOT EDIT!!! - TO REGENERATE from gl.h, EXECUTE THIS FILE IN SHELL (/bin/sh) and save the output" +#define GL_MANGLE_C2 "This file is used to create GL function protypes and aliases for the function names" + files="gl.h glext.h" +#define GL_MANGLE_C3 "get regeneration header - copy everything in this file above the 'REGENERATE_TO_END' line" + awk '!done; /^\/\*REGENERATE_TO_END/ {done=1}' $0 + echo "" +#define GL_MANGLE_C4 get aliases + grep '^GLAPI' $files | sed -e 's/.*ENTRY gl\([^( ]*\).*$/#define gl\1 MANGLE(\1)/' | sort | uniq + echo "" + echo "#endif /* GL_MANGLE_H */" + exit +#endif /* REGENERATION */ + +/* + * If you compile Mesa with USE_MGL_NAMESPACE defined then you can link + * your application both with OpenGL and Mesa. The Mesa functions will + * be redefined so they are prefixed with "mgl" instead of "gl". + * Mgl contributed by Randy Frank (rfrank@rsinc.com) + * Regneration code contributed by Ray Tice (rayt@ma.ultra.net) + */ + +#ifndef GL_MANGLE_H +#define GL_MANGLE_H + +#ifndef MANGLE +#define MANGLE(x) mgl##x +#endif /*MANGLE*/ + +/*REGENERATE_TO_END-----------ALL LINES BELOW HERE GET REPLACED ON REGENERATION */ + +#define glAccum MANGLE(Accum) +#define glActiveProgramEXT MANGLE(ActiveProgramEXT) +#define glActiveShaderProgram MANGLE(ActiveShaderProgram) +#define glActiveStencilFaceEXT MANGLE(ActiveStencilFaceEXT) +#define glActiveTextureARB MANGLE(ActiveTextureARB) +#define glActiveTexture MANGLE(ActiveTexture) +#define glActiveVaryingNV MANGLE(ActiveVaryingNV) +#define glAlphaFragmentOp1ATI MANGLE(AlphaFragmentOp1ATI) +#define glAlphaFragmentOp2ATI MANGLE(AlphaFragmentOp2ATI) +#define glAlphaFragmentOp3ATI MANGLE(AlphaFragmentOp3ATI) +#define glAlphaFunc MANGLE(AlphaFunc) +#define glApplyTextureEXT MANGLE(ApplyTextureEXT) +#define glAreProgramsResidentNV MANGLE(AreProgramsResidentNV) +#define glAreTexturesResidentEXT MANGLE(AreTexturesResidentEXT) +#define glAreTexturesResident MANGLE(AreTexturesResident) +#define glArrayElementEXT MANGLE(ArrayElementEXT) +#define glArrayElement MANGLE(ArrayElement) +#define glArrayObjectATI MANGLE(ArrayObjectATI) +#define glAsyncMarkerSGIX MANGLE(AsyncMarkerSGIX) +#define glAttachObjectARB MANGLE(AttachObjectARB) +#define glAttachShader MANGLE(AttachShader) +#define glBeginConditionalRender MANGLE(BeginConditionalRender) +#define glBeginConditionalRenderNV MANGLE(BeginConditionalRenderNV) +#define glBeginFragmentShaderATI MANGLE(BeginFragmentShaderATI) +#define glBegin MANGLE(Begin) +#define glBeginOcclusionQueryNV MANGLE(BeginOcclusionQueryNV) +#define glBeginPerfMonitorAMD MANGLE(BeginPerfMonitorAMD) +#define glBeginQueryARB MANGLE(BeginQueryARB) +#define glBeginQueryIndexed MANGLE(BeginQueryIndexed) +#define glBeginQuery MANGLE(BeginQuery) +#define glBeginTransformFeedbackEXT MANGLE(BeginTransformFeedbackEXT) +#define glBeginTransformFeedback MANGLE(BeginTransformFeedback) +#define glBeginTransformFeedbackNV MANGLE(BeginTransformFeedbackNV) +#define glBeginVertexShaderEXT MANGLE(BeginVertexShaderEXT) +#define glBeginVideoCaptureNV MANGLE(BeginVideoCaptureNV) +#define glBindAttribLocationARB MANGLE(BindAttribLocationARB) +#define glBindAttribLocation MANGLE(BindAttribLocation) +#define glBindBufferARB MANGLE(BindBufferARB) +#define glBindBufferBaseEXT MANGLE(BindBufferBaseEXT) +#define glBindBufferBase MANGLE(BindBufferBase) +#define glBindBufferBaseNV MANGLE(BindBufferBaseNV) +#define glBindBuffer MANGLE(BindBuffer) +#define glBindBufferOffsetEXT MANGLE(BindBufferOffsetEXT) +#define glBindBufferOffsetNV MANGLE(BindBufferOffsetNV) +#define glBindBufferRangeEXT MANGLE(BindBufferRangeEXT) +#define glBindBufferRange MANGLE(BindBufferRange) +#define glBindBufferRangeNV MANGLE(BindBufferRangeNV) +#define glBindFragDataLocationEXT MANGLE(BindFragDataLocationEXT) +#define glBindFragDataLocationIndexed MANGLE(BindFragDataLocationIndexed) +#define glBindFragDataLocation MANGLE(BindFragDataLocation) +#define glBindFragmentShaderATI MANGLE(BindFragmentShaderATI) +#define glBindFramebufferEXT MANGLE(BindFramebufferEXT) +#define glBindFramebuffer MANGLE(BindFramebuffer) +#define glBindImageTextureEXT MANGLE(BindImageTextureEXT) +#define glBindLightParameterEXT MANGLE(BindLightParameterEXT) +#define glBindMaterialParameterEXT MANGLE(BindMaterialParameterEXT) +#define glBindMultiTextureEXT MANGLE(BindMultiTextureEXT) +#define glBindParameterEXT MANGLE(BindParameterEXT) +#define glBindProgramARB MANGLE(BindProgramARB) +#define glBindProgramNV MANGLE(BindProgramNV) +#define glBindProgramPipeline MANGLE(BindProgramPipeline) +#define glBindRenderbufferEXT MANGLE(BindRenderbufferEXT) +#define glBindRenderbuffer MANGLE(BindRenderbuffer) +#define glBindSampler MANGLE(BindSampler) +#define glBindTexGenParameterEXT MANGLE(BindTexGenParameterEXT) +#define glBindTextureEXT MANGLE(BindTextureEXT) +#define glBindTexture MANGLE(BindTexture) +#define glBindTextureUnitParameterEXT MANGLE(BindTextureUnitParameterEXT) +#define glBindTransformFeedback MANGLE(BindTransformFeedback) +#define glBindTransformFeedbackNV MANGLE(BindTransformFeedbackNV) +#define glBindVertexArrayAPPLE MANGLE(BindVertexArrayAPPLE) +#define glBindVertexArray MANGLE(BindVertexArray) +#define glBindVertexShaderEXT MANGLE(BindVertexShaderEXT) +#define glBindVideoCaptureStreamBufferNV MANGLE(BindVideoCaptureStreamBufferNV) +#define glBindVideoCaptureStreamTextureNV MANGLE(BindVideoCaptureStreamTextureNV) +#define glBinormal3bEXT MANGLE(Binormal3bEXT) +#define glBinormal3bvEXT MANGLE(Binormal3bvEXT) +#define glBinormal3dEXT MANGLE(Binormal3dEXT) +#define glBinormal3dvEXT MANGLE(Binormal3dvEXT) +#define glBinormal3fEXT MANGLE(Binormal3fEXT) +#define glBinormal3fvEXT MANGLE(Binormal3fvEXT) +#define glBinormal3iEXT MANGLE(Binormal3iEXT) +#define glBinormal3ivEXT MANGLE(Binormal3ivEXT) +#define glBinormal3sEXT MANGLE(Binormal3sEXT) +#define glBinormal3svEXT MANGLE(Binormal3svEXT) +#define glBinormalPointerEXT MANGLE(BinormalPointerEXT) +#define glBitmap MANGLE(Bitmap) +#define glBlendColorEXT MANGLE(BlendColorEXT) +#define glBlendColor MANGLE(BlendColor) +#define glBlendEquationEXT MANGLE(BlendEquationEXT) +#define glBlendEquationiARB MANGLE(BlendEquationiARB) +#define glBlendEquationi MANGLE(BlendEquationi) +#define glBlendEquationIndexedAMD MANGLE(BlendEquationIndexedAMD) +#define glBlendEquation MANGLE(BlendEquation) +#define glBlendEquationSeparateATI MANGLE(BlendEquationSeparateATI) +#define glBlendEquationSeparateEXT MANGLE(BlendEquationSeparateEXT) +#define glBlendEquationSeparateiARB MANGLE(BlendEquationSeparateiARB) +#define glBlendEquationSeparatei MANGLE(BlendEquationSeparatei) +#define glBlendEquationSeparateIndexedAMD MANGLE(BlendEquationSeparateIndexedAMD) +#define glBlendEquationSeparate MANGLE(BlendEquationSeparate) +#define glBlendFunciARB MANGLE(BlendFunciARB) +#define glBlendFunci MANGLE(BlendFunci) +#define glBlendFuncIndexedAMD MANGLE(BlendFuncIndexedAMD) +#define glBlendFunc MANGLE(BlendFunc) +#define glBlendFuncSeparateEXT MANGLE(BlendFuncSeparateEXT) +#define glBlendFuncSeparateiARB MANGLE(BlendFuncSeparateiARB) +#define glBlendFuncSeparatei MANGLE(BlendFuncSeparatei) +#define glBlendFuncSeparateIndexedAMD MANGLE(BlendFuncSeparateIndexedAMD) +#define glBlendFuncSeparateINGR MANGLE(BlendFuncSeparateINGR) +#define glBlendFuncSeparate MANGLE(BlendFuncSeparate) +#define glBlitFramebufferEXT MANGLE(BlitFramebufferEXT) +#define glBlitFramebuffer MANGLE(BlitFramebuffer) +#define glBufferAddressRangeNV MANGLE(BufferAddressRangeNV) +#define glBufferDataARB MANGLE(BufferDataARB) +#define glBufferData MANGLE(BufferData) +#define glBufferParameteriAPPLE MANGLE(BufferParameteriAPPLE) +#define glBufferSubDataARB MANGLE(BufferSubDataARB) +#define glBufferSubData MANGLE(BufferSubData) +#define glCallList MANGLE(CallList) +#define glCallLists MANGLE(CallLists) +#define glCheckFramebufferStatusEXT MANGLE(CheckFramebufferStatusEXT) +#define glCheckFramebufferStatus MANGLE(CheckFramebufferStatus) +#define glCheckNamedFramebufferStatusEXT MANGLE(CheckNamedFramebufferStatusEXT) +#define glClampColorARB MANGLE(ClampColorARB) +#define glClampColor MANGLE(ClampColor) +#define glClearAccum MANGLE(ClearAccum) +#define glClearBufferfi MANGLE(ClearBufferfi) +#define glClearBufferfv MANGLE(ClearBufferfv) +#define glClearBufferiv MANGLE(ClearBufferiv) +#define glClearBufferuiv MANGLE(ClearBufferuiv) +#define glClearColorIiEXT MANGLE(ClearColorIiEXT) +#define glClearColorIuiEXT MANGLE(ClearColorIuiEXT) +#define glClearColor MANGLE(ClearColor) +#define glClearDebugLogMESA MANGLE(ClearDebugLogMESA) +#define glClearDepthdNV MANGLE(ClearDepthdNV) +#define glClearDepthf MANGLE(ClearDepthf) +#define glClearDepth MANGLE(ClearDepth) +#define glClearIndex MANGLE(ClearIndex) +#define glClear MANGLE(Clear) +#define glClearStencil MANGLE(ClearStencil) +#define glClientActiveTextureARB MANGLE(ClientActiveTextureARB) +#define glClientActiveTexture MANGLE(ClientActiveTexture) +#define glClientActiveVertexStreamATI MANGLE(ClientActiveVertexStreamATI) +#define glClientAttribDefaultEXT MANGLE(ClientAttribDefaultEXT) +#define glClientWaitSync MANGLE(ClientWaitSync) +#define glClipPlane MANGLE(ClipPlane) +#define glColor3b MANGLE(Color3b) +#define glColor3bv MANGLE(Color3bv) +#define glColor3d MANGLE(Color3d) +#define glColor3dv MANGLE(Color3dv) +#define glColor3f MANGLE(Color3f) +#define glColor3fVertex3fSUN MANGLE(Color3fVertex3fSUN) +#define glColor3fVertex3fvSUN MANGLE(Color3fVertex3fvSUN) +#define glColor3fv MANGLE(Color3fv) +#define glColor3hNV MANGLE(Color3hNV) +#define glColor3hvNV MANGLE(Color3hvNV) +#define glColor3i MANGLE(Color3i) +#define glColor3iv MANGLE(Color3iv) +#define glColor3s MANGLE(Color3s) +#define glColor3sv MANGLE(Color3sv) +#define glColor3ub MANGLE(Color3ub) +#define glColor3ubv MANGLE(Color3ubv) +#define glColor3ui MANGLE(Color3ui) +#define glColor3uiv MANGLE(Color3uiv) +#define glColor3us MANGLE(Color3us) +#define glColor3usv MANGLE(Color3usv) +#define glColor4b MANGLE(Color4b) +#define glColor4bv MANGLE(Color4bv) +#define glColor4d MANGLE(Color4d) +#define glColor4dv MANGLE(Color4dv) +#define glColor4f MANGLE(Color4f) +#define glColor4fNormal3fVertex3fSUN MANGLE(Color4fNormal3fVertex3fSUN) +#define glColor4fNormal3fVertex3fvSUN MANGLE(Color4fNormal3fVertex3fvSUN) +#define glColor4fv MANGLE(Color4fv) +#define glColor4hNV MANGLE(Color4hNV) +#define glColor4hvNV MANGLE(Color4hvNV) +#define glColor4i MANGLE(Color4i) +#define glColor4iv MANGLE(Color4iv) +#define glColor4s MANGLE(Color4s) +#define glColor4sv MANGLE(Color4sv) +#define glColor4ub MANGLE(Color4ub) +#define glColor4ubVertex2fSUN MANGLE(Color4ubVertex2fSUN) +#define glColor4ubVertex2fvSUN MANGLE(Color4ubVertex2fvSUN) +#define glColor4ubVertex3fSUN MANGLE(Color4ubVertex3fSUN) +#define glColor4ubVertex3fvSUN MANGLE(Color4ubVertex3fvSUN) +#define glColor4ubv MANGLE(Color4ubv) +#define glColor4ui MANGLE(Color4ui) +#define glColor4uiv MANGLE(Color4uiv) +#define glColor4us MANGLE(Color4us) +#define glColor4usv MANGLE(Color4usv) +#define glColorFormatNV MANGLE(ColorFormatNV) +#define glColorFragmentOp1ATI MANGLE(ColorFragmentOp1ATI) +#define glColorFragmentOp2ATI MANGLE(ColorFragmentOp2ATI) +#define glColorFragmentOp3ATI MANGLE(ColorFragmentOp3ATI) +#define glColorMaski MANGLE(ColorMaski) +#define glColorMaskIndexedEXT MANGLE(ColorMaskIndexedEXT) +#define glColorMask MANGLE(ColorMask) +#define glColorMaterial MANGLE(ColorMaterial) +#define glColorP3ui MANGLE(ColorP3ui) +#define glColorP3uiv MANGLE(ColorP3uiv) +#define glColorP4ui MANGLE(ColorP4ui) +#define glColorP4uiv MANGLE(ColorP4uiv) +#define glColorPointerEXT MANGLE(ColorPointerEXT) +#define glColorPointerListIBM MANGLE(ColorPointerListIBM) +#define glColorPointer MANGLE(ColorPointer) +#define glColorPointervINTEL MANGLE(ColorPointervINTEL) +#define glColorSubTableEXT MANGLE(ColorSubTableEXT) +#define glColorSubTable MANGLE(ColorSubTable) +#define glColorTableEXT MANGLE(ColorTableEXT) +#define glColorTable MANGLE(ColorTable) +#define glColorTableParameterfv MANGLE(ColorTableParameterfv) +#define glColorTableParameterfvSGI MANGLE(ColorTableParameterfvSGI) +#define glColorTableParameteriv MANGLE(ColorTableParameteriv) +#define glColorTableParameterivSGI MANGLE(ColorTableParameterivSGI) +#define glColorTableSGI MANGLE(ColorTableSGI) +#define glCombinerInputNV MANGLE(CombinerInputNV) +#define glCombinerOutputNV MANGLE(CombinerOutputNV) +#define glCombinerParameterfNV MANGLE(CombinerParameterfNV) +#define glCombinerParameterfvNV MANGLE(CombinerParameterfvNV) +#define glCombinerParameteriNV MANGLE(CombinerParameteriNV) +#define glCombinerParameterivNV MANGLE(CombinerParameterivNV) +#define glCombinerStageParameterfvNV MANGLE(CombinerStageParameterfvNV) +#define glCompileShaderARB MANGLE(CompileShaderARB) +#define glCompileShaderIncludeARB MANGLE(CompileShaderIncludeARB) +#define glCompileShader MANGLE(CompileShader) +#define glCompressedMultiTexImage1DEXT MANGLE(CompressedMultiTexImage1DEXT) +#define glCompressedMultiTexImage2DEXT MANGLE(CompressedMultiTexImage2DEXT) +#define glCompressedMultiTexImage3DEXT MANGLE(CompressedMultiTexImage3DEXT) +#define glCompressedMultiTexSubImage1DEXT MANGLE(CompressedMultiTexSubImage1DEXT) +#define glCompressedMultiTexSubImage2DEXT MANGLE(CompressedMultiTexSubImage2DEXT) +#define glCompressedMultiTexSubImage3DEXT MANGLE(CompressedMultiTexSubImage3DEXT) +#define glCompressedTexImage1DARB MANGLE(CompressedTexImage1DARB) +#define glCompressedTexImage1D MANGLE(CompressedTexImage1D) +#define glCompressedTexImage2DARB MANGLE(CompressedTexImage2DARB) +#define glCompressedTexImage2D MANGLE(CompressedTexImage2D) +#define glCompressedTexImage3DARB MANGLE(CompressedTexImage3DARB) +#define glCompressedTexImage3D MANGLE(CompressedTexImage3D) +#define glCompressedTexSubImage1DARB MANGLE(CompressedTexSubImage1DARB) +#define glCompressedTexSubImage1D MANGLE(CompressedTexSubImage1D) +#define glCompressedTexSubImage2DARB MANGLE(CompressedTexSubImage2DARB) +#define glCompressedTexSubImage2D MANGLE(CompressedTexSubImage2D) +#define glCompressedTexSubImage3DARB MANGLE(CompressedTexSubImage3DARB) +#define glCompressedTexSubImage3D MANGLE(CompressedTexSubImage3D) +#define glCompressedTextureImage1DEXT MANGLE(CompressedTextureImage1DEXT) +#define glCompressedTextureImage2DEXT MANGLE(CompressedTextureImage2DEXT) +#define glCompressedTextureImage3DEXT MANGLE(CompressedTextureImage3DEXT) +#define glCompressedTextureSubImage1DEXT MANGLE(CompressedTextureSubImage1DEXT) +#define glCompressedTextureSubImage2DEXT MANGLE(CompressedTextureSubImage2DEXT) +#define glCompressedTextureSubImage3DEXT MANGLE(CompressedTextureSubImage3DEXT) +#define glConvolutionFilter1DEXT MANGLE(ConvolutionFilter1DEXT) +#define glConvolutionFilter1D MANGLE(ConvolutionFilter1D) +#define glConvolutionFilter2DEXT MANGLE(ConvolutionFilter2DEXT) +#define glConvolutionFilter2D MANGLE(ConvolutionFilter2D) +#define glConvolutionParameterfEXT MANGLE(ConvolutionParameterfEXT) +#define glConvolutionParameterf MANGLE(ConvolutionParameterf) +#define glConvolutionParameterfvEXT MANGLE(ConvolutionParameterfvEXT) +#define glConvolutionParameterfv MANGLE(ConvolutionParameterfv) +#define glConvolutionParameteriEXT MANGLE(ConvolutionParameteriEXT) +#define glConvolutionParameteri MANGLE(ConvolutionParameteri) +#define glConvolutionParameterivEXT MANGLE(ConvolutionParameterivEXT) +#define glConvolutionParameteriv MANGLE(ConvolutionParameteriv) +#define glCopyBufferSubData MANGLE(CopyBufferSubData) +#define glCopyColorSubTableEXT MANGLE(CopyColorSubTableEXT) +#define glCopyColorSubTable MANGLE(CopyColorSubTable) +#define glCopyColorTable MANGLE(CopyColorTable) +#define glCopyColorTableSGI MANGLE(CopyColorTableSGI) +#define glCopyConvolutionFilter1DEXT MANGLE(CopyConvolutionFilter1DEXT) +#define glCopyConvolutionFilter1D MANGLE(CopyConvolutionFilter1D) +#define glCopyConvolutionFilter2DEXT MANGLE(CopyConvolutionFilter2DEXT) +#define glCopyConvolutionFilter2D MANGLE(CopyConvolutionFilter2D) +#define glCopyImageSubDataNV MANGLE(CopyImageSubDataNV) +#define glCopyMultiTexImage1DEXT MANGLE(CopyMultiTexImage1DEXT) +#define glCopyMultiTexImage2DEXT MANGLE(CopyMultiTexImage2DEXT) +#define glCopyMultiTexSubImage1DEXT MANGLE(CopyMultiTexSubImage1DEXT) +#define glCopyMultiTexSubImage2DEXT MANGLE(CopyMultiTexSubImage2DEXT) +#define glCopyMultiTexSubImage3DEXT MANGLE(CopyMultiTexSubImage3DEXT) +#define glCopyPixels MANGLE(CopyPixels) +#define glCopyTexImage1DEXT MANGLE(CopyTexImage1DEXT) +#define glCopyTexImage1D MANGLE(CopyTexImage1D) +#define glCopyTexImage2DEXT MANGLE(CopyTexImage2DEXT) +#define glCopyTexImage2D MANGLE(CopyTexImage2D) +#define glCopyTexSubImage1DEXT MANGLE(CopyTexSubImage1DEXT) +#define glCopyTexSubImage1D MANGLE(CopyTexSubImage1D) +#define glCopyTexSubImage2DEXT MANGLE(CopyTexSubImage2DEXT) +#define glCopyTexSubImage2D MANGLE(CopyTexSubImage2D) +#define glCopyTexSubImage3DEXT MANGLE(CopyTexSubImage3DEXT) +#define glCopyTexSubImage3D MANGLE(CopyTexSubImage3D) +#define glCopyTextureImage1DEXT MANGLE(CopyTextureImage1DEXT) +#define glCopyTextureImage2DEXT MANGLE(CopyTextureImage2DEXT) +#define glCopyTextureSubImage1DEXT MANGLE(CopyTextureSubImage1DEXT) +#define glCopyTextureSubImage2DEXT MANGLE(CopyTextureSubImage2DEXT) +#define glCopyTextureSubImage3DEXT MANGLE(CopyTextureSubImage3DEXT) +#define glCreateDebugObjectMESA MANGLE(CreateDebugObjectMESA) +#define glCreateProgram MANGLE(CreateProgram) +#define glCreateProgramObjectARB MANGLE(CreateProgramObjectARB) +#define glCreateShader MANGLE(CreateShader) +#define glCreateShaderObjectARB MANGLE(CreateShaderObjectARB) +#define glCreateShaderProgramEXT MANGLE(CreateShaderProgramEXT) +#define glCreateShaderProgramv MANGLE(CreateShaderProgramv) +#define glCreateSyncFromCLeventARB MANGLE(CreateSyncFromCLeventARB) +#define glCullFace MANGLE(CullFace) +#define glCullParameterdvEXT MANGLE(CullParameterdvEXT) +#define glCullParameterfvEXT MANGLE(CullParameterfvEXT) +#define glCurrentPaletteMatrixARB MANGLE(CurrentPaletteMatrixARB) +#define glDebugMessageCallbackAMD MANGLE(DebugMessageCallbackAMD) +#define glDebugMessageCallbackARB MANGLE(DebugMessageCallbackARB) +#define glDebugMessageControlARB MANGLE(DebugMessageControlARB) +#define glDebugMessageEnableAMD MANGLE(DebugMessageEnableAMD) +#define glDebugMessageInsertAMD MANGLE(DebugMessageInsertAMD) +#define glDebugMessageInsertARB MANGLE(DebugMessageInsertARB) +#define glDeformationMap3dSGIX MANGLE(DeformationMap3dSGIX) +#define glDeformationMap3fSGIX MANGLE(DeformationMap3fSGIX) +#define glDeformSGIX MANGLE(DeformSGIX) +#define glDeleteAsyncMarkersSGIX MANGLE(DeleteAsyncMarkersSGIX) +#define glDeleteBuffersARB MANGLE(DeleteBuffersARB) +#define glDeleteBuffers MANGLE(DeleteBuffers) +#define glDeleteFencesAPPLE MANGLE(DeleteFencesAPPLE) +#define glDeleteFencesNV MANGLE(DeleteFencesNV) +#define glDeleteFragmentShaderATI MANGLE(DeleteFragmentShaderATI) +#define glDeleteFramebuffersEXT MANGLE(DeleteFramebuffersEXT) +#define glDeleteFramebuffers MANGLE(DeleteFramebuffers) +#define glDeleteLists MANGLE(DeleteLists) +#define glDeleteNamedStringARB MANGLE(DeleteNamedStringARB) +#define glDeleteNamesAMD MANGLE(DeleteNamesAMD) +#define glDeleteObjectARB MANGLE(DeleteObjectARB) +#define glDeleteOcclusionQueriesNV MANGLE(DeleteOcclusionQueriesNV) +#define glDeletePerfMonitorsAMD MANGLE(DeletePerfMonitorsAMD) +#define glDeleteProgram MANGLE(DeleteProgram) +#define glDeleteProgramPipelines MANGLE(DeleteProgramPipelines) +#define glDeleteProgramsARB MANGLE(DeleteProgramsARB) +#define glDeleteProgramsNV MANGLE(DeleteProgramsNV) +#define glDeleteQueriesARB MANGLE(DeleteQueriesARB) +#define glDeleteQueries MANGLE(DeleteQueries) +#define glDeleteRenderbuffersEXT MANGLE(DeleteRenderbuffersEXT) +#define glDeleteRenderbuffers MANGLE(DeleteRenderbuffers) +#define glDeleteSamplers MANGLE(DeleteSamplers) +#define glDeleteShader MANGLE(DeleteShader) +#define glDeleteSync MANGLE(DeleteSync) +#define glDeleteTexturesEXT MANGLE(DeleteTexturesEXT) +#define glDeleteTextures MANGLE(DeleteTextures) +#define glDeleteTransformFeedbacks MANGLE(DeleteTransformFeedbacks) +#define glDeleteTransformFeedbacksNV MANGLE(DeleteTransformFeedbacksNV) +#define glDeleteVertexArraysAPPLE MANGLE(DeleteVertexArraysAPPLE) +#define glDeleteVertexArrays MANGLE(DeleteVertexArrays) +#define glDeleteVertexShaderEXT MANGLE(DeleteVertexShaderEXT) +#define glDepthBoundsdNV MANGLE(DepthBoundsdNV) +#define glDepthBoundsEXT MANGLE(DepthBoundsEXT) +#define glDepthFunc MANGLE(DepthFunc) +#define glDepthMask MANGLE(DepthMask) +#define glDepthRangeArrayv MANGLE(DepthRangeArrayv) +#define glDepthRangedNV MANGLE(DepthRangedNV) +#define glDepthRangef MANGLE(DepthRangef) +#define glDepthRangeIndexed MANGLE(DepthRangeIndexed) +#define glDepthRange MANGLE(DepthRange) +#define glDetachObjectARB MANGLE(DetachObjectARB) +#define glDetachShader MANGLE(DetachShader) +#define glDetailTexFuncSGIS MANGLE(DetailTexFuncSGIS) +#define glDisableClientStateIndexedEXT MANGLE(DisableClientStateIndexedEXT) +#define glDisableClientState MANGLE(DisableClientState) +#define glDisablei MANGLE(Disablei) +#define glDisableIndexedEXT MANGLE(DisableIndexedEXT) +#define glDisable MANGLE(Disable) +#define glDisableVariantClientStateEXT MANGLE(DisableVariantClientStateEXT) +#define glDisableVertexAttribAPPLE MANGLE(DisableVertexAttribAPPLE) +#define glDisableVertexAttribArrayARB MANGLE(DisableVertexAttribArrayARB) +#define glDisableVertexAttribArray MANGLE(DisableVertexAttribArray) +#define glDrawArraysEXT MANGLE(DrawArraysEXT) +#define glDrawArraysIndirect MANGLE(DrawArraysIndirect) +#define glDrawArraysInstancedARB MANGLE(DrawArraysInstancedARB) +#define glDrawArraysInstancedEXT MANGLE(DrawArraysInstancedEXT) +#define glDrawArraysInstanced MANGLE(DrawArraysInstanced) +#define glDrawArrays MANGLE(DrawArrays) +#define glDrawBuffer MANGLE(DrawBuffer) +#define glDrawBuffersARB MANGLE(DrawBuffersARB) +#define glDrawBuffersATI MANGLE(DrawBuffersATI) +#define glDrawBuffers MANGLE(DrawBuffers) +#define glDrawElementArrayAPPLE MANGLE(DrawElementArrayAPPLE) +#define glDrawElementArrayATI MANGLE(DrawElementArrayATI) +#define glDrawElementsBaseVertex MANGLE(DrawElementsBaseVertex) +#define glDrawElementsIndirect MANGLE(DrawElementsIndirect) +#define glDrawElementsInstancedARB MANGLE(DrawElementsInstancedARB) +#define glDrawElementsInstancedBaseVertex MANGLE(DrawElementsInstancedBaseVertex) +#define glDrawElementsInstancedEXT MANGLE(DrawElementsInstancedEXT) +#define glDrawElementsInstanced MANGLE(DrawElementsInstanced) +#define glDrawElements MANGLE(DrawElements) +#define glDrawMeshArraysSUN MANGLE(DrawMeshArraysSUN) +#define glDrawPixels MANGLE(DrawPixels) +#define glDrawRangeElementArrayAPPLE MANGLE(DrawRangeElementArrayAPPLE) +#define glDrawRangeElementArrayATI MANGLE(DrawRangeElementArrayATI) +#define glDrawRangeElementsBaseVertex MANGLE(DrawRangeElementsBaseVertex) +#define glDrawRangeElementsEXT MANGLE(DrawRangeElementsEXT) +#define glDrawRangeElements MANGLE(DrawRangeElements) +#define glDrawTransformFeedback MANGLE(DrawTransformFeedback) +#define glDrawTransformFeedbackNV MANGLE(DrawTransformFeedbackNV) +#define glDrawTransformFeedbackStream MANGLE(DrawTransformFeedbackStream) +#define glEdgeFlagFormatNV MANGLE(EdgeFlagFormatNV) +#define glEdgeFlag MANGLE(EdgeFlag) +#define glEdgeFlagPointerEXT MANGLE(EdgeFlagPointerEXT) +#define glEdgeFlagPointerListIBM MANGLE(EdgeFlagPointerListIBM) +#define glEdgeFlagPointer MANGLE(EdgeFlagPointer) +#define glEdgeFlagv MANGLE(EdgeFlagv) +#define glEGLImageTargetRenderbufferStorageOES MANGLE(EGLImageTargetRenderbufferStorageOES) +#define glEGLImageTargetTexture2DOES MANGLE(EGLImageTargetTexture2DOES) +#define glElementPointerAPPLE MANGLE(ElementPointerAPPLE) +#define glElementPointerATI MANGLE(ElementPointerATI) +#define glEnableClientStateIndexedEXT MANGLE(EnableClientStateIndexedEXT) +#define glEnableClientState MANGLE(EnableClientState) +#define glEnablei MANGLE(Enablei) +#define glEnableIndexedEXT MANGLE(EnableIndexedEXT) +#define glEnable MANGLE(Enable) +#define glEnableVariantClientStateEXT MANGLE(EnableVariantClientStateEXT) +#define glEnableVertexAttribAPPLE MANGLE(EnableVertexAttribAPPLE) +#define glEnableVertexAttribArrayARB MANGLE(EnableVertexAttribArrayARB) +#define glEnableVertexAttribArray MANGLE(EnableVertexAttribArray) +#define glEndConditionalRender MANGLE(EndConditionalRender) +#define glEndConditionalRenderNV MANGLE(EndConditionalRenderNV) +#define glEndFragmentShaderATI MANGLE(EndFragmentShaderATI) +#define glEndList MANGLE(EndList) +#define glEnd MANGLE(End) +#define glEndOcclusionQueryNV MANGLE(EndOcclusionQueryNV) +#define glEndPerfMonitorAMD MANGLE(EndPerfMonitorAMD) +#define glEndQueryARB MANGLE(EndQueryARB) +#define glEndQueryIndexed MANGLE(EndQueryIndexed) +#define glEndQuery MANGLE(EndQuery) +#define glEndTransformFeedbackEXT MANGLE(EndTransformFeedbackEXT) +#define glEndTransformFeedback MANGLE(EndTransformFeedback) +#define glEndTransformFeedbackNV MANGLE(EndTransformFeedbackNV) +#define glEndVertexShaderEXT MANGLE(EndVertexShaderEXT) +#define glEndVideoCaptureNV MANGLE(EndVideoCaptureNV) +#define glEvalCoord1d MANGLE(EvalCoord1d) +#define glEvalCoord1dv MANGLE(EvalCoord1dv) +#define glEvalCoord1f MANGLE(EvalCoord1f) +#define glEvalCoord1fv MANGLE(EvalCoord1fv) +#define glEvalCoord2d MANGLE(EvalCoord2d) +#define glEvalCoord2dv MANGLE(EvalCoord2dv) +#define glEvalCoord2f MANGLE(EvalCoord2f) +#define glEvalCoord2fv MANGLE(EvalCoord2fv) +#define glEvalMapsNV MANGLE(EvalMapsNV) +#define glEvalMesh1 MANGLE(EvalMesh1) +#define glEvalMesh2 MANGLE(EvalMesh2) +#define glEvalPoint1 MANGLE(EvalPoint1) +#define glEvalPoint2 MANGLE(EvalPoint2) +#define glExecuteProgramNV MANGLE(ExecuteProgramNV) +#define glExtractComponentEXT MANGLE(ExtractComponentEXT) +#define glFeedbackBuffer MANGLE(FeedbackBuffer) +#define glFenceSync MANGLE(FenceSync) +#define glFinalCombinerInputNV MANGLE(FinalCombinerInputNV) +#define glFinishAsyncSGIX MANGLE(FinishAsyncSGIX) +#define glFinishFenceAPPLE MANGLE(FinishFenceAPPLE) +#define glFinishFenceNV MANGLE(FinishFenceNV) +#define glFinish MANGLE(Finish) +#define glFinishObjectAPPLE MANGLE(FinishObjectAPPLE) +#define glFinishTextureSUNX MANGLE(FinishTextureSUNX) +#define glFlush MANGLE(Flush) +#define glFlushMappedBufferRangeAPPLE MANGLE(FlushMappedBufferRangeAPPLE) +#define glFlushMappedBufferRange MANGLE(FlushMappedBufferRange) +#define glFlushMappedNamedBufferRangeEXT MANGLE(FlushMappedNamedBufferRangeEXT) +#define glFlushPixelDataRangeNV MANGLE(FlushPixelDataRangeNV) +#define glFlushRasterSGIX MANGLE(FlushRasterSGIX) +#define glFlushVertexArrayRangeAPPLE MANGLE(FlushVertexArrayRangeAPPLE) +#define glFlushVertexArrayRangeNV MANGLE(FlushVertexArrayRangeNV) +#define glFogCoorddEXT MANGLE(FogCoorddEXT) +#define glFogCoordd MANGLE(FogCoordd) +#define glFogCoorddvEXT MANGLE(FogCoorddvEXT) +#define glFogCoorddv MANGLE(FogCoorddv) +#define glFogCoordfEXT MANGLE(FogCoordfEXT) +#define glFogCoordf MANGLE(FogCoordf) +#define glFogCoordFormatNV MANGLE(FogCoordFormatNV) +#define glFogCoordfvEXT MANGLE(FogCoordfvEXT) +#define glFogCoordfv MANGLE(FogCoordfv) +#define glFogCoordhNV MANGLE(FogCoordhNV) +#define glFogCoordhvNV MANGLE(FogCoordhvNV) +#define glFogCoordPointerEXT MANGLE(FogCoordPointerEXT) +#define glFogCoordPointerListIBM MANGLE(FogCoordPointerListIBM) +#define glFogCoordPointer MANGLE(FogCoordPointer) +#define glFogf MANGLE(Fogf) +#define glFogFuncSGIS MANGLE(FogFuncSGIS) +#define glFogfv MANGLE(Fogfv) +#define glFogi MANGLE(Fogi) +#define glFogiv MANGLE(Fogiv) +#define glFragmentColorMaterialSGIX MANGLE(FragmentColorMaterialSGIX) +#define glFragmentLightfSGIX MANGLE(FragmentLightfSGIX) +#define glFragmentLightfvSGIX MANGLE(FragmentLightfvSGIX) +#define glFragmentLightiSGIX MANGLE(FragmentLightiSGIX) +#define glFragmentLightivSGIX MANGLE(FragmentLightivSGIX) +#define glFragmentLightModelfSGIX MANGLE(FragmentLightModelfSGIX) +#define glFragmentLightModelfvSGIX MANGLE(FragmentLightModelfvSGIX) +#define glFragmentLightModeliSGIX MANGLE(FragmentLightModeliSGIX) +#define glFragmentLightModelivSGIX MANGLE(FragmentLightModelivSGIX) +#define glFragmentMaterialfSGIX MANGLE(FragmentMaterialfSGIX) +#define glFragmentMaterialfvSGIX MANGLE(FragmentMaterialfvSGIX) +#define glFragmentMaterialiSGIX MANGLE(FragmentMaterialiSGIX) +#define glFragmentMaterialivSGIX MANGLE(FragmentMaterialivSGIX) +#define glFramebufferDrawBufferEXT MANGLE(FramebufferDrawBufferEXT) +#define glFramebufferDrawBuffersEXT MANGLE(FramebufferDrawBuffersEXT) +#define glFramebufferReadBufferEXT MANGLE(FramebufferReadBufferEXT) +#define glFramebufferRenderbufferEXT MANGLE(FramebufferRenderbufferEXT) +#define glFramebufferRenderbuffer MANGLE(FramebufferRenderbuffer) +#define glFramebufferTexture1DEXT MANGLE(FramebufferTexture1DEXT) +#define glFramebufferTexture1D MANGLE(FramebufferTexture1D) +#define glFramebufferTexture2DEXT MANGLE(FramebufferTexture2DEXT) +#define glFramebufferTexture2D MANGLE(FramebufferTexture2D) +#define glFramebufferTexture3DEXT MANGLE(FramebufferTexture3DEXT) +#define glFramebufferTexture3D MANGLE(FramebufferTexture3D) +#define glFramebufferTextureARB MANGLE(FramebufferTextureARB) +#define glFramebufferTextureEXT MANGLE(FramebufferTextureEXT) +#define glFramebufferTextureFaceARB MANGLE(FramebufferTextureFaceARB) +#define glFramebufferTextureFaceEXT MANGLE(FramebufferTextureFaceEXT) +#define glFramebufferTextureLayerARB MANGLE(FramebufferTextureLayerARB) +#define glFramebufferTextureLayerEXT MANGLE(FramebufferTextureLayerEXT) +#define glFramebufferTextureLayer MANGLE(FramebufferTextureLayer) +#define glFramebufferTexture MANGLE(FramebufferTexture) +#define glFrameTerminatorGREMEDY MANGLE(FrameTerminatorGREMEDY) +#define glFrameZoomSGIX MANGLE(FrameZoomSGIX) +#define glFreeObjectBufferATI MANGLE(FreeObjectBufferATI) +#define glFrontFace MANGLE(FrontFace) +#define glFrustum MANGLE(Frustum) +#define glGenAsyncMarkersSGIX MANGLE(GenAsyncMarkersSGIX) +#define glGenBuffersARB MANGLE(GenBuffersARB) +#define glGenBuffers MANGLE(GenBuffers) +#define glGenerateMipmapEXT MANGLE(GenerateMipmapEXT) +#define glGenerateMipmap MANGLE(GenerateMipmap) +#define glGenerateMultiTexMipmapEXT MANGLE(GenerateMultiTexMipmapEXT) +#define glGenerateTextureMipmapEXT MANGLE(GenerateTextureMipmapEXT) +#define glGenFencesAPPLE MANGLE(GenFencesAPPLE) +#define glGenFencesNV MANGLE(GenFencesNV) +#define glGenFragmentShadersATI MANGLE(GenFragmentShadersATI) +#define glGenFramebuffersEXT MANGLE(GenFramebuffersEXT) +#define glGenFramebuffers MANGLE(GenFramebuffers) +#define glGenLists MANGLE(GenLists) +#define glGenNamesAMD MANGLE(GenNamesAMD) +#define glGenOcclusionQueriesNV MANGLE(GenOcclusionQueriesNV) +#define glGenPerfMonitorsAMD MANGLE(GenPerfMonitorsAMD) +#define glGenProgramPipelines MANGLE(GenProgramPipelines) +#define glGenProgramsARB MANGLE(GenProgramsARB) +#define glGenProgramsNV MANGLE(GenProgramsNV) +#define glGenQueriesARB MANGLE(GenQueriesARB) +#define glGenQueries MANGLE(GenQueries) +#define glGenRenderbuffersEXT MANGLE(GenRenderbuffersEXT) +#define glGenRenderbuffers MANGLE(GenRenderbuffers) +#define glGenSamplers MANGLE(GenSamplers) +#define glGenSymbolsEXT MANGLE(GenSymbolsEXT) +#define glGenTexturesEXT MANGLE(GenTexturesEXT) +#define glGenTextures MANGLE(GenTextures) +#define glGenTransformFeedbacks MANGLE(GenTransformFeedbacks) +#define glGenTransformFeedbacksNV MANGLE(GenTransformFeedbacksNV) +#define glGenVertexArraysAPPLE MANGLE(GenVertexArraysAPPLE) +#define glGenVertexArrays MANGLE(GenVertexArrays) +#define glGenVertexShadersEXT MANGLE(GenVertexShadersEXT) +#define glGetActiveAttribARB MANGLE(GetActiveAttribARB) +#define glGetActiveAttrib MANGLE(GetActiveAttrib) +#define glGetActiveSubroutineName MANGLE(GetActiveSubroutineName) +#define glGetActiveSubroutineUniformiv MANGLE(GetActiveSubroutineUniformiv) +#define glGetActiveSubroutineUniformName MANGLE(GetActiveSubroutineUniformName) +#define glGetActiveUniformARB MANGLE(GetActiveUniformARB) +#define glGetActiveUniformBlockiv MANGLE(GetActiveUniformBlockiv) +#define glGetActiveUniformBlockName MANGLE(GetActiveUniformBlockName) +#define glGetActiveUniform MANGLE(GetActiveUniform) +#define glGetActiveUniformName MANGLE(GetActiveUniformName) +#define glGetActiveUniformsiv MANGLE(GetActiveUniformsiv) +#define glGetActiveVaryingNV MANGLE(GetActiveVaryingNV) +#define glGetArrayObjectfvATI MANGLE(GetArrayObjectfvATI) +#define glGetArrayObjectivATI MANGLE(GetArrayObjectivATI) +#define glGetAttachedObjectsARB MANGLE(GetAttachedObjectsARB) +#define glGetAttachedShaders MANGLE(GetAttachedShaders) +#define glGetAttribLocationARB MANGLE(GetAttribLocationARB) +#define glGetAttribLocation MANGLE(GetAttribLocation) +#define glGetBooleanIndexedvEXT MANGLE(GetBooleanIndexedvEXT) +#define glGetBooleani_v MANGLE(GetBooleani_v) +#define glGetBooleanv MANGLE(GetBooleanv) +#define glGetBufferParameteri64v MANGLE(GetBufferParameteri64v) +#define glGetBufferParameterivARB MANGLE(GetBufferParameterivARB) +#define glGetBufferParameteriv MANGLE(GetBufferParameteriv) +#define glGetBufferParameterui64vNV MANGLE(GetBufferParameterui64vNV) +#define glGetBufferPointervARB MANGLE(GetBufferPointervARB) +#define glGetBufferPointerv MANGLE(GetBufferPointerv) +#define glGetBufferSubDataARB MANGLE(GetBufferSubDataARB) +#define glGetBufferSubData MANGLE(GetBufferSubData) +#define glGetClipPlane MANGLE(GetClipPlane) +#define glGetColorTableEXT MANGLE(GetColorTableEXT) +#define glGetColorTable MANGLE(GetColorTable) +#define glGetColorTableParameterfvEXT MANGLE(GetColorTableParameterfvEXT) +#define glGetColorTableParameterfv MANGLE(GetColorTableParameterfv) +#define glGetColorTableParameterfvSGI MANGLE(GetColorTableParameterfvSGI) +#define glGetColorTableParameterivEXT MANGLE(GetColorTableParameterivEXT) +#define glGetColorTableParameteriv MANGLE(GetColorTableParameteriv) +#define glGetColorTableParameterivSGI MANGLE(GetColorTableParameterivSGI) +#define glGetColorTableSGI MANGLE(GetColorTableSGI) +#define glGetCombinerInputParameterfvNV MANGLE(GetCombinerInputParameterfvNV) +#define glGetCombinerInputParameterivNV MANGLE(GetCombinerInputParameterivNV) +#define glGetCombinerOutputParameterfvNV MANGLE(GetCombinerOutputParameterfvNV) +#define glGetCombinerOutputParameterivNV MANGLE(GetCombinerOutputParameterivNV) +#define glGetCombinerStageParameterfvNV MANGLE(GetCombinerStageParameterfvNV) +#define glGetCompressedMultiTexImageEXT MANGLE(GetCompressedMultiTexImageEXT) +#define glGetCompressedTexImageARB MANGLE(GetCompressedTexImageARB) +#define glGetCompressedTexImage MANGLE(GetCompressedTexImage) +#define glGetCompressedTextureImageEXT MANGLE(GetCompressedTextureImageEXT) +#define glGetConvolutionFilterEXT MANGLE(GetConvolutionFilterEXT) +#define glGetConvolutionFilter MANGLE(GetConvolutionFilter) +#define glGetConvolutionParameterfvEXT MANGLE(GetConvolutionParameterfvEXT) +#define glGetConvolutionParameterfv MANGLE(GetConvolutionParameterfv) +#define glGetConvolutionParameterivEXT MANGLE(GetConvolutionParameterivEXT) +#define glGetConvolutionParameteriv MANGLE(GetConvolutionParameteriv) +#define glGetDebugLogLengthMESA MANGLE(GetDebugLogLengthMESA) +#define glGetDebugLogMESA MANGLE(GetDebugLogMESA) +#define glGetDebugMessageLogAMD MANGLE(GetDebugMessageLogAMD) +#define glGetDebugMessageLogARB MANGLE(GetDebugMessageLogARB) +#define glGetDetailTexFuncSGIS MANGLE(GetDetailTexFuncSGIS) +#define glGetDoubleIndexedvEXT MANGLE(GetDoubleIndexedvEXT) +#define glGetDoublei_v MANGLE(GetDoublei_v) +#define glGetDoublev MANGLE(GetDoublev) +#define glGetError MANGLE(GetError) +#define glGetFenceivNV MANGLE(GetFenceivNV) +#define glGetFinalCombinerInputParameterfvNV MANGLE(GetFinalCombinerInputParameterfvNV) +#define glGetFinalCombinerInputParameterivNV MANGLE(GetFinalCombinerInputParameterivNV) +#define glGetFloatIndexedvEXT MANGLE(GetFloatIndexedvEXT) +#define glGetFloati_v MANGLE(GetFloati_v) +#define glGetFloatv MANGLE(GetFloatv) +#define glGetFogFuncSGIS MANGLE(GetFogFuncSGIS) +#define glGetFragDataIndex MANGLE(GetFragDataIndex) +#define glGetFragDataLocationEXT MANGLE(GetFragDataLocationEXT) +#define glGetFragDataLocation MANGLE(GetFragDataLocation) +#define glGetFragmentLightfvSGIX MANGLE(GetFragmentLightfvSGIX) +#define glGetFragmentLightivSGIX MANGLE(GetFragmentLightivSGIX) +#define glGetFragmentMaterialfvSGIX MANGLE(GetFragmentMaterialfvSGIX) +#define glGetFragmentMaterialivSGIX MANGLE(GetFragmentMaterialivSGIX) +#define glGetFramebufferAttachmentParameterivEXT MANGLE(GetFramebufferAttachmentParameterivEXT) +#define glGetFramebufferAttachmentParameteriv MANGLE(GetFramebufferAttachmentParameteriv) +#define glGetFramebufferParameterivEXT MANGLE(GetFramebufferParameterivEXT) +#define glGetGraphicsResetStatusARB MANGLE(GetGraphicsResetStatusARB) +#define glGetHandleARB MANGLE(GetHandleARB) +#define glGetHistogramEXT MANGLE(GetHistogramEXT) +#define glGetHistogram MANGLE(GetHistogram) +#define glGetHistogramParameterfvEXT MANGLE(GetHistogramParameterfvEXT) +#define glGetHistogramParameterfv MANGLE(GetHistogramParameterfv) +#define glGetHistogramParameterivEXT MANGLE(GetHistogramParameterivEXT) +#define glGetHistogramParameteriv MANGLE(GetHistogramParameteriv) +#define glGetImageTransformParameterfvHP MANGLE(GetImageTransformParameterfvHP) +#define glGetImageTransformParameterivHP MANGLE(GetImageTransformParameterivHP) +#define glGetInfoLogARB MANGLE(GetInfoLogARB) +#define glGetInstrumentsSGIX MANGLE(GetInstrumentsSGIX) +#define glGetInteger64i_v MANGLE(GetInteger64i_v) +#define glGetInteger64v MANGLE(GetInteger64v) +#define glGetIntegerIndexedvEXT MANGLE(GetIntegerIndexedvEXT) +#define glGetIntegeri_v MANGLE(GetIntegeri_v) +#define glGetIntegerui64i_vNV MANGLE(GetIntegerui64i_vNV) +#define glGetIntegerui64vNV MANGLE(GetIntegerui64vNV) +#define glGetIntegerv MANGLE(GetIntegerv) +#define glGetInvariantBooleanvEXT MANGLE(GetInvariantBooleanvEXT) +#define glGetInvariantFloatvEXT MANGLE(GetInvariantFloatvEXT) +#define glGetInvariantIntegervEXT MANGLE(GetInvariantIntegervEXT) +#define glGetLightfv MANGLE(GetLightfv) +#define glGetLightiv MANGLE(GetLightiv) +#define glGetListParameterfvSGIX MANGLE(GetListParameterfvSGIX) +#define glGetListParameterivSGIX MANGLE(GetListParameterivSGIX) +#define glGetLocalConstantBooleanvEXT MANGLE(GetLocalConstantBooleanvEXT) +#define glGetLocalConstantFloatvEXT MANGLE(GetLocalConstantFloatvEXT) +#define glGetLocalConstantIntegervEXT MANGLE(GetLocalConstantIntegervEXT) +#define glGetMapAttribParameterfvNV MANGLE(GetMapAttribParameterfvNV) +#define glGetMapAttribParameterivNV MANGLE(GetMapAttribParameterivNV) +#define glGetMapControlPointsNV MANGLE(GetMapControlPointsNV) +#define glGetMapdv MANGLE(GetMapdv) +#define glGetMapfv MANGLE(GetMapfv) +#define glGetMapiv MANGLE(GetMapiv) +#define glGetMapParameterfvNV MANGLE(GetMapParameterfvNV) +#define glGetMapParameterivNV MANGLE(GetMapParameterivNV) +#define glGetMaterialfv MANGLE(GetMaterialfv) +#define glGetMaterialiv MANGLE(GetMaterialiv) +#define glGetMinmaxEXT MANGLE(GetMinmaxEXT) +#define glGetMinmax MANGLE(GetMinmax) +#define glGetMinmaxParameterfvEXT MANGLE(GetMinmaxParameterfvEXT) +#define glGetMinmaxParameterfv MANGLE(GetMinmaxParameterfv) +#define glGetMinmaxParameterivEXT MANGLE(GetMinmaxParameterivEXT) +#define glGetMinmaxParameteriv MANGLE(GetMinmaxParameteriv) +#define glGetMultisamplefv MANGLE(GetMultisamplefv) +#define glGetMultisamplefvNV MANGLE(GetMultisamplefvNV) +#define glGetMultiTexEnvfvEXT MANGLE(GetMultiTexEnvfvEXT) +#define glGetMultiTexEnvivEXT MANGLE(GetMultiTexEnvivEXT) +#define glGetMultiTexGendvEXT MANGLE(GetMultiTexGendvEXT) +#define glGetMultiTexGenfvEXT MANGLE(GetMultiTexGenfvEXT) +#define glGetMultiTexGenivEXT MANGLE(GetMultiTexGenivEXT) +#define glGetMultiTexImageEXT MANGLE(GetMultiTexImageEXT) +#define glGetMultiTexLevelParameterfvEXT MANGLE(GetMultiTexLevelParameterfvEXT) +#define glGetMultiTexLevelParameterivEXT MANGLE(GetMultiTexLevelParameterivEXT) +#define glGetMultiTexParameterfvEXT MANGLE(GetMultiTexParameterfvEXT) +#define glGetMultiTexParameterIivEXT MANGLE(GetMultiTexParameterIivEXT) +#define glGetMultiTexParameterIuivEXT MANGLE(GetMultiTexParameterIuivEXT) +#define glGetMultiTexParameterivEXT MANGLE(GetMultiTexParameterivEXT) +#define glGetNamedBufferParameterivEXT MANGLE(GetNamedBufferParameterivEXT) +#define glGetNamedBufferParameterui64vNV MANGLE(GetNamedBufferParameterui64vNV) +#define glGetNamedBufferPointervEXT MANGLE(GetNamedBufferPointervEXT) +#define glGetNamedBufferSubDataEXT MANGLE(GetNamedBufferSubDataEXT) +#define glGetNamedFramebufferAttachmentParameterivEXT MANGLE(GetNamedFramebufferAttachmentParameterivEXT) +#define glGetNamedProgramivEXT MANGLE(GetNamedProgramivEXT) +#define glGetNamedProgramLocalParameterdvEXT MANGLE(GetNamedProgramLocalParameterdvEXT) +#define glGetNamedProgramLocalParameterfvEXT MANGLE(GetNamedProgramLocalParameterfvEXT) +#define glGetNamedProgramLocalParameterIivEXT MANGLE(GetNamedProgramLocalParameterIivEXT) +#define glGetNamedProgramLocalParameterIuivEXT MANGLE(GetNamedProgramLocalParameterIuivEXT) +#define glGetNamedProgramStringEXT MANGLE(GetNamedProgramStringEXT) +#define glGetNamedRenderbufferParameterivEXT MANGLE(GetNamedRenderbufferParameterivEXT) +#define glGetNamedStringARB MANGLE(GetNamedStringARB) +#define glGetNamedStringivARB MANGLE(GetNamedStringivARB) +#define glGetnColorTableARB MANGLE(GetnColorTableARB) +#define glGetnCompressedTexImageARB MANGLE(GetnCompressedTexImageARB) +#define glGetnConvolutionFilterARB MANGLE(GetnConvolutionFilterARB) +#define glGetnHistogramARB MANGLE(GetnHistogramARB) +#define glGetnMapdvARB MANGLE(GetnMapdvARB) +#define glGetnMapfvARB MANGLE(GetnMapfvARB) +#define glGetnMapivARB MANGLE(GetnMapivARB) +#define glGetnMinmaxARB MANGLE(GetnMinmaxARB) +#define glGetnPixelMapfvARB MANGLE(GetnPixelMapfvARB) +#define glGetnPixelMapuivARB MANGLE(GetnPixelMapuivARB) +#define glGetnPixelMapusvARB MANGLE(GetnPixelMapusvARB) +#define glGetnPolygonStippleARB MANGLE(GetnPolygonStippleARB) +#define glGetnSeparableFilterARB MANGLE(GetnSeparableFilterARB) +#define glGetnTexImageARB MANGLE(GetnTexImageARB) +#define glGetnUniformdvARB MANGLE(GetnUniformdvARB) +#define glGetnUniformfvARB MANGLE(GetnUniformfvARB) +#define glGetnUniformivARB MANGLE(GetnUniformivARB) +#define glGetnUniformuivARB MANGLE(GetnUniformuivARB) +#define glGetObjectBufferfvATI MANGLE(GetObjectBufferfvATI) +#define glGetObjectBufferivATI MANGLE(GetObjectBufferivATI) +#define glGetObjectParameterfvARB MANGLE(GetObjectParameterfvARB) +#define glGetObjectParameterivAPPLE MANGLE(GetObjectParameterivAPPLE) +#define glGetObjectParameterivARB MANGLE(GetObjectParameterivARB) +#define glGetOcclusionQueryivNV MANGLE(GetOcclusionQueryivNV) +#define glGetOcclusionQueryuivNV MANGLE(GetOcclusionQueryuivNV) +#define glGetPerfMonitorCounterDataAMD MANGLE(GetPerfMonitorCounterDataAMD) +#define glGetPerfMonitorCounterInfoAMD MANGLE(GetPerfMonitorCounterInfoAMD) +#define glGetPerfMonitorCountersAMD MANGLE(GetPerfMonitorCountersAMD) +#define glGetPerfMonitorCounterStringAMD MANGLE(GetPerfMonitorCounterStringAMD) +#define glGetPerfMonitorGroupsAMD MANGLE(GetPerfMonitorGroupsAMD) +#define glGetPerfMonitorGroupStringAMD MANGLE(GetPerfMonitorGroupStringAMD) +#define glGetPixelMapfv MANGLE(GetPixelMapfv) +#define glGetPixelMapuiv MANGLE(GetPixelMapuiv) +#define glGetPixelMapusv MANGLE(GetPixelMapusv) +#define glGetPixelTexGenParameterfvSGIS MANGLE(GetPixelTexGenParameterfvSGIS) +#define glGetPixelTexGenParameterivSGIS MANGLE(GetPixelTexGenParameterivSGIS) +#define glGetPointerIndexedvEXT MANGLE(GetPointerIndexedvEXT) +#define glGetPointervEXT MANGLE(GetPointervEXT) +#define glGetPointerv MANGLE(GetPointerv) +#define glGetPolygonStipple MANGLE(GetPolygonStipple) +#define glGetProgramBinary MANGLE(GetProgramBinary) +#define glGetProgramEnvParameterdvARB MANGLE(GetProgramEnvParameterdvARB) +#define glGetProgramEnvParameterfvARB MANGLE(GetProgramEnvParameterfvARB) +#define glGetProgramEnvParameterIivNV MANGLE(GetProgramEnvParameterIivNV) +#define glGetProgramEnvParameterIuivNV MANGLE(GetProgramEnvParameterIuivNV) +#define glGetProgramInfoLog MANGLE(GetProgramInfoLog) +#define glGetProgramivARB MANGLE(GetProgramivARB) +#define glGetProgramiv MANGLE(GetProgramiv) +#define glGetProgramivNV MANGLE(GetProgramivNV) +#define glGetProgramLocalParameterdvARB MANGLE(GetProgramLocalParameterdvARB) +#define glGetProgramLocalParameterfvARB MANGLE(GetProgramLocalParameterfvARB) +#define glGetProgramLocalParameterIivNV MANGLE(GetProgramLocalParameterIivNV) +#define glGetProgramLocalParameterIuivNV MANGLE(GetProgramLocalParameterIuivNV) +#define glGetProgramNamedParameterdvNV MANGLE(GetProgramNamedParameterdvNV) +#define glGetProgramNamedParameterfvNV MANGLE(GetProgramNamedParameterfvNV) +#define glGetProgramParameterdvNV MANGLE(GetProgramParameterdvNV) +#define glGetProgramParameterfvNV MANGLE(GetProgramParameterfvNV) +#define glGetProgramPipelineInfoLog MANGLE(GetProgramPipelineInfoLog) +#define glGetProgramPipelineiv MANGLE(GetProgramPipelineiv) +#define glGetProgramRegisterfvMESA MANGLE(GetProgramRegisterfvMESA) +#define glGetProgramStageiv MANGLE(GetProgramStageiv) +#define glGetProgramStringARB MANGLE(GetProgramStringARB) +#define glGetProgramStringNV MANGLE(GetProgramStringNV) +#define glGetProgramSubroutineParameteruivNV MANGLE(GetProgramSubroutineParameteruivNV) +#define glGetQueryIndexediv MANGLE(GetQueryIndexediv) +#define glGetQueryivARB MANGLE(GetQueryivARB) +#define glGetQueryiv MANGLE(GetQueryiv) +#define glGetQueryObjecti64vEXT MANGLE(GetQueryObjecti64vEXT) +#define glGetQueryObjecti64v MANGLE(GetQueryObjecti64v) +#define glGetQueryObjectivARB MANGLE(GetQueryObjectivARB) +#define glGetQueryObjectiv MANGLE(GetQueryObjectiv) +#define glGetQueryObjectui64vEXT MANGLE(GetQueryObjectui64vEXT) +#define glGetQueryObjectui64v MANGLE(GetQueryObjectui64v) +#define glGetQueryObjectuivARB MANGLE(GetQueryObjectuivARB) +#define glGetQueryObjectuiv MANGLE(GetQueryObjectuiv) +#define glGetRenderbufferParameterivEXT MANGLE(GetRenderbufferParameterivEXT) +#define glGetRenderbufferParameteriv MANGLE(GetRenderbufferParameteriv) +#define glGetSamplerParameterfv MANGLE(GetSamplerParameterfv) +#define glGetSamplerParameterIiv MANGLE(GetSamplerParameterIiv) +#define glGetSamplerParameterIuiv MANGLE(GetSamplerParameterIuiv) +#define glGetSamplerParameteriv MANGLE(GetSamplerParameteriv) +#define glGetSeparableFilterEXT MANGLE(GetSeparableFilterEXT) +#define glGetSeparableFilter MANGLE(GetSeparableFilter) +#define glGetShaderInfoLog MANGLE(GetShaderInfoLog) +#define glGetShaderiv MANGLE(GetShaderiv) +#define glGetShaderPrecisionFormat MANGLE(GetShaderPrecisionFormat) +#define glGetShaderSourceARB MANGLE(GetShaderSourceARB) +#define glGetShaderSource MANGLE(GetShaderSource) +#define glGetSharpenTexFuncSGIS MANGLE(GetSharpenTexFuncSGIS) +#define glGetStringi MANGLE(GetStringi) +#define glGetString MANGLE(GetString) +#define glGetSubroutineIndex MANGLE(GetSubroutineIndex) +#define glGetSubroutineUniformLocation MANGLE(GetSubroutineUniformLocation) +#define glGetSynciv MANGLE(GetSynciv) +#define glGetTexBumpParameterfvATI MANGLE(GetTexBumpParameterfvATI) +#define glGetTexBumpParameterivATI MANGLE(GetTexBumpParameterivATI) +#define glGetTexEnvfv MANGLE(GetTexEnvfv) +#define glGetTexEnviv MANGLE(GetTexEnviv) +#define glGetTexFilterFuncSGIS MANGLE(GetTexFilterFuncSGIS) +#define glGetTexGendv MANGLE(GetTexGendv) +#define glGetTexGenfv MANGLE(GetTexGenfv) +#define glGetTexGeniv MANGLE(GetTexGeniv) +#define glGetTexImage MANGLE(GetTexImage) +#define glGetTexLevelParameterfv MANGLE(GetTexLevelParameterfv) +#define glGetTexLevelParameteriv MANGLE(GetTexLevelParameteriv) +#define glGetTexParameterfv MANGLE(GetTexParameterfv) +#define glGetTexParameterIivEXT MANGLE(GetTexParameterIivEXT) +#define glGetTexParameterIiv MANGLE(GetTexParameterIiv) +#define glGetTexParameterIuivEXT MANGLE(GetTexParameterIuivEXT) +#define glGetTexParameterIuiv MANGLE(GetTexParameterIuiv) +#define glGetTexParameteriv MANGLE(GetTexParameteriv) +#define glGetTexParameterPointervAPPLE MANGLE(GetTexParameterPointervAPPLE) +#define glGetTextureImageEXT MANGLE(GetTextureImageEXT) +#define glGetTextureLevelParameterfvEXT MANGLE(GetTextureLevelParameterfvEXT) +#define glGetTextureLevelParameterivEXT MANGLE(GetTextureLevelParameterivEXT) +#define glGetTextureParameterfvEXT MANGLE(GetTextureParameterfvEXT) +#define glGetTextureParameterIivEXT MANGLE(GetTextureParameterIivEXT) +#define glGetTextureParameterIuivEXT MANGLE(GetTextureParameterIuivEXT) +#define glGetTextureParameterivEXT MANGLE(GetTextureParameterivEXT) +#define glGetTrackMatrixivNV MANGLE(GetTrackMatrixivNV) +#define glGetTransformFeedbackVaryingEXT MANGLE(GetTransformFeedbackVaryingEXT) +#define glGetTransformFeedbackVarying MANGLE(GetTransformFeedbackVarying) +#define glGetTransformFeedbackVaryingNV MANGLE(GetTransformFeedbackVaryingNV) +#define glGetUniformBlockIndex MANGLE(GetUniformBlockIndex) +#define glGetUniformBufferSizeEXT MANGLE(GetUniformBufferSizeEXT) +#define glGetUniformdv MANGLE(GetUniformdv) +#define glGetUniformfvARB MANGLE(GetUniformfvARB) +#define glGetUniformfv MANGLE(GetUniformfv) +#define glGetUniformi64vNV MANGLE(GetUniformi64vNV) +#define glGetUniformIndices MANGLE(GetUniformIndices) +#define glGetUniformivARB MANGLE(GetUniformivARB) +#define glGetUniformiv MANGLE(GetUniformiv) +#define glGetUniformLocationARB MANGLE(GetUniformLocationARB) +#define glGetUniformLocation MANGLE(GetUniformLocation) +#define glGetUniformOffsetEXT MANGLE(GetUniformOffsetEXT) +#define glGetUniformSubroutineuiv MANGLE(GetUniformSubroutineuiv) +#define glGetUniformui64vNV MANGLE(GetUniformui64vNV) +#define glGetUniformuivEXT MANGLE(GetUniformuivEXT) +#define glGetUniformuiv MANGLE(GetUniformuiv) +#define glGetVariantArrayObjectfvATI MANGLE(GetVariantArrayObjectfvATI) +#define glGetVariantArrayObjectivATI MANGLE(GetVariantArrayObjectivATI) +#define glGetVariantBooleanvEXT MANGLE(GetVariantBooleanvEXT) +#define glGetVariantFloatvEXT MANGLE(GetVariantFloatvEXT) +#define glGetVariantIntegervEXT MANGLE(GetVariantIntegervEXT) +#define glGetVariantPointervEXT MANGLE(GetVariantPointervEXT) +#define glGetVaryingLocationNV MANGLE(GetVaryingLocationNV) +#define glGetVertexAttribArrayObjectfvATI MANGLE(GetVertexAttribArrayObjectfvATI) +#define glGetVertexAttribArrayObjectivATI MANGLE(GetVertexAttribArrayObjectivATI) +#define glGetVertexAttribdvARB MANGLE(GetVertexAttribdvARB) +#define glGetVertexAttribdv MANGLE(GetVertexAttribdv) +#define glGetVertexAttribdvNV MANGLE(GetVertexAttribdvNV) +#define glGetVertexAttribfvARB MANGLE(GetVertexAttribfvARB) +#define glGetVertexAttribfv MANGLE(GetVertexAttribfv) +#define glGetVertexAttribfvNV MANGLE(GetVertexAttribfvNV) +#define glGetVertexAttribIivEXT MANGLE(GetVertexAttribIivEXT) +#define glGetVertexAttribIiv MANGLE(GetVertexAttribIiv) +#define glGetVertexAttribIuivEXT MANGLE(GetVertexAttribIuivEXT) +#define glGetVertexAttribIuiv MANGLE(GetVertexAttribIuiv) +#define glGetVertexAttribivARB MANGLE(GetVertexAttribivARB) +#define glGetVertexAttribiv MANGLE(GetVertexAttribiv) +#define glGetVertexAttribivNV MANGLE(GetVertexAttribivNV) +#define glGetVertexAttribLdvEXT MANGLE(GetVertexAttribLdvEXT) +#define glGetVertexAttribLdv MANGLE(GetVertexAttribLdv) +#define glGetVertexAttribLi64vNV MANGLE(GetVertexAttribLi64vNV) +#define glGetVertexAttribLui64vNV MANGLE(GetVertexAttribLui64vNV) +#define glGetVertexAttribPointervARB MANGLE(GetVertexAttribPointervARB) +#define glGetVertexAttribPointerv MANGLE(GetVertexAttribPointerv) +#define glGetVertexAttribPointervNV MANGLE(GetVertexAttribPointervNV) +#define glGetVideoCaptureivNV MANGLE(GetVideoCaptureivNV) +#define glGetVideoCaptureStreamdvNV MANGLE(GetVideoCaptureStreamdvNV) +#define glGetVideoCaptureStreamfvNV MANGLE(GetVideoCaptureStreamfvNV) +#define glGetVideoCaptureStreamivNV MANGLE(GetVideoCaptureStreamivNV) +#define glGetVideoi64vNV MANGLE(GetVideoi64vNV) +#define glGetVideoivNV MANGLE(GetVideoivNV) +#define glGetVideoui64vNV MANGLE(GetVideoui64vNV) +#define glGetVideouivNV MANGLE(GetVideouivNV) +#define glGlobalAlphaFactorbSUN MANGLE(GlobalAlphaFactorbSUN) +#define glGlobalAlphaFactordSUN MANGLE(GlobalAlphaFactordSUN) +#define glGlobalAlphaFactorfSUN MANGLE(GlobalAlphaFactorfSUN) +#define glGlobalAlphaFactoriSUN MANGLE(GlobalAlphaFactoriSUN) +#define glGlobalAlphaFactorsSUN MANGLE(GlobalAlphaFactorsSUN) +#define glGlobalAlphaFactorubSUN MANGLE(GlobalAlphaFactorubSUN) +#define glGlobalAlphaFactoruiSUN MANGLE(GlobalAlphaFactoruiSUN) +#define glGlobalAlphaFactorusSUN MANGLE(GlobalAlphaFactorusSUN) +#define glHint MANGLE(Hint) +#define glHintPGI MANGLE(HintPGI) +#define glHistogramEXT MANGLE(HistogramEXT) +#define glHistogram MANGLE(Histogram) +#define glIglooInterfaceSGIX MANGLE(IglooInterfaceSGIX) +#define glImageTransformParameterfHP MANGLE(ImageTransformParameterfHP) +#define glImageTransformParameterfvHP MANGLE(ImageTransformParameterfvHP) +#define glImageTransformParameteriHP MANGLE(ImageTransformParameteriHP) +#define glImageTransformParameterivHP MANGLE(ImageTransformParameterivHP) +#define glIndexd MANGLE(Indexd) +#define glIndexdv MANGLE(Indexdv) +#define glIndexf MANGLE(Indexf) +#define glIndexFormatNV MANGLE(IndexFormatNV) +#define glIndexFuncEXT MANGLE(IndexFuncEXT) +#define glIndexfv MANGLE(Indexfv) +#define glIndexi MANGLE(Indexi) +#define glIndexiv MANGLE(Indexiv) +#define glIndexMask MANGLE(IndexMask) +#define glIndexMaterialEXT MANGLE(IndexMaterialEXT) +#define glIndexPointerEXT MANGLE(IndexPointerEXT) +#define glIndexPointerListIBM MANGLE(IndexPointerListIBM) +#define glIndexPointer MANGLE(IndexPointer) +#define glIndexs MANGLE(Indexs) +#define glIndexsv MANGLE(Indexsv) +#define glIndexub MANGLE(Indexub) +#define glIndexubv MANGLE(Indexubv) +#define glInitNames MANGLE(InitNames) +#define glInsertComponentEXT MANGLE(InsertComponentEXT) +#define glInstrumentsBufferSGIX MANGLE(InstrumentsBufferSGIX) +#define glInterleavedArrays MANGLE(InterleavedArrays) +#define glIsAsyncMarkerSGIX MANGLE(IsAsyncMarkerSGIX) +#define glIsBufferARB MANGLE(IsBufferARB) +#define glIsBuffer MANGLE(IsBuffer) +#define glIsBufferResidentNV MANGLE(IsBufferResidentNV) +#define glIsEnabledi MANGLE(IsEnabledi) +#define glIsEnabledIndexedEXT MANGLE(IsEnabledIndexedEXT) +#define glIsEnabled MANGLE(IsEnabled) +#define glIsFenceAPPLE MANGLE(IsFenceAPPLE) +#define glIsFenceNV MANGLE(IsFenceNV) +#define glIsFramebufferEXT MANGLE(IsFramebufferEXT) +#define glIsFramebuffer MANGLE(IsFramebuffer) +#define glIsList MANGLE(IsList) +#define glIsNameAMD MANGLE(IsNameAMD) +#define glIsNamedBufferResidentNV MANGLE(IsNamedBufferResidentNV) +#define glIsNamedStringARB MANGLE(IsNamedStringARB) +#define glIsObjectBufferATI MANGLE(IsObjectBufferATI) +#define glIsOcclusionQueryNV MANGLE(IsOcclusionQueryNV) +#define glIsProgramARB MANGLE(IsProgramARB) +#define glIsProgram MANGLE(IsProgram) +#define glIsProgramNV MANGLE(IsProgramNV) +#define glIsProgramPipeline MANGLE(IsProgramPipeline) +#define glIsQueryARB MANGLE(IsQueryARB) +#define glIsQuery MANGLE(IsQuery) +#define glIsRenderbufferEXT MANGLE(IsRenderbufferEXT) +#define glIsRenderbuffer MANGLE(IsRenderbuffer) +#define glIsSampler MANGLE(IsSampler) +#define glIsShader MANGLE(IsShader) +#define glIsSync MANGLE(IsSync) +#define glIsTextureEXT MANGLE(IsTextureEXT) +#define glIsTexture MANGLE(IsTexture) +#define glIsTransformFeedback MANGLE(IsTransformFeedback) +#define glIsTransformFeedbackNV MANGLE(IsTransformFeedbackNV) +#define glIsVariantEnabledEXT MANGLE(IsVariantEnabledEXT) +#define glIsVertexArrayAPPLE MANGLE(IsVertexArrayAPPLE) +#define glIsVertexArray MANGLE(IsVertexArray) +#define glIsVertexAttribEnabledAPPLE MANGLE(IsVertexAttribEnabledAPPLE) +#define glLightEnviSGIX MANGLE(LightEnviSGIX) +#define glLightf MANGLE(Lightf) +#define glLightfv MANGLE(Lightfv) +#define glLighti MANGLE(Lighti) +#define glLightiv MANGLE(Lightiv) +#define glLightModelf MANGLE(LightModelf) +#define glLightModelfv MANGLE(LightModelfv) +#define glLightModeli MANGLE(LightModeli) +#define glLightModeliv MANGLE(LightModeliv) +#define glLineStipple MANGLE(LineStipple) +#define glLineWidth MANGLE(LineWidth) +#define glLinkProgramARB MANGLE(LinkProgramARB) +#define glLinkProgram MANGLE(LinkProgram) +#define glListBase MANGLE(ListBase) +#define glListParameterfSGIX MANGLE(ListParameterfSGIX) +#define glListParameterfvSGIX MANGLE(ListParameterfvSGIX) +#define glListParameteriSGIX MANGLE(ListParameteriSGIX) +#define glListParameterivSGIX MANGLE(ListParameterivSGIX) +#define glLoadIdentityDeformationMapSGIX MANGLE(LoadIdentityDeformationMapSGIX) +#define glLoadIdentity MANGLE(LoadIdentity) +#define glLoadMatrixd MANGLE(LoadMatrixd) +#define glLoadMatrixf MANGLE(LoadMatrixf) +#define glLoadName MANGLE(LoadName) +#define glLoadProgramNV MANGLE(LoadProgramNV) +#define glLoadTransposeMatrixdARB MANGLE(LoadTransposeMatrixdARB) +#define glLoadTransposeMatrixd MANGLE(LoadTransposeMatrixd) +#define glLoadTransposeMatrixfARB MANGLE(LoadTransposeMatrixfARB) +#define glLoadTransposeMatrixf MANGLE(LoadTransposeMatrixf) +#define glLockArraysEXT MANGLE(LockArraysEXT) +#define glLogicOp MANGLE(LogicOp) +#define glMakeBufferNonResidentNV MANGLE(MakeBufferNonResidentNV) +#define glMakeBufferResidentNV MANGLE(MakeBufferResidentNV) +#define glMakeNamedBufferNonResidentNV MANGLE(MakeNamedBufferNonResidentNV) +#define glMakeNamedBufferResidentNV MANGLE(MakeNamedBufferResidentNV) +#define glMap1d MANGLE(Map1d) +#define glMap1f MANGLE(Map1f) +#define glMap2d MANGLE(Map2d) +#define glMap2f MANGLE(Map2f) +#define glMapBufferARB MANGLE(MapBufferARB) +#define glMapBuffer MANGLE(MapBuffer) +#define glMapBufferRange MANGLE(MapBufferRange) +#define glMapControlPointsNV MANGLE(MapControlPointsNV) +#define glMapGrid1d MANGLE(MapGrid1d) +#define glMapGrid1f MANGLE(MapGrid1f) +#define glMapGrid2d MANGLE(MapGrid2d) +#define glMapGrid2f MANGLE(MapGrid2f) +#define glMapNamedBufferEXT MANGLE(MapNamedBufferEXT) +#define glMapNamedBufferRangeEXT MANGLE(MapNamedBufferRangeEXT) +#define glMapObjectBufferATI MANGLE(MapObjectBufferATI) +#define glMapParameterfvNV MANGLE(MapParameterfvNV) +#define glMapParameterivNV MANGLE(MapParameterivNV) +#define glMapVertexAttrib1dAPPLE MANGLE(MapVertexAttrib1dAPPLE) +#define glMapVertexAttrib1fAPPLE MANGLE(MapVertexAttrib1fAPPLE) +#define glMapVertexAttrib2dAPPLE MANGLE(MapVertexAttrib2dAPPLE) +#define glMapVertexAttrib2fAPPLE MANGLE(MapVertexAttrib2fAPPLE) +#define glMaterialf MANGLE(Materialf) +#define glMaterialfv MANGLE(Materialfv) +#define glMateriali MANGLE(Materiali) +#define glMaterialiv MANGLE(Materialiv) +#define glMatrixFrustumEXT MANGLE(MatrixFrustumEXT) +#define glMatrixIndexPointerARB MANGLE(MatrixIndexPointerARB) +#define glMatrixIndexubvARB MANGLE(MatrixIndexubvARB) +#define glMatrixIndexuivARB MANGLE(MatrixIndexuivARB) +#define glMatrixIndexusvARB MANGLE(MatrixIndexusvARB) +#define glMatrixLoaddEXT MANGLE(MatrixLoaddEXT) +#define glMatrixLoadfEXT MANGLE(MatrixLoadfEXT) +#define glMatrixLoadIdentityEXT MANGLE(MatrixLoadIdentityEXT) +#define glMatrixLoadTransposedEXT MANGLE(MatrixLoadTransposedEXT) +#define glMatrixLoadTransposefEXT MANGLE(MatrixLoadTransposefEXT) +#define glMatrixMode MANGLE(MatrixMode) +#define glMatrixMultdEXT MANGLE(MatrixMultdEXT) +#define glMatrixMultfEXT MANGLE(MatrixMultfEXT) +#define glMatrixMultTransposedEXT MANGLE(MatrixMultTransposedEXT) +#define glMatrixMultTransposefEXT MANGLE(MatrixMultTransposefEXT) +#define glMatrixOrthoEXT MANGLE(MatrixOrthoEXT) +#define glMatrixPopEXT MANGLE(MatrixPopEXT) +#define glMatrixPushEXT MANGLE(MatrixPushEXT) +#define glMatrixRotatedEXT MANGLE(MatrixRotatedEXT) +#define glMatrixRotatefEXT MANGLE(MatrixRotatefEXT) +#define glMatrixScaledEXT MANGLE(MatrixScaledEXT) +#define glMatrixScalefEXT MANGLE(MatrixScalefEXT) +#define glMatrixTranslatedEXT MANGLE(MatrixTranslatedEXT) +#define glMatrixTranslatefEXT MANGLE(MatrixTranslatefEXT) +#define glMemoryBarrierEXT MANGLE(MemoryBarrierEXT) +#define glMinmaxEXT MANGLE(MinmaxEXT) +#define glMinmax MANGLE(Minmax) +#define glMinSampleShadingARB MANGLE(MinSampleShadingARB) +#define glMinSampleShading MANGLE(MinSampleShading) +#define glMultiDrawArraysEXT MANGLE(MultiDrawArraysEXT) +#define glMultiDrawArrays MANGLE(MultiDrawArrays) +#define glMultiDrawElementArrayAPPLE MANGLE(MultiDrawElementArrayAPPLE) +#define glMultiDrawElementsBaseVertex MANGLE(MultiDrawElementsBaseVertex) +#define glMultiDrawElementsEXT MANGLE(MultiDrawElementsEXT) +#define glMultiDrawElements MANGLE(MultiDrawElements) +#define glMultiDrawRangeElementArrayAPPLE MANGLE(MultiDrawRangeElementArrayAPPLE) +#define glMultiModeDrawArraysIBM MANGLE(MultiModeDrawArraysIBM) +#define glMultiModeDrawElementsIBM MANGLE(MultiModeDrawElementsIBM) +#define glMultiTexBufferEXT MANGLE(MultiTexBufferEXT) +#define glMultiTexCoord1dARB MANGLE(MultiTexCoord1dARB) +#define glMultiTexCoord1d MANGLE(MultiTexCoord1d) +#define glMultiTexCoord1dvARB MANGLE(MultiTexCoord1dvARB) +#define glMultiTexCoord1dv MANGLE(MultiTexCoord1dv) +#define glMultiTexCoord1fARB MANGLE(MultiTexCoord1fARB) +#define glMultiTexCoord1f MANGLE(MultiTexCoord1f) +#define glMultiTexCoord1fvARB MANGLE(MultiTexCoord1fvARB) +#define glMultiTexCoord1fv MANGLE(MultiTexCoord1fv) +#define glMultiTexCoord1hNV MANGLE(MultiTexCoord1hNV) +#define glMultiTexCoord1hvNV MANGLE(MultiTexCoord1hvNV) +#define glMultiTexCoord1iARB MANGLE(MultiTexCoord1iARB) +#define glMultiTexCoord1i MANGLE(MultiTexCoord1i) +#define glMultiTexCoord1ivARB MANGLE(MultiTexCoord1ivARB) +#define glMultiTexCoord1iv MANGLE(MultiTexCoord1iv) +#define glMultiTexCoord1sARB MANGLE(MultiTexCoord1sARB) +#define glMultiTexCoord1s MANGLE(MultiTexCoord1s) +#define glMultiTexCoord1svARB MANGLE(MultiTexCoord1svARB) +#define glMultiTexCoord1sv MANGLE(MultiTexCoord1sv) +#define glMultiTexCoord2dARB MANGLE(MultiTexCoord2dARB) +#define glMultiTexCoord2d MANGLE(MultiTexCoord2d) +#define glMultiTexCoord2dvARB MANGLE(MultiTexCoord2dvARB) +#define glMultiTexCoord2dv MANGLE(MultiTexCoord2dv) +#define glMultiTexCoord2fARB MANGLE(MultiTexCoord2fARB) +#define glMultiTexCoord2f MANGLE(MultiTexCoord2f) +#define glMultiTexCoord2fvARB MANGLE(MultiTexCoord2fvARB) +#define glMultiTexCoord2fv MANGLE(MultiTexCoord2fv) +#define glMultiTexCoord2hNV MANGLE(MultiTexCoord2hNV) +#define glMultiTexCoord2hvNV MANGLE(MultiTexCoord2hvNV) +#define glMultiTexCoord2iARB MANGLE(MultiTexCoord2iARB) +#define glMultiTexCoord2i MANGLE(MultiTexCoord2i) +#define glMultiTexCoord2ivARB MANGLE(MultiTexCoord2ivARB) +#define glMultiTexCoord2iv MANGLE(MultiTexCoord2iv) +#define glMultiTexCoord2sARB MANGLE(MultiTexCoord2sARB) +#define glMultiTexCoord2s MANGLE(MultiTexCoord2s) +#define glMultiTexCoord2svARB MANGLE(MultiTexCoord2svARB) +#define glMultiTexCoord2sv MANGLE(MultiTexCoord2sv) +#define glMultiTexCoord3dARB MANGLE(MultiTexCoord3dARB) +#define glMultiTexCoord3d MANGLE(MultiTexCoord3d) +#define glMultiTexCoord3dvARB MANGLE(MultiTexCoord3dvARB) +#define glMultiTexCoord3dv MANGLE(MultiTexCoord3dv) +#define glMultiTexCoord3fARB MANGLE(MultiTexCoord3fARB) +#define glMultiTexCoord3f MANGLE(MultiTexCoord3f) +#define glMultiTexCoord3fvARB MANGLE(MultiTexCoord3fvARB) +#define glMultiTexCoord3fv MANGLE(MultiTexCoord3fv) +#define glMultiTexCoord3hNV MANGLE(MultiTexCoord3hNV) +#define glMultiTexCoord3hvNV MANGLE(MultiTexCoord3hvNV) +#define glMultiTexCoord3iARB MANGLE(MultiTexCoord3iARB) +#define glMultiTexCoord3i MANGLE(MultiTexCoord3i) +#define glMultiTexCoord3ivARB MANGLE(MultiTexCoord3ivARB) +#define glMultiTexCoord3iv MANGLE(MultiTexCoord3iv) +#define glMultiTexCoord3sARB MANGLE(MultiTexCoord3sARB) +#define glMultiTexCoord3s MANGLE(MultiTexCoord3s) +#define glMultiTexCoord3svARB MANGLE(MultiTexCoord3svARB) +#define glMultiTexCoord3sv MANGLE(MultiTexCoord3sv) +#define glMultiTexCoord4dARB MANGLE(MultiTexCoord4dARB) +#define glMultiTexCoord4d MANGLE(MultiTexCoord4d) +#define glMultiTexCoord4dvARB MANGLE(MultiTexCoord4dvARB) +#define glMultiTexCoord4dv MANGLE(MultiTexCoord4dv) +#define glMultiTexCoord4fARB MANGLE(MultiTexCoord4fARB) +#define glMultiTexCoord4f MANGLE(MultiTexCoord4f) +#define glMultiTexCoord4fvARB MANGLE(MultiTexCoord4fvARB) +#define glMultiTexCoord4fv MANGLE(MultiTexCoord4fv) +#define glMultiTexCoord4hNV MANGLE(MultiTexCoord4hNV) +#define glMultiTexCoord4hvNV MANGLE(MultiTexCoord4hvNV) +#define glMultiTexCoord4iARB MANGLE(MultiTexCoord4iARB) +#define glMultiTexCoord4i MANGLE(MultiTexCoord4i) +#define glMultiTexCoord4ivARB MANGLE(MultiTexCoord4ivARB) +#define glMultiTexCoord4iv MANGLE(MultiTexCoord4iv) +#define glMultiTexCoord4sARB MANGLE(MultiTexCoord4sARB) +#define glMultiTexCoord4s MANGLE(MultiTexCoord4s) +#define glMultiTexCoord4svARB MANGLE(MultiTexCoord4svARB) +#define glMultiTexCoord4sv MANGLE(MultiTexCoord4sv) +#define glMultiTexCoordP1ui MANGLE(MultiTexCoordP1ui) +#define glMultiTexCoordP1uiv MANGLE(MultiTexCoordP1uiv) +#define glMultiTexCoordP2ui MANGLE(MultiTexCoordP2ui) +#define glMultiTexCoordP2uiv MANGLE(MultiTexCoordP2uiv) +#define glMultiTexCoordP3ui MANGLE(MultiTexCoordP3ui) +#define glMultiTexCoordP3uiv MANGLE(MultiTexCoordP3uiv) +#define glMultiTexCoordP4ui MANGLE(MultiTexCoordP4ui) +#define glMultiTexCoordP4uiv MANGLE(MultiTexCoordP4uiv) +#define glMultiTexCoordPointerEXT MANGLE(MultiTexCoordPointerEXT) +#define glMultiTexEnvfEXT MANGLE(MultiTexEnvfEXT) +#define glMultiTexEnvfvEXT MANGLE(MultiTexEnvfvEXT) +#define glMultiTexEnviEXT MANGLE(MultiTexEnviEXT) +#define glMultiTexEnvivEXT MANGLE(MultiTexEnvivEXT) +#define glMultiTexGendEXT MANGLE(MultiTexGendEXT) +#define glMultiTexGendvEXT MANGLE(MultiTexGendvEXT) +#define glMultiTexGenfEXT MANGLE(MultiTexGenfEXT) +#define glMultiTexGenfvEXT MANGLE(MultiTexGenfvEXT) +#define glMultiTexGeniEXT MANGLE(MultiTexGeniEXT) +#define glMultiTexGenivEXT MANGLE(MultiTexGenivEXT) +#define glMultiTexImage1DEXT MANGLE(MultiTexImage1DEXT) +#define glMultiTexImage2DEXT MANGLE(MultiTexImage2DEXT) +#define glMultiTexImage3DEXT MANGLE(MultiTexImage3DEXT) +#define glMultiTexParameterfEXT MANGLE(MultiTexParameterfEXT) +#define glMultiTexParameterfvEXT MANGLE(MultiTexParameterfvEXT) +#define glMultiTexParameteriEXT MANGLE(MultiTexParameteriEXT) +#define glMultiTexParameterIivEXT MANGLE(MultiTexParameterIivEXT) +#define glMultiTexParameterIuivEXT MANGLE(MultiTexParameterIuivEXT) +#define glMultiTexParameterivEXT MANGLE(MultiTexParameterivEXT) +#define glMultiTexRenderbufferEXT MANGLE(MultiTexRenderbufferEXT) +#define glMultiTexSubImage1DEXT MANGLE(MultiTexSubImage1DEXT) +#define glMultiTexSubImage2DEXT MANGLE(MultiTexSubImage2DEXT) +#define glMultiTexSubImage3DEXT MANGLE(MultiTexSubImage3DEXT) +#define glMultMatrixd MANGLE(MultMatrixd) +#define glMultMatrixf MANGLE(MultMatrixf) +#define glMultTransposeMatrixdARB MANGLE(MultTransposeMatrixdARB) +#define glMultTransposeMatrixd MANGLE(MultTransposeMatrixd) +#define glMultTransposeMatrixfARB MANGLE(MultTransposeMatrixfARB) +#define glMultTransposeMatrixf MANGLE(MultTransposeMatrixf) +#define glNamedBufferDataEXT MANGLE(NamedBufferDataEXT) +#define glNamedBufferSubDataEXT MANGLE(NamedBufferSubDataEXT) +#define glNamedCopyBufferSubDataEXT MANGLE(NamedCopyBufferSubDataEXT) +#define glNamedFramebufferRenderbufferEXT MANGLE(NamedFramebufferRenderbufferEXT) +#define glNamedFramebufferTexture1DEXT MANGLE(NamedFramebufferTexture1DEXT) +#define glNamedFramebufferTexture2DEXT MANGLE(NamedFramebufferTexture2DEXT) +#define glNamedFramebufferTexture3DEXT MANGLE(NamedFramebufferTexture3DEXT) +#define glNamedFramebufferTextureEXT MANGLE(NamedFramebufferTextureEXT) +#define glNamedFramebufferTextureFaceEXT MANGLE(NamedFramebufferTextureFaceEXT) +#define glNamedFramebufferTextureLayerEXT MANGLE(NamedFramebufferTextureLayerEXT) +#define glNamedProgramLocalParameter4dEXT MANGLE(NamedProgramLocalParameter4dEXT) +#define glNamedProgramLocalParameter4dvEXT MANGLE(NamedProgramLocalParameter4dvEXT) +#define glNamedProgramLocalParameter4fEXT MANGLE(NamedProgramLocalParameter4fEXT) +#define glNamedProgramLocalParameter4fvEXT MANGLE(NamedProgramLocalParameter4fvEXT) +#define glNamedProgramLocalParameterI4iEXT MANGLE(NamedProgramLocalParameterI4iEXT) +#define glNamedProgramLocalParameterI4ivEXT MANGLE(NamedProgramLocalParameterI4ivEXT) +#define glNamedProgramLocalParameterI4uiEXT MANGLE(NamedProgramLocalParameterI4uiEXT) +#define glNamedProgramLocalParameterI4uivEXT MANGLE(NamedProgramLocalParameterI4uivEXT) +#define glNamedProgramLocalParameters4fvEXT MANGLE(NamedProgramLocalParameters4fvEXT) +#define glNamedProgramLocalParametersI4ivEXT MANGLE(NamedProgramLocalParametersI4ivEXT) +#define glNamedProgramLocalParametersI4uivEXT MANGLE(NamedProgramLocalParametersI4uivEXT) +#define glNamedProgramStringEXT MANGLE(NamedProgramStringEXT) +#define glNamedRenderbufferStorageEXT MANGLE(NamedRenderbufferStorageEXT) +#define glNamedRenderbufferStorageMultisampleCoverageEXT MANGLE(NamedRenderbufferStorageMultisampleCoverageEXT) +#define glNamedRenderbufferStorageMultisampleEXT MANGLE(NamedRenderbufferStorageMultisampleEXT) +#define glNamedStringARB MANGLE(NamedStringARB) +#define glNewList MANGLE(NewList) +#define glNewObjectBufferATI MANGLE(NewObjectBufferATI) +#define glNormal3b MANGLE(Normal3b) +#define glNormal3bv MANGLE(Normal3bv) +#define glNormal3d MANGLE(Normal3d) +#define glNormal3dv MANGLE(Normal3dv) +#define glNormal3f MANGLE(Normal3f) +#define glNormal3fVertex3fSUN MANGLE(Normal3fVertex3fSUN) +#define glNormal3fVertex3fvSUN MANGLE(Normal3fVertex3fvSUN) +#define glNormal3fv MANGLE(Normal3fv) +#define glNormal3hNV MANGLE(Normal3hNV) +#define glNormal3hvNV MANGLE(Normal3hvNV) +#define glNormal3i MANGLE(Normal3i) +#define glNormal3iv MANGLE(Normal3iv) +#define glNormal3s MANGLE(Normal3s) +#define glNormal3sv MANGLE(Normal3sv) +#define glNormalFormatNV MANGLE(NormalFormatNV) +#define glNormalP3ui MANGLE(NormalP3ui) +#define glNormalP3uiv MANGLE(NormalP3uiv) +#define glNormalPointerEXT MANGLE(NormalPointerEXT) +#define glNormalPointerListIBM MANGLE(NormalPointerListIBM) +#define glNormalPointer MANGLE(NormalPointer) +#define glNormalPointervINTEL MANGLE(NormalPointervINTEL) +#define glNormalStream3bATI MANGLE(NormalStream3bATI) +#define glNormalStream3bvATI MANGLE(NormalStream3bvATI) +#define glNormalStream3dATI MANGLE(NormalStream3dATI) +#define glNormalStream3dvATI MANGLE(NormalStream3dvATI) +#define glNormalStream3fATI MANGLE(NormalStream3fATI) +#define glNormalStream3fvATI MANGLE(NormalStream3fvATI) +#define glNormalStream3iATI MANGLE(NormalStream3iATI) +#define glNormalStream3ivATI MANGLE(NormalStream3ivATI) +#define glNormalStream3sATI MANGLE(NormalStream3sATI) +#define glNormalStream3svATI MANGLE(NormalStream3svATI) +#define glObjectPurgeableAPPLE MANGLE(ObjectPurgeableAPPLE) +#define glObjectUnpurgeableAPPLE MANGLE(ObjectUnpurgeableAPPLE) +#define glOrtho MANGLE(Ortho) +#define glPassTexCoordATI MANGLE(PassTexCoordATI) +#define glPassThrough MANGLE(PassThrough) +#define glPatchParameterfv MANGLE(PatchParameterfv) +#define glPatchParameteri MANGLE(PatchParameteri) +#define glPauseTransformFeedback MANGLE(PauseTransformFeedback) +#define glPauseTransformFeedbackNV MANGLE(PauseTransformFeedbackNV) +#define glPixelDataRangeNV MANGLE(PixelDataRangeNV) +#define glPixelMapfv MANGLE(PixelMapfv) +#define glPixelMapuiv MANGLE(PixelMapuiv) +#define glPixelMapusv MANGLE(PixelMapusv) +#define glPixelStoref MANGLE(PixelStoref) +#define glPixelStorei MANGLE(PixelStorei) +#define glPixelTexGenParameterfSGIS MANGLE(PixelTexGenParameterfSGIS) +#define glPixelTexGenParameterfvSGIS MANGLE(PixelTexGenParameterfvSGIS) +#define glPixelTexGenParameteriSGIS MANGLE(PixelTexGenParameteriSGIS) +#define glPixelTexGenParameterivSGIS MANGLE(PixelTexGenParameterivSGIS) +#define glPixelTexGenSGIX MANGLE(PixelTexGenSGIX) +#define glPixelTransferf MANGLE(PixelTransferf) +#define glPixelTransferi MANGLE(PixelTransferi) +#define glPixelTransformParameterfEXT MANGLE(PixelTransformParameterfEXT) +#define glPixelTransformParameterfvEXT MANGLE(PixelTransformParameterfvEXT) +#define glPixelTransformParameteriEXT MANGLE(PixelTransformParameteriEXT) +#define glPixelTransformParameterivEXT MANGLE(PixelTransformParameterivEXT) +#define glPixelZoom MANGLE(PixelZoom) +#define glPNTrianglesfATI MANGLE(PNTrianglesfATI) +#define glPNTrianglesiATI MANGLE(PNTrianglesiATI) +#define glPointParameterfARB MANGLE(PointParameterfARB) +#define glPointParameterfEXT MANGLE(PointParameterfEXT) +#define glPointParameterf MANGLE(PointParameterf) +#define glPointParameterfSGIS MANGLE(PointParameterfSGIS) +#define glPointParameterfvARB MANGLE(PointParameterfvARB) +#define glPointParameterfvEXT MANGLE(PointParameterfvEXT) +#define glPointParameterfv MANGLE(PointParameterfv) +#define glPointParameterfvSGIS MANGLE(PointParameterfvSGIS) +#define glPointParameteri MANGLE(PointParameteri) +#define glPointParameteriNV MANGLE(PointParameteriNV) +#define glPointParameteriv MANGLE(PointParameteriv) +#define glPointParameterivNV MANGLE(PointParameterivNV) +#define glPointSize MANGLE(PointSize) +#define glPollAsyncSGIX MANGLE(PollAsyncSGIX) +#define glPollInstrumentsSGIX MANGLE(PollInstrumentsSGIX) +#define glPolygonMode MANGLE(PolygonMode) +#define glPolygonOffsetEXT MANGLE(PolygonOffsetEXT) +#define glPolygonOffset MANGLE(PolygonOffset) +#define glPolygonStipple MANGLE(PolygonStipple) +#define glPopAttrib MANGLE(PopAttrib) +#define glPopClientAttrib MANGLE(PopClientAttrib) +#define glPopMatrix MANGLE(PopMatrix) +#define glPopName MANGLE(PopName) +#define glPresentFrameDualFillNV MANGLE(PresentFrameDualFillNV) +#define glPresentFrameKeyedNV MANGLE(PresentFrameKeyedNV) +#define glPrimitiveRestartIndex MANGLE(PrimitiveRestartIndex) +#define glPrimitiveRestartIndexNV MANGLE(PrimitiveRestartIndexNV) +#define glPrimitiveRestartNV MANGLE(PrimitiveRestartNV) +#define glPrioritizeTexturesEXT MANGLE(PrioritizeTexturesEXT) +#define glPrioritizeTextures MANGLE(PrioritizeTextures) +#define glProgramBinary MANGLE(ProgramBinary) +#define glProgramBufferParametersfvNV MANGLE(ProgramBufferParametersfvNV) +#define glProgramBufferParametersIivNV MANGLE(ProgramBufferParametersIivNV) +#define glProgramBufferParametersIuivNV MANGLE(ProgramBufferParametersIuivNV) +#define glProgramCallbackMESA MANGLE(ProgramCallbackMESA) +#define glProgramEnvParameter4dARB MANGLE(ProgramEnvParameter4dARB) +#define glProgramEnvParameter4dvARB MANGLE(ProgramEnvParameter4dvARB) +#define glProgramEnvParameter4fARB MANGLE(ProgramEnvParameter4fARB) +#define glProgramEnvParameter4fvARB MANGLE(ProgramEnvParameter4fvARB) +#define glProgramEnvParameterI4iNV MANGLE(ProgramEnvParameterI4iNV) +#define glProgramEnvParameterI4ivNV MANGLE(ProgramEnvParameterI4ivNV) +#define glProgramEnvParameterI4uiNV MANGLE(ProgramEnvParameterI4uiNV) +#define glProgramEnvParameterI4uivNV MANGLE(ProgramEnvParameterI4uivNV) +#define glProgramEnvParameters4fvEXT MANGLE(ProgramEnvParameters4fvEXT) +#define glProgramEnvParametersI4ivNV MANGLE(ProgramEnvParametersI4ivNV) +#define glProgramEnvParametersI4uivNV MANGLE(ProgramEnvParametersI4uivNV) +#define glProgramLocalParameter4dARB MANGLE(ProgramLocalParameter4dARB) +#define glProgramLocalParameter4dvARB MANGLE(ProgramLocalParameter4dvARB) +#define glProgramLocalParameter4fARB MANGLE(ProgramLocalParameter4fARB) +#define glProgramLocalParameter4fvARB MANGLE(ProgramLocalParameter4fvARB) +#define glProgramLocalParameterI4iNV MANGLE(ProgramLocalParameterI4iNV) +#define glProgramLocalParameterI4ivNV MANGLE(ProgramLocalParameterI4ivNV) +#define glProgramLocalParameterI4uiNV MANGLE(ProgramLocalParameterI4uiNV) +#define glProgramLocalParameterI4uivNV MANGLE(ProgramLocalParameterI4uivNV) +#define glProgramLocalParameters4fvEXT MANGLE(ProgramLocalParameters4fvEXT) +#define glProgramLocalParametersI4ivNV MANGLE(ProgramLocalParametersI4ivNV) +#define glProgramLocalParametersI4uivNV MANGLE(ProgramLocalParametersI4uivNV) +#define glProgramNamedParameter4dNV MANGLE(ProgramNamedParameter4dNV) +#define glProgramNamedParameter4dvNV MANGLE(ProgramNamedParameter4dvNV) +#define glProgramNamedParameter4fNV MANGLE(ProgramNamedParameter4fNV) +#define glProgramNamedParameter4fvNV MANGLE(ProgramNamedParameter4fvNV) +#define glProgramParameter4dNV MANGLE(ProgramParameter4dNV) +#define glProgramParameter4dvNV MANGLE(ProgramParameter4dvNV) +#define glProgramParameter4fNV MANGLE(ProgramParameter4fNV) +#define glProgramParameter4fvNV MANGLE(ProgramParameter4fvNV) +#define glProgramParameteriARB MANGLE(ProgramParameteriARB) +#define glProgramParameteriEXT MANGLE(ProgramParameteriEXT) +#define glProgramParameteri MANGLE(ProgramParameteri) +#define glProgramParameters4dvNV MANGLE(ProgramParameters4dvNV) +#define glProgramParameters4fvNV MANGLE(ProgramParameters4fvNV) +#define glProgramStringARB MANGLE(ProgramStringARB) +#define glProgramSubroutineParametersuivNV MANGLE(ProgramSubroutineParametersuivNV) +#define glProgramUniform1dEXT MANGLE(ProgramUniform1dEXT) +#define glProgramUniform1d MANGLE(ProgramUniform1d) +#define glProgramUniform1dvEXT MANGLE(ProgramUniform1dvEXT) +#define glProgramUniform1dv MANGLE(ProgramUniform1dv) +#define glProgramUniform1fEXT MANGLE(ProgramUniform1fEXT) +#define glProgramUniform1f MANGLE(ProgramUniform1f) +#define glProgramUniform1fvEXT MANGLE(ProgramUniform1fvEXT) +#define glProgramUniform1fv MANGLE(ProgramUniform1fv) +#define glProgramUniform1i64NV MANGLE(ProgramUniform1i64NV) +#define glProgramUniform1i64vNV MANGLE(ProgramUniform1i64vNV) +#define glProgramUniform1iEXT MANGLE(ProgramUniform1iEXT) +#define glProgramUniform1i MANGLE(ProgramUniform1i) +#define glProgramUniform1ivEXT MANGLE(ProgramUniform1ivEXT) +#define glProgramUniform1iv MANGLE(ProgramUniform1iv) +#define glProgramUniform1ui64NV MANGLE(ProgramUniform1ui64NV) +#define glProgramUniform1ui64vNV MANGLE(ProgramUniform1ui64vNV) +#define glProgramUniform1uiEXT MANGLE(ProgramUniform1uiEXT) +#define glProgramUniform1ui MANGLE(ProgramUniform1ui) +#define glProgramUniform1uivEXT MANGLE(ProgramUniform1uivEXT) +#define glProgramUniform1uiv MANGLE(ProgramUniform1uiv) +#define glProgramUniform2dEXT MANGLE(ProgramUniform2dEXT) +#define glProgramUniform2d MANGLE(ProgramUniform2d) +#define glProgramUniform2dvEXT MANGLE(ProgramUniform2dvEXT) +#define glProgramUniform2dv MANGLE(ProgramUniform2dv) +#define glProgramUniform2fEXT MANGLE(ProgramUniform2fEXT) +#define glProgramUniform2f MANGLE(ProgramUniform2f) +#define glProgramUniform2fvEXT MANGLE(ProgramUniform2fvEXT) +#define glProgramUniform2fv MANGLE(ProgramUniform2fv) +#define glProgramUniform2i64NV MANGLE(ProgramUniform2i64NV) +#define glProgramUniform2i64vNV MANGLE(ProgramUniform2i64vNV) +#define glProgramUniform2iEXT MANGLE(ProgramUniform2iEXT) +#define glProgramUniform2i MANGLE(ProgramUniform2i) +#define glProgramUniform2ivEXT MANGLE(ProgramUniform2ivEXT) +#define glProgramUniform2iv MANGLE(ProgramUniform2iv) +#define glProgramUniform2ui64NV MANGLE(ProgramUniform2ui64NV) +#define glProgramUniform2ui64vNV MANGLE(ProgramUniform2ui64vNV) +#define glProgramUniform2uiEXT MANGLE(ProgramUniform2uiEXT) +#define glProgramUniform2ui MANGLE(ProgramUniform2ui) +#define glProgramUniform2uivEXT MANGLE(ProgramUniform2uivEXT) +#define glProgramUniform2uiv MANGLE(ProgramUniform2uiv) +#define glProgramUniform3dEXT MANGLE(ProgramUniform3dEXT) +#define glProgramUniform3d MANGLE(ProgramUniform3d) +#define glProgramUniform3dvEXT MANGLE(ProgramUniform3dvEXT) +#define glProgramUniform3dv MANGLE(ProgramUniform3dv) +#define glProgramUniform3fEXT MANGLE(ProgramUniform3fEXT) +#define glProgramUniform3f MANGLE(ProgramUniform3f) +#define glProgramUniform3fvEXT MANGLE(ProgramUniform3fvEXT) +#define glProgramUniform3fv MANGLE(ProgramUniform3fv) +#define glProgramUniform3i64NV MANGLE(ProgramUniform3i64NV) +#define glProgramUniform3i64vNV MANGLE(ProgramUniform3i64vNV) +#define glProgramUniform3iEXT MANGLE(ProgramUniform3iEXT) +#define glProgramUniform3i MANGLE(ProgramUniform3i) +#define glProgramUniform3ivEXT MANGLE(ProgramUniform3ivEXT) +#define glProgramUniform3iv MANGLE(ProgramUniform3iv) +#define glProgramUniform3ui64NV MANGLE(ProgramUniform3ui64NV) +#define glProgramUniform3ui64vNV MANGLE(ProgramUniform3ui64vNV) +#define glProgramUniform3uiEXT MANGLE(ProgramUniform3uiEXT) +#define glProgramUniform3ui MANGLE(ProgramUniform3ui) +#define glProgramUniform3uivEXT MANGLE(ProgramUniform3uivEXT) +#define glProgramUniform3uiv MANGLE(ProgramUniform3uiv) +#define glProgramUniform4dEXT MANGLE(ProgramUniform4dEXT) +#define glProgramUniform4d MANGLE(ProgramUniform4d) +#define glProgramUniform4dvEXT MANGLE(ProgramUniform4dvEXT) +#define glProgramUniform4dv MANGLE(ProgramUniform4dv) +#define glProgramUniform4fEXT MANGLE(ProgramUniform4fEXT) +#define glProgramUniform4f MANGLE(ProgramUniform4f) +#define glProgramUniform4fvEXT MANGLE(ProgramUniform4fvEXT) +#define glProgramUniform4fv MANGLE(ProgramUniform4fv) +#define glProgramUniform4i64NV MANGLE(ProgramUniform4i64NV) +#define glProgramUniform4i64vNV MANGLE(ProgramUniform4i64vNV) +#define glProgramUniform4iEXT MANGLE(ProgramUniform4iEXT) +#define glProgramUniform4i MANGLE(ProgramUniform4i) +#define glProgramUniform4ivEXT MANGLE(ProgramUniform4ivEXT) +#define glProgramUniform4iv MANGLE(ProgramUniform4iv) +#define glProgramUniform4ui64NV MANGLE(ProgramUniform4ui64NV) +#define glProgramUniform4ui64vNV MANGLE(ProgramUniform4ui64vNV) +#define glProgramUniform4uiEXT MANGLE(ProgramUniform4uiEXT) +#define glProgramUniform4ui MANGLE(ProgramUniform4ui) +#define glProgramUniform4uivEXT MANGLE(ProgramUniform4uivEXT) +#define glProgramUniform4uiv MANGLE(ProgramUniform4uiv) +#define glProgramUniformMatrix2dvEXT MANGLE(ProgramUniformMatrix2dvEXT) +#define glProgramUniformMatrix2dv MANGLE(ProgramUniformMatrix2dv) +#define glProgramUniformMatrix2fvEXT MANGLE(ProgramUniformMatrix2fvEXT) +#define glProgramUniformMatrix2fv MANGLE(ProgramUniformMatrix2fv) +#define glProgramUniformMatrix2x3dvEXT MANGLE(ProgramUniformMatrix2x3dvEXT) +#define glProgramUniformMatrix2x3dv MANGLE(ProgramUniformMatrix2x3dv) +#define glProgramUniformMatrix2x3fvEXT MANGLE(ProgramUniformMatrix2x3fvEXT) +#define glProgramUniformMatrix2x3fv MANGLE(ProgramUniformMatrix2x3fv) +#define glProgramUniformMatrix2x4dvEXT MANGLE(ProgramUniformMatrix2x4dvEXT) +#define glProgramUniformMatrix2x4dv MANGLE(ProgramUniformMatrix2x4dv) +#define glProgramUniformMatrix2x4fvEXT MANGLE(ProgramUniformMatrix2x4fvEXT) +#define glProgramUniformMatrix2x4fv MANGLE(ProgramUniformMatrix2x4fv) +#define glProgramUniformMatrix3dvEXT MANGLE(ProgramUniformMatrix3dvEXT) +#define glProgramUniformMatrix3dv MANGLE(ProgramUniformMatrix3dv) +#define glProgramUniformMatrix3fvEXT MANGLE(ProgramUniformMatrix3fvEXT) +#define glProgramUniformMatrix3fv MANGLE(ProgramUniformMatrix3fv) +#define glProgramUniformMatrix3x2dvEXT MANGLE(ProgramUniformMatrix3x2dvEXT) +#define glProgramUniformMatrix3x2dv MANGLE(ProgramUniformMatrix3x2dv) +#define glProgramUniformMatrix3x2fvEXT MANGLE(ProgramUniformMatrix3x2fvEXT) +#define glProgramUniformMatrix3x2fv MANGLE(ProgramUniformMatrix3x2fv) +#define glProgramUniformMatrix3x4dvEXT MANGLE(ProgramUniformMatrix3x4dvEXT) +#define glProgramUniformMatrix3x4dv MANGLE(ProgramUniformMatrix3x4dv) +#define glProgramUniformMatrix3x4fvEXT MANGLE(ProgramUniformMatrix3x4fvEXT) +#define glProgramUniformMatrix3x4fv MANGLE(ProgramUniformMatrix3x4fv) +#define glProgramUniformMatrix4dvEXT MANGLE(ProgramUniformMatrix4dvEXT) +#define glProgramUniformMatrix4dv MANGLE(ProgramUniformMatrix4dv) +#define glProgramUniformMatrix4fvEXT MANGLE(ProgramUniformMatrix4fvEXT) +#define glProgramUniformMatrix4fv MANGLE(ProgramUniformMatrix4fv) +#define glProgramUniformMatrix4x2dvEXT MANGLE(ProgramUniformMatrix4x2dvEXT) +#define glProgramUniformMatrix4x2dv MANGLE(ProgramUniformMatrix4x2dv) +#define glProgramUniformMatrix4x2fvEXT MANGLE(ProgramUniformMatrix4x2fvEXT) +#define glProgramUniformMatrix4x2fv MANGLE(ProgramUniformMatrix4x2fv) +#define glProgramUniformMatrix4x3dvEXT MANGLE(ProgramUniformMatrix4x3dvEXT) +#define glProgramUniformMatrix4x3dv MANGLE(ProgramUniformMatrix4x3dv) +#define glProgramUniformMatrix4x3fvEXT MANGLE(ProgramUniformMatrix4x3fvEXT) +#define glProgramUniformMatrix4x3fv MANGLE(ProgramUniformMatrix4x3fv) +#define glProgramUniformui64NV MANGLE(ProgramUniformui64NV) +#define glProgramUniformui64vNV MANGLE(ProgramUniformui64vNV) +#define glProgramVertexLimitNV MANGLE(ProgramVertexLimitNV) +#define glProvokingVertexEXT MANGLE(ProvokingVertexEXT) +#define glProvokingVertex MANGLE(ProvokingVertex) +#define glPushAttrib MANGLE(PushAttrib) +#define glPushClientAttribDefaultEXT MANGLE(PushClientAttribDefaultEXT) +#define glPushClientAttrib MANGLE(PushClientAttrib) +#define glPushMatrix MANGLE(PushMatrix) +#define glPushName MANGLE(PushName) +#define glQueryCounter MANGLE(QueryCounter) +#define glRasterPos2d MANGLE(RasterPos2d) +#define glRasterPos2dv MANGLE(RasterPos2dv) +#define glRasterPos2f MANGLE(RasterPos2f) +#define glRasterPos2fv MANGLE(RasterPos2fv) +#define glRasterPos2i MANGLE(RasterPos2i) +#define glRasterPos2iv MANGLE(RasterPos2iv) +#define glRasterPos2s MANGLE(RasterPos2s) +#define glRasterPos2sv MANGLE(RasterPos2sv) +#define glRasterPos3d MANGLE(RasterPos3d) +#define glRasterPos3dv MANGLE(RasterPos3dv) +#define glRasterPos3f MANGLE(RasterPos3f) +#define glRasterPos3fv MANGLE(RasterPos3fv) +#define glRasterPos3i MANGLE(RasterPos3i) +#define glRasterPos3iv MANGLE(RasterPos3iv) +#define glRasterPos3s MANGLE(RasterPos3s) +#define glRasterPos3sv MANGLE(RasterPos3sv) +#define glRasterPos4d MANGLE(RasterPos4d) +#define glRasterPos4dv MANGLE(RasterPos4dv) +#define glRasterPos4f MANGLE(RasterPos4f) +#define glRasterPos4fv MANGLE(RasterPos4fv) +#define glRasterPos4i MANGLE(RasterPos4i) +#define glRasterPos4iv MANGLE(RasterPos4iv) +#define glRasterPos4s MANGLE(RasterPos4s) +#define glRasterPos4sv MANGLE(RasterPos4sv) +#define glReadBuffer MANGLE(ReadBuffer) +#define glReadInstrumentsSGIX MANGLE(ReadInstrumentsSGIX) +#define glReadnPixelsARB MANGLE(ReadnPixelsARB) +#define glReadPixels MANGLE(ReadPixels) +#define glRectd MANGLE(Rectd) +#define glRectdv MANGLE(Rectdv) +#define glRectf MANGLE(Rectf) +#define glRectfv MANGLE(Rectfv) +#define glRecti MANGLE(Recti) +#define glRectiv MANGLE(Rectiv) +#define glRects MANGLE(Rects) +#define glRectsv MANGLE(Rectsv) +#define glReferencePlaneSGIX MANGLE(ReferencePlaneSGIX) +#define glReleaseShaderCompiler MANGLE(ReleaseShaderCompiler) +#define glRenderbufferStorageEXT MANGLE(RenderbufferStorageEXT) +#define glRenderbufferStorage MANGLE(RenderbufferStorage) +#define glRenderbufferStorageMultisampleCoverageNV MANGLE(RenderbufferStorageMultisampleCoverageNV) +#define glRenderbufferStorageMultisampleEXT MANGLE(RenderbufferStorageMultisampleEXT) +#define glRenderbufferStorageMultisample MANGLE(RenderbufferStorageMultisample) +#define glRenderMode MANGLE(RenderMode) +#define glReplacementCodePointerSUN MANGLE(ReplacementCodePointerSUN) +#define glReplacementCodeubSUN MANGLE(ReplacementCodeubSUN) +#define glReplacementCodeubvSUN MANGLE(ReplacementCodeubvSUN) +#define glReplacementCodeuiColor3fVertex3fSUN MANGLE(ReplacementCodeuiColor3fVertex3fSUN) +#define glReplacementCodeuiColor3fVertex3fvSUN MANGLE(ReplacementCodeuiColor3fVertex3fvSUN) +#define glReplacementCodeuiColor4fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiColor4fNormal3fVertex3fSUN) +#define glReplacementCodeuiColor4fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiColor4fNormal3fVertex3fvSUN) +#define glReplacementCodeuiColor4ubVertex3fSUN MANGLE(ReplacementCodeuiColor4ubVertex3fSUN) +#define glReplacementCodeuiColor4ubVertex3fvSUN MANGLE(ReplacementCodeuiColor4ubVertex3fvSUN) +#define glReplacementCodeuiNormal3fVertex3fSUN MANGLE(ReplacementCodeuiNormal3fVertex3fSUN) +#define glReplacementCodeuiNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiNormal3fVertex3fvSUN) +#define glReplacementCodeuiSUN MANGLE(ReplacementCodeuiSUN) +#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN) +#define glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN) +#define glReplacementCodeuiTexCoord2fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fVertex3fvSUN) +#define glReplacementCodeuiVertex3fSUN MANGLE(ReplacementCodeuiVertex3fSUN) +#define glReplacementCodeuiVertex3fvSUN MANGLE(ReplacementCodeuiVertex3fvSUN) +#define glReplacementCodeuivSUN MANGLE(ReplacementCodeuivSUN) +#define glReplacementCodeusSUN MANGLE(ReplacementCodeusSUN) +#define glReplacementCodeusvSUN MANGLE(ReplacementCodeusvSUN) +#define glRequestResidentProgramsNV MANGLE(RequestResidentProgramsNV) +#define glResetHistogramEXT MANGLE(ResetHistogramEXT) +#define glResetHistogram MANGLE(ResetHistogram) +#define glResetMinmaxEXT MANGLE(ResetMinmaxEXT) +#define glResetMinmax MANGLE(ResetMinmax) +#define glResizeBuffersMESA MANGLE(ResizeBuffersMESA) +#define glResumeTransformFeedback MANGLE(ResumeTransformFeedback) +#define glResumeTransformFeedbackNV MANGLE(ResumeTransformFeedbackNV) +#define glRotated MANGLE(Rotated) +#define glRotatef MANGLE(Rotatef) +#define glSampleCoverageARB MANGLE(SampleCoverageARB) +#define glSampleCoverage MANGLE(SampleCoverage) +#define glSampleMapATI MANGLE(SampleMapATI) +#define glSampleMaskEXT MANGLE(SampleMaskEXT) +#define glSampleMaski MANGLE(SampleMaski) +#define glSampleMaskIndexedNV MANGLE(SampleMaskIndexedNV) +#define glSampleMaskSGIS MANGLE(SampleMaskSGIS) +#define glSamplePatternEXT MANGLE(SamplePatternEXT) +#define glSamplePatternSGIS MANGLE(SamplePatternSGIS) +#define glSamplerParameterf MANGLE(SamplerParameterf) +#define glSamplerParameterfv MANGLE(SamplerParameterfv) +#define glSamplerParameterIiv MANGLE(SamplerParameterIiv) +#define glSamplerParameteri MANGLE(SamplerParameteri) +#define glSamplerParameterIuiv MANGLE(SamplerParameterIuiv) +#define glSamplerParameteriv MANGLE(SamplerParameteriv) +#define glScaled MANGLE(Scaled) +#define glScalef MANGLE(Scalef) +#define glScissorArrayv MANGLE(ScissorArrayv) +#define glScissorIndexed MANGLE(ScissorIndexed) +#define glScissorIndexedv MANGLE(ScissorIndexedv) +#define glScissor MANGLE(Scissor) +#define glSecondaryColor3bEXT MANGLE(SecondaryColor3bEXT) +#define glSecondaryColor3b MANGLE(SecondaryColor3b) +#define glSecondaryColor3bvEXT MANGLE(SecondaryColor3bvEXT) +#define glSecondaryColor3bv MANGLE(SecondaryColor3bv) +#define glSecondaryColor3dEXT MANGLE(SecondaryColor3dEXT) +#define glSecondaryColor3d MANGLE(SecondaryColor3d) +#define glSecondaryColor3dvEXT MANGLE(SecondaryColor3dvEXT) +#define glSecondaryColor3dv MANGLE(SecondaryColor3dv) +#define glSecondaryColor3fEXT MANGLE(SecondaryColor3fEXT) +#define glSecondaryColor3f MANGLE(SecondaryColor3f) +#define glSecondaryColor3fvEXT MANGLE(SecondaryColor3fvEXT) +#define glSecondaryColor3fv MANGLE(SecondaryColor3fv) +#define glSecondaryColor3hNV MANGLE(SecondaryColor3hNV) +#define glSecondaryColor3hvNV MANGLE(SecondaryColor3hvNV) +#define glSecondaryColor3iEXT MANGLE(SecondaryColor3iEXT) +#define glSecondaryColor3i MANGLE(SecondaryColor3i) +#define glSecondaryColor3ivEXT MANGLE(SecondaryColor3ivEXT) +#define glSecondaryColor3iv MANGLE(SecondaryColor3iv) +#define glSecondaryColor3sEXT MANGLE(SecondaryColor3sEXT) +#define glSecondaryColor3s MANGLE(SecondaryColor3s) +#define glSecondaryColor3svEXT MANGLE(SecondaryColor3svEXT) +#define glSecondaryColor3sv MANGLE(SecondaryColor3sv) +#define glSecondaryColor3ubEXT MANGLE(SecondaryColor3ubEXT) +#define glSecondaryColor3ub MANGLE(SecondaryColor3ub) +#define glSecondaryColor3ubvEXT MANGLE(SecondaryColor3ubvEXT) +#define glSecondaryColor3ubv MANGLE(SecondaryColor3ubv) +#define glSecondaryColor3uiEXT MANGLE(SecondaryColor3uiEXT) +#define glSecondaryColor3ui MANGLE(SecondaryColor3ui) +#define glSecondaryColor3uivEXT MANGLE(SecondaryColor3uivEXT) +#define glSecondaryColor3uiv MANGLE(SecondaryColor3uiv) +#define glSecondaryColor3usEXT MANGLE(SecondaryColor3usEXT) +#define glSecondaryColor3us MANGLE(SecondaryColor3us) +#define glSecondaryColor3usvEXT MANGLE(SecondaryColor3usvEXT) +#define glSecondaryColor3usv MANGLE(SecondaryColor3usv) +#define glSecondaryColorFormatNV MANGLE(SecondaryColorFormatNV) +#define glSecondaryColorP3ui MANGLE(SecondaryColorP3ui) +#define glSecondaryColorP3uiv MANGLE(SecondaryColorP3uiv) +#define glSecondaryColorPointerEXT MANGLE(SecondaryColorPointerEXT) +#define glSecondaryColorPointerListIBM MANGLE(SecondaryColorPointerListIBM) +#define glSecondaryColorPointer MANGLE(SecondaryColorPointer) +#define glSelectBuffer MANGLE(SelectBuffer) +#define glSelectPerfMonitorCountersAMD MANGLE(SelectPerfMonitorCountersAMD) +#define glSeparableFilter2DEXT MANGLE(SeparableFilter2DEXT) +#define glSeparableFilter2D MANGLE(SeparableFilter2D) +#define glSetFenceAPPLE MANGLE(SetFenceAPPLE) +#define glSetFenceNV MANGLE(SetFenceNV) +#define glSetFragmentShaderConstantATI MANGLE(SetFragmentShaderConstantATI) +#define glSetInvariantEXT MANGLE(SetInvariantEXT) +#define glSetLocalConstantEXT MANGLE(SetLocalConstantEXT) +#define glShadeModel MANGLE(ShadeModel) +#define glShaderBinary MANGLE(ShaderBinary) +#define glShaderOp1EXT MANGLE(ShaderOp1EXT) +#define glShaderOp2EXT MANGLE(ShaderOp2EXT) +#define glShaderOp3EXT MANGLE(ShaderOp3EXT) +#define glShaderSourceARB MANGLE(ShaderSourceARB) +#define glShaderSource MANGLE(ShaderSource) +#define glSharpenTexFuncSGIS MANGLE(SharpenTexFuncSGIS) +#define glSpriteParameterfSGIX MANGLE(SpriteParameterfSGIX) +#define glSpriteParameterfvSGIX MANGLE(SpriteParameterfvSGIX) +#define glSpriteParameteriSGIX MANGLE(SpriteParameteriSGIX) +#define glSpriteParameterivSGIX MANGLE(SpriteParameterivSGIX) +#define glStartInstrumentsSGIX MANGLE(StartInstrumentsSGIX) +#define glStencilClearTagEXT MANGLE(StencilClearTagEXT) +#define glStencilFunc MANGLE(StencilFunc) +#define glStencilFuncSeparateATI MANGLE(StencilFuncSeparateATI) +#define glStencilFuncSeparate MANGLE(StencilFuncSeparate) +#define glStencilMask MANGLE(StencilMask) +#define glStencilMaskSeparate MANGLE(StencilMaskSeparate) +#define glStencilOp MANGLE(StencilOp) +#define glStencilOpSeparateATI MANGLE(StencilOpSeparateATI) +#define glStencilOpSeparate MANGLE(StencilOpSeparate) +#define glStopInstrumentsSGIX MANGLE(StopInstrumentsSGIX) +#define glStringMarkerGREMEDY MANGLE(StringMarkerGREMEDY) +#define glSwizzleEXT MANGLE(SwizzleEXT) +#define glTagSampleBufferSGIX MANGLE(TagSampleBufferSGIX) +#define glTangent3bEXT MANGLE(Tangent3bEXT) +#define glTangent3bvEXT MANGLE(Tangent3bvEXT) +#define glTangent3dEXT MANGLE(Tangent3dEXT) +#define glTangent3dvEXT MANGLE(Tangent3dvEXT) +#define glTangent3fEXT MANGLE(Tangent3fEXT) +#define glTangent3fvEXT MANGLE(Tangent3fvEXT) +#define glTangent3iEXT MANGLE(Tangent3iEXT) +#define glTangent3ivEXT MANGLE(Tangent3ivEXT) +#define glTangent3sEXT MANGLE(Tangent3sEXT) +#define glTangent3svEXT MANGLE(Tangent3svEXT) +#define glTangentPointerEXT MANGLE(TangentPointerEXT) +#define glTbufferMask3DFX MANGLE(TbufferMask3DFX) +#define glTessellationFactorAMD MANGLE(TessellationFactorAMD) +#define glTessellationModeAMD MANGLE(TessellationModeAMD) +#define glTestFenceAPPLE MANGLE(TestFenceAPPLE) +#define glTestFenceNV MANGLE(TestFenceNV) +#define glTestObjectAPPLE MANGLE(TestObjectAPPLE) +#define glTexBufferARB MANGLE(TexBufferARB) +#define glTexBufferEXT MANGLE(TexBufferEXT) +#define glTexBuffer MANGLE(TexBuffer) +#define glTexBumpParameterfvATI MANGLE(TexBumpParameterfvATI) +#define glTexBumpParameterivATI MANGLE(TexBumpParameterivATI) +#define glTexCoord1d MANGLE(TexCoord1d) +#define glTexCoord1dv MANGLE(TexCoord1dv) +#define glTexCoord1f MANGLE(TexCoord1f) +#define glTexCoord1fv MANGLE(TexCoord1fv) +#define glTexCoord1hNV MANGLE(TexCoord1hNV) +#define glTexCoord1hvNV MANGLE(TexCoord1hvNV) +#define glTexCoord1i MANGLE(TexCoord1i) +#define glTexCoord1iv MANGLE(TexCoord1iv) +#define glTexCoord1s MANGLE(TexCoord1s) +#define glTexCoord1sv MANGLE(TexCoord1sv) +#define glTexCoord2d MANGLE(TexCoord2d) +#define glTexCoord2dv MANGLE(TexCoord2dv) +#define glTexCoord2fColor3fVertex3fSUN MANGLE(TexCoord2fColor3fVertex3fSUN) +#define glTexCoord2fColor3fVertex3fvSUN MANGLE(TexCoord2fColor3fVertex3fvSUN) +#define glTexCoord2fColor4fNormal3fVertex3fSUN MANGLE(TexCoord2fColor4fNormal3fVertex3fSUN) +#define glTexCoord2fColor4fNormal3fVertex3fvSUN MANGLE(TexCoord2fColor4fNormal3fVertex3fvSUN) +#define glTexCoord2fColor4ubVertex3fSUN MANGLE(TexCoord2fColor4ubVertex3fSUN) +#define glTexCoord2fColor4ubVertex3fvSUN MANGLE(TexCoord2fColor4ubVertex3fvSUN) +#define glTexCoord2f MANGLE(TexCoord2f) +#define glTexCoord2fNormal3fVertex3fSUN MANGLE(TexCoord2fNormal3fVertex3fSUN) +#define glTexCoord2fNormal3fVertex3fvSUN MANGLE(TexCoord2fNormal3fVertex3fvSUN) +#define glTexCoord2fVertex3fSUN MANGLE(TexCoord2fVertex3fSUN) +#define glTexCoord2fVertex3fvSUN MANGLE(TexCoord2fVertex3fvSUN) +#define glTexCoord2fv MANGLE(TexCoord2fv) +#define glTexCoord2hNV MANGLE(TexCoord2hNV) +#define glTexCoord2hvNV MANGLE(TexCoord2hvNV) +#define glTexCoord2i MANGLE(TexCoord2i) +#define glTexCoord2iv MANGLE(TexCoord2iv) +#define glTexCoord2s MANGLE(TexCoord2s) +#define glTexCoord2sv MANGLE(TexCoord2sv) +#define glTexCoord3d MANGLE(TexCoord3d) +#define glTexCoord3dv MANGLE(TexCoord3dv) +#define glTexCoord3f MANGLE(TexCoord3f) +#define glTexCoord3fv MANGLE(TexCoord3fv) +#define glTexCoord3hNV MANGLE(TexCoord3hNV) +#define glTexCoord3hvNV MANGLE(TexCoord3hvNV) +#define glTexCoord3i MANGLE(TexCoord3i) +#define glTexCoord3iv MANGLE(TexCoord3iv) +#define glTexCoord3s MANGLE(TexCoord3s) +#define glTexCoord3sv MANGLE(TexCoord3sv) +#define glTexCoord4d MANGLE(TexCoord4d) +#define glTexCoord4dv MANGLE(TexCoord4dv) +#define glTexCoord4fColor4fNormal3fVertex4fSUN MANGLE(TexCoord4fColor4fNormal3fVertex4fSUN) +#define glTexCoord4fColor4fNormal3fVertex4fvSUN MANGLE(TexCoord4fColor4fNormal3fVertex4fvSUN) +#define glTexCoord4f MANGLE(TexCoord4f) +#define glTexCoord4fVertex4fSUN MANGLE(TexCoord4fVertex4fSUN) +#define glTexCoord4fVertex4fvSUN MANGLE(TexCoord4fVertex4fvSUN) +#define glTexCoord4fv MANGLE(TexCoord4fv) +#define glTexCoord4hNV MANGLE(TexCoord4hNV) +#define glTexCoord4hvNV MANGLE(TexCoord4hvNV) +#define glTexCoord4i MANGLE(TexCoord4i) +#define glTexCoord4iv MANGLE(TexCoord4iv) +#define glTexCoord4s MANGLE(TexCoord4s) +#define glTexCoord4sv MANGLE(TexCoord4sv) +#define glTexCoordFormatNV MANGLE(TexCoordFormatNV) +#define glTexCoordP1ui MANGLE(TexCoordP1ui) +#define glTexCoordP1uiv MANGLE(TexCoordP1uiv) +#define glTexCoordP2ui MANGLE(TexCoordP2ui) +#define glTexCoordP2uiv MANGLE(TexCoordP2uiv) +#define glTexCoordP3ui MANGLE(TexCoordP3ui) +#define glTexCoordP3uiv MANGLE(TexCoordP3uiv) +#define glTexCoordP4ui MANGLE(TexCoordP4ui) +#define glTexCoordP4uiv MANGLE(TexCoordP4uiv) +#define glTexCoordPointerEXT MANGLE(TexCoordPointerEXT) +#define glTexCoordPointerListIBM MANGLE(TexCoordPointerListIBM) +#define glTexCoordPointer MANGLE(TexCoordPointer) +#define glTexCoordPointervINTEL MANGLE(TexCoordPointervINTEL) +#define glTexEnvf MANGLE(TexEnvf) +#define glTexEnvfv MANGLE(TexEnvfv) +#define glTexEnvi MANGLE(TexEnvi) +#define glTexEnviv MANGLE(TexEnviv) +#define glTexFilterFuncSGIS MANGLE(TexFilterFuncSGIS) +#define glTexGend MANGLE(TexGend) +#define glTexGendv MANGLE(TexGendv) +#define glTexGenf MANGLE(TexGenf) +#define glTexGenfv MANGLE(TexGenfv) +#define glTexGeni MANGLE(TexGeni) +#define glTexGeniv MANGLE(TexGeniv) +#define glTexImage1D MANGLE(TexImage1D) +#define glTexImage2D MANGLE(TexImage2D) +#define glTexImage2DMultisample MANGLE(TexImage2DMultisample) +#define glTexImage3DEXT MANGLE(TexImage3DEXT) +#define glTexImage3D MANGLE(TexImage3D) +#define glTexImage3DMultisample MANGLE(TexImage3DMultisample) +#define glTexImage4DSGIS MANGLE(TexImage4DSGIS) +#define glTexParameterf MANGLE(TexParameterf) +#define glTexParameterfv MANGLE(TexParameterfv) +#define glTexParameterIivEXT MANGLE(TexParameterIivEXT) +#define glTexParameterIiv MANGLE(TexParameterIiv) +#define glTexParameteri MANGLE(TexParameteri) +#define glTexParameterIuivEXT MANGLE(TexParameterIuivEXT) +#define glTexParameterIuiv MANGLE(TexParameterIuiv) +#define glTexParameteriv MANGLE(TexParameteriv) +#define glTexRenderbufferNV MANGLE(TexRenderbufferNV) +#define glTexSubImage1DEXT MANGLE(TexSubImage1DEXT) +#define glTexSubImage1D MANGLE(TexSubImage1D) +#define glTexSubImage2DEXT MANGLE(TexSubImage2DEXT) +#define glTexSubImage2D MANGLE(TexSubImage2D) +#define glTexSubImage3DEXT MANGLE(TexSubImage3DEXT) +#define glTexSubImage3D MANGLE(TexSubImage3D) +#define glTexSubImage4DSGIS MANGLE(TexSubImage4DSGIS) +#define glTextureBarrierNV MANGLE(TextureBarrierNV) +#define glTextureBufferEXT MANGLE(TextureBufferEXT) +#define glTextureColorMaskSGIS MANGLE(TextureColorMaskSGIS) +#define glTextureImage1DEXT MANGLE(TextureImage1DEXT) +#define glTextureImage2DEXT MANGLE(TextureImage2DEXT) +#define glTextureImage3DEXT MANGLE(TextureImage3DEXT) +#define glTextureLightEXT MANGLE(TextureLightEXT) +#define glTextureMaterialEXT MANGLE(TextureMaterialEXT) +#define glTextureNormalEXT MANGLE(TextureNormalEXT) +#define glTextureParameterfEXT MANGLE(TextureParameterfEXT) +#define glTextureParameterfvEXT MANGLE(TextureParameterfvEXT) +#define glTextureParameteriEXT MANGLE(TextureParameteriEXT) +#define glTextureParameterIivEXT MANGLE(TextureParameterIivEXT) +#define glTextureParameterIuivEXT MANGLE(TextureParameterIuivEXT) +#define glTextureParameterivEXT MANGLE(TextureParameterivEXT) +#define glTextureRangeAPPLE MANGLE(TextureRangeAPPLE) +#define glTextureRenderbufferEXT MANGLE(TextureRenderbufferEXT) +#define glTextureSubImage1DEXT MANGLE(TextureSubImage1DEXT) +#define glTextureSubImage2DEXT MANGLE(TextureSubImage2DEXT) +#define glTextureSubImage3DEXT MANGLE(TextureSubImage3DEXT) +#define glTrackMatrixNV MANGLE(TrackMatrixNV) +#define glTransformFeedbackAttribsNV MANGLE(TransformFeedbackAttribsNV) +#define glTransformFeedbackStreamAttribsNV MANGLE(TransformFeedbackStreamAttribsNV) +#define glTransformFeedbackVaryingsEXT MANGLE(TransformFeedbackVaryingsEXT) +#define glTransformFeedbackVaryings MANGLE(TransformFeedbackVaryings) +#define glTransformFeedbackVaryingsNV MANGLE(TransformFeedbackVaryingsNV) +#define glTranslated MANGLE(Translated) +#define glTranslatef MANGLE(Translatef) +#define glUniform1d MANGLE(Uniform1d) +#define glUniform1dv MANGLE(Uniform1dv) +#define glUniform1fARB MANGLE(Uniform1fARB) +#define glUniform1f MANGLE(Uniform1f) +#define glUniform1fvARB MANGLE(Uniform1fvARB) +#define glUniform1fv MANGLE(Uniform1fv) +#define glUniform1i64NV MANGLE(Uniform1i64NV) +#define glUniform1i64vNV MANGLE(Uniform1i64vNV) +#define glUniform1iARB MANGLE(Uniform1iARB) +#define glUniform1i MANGLE(Uniform1i) +#define glUniform1ivARB MANGLE(Uniform1ivARB) +#define glUniform1iv MANGLE(Uniform1iv) +#define glUniform1ui64NV MANGLE(Uniform1ui64NV) +#define glUniform1ui64vNV MANGLE(Uniform1ui64vNV) +#define glUniform1uiEXT MANGLE(Uniform1uiEXT) +#define glUniform1ui MANGLE(Uniform1ui) +#define glUniform1uivEXT MANGLE(Uniform1uivEXT) +#define glUniform1uiv MANGLE(Uniform1uiv) +#define glUniform2d MANGLE(Uniform2d) +#define glUniform2dv MANGLE(Uniform2dv) +#define glUniform2fARB MANGLE(Uniform2fARB) +#define glUniform2f MANGLE(Uniform2f) +#define glUniform2fvARB MANGLE(Uniform2fvARB) +#define glUniform2fv MANGLE(Uniform2fv) +#define glUniform2i64NV MANGLE(Uniform2i64NV) +#define glUniform2i64vNV MANGLE(Uniform2i64vNV) +#define glUniform2iARB MANGLE(Uniform2iARB) +#define glUniform2i MANGLE(Uniform2i) +#define glUniform2ivARB MANGLE(Uniform2ivARB) +#define glUniform2iv MANGLE(Uniform2iv) +#define glUniform2ui64NV MANGLE(Uniform2ui64NV) +#define glUniform2ui64vNV MANGLE(Uniform2ui64vNV) +#define glUniform2uiEXT MANGLE(Uniform2uiEXT) +#define glUniform2ui MANGLE(Uniform2ui) +#define glUniform2uivEXT MANGLE(Uniform2uivEXT) +#define glUniform2uiv MANGLE(Uniform2uiv) +#define glUniform3d MANGLE(Uniform3d) +#define glUniform3dv MANGLE(Uniform3dv) +#define glUniform3fARB MANGLE(Uniform3fARB) +#define glUniform3f MANGLE(Uniform3f) +#define glUniform3fvARB MANGLE(Uniform3fvARB) +#define glUniform3fv MANGLE(Uniform3fv) +#define glUniform3i64NV MANGLE(Uniform3i64NV) +#define glUniform3i64vNV MANGLE(Uniform3i64vNV) +#define glUniform3iARB MANGLE(Uniform3iARB) +#define glUniform3i MANGLE(Uniform3i) +#define glUniform3ivARB MANGLE(Uniform3ivARB) +#define glUniform3iv MANGLE(Uniform3iv) +#define glUniform3ui64NV MANGLE(Uniform3ui64NV) +#define glUniform3ui64vNV MANGLE(Uniform3ui64vNV) +#define glUniform3uiEXT MANGLE(Uniform3uiEXT) +#define glUniform3ui MANGLE(Uniform3ui) +#define glUniform3uivEXT MANGLE(Uniform3uivEXT) +#define glUniform3uiv MANGLE(Uniform3uiv) +#define glUniform4d MANGLE(Uniform4d) +#define glUniform4dv MANGLE(Uniform4dv) +#define glUniform4fARB MANGLE(Uniform4fARB) +#define glUniform4f MANGLE(Uniform4f) +#define glUniform4fvARB MANGLE(Uniform4fvARB) +#define glUniform4fv MANGLE(Uniform4fv) +#define glUniform4i64NV MANGLE(Uniform4i64NV) +#define glUniform4i64vNV MANGLE(Uniform4i64vNV) +#define glUniform4iARB MANGLE(Uniform4iARB) +#define glUniform4i MANGLE(Uniform4i) +#define glUniform4ivARB MANGLE(Uniform4ivARB) +#define glUniform4iv MANGLE(Uniform4iv) +#define glUniform4ui64NV MANGLE(Uniform4ui64NV) +#define glUniform4ui64vNV MANGLE(Uniform4ui64vNV) +#define glUniform4uiEXT MANGLE(Uniform4uiEXT) +#define glUniform4ui MANGLE(Uniform4ui) +#define glUniform4uivEXT MANGLE(Uniform4uivEXT) +#define glUniform4uiv MANGLE(Uniform4uiv) +#define glUniformBlockBinding MANGLE(UniformBlockBinding) +#define glUniformBufferEXT MANGLE(UniformBufferEXT) +#define glUniformMatrix2dv MANGLE(UniformMatrix2dv) +#define glUniformMatrix2fvARB MANGLE(UniformMatrix2fvARB) +#define glUniformMatrix2fv MANGLE(UniformMatrix2fv) +#define glUniformMatrix2x3dv MANGLE(UniformMatrix2x3dv) +#define glUniformMatrix2x3fv MANGLE(UniformMatrix2x3fv) +#define glUniformMatrix2x4dv MANGLE(UniformMatrix2x4dv) +#define glUniformMatrix2x4fv MANGLE(UniformMatrix2x4fv) +#define glUniformMatrix3dv MANGLE(UniformMatrix3dv) +#define glUniformMatrix3fvARB MANGLE(UniformMatrix3fvARB) +#define glUniformMatrix3fv MANGLE(UniformMatrix3fv) +#define glUniformMatrix3x2dv MANGLE(UniformMatrix3x2dv) +#define glUniformMatrix3x2fv MANGLE(UniformMatrix3x2fv) +#define glUniformMatrix3x4dv MANGLE(UniformMatrix3x4dv) +#define glUniformMatrix3x4fv MANGLE(UniformMatrix3x4fv) +#define glUniformMatrix4dv MANGLE(UniformMatrix4dv) +#define glUniformMatrix4fvARB MANGLE(UniformMatrix4fvARB) +#define glUniformMatrix4fv MANGLE(UniformMatrix4fv) +#define glUniformMatrix4x2dv MANGLE(UniformMatrix4x2dv) +#define glUniformMatrix4x2fv MANGLE(UniformMatrix4x2fv) +#define glUniformMatrix4x3dv MANGLE(UniformMatrix4x3dv) +#define glUniformMatrix4x3fv MANGLE(UniformMatrix4x3fv) +#define glUniformSubroutinesuiv MANGLE(UniformSubroutinesuiv) +#define glUniformui64NV MANGLE(Uniformui64NV) +#define glUniformui64vNV MANGLE(Uniformui64vNV) +#define glUnlockArraysEXT MANGLE(UnlockArraysEXT) +#define glUnmapBufferARB MANGLE(UnmapBufferARB) +#define glUnmapBuffer MANGLE(UnmapBuffer) +#define glUnmapNamedBufferEXT MANGLE(UnmapNamedBufferEXT) +#define glUnmapObjectBufferATI MANGLE(UnmapObjectBufferATI) +#define glUpdateObjectBufferATI MANGLE(UpdateObjectBufferATI) +#define glUseProgram MANGLE(UseProgram) +#define glUseProgramObjectARB MANGLE(UseProgramObjectARB) +#define glUseProgramStages MANGLE(UseProgramStages) +#define glUseShaderProgramEXT MANGLE(UseShaderProgramEXT) +#define glValidateProgramARB MANGLE(ValidateProgramARB) +#define glValidateProgram MANGLE(ValidateProgram) +#define glValidateProgramPipeline MANGLE(ValidateProgramPipeline) +#define glVariantArrayObjectATI MANGLE(VariantArrayObjectATI) +#define glVariantbvEXT MANGLE(VariantbvEXT) +#define glVariantdvEXT MANGLE(VariantdvEXT) +#define glVariantfvEXT MANGLE(VariantfvEXT) +#define glVariantivEXT MANGLE(VariantivEXT) +#define glVariantPointerEXT MANGLE(VariantPointerEXT) +#define glVariantsvEXT MANGLE(VariantsvEXT) +#define glVariantubvEXT MANGLE(VariantubvEXT) +#define glVariantuivEXT MANGLE(VariantuivEXT) +#define glVariantusvEXT MANGLE(VariantusvEXT) +#define glVDPAUFiniNV MANGLE(VDPAUFiniNV) +#define glVDPAUGetSurfaceivNV MANGLE(VDPAUGetSurfaceivNV) +#define glVDPAUInitNV MANGLE(VDPAUInitNV) +#define glVDPAUIsSurfaceNV MANGLE(VDPAUIsSurfaceNV) +#define glVDPAUMapSurfacesNV MANGLE(VDPAUMapSurfacesNV) +#define glVDPAURegisterOutputSurfaceNV MANGLE(VDPAURegisterOutputSurfaceNV) +#define glVDPAURegisterVideoSurfaceNV MANGLE(VDPAURegisterVideoSurfaceNV) +#define glVDPAUSurfaceAccessNV MANGLE(VDPAUSurfaceAccessNV) +#define glVDPAUUnmapSurfacesNV MANGLE(VDPAUUnmapSurfacesNV) +#define glVDPAUUnregisterSurfaceNV MANGLE(VDPAUUnregisterSurfaceNV) +#define glVertex2d MANGLE(Vertex2d) +#define glVertex2dv MANGLE(Vertex2dv) +#define glVertex2f MANGLE(Vertex2f) +#define glVertex2fv MANGLE(Vertex2fv) +#define glVertex2hNV MANGLE(Vertex2hNV) +#define glVertex2hvNV MANGLE(Vertex2hvNV) +#define glVertex2i MANGLE(Vertex2i) +#define glVertex2iv MANGLE(Vertex2iv) +#define glVertex2s MANGLE(Vertex2s) +#define glVertex2sv MANGLE(Vertex2sv) +#define glVertex3d MANGLE(Vertex3d) +#define glVertex3dv MANGLE(Vertex3dv) +#define glVertex3f MANGLE(Vertex3f) +#define glVertex3fv MANGLE(Vertex3fv) +#define glVertex3hNV MANGLE(Vertex3hNV) +#define glVertex3hvNV MANGLE(Vertex3hvNV) +#define glVertex3i MANGLE(Vertex3i) +#define glVertex3iv MANGLE(Vertex3iv) +#define glVertex3s MANGLE(Vertex3s) +#define glVertex3sv MANGLE(Vertex3sv) +#define glVertex4d MANGLE(Vertex4d) +#define glVertex4dv MANGLE(Vertex4dv) +#define glVertex4f MANGLE(Vertex4f) +#define glVertex4fv MANGLE(Vertex4fv) +#define glVertex4hNV MANGLE(Vertex4hNV) +#define glVertex4hvNV MANGLE(Vertex4hvNV) +#define glVertex4i MANGLE(Vertex4i) +#define glVertex4iv MANGLE(Vertex4iv) +#define glVertex4s MANGLE(Vertex4s) +#define glVertex4sv MANGLE(Vertex4sv) +#define glVertexArrayParameteriAPPLE MANGLE(VertexArrayParameteriAPPLE) +#define glVertexArrayRangeAPPLE MANGLE(VertexArrayRangeAPPLE) +#define glVertexArrayRangeNV MANGLE(VertexArrayRangeNV) +#define glVertexArrayVertexAttribLOffsetEXT MANGLE(VertexArrayVertexAttribLOffsetEXT) +#define glVertexAttrib1dARB MANGLE(VertexAttrib1dARB) +#define glVertexAttrib1d MANGLE(VertexAttrib1d) +#define glVertexAttrib1dNV MANGLE(VertexAttrib1dNV) +#define glVertexAttrib1dvARB MANGLE(VertexAttrib1dvARB) +#define glVertexAttrib1dv MANGLE(VertexAttrib1dv) +#define glVertexAttrib1dvNV MANGLE(VertexAttrib1dvNV) +#define glVertexAttrib1fARB MANGLE(VertexAttrib1fARB) +#define glVertexAttrib1f MANGLE(VertexAttrib1f) +#define glVertexAttrib1fNV MANGLE(VertexAttrib1fNV) +#define glVertexAttrib1fvARB MANGLE(VertexAttrib1fvARB) +#define glVertexAttrib1fv MANGLE(VertexAttrib1fv) +#define glVertexAttrib1fvNV MANGLE(VertexAttrib1fvNV) +#define glVertexAttrib1hNV MANGLE(VertexAttrib1hNV) +#define glVertexAttrib1hvNV MANGLE(VertexAttrib1hvNV) +#define glVertexAttrib1sARB MANGLE(VertexAttrib1sARB) +#define glVertexAttrib1s MANGLE(VertexAttrib1s) +#define glVertexAttrib1sNV MANGLE(VertexAttrib1sNV) +#define glVertexAttrib1svARB MANGLE(VertexAttrib1svARB) +#define glVertexAttrib1sv MANGLE(VertexAttrib1sv) +#define glVertexAttrib1svNV MANGLE(VertexAttrib1svNV) +#define glVertexAttrib2dARB MANGLE(VertexAttrib2dARB) +#define glVertexAttrib2d MANGLE(VertexAttrib2d) +#define glVertexAttrib2dNV MANGLE(VertexAttrib2dNV) +#define glVertexAttrib2dvARB MANGLE(VertexAttrib2dvARB) +#define glVertexAttrib2dv MANGLE(VertexAttrib2dv) +#define glVertexAttrib2dvNV MANGLE(VertexAttrib2dvNV) +#define glVertexAttrib2fARB MANGLE(VertexAttrib2fARB) +#define glVertexAttrib2f MANGLE(VertexAttrib2f) +#define glVertexAttrib2fNV MANGLE(VertexAttrib2fNV) +#define glVertexAttrib2fvARB MANGLE(VertexAttrib2fvARB) +#define glVertexAttrib2fv MANGLE(VertexAttrib2fv) +#define glVertexAttrib2fvNV MANGLE(VertexAttrib2fvNV) +#define glVertexAttrib2hNV MANGLE(VertexAttrib2hNV) +#define glVertexAttrib2hvNV MANGLE(VertexAttrib2hvNV) +#define glVertexAttrib2sARB MANGLE(VertexAttrib2sARB) +#define glVertexAttrib2s MANGLE(VertexAttrib2s) +#define glVertexAttrib2sNV MANGLE(VertexAttrib2sNV) +#define glVertexAttrib2svARB MANGLE(VertexAttrib2svARB) +#define glVertexAttrib2sv MANGLE(VertexAttrib2sv) +#define glVertexAttrib2svNV MANGLE(VertexAttrib2svNV) +#define glVertexAttrib3dARB MANGLE(VertexAttrib3dARB) +#define glVertexAttrib3d MANGLE(VertexAttrib3d) +#define glVertexAttrib3dNV MANGLE(VertexAttrib3dNV) +#define glVertexAttrib3dvARB MANGLE(VertexAttrib3dvARB) +#define glVertexAttrib3dv MANGLE(VertexAttrib3dv) +#define glVertexAttrib3dvNV MANGLE(VertexAttrib3dvNV) +#define glVertexAttrib3fARB MANGLE(VertexAttrib3fARB) +#define glVertexAttrib3f MANGLE(VertexAttrib3f) +#define glVertexAttrib3fNV MANGLE(VertexAttrib3fNV) +#define glVertexAttrib3fvARB MANGLE(VertexAttrib3fvARB) +#define glVertexAttrib3fv MANGLE(VertexAttrib3fv) +#define glVertexAttrib3fvNV MANGLE(VertexAttrib3fvNV) +#define glVertexAttrib3hNV MANGLE(VertexAttrib3hNV) +#define glVertexAttrib3hvNV MANGLE(VertexAttrib3hvNV) +#define glVertexAttrib3sARB MANGLE(VertexAttrib3sARB) +#define glVertexAttrib3s MANGLE(VertexAttrib3s) +#define glVertexAttrib3sNV MANGLE(VertexAttrib3sNV) +#define glVertexAttrib3svARB MANGLE(VertexAttrib3svARB) +#define glVertexAttrib3sv MANGLE(VertexAttrib3sv) +#define glVertexAttrib3svNV MANGLE(VertexAttrib3svNV) +#define glVertexAttrib4bvARB MANGLE(VertexAttrib4bvARB) +#define glVertexAttrib4bv MANGLE(VertexAttrib4bv) +#define glVertexAttrib4dARB MANGLE(VertexAttrib4dARB) +#define glVertexAttrib4d MANGLE(VertexAttrib4d) +#define glVertexAttrib4dNV MANGLE(VertexAttrib4dNV) +#define glVertexAttrib4dvARB MANGLE(VertexAttrib4dvARB) +#define glVertexAttrib4dv MANGLE(VertexAttrib4dv) +#define glVertexAttrib4dvNV MANGLE(VertexAttrib4dvNV) +#define glVertexAttrib4fARB MANGLE(VertexAttrib4fARB) +#define glVertexAttrib4f MANGLE(VertexAttrib4f) +#define glVertexAttrib4fNV MANGLE(VertexAttrib4fNV) +#define glVertexAttrib4fvARB MANGLE(VertexAttrib4fvARB) +#define glVertexAttrib4fv MANGLE(VertexAttrib4fv) +#define glVertexAttrib4fvNV MANGLE(VertexAttrib4fvNV) +#define glVertexAttrib4hNV MANGLE(VertexAttrib4hNV) +#define glVertexAttrib4hvNV MANGLE(VertexAttrib4hvNV) +#define glVertexAttrib4ivARB MANGLE(VertexAttrib4ivARB) +#define glVertexAttrib4iv MANGLE(VertexAttrib4iv) +#define glVertexAttrib4NbvARB MANGLE(VertexAttrib4NbvARB) +#define glVertexAttrib4Nbv MANGLE(VertexAttrib4Nbv) +#define glVertexAttrib4NivARB MANGLE(VertexAttrib4NivARB) +#define glVertexAttrib4Niv MANGLE(VertexAttrib4Niv) +#define glVertexAttrib4NsvARB MANGLE(VertexAttrib4NsvARB) +#define glVertexAttrib4Nsv MANGLE(VertexAttrib4Nsv) +#define glVertexAttrib4NubARB MANGLE(VertexAttrib4NubARB) +#define glVertexAttrib4Nub MANGLE(VertexAttrib4Nub) +#define glVertexAttrib4NubvARB MANGLE(VertexAttrib4NubvARB) +#define glVertexAttrib4Nubv MANGLE(VertexAttrib4Nubv) +#define glVertexAttrib4NuivARB MANGLE(VertexAttrib4NuivARB) +#define glVertexAttrib4Nuiv MANGLE(VertexAttrib4Nuiv) +#define glVertexAttrib4NusvARB MANGLE(VertexAttrib4NusvARB) +#define glVertexAttrib4Nusv MANGLE(VertexAttrib4Nusv) +#define glVertexAttrib4sARB MANGLE(VertexAttrib4sARB) +#define glVertexAttrib4s MANGLE(VertexAttrib4s) +#define glVertexAttrib4sNV MANGLE(VertexAttrib4sNV) +#define glVertexAttrib4svARB MANGLE(VertexAttrib4svARB) +#define glVertexAttrib4sv MANGLE(VertexAttrib4sv) +#define glVertexAttrib4svNV MANGLE(VertexAttrib4svNV) +#define glVertexAttrib4ubNV MANGLE(VertexAttrib4ubNV) +#define glVertexAttrib4ubvARB MANGLE(VertexAttrib4ubvARB) +#define glVertexAttrib4ubv MANGLE(VertexAttrib4ubv) +#define glVertexAttrib4ubvNV MANGLE(VertexAttrib4ubvNV) +#define glVertexAttrib4uivARB MANGLE(VertexAttrib4uivARB) +#define glVertexAttrib4uiv MANGLE(VertexAttrib4uiv) +#define glVertexAttrib4usvARB MANGLE(VertexAttrib4usvARB) +#define glVertexAttrib4usv MANGLE(VertexAttrib4usv) +#define glVertexAttribArrayObjectATI MANGLE(VertexAttribArrayObjectATI) +#define glVertexAttribDivisorARB MANGLE(VertexAttribDivisorARB) +#define glVertexAttribDivisor MANGLE(VertexAttribDivisor) +#define glVertexAttribFormatNV MANGLE(VertexAttribFormatNV) +#define glVertexAttribI1iEXT MANGLE(VertexAttribI1iEXT) +#define glVertexAttribI1i MANGLE(VertexAttribI1i) +#define glVertexAttribI1ivEXT MANGLE(VertexAttribI1ivEXT) +#define glVertexAttribI1iv MANGLE(VertexAttribI1iv) +#define glVertexAttribI1uiEXT MANGLE(VertexAttribI1uiEXT) +#define glVertexAttribI1ui MANGLE(VertexAttribI1ui) +#define glVertexAttribI1uivEXT MANGLE(VertexAttribI1uivEXT) +#define glVertexAttribI1uiv MANGLE(VertexAttribI1uiv) +#define glVertexAttribI2iEXT MANGLE(VertexAttribI2iEXT) +#define glVertexAttribI2i MANGLE(VertexAttribI2i) +#define glVertexAttribI2ivEXT MANGLE(VertexAttribI2ivEXT) +#define glVertexAttribI2iv MANGLE(VertexAttribI2iv) +#define glVertexAttribI2uiEXT MANGLE(VertexAttribI2uiEXT) +#define glVertexAttribI2ui MANGLE(VertexAttribI2ui) +#define glVertexAttribI2uivEXT MANGLE(VertexAttribI2uivEXT) +#define glVertexAttribI2uiv MANGLE(VertexAttribI2uiv) +#define glVertexAttribI3iEXT MANGLE(VertexAttribI3iEXT) +#define glVertexAttribI3i MANGLE(VertexAttribI3i) +#define glVertexAttribI3ivEXT MANGLE(VertexAttribI3ivEXT) +#define glVertexAttribI3iv MANGLE(VertexAttribI3iv) +#define glVertexAttribI3uiEXT MANGLE(VertexAttribI3uiEXT) +#define glVertexAttribI3ui MANGLE(VertexAttribI3ui) +#define glVertexAttribI3uivEXT MANGLE(VertexAttribI3uivEXT) +#define glVertexAttribI3uiv MANGLE(VertexAttribI3uiv) +#define glVertexAttribI4bvEXT MANGLE(VertexAttribI4bvEXT) +#define glVertexAttribI4bv MANGLE(VertexAttribI4bv) +#define glVertexAttribI4iEXT MANGLE(VertexAttribI4iEXT) +#define glVertexAttribI4i MANGLE(VertexAttribI4i) +#define glVertexAttribI4ivEXT MANGLE(VertexAttribI4ivEXT) +#define glVertexAttribI4iv MANGLE(VertexAttribI4iv) +#define glVertexAttribI4svEXT MANGLE(VertexAttribI4svEXT) +#define glVertexAttribI4sv MANGLE(VertexAttribI4sv) +#define glVertexAttribI4ubvEXT MANGLE(VertexAttribI4ubvEXT) +#define glVertexAttribI4ubv MANGLE(VertexAttribI4ubv) +#define glVertexAttribI4uiEXT MANGLE(VertexAttribI4uiEXT) +#define glVertexAttribI4ui MANGLE(VertexAttribI4ui) +#define glVertexAttribI4uivEXT MANGLE(VertexAttribI4uivEXT) +#define glVertexAttribI4uiv MANGLE(VertexAttribI4uiv) +#define glVertexAttribI4usvEXT MANGLE(VertexAttribI4usvEXT) +#define glVertexAttribI4usv MANGLE(VertexAttribI4usv) +#define glVertexAttribIFormatNV MANGLE(VertexAttribIFormatNV) +#define glVertexAttribIPointerEXT MANGLE(VertexAttribIPointerEXT) +#define glVertexAttribIPointer MANGLE(VertexAttribIPointer) +#define glVertexAttribL1dEXT MANGLE(VertexAttribL1dEXT) +#define glVertexAttribL1d MANGLE(VertexAttribL1d) +#define glVertexAttribL1dvEXT MANGLE(VertexAttribL1dvEXT) +#define glVertexAttribL1dv MANGLE(VertexAttribL1dv) +#define glVertexAttribL1i64NV MANGLE(VertexAttribL1i64NV) +#define glVertexAttribL1i64vNV MANGLE(VertexAttribL1i64vNV) +#define glVertexAttribL1ui64NV MANGLE(VertexAttribL1ui64NV) +#define glVertexAttribL1ui64vNV MANGLE(VertexAttribL1ui64vNV) +#define glVertexAttribL2dEXT MANGLE(VertexAttribL2dEXT) +#define glVertexAttribL2d MANGLE(VertexAttribL2d) +#define glVertexAttribL2dvEXT MANGLE(VertexAttribL2dvEXT) +#define glVertexAttribL2dv MANGLE(VertexAttribL2dv) +#define glVertexAttribL2i64NV MANGLE(VertexAttribL2i64NV) +#define glVertexAttribL2i64vNV MANGLE(VertexAttribL2i64vNV) +#define glVertexAttribL2ui64NV MANGLE(VertexAttribL2ui64NV) +#define glVertexAttribL2ui64vNV MANGLE(VertexAttribL2ui64vNV) +#define glVertexAttribL3dEXT MANGLE(VertexAttribL3dEXT) +#define glVertexAttribL3d MANGLE(VertexAttribL3d) +#define glVertexAttribL3dvEXT MANGLE(VertexAttribL3dvEXT) +#define glVertexAttribL3dv MANGLE(VertexAttribL3dv) +#define glVertexAttribL3i64NV MANGLE(VertexAttribL3i64NV) +#define glVertexAttribL3i64vNV MANGLE(VertexAttribL3i64vNV) +#define glVertexAttribL3ui64NV MANGLE(VertexAttribL3ui64NV) +#define glVertexAttribL3ui64vNV MANGLE(VertexAttribL3ui64vNV) +#define glVertexAttribL4dEXT MANGLE(VertexAttribL4dEXT) +#define glVertexAttribL4d MANGLE(VertexAttribL4d) +#define glVertexAttribL4dvEXT MANGLE(VertexAttribL4dvEXT) +#define glVertexAttribL4dv MANGLE(VertexAttribL4dv) +#define glVertexAttribL4i64NV MANGLE(VertexAttribL4i64NV) +#define glVertexAttribL4i64vNV MANGLE(VertexAttribL4i64vNV) +#define glVertexAttribL4ui64NV MANGLE(VertexAttribL4ui64NV) +#define glVertexAttribL4ui64vNV MANGLE(VertexAttribL4ui64vNV) +#define glVertexAttribLFormatNV MANGLE(VertexAttribLFormatNV) +#define glVertexAttribLPointerEXT MANGLE(VertexAttribLPointerEXT) +#define glVertexAttribLPointer MANGLE(VertexAttribLPointer) +#define glVertexAttribP1ui MANGLE(VertexAttribP1ui) +#define glVertexAttribP1uiv MANGLE(VertexAttribP1uiv) +#define glVertexAttribP2ui MANGLE(VertexAttribP2ui) +#define glVertexAttribP2uiv MANGLE(VertexAttribP2uiv) +#define glVertexAttribP3ui MANGLE(VertexAttribP3ui) +#define glVertexAttribP3uiv MANGLE(VertexAttribP3uiv) +#define glVertexAttribP4ui MANGLE(VertexAttribP4ui) +#define glVertexAttribP4uiv MANGLE(VertexAttribP4uiv) +#define glVertexAttribPointerARB MANGLE(VertexAttribPointerARB) +#define glVertexAttribPointer MANGLE(VertexAttribPointer) +#define glVertexAttribPointerNV MANGLE(VertexAttribPointerNV) +#define glVertexAttribs1dvNV MANGLE(VertexAttribs1dvNV) +#define glVertexAttribs1fvNV MANGLE(VertexAttribs1fvNV) +#define glVertexAttribs1hvNV MANGLE(VertexAttribs1hvNV) +#define glVertexAttribs1svNV MANGLE(VertexAttribs1svNV) +#define glVertexAttribs2dvNV MANGLE(VertexAttribs2dvNV) +#define glVertexAttribs2fvNV MANGLE(VertexAttribs2fvNV) +#define glVertexAttribs2hvNV MANGLE(VertexAttribs2hvNV) +#define glVertexAttribs2svNV MANGLE(VertexAttribs2svNV) +#define glVertexAttribs3dvNV MANGLE(VertexAttribs3dvNV) +#define glVertexAttribs3fvNV MANGLE(VertexAttribs3fvNV) +#define glVertexAttribs3hvNV MANGLE(VertexAttribs3hvNV) +#define glVertexAttribs3svNV MANGLE(VertexAttribs3svNV) +#define glVertexAttribs4dvNV MANGLE(VertexAttribs4dvNV) +#define glVertexAttribs4fvNV MANGLE(VertexAttribs4fvNV) +#define glVertexAttribs4hvNV MANGLE(VertexAttribs4hvNV) +#define glVertexAttribs4svNV MANGLE(VertexAttribs4svNV) +#define glVertexAttribs4ubvNV MANGLE(VertexAttribs4ubvNV) +#define glVertexBlendARB MANGLE(VertexBlendARB) +#define glVertexBlendEnvfATI MANGLE(VertexBlendEnvfATI) +#define glVertexBlendEnviATI MANGLE(VertexBlendEnviATI) +#define glVertexFormatNV MANGLE(VertexFormatNV) +#define glVertexP2ui MANGLE(VertexP2ui) +#define glVertexP2uiv MANGLE(VertexP2uiv) +#define glVertexP3ui MANGLE(VertexP3ui) +#define glVertexP3uiv MANGLE(VertexP3uiv) +#define glVertexP4ui MANGLE(VertexP4ui) +#define glVertexP4uiv MANGLE(VertexP4uiv) +#define glVertexPointerEXT MANGLE(VertexPointerEXT) +#define glVertexPointerListIBM MANGLE(VertexPointerListIBM) +#define glVertexPointer MANGLE(VertexPointer) +#define glVertexPointervINTEL MANGLE(VertexPointervINTEL) +#define glVertexStream1dATI MANGLE(VertexStream1dATI) +#define glVertexStream1dvATI MANGLE(VertexStream1dvATI) +#define glVertexStream1fATI MANGLE(VertexStream1fATI) +#define glVertexStream1fvATI MANGLE(VertexStream1fvATI) +#define glVertexStream1iATI MANGLE(VertexStream1iATI) +#define glVertexStream1ivATI MANGLE(VertexStream1ivATI) +#define glVertexStream1sATI MANGLE(VertexStream1sATI) +#define glVertexStream1svATI MANGLE(VertexStream1svATI) +#define glVertexStream2dATI MANGLE(VertexStream2dATI) +#define glVertexStream2dvATI MANGLE(VertexStream2dvATI) +#define glVertexStream2fATI MANGLE(VertexStream2fATI) +#define glVertexStream2fvATI MANGLE(VertexStream2fvATI) +#define glVertexStream2iATI MANGLE(VertexStream2iATI) +#define glVertexStream2ivATI MANGLE(VertexStream2ivATI) +#define glVertexStream2sATI MANGLE(VertexStream2sATI) +#define glVertexStream2svATI MANGLE(VertexStream2svATI) +#define glVertexStream3dATI MANGLE(VertexStream3dATI) +#define glVertexStream3dvATI MANGLE(VertexStream3dvATI) +#define glVertexStream3fATI MANGLE(VertexStream3fATI) +#define glVertexStream3fvATI MANGLE(VertexStream3fvATI) +#define glVertexStream3iATI MANGLE(VertexStream3iATI) +#define glVertexStream3ivATI MANGLE(VertexStream3ivATI) +#define glVertexStream3sATI MANGLE(VertexStream3sATI) +#define glVertexStream3svATI MANGLE(VertexStream3svATI) +#define glVertexStream4dATI MANGLE(VertexStream4dATI) +#define glVertexStream4dvATI MANGLE(VertexStream4dvATI) +#define glVertexStream4fATI MANGLE(VertexStream4fATI) +#define glVertexStream4fvATI MANGLE(VertexStream4fvATI) +#define glVertexStream4iATI MANGLE(VertexStream4iATI) +#define glVertexStream4ivATI MANGLE(VertexStream4ivATI) +#define glVertexStream4sATI MANGLE(VertexStream4sATI) +#define glVertexStream4svATI MANGLE(VertexStream4svATI) +#define glVertexWeightfEXT MANGLE(VertexWeightfEXT) +#define glVertexWeightfvEXT MANGLE(VertexWeightfvEXT) +#define glVertexWeighthNV MANGLE(VertexWeighthNV) +#define glVertexWeighthvNV MANGLE(VertexWeighthvNV) +#define glVertexWeightPointerEXT MANGLE(VertexWeightPointerEXT) +#define glVideoCaptureNV MANGLE(VideoCaptureNV) +#define glVideoCaptureStreamParameterdvNV MANGLE(VideoCaptureStreamParameterdvNV) +#define glVideoCaptureStreamParameterfvNV MANGLE(VideoCaptureStreamParameterfvNV) +#define glVideoCaptureStreamParameterivNV MANGLE(VideoCaptureStreamParameterivNV) +#define glViewportArrayv MANGLE(ViewportArrayv) +#define glViewportIndexedf MANGLE(ViewportIndexedf) +#define glViewportIndexedfv MANGLE(ViewportIndexedfv) +#define glViewport MANGLE(Viewport) +#define glWaitSync MANGLE(WaitSync) +#define glWeightbvARB MANGLE(WeightbvARB) +#define glWeightdvARB MANGLE(WeightdvARB) +#define glWeightfvARB MANGLE(WeightfvARB) +#define glWeightivARB MANGLE(WeightivARB) +#define glWeightPointerARB MANGLE(WeightPointerARB) +#define glWeightsvARB MANGLE(WeightsvARB) +#define glWeightubvARB MANGLE(WeightubvARB) +#define glWeightuivARB MANGLE(WeightuivARB) +#define glWeightusvARB MANGLE(WeightusvARB) +#define glWindowPos2dARB MANGLE(WindowPos2dARB) +#define glWindowPos2d MANGLE(WindowPos2d) +#define glWindowPos2dMESA MANGLE(WindowPos2dMESA) +#define glWindowPos2dvARB MANGLE(WindowPos2dvARB) +#define glWindowPos2dv MANGLE(WindowPos2dv) +#define glWindowPos2dvMESA MANGLE(WindowPos2dvMESA) +#define glWindowPos2fARB MANGLE(WindowPos2fARB) +#define glWindowPos2f MANGLE(WindowPos2f) +#define glWindowPos2fMESA MANGLE(WindowPos2fMESA) +#define glWindowPos2fvARB MANGLE(WindowPos2fvARB) +#define glWindowPos2fv MANGLE(WindowPos2fv) +#define glWindowPos2fvMESA MANGLE(WindowPos2fvMESA) +#define glWindowPos2iARB MANGLE(WindowPos2iARB) +#define glWindowPos2i MANGLE(WindowPos2i) +#define glWindowPos2iMESA MANGLE(WindowPos2iMESA) +#define glWindowPos2ivARB MANGLE(WindowPos2ivARB) +#define glWindowPos2iv MANGLE(WindowPos2iv) +#define glWindowPos2ivMESA MANGLE(WindowPos2ivMESA) +#define glWindowPos2sARB MANGLE(WindowPos2sARB) +#define glWindowPos2s MANGLE(WindowPos2s) +#define glWindowPos2sMESA MANGLE(WindowPos2sMESA) +#define glWindowPos2svARB MANGLE(WindowPos2svARB) +#define glWindowPos2sv MANGLE(WindowPos2sv) +#define glWindowPos2svMESA MANGLE(WindowPos2svMESA) +#define glWindowPos3dARB MANGLE(WindowPos3dARB) +#define glWindowPos3d MANGLE(WindowPos3d) +#define glWindowPos3dMESA MANGLE(WindowPos3dMESA) +#define glWindowPos3dvARB MANGLE(WindowPos3dvARB) +#define glWindowPos3dv MANGLE(WindowPos3dv) +#define glWindowPos3dvMESA MANGLE(WindowPos3dvMESA) +#define glWindowPos3fARB MANGLE(WindowPos3fARB) +#define glWindowPos3f MANGLE(WindowPos3f) +#define glWindowPos3fMESA MANGLE(WindowPos3fMESA) +#define glWindowPos3fvARB MANGLE(WindowPos3fvARB) +#define glWindowPos3fv MANGLE(WindowPos3fv) +#define glWindowPos3fvMESA MANGLE(WindowPos3fvMESA) +#define glWindowPos3iARB MANGLE(WindowPos3iARB) +#define glWindowPos3i MANGLE(WindowPos3i) +#define glWindowPos3iMESA MANGLE(WindowPos3iMESA) +#define glWindowPos3ivARB MANGLE(WindowPos3ivARB) +#define glWindowPos3iv MANGLE(WindowPos3iv) +#define glWindowPos3ivMESA MANGLE(WindowPos3ivMESA) +#define glWindowPos3sARB MANGLE(WindowPos3sARB) +#define glWindowPos3s MANGLE(WindowPos3s) +#define glWindowPos3sMESA MANGLE(WindowPos3sMESA) +#define glWindowPos3svARB MANGLE(WindowPos3svARB) +#define glWindowPos3sv MANGLE(WindowPos3sv) +#define glWindowPos3svMESA MANGLE(WindowPos3svMESA) +#define glWindowPos4dMESA MANGLE(WindowPos4dMESA) +#define glWindowPos4dvMESA MANGLE(WindowPos4dvMESA) +#define glWindowPos4fMESA MANGLE(WindowPos4fMESA) +#define glWindowPos4fvMESA MANGLE(WindowPos4fvMESA) +#define glWindowPos4iMESA MANGLE(WindowPos4iMESA) +#define glWindowPos4ivMESA MANGLE(WindowPos4ivMESA) +#define glWindowPos4sMESA MANGLE(WindowPos4sMESA) +#define glWindowPos4svMESA MANGLE(WindowPos4svMESA) +#define glWriteMaskEXT MANGLE(WriteMaskEXT) + +#endif /* GL_MANGLE_H */ diff --git a/mesalib/scons/dxsdk.py b/mesalib/scons/dxsdk.py index 4671763d3..920cc2f68 100644 --- a/mesalib/scons/dxsdk.py +++ b/mesalib/scons/dxsdk.py @@ -1,73 +1,73 @@ -"""dxsdk - -Tool-specific initialization for Microsoft DirectX SDK - -""" - -# -# Copyright (c) 2009 VMware, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# 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. -# - -import os -import os.path - -import SCons.Errors -import SCons.Util - - -def get_dxsdk_root(env): - try: - return os.environ['DXSDK_DIR'] - except KeyError: - return None - -def generate(env): - dxsdk_root = get_dxsdk_root(env) - if dxsdk_root is None: - # DirectX SDK not found - return - - if env['machine'] in ('generic', 'x86'): - target_cpu = 'x86' - elif env['machine'] == 'x86_64': - target_cpu = 'x64' - else: - raise SCons.Errors.InternalError, "Unsupported target machine" - - include_dir = os.path.join(dxsdk_root, 'Include') - lib_dir = os.path.join(dxsdk_root, 'Lib', target_cpu) - - env.Append(CPPDEFINES = [('HAVE_DXSDK', '1')]) - - gcc = 'gcc' in os.path.basename(env['CC']).split('-') - if gcc: - # Make GCC more forgiving towards Microsoft's headers - env.Prepend(CPPFLAGS = ['-isystem', include_dir]) - else: - env.Prepend(CPPPATH = [include_dir]) - - env.Prepend(LIBPATH = [lib_dir]) - -def exists(env): - return get_dxsdk_root(env) is not None - -# vim:set ts=4 sw=4 et: +"""dxsdk + +Tool-specific initialization for Microsoft DirectX SDK + +""" + +# +# Copyright (c) 2009 VMware, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# 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. +# + +import os +import os.path + +import SCons.Errors +import SCons.Util + + +def get_dxsdk_root(env): + try: + return os.environ['DXSDK_DIR'] + except KeyError: + return None + +def generate(env): + dxsdk_root = get_dxsdk_root(env) + if dxsdk_root is None: + # DirectX SDK not found + return + + if env['machine'] in ('generic', 'x86'): + target_cpu = 'x86' + elif env['machine'] == 'x86_64': + target_cpu = 'x64' + else: + raise SCons.Errors.InternalError, "Unsupported target machine" + + include_dir = os.path.join(dxsdk_root, 'Include') + lib_dir = os.path.join(dxsdk_root, 'Lib', target_cpu) + + env.Append(CPPDEFINES = [('HAVE_DXSDK', '1')]) + + gcc = 'gcc' in os.path.basename(env['CC']).split('-') + if gcc: + # Make GCC more forgiving towards Microsoft's headers + env.Prepend(CPPFLAGS = ['-isystem', include_dir]) + else: + env.Prepend(CPPPATH = [include_dir]) + + env.Prepend(LIBPATH = [lib_dir]) + +def exists(env): + return get_dxsdk_root(env) is not None + +# vim:set ts=4 sw=4 et: diff --git a/mesalib/scons/fixes.py b/mesalib/scons/fixes.py index 5946106ab..714cccf61 100644 --- a/mesalib/scons/fixes.py +++ b/mesalib/scons/fixes.py @@ -1,27 +1,27 @@ -import sys - -# Monkey patch os.spawnve on windows to become thread safe -if sys.platform == 'win32': - import os - import threading - from os import spawnve as old_spawnve - - spawn_lock = threading.Lock() - - def new_spawnve(mode, file, args, env): - spawn_lock.acquire() - try: - if mode == os.P_WAIT: - ret = old_spawnve(os.P_NOWAIT, file, args, env) - else: - ret = old_spawnve(mode, file, args, env) - finally: - spawn_lock.release() - if mode == os.P_WAIT: - pid, status = os.waitpid(ret, 0) - ret = status >> 8 - return ret - - os.spawnve = new_spawnve - - +import sys + +# Monkey patch os.spawnve on windows to become thread safe +if sys.platform == 'win32': + import os + import threading + from os import spawnve as old_spawnve + + spawn_lock = threading.Lock() + + def new_spawnve(mode, file, args, env): + spawn_lock.acquire() + try: + if mode == os.P_WAIT: + ret = old_spawnve(os.P_NOWAIT, file, args, env) + else: + ret = old_spawnve(mode, file, args, env) + finally: + spawn_lock.release() + if mode == os.P_WAIT: + pid, status = os.waitpid(ret, 0) + ret = status >> 8 + return ret + + os.spawnve = new_spawnve + + diff --git a/mesalib/scons/x11.py b/mesalib/scons/x11.py index 86f090e37..99bf07962 100644 --- a/mesalib/scons/x11.py +++ b/mesalib/scons/x11.py @@ -1,52 +1,52 @@ -"""x11 - -Tool-specific initialization for X11 - -""" - -# -# Copyright (c) 2010 VMware, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# 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. -# - - -def generate(env): - env.Append(CPPPATH = ['/usr/X11R6/include']) - env.Append(LIBPATH = ['/usr/X11R6/lib']) - - env.Append(LIBS = [ - 'X11', - 'Xext', - 'Xxf86vm', - 'Xdamage', - 'Xfixes', - ]) - - -def exists(env): - # TODO: actually detect the presence of the headers - if env['platform'] in ('linux', 'freebsd', 'darwin'): - return True - else: - return False - - -# vim:set ts=4 sw=4 et: +"""x11 + +Tool-specific initialization for X11 + +""" + +# +# Copyright (c) 2010 VMware, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# 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. +# + + +def generate(env): + env.Append(CPPPATH = ['/usr/X11R6/include']) + env.Append(LIBPATH = ['/usr/X11R6/lib']) + + env.Append(LIBS = [ + 'X11', + 'Xext', + 'Xxf86vm', + 'Xdamage', + 'Xfixes', + ]) + + +def exists(env): + # TODO: actually detect the presence of the headers + if env['platform'] in ('linux', 'freebsd', 'darwin'): + return True + else: + return False + + +# vim:set ts=4 sw=4 et: diff --git a/mesalib/src/gallium/Android.common.mk b/mesalib/src/gallium/Android.common.mk new file mode 100644 index 000000000..782510ff0 --- /dev/null +++ b/mesalib/src/gallium/Android.common.mk @@ -0,0 +1,32 @@ +# Mesa 3-D graphics library +# +# Copyright (C) 2010-2011 Chia-I Wu +# Copyright (C) 2010-2011 LunarG Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to 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. + +# src/gallium/Android.common.mk + +LOCAL_C_INCLUDES += \ + $(GALLIUM_TOP)/include \ + $(GALLIUM_TOP)/auxiliary \ + $(GALLIUM_TOP)/winsys \ + $(GALLIUM_TOP)/drivers + +include $(MESA_COMMON_MK) diff --git a/mesalib/src/gallium/Android.mk b/mesalib/src/gallium/Android.mk new file mode 100644 index 000000000..1d002d053 --- /dev/null +++ b/mesalib/src/gallium/Android.mk @@ -0,0 +1,72 @@ +# Mesa 3-D graphics library +# +# Copyright (C) 2010-2011 Chia-I Wu +# Copyright (C) 2010-2011 LunarG Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to 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. + +# src/gallium/Android.mk + +GALLIUM_TOP := $(call my-dir) +GALLIUM_COMMON_MK := $(GALLIUM_TOP)/Android.common.mk + +SUBDIRS := \ + targets/egl-static \ + state_trackers/egl \ + auxiliary + +# swrast +SUBDIRS += winsys/sw/android drivers/softpipe + +# i915g +ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),) +SUBDIRS += winsys/i915/drm drivers/i915 +endif + +# nouveau +ifneq ($(filter nouveau, $(MESA_GPU_DRIVERS)),) +SUBDIRS += \ + winsys/nouveau/drm \ + drivers/nouveau \ + drivers/nvfx \ + drivers/nv50 \ + drivers/nvc0 +endif + +# r300g/r600g/radeonsi +ifneq ($(filter r300g r600g radeonsi, $(MESA_GPU_DRIVERS)),) +SUBDIRS += winsys/radeon/drm +ifneq ($(filter r300g, $(MESA_GPU_DRIVERS)),) +SUBDIRS += drivers/r300 +endif +ifneq ($(filter r600g, $(MESA_GPU_DRIVERS)),) +SUBDIRS += drivers/r600 +endif +ifneq ($(filter radeonsi, $(MESA_GPU_DRIVERS)),) +SUBDIRS += drivers/radeonsi +endif +endif + +# vmwgfx +ifneq ($(filter vmwgfx, $(MESA_GPU_DRIVERS)),) +SUBDIRS += winsys/svga/drm drivers/svga +endif + +mkfiles := $(patsubst %,$(GALLIUM_TOP)/%/Android.mk,$(SUBDIRS)) +include $(mkfiles) diff --git a/mesalib/src/gallium/Makefile b/mesalib/src/gallium/Makefile new file mode 100644 index 000000000..79ca767f7 --- /dev/null +++ b/mesalib/src/gallium/Makefile @@ -0,0 +1,12 @@ +# src/gallium/Makefile +TOP = ../.. +include $(TOP)/configs/current + +SUBDIRS = $(GALLIUM_DIRS) + +default install clean: + @for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) $@) || exit 1; \ + fi \ + done diff --git a/mesalib/src/gallium/Makefile.template b/mesalib/src/gallium/Makefile.template new file mode 100644 index 000000000..036c11986 --- /dev/null +++ b/mesalib/src/gallium/Makefile.template @@ -0,0 +1,73 @@ +# src/gallium/Makefile.template + +# Template makefile for gallium libraries. +# +# Usage: +# The minimum that the including makefile needs to define +# is TOP, LIBNAME and one of of the *_SOURCES. +# +# Optional defines: +# LIBRARY_INCLUDES are appended to the list of includes directories. +# LIBRARY_DEFINES is not used for makedepend, but for compilation. + +### Basic defines ### + +OBJECTS = $(C_SOURCES:.c=.o) \ + $(CPP_SOURCES:.cpp=.o) \ + $(ASM_SOURCES:.S=.o) + +INCLUDES = \ + -I. \ + -I$(TOP)/src/gallium/include \ + -I$(TOP)/src/gallium/auxiliary \ + -I$(TOP)/src/gallium/drivers \ + $(LIBRARY_INCLUDES) + +ifeq ($(MESA_LLVM),1) +LIBRARY_DEFINES += $(LLVM_CFLAGS) +endif + + +##### TARGETS ##### + +default: depend lib$(LIBNAME).a $(PROGS) + +lib$(LIBNAME).a: $(OBJECTS) $(EXTRA_OBJECTS) Makefile $(TOP)/src/gallium/Makefile.template + $(MKLIB) -o $(LIBNAME) -static $(OBJECTS) $(EXTRA_OBJECTS) + +depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURCES) + rm -f depend + touch depend + $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(GENERATED_SOURCES) 2> /dev/null + +$(PROGS): % : %.o $(PROGS_DEPS) + $(LD) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS) -Wl,--end-group + +# Emacs tags +tags: + etags `find . -name \*.[ch]` `find $(TOP)/src/gallium/include -name \*.h` + +# Remove .o and backup files +clean: + rm -f $(OBJECTS) $(GENERATED_SOURCES) $(PROGS) lib$(LIBNAME).a depend depend.bak $(CLEAN_EXTRA) + +# Dummy target +install: + @echo -n "" + +##### RULES ##### + +%.s: %.c + $(CC) -S $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@ + +%.o: %.c + $(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@ + +%.o: %.cpp + $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(LIBRARY_DEFINES) $< -o $@ + +%.o: %.S + $(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@ + + +sinclude depend diff --git a/mesalib/src/gallium/README.portability b/mesalib/src/gallium/README.portability new file mode 100644 index 000000000..adecf4bb7 --- /dev/null +++ b/mesalib/src/gallium/README.portability @@ -0,0 +1,109 @@ + CROSS-PLATFORM PORTABILITY GUIDELINES FOR GALLIUM3D + + += General Considerations = + +The state tracker and winsys driver support a rather limited number of +platforms. However, the pipe drivers are meant to run in a wide number of +platforms. Hence the pipe drivers, the auxiliary modules, and all public +headers in general, should strictly follow these guidelines to ensure + + += Compiler Support = + +* Include the p_compiler.h. + +* Don't use the 'inline' keyword, use the INLINE macro in p_compiler.h instead. + +* Cast explicitly when converting to integer types of smaller sizes. + +* Cast explicitly when converting between float, double and integral types. + +* Don't use named struct initializers. + +* Don't use variable number of macro arguments. Use static inline functions +instead. + +* Don't use C99 features. + += Standard Library = + +* Avoid including standard library headers. Most standard library functions are +not available in Windows Kernel Mode. Use the appropriate p_*.h include. + +== Memory Allocation == + +* Use MALLOC, CALLOC, FREE instead of the malloc, calloc, free functions. + +* Use align_pointer() function defined in u_memory.h for aligning pointers + in a portable way. + +== Debugging == + +* Use the functions/macros in p_debug.h. + +* Don't include assert.h, call abort, printf, etc. + + += Code Style = + +== Inherantice in C == + +The main thing we do is mimic inheritance by structure containment. + +Here's a silly made-up example: + +/* base class */ +struct buffer +{ + int size; + void (*validate)(struct buffer *buf); +}; + +/* sub-class of bufffer */ +struct texture_buffer +{ + struct buffer base; /* the base class, MUST COME FIRST! */ + int format; + int width, height; +}; + + +Then, we'll typically have cast-wrapper functions to convert base-class +pointers to sub-class pointers where needed: + +static inline struct vertex_buffer *vertex_buffer(struct buffer *buf) +{ + return (struct vertex_buffer *) buf; +} + + +To create/init a sub-classed object: + +struct buffer *create_texture_buffer(int w, int h, int format) +{ + struct texture_buffer *t = malloc(sizeof(*t)); + t->format = format; + t->width = w; + t->height = h; + t->base.size = w * h; + t->base.validate = tex_validate; + return &t->base; +} + +Example sub-class method: + +void tex_validate(struct buffer *buf) +{ + struct texture_buffer *tb = texture_buffer(buf); + assert(tb->format); + assert(tb->width); + assert(tb->height); +} + + +Note that we typically do not use typedefs to make "class names"; we use +'struct whatever' everywhere. + +Gallium's pipe_context and the subclassed psb_context, etc are prime examples +of this. There's also many examples in Mesa and the Mesa state tracker. diff --git a/mesalib/src/gallium/SConscript b/mesalib/src/gallium/SConscript new file mode 100644 index 000000000..f281f4c65 --- /dev/null +++ b/mesalib/src/gallium/SConscript @@ -0,0 +1,179 @@ +Import('env') + +# +# Auxiliary modules +# + +SConscript('auxiliary/SConscript') + +# +# Drivers +# + +# These are common and work across all platforms +SConscript([ + 'drivers/galahad/SConscript', + 'drivers/identity/SConscript', + 'drivers/llvmpipe/SConscript', + 'drivers/rbug/SConscript', + 'drivers/softpipe/SConscript', + 'drivers/svga/SConscript', + 'drivers/trace/SConscript', +]) + +if not env['msvc']: + # These drivers do not build on MSVC compilers + SConscript([ + 'drivers/i915/SConscript', + ]) + +if env['drm']: + # These drivers depend on drm headers + if env['drm_radeon']: + SConscript([ + 'drivers/r300/SConscript', + 'drivers/r600/SConscript', + ]) + if env['llvm']: + SConscript([ + 'drivers/radeonsi/SConscript', + ]) + # XXX: nouveau drivers have a tight dependency on libdrm, so to enable + # we need some version logic before we enable them. Also, ATM there is + # no nouveau target in scons + # if env['drm_nouveau']: + # SConscript([ + # 'drivers/nouveau/SConscript', + # 'drivers/nv50/SConscript', + # 'drivers/nvc0/SConscript', + # 'drivers/nvfx/SConscript', + # ]) + +# +# State trackers +# + +# Needed by some state trackers +SConscript('winsys/sw/null/SConscript') + +if not env['embedded']: + SConscript('state_trackers/vega/SConscript') + if env['platform'] not in ('cygwin', 'darwin', 'haiku', 'sunos'): + SConscript('state_trackers/egl/SConscript') + + if env['x11']: + SConscript('state_trackers/glx/xlib/SConscript') + + if env['dri']: + SConscript('state_trackers/dri/SConscript') + + if env['dri'] and env['xorg']: + SConscript('state_trackers/xorg/SConscript') + + if env['platform'] == 'windows': + SConscript('state_trackers/wgl/SConscript') + +# +# Winsys +# + +SConscript([ + 'winsys/sw/wrapper/SConscript', +]) + +if env['x11']: + SConscript([ + 'winsys/sw/xlib/SConscript', + ]) + +if env['platform'] == 'windows': + SConscript([ + 'winsys/sw/gdi/SConscript', + ]) + +if not env['msvc']: + SConscript([ + 'winsys/i915/sw/SConscript', + ]) + +if env['dri']: + SConscript([ + 'winsys/sw/dri/SConscript', + ]) + + SConscript([ + 'winsys/svga/drm/SConscript', + ]) + + if env['drm_intel']: + SConscript([ + 'winsys/i915/drm/SConscript', + ]) + + if env['drm_radeon']: + SConscript([ + 'winsys/radeon/drm/SConscript', + ]) + +# +# Targets +# + +SConscript([ + 'targets/graw-null/SConscript', +]) + +if not env['embedded']: + if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 'sunos'): + SConscript([ + 'targets/egl-static/SConscript' + ]) + + if env['x11']: + SConscript([ + 'targets/graw-xlib/SConscript', + 'targets/libgl-xlib/SConscript', + ]) + + if env['platform'] == 'windows': + SConscript([ + 'targets/graw-gdi/SConscript', + 'targets/libgl-gdi/SConscript', + ]) + + if env['dri']: + SConscript([ + 'targets/SConscript.dri', + 'targets/dri-swrast/SConscript', + 'targets/dri-vmwgfx/SConscript', + #'targets/dri-nouveau/SConscript', + ]) + if env['drm_intel']: + SConscript([ + 'targets/dri-i915/SConscript', + ]) + if env['drm_radeon']: + SConscript([ + 'targets/dri-r300/SConscript', + 'targets/dri-r600/SConscript', + ]) + if env['llvm']: + SConscript([ + 'targets/dri-radeonsi/SConscript', + ]) + + if env['xorg'] and env['drm']: + SConscript([ + #'targets/xorg-i915/SConscript', + #'targets/xorg-nouveau/SConscript', + #'targets/xorg-radeon/SConscript', + ]) + + +# +# Unit tests & tools +# + +if not env['embedded']: + SConscript('tests/unit/SConscript') + SConscript('tests/graw/SConscript') diff --git a/mesalib/src/gallium/auxiliary/Android.mk b/mesalib/src/gallium/auxiliary/Android.mk new file mode 100644 index 000000000..0c37dd31a --- /dev/null +++ b/mesalib/src/gallium/auxiliary/Android.mk @@ -0,0 +1,55 @@ +# Mesa 3-D graphics library +# +# Copyright (C) 2010-2011 Chia-I Wu +# Copyright (C) 2010-2011 LunarG Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to 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. + +LOCAL_PATH := $(call my-dir) + +# get C_SOURCES and GENERATED_SOURCES +include $(LOCAL_PATH)/Makefile.sources + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := $(C_SOURCES) + +LOCAL_C_INCLUDES := $(GALLIUM_TOP)/auxiliary/util + +LOCAL_MODULE := libmesa_gallium + +# generate sources +LOCAL_MODULE_CLASS := STATIC_LIBRARIES +intermediates := $(call local-intermediates-dir) +LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/, $(GENERATED_SOURCES)) + +$(LOCAL_GENERATED_SOURCES): PRIVATE_PYTHON := $(MESA_PYTHON2) +$(LOCAL_GENERATED_SOURCES): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PYTHON) $^ > $@ + +$(intermediates)/indices/u_indices_gen.c \ +$(intermediates)/indices/u_unfilled_gen.c \ +$(intermediates)/util/u_format_srgb.c \ +$(intermediates)/util/u_half.c: $(intermediates)/%.c: $(LOCAL_PATH)/%.py + $(transform-generated-source) + +$(intermediates)/util/u_format_table.c: $(intermediates)/%.c: $(LOCAL_PATH)/%.py $(LOCAL_PATH)/util/u_format.csv + $(transform-generated-source) + +include $(GALLIUM_COMMON_MK) +include $(BUILD_STATIC_LIBRARY) diff --git a/mesalib/src/gallium/auxiliary/Makefile b/mesalib/src/gallium/auxiliary/Makefile new file mode 100644 index 000000000..a70ae7384 --- /dev/null +++ b/mesalib/src/gallium/auxiliary/Makefile @@ -0,0 +1,44 @@ +TOP = ../../.. +include $(TOP)/configs/current + +LIBNAME = gallium + +# get source lists +include Makefile.sources + +C_SOURCES += $(GENERATED_SOURCES) + +ifeq ($(MESA_LLVM),1) +C_SOURCES += \ + $(GALLIVM_SOURCES) +CPP_SOURCES += \ + $(GALLIVM_CPP_SOURCES) +endif + + +include ../Makefile.template + +default install clean: %: subdirs-% + +subdirs-%: + @for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) $*) || exit 1; \ + fi \ + done + +indices/u_indices_gen.c: indices/u_indices_gen.py + $(PYTHON2) $< > $@ + +indices/u_unfilled_gen.c: indices/u_unfilled_gen.py + $(PYTHON2) $< > $@ + +util/u_format_srgb.c: util/u_format_srgb.py + $(PYTHON2) $< > $@ + +util/u_format_table.c: util/u_format_table.py util/u_format_pack.py util/u_format_parse.py util/u_format.csv + $(PYTHON2) util/u_format_table.py util/u_format.csv > $@ + +util/u_half.c: util/u_half.py + $(PYTHON2) util/u_half.py > $@ +# DO NOT DELETE diff --git a/mesalib/src/gallium/auxiliary/Makefile.sources b/mesalib/src/gallium/auxiliary/Makefile.sources new file mode 100644 index 000000000..277428b38 --- /dev/null +++ b/mesalib/src/gallium/auxiliary/Makefile.sources @@ -0,0 +1,197 @@ +SUBDIRS := pipe-loader + +C_SOURCES := \ + cso_cache/cso_cache.c \ + cso_cache/cso_context.c \ + cso_cache/cso_hash.c \ + draw/draw_context.c \ + draw/draw_fs.c \ + draw/draw_gs.c \ + draw/draw_pipe.c \ + draw/draw_pipe_aaline.c \ + draw/draw_pipe_aapoint.c \ + draw/draw_pipe_clip.c \ + draw/draw_pipe_cull.c \ + draw/draw_pipe_flatshade.c \ + draw/draw_pipe_offset.c \ + draw/draw_pipe_pstipple.c \ + draw/draw_pipe_stipple.c \ + draw/draw_pipe_twoside.c \ + draw/draw_pipe_unfilled.c \ + draw/draw_pipe_util.c \ + draw/draw_pipe_validate.c \ + draw/draw_pipe_vbuf.c \ + draw/draw_pipe_wide_line.c \ + draw/draw_pipe_wide_point.c \ + draw/draw_pt.c \ + draw/draw_pt_emit.c \ + draw/draw_pt_fetch.c \ + draw/draw_pt_fetch_emit.c \ + draw/draw_pt_fetch_shade_emit.c \ + draw/draw_pt_fetch_shade_pipeline.c \ + draw/draw_pt_post_vs.c \ + draw/draw_pt_so_emit.c \ + draw/draw_pt_util.c \ + draw/draw_pt_vsplit.c \ + draw/draw_vertex.c \ + draw/draw_vs.c \ + draw/draw_vs_exec.c \ + draw/draw_vs_ppc.c \ + draw/draw_vs_variant.c \ + os/os_misc.c \ + os/os_time.c \ + pipebuffer/pb_buffer_fenced.c \ + pipebuffer/pb_buffer_malloc.c \ + pipebuffer/pb_bufmgr_alt.c \ + pipebuffer/pb_bufmgr_cache.c \ + pipebuffer/pb_bufmgr_debug.c \ + pipebuffer/pb_bufmgr_mm.c \ + pipebuffer/pb_bufmgr_ondemand.c \ + pipebuffer/pb_bufmgr_pool.c \ + pipebuffer/pb_bufmgr_slab.c \ + pipebuffer/pb_validate.c \ + postprocess/pp_celshade.c \ + postprocess/pp_colors.c \ + postprocess/pp_init.c \ + postprocess/pp_mlaa.c \ + postprocess/pp_run.c \ + postprocess/pp_program.c \ + rbug/rbug_connection.c \ + rbug/rbug_context.c \ + rbug/rbug_core.c \ + rbug/rbug_demarshal.c \ + rbug/rbug_texture.c \ + rbug/rbug_shader.c \ + rtasm/rtasm_cpu.c \ + rtasm/rtasm_execmem.c \ + rtasm/rtasm_ppc.c \ + rtasm/rtasm_x86sse.c \ + tgsi/tgsi_build.c \ + tgsi/tgsi_dump.c \ + tgsi/tgsi_exec.c \ + tgsi/tgsi_info.c \ + tgsi/tgsi_iterate.c \ + tgsi/tgsi_parse.c \ + tgsi/tgsi_ppc.c \ + tgsi/tgsi_sanity.c \ + tgsi/tgsi_scan.c \ + tgsi/tgsi_strings.c \ + tgsi/tgsi_text.c \ + tgsi/tgsi_transform.c \ + tgsi/tgsi_ureg.c \ + tgsi/tgsi_util.c \ + translate/translate.c \ + translate/translate_cache.c \ + translate/translate_generic.c \ + translate/translate_sse.c \ + util/u_debug.c \ + util/u_debug_describe.c \ + util/u_debug_memory.c \ + util/u_debug_refcnt.c \ + util/u_debug_stack.c \ + util/u_debug_symbol.c \ + util/u_dump_defines.c \ + util/u_dump_state.c \ + util/u_bitmask.c \ + util/u_blit.c \ + util/u_blitter.c \ + util/u_cache.c \ + util/u_caps.c \ + util/u_cpu_detect.c \ + util/u_dl.c \ + util/u_draw.c \ + util/u_draw_quad.c \ + util/u_format.c \ + util/u_format_other.c \ + util/u_format_latc.c \ + util/u_format_s3tc.c \ + util/u_format_rgtc.c \ + util/u_format_etc.c \ + util/u_format_tests.c \ + util/u_format_yuv.c \ + util/u_format_zs.c \ + util/u_framebuffer.c \ + util/u_gen_mipmap.c \ + util/u_handle_table.c \ + util/u_hash.c \ + util/u_hash_table.c \ + util/u_index_modify.c \ + util/u_keymap.c \ + util/u_linear.c \ + util/u_linkage.c \ + util/u_network.c \ + util/u_math.c \ + util/u_mm.c \ + util/u_pstipple.c \ + util/u_rect.c \ + util/u_ringbuffer.c \ + util/u_sampler.c \ + util/u_simple_shaders.c \ + util/u_slab.c \ + util/u_snprintf.c \ + util/u_staging.c \ + util/u_surface.c \ + util/u_surfaces.c \ + util/u_texture.c \ + util/u_tile.c \ + util/u_transfer.c \ + util/u_resource.c \ + util/u_upload_mgr.c \ + util/u_vbuf.c \ + vl/vl_csc.c \ + vl/vl_compositor.c \ + vl/vl_matrix_filter.c \ + vl/vl_median_filter.c \ + vl/vl_decoder.c \ + vl/vl_mpeg12_decoder.c \ + vl/vl_mpeg12_bitstream.c \ + vl/vl_zscan.c \ + vl/vl_idct.c \ + vl/vl_mc.c \ + vl/vl_vertex_buffers.c \ + vl/vl_video_buffer.c + +GENERATED_SOURCES := \ + indices/u_indices_gen.c \ + indices/u_unfilled_gen.c \ + util/u_format_srgb.c \ + util/u_format_table.c \ + util/u_half.c + +GALLIVM_SOURCES := \ + gallivm/lp_bld_arit.c \ + gallivm/lp_bld_assert.c \ + gallivm/lp_bld_bitarit.c \ + gallivm/lp_bld_const.c \ + gallivm/lp_bld_conv.c \ + gallivm/lp_bld_flow.c \ + gallivm/lp_bld_format_aos.c \ + gallivm/lp_bld_format_soa.c \ + gallivm/lp_bld_format_yuv.c \ + gallivm/lp_bld_gather.c \ + gallivm/lp_bld_init.c \ + gallivm/lp_bld_intr.c \ + gallivm/lp_bld_logic.c \ + gallivm/lp_bld_pack.c \ + gallivm/lp_bld_printf.c \ + gallivm/lp_bld_quad.c \ + gallivm/lp_bld_sample.c \ + gallivm/lp_bld_sample_aos.c \ + gallivm/lp_bld_sample_soa.c \ + gallivm/lp_bld_struct.c \ + gallivm/lp_bld_swizzle.c \ + gallivm/lp_bld_tgsi.c \ + gallivm/lp_bld_tgsi_action.c \ + gallivm/lp_bld_tgsi_aos.c \ + gallivm/lp_bld_tgsi_info.c \ + gallivm/lp_bld_tgsi_soa.c \ + gallivm/lp_bld_type.c \ + draw/draw_llvm.c \ + draw/draw_llvm_sample.c \ + draw/draw_llvm_translate.c \ + draw/draw_vs_llvm.c \ + draw/draw_pt_fetch_shade_pipeline_llvm.c + +GALLIVM_CPP_SOURCES := \ + gallivm/lp_bld_debug.cpp \ + gallivm/lp_bld_misc.cpp diff --git a/mesalib/src/gallium/auxiliary/SConscript b/mesalib/src/gallium/auxiliary/SConscript new file mode 100644 index 000000000..07c420e13 --- /dev/null +++ b/mesalib/src/gallium/auxiliary/SConscript @@ -0,0 +1,72 @@ +Import('*') + +from sys import executable as python_cmd + +env.Append(CPPPATH = [ + 'indices', + 'util', +]) + +env.CodeGenerate( + target = 'indices/u_indices_gen.c', + script = 'indices/u_indices_gen.py', + source = [], + command = python_cmd + ' $SCRIPT > $TARGET' +) + +env.CodeGenerate( + target = 'indices/u_unfilled_gen.c', + script = 'indices/u_unfilled_gen.py', + source = [], + command = python_cmd + ' $SCRIPT > $TARGET' +) + +env.CodeGenerate( + target = 'util/u_format_srgb.c', + script = 'util/u_format_srgb.py', + source = [], + command = python_cmd + ' $SCRIPT > $TARGET' +) + +env.CodeGenerate( + target = 'util/u_format_table.c', + script = '#src/gallium/auxiliary/util/u_format_table.py', + source = ['#src/gallium/auxiliary/util/u_format.csv'], + command = python_cmd + ' $SCRIPT $SOURCE > $TARGET' +) + +env.CodeGenerate( + target = 'util/u_half.c', + script = 'util/u_half.py', + source = [], + command = python_cmd + ' $SCRIPT > $TARGET' +) + +env.Depends('util/u_format_table.c', [ + '#src/gallium/auxiliary/util/u_format_parse.py', + 'util/u_format_pack.py', +]) + +source = env.ParseSourceList('Makefile.sources', [ + 'C_SOURCES', + 'GENERATED_SOURCES' +]) + +if env['llvm']: + source += env.ParseSourceList('Makefile.sources', [ + 'GALLIVM_SOURCES', + 'GALLIVM_CPP_SOURCES' + ]) + + if env['toolchain'] == 'crossmingw': + # compile lp_bld_misc.cpp without -gstabs option + source = env.compile_without_gstabs(source, "gallivm/lp_bld_misc.cpp") + +gallium = env.ConvenienceLibrary( + target = 'gallium', + source = source, +) + +env.Alias('gallium', gallium) + +Export('gallium') diff --git a/mesalib/src/gallium/auxiliary/util/.gitignore b/mesalib/src/gallium/auxiliary/util/.gitignore new file mode 100644 index 000000000..5dd0408ef --- /dev/null +++ b/mesalib/src/gallium/auxiliary/util/.gitignore @@ -0,0 +1,3 @@ +u_format_srgb.c +u_format_table.c +u_half.c diff --git a/mesalib/src/gallium/auxiliary/util/dbghelp.h b/mesalib/src/gallium/auxiliary/util/dbghelp.h index da5e3ad08..bc7c53cf9 100644 --- a/mesalib/src/gallium/auxiliary/util/dbghelp.h +++ b/mesalib/src/gallium/auxiliary/util/dbghelp.h @@ -1,1265 +1,1265 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#ifndef _DBGHELP_ -#define _DBGHELP_ - -#ifdef _WIN64 -#ifndef _IMAGEHLP64 -#define _IMAGEHLP64 -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define IMAGEAPI DECLSPEC_IMPORT WINAPI -#define DBHLP_DEPRECIATED __declspec(deprecated) - -#define DBHLPAPI IMAGEAPI - -#define IMAGE_SEPARATION (64*1024) - - typedef struct _LOADED_IMAGE { - PSTR ModuleName; - HANDLE hFile; - PUCHAR MappedAddress; -#ifdef _IMAGEHLP64 - PIMAGE_NT_HEADERS64 FileHeader; -#else - PIMAGE_NT_HEADERS32 FileHeader; -#endif - PIMAGE_SECTION_HEADER LastRvaSection; - ULONG NumberOfSections; - PIMAGE_SECTION_HEADER Sections; - ULONG Characteristics; - BOOLEAN fSystemImage; - BOOLEAN fDOSImage; - LIST_ENTRY Links; - ULONG SizeOfImage; - } LOADED_IMAGE,*PLOADED_IMAGE; - -#define MAX_SYM_NAME 2000 - - typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE FileHandle,PSTR FileName,PVOID CallerData); - typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PSTR filename,PVOID context); - typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACK)(HANDLE FileHandle,PSTR FileName,PVOID CallerData); - - typedef BOOL (WINAPI *PSYMBOLSERVERPROC)(LPCSTR,LPCSTR,PVOID,DWORD,DWORD,LPSTR); - typedef BOOL (WINAPI *PSYMBOLSERVEROPENPROC)(VOID); - typedef BOOL (WINAPI *PSYMBOLSERVERCLOSEPROC)(VOID); - typedef BOOL (WINAPI *PSYMBOLSERVERSETOPTIONSPROC)(UINT_PTR,ULONG64); - typedef BOOL (CALLBACK WINAPI *PSYMBOLSERVERCALLBACKPROC)(UINT_PTR action,ULONG64 data,ULONG64 context); - typedef UINT_PTR (WINAPI *PSYMBOLSERVERGETOPTIONSPROC)(); - typedef BOOL (WINAPI *PSYMBOLSERVERPINGPROC)(LPCSTR); - - HANDLE IMAGEAPI FindDebugInfoFile(PSTR FileName,PSTR SymbolPath,PSTR DebugFilePath); - HANDLE IMAGEAPI FindDebugInfoFileEx(PSTR FileName,PSTR SymbolPath,PSTR DebugFilePath,PFIND_DEBUG_FILE_CALLBACK Callback,PVOID CallerData); - BOOL IMAGEAPI SymFindFileInPath(HANDLE hprocess,LPSTR SearchPath,LPSTR FileName,PVOID id,DWORD two,DWORD three,DWORD flags,LPSTR FoundFile,PFINDFILEINPATHCALLBACK callback,PVOID context); - HANDLE IMAGEAPI FindExecutableImage(PSTR FileName,PSTR SymbolPath,PSTR ImageFilePath); - HANDLE IMAGEAPI FindExecutableImageEx(PSTR FileName,PSTR SymbolPath,PSTR ImageFilePath,PFIND_EXE_FILE_CALLBACK Callback,PVOID CallerData); - PIMAGE_NT_HEADERS IMAGEAPI ImageNtHeader(PVOID Base); - PVOID IMAGEAPI ImageDirectoryEntryToDataEx(PVOID Base,BOOLEAN MappedAsImage,USHORT DirectoryEntry,PULONG Size,PIMAGE_SECTION_HEADER *FoundHeader); - PVOID IMAGEAPI ImageDirectoryEntryToData(PVOID Base,BOOLEAN MappedAsImage,USHORT DirectoryEntry,PULONG Size); - PIMAGE_SECTION_HEADER IMAGEAPI ImageRvaToSection(PIMAGE_NT_HEADERS NtHeaders,PVOID Base,ULONG Rva); - PVOID IMAGEAPI ImageRvaToVa(PIMAGE_NT_HEADERS NtHeaders,PVOID Base,ULONG Rva,PIMAGE_SECTION_HEADER *LastRvaSection); - -#define SSRVOPT_CALLBACK 0x0001 -#define SSRVOPT_DWORD 0x0002 -#define SSRVOPT_DWORDPTR 0x0004 -#define SSRVOPT_GUIDPTR 0x0008 -#define SSRVOPT_OLDGUIDPTR 0x0010 -#define SSRVOPT_UNATTENDED 0x0020 -#define SSRVOPT_NOCOPY 0x0040 -#define SSRVOPT_PARENTWIN 0x0080 -#define SSRVOPT_PARAMTYPE 0x0100 -#define SSRVOPT_SECURE 0x0200 -#define SSRVOPT_TRACE 0x0400 -#define SSRVOPT_SETCONTEXT 0x0800 -#define SSRVOPT_PROXY 0x1000 -#define SSRVOPT_DOWNSTREAM_STORE 0x2000 -#define SSRVOPT_RESET ((ULONG_PTR)-1) - -#define SSRVACTION_TRACE 1 -#define SSRVACTION_QUERYCANCEL 2 -#define SSRVACTION_EVENT 3 - -#ifndef _WIN64 - - typedef struct _IMAGE_DEBUG_INFORMATION { - LIST_ENTRY List; - DWORD ReservedSize; - PVOID ReservedMappedBase; - USHORT ReservedMachine; - USHORT ReservedCharacteristics; - DWORD ReservedCheckSum; - DWORD ImageBase; - DWORD SizeOfImage; - DWORD ReservedNumberOfSections; - PIMAGE_SECTION_HEADER ReservedSections; - DWORD ReservedExportedNamesSize; - PSTR ReservedExportedNames; - DWORD ReservedNumberOfFunctionTableEntries; - PIMAGE_FUNCTION_ENTRY ReservedFunctionTableEntries; - DWORD ReservedLowestFunctionStartingAddress; - DWORD ReservedHighestFunctionEndingAddress; - DWORD ReservedNumberOfFpoTableEntries; - PFPO_DATA ReservedFpoTableEntries; - DWORD SizeOfCoffSymbols; - PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols; - DWORD ReservedSizeOfCodeViewSymbols; - PVOID ReservedCodeViewSymbols; - PSTR ImageFilePath; - PSTR ImageFileName; - PSTR ReservedDebugFilePath; - DWORD ReservedTimeDateStamp; - BOOL ReservedRomImage; - PIMAGE_DEBUG_DIRECTORY ReservedDebugDirectory; - DWORD ReservedNumberOfDebugDirectories; - DWORD ReservedOriginalFunctionTableBaseAddress; - DWORD Reserved[2 ]; - } IMAGE_DEBUG_INFORMATION,*PIMAGE_DEBUG_INFORMATION; - - PIMAGE_DEBUG_INFORMATION IMAGEAPI MapDebugInformation(HANDLE FileHandle,PSTR FileName,PSTR SymbolPath,DWORD ImageBase); - BOOL IMAGEAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION DebugInfo); -#endif - - typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACK)(LPCSTR FilePath,PVOID CallerData); - - BOOL IMAGEAPI SearchTreeForFile(PSTR RootPath,PSTR InputPathName,PSTR OutputPathBuffer); - BOOL IMAGEAPI EnumDirTree(HANDLE hProcess,PSTR RootPath,PSTR InputPathName,PSTR OutputPathBuffer,PENUMDIRTREE_CALLBACK Callback,PVOID CallbackData); - BOOL IMAGEAPI MakeSureDirectoryPathExists(PCSTR DirPath); - -#define UNDNAME_COMPLETE (0x0000) -#define UNDNAME_NO_LEADING_UNDERSCORES (0x0001) -#define UNDNAME_NO_MS_KEYWORDS (0x0002) -#define UNDNAME_NO_FUNCTION_RETURNS (0x0004) -#define UNDNAME_NO_ALLOCATION_MODEL (0x0008) -#define UNDNAME_NO_ALLOCATION_LANGUAGE (0x0010) -#define UNDNAME_NO_MS_THISTYPE (0x0020) -#define UNDNAME_NO_CV_THISTYPE (0x0040) -#define UNDNAME_NO_THISTYPE (0x0060) -#define UNDNAME_NO_ACCESS_SPECIFIERS (0x0080) -#define UNDNAME_NO_THROW_SIGNATURES (0x0100) -#define UNDNAME_NO_MEMBER_TYPE (0x0200) -#define UNDNAME_NO_RETURN_UDT_MODEL (0x0400) -#define UNDNAME_32_BIT_DECODE (0x0800) -#define UNDNAME_NAME_ONLY (0x1000) -#define UNDNAME_NO_ARGUMENTS (0x2000) -#define UNDNAME_NO_SPECIAL_SYMS (0x4000) - - DWORD IMAGEAPI WINAPI UnDecorateSymbolName(PCSTR DecoratedName,PSTR UnDecoratedName,DWORD UndecoratedLength,DWORD Flags); - -#define DBHHEADER_DEBUGDIRS 0x1 - - typedef struct _MODLOAD_DATA { - DWORD ssize; - DWORD ssig; - PVOID data; - DWORD size; - DWORD flags; - } MODLOAD_DATA,*PMODLOAD_DATA; - - typedef enum { - AddrMode1616,AddrMode1632,AddrModeReal,AddrModeFlat - } ADDRESS_MODE; - - typedef struct _tagADDRESS64 { - DWORD64 Offset; - WORD Segment; - ADDRESS_MODE Mode; - } ADDRESS64,*LPADDRESS64; - -#ifdef _IMAGEHLP64 -#define ADDRESS ADDRESS64 -#define LPADDRESS LPADDRESS64 -#else - typedef struct _tagADDRESS { - DWORD Offset; - WORD Segment; - ADDRESS_MODE Mode; - } ADDRESS,*LPADDRESS; - - static __inline void Address32To64(LPADDRESS a32,LPADDRESS64 a64) { - a64->Offset = (ULONG64)(LONG64)(LONG)a32->Offset; - a64->Segment = a32->Segment; - a64->Mode = a32->Mode; - } - - static __inline void Address64To32(LPADDRESS64 a64,LPADDRESS a32) { - a32->Offset = (ULONG)a64->Offset; - a32->Segment = a64->Segment; - a32->Mode = a64->Mode; - } -#endif - - typedef struct _KDHELP64 { - DWORD64 Thread; - DWORD ThCallbackStack; - DWORD ThCallbackBStore; - DWORD NextCallback; - DWORD FramePointer; - DWORD64 KiCallUserMode; - DWORD64 KeUserCallbackDispatcher; - DWORD64 SystemRangeStart; - DWORD64 Reserved[8]; - } KDHELP64,*PKDHELP64; - -#ifdef _IMAGEHLP64 -#define KDHELP KDHELP64 -#define PKDHELP PKDHELP64 -#else - typedef struct _KDHELP { - DWORD Thread; - DWORD ThCallbackStack; - DWORD NextCallback; - DWORD FramePointer; - DWORD KiCallUserMode; - DWORD KeUserCallbackDispatcher; - DWORD SystemRangeStart; - DWORD ThCallbackBStore; - DWORD Reserved[8]; - } KDHELP,*PKDHELP; - - static __inline void KdHelp32To64(PKDHELP p32,PKDHELP64 p64) { - p64->Thread = p32->Thread; - p64->ThCallbackStack = p32->ThCallbackStack; - p64->NextCallback = p32->NextCallback; - p64->FramePointer = p32->FramePointer; - p64->KiCallUserMode = p32->KiCallUserMode; - p64->KeUserCallbackDispatcher = p32->KeUserCallbackDispatcher; - p64->SystemRangeStart = p32->SystemRangeStart; - } -#endif - - typedef struct _tagSTACKFRAME64 { - ADDRESS64 AddrPC; - ADDRESS64 AddrReturn; - ADDRESS64 AddrFrame; - ADDRESS64 AddrStack; - ADDRESS64 AddrBStore; - PVOID FuncTableEntry; - DWORD64 Params[4]; - BOOL Far; - BOOL Virtual; - DWORD64 Reserved[3]; - KDHELP64 KdHelp; - } STACKFRAME64,*LPSTACKFRAME64; - -#ifdef _IMAGEHLP64 -#define STACKFRAME STACKFRAME64 -#define LPSTACKFRAME LPSTACKFRAME64 -#else - typedef struct _tagSTACKFRAME { - ADDRESS AddrPC; - ADDRESS AddrReturn; - ADDRESS AddrFrame; - ADDRESS AddrStack; - PVOID FuncTableEntry; - DWORD Params[4]; - BOOL Far; - BOOL Virtual; - DWORD Reserved[3]; - KDHELP KdHelp; - ADDRESS AddrBStore; - } STACKFRAME,*LPSTACKFRAME; -#endif - - typedef BOOL (WINAPI *PREAD_PROCESS_MEMORY_ROUTINE64)(HANDLE hProcess,DWORD64 qwBaseAddress,PVOID lpBuffer,DWORD nSize,LPDWORD lpNumberOfBytesRead); - typedef PVOID (WINAPI *PFUNCTION_TABLE_ACCESS_ROUTINE64)(HANDLE hProcess,DWORD64 AddrBase); - typedef DWORD64 (WINAPI *PGET_MODULE_BASE_ROUTINE64)(HANDLE hProcess,DWORD64 Address); - typedef DWORD64 (WINAPI *PTRANSLATE_ADDRESS_ROUTINE64)(HANDLE hProcess,HANDLE hThread,LPADDRESS64 lpaddr); - - BOOL IMAGEAPI StackWalk64(DWORD MachineType,HANDLE hProcess,HANDLE hThread,LPSTACKFRAME64 StackFrame,PVOID ContextRecord,PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine,PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine,PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine,PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress); - -#ifdef _IMAGEHLP64 -#define PREAD_PROCESS_MEMORY_ROUTINE PREAD_PROCESS_MEMORY_ROUTINE64 -#define PFUNCTION_TABLE_ACCESS_ROUTINE PFUNCTION_TABLE_ACCESS_ROUTINE64 -#define PGET_MODULE_BASE_ROUTINE PGET_MODULE_BASE_ROUTINE64 -#define PTRANSLATE_ADDRESS_ROUTINE PTRANSLATE_ADDRESS_ROUTINE64 -#define StackWalk StackWalk64 -#else - typedef BOOL (WINAPI *PREAD_PROCESS_MEMORY_ROUTINE)(HANDLE hProcess,DWORD lpBaseAddress,PVOID lpBuffer,DWORD nSize,PDWORD lpNumberOfBytesRead); - typedef PVOID (WINAPI *PFUNCTION_TABLE_ACCESS_ROUTINE)(HANDLE hProcess,DWORD AddrBase); - typedef DWORD (WINAPI *PGET_MODULE_BASE_ROUTINE)(HANDLE hProcess,DWORD Address); - typedef DWORD (WINAPI *PTRANSLATE_ADDRESS_ROUTINE)(HANDLE hProcess,HANDLE hThread,LPADDRESS lpaddr); - - BOOL IMAGEAPI StackWalk(DWORD MachineType,HANDLE hProcess,HANDLE hThread,LPSTACKFRAME StackFrame,PVOID ContextRecord,PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine,PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine,PTRANSLATE_ADDRESS_ROUTINE TranslateAddress); -#endif - -#define API_VERSION_NUMBER 9 - - typedef struct API_VERSION { - USHORT MajorVersion; - USHORT MinorVersion; - USHORT Revision; - USHORT Reserved; - } API_VERSION,*LPAPI_VERSION; - - LPAPI_VERSION IMAGEAPI ImagehlpApiVersion(VOID); - LPAPI_VERSION IMAGEAPI ImagehlpApiVersionEx(LPAPI_VERSION AppVersion); - DWORD IMAGEAPI GetTimestampForLoadedLibrary(HMODULE Module); - - typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK64)(PSTR ModuleName,DWORD64 BaseOfDll,PVOID UserContext); - typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64)(PSTR SymbolName,DWORD64 SymbolAddress,ULONG SymbolSize,PVOID UserContext); - typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64W)(PWSTR SymbolName,DWORD64 SymbolAddress,ULONG SymbolSize,PVOID UserContext); - typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK64)(PSTR ModuleName,DWORD64 ModuleBase,ULONG ModuleSize,PVOID UserContext); - typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK64)(HANDLE hProcess,ULONG ActionCode,ULONG64 CallbackData,ULONG64 UserContext); - typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK)(HANDLE hProcess,DWORD AddrBase,PVOID UserContext); - typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK64)(HANDLE hProcess,ULONG64 AddrBase,ULONG64 UserContext); - -#ifdef _IMAGEHLP64 -#define PSYM_ENUMMODULES_CALLBACK PSYM_ENUMMODULES_CALLBACK64 -#define PSYM_ENUMSYMBOLS_CALLBACK PSYM_ENUMSYMBOLS_CALLBACK64 -#define PSYM_ENUMSYMBOLS_CALLBACKW PSYM_ENUMSYMBOLS_CALLBACK64W -#define PENUMLOADED_MODULES_CALLBACK PENUMLOADED_MODULES_CALLBACK64 -#define PSYMBOL_REGISTERED_CALLBACK PSYMBOL_REGISTERED_CALLBACK64 -#define PSYMBOL_FUNCENTRY_CALLBACK PSYMBOL_FUNCENTRY_CALLBACK64 -#else - typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PSTR ModuleName,ULONG BaseOfDll,PVOID UserContext); - typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(PSTR SymbolName,ULONG SymbolAddress,ULONG SymbolSize,PVOID UserContext); - typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACKW)(PWSTR SymbolName,ULONG SymbolAddress,ULONG SymbolSize,PVOID UserContext); - typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PSTR ModuleName,ULONG ModuleBase,ULONG ModuleSize,PVOID UserContext); - typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(HANDLE hProcess,ULONG ActionCode,PVOID CallbackData,PVOID UserContext); -#endif - -#define SYMFLAG_VALUEPRESENT 0x00000001 -#define SYMFLAG_REGISTER 0x00000008 -#define SYMFLAG_REGREL 0x00000010 -#define SYMFLAG_FRAMEREL 0x00000020 -#define SYMFLAG_PARAMETER 0x00000040 -#define SYMFLAG_LOCAL 0x00000080 -#define SYMFLAG_CONSTANT 0x00000100 -#define SYMFLAG_EXPORT 0x00000200 -#define SYMFLAG_FORWARDER 0x00000400 -#define SYMFLAG_FUNCTION 0x00000800 -#define SYMFLAG_VIRTUAL 0x00001000 -#define SYMFLAG_THUNK 0x00002000 -#define SYMFLAG_TLSREL 0x00004000 - - typedef enum { - SymNone = 0,SymCoff,SymCv,SymPdb,SymExport,SymDeferred,SymSym,SymDia,SymVirtual,NumSymTypes - } SYM_TYPE; - - typedef struct _IMAGEHLP_SYMBOL64 { - DWORD SizeOfStruct; - DWORD64 Address; - DWORD Size; - DWORD Flags; - DWORD MaxNameLength; - CHAR Name[1]; - } IMAGEHLP_SYMBOL64,*PIMAGEHLP_SYMBOL64; - - typedef struct _IMAGEHLP_SYMBOL64_PACKAGE { - IMAGEHLP_SYMBOL64 sym; - CHAR name[MAX_SYM_NAME + 1]; - } IMAGEHLP_SYMBOL64_PACKAGE,*PIMAGEHLP_SYMBOL64_PACKAGE; - -#ifdef _IMAGEHLP64 - -#define IMAGEHLP_SYMBOL IMAGEHLP_SYMBOL64 -#define PIMAGEHLP_SYMBOL PIMAGEHLP_SYMBOL64 -#define IMAGEHLP_SYMBOL_PACKAGE IMAGEHLP_SYMBOL64_PACKAGE -#define PIMAGEHLP_SYMBOL_PACKAGE PIMAGEHLP_SYMBOL64_PACKAGE -#else - - typedef struct _IMAGEHLP_SYMBOL { - DWORD SizeOfStruct; - DWORD Address; - DWORD Size; - DWORD Flags; - DWORD MaxNameLength; - CHAR Name[1]; - } IMAGEHLP_SYMBOL,*PIMAGEHLP_SYMBOL; - - typedef struct _IMAGEHLP_SYMBOL_PACKAGE { - IMAGEHLP_SYMBOL sym; - CHAR name[MAX_SYM_NAME + 1]; - } IMAGEHLP_SYMBOL_PACKAGE,*PIMAGEHLP_SYMBOL_PACKAGE; -#endif - - typedef struct _IMAGEHLP_MODULE64 { - DWORD SizeOfStruct; - DWORD64 BaseOfImage; - DWORD ImageSize; - DWORD TimeDateStamp; - DWORD CheckSum; - DWORD NumSyms; - SYM_TYPE SymType; - CHAR ModuleName[32]; - CHAR ImageName[256]; - CHAR LoadedImageName[256]; - CHAR LoadedPdbName[256]; - DWORD CVSig; - CHAR CVData[MAX_PATH*3]; - DWORD PdbSig; - GUID PdbSig70; - DWORD PdbAge; - BOOL PdbUnmatched; - BOOL DbgUnmatched; - BOOL LineNumbers; - BOOL GlobalSymbols; - BOOL TypeInfo; - } IMAGEHLP_MODULE64,*PIMAGEHLP_MODULE64; - - typedef struct _IMAGEHLP_MODULE64W { - DWORD SizeOfStruct; - DWORD64 BaseOfImage; - DWORD ImageSize; - DWORD TimeDateStamp; - DWORD CheckSum; - DWORD NumSyms; - SYM_TYPE SymType; - WCHAR ModuleName[32]; - WCHAR ImageName[256]; - WCHAR LoadedImageName[256]; - WCHAR LoadedPdbName[256]; - DWORD CVSig; - WCHAR CVData[MAX_PATH*3]; - DWORD PdbSig; - GUID PdbSig70; - DWORD PdbAge; - BOOL PdbUnmatched; - BOOL DbgUnmatched; - BOOL LineNumbers; - BOOL GlobalSymbols; - BOOL TypeInfo; - } IMAGEHLP_MODULEW64,*PIMAGEHLP_MODULEW64; - -#ifdef _IMAGEHLP64 -#define IMAGEHLP_MODULE IMAGEHLP_MODULE64 -#define PIMAGEHLP_MODULE PIMAGEHLP_MODULE64 -#define IMAGEHLP_MODULEW IMAGEHLP_MODULEW64 -#define PIMAGEHLP_MODULEW PIMAGEHLP_MODULEW64 -#else - typedef struct _IMAGEHLP_MODULE { - DWORD SizeOfStruct; - DWORD BaseOfImage; - DWORD ImageSize; - DWORD TimeDateStamp; - DWORD CheckSum; - DWORD NumSyms; - SYM_TYPE SymType; - CHAR ModuleName[32]; - CHAR ImageName[256]; - CHAR LoadedImageName[256]; - } IMAGEHLP_MODULE,*PIMAGEHLP_MODULE; - - typedef struct _IMAGEHLP_MODULEW { - DWORD SizeOfStruct; - DWORD BaseOfImage; - DWORD ImageSize; - DWORD TimeDateStamp; - DWORD CheckSum; - DWORD NumSyms; - SYM_TYPE SymType; - WCHAR ModuleName[32]; - WCHAR ImageName[256]; - WCHAR LoadedImageName[256]; - } IMAGEHLP_MODULEW,*PIMAGEHLP_MODULEW; -#endif - - typedef struct _IMAGEHLP_LINE64 { - DWORD SizeOfStruct; - PVOID Key; - DWORD LineNumber; - PCHAR FileName; - DWORD64 Address; - } IMAGEHLP_LINE64,*PIMAGEHLP_LINE64; - -#ifdef _IMAGEHLP64 -#define IMAGEHLP_LINE IMAGEHLP_LINE64 -#define PIMAGEHLP_LINE PIMAGEHLP_LINE64 -#else - typedef struct _IMAGEHLP_LINE { - DWORD SizeOfStruct; - PVOID Key; - DWORD LineNumber; - PCHAR FileName; - DWORD Address; - } IMAGEHLP_LINE,*PIMAGEHLP_LINE; -#endif - - typedef struct _SOURCEFILE { - DWORD64 ModBase; - PCHAR FileName; - } SOURCEFILE,*PSOURCEFILE; - -#define CBA_DEFERRED_SYMBOL_LOAD_START 0x00000001 -#define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 0x00000002 -#define CBA_DEFERRED_SYMBOL_LOAD_FAILURE 0x00000003 -#define CBA_SYMBOLS_UNLOADED 0x00000004 -#define CBA_DUPLICATE_SYMBOL 0x00000005 -#define CBA_READ_MEMORY 0x00000006 -#define CBA_DEFERRED_SYMBOL_LOAD_CANCEL 0x00000007 -#define CBA_SET_OPTIONS 0x00000008 -#define CBA_EVENT 0x00000010 -#define CBA_DEFERRED_SYMBOL_LOAD_PARTIAL 0x00000020 -#define CBA_DEBUG_INFO 0x10000000 - - typedef struct _IMAGEHLP_CBA_READ_MEMORY { - DWORD64 addr; - PVOID buf; - DWORD bytes; - DWORD *bytesread; - } IMAGEHLP_CBA_READ_MEMORY,*PIMAGEHLP_CBA_READ_MEMORY; - - enum { - sevInfo = 0,sevProblem,sevAttn,sevFatal,sevMax - }; - - typedef struct _IMAGEHLP_CBA_EVENT { - DWORD severity; - DWORD code; - PCHAR desc; - PVOID object; - } IMAGEHLP_CBA_EVENT,*PIMAGEHLP_CBA_EVENT; - - typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD64 { - DWORD SizeOfStruct; - DWORD64 BaseOfImage; - DWORD CheckSum; - DWORD TimeDateStamp; - CHAR FileName[MAX_PATH]; - BOOLEAN Reparse; - HANDLE hFile; - DWORD Flags; - } IMAGEHLP_DEFERRED_SYMBOL_LOAD64,*PIMAGEHLP_DEFERRED_SYMBOL_LOAD64; - -#define DSLFLAG_MISMATCHED_PDB 0x1 -#define DSLFLAG_MISMATCHED_DBG 0x2 - -#ifdef _IMAGEHLP64 -#define IMAGEHLP_DEFERRED_SYMBOL_LOAD IMAGEHLP_DEFERRED_SYMBOL_LOAD64 -#define PIMAGEHLP_DEFERRED_SYMBOL_LOAD PIMAGEHLP_DEFERRED_SYMBOL_LOAD64 -#else - typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD { - DWORD SizeOfStruct; - DWORD BaseOfImage; - DWORD CheckSum; - DWORD TimeDateStamp; - CHAR FileName[MAX_PATH]; - BOOLEAN Reparse; - HANDLE hFile; - } IMAGEHLP_DEFERRED_SYMBOL_LOAD,*PIMAGEHLP_DEFERRED_SYMBOL_LOAD; -#endif - - typedef struct _IMAGEHLP_DUPLICATE_SYMBOL64 { - DWORD SizeOfStruct; - DWORD NumberOfDups; - PIMAGEHLP_SYMBOL64 Symbol; - DWORD SelectedSymbol; - } IMAGEHLP_DUPLICATE_SYMBOL64,*PIMAGEHLP_DUPLICATE_SYMBOL64; - -#ifdef _IMAGEHLP64 -#define IMAGEHLP_DUPLICATE_SYMBOL IMAGEHLP_DUPLICATE_SYMBOL64 -#define PIMAGEHLP_DUPLICATE_SYMBOL PIMAGEHLP_DUPLICATE_SYMBOL64 -#else - typedef struct _IMAGEHLP_DUPLICATE_SYMBOL { - DWORD SizeOfStruct; - DWORD NumberOfDups; - PIMAGEHLP_SYMBOL Symbol; - DWORD SelectedSymbol; - } IMAGEHLP_DUPLICATE_SYMBOL,*PIMAGEHLP_DUPLICATE_SYMBOL; -#endif - - BOOL IMAGEAPI SymSetParentWindow(HWND hwnd); - PCHAR IMAGEAPI SymSetHomeDirectory(PCSTR dir); - PCHAR IMAGEAPI SymGetHomeDirectory(DWORD type,PSTR dir,size_t size); - - enum { - hdBase = 0,hdSym,hdSrc,hdMax - }; - -#define SYMOPT_CASE_INSENSITIVE 0x00000001 -#define SYMOPT_UNDNAME 0x00000002 -#define SYMOPT_DEFERRED_LOADS 0x00000004 -#define SYMOPT_NO_CPP 0x00000008 -#define SYMOPT_LOAD_LINES 0x00000010 -#define SYMOPT_OMAP_FIND_NEAREST 0x00000020 -#define SYMOPT_LOAD_ANYTHING 0x00000040 -#define SYMOPT_IGNORE_CVREC 0x00000080 -#define SYMOPT_NO_UNQUALIFIED_LOADS 0x00000100 -#define SYMOPT_FAIL_CRITICAL_ERRORS 0x00000200 -#define SYMOPT_EXACT_SYMBOLS 0x00000400 -#define SYMOPT_ALLOW_ABSOLUTE_SYMBOLS 0x00000800 -#define SYMOPT_IGNORE_NT_SYMPATH 0x00001000 -#define SYMOPT_INCLUDE_32BIT_MODULES 0x00002000 -#define SYMOPT_PUBLICS_ONLY 0x00004000 -#define SYMOPT_NO_PUBLICS 0x00008000 -#define SYMOPT_AUTO_PUBLICS 0x00010000 -#define SYMOPT_NO_IMAGE_SEARCH 0x00020000 -#define SYMOPT_SECURE 0x00040000 -#define SYMOPT_NO_PROMPTS 0x00080000 - -#define SYMOPT_DEBUG 0x80000000 - - DWORD IMAGEAPI SymSetOptions(DWORD SymOptions); - DWORD IMAGEAPI SymGetOptions(VOID); - BOOL IMAGEAPI SymCleanup(HANDLE hProcess); - BOOL IMAGEAPI SymMatchString(LPSTR string,LPSTR expression,BOOL fCase); - - typedef BOOL (CALLBACK *PSYM_ENUMSOURCFILES_CALLBACK)(PSOURCEFILE pSourceFile,PVOID UserContext); - - BOOL IMAGEAPI SymEnumSourceFiles(HANDLE hProcess,ULONG64 ModBase,LPSTR Mask,PSYM_ENUMSOURCFILES_CALLBACK cbSrcFiles,PVOID UserContext); - BOOL IMAGEAPI SymEnumerateModules64(HANDLE hProcess,PSYM_ENUMMODULES_CALLBACK64 EnumModulesCallback,PVOID UserContext); - -#ifdef _IMAGEHLP64 -#define SymEnumerateModules SymEnumerateModules64 -#else - BOOL IMAGEAPI SymEnumerateModules(HANDLE hProcess,PSYM_ENUMMODULES_CALLBACK EnumModulesCallback,PVOID UserContext); -#endif - - BOOL IMAGEAPI SymEnumerateSymbols64(HANDLE hProcess,DWORD64 BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACK64 EnumSymbolsCallback,PVOID UserContext); - BOOL IMAGEAPI SymEnumerateSymbolsW64(HANDLE hProcess,DWORD64 BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACK64W EnumSymbolsCallback,PVOID UserContext); - -#ifdef _IMAGEHLP64 -#define SymEnumerateSymbols SymEnumerateSymbols64 -#define SymEnumerateSymbolsW SymEnumerateSymbolsW64 -#else - BOOL IMAGEAPI SymEnumerateSymbols(HANDLE hProcess,DWORD BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); - BOOL IMAGEAPI SymEnumerateSymbolsW(HANDLE hProcess,DWORD BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACKW EnumSymbolsCallback,PVOID UserContext); -#endif - - BOOL IMAGEAPI EnumerateLoadedModules64(HANDLE hProcess,PENUMLOADED_MODULES_CALLBACK64 EnumLoadedModulesCallback,PVOID UserContext); -#ifdef _IMAGEHLP64 -#define EnumerateLoadedModules EnumerateLoadedModules64 -#else - BOOL IMAGEAPI EnumerateLoadedModules(HANDLE hProcess,PENUMLOADED_MODULES_CALLBACK EnumLoadedModulesCallback,PVOID UserContext); -#endif - - PVOID IMAGEAPI SymFunctionTableAccess64(HANDLE hProcess,DWORD64 AddrBase); - -#ifdef _IMAGEHLP64 -#define SymFunctionTableAccess SymFunctionTableAccess64 -#else - PVOID IMAGEAPI SymFunctionTableAccess(HANDLE hProcess,DWORD AddrBase); -#endif - - BOOL IMAGEAPI SymGetModuleInfo64(HANDLE hProcess,DWORD64 qwAddr,PIMAGEHLP_MODULE64 ModuleInfo); - BOOL IMAGEAPI SymGetModuleInfoW64(HANDLE hProcess,DWORD64 qwAddr,PIMAGEHLP_MODULEW64 ModuleInfo); - -#ifdef _IMAGEHLP64 -#define SymGetModuleInfo SymGetModuleInfo64 -#define SymGetModuleInfoW SymGetModuleInfoW64 -#else - BOOL IMAGEAPI SymGetModuleInfo(HANDLE hProcess,DWORD dwAddr,PIMAGEHLP_MODULE ModuleInfo); - BOOL IMAGEAPI SymGetModuleInfoW(HANDLE hProcess,DWORD dwAddr,PIMAGEHLP_MODULEW ModuleInfo); -#endif - - DWORD64 IMAGEAPI SymGetModuleBase64(HANDLE hProcess,DWORD64 qwAddr); - -#ifdef _IMAGEHLP64 -#define SymGetModuleBase SymGetModuleBase64 -#else - DWORD IMAGEAPI SymGetModuleBase(HANDLE hProcess,DWORD dwAddr); -#endif - - BOOL IMAGEAPI SymGetSymNext64(HANDLE hProcess,PIMAGEHLP_SYMBOL64 Symbol); - -#ifdef _IMAGEHLP64 -#define SymGetSymNext SymGetSymNext64 -#else - BOOL IMAGEAPI SymGetSymNext(HANDLE hProcess,PIMAGEHLP_SYMBOL Symbol); -#endif - - BOOL IMAGEAPI SymGetSymPrev64(HANDLE hProcess,PIMAGEHLP_SYMBOL64 Symbol); - -#ifdef _IMAGEHLP64 -#define SymGetSymPrev SymGetSymPrev64 -#else - BOOL IMAGEAPI SymGetSymPrev(HANDLE hProcess,PIMAGEHLP_SYMBOL Symbol); -#endif - - typedef struct _SRCCODEINFO { - DWORD SizeOfStruct; - PVOID Key; - DWORD64 ModBase; - CHAR Obj[MAX_PATH + 1]; - CHAR FileName[MAX_PATH + 1]; - DWORD LineNumber; - DWORD64 Address; - } SRCCODEINFO,*PSRCCODEINFO; - - typedef BOOL (CALLBACK *PSYM_ENUMLINES_CALLBACK)(PSRCCODEINFO LineInfo,PVOID UserContext); - - BOOL IMAGEAPI SymEnumLines(HANDLE hProcess,ULONG64 Base,PCSTR Obj,PCSTR File,PSYM_ENUMLINES_CALLBACK EnumLinesCallback,PVOID UserContext); - BOOL IMAGEAPI SymGetLineFromAddr64(HANDLE hProcess,DWORD64 qwAddr,PDWORD pdwDisplacement,PIMAGEHLP_LINE64 Line64); - -#ifdef _IMAGEHLP64 -#define SymGetLineFromAddr SymGetLineFromAddr64 -#else - BOOL IMAGEAPI SymGetLineFromAddr(HANDLE hProcess,DWORD dwAddr,PDWORD pdwDisplacement,PIMAGEHLP_LINE Line); -#endif - - BOOL IMAGEAPI SymGetLineFromName64(HANDLE hProcess,PSTR ModuleName,PSTR FileName,DWORD dwLineNumber,PLONG plDisplacement,PIMAGEHLP_LINE64 Line); - -#ifdef _IMAGEHLP64 -#define SymGetLineFromName SymGetLineFromName64 -#else - BOOL IMAGEAPI SymGetLineFromName(HANDLE hProcess,PSTR ModuleName,PSTR FileName,DWORD dwLineNumber,PLONG plDisplacement,PIMAGEHLP_LINE Line); -#endif - - BOOL IMAGEAPI SymGetLineNext64(HANDLE hProcess,PIMAGEHLP_LINE64 Line); - -#ifdef _IMAGEHLP64 -#define SymGetLineNext SymGetLineNext64 -#else - BOOL IMAGEAPI SymGetLineNext(HANDLE hProcess,PIMAGEHLP_LINE Line); -#endif - - BOOL IMAGEAPI SymGetLinePrev64(HANDLE hProcess,PIMAGEHLP_LINE64 Line); - -#ifdef _IMAGEHLP64 -#define SymGetLinePrev SymGetLinePrev64 -#else - BOOL IMAGEAPI SymGetLinePrev(HANDLE hProcess,PIMAGEHLP_LINE Line); -#endif - - BOOL IMAGEAPI SymMatchFileName(PSTR FileName,PSTR Match,PSTR *FileNameStop,PSTR *MatchStop); - BOOL IMAGEAPI SymInitialize(HANDLE hProcess,PSTR UserSearchPath,BOOL fInvadeProcess); - BOOL IMAGEAPI SymGetSearchPath(HANDLE hProcess,PSTR SearchPath,DWORD SearchPathLength); - BOOL IMAGEAPI SymSetSearchPath(HANDLE hProcess,PSTR SearchPath); - DWORD64 IMAGEAPI SymLoadModule64(HANDLE hProcess,HANDLE hFile,PSTR ImageName,PSTR ModuleName,DWORD64 BaseOfDll,DWORD SizeOfDll); - -#define SLMFLAG_VIRTUAL 0x1 - - DWORD64 IMAGEAPI SymLoadModuleEx(HANDLE hProcess,HANDLE hFile,PSTR ImageName,PSTR ModuleName,DWORD64 BaseOfDll,DWORD DllSize,PMODLOAD_DATA Data,DWORD Flags); - -#ifdef _IMAGEHLP64 -#define SymLoadModule SymLoadModule64 -#else - DWORD IMAGEAPI SymLoadModule(HANDLE hProcess,HANDLE hFile,PSTR ImageName,PSTR ModuleName,DWORD BaseOfDll,DWORD SizeOfDll); -#endif - - BOOL IMAGEAPI SymUnloadModule64(HANDLE hProcess,DWORD64 BaseOfDll); - -#ifdef _IMAGEHLP64 -#define SymUnloadModule SymUnloadModule64 -#else - BOOL IMAGEAPI SymUnloadModule(HANDLE hProcess,DWORD BaseOfDll); -#endif - - BOOL IMAGEAPI SymUnDName64(PIMAGEHLP_SYMBOL64 sym,PSTR UnDecName,DWORD UnDecNameLength); - -#ifdef _IMAGEHLP64 -#define SymUnDName SymUnDName64 -#else - BOOL IMAGEAPI SymUnDName(PIMAGEHLP_SYMBOL sym,PSTR UnDecName,DWORD UnDecNameLength); -#endif - - BOOL IMAGEAPI SymRegisterCallback64(HANDLE hProcess,PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction,ULONG64 UserContext); - - BOOL IMAGEAPI SymRegisterFunctionEntryCallback64(HANDLE hProcess,PSYMBOL_FUNCENTRY_CALLBACK64 CallbackFunction,ULONG64 UserContext); - -#ifdef _IMAGEHLP64 -#define SymRegisterCallback SymRegisterCallback64 -#define SymRegisterFunctionEntryCallback SymRegisterFunctionEntryCallback64 -#else - BOOL IMAGEAPI SymRegisterCallback(HANDLE hProcess,PSYMBOL_REGISTERED_CALLBACK CallbackFunction,PVOID UserContext); - BOOL IMAGEAPI SymRegisterFunctionEntryCallback(HANDLE hProcess,PSYMBOL_FUNCENTRY_CALLBACK CallbackFunction,PVOID UserContext); -#endif - - typedef struct _IMAGEHLP_SYMBOL_SRC { - DWORD sizeofstruct; - DWORD type; - char file[MAX_PATH]; - } IMAGEHLP_SYMBOL_SRC,*PIMAGEHLP_SYMBOL_SRC; - - typedef struct _MODULE_TYPE_INFO { - USHORT dataLength; - USHORT leaf; - BYTE data[1]; - } MODULE_TYPE_INFO,*PMODULE_TYPE_INFO; - - typedef struct _SYMBOL_INFO { - ULONG SizeOfStruct; - ULONG TypeIndex; - ULONG64 Reserved[2]; - ULONG info; - ULONG Size; - ULONG64 ModBase; - ULONG Flags; - ULONG64 Value; - ULONG64 Address; - ULONG Register; - ULONG Scope; - ULONG Tag; - ULONG NameLen; - ULONG MaxNameLen; - CHAR Name[1]; - } SYMBOL_INFO,*PSYMBOL_INFO; - - typedef struct _SYMBOL_INFO_PACKAGE { - SYMBOL_INFO si; - CHAR name[MAX_SYM_NAME + 1]; - } SYMBOL_INFO_PACKAGE,*PSYMBOL_INFO_PACKAGE; - - typedef struct _IMAGEHLP_STACK_FRAME - { - ULONG64 InstructionOffset; - ULONG64 ReturnOffset; - ULONG64 FrameOffset; - ULONG64 StackOffset; - ULONG64 BackingStoreOffset; - ULONG64 FuncTableEntry; - ULONG64 Params[4]; - ULONG64 Reserved[5]; - BOOL Virtual; - ULONG Reserved2; - } IMAGEHLP_STACK_FRAME,*PIMAGEHLP_STACK_FRAME; - - typedef VOID IMAGEHLP_CONTEXT,*PIMAGEHLP_CONTEXT; - - BOOL IMAGEAPI SymSetContext(HANDLE hProcess,PIMAGEHLP_STACK_FRAME StackFrame,PIMAGEHLP_CONTEXT Context); - BOOL IMAGEAPI SymFromAddr(HANDLE hProcess,DWORD64 Address,PDWORD64 Displacement,PSYMBOL_INFO Symbol); - BOOL IMAGEAPI SymFromToken(HANDLE hProcess,DWORD64 Base,DWORD Token,PSYMBOL_INFO Symbol); - BOOL IMAGEAPI SymFromName(HANDLE hProcess,LPSTR Name,PSYMBOL_INFO Symbol); - - typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO pSymInfo,ULONG SymbolSize,PVOID UserContext); - - BOOL IMAGEAPI SymEnumSymbols(HANDLE hProcess,ULONG64 BaseOfDll,PCSTR Mask,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); - BOOL IMAGEAPI SymEnumSymbolsForAddr(HANDLE hProcess,DWORD64 Address,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); - -#define SYMENUMFLAG_FULLSRCH 1 -#define SYMENUMFLAG_SPEEDSRCH 2 - - typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO { - TI_GET_SYMTAG,TI_GET_SYMNAME,TI_GET_LENGTH,TI_GET_TYPE,TI_GET_TYPEID,TI_GET_BASETYPE,TI_GET_ARRAYINDEXTYPEID,TI_FINDCHILDREN, - TI_GET_DATAKIND,TI_GET_ADDRESSOFFSET,TI_GET_OFFSET,TI_GET_VALUE,TI_GET_COUNT,TI_GET_CHILDRENCOUNT,TI_GET_BITPOSITION,TI_GET_VIRTUALBASECLASS, - TI_GET_VIRTUALTABLESHAPEID,TI_GET_VIRTUALBASEPOINTEROFFSET,TI_GET_CLASSPARENTID,TI_GET_NESTED,TI_GET_SYMINDEX,TI_GET_LEXICALPARENT, - TI_GET_ADDRESS,TI_GET_THISADJUST,TI_GET_UDTKIND,TI_IS_EQUIV_TO,TI_GET_CALLING_CONVENTION - } IMAGEHLP_SYMBOL_TYPE_INFO; - - typedef struct _TI_FINDCHILDREN_PARAMS { - ULONG Count; - ULONG Start; - ULONG ChildId[1]; - } TI_FINDCHILDREN_PARAMS; - - BOOL IMAGEAPI SymGetTypeInfo(HANDLE hProcess,DWORD64 ModBase,ULONG TypeId,IMAGEHLP_SYMBOL_TYPE_INFO GetType,PVOID pInfo); - BOOL IMAGEAPI SymEnumTypes(HANDLE hProcess,ULONG64 BaseOfDll,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); - BOOL IMAGEAPI SymGetTypeFromName(HANDLE hProcess,ULONG64 BaseOfDll,LPSTR Name,PSYMBOL_INFO Symbol); - BOOL IMAGEAPI SymAddSymbol(HANDLE hProcess,ULONG64 BaseOfDll,PCSTR Name,DWORD64 Address,DWORD Size,DWORD Flags); - BOOL IMAGEAPI SymDeleteSymbol(HANDLE hProcess,ULONG64 BaseOfDll,PCSTR Name,DWORD64 Address,DWORD Flags); - - typedef BOOL (WINAPI *PDBGHELP_CREATE_USER_DUMP_CALLBACK)(DWORD DataType,PVOID *Data,LPDWORD DataLength,PVOID UserData); - - BOOL WINAPI DbgHelpCreateUserDump(LPSTR FileName,PDBGHELP_CREATE_USER_DUMP_CALLBACK Callback,PVOID UserData); - BOOL WINAPI DbgHelpCreateUserDumpW(LPWSTR FileName,PDBGHELP_CREATE_USER_DUMP_CALLBACK Callback,PVOID UserData); - BOOL IMAGEAPI SymGetSymFromAddr64(HANDLE hProcess,DWORD64 qwAddr,PDWORD64 pdwDisplacement,PIMAGEHLP_SYMBOL64 Symbol); - -#ifdef _IMAGEHLP64 -#define SymGetSymFromAddr SymGetSymFromAddr64 -#else - BOOL IMAGEAPI SymGetSymFromAddr(HANDLE hProcess,DWORD dwAddr,PDWORD pdwDisplacement,PIMAGEHLP_SYMBOL Symbol); -#endif - - BOOL IMAGEAPI SymGetSymFromName64(HANDLE hProcess,PSTR Name,PIMAGEHLP_SYMBOL64 Symbol); - -#ifdef _IMAGEHLP64 -#define SymGetSymFromName SymGetSymFromName64 -#else - BOOL IMAGEAPI SymGetSymFromName(HANDLE hProcess,PSTR Name,PIMAGEHLP_SYMBOL Symbol); -#endif - - DBHLP_DEPRECIATED BOOL IMAGEAPI FindFileInPath(HANDLE hprocess,LPSTR SearchPath,LPSTR FileName,PVOID id,DWORD two,DWORD three,DWORD flags,LPSTR FilePath); - DBHLP_DEPRECIATED BOOL IMAGEAPI FindFileInSearchPath(HANDLE hprocess,LPSTR SearchPath,LPSTR FileName,DWORD one,DWORD two,DWORD three,LPSTR FilePath); - DBHLP_DEPRECIATED BOOL IMAGEAPI SymEnumSym(HANDLE hProcess,ULONG64 BaseOfDll,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); - -#define SYMF_OMAP_GENERATED 0x00000001 -#define SYMF_OMAP_MODIFIED 0x00000002 -#define SYMF_REGISTER 0x00000008 -#define SYMF_REGREL 0x00000010 -#define SYMF_FRAMEREL 0x00000020 -#define SYMF_PARAMETER 0x00000040 -#define SYMF_LOCAL 0x00000080 -#define SYMF_CONSTANT 0x00000100 -#define SYMF_EXPORT 0x00000200 -#define SYMF_FORWARDER 0x00000400 -#define SYMF_FUNCTION 0x00000800 -#define SYMF_VIRTUAL 0x00001000 -#define SYMF_THUNK 0x00002000 -#define SYMF_TLSREL 0x00004000 - -#define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT 1 -#define IMAGEHLP_SYMBOL_INFO_REGISTER SYMF_REGISTER -#define IMAGEHLP_SYMBOL_INFO_REGRELATIVE SYMF_REGREL -#define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE SYMF_FRAMEREL -#define IMAGEHLP_SYMBOL_INFO_PARAMETER SYMF_PARAMETER -#define IMAGEHLP_SYMBOL_INFO_LOCAL SYMF_LOCAL -#define IMAGEHLP_SYMBOL_INFO_CONSTANT SYMF_CONSTANT -#define IMAGEHLP_SYMBOL_FUNCTION SYMF_FUNCTION -#define IMAGEHLP_SYMBOL_VIRTUAL SYMF_VIRTUAL -#define IMAGEHLP_SYMBOL_THUNK SYMF_THUNK -#define IMAGEHLP_SYMBOL_INFO_TLSRELATIVE SYMF_TLSREL - -#include - -#define MINIDUMP_SIGNATURE ('PMDM') -#define MINIDUMP_VERSION (42899) - typedef DWORD RVA; - typedef ULONG64 RVA64; - - typedef struct _MINIDUMP_LOCATION_DESCRIPTOR { - ULONG32 DataSize; - RVA Rva; - } MINIDUMP_LOCATION_DESCRIPTOR; - - typedef struct _MINIDUMP_LOCATION_DESCRIPTOR64 { - ULONG64 DataSize; - RVA64 Rva; - } MINIDUMP_LOCATION_DESCRIPTOR64; - - typedef struct _MINIDUMP_MEMORY_DESCRIPTOR { - ULONG64 StartOfMemoryRange; - MINIDUMP_LOCATION_DESCRIPTOR Memory; - } MINIDUMP_MEMORY_DESCRIPTOR,*PMINIDUMP_MEMORY_DESCRIPTOR; - - typedef struct _MINIDUMP_MEMORY_DESCRIPTOR64 { - ULONG64 StartOfMemoryRange; - ULONG64 DataSize; - } MINIDUMP_MEMORY_DESCRIPTOR64,*PMINIDUMP_MEMORY_DESCRIPTOR64; - - typedef struct _MINIDUMP_HEADER { - ULONG32 Signature; - ULONG32 Version; - ULONG32 NumberOfStreams; - RVA StreamDirectoryRva; - ULONG32 CheckSum; - union { - ULONG32 Reserved; - ULONG32 TimeDateStamp; - } DUMMYUNIONNAME; - ULONG64 Flags; - } MINIDUMP_HEADER,*PMINIDUMP_HEADER; - - typedef struct _MINIDUMP_DIRECTORY { - ULONG32 StreamType; - MINIDUMP_LOCATION_DESCRIPTOR Location; - } MINIDUMP_DIRECTORY,*PMINIDUMP_DIRECTORY; - - typedef struct _MINIDUMP_STRING { - ULONG32 Length; - WCHAR Buffer [0]; - } MINIDUMP_STRING,*PMINIDUMP_STRING; - - typedef enum _MINIDUMP_STREAM_TYPE { - UnusedStream = 0,ReservedStream0 = 1,ReservedStream1 = 2,ThreadListStream = 3,ModuleListStream = 4,MemoryListStream = 5, - ExceptionStream = 6,SystemInfoStream = 7,ThreadExListStream = 8,Memory64ListStream = 9,CommentStreamA = 10,CommentStreamW = 11, - HandleDataStream = 12,FunctionTableStream = 13,UnloadedModuleListStream = 14,MiscInfoStream = 15,LastReservedStream = 0xffff - } MINIDUMP_STREAM_TYPE; - - typedef union _CPU_INFORMATION { - struct { - ULONG32 VendorId [3 ]; - ULONG32 VersionInformation; - ULONG32 FeatureInformation; - ULONG32 AMDExtendedCpuFeatures; - } X86CpuInfo; - struct { - ULONG64 ProcessorFeatures [2 ]; - } OtherCpuInfo; - } CPU_INFORMATION,*PCPU_INFORMATION; - - typedef struct _MINIDUMP_SYSTEM_INFO { - USHORT ProcessorArchitecture; - USHORT ProcessorLevel; - USHORT ProcessorRevision; - union { - USHORT Reserved0; - struct { - UCHAR NumberOfProcessors; - UCHAR ProductType; - } DUMMYSTRUCTNAME; - } DUMMYUNIONNAME; - ULONG32 MajorVersion; - ULONG32 MinorVersion; - ULONG32 BuildNumber; - ULONG32 PlatformId; - RVA CSDVersionRva; - union { - ULONG32 Reserved1; - struct { - USHORT SuiteMask; - USHORT Reserved2; - } DUMMYSTRUCTNAME; - } DUMMYUNIONNAME1; - CPU_INFORMATION Cpu; - } MINIDUMP_SYSTEM_INFO,*PMINIDUMP_SYSTEM_INFO; - - C_ASSERT (sizeof (((PPROCESS_INFORMATION)0)->dwThreadId)==4); - - typedef struct _MINIDUMP_THREAD { - ULONG32 ThreadId; - ULONG32 SuspendCount; - ULONG32 PriorityClass; - ULONG32 Priority; - ULONG64 Teb; - MINIDUMP_MEMORY_DESCRIPTOR Stack; - MINIDUMP_LOCATION_DESCRIPTOR ThreadContext; - } MINIDUMP_THREAD,*PMINIDUMP_THREAD; - - typedef struct _MINIDUMP_THREAD_LIST { - ULONG32 NumberOfThreads; - MINIDUMP_THREAD Threads [0]; - } MINIDUMP_THREAD_LIST,*PMINIDUMP_THREAD_LIST; - - typedef struct _MINIDUMP_THREAD_EX { - ULONG32 ThreadId; - ULONG32 SuspendCount; - ULONG32 PriorityClass; - ULONG32 Priority; - ULONG64 Teb; - MINIDUMP_MEMORY_DESCRIPTOR Stack; - MINIDUMP_LOCATION_DESCRIPTOR ThreadContext; - MINIDUMP_MEMORY_DESCRIPTOR BackingStore; - } MINIDUMP_THREAD_EX,*PMINIDUMP_THREAD_EX; - - typedef struct _MINIDUMP_THREAD_EX_LIST { - ULONG32 NumberOfThreads; - MINIDUMP_THREAD_EX Threads [0]; - } MINIDUMP_THREAD_EX_LIST,*PMINIDUMP_THREAD_EX_LIST; - - typedef struct _MINIDUMP_EXCEPTION { - ULONG32 ExceptionCode; - ULONG32 ExceptionFlags; - ULONG64 ExceptionRecord; - ULONG64 ExceptionAddress; - ULONG32 NumberParameters; - ULONG32 __unusedAlignment; - ULONG64 ExceptionInformation [EXCEPTION_MAXIMUM_PARAMETERS ]; - } MINIDUMP_EXCEPTION,*PMINIDUMP_EXCEPTION; - - typedef struct MINIDUMP_EXCEPTION_STREAM { - ULONG32 ThreadId; - ULONG32 __alignment; - MINIDUMP_EXCEPTION ExceptionRecord; - MINIDUMP_LOCATION_DESCRIPTOR ThreadContext; - } MINIDUMP_EXCEPTION_STREAM,*PMINIDUMP_EXCEPTION_STREAM; - - typedef struct _MINIDUMP_MODULE { - ULONG64 BaseOfImage; - ULONG32 SizeOfImage; - ULONG32 CheckSum; - ULONG32 TimeDateStamp; - RVA ModuleNameRva; - VS_FIXEDFILEINFO VersionInfo; - MINIDUMP_LOCATION_DESCRIPTOR CvRecord; - MINIDUMP_LOCATION_DESCRIPTOR MiscRecord; - ULONG64 Reserved0; - ULONG64 Reserved1; - } MINIDUMP_MODULE,*PMINIDUMP_MODULE; - - typedef struct _MINIDUMP_MODULE_LIST { - ULONG32 NumberOfModules; - MINIDUMP_MODULE Modules [0 ]; - } MINIDUMP_MODULE_LIST,*PMINIDUMP_MODULE_LIST; - - typedef struct _MINIDUMP_MEMORY_LIST { - ULONG32 NumberOfMemoryRanges; - MINIDUMP_MEMORY_DESCRIPTOR MemoryRanges [0]; - } MINIDUMP_MEMORY_LIST,*PMINIDUMP_MEMORY_LIST; - - typedef struct _MINIDUMP_MEMORY64_LIST { - ULONG64 NumberOfMemoryRanges; - RVA64 BaseRva; - MINIDUMP_MEMORY_DESCRIPTOR64 MemoryRanges [0]; - } MINIDUMP_MEMORY64_LIST,*PMINIDUMP_MEMORY64_LIST; - - typedef struct _MINIDUMP_EXCEPTION_INFORMATION { - DWORD ThreadId; - PEXCEPTION_POINTERS ExceptionPointers; - BOOL ClientPointers; - } MINIDUMP_EXCEPTION_INFORMATION,*PMINIDUMP_EXCEPTION_INFORMATION; - - typedef struct _MINIDUMP_EXCEPTION_INFORMATION64 { - DWORD ThreadId; - ULONG64 ExceptionRecord; - ULONG64 ContextRecord; - BOOL ClientPointers; - } MINIDUMP_EXCEPTION_INFORMATION64,*PMINIDUMP_EXCEPTION_INFORMATION64; - - typedef struct _MINIDUMP_HANDLE_DESCRIPTOR { - ULONG64 Handle; - RVA TypeNameRva; - RVA ObjectNameRva; - ULONG32 Attributes; - ULONG32 GrantedAccess; - ULONG32 HandleCount; - ULONG32 PointerCount; - } MINIDUMP_HANDLE_DESCRIPTOR,*PMINIDUMP_HANDLE_DESCRIPTOR; - - typedef struct _MINIDUMP_HANDLE_DATA_STREAM { - ULONG32 SizeOfHeader; - ULONG32 SizeOfDescriptor; - ULONG32 NumberOfDescriptors; - ULONG32 Reserved; - } MINIDUMP_HANDLE_DATA_STREAM,*PMINIDUMP_HANDLE_DATA_STREAM; - - typedef struct _MINIDUMP_FUNCTION_TABLE_DESCRIPTOR { - ULONG64 MinimumAddress; - ULONG64 MaximumAddress; - ULONG64 BaseAddress; - ULONG32 EntryCount; - ULONG32 SizeOfAlignPad; - } MINIDUMP_FUNCTION_TABLE_DESCRIPTOR,*PMINIDUMP_FUNCTION_TABLE_DESCRIPTOR; - - typedef struct _MINIDUMP_FUNCTION_TABLE_STREAM { - ULONG32 SizeOfHeader; - ULONG32 SizeOfDescriptor; - ULONG32 SizeOfNativeDescriptor; - ULONG32 SizeOfFunctionEntry; - ULONG32 NumberOfDescriptors; - ULONG32 SizeOfAlignPad; - } MINIDUMP_FUNCTION_TABLE_STREAM,*PMINIDUMP_FUNCTION_TABLE_STREAM; - - typedef struct _MINIDUMP_UNLOADED_MODULE { - ULONG64 BaseOfImage; - ULONG32 SizeOfImage; - ULONG32 CheckSum; - ULONG32 TimeDateStamp; - RVA ModuleNameRva; - } MINIDUMP_UNLOADED_MODULE,*PMINIDUMP_UNLOADED_MODULE; - - typedef struct _MINIDUMP_UNLOADED_MODULE_LIST { - ULONG32 SizeOfHeader; - ULONG32 SizeOfEntry; - ULONG32 NumberOfEntries; - } MINIDUMP_UNLOADED_MODULE_LIST,*PMINIDUMP_UNLOADED_MODULE_LIST; - -#define MINIDUMP_MISC1_PROCESS_ID 0x00000001 -#define MINIDUMP_MISC1_PROCESS_TIMES 0x00000002 - - typedef struct _MINIDUMP_MISC_INFO { - ULONG32 SizeOfInfo; - ULONG32 Flags1; - ULONG32 ProcessId; - ULONG32 ProcessCreateTime; - ULONG32 ProcessUserTime; - ULONG32 ProcessKernelTime; - } MINIDUMP_MISC_INFO,*PMINIDUMP_MISC_INFO; - - typedef struct _MINIDUMP_USER_RECORD { - ULONG32 Type; - MINIDUMP_LOCATION_DESCRIPTOR Memory; - } MINIDUMP_USER_RECORD,*PMINIDUMP_USER_RECORD; - - typedef struct _MINIDUMP_USER_STREAM { - ULONG32 Type; - ULONG BufferSize; - PVOID Buffer; - } MINIDUMP_USER_STREAM,*PMINIDUMP_USER_STREAM; - - typedef struct _MINIDUMP_USER_STREAM_INFORMATION { - ULONG UserStreamCount; - PMINIDUMP_USER_STREAM UserStreamArray; - } MINIDUMP_USER_STREAM_INFORMATION,*PMINIDUMP_USER_STREAM_INFORMATION; - - typedef enum _MINIDUMP_CALLBACK_TYPE { - ModuleCallback,ThreadCallback,ThreadExCallback,IncludeThreadCallback,IncludeModuleCallback,MemoryCallback - } MINIDUMP_CALLBACK_TYPE; - - typedef struct _MINIDUMP_THREAD_CALLBACK { - ULONG ThreadId; - HANDLE ThreadHandle; - CONTEXT Context; - ULONG SizeOfContext; - ULONG64 StackBase; - ULONG64 StackEnd; - } MINIDUMP_THREAD_CALLBACK,*PMINIDUMP_THREAD_CALLBACK; - - typedef struct _MINIDUMP_THREAD_EX_CALLBACK { - ULONG ThreadId; - HANDLE ThreadHandle; - CONTEXT Context; - ULONG SizeOfContext; - ULONG64 StackBase; - ULONG64 StackEnd; - ULONG64 BackingStoreBase; - ULONG64 BackingStoreEnd; - } MINIDUMP_THREAD_EX_CALLBACK,*PMINIDUMP_THREAD_EX_CALLBACK; - - typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK { - ULONG ThreadId; - } MINIDUMP_INCLUDE_THREAD_CALLBACK,*PMINIDUMP_INCLUDE_THREAD_CALLBACK; - - typedef enum _THREAD_WRITE_FLAGS { - ThreadWriteThread = 0x0001,ThreadWriteStack = 0x0002,ThreadWriteContext = 0x0004,ThreadWriteBackingStore = 0x0008, - ThreadWriteInstructionWindow = 0x0010,ThreadWriteThreadData = 0x0020 - } THREAD_WRITE_FLAGS; - - typedef struct _MINIDUMP_MODULE_CALLBACK { - PWCHAR FullPath; - ULONG64 BaseOfImage; - ULONG SizeOfImage; - ULONG CheckSum; - ULONG TimeDateStamp; - VS_FIXEDFILEINFO VersionInfo; - PVOID CvRecord; - ULONG SizeOfCvRecord; - PVOID MiscRecord; - ULONG SizeOfMiscRecord; - } MINIDUMP_MODULE_CALLBACK,*PMINIDUMP_MODULE_CALLBACK; - - typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK { - ULONG64 BaseOfImage; - } MINIDUMP_INCLUDE_MODULE_CALLBACK,*PMINIDUMP_INCLUDE_MODULE_CALLBACK; - - typedef enum _MODULE_WRITE_FLAGS { - ModuleWriteModule = 0x0001,ModuleWriteDataSeg = 0x0002,ModuleWriteMiscRecord = 0x0004,ModuleWriteCvRecord = 0x0008, - ModuleReferencedByMemory = 0x0010 - } MODULE_WRITE_FLAGS; - - typedef struct _MINIDUMP_CALLBACK_INPUT { - ULONG ProcessId; - HANDLE ProcessHandle; - ULONG CallbackType; - union { - MINIDUMP_THREAD_CALLBACK Thread; - MINIDUMP_THREAD_EX_CALLBACK ThreadEx; - MINIDUMP_MODULE_CALLBACK Module; - MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread; - MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule; - } DUMMYUNIONNAME; - } MINIDUMP_CALLBACK_INPUT,*PMINIDUMP_CALLBACK_INPUT; - - typedef struct _MINIDUMP_CALLBACK_OUTPUT { - union { - ULONG ModuleWriteFlags; - ULONG ThreadWriteFlags; - struct { - ULONG64 MemoryBase; - ULONG MemorySize; - } DUMMYSTRUCTNAME; - } DUMMYUNIONNAME; - } MINIDUMP_CALLBACK_OUTPUT,*PMINIDUMP_CALLBACK_OUTPUT; - - typedef enum _MINIDUMP_TYPE { - MiniDumpNormal = 0x0000,MiniDumpWithDataSegs = 0x0001,MiniDumpWithFullMemory = 0x0002,MiniDumpWithHandleData = 0x0004, - MiniDumpFilterMemory = 0x0008,MiniDumpScanMemory = 0x0010,MiniDumpWithUnloadedModules = 0x0020,MiniDumpWithIndirectlyReferencedMemory = 0x0040, - MiniDumpFilterModulePaths = 0x0080,MiniDumpWithProcessThreadData = 0x0100,MiniDumpWithPrivateReadWriteMemory = 0x0200, - MiniDumpWithoutOptionalData = 0x0400 - } MINIDUMP_TYPE; - - typedef BOOL (WINAPI *MINIDUMP_CALLBACK_ROUTINE)(PVOID CallbackParam,CONST PMINIDUMP_CALLBACK_INPUT CallbackInput,PMINIDUMP_CALLBACK_OUTPUT CallbackOutput); - - typedef struct _MINIDUMP_CALLBACK_INFORMATION { - MINIDUMP_CALLBACK_ROUTINE CallbackRoutine; - PVOID CallbackParam; - } MINIDUMP_CALLBACK_INFORMATION,*PMINIDUMP_CALLBACK_INFORMATION; - -#define RVA_TO_ADDR(Mapping,Rva) ((PVOID)(((ULONG_PTR) (Mapping)) + (Rva))) - - BOOL WINAPI MiniDumpWriteDump(HANDLE hProcess,DWORD ProcessId,HANDLE hFile,MINIDUMP_TYPE DumpType,CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam); - BOOL WINAPI MiniDumpReadDumpStream(PVOID BaseOfDump,ULONG StreamNumber,PMINIDUMP_DIRECTORY *Dir,PVOID *StreamPointer,ULONG *StreamSize); - -#include - -#ifdef __cplusplus -} -#endif -#endif +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#ifndef _DBGHELP_ +#define _DBGHELP_ + +#ifdef _WIN64 +#ifndef _IMAGEHLP64 +#define _IMAGEHLP64 +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define IMAGEAPI DECLSPEC_IMPORT WINAPI +#define DBHLP_DEPRECIATED __declspec(deprecated) + +#define DBHLPAPI IMAGEAPI + +#define IMAGE_SEPARATION (64*1024) + + typedef struct _LOADED_IMAGE { + PSTR ModuleName; + HANDLE hFile; + PUCHAR MappedAddress; +#ifdef _IMAGEHLP64 + PIMAGE_NT_HEADERS64 FileHeader; +#else + PIMAGE_NT_HEADERS32 FileHeader; +#endif + PIMAGE_SECTION_HEADER LastRvaSection; + ULONG NumberOfSections; + PIMAGE_SECTION_HEADER Sections; + ULONG Characteristics; + BOOLEAN fSystemImage; + BOOLEAN fDOSImage; + LIST_ENTRY Links; + ULONG SizeOfImage; + } LOADED_IMAGE,*PLOADED_IMAGE; + +#define MAX_SYM_NAME 2000 + + typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE FileHandle,PSTR FileName,PVOID CallerData); + typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PSTR filename,PVOID context); + typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACK)(HANDLE FileHandle,PSTR FileName,PVOID CallerData); + + typedef BOOL (WINAPI *PSYMBOLSERVERPROC)(LPCSTR,LPCSTR,PVOID,DWORD,DWORD,LPSTR); + typedef BOOL (WINAPI *PSYMBOLSERVEROPENPROC)(VOID); + typedef BOOL (WINAPI *PSYMBOLSERVERCLOSEPROC)(VOID); + typedef BOOL (WINAPI *PSYMBOLSERVERSETOPTIONSPROC)(UINT_PTR,ULONG64); + typedef BOOL (CALLBACK WINAPI *PSYMBOLSERVERCALLBACKPROC)(UINT_PTR action,ULONG64 data,ULONG64 context); + typedef UINT_PTR (WINAPI *PSYMBOLSERVERGETOPTIONSPROC)(); + typedef BOOL (WINAPI *PSYMBOLSERVERPINGPROC)(LPCSTR); + + HANDLE IMAGEAPI FindDebugInfoFile(PSTR FileName,PSTR SymbolPath,PSTR DebugFilePath); + HANDLE IMAGEAPI FindDebugInfoFileEx(PSTR FileName,PSTR SymbolPath,PSTR DebugFilePath,PFIND_DEBUG_FILE_CALLBACK Callback,PVOID CallerData); + BOOL IMAGEAPI SymFindFileInPath(HANDLE hprocess,LPSTR SearchPath,LPSTR FileName,PVOID id,DWORD two,DWORD three,DWORD flags,LPSTR FoundFile,PFINDFILEINPATHCALLBACK callback,PVOID context); + HANDLE IMAGEAPI FindExecutableImage(PSTR FileName,PSTR SymbolPath,PSTR ImageFilePath); + HANDLE IMAGEAPI FindExecutableImageEx(PSTR FileName,PSTR SymbolPath,PSTR ImageFilePath,PFIND_EXE_FILE_CALLBACK Callback,PVOID CallerData); + PIMAGE_NT_HEADERS IMAGEAPI ImageNtHeader(PVOID Base); + PVOID IMAGEAPI ImageDirectoryEntryToDataEx(PVOID Base,BOOLEAN MappedAsImage,USHORT DirectoryEntry,PULONG Size,PIMAGE_SECTION_HEADER *FoundHeader); + PVOID IMAGEAPI ImageDirectoryEntryToData(PVOID Base,BOOLEAN MappedAsImage,USHORT DirectoryEntry,PULONG Size); + PIMAGE_SECTION_HEADER IMAGEAPI ImageRvaToSection(PIMAGE_NT_HEADERS NtHeaders,PVOID Base,ULONG Rva); + PVOID IMAGEAPI ImageRvaToVa(PIMAGE_NT_HEADERS NtHeaders,PVOID Base,ULONG Rva,PIMAGE_SECTION_HEADER *LastRvaSection); + +#define SSRVOPT_CALLBACK 0x0001 +#define SSRVOPT_DWORD 0x0002 +#define SSRVOPT_DWORDPTR 0x0004 +#define SSRVOPT_GUIDPTR 0x0008 +#define SSRVOPT_OLDGUIDPTR 0x0010 +#define SSRVOPT_UNATTENDED 0x0020 +#define SSRVOPT_NOCOPY 0x0040 +#define SSRVOPT_PARENTWIN 0x0080 +#define SSRVOPT_PARAMTYPE 0x0100 +#define SSRVOPT_SECURE 0x0200 +#define SSRVOPT_TRACE 0x0400 +#define SSRVOPT_SETCONTEXT 0x0800 +#define SSRVOPT_PROXY 0x1000 +#define SSRVOPT_DOWNSTREAM_STORE 0x2000 +#define SSRVOPT_RESET ((ULONG_PTR)-1) + +#define SSRVACTION_TRACE 1 +#define SSRVACTION_QUERYCANCEL 2 +#define SSRVACTION_EVENT 3 + +#ifndef _WIN64 + + typedef struct _IMAGE_DEBUG_INFORMATION { + LIST_ENTRY List; + DWORD ReservedSize; + PVOID ReservedMappedBase; + USHORT ReservedMachine; + USHORT ReservedCharacteristics; + DWORD ReservedCheckSum; + DWORD ImageBase; + DWORD SizeOfImage; + DWORD ReservedNumberOfSections; + PIMAGE_SECTION_HEADER ReservedSections; + DWORD ReservedExportedNamesSize; + PSTR ReservedExportedNames; + DWORD ReservedNumberOfFunctionTableEntries; + PIMAGE_FUNCTION_ENTRY ReservedFunctionTableEntries; + DWORD ReservedLowestFunctionStartingAddress; + DWORD ReservedHighestFunctionEndingAddress; + DWORD ReservedNumberOfFpoTableEntries; + PFPO_DATA ReservedFpoTableEntries; + DWORD SizeOfCoffSymbols; + PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols; + DWORD ReservedSizeOfCodeViewSymbols; + PVOID ReservedCodeViewSymbols; + PSTR ImageFilePath; + PSTR ImageFileName; + PSTR ReservedDebugFilePath; + DWORD ReservedTimeDateStamp; + BOOL ReservedRomImage; + PIMAGE_DEBUG_DIRECTORY ReservedDebugDirectory; + DWORD ReservedNumberOfDebugDirectories; + DWORD ReservedOriginalFunctionTableBaseAddress; + DWORD Reserved[2 ]; + } IMAGE_DEBUG_INFORMATION,*PIMAGE_DEBUG_INFORMATION; + + PIMAGE_DEBUG_INFORMATION IMAGEAPI MapDebugInformation(HANDLE FileHandle,PSTR FileName,PSTR SymbolPath,DWORD ImageBase); + BOOL IMAGEAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION DebugInfo); +#endif + + typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACK)(LPCSTR FilePath,PVOID CallerData); + + BOOL IMAGEAPI SearchTreeForFile(PSTR RootPath,PSTR InputPathName,PSTR OutputPathBuffer); + BOOL IMAGEAPI EnumDirTree(HANDLE hProcess,PSTR RootPath,PSTR InputPathName,PSTR OutputPathBuffer,PENUMDIRTREE_CALLBACK Callback,PVOID CallbackData); + BOOL IMAGEAPI MakeSureDirectoryPathExists(PCSTR DirPath); + +#define UNDNAME_COMPLETE (0x0000) +#define UNDNAME_NO_LEADING_UNDERSCORES (0x0001) +#define UNDNAME_NO_MS_KEYWORDS (0x0002) +#define UNDNAME_NO_FUNCTION_RETURNS (0x0004) +#define UNDNAME_NO_ALLOCATION_MODEL (0x0008) +#define UNDNAME_NO_ALLOCATION_LANGUAGE (0x0010) +#define UNDNAME_NO_MS_THISTYPE (0x0020) +#define UNDNAME_NO_CV_THISTYPE (0x0040) +#define UNDNAME_NO_THISTYPE (0x0060) +#define UNDNAME_NO_ACCESS_SPECIFIERS (0x0080) +#define UNDNAME_NO_THROW_SIGNATURES (0x0100) +#define UNDNAME_NO_MEMBER_TYPE (0x0200) +#define UNDNAME_NO_RETURN_UDT_MODEL (0x0400) +#define UNDNAME_32_BIT_DECODE (0x0800) +#define UNDNAME_NAME_ONLY (0x1000) +#define UNDNAME_NO_ARGUMENTS (0x2000) +#define UNDNAME_NO_SPECIAL_SYMS (0x4000) + + DWORD IMAGEAPI WINAPI UnDecorateSymbolName(PCSTR DecoratedName,PSTR UnDecoratedName,DWORD UndecoratedLength,DWORD Flags); + +#define DBHHEADER_DEBUGDIRS 0x1 + + typedef struct _MODLOAD_DATA { + DWORD ssize; + DWORD ssig; + PVOID data; + DWORD size; + DWORD flags; + } MODLOAD_DATA,*PMODLOAD_DATA; + + typedef enum { + AddrMode1616,AddrMode1632,AddrModeReal,AddrModeFlat + } ADDRESS_MODE; + + typedef struct _tagADDRESS64 { + DWORD64 Offset; + WORD Segment; + ADDRESS_MODE Mode; + } ADDRESS64,*LPADDRESS64; + +#ifdef _IMAGEHLP64 +#define ADDRESS ADDRESS64 +#define LPADDRESS LPADDRESS64 +#else + typedef struct _tagADDRESS { + DWORD Offset; + WORD Segment; + ADDRESS_MODE Mode; + } ADDRESS,*LPADDRESS; + + static __inline void Address32To64(LPADDRESS a32,LPADDRESS64 a64) { + a64->Offset = (ULONG64)(LONG64)(LONG)a32->Offset; + a64->Segment = a32->Segment; + a64->Mode = a32->Mode; + } + + static __inline void Address64To32(LPADDRESS64 a64,LPADDRESS a32) { + a32->Offset = (ULONG)a64->Offset; + a32->Segment = a64->Segment; + a32->Mode = a64->Mode; + } +#endif + + typedef struct _KDHELP64 { + DWORD64 Thread; + DWORD ThCallbackStack; + DWORD ThCallbackBStore; + DWORD NextCallback; + DWORD FramePointer; + DWORD64 KiCallUserMode; + DWORD64 KeUserCallbackDispatcher; + DWORD64 SystemRangeStart; + DWORD64 Reserved[8]; + } KDHELP64,*PKDHELP64; + +#ifdef _IMAGEHLP64 +#define KDHELP KDHELP64 +#define PKDHELP PKDHELP64 +#else + typedef struct _KDHELP { + DWORD Thread; + DWORD ThCallbackStack; + DWORD NextCallback; + DWORD FramePointer; + DWORD KiCallUserMode; + DWORD KeUserCallbackDispatcher; + DWORD SystemRangeStart; + DWORD ThCallbackBStore; + DWORD Reserved[8]; + } KDHELP,*PKDHELP; + + static __inline void KdHelp32To64(PKDHELP p32,PKDHELP64 p64) { + p64->Thread = p32->Thread; + p64->ThCallbackStack = p32->ThCallbackStack; + p64->NextCallback = p32->NextCallback; + p64->FramePointer = p32->FramePointer; + p64->KiCallUserMode = p32->KiCallUserMode; + p64->KeUserCallbackDispatcher = p32->KeUserCallbackDispatcher; + p64->SystemRangeStart = p32->SystemRangeStart; + } +#endif + + typedef struct _tagSTACKFRAME64 { + ADDRESS64 AddrPC; + ADDRESS64 AddrReturn; + ADDRESS64 AddrFrame; + ADDRESS64 AddrStack; + ADDRESS64 AddrBStore; + PVOID FuncTableEntry; + DWORD64 Params[4]; + BOOL Far; + BOOL Virtual; + DWORD64 Reserved[3]; + KDHELP64 KdHelp; + } STACKFRAME64,*LPSTACKFRAME64; + +#ifdef _IMAGEHLP64 +#define STACKFRAME STACKFRAME64 +#define LPSTACKFRAME LPSTACKFRAME64 +#else + typedef struct _tagSTACKFRAME { + ADDRESS AddrPC; + ADDRESS AddrReturn; + ADDRESS AddrFrame; + ADDRESS AddrStack; + PVOID FuncTableEntry; + DWORD Params[4]; + BOOL Far; + BOOL Virtual; + DWORD Reserved[3]; + KDHELP KdHelp; + ADDRESS AddrBStore; + } STACKFRAME,*LPSTACKFRAME; +#endif + + typedef BOOL (WINAPI *PREAD_PROCESS_MEMORY_ROUTINE64)(HANDLE hProcess,DWORD64 qwBaseAddress,PVOID lpBuffer,DWORD nSize,LPDWORD lpNumberOfBytesRead); + typedef PVOID (WINAPI *PFUNCTION_TABLE_ACCESS_ROUTINE64)(HANDLE hProcess,DWORD64 AddrBase); + typedef DWORD64 (WINAPI *PGET_MODULE_BASE_ROUTINE64)(HANDLE hProcess,DWORD64 Address); + typedef DWORD64 (WINAPI *PTRANSLATE_ADDRESS_ROUTINE64)(HANDLE hProcess,HANDLE hThread,LPADDRESS64 lpaddr); + + BOOL IMAGEAPI StackWalk64(DWORD MachineType,HANDLE hProcess,HANDLE hThread,LPSTACKFRAME64 StackFrame,PVOID ContextRecord,PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine,PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine,PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine,PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress); + +#ifdef _IMAGEHLP64 +#define PREAD_PROCESS_MEMORY_ROUTINE PREAD_PROCESS_MEMORY_ROUTINE64 +#define PFUNCTION_TABLE_ACCESS_ROUTINE PFUNCTION_TABLE_ACCESS_ROUTINE64 +#define PGET_MODULE_BASE_ROUTINE PGET_MODULE_BASE_ROUTINE64 +#define PTRANSLATE_ADDRESS_ROUTINE PTRANSLATE_ADDRESS_ROUTINE64 +#define StackWalk StackWalk64 +#else + typedef BOOL (WINAPI *PREAD_PROCESS_MEMORY_ROUTINE)(HANDLE hProcess,DWORD lpBaseAddress,PVOID lpBuffer,DWORD nSize,PDWORD lpNumberOfBytesRead); + typedef PVOID (WINAPI *PFUNCTION_TABLE_ACCESS_ROUTINE)(HANDLE hProcess,DWORD AddrBase); + typedef DWORD (WINAPI *PGET_MODULE_BASE_ROUTINE)(HANDLE hProcess,DWORD Address); + typedef DWORD (WINAPI *PTRANSLATE_ADDRESS_ROUTINE)(HANDLE hProcess,HANDLE hThread,LPADDRESS lpaddr); + + BOOL IMAGEAPI StackWalk(DWORD MachineType,HANDLE hProcess,HANDLE hThread,LPSTACKFRAME StackFrame,PVOID ContextRecord,PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine,PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine,PTRANSLATE_ADDRESS_ROUTINE TranslateAddress); +#endif + +#define API_VERSION_NUMBER 9 + + typedef struct API_VERSION { + USHORT MajorVersion; + USHORT MinorVersion; + USHORT Revision; + USHORT Reserved; + } API_VERSION,*LPAPI_VERSION; + + LPAPI_VERSION IMAGEAPI ImagehlpApiVersion(VOID); + LPAPI_VERSION IMAGEAPI ImagehlpApiVersionEx(LPAPI_VERSION AppVersion); + DWORD IMAGEAPI GetTimestampForLoadedLibrary(HMODULE Module); + + typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK64)(PSTR ModuleName,DWORD64 BaseOfDll,PVOID UserContext); + typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64)(PSTR SymbolName,DWORD64 SymbolAddress,ULONG SymbolSize,PVOID UserContext); + typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64W)(PWSTR SymbolName,DWORD64 SymbolAddress,ULONG SymbolSize,PVOID UserContext); + typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK64)(PSTR ModuleName,DWORD64 ModuleBase,ULONG ModuleSize,PVOID UserContext); + typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK64)(HANDLE hProcess,ULONG ActionCode,ULONG64 CallbackData,ULONG64 UserContext); + typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK)(HANDLE hProcess,DWORD AddrBase,PVOID UserContext); + typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK64)(HANDLE hProcess,ULONG64 AddrBase,ULONG64 UserContext); + +#ifdef _IMAGEHLP64 +#define PSYM_ENUMMODULES_CALLBACK PSYM_ENUMMODULES_CALLBACK64 +#define PSYM_ENUMSYMBOLS_CALLBACK PSYM_ENUMSYMBOLS_CALLBACK64 +#define PSYM_ENUMSYMBOLS_CALLBACKW PSYM_ENUMSYMBOLS_CALLBACK64W +#define PENUMLOADED_MODULES_CALLBACK PENUMLOADED_MODULES_CALLBACK64 +#define PSYMBOL_REGISTERED_CALLBACK PSYMBOL_REGISTERED_CALLBACK64 +#define PSYMBOL_FUNCENTRY_CALLBACK PSYMBOL_FUNCENTRY_CALLBACK64 +#else + typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PSTR ModuleName,ULONG BaseOfDll,PVOID UserContext); + typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(PSTR SymbolName,ULONG SymbolAddress,ULONG SymbolSize,PVOID UserContext); + typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACKW)(PWSTR SymbolName,ULONG SymbolAddress,ULONG SymbolSize,PVOID UserContext); + typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PSTR ModuleName,ULONG ModuleBase,ULONG ModuleSize,PVOID UserContext); + typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(HANDLE hProcess,ULONG ActionCode,PVOID CallbackData,PVOID UserContext); +#endif + +#define SYMFLAG_VALUEPRESENT 0x00000001 +#define SYMFLAG_REGISTER 0x00000008 +#define SYMFLAG_REGREL 0x00000010 +#define SYMFLAG_FRAMEREL 0x00000020 +#define SYMFLAG_PARAMETER 0x00000040 +#define SYMFLAG_LOCAL 0x00000080 +#define SYMFLAG_CONSTANT 0x00000100 +#define SYMFLAG_EXPORT 0x00000200 +#define SYMFLAG_FORWARDER 0x00000400 +#define SYMFLAG_FUNCTION 0x00000800 +#define SYMFLAG_VIRTUAL 0x00001000 +#define SYMFLAG_THUNK 0x00002000 +#define SYMFLAG_TLSREL 0x00004000 + + typedef enum { + SymNone = 0,SymCoff,SymCv,SymPdb,SymExport,SymDeferred,SymSym,SymDia,SymVirtual,NumSymTypes + } SYM_TYPE; + + typedef struct _IMAGEHLP_SYMBOL64 { + DWORD SizeOfStruct; + DWORD64 Address; + DWORD Size; + DWORD Flags; + DWORD MaxNameLength; + CHAR Name[1]; + } IMAGEHLP_SYMBOL64,*PIMAGEHLP_SYMBOL64; + + typedef struct _IMAGEHLP_SYMBOL64_PACKAGE { + IMAGEHLP_SYMBOL64 sym; + CHAR name[MAX_SYM_NAME + 1]; + } IMAGEHLP_SYMBOL64_PACKAGE,*PIMAGEHLP_SYMBOL64_PACKAGE; + +#ifdef _IMAGEHLP64 + +#define IMAGEHLP_SYMBOL IMAGEHLP_SYMBOL64 +#define PIMAGEHLP_SYMBOL PIMAGEHLP_SYMBOL64 +#define IMAGEHLP_SYMBOL_PACKAGE IMAGEHLP_SYMBOL64_PACKAGE +#define PIMAGEHLP_SYMBOL_PACKAGE PIMAGEHLP_SYMBOL64_PACKAGE +#else + + typedef struct _IMAGEHLP_SYMBOL { + DWORD SizeOfStruct; + DWORD Address; + DWORD Size; + DWORD Flags; + DWORD MaxNameLength; + CHAR Name[1]; + } IMAGEHLP_SYMBOL,*PIMAGEHLP_SYMBOL; + + typedef struct _IMAGEHLP_SYMBOL_PACKAGE { + IMAGEHLP_SYMBOL sym; + CHAR name[MAX_SYM_NAME + 1]; + } IMAGEHLP_SYMBOL_PACKAGE,*PIMAGEHLP_SYMBOL_PACKAGE; +#endif + + typedef struct _IMAGEHLP_MODULE64 { + DWORD SizeOfStruct; + DWORD64 BaseOfImage; + DWORD ImageSize; + DWORD TimeDateStamp; + DWORD CheckSum; + DWORD NumSyms; + SYM_TYPE SymType; + CHAR ModuleName[32]; + CHAR ImageName[256]; + CHAR LoadedImageName[256]; + CHAR LoadedPdbName[256]; + DWORD CVSig; + CHAR CVData[MAX_PATH*3]; + DWORD PdbSig; + GUID PdbSig70; + DWORD PdbAge; + BOOL PdbUnmatched; + BOOL DbgUnmatched; + BOOL LineNumbers; + BOOL GlobalSymbols; + BOOL TypeInfo; + } IMAGEHLP_MODULE64,*PIMAGEHLP_MODULE64; + + typedef struct _IMAGEHLP_MODULE64W { + DWORD SizeOfStruct; + DWORD64 BaseOfImage; + DWORD ImageSize; + DWORD TimeDateStamp; + DWORD CheckSum; + DWORD NumSyms; + SYM_TYPE SymType; + WCHAR ModuleName[32]; + WCHAR ImageName[256]; + WCHAR LoadedImageName[256]; + WCHAR LoadedPdbName[256]; + DWORD CVSig; + WCHAR CVData[MAX_PATH*3]; + DWORD PdbSig; + GUID PdbSig70; + DWORD PdbAge; + BOOL PdbUnmatched; + BOOL DbgUnmatched; + BOOL LineNumbers; + BOOL GlobalSymbols; + BOOL TypeInfo; + } IMAGEHLP_MODULEW64,*PIMAGEHLP_MODULEW64; + +#ifdef _IMAGEHLP64 +#define IMAGEHLP_MODULE IMAGEHLP_MODULE64 +#define PIMAGEHLP_MODULE PIMAGEHLP_MODULE64 +#define IMAGEHLP_MODULEW IMAGEHLP_MODULEW64 +#define PIMAGEHLP_MODULEW PIMAGEHLP_MODULEW64 +#else + typedef struct _IMAGEHLP_MODULE { + DWORD SizeOfStruct; + DWORD BaseOfImage; + DWORD ImageSize; + DWORD TimeDateStamp; + DWORD CheckSum; + DWORD NumSyms; + SYM_TYPE SymType; + CHAR ModuleName[32]; + CHAR ImageName[256]; + CHAR LoadedImageName[256]; + } IMAGEHLP_MODULE,*PIMAGEHLP_MODULE; + + typedef struct _IMAGEHLP_MODULEW { + DWORD SizeOfStruct; + DWORD BaseOfImage; + DWORD ImageSize; + DWORD TimeDateStamp; + DWORD CheckSum; + DWORD NumSyms; + SYM_TYPE SymType; + WCHAR ModuleName[32]; + WCHAR ImageName[256]; + WCHAR LoadedImageName[256]; + } IMAGEHLP_MODULEW,*PIMAGEHLP_MODULEW; +#endif + + typedef struct _IMAGEHLP_LINE64 { + DWORD SizeOfStruct; + PVOID Key; + DWORD LineNumber; + PCHAR FileName; + DWORD64 Address; + } IMAGEHLP_LINE64,*PIMAGEHLP_LINE64; + +#ifdef _IMAGEHLP64 +#define IMAGEHLP_LINE IMAGEHLP_LINE64 +#define PIMAGEHLP_LINE PIMAGEHLP_LINE64 +#else + typedef struct _IMAGEHLP_LINE { + DWORD SizeOfStruct; + PVOID Key; + DWORD LineNumber; + PCHAR FileName; + DWORD Address; + } IMAGEHLP_LINE,*PIMAGEHLP_LINE; +#endif + + typedef struct _SOURCEFILE { + DWORD64 ModBase; + PCHAR FileName; + } SOURCEFILE,*PSOURCEFILE; + +#define CBA_DEFERRED_SYMBOL_LOAD_START 0x00000001 +#define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 0x00000002 +#define CBA_DEFERRED_SYMBOL_LOAD_FAILURE 0x00000003 +#define CBA_SYMBOLS_UNLOADED 0x00000004 +#define CBA_DUPLICATE_SYMBOL 0x00000005 +#define CBA_READ_MEMORY 0x00000006 +#define CBA_DEFERRED_SYMBOL_LOAD_CANCEL 0x00000007 +#define CBA_SET_OPTIONS 0x00000008 +#define CBA_EVENT 0x00000010 +#define CBA_DEFERRED_SYMBOL_LOAD_PARTIAL 0x00000020 +#define CBA_DEBUG_INFO 0x10000000 + + typedef struct _IMAGEHLP_CBA_READ_MEMORY { + DWORD64 addr; + PVOID buf; + DWORD bytes; + DWORD *bytesread; + } IMAGEHLP_CBA_READ_MEMORY,*PIMAGEHLP_CBA_READ_MEMORY; + + enum { + sevInfo = 0,sevProblem,sevAttn,sevFatal,sevMax + }; + + typedef struct _IMAGEHLP_CBA_EVENT { + DWORD severity; + DWORD code; + PCHAR desc; + PVOID object; + } IMAGEHLP_CBA_EVENT,*PIMAGEHLP_CBA_EVENT; + + typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD64 { + DWORD SizeOfStruct; + DWORD64 BaseOfImage; + DWORD CheckSum; + DWORD TimeDateStamp; + CHAR FileName[MAX_PATH]; + BOOLEAN Reparse; + HANDLE hFile; + DWORD Flags; + } IMAGEHLP_DEFERRED_SYMBOL_LOAD64,*PIMAGEHLP_DEFERRED_SYMBOL_LOAD64; + +#define DSLFLAG_MISMATCHED_PDB 0x1 +#define DSLFLAG_MISMATCHED_DBG 0x2 + +#ifdef _IMAGEHLP64 +#define IMAGEHLP_DEFERRED_SYMBOL_LOAD IMAGEHLP_DEFERRED_SYMBOL_LOAD64 +#define PIMAGEHLP_DEFERRED_SYMBOL_LOAD PIMAGEHLP_DEFERRED_SYMBOL_LOAD64 +#else + typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD { + DWORD SizeOfStruct; + DWORD BaseOfImage; + DWORD CheckSum; + DWORD TimeDateStamp; + CHAR FileName[MAX_PATH]; + BOOLEAN Reparse; + HANDLE hFile; + } IMAGEHLP_DEFERRED_SYMBOL_LOAD,*PIMAGEHLP_DEFERRED_SYMBOL_LOAD; +#endif + + typedef struct _IMAGEHLP_DUPLICATE_SYMBOL64 { + DWORD SizeOfStruct; + DWORD NumberOfDups; + PIMAGEHLP_SYMBOL64 Symbol; + DWORD SelectedSymbol; + } IMAGEHLP_DUPLICATE_SYMBOL64,*PIMAGEHLP_DUPLICATE_SYMBOL64; + +#ifdef _IMAGEHLP64 +#define IMAGEHLP_DUPLICATE_SYMBOL IMAGEHLP_DUPLICATE_SYMBOL64 +#define PIMAGEHLP_DUPLICATE_SYMBOL PIMAGEHLP_DUPLICATE_SYMBOL64 +#else + typedef struct _IMAGEHLP_DUPLICATE_SYMBOL { + DWORD SizeOfStruct; + DWORD NumberOfDups; + PIMAGEHLP_SYMBOL Symbol; + DWORD SelectedSymbol; + } IMAGEHLP_DUPLICATE_SYMBOL,*PIMAGEHLP_DUPLICATE_SYMBOL; +#endif + + BOOL IMAGEAPI SymSetParentWindow(HWND hwnd); + PCHAR IMAGEAPI SymSetHomeDirectory(PCSTR dir); + PCHAR IMAGEAPI SymGetHomeDirectory(DWORD type,PSTR dir,size_t size); + + enum { + hdBase = 0,hdSym,hdSrc,hdMax + }; + +#define SYMOPT_CASE_INSENSITIVE 0x00000001 +#define SYMOPT_UNDNAME 0x00000002 +#define SYMOPT_DEFERRED_LOADS 0x00000004 +#define SYMOPT_NO_CPP 0x00000008 +#define SYMOPT_LOAD_LINES 0x00000010 +#define SYMOPT_OMAP_FIND_NEAREST 0x00000020 +#define SYMOPT_LOAD_ANYTHING 0x00000040 +#define SYMOPT_IGNORE_CVREC 0x00000080 +#define SYMOPT_NO_UNQUALIFIED_LOADS 0x00000100 +#define SYMOPT_FAIL_CRITICAL_ERRORS 0x00000200 +#define SYMOPT_EXACT_SYMBOLS 0x00000400 +#define SYMOPT_ALLOW_ABSOLUTE_SYMBOLS 0x00000800 +#define SYMOPT_IGNORE_NT_SYMPATH 0x00001000 +#define SYMOPT_INCLUDE_32BIT_MODULES 0x00002000 +#define SYMOPT_PUBLICS_ONLY 0x00004000 +#define SYMOPT_NO_PUBLICS 0x00008000 +#define SYMOPT_AUTO_PUBLICS 0x00010000 +#define SYMOPT_NO_IMAGE_SEARCH 0x00020000 +#define SYMOPT_SECURE 0x00040000 +#define SYMOPT_NO_PROMPTS 0x00080000 + +#define SYMOPT_DEBUG 0x80000000 + + DWORD IMAGEAPI SymSetOptions(DWORD SymOptions); + DWORD IMAGEAPI SymGetOptions(VOID); + BOOL IMAGEAPI SymCleanup(HANDLE hProcess); + BOOL IMAGEAPI SymMatchString(LPSTR string,LPSTR expression,BOOL fCase); + + typedef BOOL (CALLBACK *PSYM_ENUMSOURCFILES_CALLBACK)(PSOURCEFILE pSourceFile,PVOID UserContext); + + BOOL IMAGEAPI SymEnumSourceFiles(HANDLE hProcess,ULONG64 ModBase,LPSTR Mask,PSYM_ENUMSOURCFILES_CALLBACK cbSrcFiles,PVOID UserContext); + BOOL IMAGEAPI SymEnumerateModules64(HANDLE hProcess,PSYM_ENUMMODULES_CALLBACK64 EnumModulesCallback,PVOID UserContext); + +#ifdef _IMAGEHLP64 +#define SymEnumerateModules SymEnumerateModules64 +#else + BOOL IMAGEAPI SymEnumerateModules(HANDLE hProcess,PSYM_ENUMMODULES_CALLBACK EnumModulesCallback,PVOID UserContext); +#endif + + BOOL IMAGEAPI SymEnumerateSymbols64(HANDLE hProcess,DWORD64 BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACK64 EnumSymbolsCallback,PVOID UserContext); + BOOL IMAGEAPI SymEnumerateSymbolsW64(HANDLE hProcess,DWORD64 BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACK64W EnumSymbolsCallback,PVOID UserContext); + +#ifdef _IMAGEHLP64 +#define SymEnumerateSymbols SymEnumerateSymbols64 +#define SymEnumerateSymbolsW SymEnumerateSymbolsW64 +#else + BOOL IMAGEAPI SymEnumerateSymbols(HANDLE hProcess,DWORD BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); + BOOL IMAGEAPI SymEnumerateSymbolsW(HANDLE hProcess,DWORD BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACKW EnumSymbolsCallback,PVOID UserContext); +#endif + + BOOL IMAGEAPI EnumerateLoadedModules64(HANDLE hProcess,PENUMLOADED_MODULES_CALLBACK64 EnumLoadedModulesCallback,PVOID UserContext); +#ifdef _IMAGEHLP64 +#define EnumerateLoadedModules EnumerateLoadedModules64 +#else + BOOL IMAGEAPI EnumerateLoadedModules(HANDLE hProcess,PENUMLOADED_MODULES_CALLBACK EnumLoadedModulesCallback,PVOID UserContext); +#endif + + PVOID IMAGEAPI SymFunctionTableAccess64(HANDLE hProcess,DWORD64 AddrBase); + +#ifdef _IMAGEHLP64 +#define SymFunctionTableAccess SymFunctionTableAccess64 +#else + PVOID IMAGEAPI SymFunctionTableAccess(HANDLE hProcess,DWORD AddrBase); +#endif + + BOOL IMAGEAPI SymGetModuleInfo64(HANDLE hProcess,DWORD64 qwAddr,PIMAGEHLP_MODULE64 ModuleInfo); + BOOL IMAGEAPI SymGetModuleInfoW64(HANDLE hProcess,DWORD64 qwAddr,PIMAGEHLP_MODULEW64 ModuleInfo); + +#ifdef _IMAGEHLP64 +#define SymGetModuleInfo SymGetModuleInfo64 +#define SymGetModuleInfoW SymGetModuleInfoW64 +#else + BOOL IMAGEAPI SymGetModuleInfo(HANDLE hProcess,DWORD dwAddr,PIMAGEHLP_MODULE ModuleInfo); + BOOL IMAGEAPI SymGetModuleInfoW(HANDLE hProcess,DWORD dwAddr,PIMAGEHLP_MODULEW ModuleInfo); +#endif + + DWORD64 IMAGEAPI SymGetModuleBase64(HANDLE hProcess,DWORD64 qwAddr); + +#ifdef _IMAGEHLP64 +#define SymGetModuleBase SymGetModuleBase64 +#else + DWORD IMAGEAPI SymGetModuleBase(HANDLE hProcess,DWORD dwAddr); +#endif + + BOOL IMAGEAPI SymGetSymNext64(HANDLE hProcess,PIMAGEHLP_SYMBOL64 Symbol); + +#ifdef _IMAGEHLP64 +#define SymGetSymNext SymGetSymNext64 +#else + BOOL IMAGEAPI SymGetSymNext(HANDLE hProcess,PIMAGEHLP_SYMBOL Symbol); +#endif + + BOOL IMAGEAPI SymGetSymPrev64(HANDLE hProcess,PIMAGEHLP_SYMBOL64 Symbol); + +#ifdef _IMAGEHLP64 +#define SymGetSymPrev SymGetSymPrev64 +#else + BOOL IMAGEAPI SymGetSymPrev(HANDLE hProcess,PIMAGEHLP_SYMBOL Symbol); +#endif + + typedef struct _SRCCODEINFO { + DWORD SizeOfStruct; + PVOID Key; + DWORD64 ModBase; + CHAR Obj[MAX_PATH + 1]; + CHAR FileName[MAX_PATH + 1]; + DWORD LineNumber; + DWORD64 Address; + } SRCCODEINFO,*PSRCCODEINFO; + + typedef BOOL (CALLBACK *PSYM_ENUMLINES_CALLBACK)(PSRCCODEINFO LineInfo,PVOID UserContext); + + BOOL IMAGEAPI SymEnumLines(HANDLE hProcess,ULONG64 Base,PCSTR Obj,PCSTR File,PSYM_ENUMLINES_CALLBACK EnumLinesCallback,PVOID UserContext); + BOOL IMAGEAPI SymGetLineFromAddr64(HANDLE hProcess,DWORD64 qwAddr,PDWORD pdwDisplacement,PIMAGEHLP_LINE64 Line64); + +#ifdef _IMAGEHLP64 +#define SymGetLineFromAddr SymGetLineFromAddr64 +#else + BOOL IMAGEAPI SymGetLineFromAddr(HANDLE hProcess,DWORD dwAddr,PDWORD pdwDisplacement,PIMAGEHLP_LINE Line); +#endif + + BOOL IMAGEAPI SymGetLineFromName64(HANDLE hProcess,PSTR ModuleName,PSTR FileName,DWORD dwLineNumber,PLONG plDisplacement,PIMAGEHLP_LINE64 Line); + +#ifdef _IMAGEHLP64 +#define SymGetLineFromName SymGetLineFromName64 +#else + BOOL IMAGEAPI SymGetLineFromName(HANDLE hProcess,PSTR ModuleName,PSTR FileName,DWORD dwLineNumber,PLONG plDisplacement,PIMAGEHLP_LINE Line); +#endif + + BOOL IMAGEAPI SymGetLineNext64(HANDLE hProcess,PIMAGEHLP_LINE64 Line); + +#ifdef _IMAGEHLP64 +#define SymGetLineNext SymGetLineNext64 +#else + BOOL IMAGEAPI SymGetLineNext(HANDLE hProcess,PIMAGEHLP_LINE Line); +#endif + + BOOL IMAGEAPI SymGetLinePrev64(HANDLE hProcess,PIMAGEHLP_LINE64 Line); + +#ifdef _IMAGEHLP64 +#define SymGetLinePrev SymGetLinePrev64 +#else + BOOL IMAGEAPI SymGetLinePrev(HANDLE hProcess,PIMAGEHLP_LINE Line); +#endif + + BOOL IMAGEAPI SymMatchFileName(PSTR FileName,PSTR Match,PSTR *FileNameStop,PSTR *MatchStop); + BOOL IMAGEAPI SymInitialize(HANDLE hProcess,PSTR UserSearchPath,BOOL fInvadeProcess); + BOOL IMAGEAPI SymGetSearchPath(HANDLE hProcess,PSTR SearchPath,DWORD SearchPathLength); + BOOL IMAGEAPI SymSetSearchPath(HANDLE hProcess,PSTR SearchPath); + DWORD64 IMAGEAPI SymLoadModule64(HANDLE hProcess,HANDLE hFile,PSTR ImageName,PSTR ModuleName,DWORD64 BaseOfDll,DWORD SizeOfDll); + +#define SLMFLAG_VIRTUAL 0x1 + + DWORD64 IMAGEAPI SymLoadModuleEx(HANDLE hProcess,HANDLE hFile,PSTR ImageName,PSTR ModuleName,DWORD64 BaseOfDll,DWORD DllSize,PMODLOAD_DATA Data,DWORD Flags); + +#ifdef _IMAGEHLP64 +#define SymLoadModule SymLoadModule64 +#else + DWORD IMAGEAPI SymLoadModule(HANDLE hProcess,HANDLE hFile,PSTR ImageName,PSTR ModuleName,DWORD BaseOfDll,DWORD SizeOfDll); +#endif + + BOOL IMAGEAPI SymUnloadModule64(HANDLE hProcess,DWORD64 BaseOfDll); + +#ifdef _IMAGEHLP64 +#define SymUnloadModule SymUnloadModule64 +#else + BOOL IMAGEAPI SymUnloadModule(HANDLE hProcess,DWORD BaseOfDll); +#endif + + BOOL IMAGEAPI SymUnDName64(PIMAGEHLP_SYMBOL64 sym,PSTR UnDecName,DWORD UnDecNameLength); + +#ifdef _IMAGEHLP64 +#define SymUnDName SymUnDName64 +#else + BOOL IMAGEAPI SymUnDName(PIMAGEHLP_SYMBOL sym,PSTR UnDecName,DWORD UnDecNameLength); +#endif + + BOOL IMAGEAPI SymRegisterCallback64(HANDLE hProcess,PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction,ULONG64 UserContext); + + BOOL IMAGEAPI SymRegisterFunctionEntryCallback64(HANDLE hProcess,PSYMBOL_FUNCENTRY_CALLBACK64 CallbackFunction,ULONG64 UserContext); + +#ifdef _IMAGEHLP64 +#define SymRegisterCallback SymRegisterCallback64 +#define SymRegisterFunctionEntryCallback SymRegisterFunctionEntryCallback64 +#else + BOOL IMAGEAPI SymRegisterCallback(HANDLE hProcess,PSYMBOL_REGISTERED_CALLBACK CallbackFunction,PVOID UserContext); + BOOL IMAGEAPI SymRegisterFunctionEntryCallback(HANDLE hProcess,PSYMBOL_FUNCENTRY_CALLBACK CallbackFunction,PVOID UserContext); +#endif + + typedef struct _IMAGEHLP_SYMBOL_SRC { + DWORD sizeofstruct; + DWORD type; + char file[MAX_PATH]; + } IMAGEHLP_SYMBOL_SRC,*PIMAGEHLP_SYMBOL_SRC; + + typedef struct _MODULE_TYPE_INFO { + USHORT dataLength; + USHORT leaf; + BYTE data[1]; + } MODULE_TYPE_INFO,*PMODULE_TYPE_INFO; + + typedef struct _SYMBOL_INFO { + ULONG SizeOfStruct; + ULONG TypeIndex; + ULONG64 Reserved[2]; + ULONG info; + ULONG Size; + ULONG64 ModBase; + ULONG Flags; + ULONG64 Value; + ULONG64 Address; + ULONG Register; + ULONG Scope; + ULONG Tag; + ULONG NameLen; + ULONG MaxNameLen; + CHAR Name[1]; + } SYMBOL_INFO,*PSYMBOL_INFO; + + typedef struct _SYMBOL_INFO_PACKAGE { + SYMBOL_INFO si; + CHAR name[MAX_SYM_NAME + 1]; + } SYMBOL_INFO_PACKAGE,*PSYMBOL_INFO_PACKAGE; + + typedef struct _IMAGEHLP_STACK_FRAME + { + ULONG64 InstructionOffset; + ULONG64 ReturnOffset; + ULONG64 FrameOffset; + ULONG64 StackOffset; + ULONG64 BackingStoreOffset; + ULONG64 FuncTableEntry; + ULONG64 Params[4]; + ULONG64 Reserved[5]; + BOOL Virtual; + ULONG Reserved2; + } IMAGEHLP_STACK_FRAME,*PIMAGEHLP_STACK_FRAME; + + typedef VOID IMAGEHLP_CONTEXT,*PIMAGEHLP_CONTEXT; + + BOOL IMAGEAPI SymSetContext(HANDLE hProcess,PIMAGEHLP_STACK_FRAME StackFrame,PIMAGEHLP_CONTEXT Context); + BOOL IMAGEAPI SymFromAddr(HANDLE hProcess,DWORD64 Address,PDWORD64 Displacement,PSYMBOL_INFO Symbol); + BOOL IMAGEAPI SymFromToken(HANDLE hProcess,DWORD64 Base,DWORD Token,PSYMBOL_INFO Symbol); + BOOL IMAGEAPI SymFromName(HANDLE hProcess,LPSTR Name,PSYMBOL_INFO Symbol); + + typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO pSymInfo,ULONG SymbolSize,PVOID UserContext); + + BOOL IMAGEAPI SymEnumSymbols(HANDLE hProcess,ULONG64 BaseOfDll,PCSTR Mask,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); + BOOL IMAGEAPI SymEnumSymbolsForAddr(HANDLE hProcess,DWORD64 Address,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); + +#define SYMENUMFLAG_FULLSRCH 1 +#define SYMENUMFLAG_SPEEDSRCH 2 + + typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO { + TI_GET_SYMTAG,TI_GET_SYMNAME,TI_GET_LENGTH,TI_GET_TYPE,TI_GET_TYPEID,TI_GET_BASETYPE,TI_GET_ARRAYINDEXTYPEID,TI_FINDCHILDREN, + TI_GET_DATAKIND,TI_GET_ADDRESSOFFSET,TI_GET_OFFSET,TI_GET_VALUE,TI_GET_COUNT,TI_GET_CHILDRENCOUNT,TI_GET_BITPOSITION,TI_GET_VIRTUALBASECLASS, + TI_GET_VIRTUALTABLESHAPEID,TI_GET_VIRTUALBASEPOINTEROFFSET,TI_GET_CLASSPARENTID,TI_GET_NESTED,TI_GET_SYMINDEX,TI_GET_LEXICALPARENT, + TI_GET_ADDRESS,TI_GET_THISADJUST,TI_GET_UDTKIND,TI_IS_EQUIV_TO,TI_GET_CALLING_CONVENTION + } IMAGEHLP_SYMBOL_TYPE_INFO; + + typedef struct _TI_FINDCHILDREN_PARAMS { + ULONG Count; + ULONG Start; + ULONG ChildId[1]; + } TI_FINDCHILDREN_PARAMS; + + BOOL IMAGEAPI SymGetTypeInfo(HANDLE hProcess,DWORD64 ModBase,ULONG TypeId,IMAGEHLP_SYMBOL_TYPE_INFO GetType,PVOID pInfo); + BOOL IMAGEAPI SymEnumTypes(HANDLE hProcess,ULONG64 BaseOfDll,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); + BOOL IMAGEAPI SymGetTypeFromName(HANDLE hProcess,ULONG64 BaseOfDll,LPSTR Name,PSYMBOL_INFO Symbol); + BOOL IMAGEAPI SymAddSymbol(HANDLE hProcess,ULONG64 BaseOfDll,PCSTR Name,DWORD64 Address,DWORD Size,DWORD Flags); + BOOL IMAGEAPI SymDeleteSymbol(HANDLE hProcess,ULONG64 BaseOfDll,PCSTR Name,DWORD64 Address,DWORD Flags); + + typedef BOOL (WINAPI *PDBGHELP_CREATE_USER_DUMP_CALLBACK)(DWORD DataType,PVOID *Data,LPDWORD DataLength,PVOID UserData); + + BOOL WINAPI DbgHelpCreateUserDump(LPSTR FileName,PDBGHELP_CREATE_USER_DUMP_CALLBACK Callback,PVOID UserData); + BOOL WINAPI DbgHelpCreateUserDumpW(LPWSTR FileName,PDBGHELP_CREATE_USER_DUMP_CALLBACK Callback,PVOID UserData); + BOOL IMAGEAPI SymGetSymFromAddr64(HANDLE hProcess,DWORD64 qwAddr,PDWORD64 pdwDisplacement,PIMAGEHLP_SYMBOL64 Symbol); + +#ifdef _IMAGEHLP64 +#define SymGetSymFromAddr SymGetSymFromAddr64 +#else + BOOL IMAGEAPI SymGetSymFromAddr(HANDLE hProcess,DWORD dwAddr,PDWORD pdwDisplacement,PIMAGEHLP_SYMBOL Symbol); +#endif + + BOOL IMAGEAPI SymGetSymFromName64(HANDLE hProcess,PSTR Name,PIMAGEHLP_SYMBOL64 Symbol); + +#ifdef _IMAGEHLP64 +#define SymGetSymFromName SymGetSymFromName64 +#else + BOOL IMAGEAPI SymGetSymFromName(HANDLE hProcess,PSTR Name,PIMAGEHLP_SYMBOL Symbol); +#endif + + DBHLP_DEPRECIATED BOOL IMAGEAPI FindFileInPath(HANDLE hprocess,LPSTR SearchPath,LPSTR FileName,PVOID id,DWORD two,DWORD three,DWORD flags,LPSTR FilePath); + DBHLP_DEPRECIATED BOOL IMAGEAPI FindFileInSearchPath(HANDLE hprocess,LPSTR SearchPath,LPSTR FileName,DWORD one,DWORD two,DWORD three,LPSTR FilePath); + DBHLP_DEPRECIATED BOOL IMAGEAPI SymEnumSym(HANDLE hProcess,ULONG64 BaseOfDll,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); + +#define SYMF_OMAP_GENERATED 0x00000001 +#define SYMF_OMAP_MODIFIED 0x00000002 +#define SYMF_REGISTER 0x00000008 +#define SYMF_REGREL 0x00000010 +#define SYMF_FRAMEREL 0x00000020 +#define SYMF_PARAMETER 0x00000040 +#define SYMF_LOCAL 0x00000080 +#define SYMF_CONSTANT 0x00000100 +#define SYMF_EXPORT 0x00000200 +#define SYMF_FORWARDER 0x00000400 +#define SYMF_FUNCTION 0x00000800 +#define SYMF_VIRTUAL 0x00001000 +#define SYMF_THUNK 0x00002000 +#define SYMF_TLSREL 0x00004000 + +#define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT 1 +#define IMAGEHLP_SYMBOL_INFO_REGISTER SYMF_REGISTER +#define IMAGEHLP_SYMBOL_INFO_REGRELATIVE SYMF_REGREL +#define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE SYMF_FRAMEREL +#define IMAGEHLP_SYMBOL_INFO_PARAMETER SYMF_PARAMETER +#define IMAGEHLP_SYMBOL_INFO_LOCAL SYMF_LOCAL +#define IMAGEHLP_SYMBOL_INFO_CONSTANT SYMF_CONSTANT +#define IMAGEHLP_SYMBOL_FUNCTION SYMF_FUNCTION +#define IMAGEHLP_SYMBOL_VIRTUAL SYMF_VIRTUAL +#define IMAGEHLP_SYMBOL_THUNK SYMF_THUNK +#define IMAGEHLP_SYMBOL_INFO_TLSRELATIVE SYMF_TLSREL + +#include + +#define MINIDUMP_SIGNATURE ('PMDM') +#define MINIDUMP_VERSION (42899) + typedef DWORD RVA; + typedef ULONG64 RVA64; + + typedef struct _MINIDUMP_LOCATION_DESCRIPTOR { + ULONG32 DataSize; + RVA Rva; + } MINIDUMP_LOCATION_DESCRIPTOR; + + typedef struct _MINIDUMP_LOCATION_DESCRIPTOR64 { + ULONG64 DataSize; + RVA64 Rva; + } MINIDUMP_LOCATION_DESCRIPTOR64; + + typedef struct _MINIDUMP_MEMORY_DESCRIPTOR { + ULONG64 StartOfMemoryRange; + MINIDUMP_LOCATION_DESCRIPTOR Memory; + } MINIDUMP_MEMORY_DESCRIPTOR,*PMINIDUMP_MEMORY_DESCRIPTOR; + + typedef struct _MINIDUMP_MEMORY_DESCRIPTOR64 { + ULONG64 StartOfMemoryRange; + ULONG64 DataSize; + } MINIDUMP_MEMORY_DESCRIPTOR64,*PMINIDUMP_MEMORY_DESCRIPTOR64; + + typedef struct _MINIDUMP_HEADER { + ULONG32 Signature; + ULONG32 Version; + ULONG32 NumberOfStreams; + RVA StreamDirectoryRva; + ULONG32 CheckSum; + union { + ULONG32 Reserved; + ULONG32 TimeDateStamp; + } DUMMYUNIONNAME; + ULONG64 Flags; + } MINIDUMP_HEADER,*PMINIDUMP_HEADER; + + typedef struct _MINIDUMP_DIRECTORY { + ULONG32 StreamType; + MINIDUMP_LOCATION_DESCRIPTOR Location; + } MINIDUMP_DIRECTORY,*PMINIDUMP_DIRECTORY; + + typedef struct _MINIDUMP_STRING { + ULONG32 Length; + WCHAR Buffer [0]; + } MINIDUMP_STRING,*PMINIDUMP_STRING; + + typedef enum _MINIDUMP_STREAM_TYPE { + UnusedStream = 0,ReservedStream0 = 1,ReservedStream1 = 2,ThreadListStream = 3,ModuleListStream = 4,MemoryListStream = 5, + ExceptionStream = 6,SystemInfoStream = 7,ThreadExListStream = 8,Memory64ListStream = 9,CommentStreamA = 10,CommentStreamW = 11, + HandleDataStream = 12,FunctionTableStream = 13,UnloadedModuleListStream = 14,MiscInfoStream = 15,LastReservedStream = 0xffff + } MINIDUMP_STREAM_TYPE; + + typedef union _CPU_INFORMATION { + struct { + ULONG32 VendorId [3 ]; + ULONG32 VersionInformation; + ULONG32 FeatureInformation; + ULONG32 AMDExtendedCpuFeatures; + } X86CpuInfo; + struct { + ULONG64 ProcessorFeatures [2 ]; + } OtherCpuInfo; + } CPU_INFORMATION,*PCPU_INFORMATION; + + typedef struct _MINIDUMP_SYSTEM_INFO { + USHORT ProcessorArchitecture; + USHORT ProcessorLevel; + USHORT ProcessorRevision; + union { + USHORT Reserved0; + struct { + UCHAR NumberOfProcessors; + UCHAR ProductType; + } DUMMYSTRUCTNAME; + } DUMMYUNIONNAME; + ULONG32 MajorVersion; + ULONG32 MinorVersion; + ULONG32 BuildNumber; + ULONG32 PlatformId; + RVA CSDVersionRva; + union { + ULONG32 Reserved1; + struct { + USHORT SuiteMask; + USHORT Reserved2; + } DUMMYSTRUCTNAME; + } DUMMYUNIONNAME1; + CPU_INFORMATION Cpu; + } MINIDUMP_SYSTEM_INFO,*PMINIDUMP_SYSTEM_INFO; + + C_ASSERT (sizeof (((PPROCESS_INFORMATION)0)->dwThreadId)==4); + + typedef struct _MINIDUMP_THREAD { + ULONG32 ThreadId; + ULONG32 SuspendCount; + ULONG32 PriorityClass; + ULONG32 Priority; + ULONG64 Teb; + MINIDUMP_MEMORY_DESCRIPTOR Stack; + MINIDUMP_LOCATION_DESCRIPTOR ThreadContext; + } MINIDUMP_THREAD,*PMINIDUMP_THREAD; + + typedef struct _MINIDUMP_THREAD_LIST { + ULONG32 NumberOfThreads; + MINIDUMP_THREAD Threads [0]; + } MINIDUMP_THREAD_LIST,*PMINIDUMP_THREAD_LIST; + + typedef struct _MINIDUMP_THREAD_EX { + ULONG32 ThreadId; + ULONG32 SuspendCount; + ULONG32 PriorityClass; + ULONG32 Priority; + ULONG64 Teb; + MINIDUMP_MEMORY_DESCRIPTOR Stack; + MINIDUMP_LOCATION_DESCRIPTOR ThreadContext; + MINIDUMP_MEMORY_DESCRIPTOR BackingStore; + } MINIDUMP_THREAD_EX,*PMINIDUMP_THREAD_EX; + + typedef struct _MINIDUMP_THREAD_EX_LIST { + ULONG32 NumberOfThreads; + MINIDUMP_THREAD_EX Threads [0]; + } MINIDUMP_THREAD_EX_LIST,*PMINIDUMP_THREAD_EX_LIST; + + typedef struct _MINIDUMP_EXCEPTION { + ULONG32 ExceptionCode; + ULONG32 ExceptionFlags; + ULONG64 ExceptionRecord; + ULONG64 ExceptionAddress; + ULONG32 NumberParameters; + ULONG32 __unusedAlignment; + ULONG64 ExceptionInformation [EXCEPTION_MAXIMUM_PARAMETERS ]; + } MINIDUMP_EXCEPTION,*PMINIDUMP_EXCEPTION; + + typedef struct MINIDUMP_EXCEPTION_STREAM { + ULONG32 ThreadId; + ULONG32 __alignment; + MINIDUMP_EXCEPTION ExceptionRecord; + MINIDUMP_LOCATION_DESCRIPTOR ThreadContext; + } MINIDUMP_EXCEPTION_STREAM,*PMINIDUMP_EXCEPTION_STREAM; + + typedef struct _MINIDUMP_MODULE { + ULONG64 BaseOfImage; + ULONG32 SizeOfImage; + ULONG32 CheckSum; + ULONG32 TimeDateStamp; + RVA ModuleNameRva; + VS_FIXEDFILEINFO VersionInfo; + MINIDUMP_LOCATION_DESCRIPTOR CvRecord; + MINIDUMP_LOCATION_DESCRIPTOR MiscRecord; + ULONG64 Reserved0; + ULONG64 Reserved1; + } MINIDUMP_MODULE,*PMINIDUMP_MODULE; + + typedef struct _MINIDUMP_MODULE_LIST { + ULONG32 NumberOfModules; + MINIDUMP_MODULE Modules [0 ]; + } MINIDUMP_MODULE_LIST,*PMINIDUMP_MODULE_LIST; + + typedef struct _MINIDUMP_MEMORY_LIST { + ULONG32 NumberOfMemoryRanges; + MINIDUMP_MEMORY_DESCRIPTOR MemoryRanges [0]; + } MINIDUMP_MEMORY_LIST,*PMINIDUMP_MEMORY_LIST; + + typedef struct _MINIDUMP_MEMORY64_LIST { + ULONG64 NumberOfMemoryRanges; + RVA64 BaseRva; + MINIDUMP_MEMORY_DESCRIPTOR64 MemoryRanges [0]; + } MINIDUMP_MEMORY64_LIST,*PMINIDUMP_MEMORY64_LIST; + + typedef struct _MINIDUMP_EXCEPTION_INFORMATION { + DWORD ThreadId; + PEXCEPTION_POINTERS ExceptionPointers; + BOOL ClientPointers; + } MINIDUMP_EXCEPTION_INFORMATION,*PMINIDUMP_EXCEPTION_INFORMATION; + + typedef struct _MINIDUMP_EXCEPTION_INFORMATION64 { + DWORD ThreadId; + ULONG64 ExceptionRecord; + ULONG64 ContextRecord; + BOOL ClientPointers; + } MINIDUMP_EXCEPTION_INFORMATION64,*PMINIDUMP_EXCEPTION_INFORMATION64; + + typedef struct _MINIDUMP_HANDLE_DESCRIPTOR { + ULONG64 Handle; + RVA TypeNameRva; + RVA ObjectNameRva; + ULONG32 Attributes; + ULONG32 GrantedAccess; + ULONG32 HandleCount; + ULONG32 PointerCount; + } MINIDUMP_HANDLE_DESCRIPTOR,*PMINIDUMP_HANDLE_DESCRIPTOR; + + typedef struct _MINIDUMP_HANDLE_DATA_STREAM { + ULONG32 SizeOfHeader; + ULONG32 SizeOfDescriptor; + ULONG32 NumberOfDescriptors; + ULONG32 Reserved; + } MINIDUMP_HANDLE_DATA_STREAM,*PMINIDUMP_HANDLE_DATA_STREAM; + + typedef struct _MINIDUMP_FUNCTION_TABLE_DESCRIPTOR { + ULONG64 MinimumAddress; + ULONG64 MaximumAddress; + ULONG64 BaseAddress; + ULONG32 EntryCount; + ULONG32 SizeOfAlignPad; + } MINIDUMP_FUNCTION_TABLE_DESCRIPTOR,*PMINIDUMP_FUNCTION_TABLE_DESCRIPTOR; + + typedef struct _MINIDUMP_FUNCTION_TABLE_STREAM { + ULONG32 SizeOfHeader; + ULONG32 SizeOfDescriptor; + ULONG32 SizeOfNativeDescriptor; + ULONG32 SizeOfFunctionEntry; + ULONG32 NumberOfDescriptors; + ULONG32 SizeOfAlignPad; + } MINIDUMP_FUNCTION_TABLE_STREAM,*PMINIDUMP_FUNCTION_TABLE_STREAM; + + typedef struct _MINIDUMP_UNLOADED_MODULE { + ULONG64 BaseOfImage; + ULONG32 SizeOfImage; + ULONG32 CheckSum; + ULONG32 TimeDateStamp; + RVA ModuleNameRva; + } MINIDUMP_UNLOADED_MODULE,*PMINIDUMP_UNLOADED_MODULE; + + typedef struct _MINIDUMP_UNLOADED_MODULE_LIST { + ULONG32 SizeOfHeader; + ULONG32 SizeOfEntry; + ULONG32 NumberOfEntries; + } MINIDUMP_UNLOADED_MODULE_LIST,*PMINIDUMP_UNLOADED_MODULE_LIST; + +#define MINIDUMP_MISC1_PROCESS_ID 0x00000001 +#define MINIDUMP_MISC1_PROCESS_TIMES 0x00000002 + + typedef struct _MINIDUMP_MISC_INFO { + ULONG32 SizeOfInfo; + ULONG32 Flags1; + ULONG32 ProcessId; + ULONG32 ProcessCreateTime; + ULONG32 ProcessUserTime; + ULONG32 ProcessKernelTime; + } MINIDUMP_MISC_INFO,*PMINIDUMP_MISC_INFO; + + typedef struct _MINIDUMP_USER_RECORD { + ULONG32 Type; + MINIDUMP_LOCATION_DESCRIPTOR Memory; + } MINIDUMP_USER_RECORD,*PMINIDUMP_USER_RECORD; + + typedef struct _MINIDUMP_USER_STREAM { + ULONG32 Type; + ULONG BufferSize; + PVOID Buffer; + } MINIDUMP_USER_STREAM,*PMINIDUMP_USER_STREAM; + + typedef struct _MINIDUMP_USER_STREAM_INFORMATION { + ULONG UserStreamCount; + PMINIDUMP_USER_STREAM UserStreamArray; + } MINIDUMP_USER_STREAM_INFORMATION,*PMINIDUMP_USER_STREAM_INFORMATION; + + typedef enum _MINIDUMP_CALLBACK_TYPE { + ModuleCallback,ThreadCallback,ThreadExCallback,IncludeThreadCallback,IncludeModuleCallback,MemoryCallback + } MINIDUMP_CALLBACK_TYPE; + + typedef struct _MINIDUMP_THREAD_CALLBACK { + ULONG ThreadId; + HANDLE ThreadHandle; + CONTEXT Context; + ULONG SizeOfContext; + ULONG64 StackBase; + ULONG64 StackEnd; + } MINIDUMP_THREAD_CALLBACK,*PMINIDUMP_THREAD_CALLBACK; + + typedef struct _MINIDUMP_THREAD_EX_CALLBACK { + ULONG ThreadId; + HANDLE ThreadHandle; + CONTEXT Context; + ULONG SizeOfContext; + ULONG64 StackBase; + ULONG64 StackEnd; + ULONG64 BackingStoreBase; + ULONG64 BackingStoreEnd; + } MINIDUMP_THREAD_EX_CALLBACK,*PMINIDUMP_THREAD_EX_CALLBACK; + + typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK { + ULONG ThreadId; + } MINIDUMP_INCLUDE_THREAD_CALLBACK,*PMINIDUMP_INCLUDE_THREAD_CALLBACK; + + typedef enum _THREAD_WRITE_FLAGS { + ThreadWriteThread = 0x0001,ThreadWriteStack = 0x0002,ThreadWriteContext = 0x0004,ThreadWriteBackingStore = 0x0008, + ThreadWriteInstructionWindow = 0x0010,ThreadWriteThreadData = 0x0020 + } THREAD_WRITE_FLAGS; + + typedef struct _MINIDUMP_MODULE_CALLBACK { + PWCHAR FullPath; + ULONG64 BaseOfImage; + ULONG SizeOfImage; + ULONG CheckSum; + ULONG TimeDateStamp; + VS_FIXEDFILEINFO VersionInfo; + PVOID CvRecord; + ULONG SizeOfCvRecord; + PVOID MiscRecord; + ULONG SizeOfMiscRecord; + } MINIDUMP_MODULE_CALLBACK,*PMINIDUMP_MODULE_CALLBACK; + + typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK { + ULONG64 BaseOfImage; + } MINIDUMP_INCLUDE_MODULE_CALLBACK,*PMINIDUMP_INCLUDE_MODULE_CALLBACK; + + typedef enum _MODULE_WRITE_FLAGS { + ModuleWriteModule = 0x0001,ModuleWriteDataSeg = 0x0002,ModuleWriteMiscRecord = 0x0004,ModuleWriteCvRecord = 0x0008, + ModuleReferencedByMemory = 0x0010 + } MODULE_WRITE_FLAGS; + + typedef struct _MINIDUMP_CALLBACK_INPUT { + ULONG ProcessId; + HANDLE ProcessHandle; + ULONG CallbackType; + union { + MINIDUMP_THREAD_CALLBACK Thread; + MINIDUMP_THREAD_EX_CALLBACK ThreadEx; + MINIDUMP_MODULE_CALLBACK Module; + MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread; + MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule; + } DUMMYUNIONNAME; + } MINIDUMP_CALLBACK_INPUT,*PMINIDUMP_CALLBACK_INPUT; + + typedef struct _MINIDUMP_CALLBACK_OUTPUT { + union { + ULONG ModuleWriteFlags; + ULONG ThreadWriteFlags; + struct { + ULONG64 MemoryBase; + ULONG MemorySize; + } DUMMYSTRUCTNAME; + } DUMMYUNIONNAME; + } MINIDUMP_CALLBACK_OUTPUT,*PMINIDUMP_CALLBACK_OUTPUT; + + typedef enum _MINIDUMP_TYPE { + MiniDumpNormal = 0x0000,MiniDumpWithDataSegs = 0x0001,MiniDumpWithFullMemory = 0x0002,MiniDumpWithHandleData = 0x0004, + MiniDumpFilterMemory = 0x0008,MiniDumpScanMemory = 0x0010,MiniDumpWithUnloadedModules = 0x0020,MiniDumpWithIndirectlyReferencedMemory = 0x0040, + MiniDumpFilterModulePaths = 0x0080,MiniDumpWithProcessThreadData = 0x0100,MiniDumpWithPrivateReadWriteMemory = 0x0200, + MiniDumpWithoutOptionalData = 0x0400 + } MINIDUMP_TYPE; + + typedef BOOL (WINAPI *MINIDUMP_CALLBACK_ROUTINE)(PVOID CallbackParam,CONST PMINIDUMP_CALLBACK_INPUT CallbackInput,PMINIDUMP_CALLBACK_OUTPUT CallbackOutput); + + typedef struct _MINIDUMP_CALLBACK_INFORMATION { + MINIDUMP_CALLBACK_ROUTINE CallbackRoutine; + PVOID CallbackParam; + } MINIDUMP_CALLBACK_INFORMATION,*PMINIDUMP_CALLBACK_INFORMATION; + +#define RVA_TO_ADDR(Mapping,Rva) ((PVOID)(((ULONG_PTR) (Mapping)) + (Rva))) + + BOOL WINAPI MiniDumpWriteDump(HANDLE hProcess,DWORD ProcessId,HANDLE hFile,MINIDUMP_TYPE DumpType,CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam); + BOOL WINAPI MiniDumpReadDumpStream(PVOID BaseOfDump,ULONG StreamNumber,PMINIDUMP_DIRECTORY *Dir,PVOID *StreamPointer,ULONG *StreamSize); + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_bitmask.c b/mesalib/src/gallium/auxiliary/util/u_bitmask.c index c2952a30d..23c93a3eb 100644 --- a/mesalib/src/gallium/auxiliary/util/u_bitmask.c +++ b/mesalib/src/gallium/auxiliary/util/u_bitmask.c @@ -1,328 +1,328 @@ -/************************************************************************** - * - * Copyright 2009 VMware, 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 VMWARE 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 - * Generic bitmask implementation. - * - * @author Jose Fonseca - */ - - -#include "pipe/p_compiler.h" -#include "util/u_debug.h" - -#include "util/u_memory.h" -#include "util/u_bitmask.h" - - -typedef uint32_t util_bitmask_word; - - -#define UTIL_BITMASK_INITIAL_WORDS 16 -#define UTIL_BITMASK_BITS_PER_BYTE 8 -#define UTIL_BITMASK_BITS_PER_WORD (sizeof(util_bitmask_word) * UTIL_BITMASK_BITS_PER_BYTE) - - -struct util_bitmask -{ - util_bitmask_word *words; - - /** Number of bits we can currently hold */ - unsigned size; - - /** Number of consecutive bits set at the start of the bitmask */ - unsigned filled; -}; - - -struct util_bitmask * -util_bitmask_create(void) -{ - struct util_bitmask *bm; - - bm = MALLOC_STRUCT(util_bitmask); - if(!bm) - return NULL; - - bm->words = (util_bitmask_word *)CALLOC(UTIL_BITMASK_INITIAL_WORDS, sizeof(util_bitmask_word)); - if(!bm->words) { - FREE(bm); - return NULL; - } - - bm->size = UTIL_BITMASK_INITIAL_WORDS * UTIL_BITMASK_BITS_PER_WORD; - bm->filled = 0; - - return bm; -} - - -/** - * Resize the bitmask if necessary - */ -static INLINE boolean -util_bitmask_resize(struct util_bitmask *bm, - unsigned minimum_index) -{ - unsigned minimum_size = minimum_index + 1; - unsigned new_size; - util_bitmask_word *new_words; - - /* Check integer overflow */ - if(!minimum_size) - return FALSE; - - if(bm->size >= minimum_size) - return TRUE; - - assert(bm->size % UTIL_BITMASK_BITS_PER_WORD == 0); - new_size = bm->size; - while(new_size < minimum_size) { - new_size *= 2; - /* Check integer overflow */ - if(new_size < bm->size) - return FALSE; - } - assert(new_size); - assert(new_size % UTIL_BITMASK_BITS_PER_WORD == 0); - - new_words = (util_bitmask_word *)REALLOC((void *)bm->words, - bm->size / UTIL_BITMASK_BITS_PER_BYTE, - new_size / UTIL_BITMASK_BITS_PER_BYTE); - if(!new_words) - return FALSE; - - memset(new_words + bm->size/UTIL_BITMASK_BITS_PER_WORD, - 0, - (new_size - bm->size)/UTIL_BITMASK_BITS_PER_BYTE); - - bm->size = new_size; - bm->words = new_words; - - return TRUE; -} - - -/** - * Lazily update the filled. - */ -static INLINE void -util_bitmask_filled_set(struct util_bitmask *bm, - unsigned index) -{ - assert(bm->filled <= bm->size); - assert(index < bm->size); - - if(index == bm->filled) { - ++bm->filled; - assert(bm->filled <= bm->size); - } -} - -static INLINE void -util_bitmask_filled_unset(struct util_bitmask *bm, - unsigned index) -{ - assert(bm->filled <= bm->size); - assert(index < bm->size); - - if(index < bm->filled) - bm->filled = index; -} - - -unsigned -util_bitmask_add(struct util_bitmask *bm) -{ - unsigned word; - unsigned bit; - util_bitmask_word mask; - - assert(bm); - - /* linear search for an empty index */ - word = bm->filled / UTIL_BITMASK_BITS_PER_WORD; - bit = bm->filled % UTIL_BITMASK_BITS_PER_WORD; - mask = 1 << bit; - while(word < bm->size / UTIL_BITMASK_BITS_PER_WORD) { - while(bit < UTIL_BITMASK_BITS_PER_WORD) { - if(!(bm->words[word] & mask)) - goto found; - ++bm->filled; - ++bit; - mask <<= 1; - } - ++word; - bit = 0; - mask = 1; - } -found: - - /* grow the bitmask if necessary */ - if(!util_bitmask_resize(bm, bm->filled)) - return UTIL_BITMASK_INVALID_INDEX; - - assert(!(bm->words[word] & mask)); - bm->words[word] |= mask; - - return bm->filled++; -} - - -unsigned -util_bitmask_set(struct util_bitmask *bm, - unsigned index) -{ - unsigned word; - unsigned bit; - util_bitmask_word mask; - - assert(bm); - - /* grow the bitmask if necessary */ - if(!util_bitmask_resize(bm, index)) - return UTIL_BITMASK_INVALID_INDEX; - - word = index / UTIL_BITMASK_BITS_PER_WORD; - bit = index % UTIL_BITMASK_BITS_PER_WORD; - mask = 1 << bit; - - bm->words[word] |= mask; - - util_bitmask_filled_set(bm, index); - - return index; -} - - -void -util_bitmask_clear(struct util_bitmask *bm, - unsigned index) -{ - unsigned word; - unsigned bit; - util_bitmask_word mask; - - assert(bm); - - if(index >= bm->size) - return; - - word = index / UTIL_BITMASK_BITS_PER_WORD; - bit = index % UTIL_BITMASK_BITS_PER_WORD; - mask = 1 << bit; - - bm->words[word] &= ~mask; - - util_bitmask_filled_unset(bm, index); -} - - -boolean -util_bitmask_get(struct util_bitmask *bm, - unsigned index) -{ - unsigned word = index / UTIL_BITMASK_BITS_PER_WORD; - unsigned bit = index % UTIL_BITMASK_BITS_PER_WORD; - util_bitmask_word mask = 1 << bit; - - assert(bm); - - if(index < bm->filled) { - assert(bm->words[word] & mask); - return TRUE; - } - - if(index >= bm->size) - return FALSE; - - if(bm->words[word] & mask) { - util_bitmask_filled_set(bm, index); - return TRUE; - } - else - return FALSE; -} - - -unsigned -util_bitmask_get_next_index(struct util_bitmask *bm, - unsigned index) -{ - unsigned word = index / UTIL_BITMASK_BITS_PER_WORD; - unsigned bit = index % UTIL_BITMASK_BITS_PER_WORD; - util_bitmask_word mask = 1 << bit; - - if(index < bm->filled) { - assert(bm->words[word] & mask); - return index; - } - - if(index >= bm->size) { - return UTIL_BITMASK_INVALID_INDEX; - } - - /* Do a linear search */ - while(word < bm->size / UTIL_BITMASK_BITS_PER_WORD) { - while(bit < UTIL_BITMASK_BITS_PER_WORD) { - if(bm->words[word] & mask) { - if(index == bm->filled) { - ++bm->filled; - assert(bm->filled <= bm->size); - } - return index; - } - ++index; - ++bit; - mask <<= 1; - } - ++word; - bit = 0; - mask = 1; - } - - return UTIL_BITMASK_INVALID_INDEX; -} - - -unsigned -util_bitmask_get_first_index(struct util_bitmask *bm) -{ - return util_bitmask_get_next_index(bm, 0); -} - - -void -util_bitmask_destroy(struct util_bitmask *bm) -{ - assert(bm); - - FREE(bm->words); - FREE(bm); -} - +/************************************************************************** + * + * Copyright 2009 VMware, 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 VMWARE 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 + * Generic bitmask implementation. + * + * @author Jose Fonseca + */ + + +#include "pipe/p_compiler.h" +#include "util/u_debug.h" + +#include "util/u_memory.h" +#include "util/u_bitmask.h" + + +typedef uint32_t util_bitmask_word; + + +#define UTIL_BITMASK_INITIAL_WORDS 16 +#define UTIL_BITMASK_BITS_PER_BYTE 8 +#define UTIL_BITMASK_BITS_PER_WORD (sizeof(util_bitmask_word) * UTIL_BITMASK_BITS_PER_BYTE) + + +struct util_bitmask +{ + util_bitmask_word *words; + + /** Number of bits we can currently hold */ + unsigned size; + + /** Number of consecutive bits set at the start of the bitmask */ + unsigned filled; +}; + + +struct util_bitmask * +util_bitmask_create(void) +{ + struct util_bitmask *bm; + + bm = MALLOC_STRUCT(util_bitmask); + if(!bm) + return NULL; + + bm->words = (util_bitmask_word *)CALLOC(UTIL_BITMASK_INITIAL_WORDS, sizeof(util_bitmask_word)); + if(!bm->words) { + FREE(bm); + return NULL; + } + + bm->size = UTIL_BITMASK_INITIAL_WORDS * UTIL_BITMASK_BITS_PER_WORD; + bm->filled = 0; + + return bm; +} + + +/** + * Resize the bitmask if necessary + */ +static INLINE boolean +util_bitmask_resize(struct util_bitmask *bm, + unsigned minimum_index) +{ + unsigned minimum_size = minimum_index + 1; + unsigned new_size; + util_bitmask_word *new_words; + + /* Check integer overflow */ + if(!minimum_size) + return FALSE; + + if(bm->size >= minimum_size) + return TRUE; + + assert(bm->size % UTIL_BITMASK_BITS_PER_WORD == 0); + new_size = bm->size; + while(new_size < minimum_size) { + new_size *= 2; + /* Check integer overflow */ + if(new_size < bm->size) + return FALSE; + } + assert(new_size); + assert(new_size % UTIL_BITMASK_BITS_PER_WORD == 0); + + new_words = (util_bitmask_word *)REALLOC((void *)bm->words, + bm->size / UTIL_BITMASK_BITS_PER_BYTE, + new_size / UTIL_BITMASK_BITS_PER_BYTE); + if(!new_words) + return FALSE; + + memset(new_words + bm->size/UTIL_BITMASK_BITS_PER_WORD, + 0, + (new_size - bm->size)/UTIL_BITMASK_BITS_PER_BYTE); + + bm->size = new_size; + bm->words = new_words; + + return TRUE; +} + + +/** + * Lazily update the filled. + */ +static INLINE void +util_bitmask_filled_set(struct util_bitmask *bm, + unsigned index) +{ + assert(bm->filled <= bm->size); + assert(index < bm->size); + + if(index == bm->filled) { + ++bm->filled; + assert(bm->filled <= bm->size); + } +} + +static INLINE void +util_bitmask_filled_unset(struct util_bitmask *bm, + unsigned index) +{ + assert(bm->filled <= bm->size); + assert(index < bm->size); + + if(index < bm->filled) + bm->filled = index; +} + + +unsigned +util_bitmask_add(struct util_bitmask *bm) +{ + unsigned word; + unsigned bit; + util_bitmask_word mask; + + assert(bm); + + /* linear search for an empty index */ + word = bm->filled / UTIL_BITMASK_BITS_PER_WORD; + bit = bm->filled % UTIL_BITMASK_BITS_PER_WORD; + mask = 1 << bit; + while(word < bm->size / UTIL_BITMASK_BITS_PER_WORD) { + while(bit < UTIL_BITMASK_BITS_PER_WORD) { + if(!(bm->words[word] & mask)) + goto found; + ++bm->filled; + ++bit; + mask <<= 1; + } + ++word; + bit = 0; + mask = 1; + } +found: + + /* grow the bitmask if necessary */ + if(!util_bitmask_resize(bm, bm->filled)) + return UTIL_BITMASK_INVALID_INDEX; + + assert(!(bm->words[word] & mask)); + bm->words[word] |= mask; + + return bm->filled++; +} + + +unsigned +util_bitmask_set(struct util_bitmask *bm, + unsigned index) +{ + unsigned word; + unsigned bit; + util_bitmask_word mask; + + assert(bm); + + /* grow the bitmask if necessary */ + if(!util_bitmask_resize(bm, index)) + return UTIL_BITMASK_INVALID_INDEX; + + word = index / UTIL_BITMASK_BITS_PER_WORD; + bit = index % UTIL_BITMASK_BITS_PER_WORD; + mask = 1 << bit; + + bm->words[word] |= mask; + + util_bitmask_filled_set(bm, index); + + return index; +} + + +void +util_bitmask_clear(struct util_bitmask *bm, + unsigned index) +{ + unsigned word; + unsigned bit; + util_bitmask_word mask; + + assert(bm); + + if(index >= bm->size) + return; + + word = index / UTIL_BITMASK_BITS_PER_WORD; + bit = index % UTIL_BITMASK_BITS_PER_WORD; + mask = 1 << bit; + + bm->words[word] &= ~mask; + + util_bitmask_filled_unset(bm, index); +} + + +boolean +util_bitmask_get(struct util_bitmask *bm, + unsigned index) +{ + unsigned word = index / UTIL_BITMASK_BITS_PER_WORD; + unsigned bit = index % UTIL_BITMASK_BITS_PER_WORD; + util_bitmask_word mask = 1 << bit; + + assert(bm); + + if(index < bm->filled) { + assert(bm->words[word] & mask); + return TRUE; + } + + if(index >= bm->size) + return FALSE; + + if(bm->words[word] & mask) { + util_bitmask_filled_set(bm, index); + return TRUE; + } + else + return FALSE; +} + + +unsigned +util_bitmask_get_next_index(struct util_bitmask *bm, + unsigned index) +{ + unsigned word = index / UTIL_BITMASK_BITS_PER_WORD; + unsigned bit = index % UTIL_BITMASK_BITS_PER_WORD; + util_bitmask_word mask = 1 << bit; + + if(index < bm->filled) { + assert(bm->words[word] & mask); + return index; + } + + if(index >= bm->size) { + return UTIL_BITMASK_INVALID_INDEX; + } + + /* Do a linear search */ + while(word < bm->size / UTIL_BITMASK_BITS_PER_WORD) { + while(bit < UTIL_BITMASK_BITS_PER_WORD) { + if(bm->words[word] & mask) { + if(index == bm->filled) { + ++bm->filled; + assert(bm->filled <= bm->size); + } + return index; + } + ++index; + ++bit; + mask <<= 1; + } + ++word; + bit = 0; + mask = 1; + } + + return UTIL_BITMASK_INVALID_INDEX; +} + + +unsigned +util_bitmask_get_first_index(struct util_bitmask *bm) +{ + return util_bitmask_get_next_index(bm, 0); +} + + +void +util_bitmask_destroy(struct util_bitmask *bm) +{ + assert(bm); + + FREE(bm->words); + FREE(bm); +} + diff --git a/mesalib/src/gallium/auxiliary/util/u_bitmask.h b/mesalib/src/gallium/auxiliary/util/u_bitmask.h index 179328ae9..98b85ddec 100644 --- a/mesalib/src/gallium/auxiliary/util/u_bitmask.h +++ b/mesalib/src/gallium/auxiliary/util/u_bitmask.h @@ -1,117 +1,117 @@ -/************************************************************************** - * - * Copyright 2009 VMware, 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 VMWARE 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 - * Generic bitmask. - * - * @author Jose Fonseca - */ - -#ifndef U_HANDLE_BITMASK_H_ -#define U_HANDLE_BITMASK_H_ - - -#include "pipe/p_compiler.h" - - -#ifdef __cplusplus -extern "C" { -#endif - - -#define UTIL_BITMASK_INVALID_INDEX (~0U) - - -/** - * Abstract data type to represent arbitrary set of bits. - */ -struct util_bitmask; - - -struct util_bitmask * -util_bitmask_create(void); - - -/** - * Search a cleared bit and set it. - * - * It searches for the first cleared bit. - * - * Returns the bit index on success, or UTIL_BITMASK_INVALID_INDEX on out of - * memory growing the bitmask. - */ -unsigned -util_bitmask_add(struct util_bitmask *bm); - -/** - * Set a bit. - * - * Returns the input index on success, or UTIL_BITMASK_INVALID_INDEX on out of - * memory growing the bitmask. - */ -unsigned -util_bitmask_set(struct util_bitmask *bm, - unsigned index); - -void -util_bitmask_clear(struct util_bitmask *bm, - unsigned index); - -boolean -util_bitmask_get(struct util_bitmask *bm, - unsigned index); - - -void -util_bitmask_destroy(struct util_bitmask *bm); - - -/** - * Search for the first set bit. - * - * Returns UTIL_BITMASK_INVALID_INDEX if a set bit cannot be found. - */ -unsigned -util_bitmask_get_first_index(struct util_bitmask *bm); - - -/** - * Search for the first set bit, starting from the giving index. - * - * Returns UTIL_BITMASK_INVALID_INDEX if a set bit cannot be found. - */ -unsigned -util_bitmask_get_next_index(struct util_bitmask *bm, - unsigned index); - - -#ifdef __cplusplus -} -#endif - -#endif /* U_HANDLE_BITMASK_H_ */ +/************************************************************************** + * + * Copyright 2009 VMware, 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 VMWARE 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 + * Generic bitmask. + * + * @author Jose Fonseca + */ + +#ifndef U_HANDLE_BITMASK_H_ +#define U_HANDLE_BITMASK_H_ + + +#include "pipe/p_compiler.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +#define UTIL_BITMASK_INVALID_INDEX (~0U) + + +/** + * Abstract data type to represent arbitrary set of bits. + */ +struct util_bitmask; + + +struct util_bitmask * +util_bitmask_create(void); + + +/** + * Search a cleared bit and set it. + * + * It searches for the first cleared bit. + * + * Returns the bit index on success, or UTIL_BITMASK_INVALID_INDEX on out of + * memory growing the bitmask. + */ +unsigned +util_bitmask_add(struct util_bitmask *bm); + +/** + * Set a bit. + * + * Returns the input index on success, or UTIL_BITMASK_INVALID_INDEX on out of + * memory growing the bitmask. + */ +unsigned +util_bitmask_set(struct util_bitmask *bm, + unsigned index); + +void +util_bitmask_clear(struct util_bitmask *bm, + unsigned index); + +boolean +util_bitmask_get(struct util_bitmask *bm, + unsigned index); + + +void +util_bitmask_destroy(struct util_bitmask *bm); + + +/** + * Search for the first set bit. + * + * Returns UTIL_BITMASK_INVALID_INDEX if a set bit cannot be found. + */ +unsigned +util_bitmask_get_first_index(struct util_bitmask *bm); + + +/** + * Search for the first set bit, starting from the giving index. + * + * Returns UTIL_BITMASK_INVALID_INDEX if a set bit cannot be found. + */ +unsigned +util_bitmask_get_next_index(struct util_bitmask *bm, + unsigned index); + + +#ifdef __cplusplus +} +#endif + +#endif /* U_HANDLE_BITMASK_H_ */ diff --git a/mesalib/src/gallium/auxiliary/util/u_box.h b/mesalib/src/gallium/auxiliary/util/u_box.h index f2f0829b5..0b28d0f12 100644 --- a/mesalib/src/gallium/auxiliary/util/u_box.h +++ b/mesalib/src/gallium/auxiliary/util/u_box.h @@ -1,80 +1,80 @@ -#ifndef UTIL_BOX_INLINES_H -#define UTIL_BOX_INLINES_H - -#include "pipe/p_state.h" - -static INLINE -void u_box_1d( unsigned x, - unsigned w, - struct pipe_box *box ) -{ - box->x = x; - box->y = 0; - box->z = 0; - box->width = w; - box->height = 1; - box->depth = 1; -} - -static INLINE -void u_box_2d( unsigned x, - unsigned y, - unsigned w, - unsigned h, - struct pipe_box *box ) -{ - box->x = x; - box->y = y; - box->z = 0; - box->width = w; - box->height = h; - box->depth = 1; -} - -static INLINE -void u_box_origin_2d( unsigned w, - unsigned h, - struct pipe_box *box ) -{ - box->x = 0; - box->y = 0; - box->z = 0; - box->width = w; - box->height = h; - box->depth = 1; -} - -static INLINE -void u_box_2d_zslice( unsigned x, - unsigned y, - unsigned z, - unsigned w, - unsigned h, - struct pipe_box *box ) -{ - box->x = x; - box->y = y; - box->z = z; - box->width = w; - box->height = h; - box->depth = 1; -} - -static INLINE -void u_box_3d( unsigned x, - unsigned y, - unsigned z, - unsigned w, - unsigned h, - unsigned d, - struct pipe_box *box ) -{ - box->x = x; - box->y = y; - box->z = z; - box->width = w; - box->height = h; - box->depth = d; -} - -#endif +#ifndef UTIL_BOX_INLINES_H +#define UTIL_BOX_INLINES_H + +#include "pipe/p_state.h" + +static INLINE +void u_box_1d( unsigned x, + unsigned w, + struct pipe_box *box ) +{ + box->x = x; + box->y = 0; + box->z = 0; + box->width = w; + box->height = 1; + box->depth = 1; +} + +static INLINE +void u_box_2d( unsigned x, + unsigned y, + unsigned w, + unsigned h, + struct pipe_box *box ) +{ + box->x = x; + box->y = y; + box->z = 0; + box->width = w; + box->height = h; + box->depth = 1; +} + +static INLINE +void u_box_origin_2d( unsigned w, + unsigned h, + struct pipe_box *box ) +{ + box->x = 0; + box->y = 0; + box->z = 0; + box->width = w; + box->height = h; + box->depth = 1; +} + +static INLINE +void u_box_2d_zslice( unsigned x, + unsigned y, + unsigned z, + unsigned w, + unsigned h, + struct pipe_box *box ) +{ + box->x = x; + box->y = y; + box->z = z; + box->width = w; + box->height = h; + box->depth = 1; +} + +static INLINE +void u_box_3d( unsigned x, + unsigned y, + unsigned z, + unsigned w, + unsigned h, + unsigned d, + struct pipe_box *box ) +{ + box->x = x; + box->y = y; + box->z = z; + box->width = w; + box->height = h; + box->depth = d; +} + +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_cache.c b/mesalib/src/gallium/auxiliary/util/u_cache.c index 215236818..df08ec302 100644 --- a/mesalib/src/gallium/auxiliary/util/u_cache.c +++ b/mesalib/src/gallium/auxiliary/util/u_cache.c @@ -1,351 +1,351 @@ -/************************************************************************** - * - * Copyright 2008 VMware, 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 VMWARE 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 - * Improved cache implementation. - * - * Fixed size array with linear probing on collision and LRU eviction - * on full. - * - * @author Jose Fonseca - */ - - -#include "pipe/p_compiler.h" -#include "util/u_debug.h" - -#include "util/u_math.h" -#include "util/u_memory.h" -#include "util/u_cache.h" -#include "util/u_simple_list.h" - - -struct util_cache_entry -{ - enum { EMPTY = 0, FILLED, DELETED } state; - uint32_t hash; - - struct util_cache_entry *next; - struct util_cache_entry *prev; - - void *key; - void *value; - -#ifdef DEBUG - unsigned count; -#endif -}; - - -struct util_cache -{ - /** Hash function */ - uint32_t (*hash)(const void *key); - - /** Compare two keys */ - int (*compare)(const void *key1, const void *key2); - - /** Destroy a (key, value) pair */ - void (*destroy)(void *key, void *value); - - uint32_t size; - - struct util_cache_entry *entries; - - unsigned count; - struct util_cache_entry lru; -}; - -static void -ensure_sanity(const struct util_cache *cache); - -#define CACHE_DEFAULT_ALPHA 2 - -struct util_cache * -util_cache_create(uint32_t (*hash)(const void *key), - int (*compare)(const void *key1, const void *key2), - void (*destroy)(void *key, void *value), - uint32_t size) -{ - struct util_cache *cache; - - cache = CALLOC_STRUCT(util_cache); - if(!cache) - return NULL; - - cache->hash = hash; - cache->compare = compare; - cache->destroy = destroy; - - make_empty_list(&cache->lru); - - size *= CACHE_DEFAULT_ALPHA; - cache->size = size; - - cache->entries = CALLOC(size, sizeof(struct util_cache_entry)); - if(!cache->entries) { - FREE(cache); - return NULL; - } - - ensure_sanity(cache); - return cache; -} - - -static struct util_cache_entry * -util_cache_entry_get(struct util_cache *cache, - uint32_t hash, - const void *key) -{ - struct util_cache_entry *first_unfilled = NULL; - uint32_t index = hash % cache->size; - uint32_t probe; - - /* Probe until we find either a matching FILLED entry or an EMPTY - * slot (which has never been occupied). - * - * Deleted or non-matching slots are not indicative of completion - * as a previous linear probe for the same key could have continued - * past this point. - */ - for (probe = 0; probe < cache->size; probe++) { - uint32_t i = (index + probe) % cache->size; - struct util_cache_entry *current = &cache->entries[i]; - - if (current->state == FILLED) { - if (current->hash == hash && - cache->compare(key, current->key) == 0) - return current; - } - else { - if (!first_unfilled) - first_unfilled = current; - - if (current->state == EMPTY) - return first_unfilled; - } - } - - return NULL; -} - -static INLINE void -util_cache_entry_destroy(struct util_cache *cache, - struct util_cache_entry *entry) -{ - void *key = entry->key; - void *value = entry->value; - - entry->key = NULL; - entry->value = NULL; - - if (entry->state == FILLED) { - remove_from_list(entry); - cache->count--; - - if(cache->destroy) - cache->destroy(key, value); - - entry->state = DELETED; - } -} - - -void -util_cache_set(struct util_cache *cache, - void *key, - void *value) -{ - struct util_cache_entry *entry; - uint32_t hash = cache->hash(key); - - assert(cache); - if (!cache) - return; - - entry = util_cache_entry_get(cache, hash, key); - if (!entry) - entry = cache->lru.prev; - - if (cache->count >= cache->size / CACHE_DEFAULT_ALPHA) - util_cache_entry_destroy(cache, cache->lru.prev); - - util_cache_entry_destroy(cache, entry); - -#ifdef DEBUG - ++entry->count; -#endif - - entry->key = key; - entry->hash = hash; - entry->value = value; - entry->state = FILLED; - insert_at_head(&cache->lru, entry); - cache->count++; - - ensure_sanity(cache); -} - - -void * -util_cache_get(struct util_cache *cache, - const void *key) -{ - struct util_cache_entry *entry; - uint32_t hash = cache->hash(key); - - assert(cache); - if (!cache) - return NULL; - - entry = util_cache_entry_get(cache, hash, key); - if (!entry) - return NULL; - - if (entry->state == FILLED) - move_to_head(&cache->lru, entry); - - return entry->value; -} - - -void -util_cache_clear(struct util_cache *cache) -{ - uint32_t i; - - assert(cache); - if (!cache) - return; - - for(i = 0; i < cache->size; ++i) { - util_cache_entry_destroy(cache, &cache->entries[i]); - cache->entries[i].state = EMPTY; - } - - assert(cache->count == 0); - assert(is_empty_list(&cache->lru)); - ensure_sanity(cache); -} - - -void -util_cache_destroy(struct util_cache *cache) -{ - assert(cache); - if (!cache) - return; - -#ifdef DEBUG - if(cache->count >= 20*cache->size) { - /* Normal approximation of the Poisson distribution */ - double mean = (double)cache->count/(double)cache->size; - double stddev = sqrt(mean); - unsigned i; - for(i = 0; i < cache->size; ++i) { - double z = fabs(cache->entries[i].count - mean)/stddev; - /* This assert should not fail 99.9999998027% of the times, unless - * the hash function is a poor one */ - assert(z <= 6.0); - } - } -#endif - - util_cache_clear(cache); - - FREE(cache->entries); - FREE(cache); -} - - -void -util_cache_remove(struct util_cache *cache, - const void *key) -{ - struct util_cache_entry *entry; - uint32_t hash; - - assert(cache); - if (!cache) - return; - - hash = cache->hash(key); - - entry = util_cache_entry_get(cache, hash, key); - if (!entry) - return; - - if (entry->state == FILLED) - util_cache_entry_destroy(cache, entry); - - ensure_sanity(cache); -} - - -static void -ensure_sanity(const struct util_cache *cache) -{ -#ifdef DEBUG - unsigned i, cnt = 0; - - assert(cache); - for (i = 0; i < cache->size; i++) { - struct util_cache_entry *header = &cache->entries[i]; - - assert(header); - assert(header->state == FILLED || - header->state == EMPTY || - header->state == DELETED); - if (header->state == FILLED) { - cnt++; - assert(header->hash == cache->hash(header->key)); - } - } - - assert(cnt == cache->count); - assert(cache->size >= cnt); - - if (cache->count == 0) { - assert (is_empty_list(&cache->lru)); - } - else { - struct util_cache_entry *header = cache->lru.next; - - assert (header); - assert (!is_empty_list(&cache->lru)); - - for (i = 0; i < cache->count; i++) - header = header->next; - - assert(header == &cache->lru); - } -#endif - - (void)cache; -} +/************************************************************************** + * + * Copyright 2008 VMware, 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 VMWARE 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 + * Improved cache implementation. + * + * Fixed size array with linear probing on collision and LRU eviction + * on full. + * + * @author Jose Fonseca + */ + + +#include "pipe/p_compiler.h" +#include "util/u_debug.h" + +#include "util/u_math.h" +#include "util/u_memory.h" +#include "util/u_cache.h" +#include "util/u_simple_list.h" + + +struct util_cache_entry +{ + enum { EMPTY = 0, FILLED, DELETED } state; + uint32_t hash; + + struct util_cache_entry *next; + struct util_cache_entry *prev; + + void *key; + void *value; + +#ifdef DEBUG + unsigned count; +#endif +}; + + +struct util_cache +{ + /** Hash function */ + uint32_t (*hash)(const void *key); + + /** Compare two keys */ + int (*compare)(const void *key1, const void *key2); + + /** Destroy a (key, value) pair */ + void (*destroy)(void *key, void *value); + + uint32_t size; + + struct util_cache_entry *entries; + + unsigned count; + struct util_cache_entry lru; +}; + +static void +ensure_sanity(const struct util_cache *cache); + +#define CACHE_DEFAULT_ALPHA 2 + +struct util_cache * +util_cache_create(uint32_t (*hash)(const void *key), + int (*compare)(const void *key1, const void *key2), + void (*destroy)(void *key, void *value), + uint32_t size) +{ + struct util_cache *cache; + + cache = CALLOC_STRUCT(util_cache); + if(!cache) + return NULL; + + cache->hash = hash; + cache->compare = compare; + cache->destroy = destroy; + + make_empty_list(&cache->lru); + + size *= CACHE_DEFAULT_ALPHA; + cache->size = size; + + cache->entries = CALLOC(size, sizeof(struct util_cache_entry)); + if(!cache->entries) { + FREE(cache); + return NULL; + } + + ensure_sanity(cache); + return cache; +} + + +static struct util_cache_entry * +util_cache_entry_get(struct util_cache *cache, + uint32_t hash, + const void *key) +{ + struct util_cache_entry *first_unfilled = NULL; + uint32_t index = hash % cache->size; + uint32_t probe; + + /* Probe until we find either a matching FILLED entry or an EMPTY + * slot (which has never been occupied). + * + * Deleted or non-matching slots are not indicative of completion + * as a previous linear probe for the same key could have continued + * past this point. + */ + for (probe = 0; probe < cache->size; probe++) { + uint32_t i = (index + probe) % cache->size; + struct util_cache_entry *current = &cache->entries[i]; + + if (current->state == FILLED) { + if (current->hash == hash && + cache->compare(key, current->key) == 0) + return current; + } + else { + if (!first_unfilled) + first_unfilled = current; + + if (current->state == EMPTY) + return first_unfilled; + } + } + + return NULL; +} + +static INLINE void +util_cache_entry_destroy(struct util_cache *cache, + struct util_cache_entry *entry) +{ + void *key = entry->key; + void *value = entry->value; + + entry->key = NULL; + entry->value = NULL; + + if (entry->state == FILLED) { + remove_from_list(entry); + cache->count--; + + if(cache->destroy) + cache->destroy(key, value); + + entry->state = DELETED; + } +} + + +void +util_cache_set(struct util_cache *cache, + void *key, + void *value) +{ + struct util_cache_entry *entry; + uint32_t hash = cache->hash(key); + + assert(cache); + if (!cache) + return; + + entry = util_cache_entry_get(cache, hash, key); + if (!entry) + entry = cache->lru.prev; + + if (cache->count >= cache->size / CACHE_DEFAULT_ALPHA) + util_cache_entry_destroy(cache, cache->lru.prev); + + util_cache_entry_destroy(cache, entry); + +#ifdef DEBUG + ++entry->count; +#endif + + entry->key = key; + entry->hash = hash; + entry->value = value; + entry->state = FILLED; + insert_at_head(&cache->lru, entry); + cache->count++; + + ensure_sanity(cache); +} + + +void * +util_cache_get(struct util_cache *cache, + const void *key) +{ + struct util_cache_entry *entry; + uint32_t hash = cache->hash(key); + + assert(cache); + if (!cache) + return NULL; + + entry = util_cache_entry_get(cache, hash, key); + if (!entry) + return NULL; + + if (entry->state == FILLED) + move_to_head(&cache->lru, entry); + + return entry->value; +} + + +void +util_cache_clear(struct util_cache *cache) +{ + uint32_t i; + + assert(cache); + if (!cache) + return; + + for(i = 0; i < cache->size; ++i) { + util_cache_entry_destroy(cache, &cache->entries[i]); + cache->entries[i].state = EMPTY; + } + + assert(cache->count == 0); + assert(is_empty_list(&cache->lru)); + ensure_sanity(cache); +} + + +void +util_cache_destroy(struct util_cache *cache) +{ + assert(cache); + if (!cache) + return; + +#ifdef DEBUG + if(cache->count >= 20*cache->size) { + /* Normal approximation of the Poisson distribution */ + double mean = (double)cache->count/(double)cache->size; + double stddev = sqrt(mean); + unsigned i; + for(i = 0; i < cache->size; ++i) { + double z = fabs(cache->entries[i].count - mean)/stddev; + /* This assert should not fail 99.9999998027% of the times, unless + * the hash function is a poor one */ + assert(z <= 6.0); + } + } +#endif + + util_cache_clear(cache); + + FREE(cache->entries); + FREE(cache); +} + + +void +util_cache_remove(struct util_cache *cache, + const void *key) +{ + struct util_cache_entry *entry; + uint32_t hash; + + assert(cache); + if (!cache) + return; + + hash = cache->hash(key); + + entry = util_cache_entry_get(cache, hash, key); + if (!entry) + return; + + if (entry->state == FILLED) + util_cache_entry_destroy(cache, entry); + + ensure_sanity(cache); +} + + +static void +ensure_sanity(const struct util_cache *cache) +{ +#ifdef DEBUG + unsigned i, cnt = 0; + + assert(cache); + for (i = 0; i < cache->size; i++) { + struct util_cache_entry *header = &cache->entries[i]; + + assert(header); + assert(header->state == FILLED || + header->state == EMPTY || + header->state == DELETED); + if (header->state == FILLED) { + cnt++; + assert(header->hash == cache->hash(header->key)); + } + } + + assert(cnt == cache->count); + assert(cache->size >= cnt); + + if (cache->count == 0) { + assert (is_empty_list(&cache->lru)); + } + else { + struct util_cache_entry *header = cache->lru.next; + + assert (header); + assert (!is_empty_list(&cache->lru)); + + for (i = 0; i < cache->count; i++) + header = header->next; + + assert(header == &cache->lru); + } +#endif + + (void)cache; +} diff --git a/mesalib/src/gallium/auxiliary/util/u_cache.h b/mesalib/src/gallium/auxiliary/util/u_cache.h index f88ccb2b2..be3631b72 100644 --- a/mesalib/src/gallium/auxiliary/util/u_cache.h +++ b/mesalib/src/gallium/auxiliary/util/u_cache.h @@ -1,91 +1,91 @@ -/************************************************************************** - * - * Copyright 2008 VMware, 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 VMWARE 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 - * Simple cache. - * - * @author Jose Fonseca - */ - -#ifndef U_CACHE_H_ -#define U_CACHE_H_ - - -#include "pipe/p_compiler.h" - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Least Recently Used (LRU) cache. - */ -struct util_cache; - - -/** - * Create a cache. - * - * @param hash hash function - * @param compare should return 0 for two equal keys - * @param destroy destruction callback (optional) - * @param size maximum number of entries - */ -struct util_cache * -util_cache_create(uint32_t (*hash)(const void *key), - int (*compare)(const void *key1, const void *key2), - void (*destroy)(void *key, void *value), - uint32_t size); - -void -util_cache_set(struct util_cache *cache, - void *key, - void *value); - -void * -util_cache_get(struct util_cache *cache, - const void *key); - -void -util_cache_clear(struct util_cache *cache); - -void -util_cache_destroy(struct util_cache *cache); - -void -util_cache_remove(struct util_cache *cache, - const void *key); - - -#ifdef __cplusplus -} -#endif - -#endif /* U_CACHE_H_ */ +/************************************************************************** + * + * Copyright 2008 VMware, 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 VMWARE 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 + * Simple cache. + * + * @author Jose Fonseca + */ + +#ifndef U_CACHE_H_ +#define U_CACHE_H_ + + +#include "pipe/p_compiler.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * Least Recently Used (LRU) cache. + */ +struct util_cache; + + +/** + * Create a cache. + * + * @param hash hash function + * @param compare should return 0 for two equal keys + * @param destroy destruction callback (optional) + * @param size maximum number of entries + */ +struct util_cache * +util_cache_create(uint32_t (*hash)(const void *key), + int (*compare)(const void *key1, const void *key2), + void (*destroy)(void *key, void *value), + uint32_t size); + +void +util_cache_set(struct util_cache *cache, + void *key, + void *value); + +void * +util_cache_get(struct util_cache *cache, + const void *key); + +void +util_cache_clear(struct util_cache *cache); + +void +util_cache_destroy(struct util_cache *cache); + +void +util_cache_remove(struct util_cache *cache, + const void *key); + + +#ifdef __cplusplus +} +#endif + +#endif /* U_CACHE_H_ */ diff --git a/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c b/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c index 28929d174..e0c8f73c7 100644 --- a/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c @@ -1,343 +1,343 @@ -/************************************************************************** - * - * Copyright 2008 Dennis Smit - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to 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 - * AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -/** - * @file - * CPU feature detection. - * - * @author Dennis Smit - * @author Based on the work of Eric Anholt - */ - -#include "pipe/p_config.h" - -#include "u_debug.h" -#include "u_cpu_detect.h" - -#if defined(PIPE_ARCH_PPC) -#if defined(PIPE_OS_APPLE) -#include -#else -#include -#include -#endif -#endif - -#if defined(PIPE_OS_NETBSD) || defined(PIPE_OS_OPENBSD) -#include -#include -#include -#endif - -#if defined(PIPE_OS_FREEBSD) -#include -#include -#endif - -#if defined(PIPE_OS_LINUX) -#include -#endif - -#ifdef PIPE_OS_UNIX -#include -#endif - -#if defined(PIPE_OS_WINDOWS) -#include -#if defined(MSVC) -#include -#endif -#endif - - -#ifdef DEBUG -DEBUG_GET_ONCE_BOOL_OPTION(dump_cpu, "GALLIUM_DUMP_CPU", FALSE) -#endif - - -struct util_cpu_caps util_cpu_caps; - -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) -static int has_cpuid(void); -#endif - - -#if defined(PIPE_ARCH_PPC) && !defined(PIPE_OS_APPLE) -static jmp_buf __lv_powerpc_jmpbuf; -static volatile sig_atomic_t __lv_powerpc_canjump = 0; - -static void -sigill_handler(int sig) -{ - if (!__lv_powerpc_canjump) { - signal (sig, SIG_DFL); - raise (sig); - } - - __lv_powerpc_canjump = 0; - longjmp(__lv_powerpc_jmpbuf, 1); -} -#endif - -#if defined(PIPE_ARCH_PPC) -static void -check_os_altivec_support(void) -{ -#if defined(PIPE_OS_APPLE) - int sels[2] = {CTL_HW, HW_VECTORUNIT}; - int has_vu = 0; - int len = sizeof (has_vu); - int err; - - err = sysctl(sels, 2, &has_vu, &len, NULL, 0); - - if (err == 0) { - if (has_vu != 0) { - util_cpu_caps.has_altivec = 1; - } - } -#else /* !PIPE_OS_APPLE */ - /* not on Apple/Darwin, do it the brute-force way */ - /* this is borrowed from the libmpeg2 library */ - signal(SIGILL, sigill_handler); - if (setjmp(__lv_powerpc_jmpbuf)) { - signal(SIGILL, SIG_DFL); - } else { - __lv_powerpc_canjump = 1; - - __asm __volatile - ("mtspr 256, %0\n\t" - "vand %%v0, %%v0, %%v0" - : - : "r" (-1)); - - signal(SIGILL, SIG_DFL); - util_cpu_caps.has_altivec = 1; - } -#endif /* !PIPE_OS_APPLE */ -} -#endif /* PIPE_ARCH_PPC */ - - -#if defined(PIPE_ARCH_X86) || defined (PIPE_ARCH_X86_64) -static int has_cpuid(void) -{ -#if defined(PIPE_ARCH_X86) -#if defined(PIPE_OS_GCC) - int a, c; - - __asm __volatile - ("pushf\n" - "popl %0\n" - "movl %0, %1\n" - "xorl $0x200000, %0\n" - "push %0\n" - "popf\n" - "pushf\n" - "popl %0\n" - : "=a" (a), "=c" (c) - : - : "cc"); - - return a != c; -#else - /* FIXME */ - return 1; -#endif -#elif defined(PIPE_ARCH_X86_64) - return 1; -#else - return 0; -#endif -} - - -/** - * @sa cpuid.h included in gcc-4.3 onwards. - * @sa http://msdn.microsoft.com/en-us/library/hskdteyh.aspx - */ -static INLINE void -cpuid(uint32_t ax, uint32_t *p) -{ -#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86) - __asm __volatile ( - "xchgl %%ebx, %1\n\t" - "cpuid\n\t" - "xchgl %%ebx, %1" - : "=a" (p[0]), - "=S" (p[1]), - "=c" (p[2]), - "=d" (p[3]) - : "0" (ax) - ); -#elif defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64) - __asm __volatile ( - "cpuid\n\t" - : "=a" (p[0]), - "=b" (p[1]), - "=c" (p[2]), - "=d" (p[3]) - : "0" (ax) - ); -#elif defined(PIPE_CC_MSVC) - __cpuid(p, ax); -#else - p[0] = 0; - p[1] = 0; - p[2] = 0; - p[3] = 0; -#endif -} -#endif /* X86 or X86_64 */ - -void -util_cpu_detect(void) -{ - static boolean util_cpu_detect_initialized = FALSE; - - if(util_cpu_detect_initialized) - return; - - memset(&util_cpu_caps, 0, sizeof util_cpu_caps); - - /* Count the number of CPUs in system */ -#if defined(PIPE_OS_WINDOWS) - { - SYSTEM_INFO system_info; - GetSystemInfo(&system_info); - util_cpu_caps.nr_cpus = system_info.dwNumberOfProcessors; - } -#elif defined(PIPE_OS_UNIX) && defined(_SC_NPROCESSORS_ONLN) - util_cpu_caps.nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); - if (util_cpu_caps.nr_cpus == -1) - util_cpu_caps.nr_cpus = 1; -#elif defined(PIPE_OS_BSD) - { - int mib[2], ncpu; - int len; - - mib[0] = CTL_HW; - mib[1] = HW_NCPU; - - len = sizeof (ncpu); - sysctl(mib, 2, &ncpu, &len, NULL, 0); - util_cpu_caps.nr_cpus = ncpu; - } -#else - util_cpu_caps.nr_cpus = 1; -#endif - -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) - if (has_cpuid()) { - uint32_t regs[4]; - uint32_t regs2[4]; - - util_cpu_caps.cacheline = 32; - - /* Get max cpuid level */ - cpuid(0x00000000, regs); - - if (regs[0] >= 0x00000001) { - unsigned int cacheline; - - cpuid (0x00000001, regs2); - - util_cpu_caps.x86_cpu_type = (regs2[0] >> 8) & 0xf; - if (util_cpu_caps.x86_cpu_type == 0xf) - util_cpu_caps.x86_cpu_type = 8 + ((regs2[0] >> 20) & 255); /* use extended family (P4, IA64) */ - - /* general feature flags */ - util_cpu_caps.has_tsc = (regs2[3] >> 8) & 1; /* 0x0000010 */ - util_cpu_caps.has_mmx = (regs2[3] >> 23) & 1; /* 0x0800000 */ - util_cpu_caps.has_sse = (regs2[3] >> 25) & 1; /* 0x2000000 */ - util_cpu_caps.has_sse2 = (regs2[3] >> 26) & 1; /* 0x4000000 */ - util_cpu_caps.has_sse3 = (regs2[2] >> 0) & 1; /* 0x0000001 */ - util_cpu_caps.has_ssse3 = (regs2[2] >> 9) & 1; /* 0x0000020 */ - util_cpu_caps.has_sse4_1 = (regs2[2] >> 19) & 1; - util_cpu_caps.has_sse4_2 = (regs2[2] >> 20) & 1; - util_cpu_caps.has_avx = (regs2[2] >> 28) & 1; - util_cpu_caps.has_mmx2 = util_cpu_caps.has_sse; /* SSE cpus supports mmxext too */ - - cacheline = ((regs2[1] >> 8) & 0xFF) * 8; - if (cacheline > 0) - util_cpu_caps.cacheline = cacheline; - } - - cpuid(0x80000000, regs); - - if (regs[0] >= 0x80000001) { - - cpuid(0x80000001, regs2); - - util_cpu_caps.has_mmx |= (regs2[3] >> 23) & 1; - util_cpu_caps.has_mmx2 |= (regs2[3] >> 22) & 1; - util_cpu_caps.has_3dnow = (regs2[3] >> 31) & 1; - util_cpu_caps.has_3dnow_ext = (regs2[3] >> 30) & 1; - } - - if (regs[0] >= 0x80000006) { - cpuid(0x80000006, regs2); - util_cpu_caps.cacheline = regs2[2] & 0xFF; - } - - if (!util_cpu_caps.has_sse) { - util_cpu_caps.has_sse2 = 0; - util_cpu_caps.has_sse3 = 0; - util_cpu_caps.has_ssse3 = 0; - util_cpu_caps.has_sse4_1 = 0; - } - } -#endif /* PIPE_ARCH_X86 || PIPE_ARCH_X86_64 */ - -#if defined(PIPE_ARCH_PPC) - check_os_altivec_support(); -#endif /* PIPE_ARCH_PPC */ - -#ifdef DEBUG - if (debug_get_option_dump_cpu()) { - debug_printf("util_cpu_caps.nr_cpus = %u\n", util_cpu_caps.nr_cpus); - - debug_printf("util_cpu_caps.x86_cpu_type = %u\n", util_cpu_caps.x86_cpu_type); - debug_printf("util_cpu_caps.cacheline = %u\n", util_cpu_caps.cacheline); - - debug_printf("util_cpu_caps.has_tsc = %u\n", util_cpu_caps.has_tsc); - debug_printf("util_cpu_caps.has_mmx = %u\n", util_cpu_caps.has_mmx); - debug_printf("util_cpu_caps.has_mmx2 = %u\n", util_cpu_caps.has_mmx2); - debug_printf("util_cpu_caps.has_sse = %u\n", util_cpu_caps.has_sse); - debug_printf("util_cpu_caps.has_sse2 = %u\n", util_cpu_caps.has_sse2); - debug_printf("util_cpu_caps.has_sse3 = %u\n", util_cpu_caps.has_sse3); - debug_printf("util_cpu_caps.has_ssse3 = %u\n", util_cpu_caps.has_ssse3); - debug_printf("util_cpu_caps.has_sse4_1 = %u\n", util_cpu_caps.has_sse4_1); - debug_printf("util_cpu_caps.has_sse4_2 = %u\n", util_cpu_caps.has_sse4_2); - debug_printf("util_cpu_caps.has_avx = %u\n", util_cpu_caps.has_avx); - debug_printf("util_cpu_caps.has_3dnow = %u\n", util_cpu_caps.has_3dnow); - debug_printf("util_cpu_caps.has_3dnow_ext = %u\n", util_cpu_caps.has_3dnow_ext); - debug_printf("util_cpu_caps.has_altivec = %u\n", util_cpu_caps.has_altivec); - } -#endif - - util_cpu_detect_initialized = TRUE; -} +/************************************************************************** + * + * Copyright 2008 Dennis Smit + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to 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 + * AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/** + * @file + * CPU feature detection. + * + * @author Dennis Smit + * @author Based on the work of Eric Anholt + */ + +#include "pipe/p_config.h" + +#include "u_debug.h" +#include "u_cpu_detect.h" + +#if defined(PIPE_ARCH_PPC) +#if defined(PIPE_OS_APPLE) +#include +#else +#include +#include +#endif +#endif + +#if defined(PIPE_OS_NETBSD) || defined(PIPE_OS_OPENBSD) +#include +#include +#include +#endif + +#if defined(PIPE_OS_FREEBSD) +#include +#include +#endif + +#if defined(PIPE_OS_LINUX) +#include +#endif + +#ifdef PIPE_OS_UNIX +#include +#endif + +#if defined(PIPE_OS_WINDOWS) +#include +#if defined(MSVC) +#include +#endif +#endif + + +#ifdef DEBUG +DEBUG_GET_ONCE_BOOL_OPTION(dump_cpu, "GALLIUM_DUMP_CPU", FALSE) +#endif + + +struct util_cpu_caps util_cpu_caps; + +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) +static int has_cpuid(void); +#endif + + +#if defined(PIPE_ARCH_PPC) && !defined(PIPE_OS_APPLE) +static jmp_buf __lv_powerpc_jmpbuf; +static volatile sig_atomic_t __lv_powerpc_canjump = 0; + +static void +sigill_handler(int sig) +{ + if (!__lv_powerpc_canjump) { + signal (sig, SIG_DFL); + raise (sig); + } + + __lv_powerpc_canjump = 0; + longjmp(__lv_powerpc_jmpbuf, 1); +} +#endif + +#if defined(PIPE_ARCH_PPC) +static void +check_os_altivec_support(void) +{ +#if defined(PIPE_OS_APPLE) + int sels[2] = {CTL_HW, HW_VECTORUNIT}; + int has_vu = 0; + int len = sizeof (has_vu); + int err; + + err = sysctl(sels, 2, &has_vu, &len, NULL, 0); + + if (err == 0) { + if (has_vu != 0) { + util_cpu_caps.has_altivec = 1; + } + } +#else /* !PIPE_OS_APPLE */ + /* not on Apple/Darwin, do it the brute-force way */ + /* this is borrowed from the libmpeg2 library */ + signal(SIGILL, sigill_handler); + if (setjmp(__lv_powerpc_jmpbuf)) { + signal(SIGILL, SIG_DFL); + } else { + __lv_powerpc_canjump = 1; + + __asm __volatile + ("mtspr 256, %0\n\t" + "vand %%v0, %%v0, %%v0" + : + : "r" (-1)); + + signal(SIGILL, SIG_DFL); + util_cpu_caps.has_altivec = 1; + } +#endif /* !PIPE_OS_APPLE */ +} +#endif /* PIPE_ARCH_PPC */ + + +#if defined(PIPE_ARCH_X86) || defined (PIPE_ARCH_X86_64) +static int has_cpuid(void) +{ +#if defined(PIPE_ARCH_X86) +#if defined(PIPE_OS_GCC) + int a, c; + + __asm __volatile + ("pushf\n" + "popl %0\n" + "movl %0, %1\n" + "xorl $0x200000, %0\n" + "push %0\n" + "popf\n" + "pushf\n" + "popl %0\n" + : "=a" (a), "=c" (c) + : + : "cc"); + + return a != c; +#else + /* FIXME */ + return 1; +#endif +#elif defined(PIPE_ARCH_X86_64) + return 1; +#else + return 0; +#endif +} + + +/** + * @sa cpuid.h included in gcc-4.3 onwards. + * @sa http://msdn.microsoft.com/en-us/library/hskdteyh.aspx + */ +static INLINE void +cpuid(uint32_t ax, uint32_t *p) +{ +#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86) + __asm __volatile ( + "xchgl %%ebx, %1\n\t" + "cpuid\n\t" + "xchgl %%ebx, %1" + : "=a" (p[0]), + "=S" (p[1]), + "=c" (p[2]), + "=d" (p[3]) + : "0" (ax) + ); +#elif defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64) + __asm __volatile ( + "cpuid\n\t" + : "=a" (p[0]), + "=b" (p[1]), + "=c" (p[2]), + "=d" (p[3]) + : "0" (ax) + ); +#elif defined(PIPE_CC_MSVC) + __cpuid(p, ax); +#else + p[0] = 0; + p[1] = 0; + p[2] = 0; + p[3] = 0; +#endif +} +#endif /* X86 or X86_64 */ + +void +util_cpu_detect(void) +{ + static boolean util_cpu_detect_initialized = FALSE; + + if(util_cpu_detect_initialized) + return; + + memset(&util_cpu_caps, 0, sizeof util_cpu_caps); + + /* Count the number of CPUs in system */ +#if defined(PIPE_OS_WINDOWS) + { + SYSTEM_INFO system_info; + GetSystemInfo(&system_info); + util_cpu_caps.nr_cpus = system_info.dwNumberOfProcessors; + } +#elif defined(PIPE_OS_UNIX) && defined(_SC_NPROCESSORS_ONLN) + util_cpu_caps.nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); + if (util_cpu_caps.nr_cpus == -1) + util_cpu_caps.nr_cpus = 1; +#elif defined(PIPE_OS_BSD) + { + int mib[2], ncpu; + int len; + + mib[0] = CTL_HW; + mib[1] = HW_NCPU; + + len = sizeof (ncpu); + sysctl(mib, 2, &ncpu, &len, NULL, 0); + util_cpu_caps.nr_cpus = ncpu; + } +#else + util_cpu_caps.nr_cpus = 1; +#endif + +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) + if (has_cpuid()) { + uint32_t regs[4]; + uint32_t regs2[4]; + + util_cpu_caps.cacheline = 32; + + /* Get max cpuid level */ + cpuid(0x00000000, regs); + + if (regs[0] >= 0x00000001) { + unsigned int cacheline; + + cpuid (0x00000001, regs2); + + util_cpu_caps.x86_cpu_type = (regs2[0] >> 8) & 0xf; + if (util_cpu_caps.x86_cpu_type == 0xf) + util_cpu_caps.x86_cpu_type = 8 + ((regs2[0] >> 20) & 255); /* use extended family (P4, IA64) */ + + /* general feature flags */ + util_cpu_caps.has_tsc = (regs2[3] >> 8) & 1; /* 0x0000010 */ + util_cpu_caps.has_mmx = (regs2[3] >> 23) & 1; /* 0x0800000 */ + util_cpu_caps.has_sse = (regs2[3] >> 25) & 1; /* 0x2000000 */ + util_cpu_caps.has_sse2 = (regs2[3] >> 26) & 1; /* 0x4000000 */ + util_cpu_caps.has_sse3 = (regs2[2] >> 0) & 1; /* 0x0000001 */ + util_cpu_caps.has_ssse3 = (regs2[2] >> 9) & 1; /* 0x0000020 */ + util_cpu_caps.has_sse4_1 = (regs2[2] >> 19) & 1; + util_cpu_caps.has_sse4_2 = (regs2[2] >> 20) & 1; + util_cpu_caps.has_avx = (regs2[2] >> 28) & 1; + util_cpu_caps.has_mmx2 = util_cpu_caps.has_sse; /* SSE cpus supports mmxext too */ + + cacheline = ((regs2[1] >> 8) & 0xFF) * 8; + if (cacheline > 0) + util_cpu_caps.cacheline = cacheline; + } + + cpuid(0x80000000, regs); + + if (regs[0] >= 0x80000001) { + + cpuid(0x80000001, regs2); + + util_cpu_caps.has_mmx |= (regs2[3] >> 23) & 1; + util_cpu_caps.has_mmx2 |= (regs2[3] >> 22) & 1; + util_cpu_caps.has_3dnow = (regs2[3] >> 31) & 1; + util_cpu_caps.has_3dnow_ext = (regs2[3] >> 30) & 1; + } + + if (regs[0] >= 0x80000006) { + cpuid(0x80000006, regs2); + util_cpu_caps.cacheline = regs2[2] & 0xFF; + } + + if (!util_cpu_caps.has_sse) { + util_cpu_caps.has_sse2 = 0; + util_cpu_caps.has_sse3 = 0; + util_cpu_caps.has_ssse3 = 0; + util_cpu_caps.has_sse4_1 = 0; + } + } +#endif /* PIPE_ARCH_X86 || PIPE_ARCH_X86_64 */ + +#if defined(PIPE_ARCH_PPC) + check_os_altivec_support(); +#endif /* PIPE_ARCH_PPC */ + +#ifdef DEBUG + if (debug_get_option_dump_cpu()) { + debug_printf("util_cpu_caps.nr_cpus = %u\n", util_cpu_caps.nr_cpus); + + debug_printf("util_cpu_caps.x86_cpu_type = %u\n", util_cpu_caps.x86_cpu_type); + debug_printf("util_cpu_caps.cacheline = %u\n", util_cpu_caps.cacheline); + + debug_printf("util_cpu_caps.has_tsc = %u\n", util_cpu_caps.has_tsc); + debug_printf("util_cpu_caps.has_mmx = %u\n", util_cpu_caps.has_mmx); + debug_printf("util_cpu_caps.has_mmx2 = %u\n", util_cpu_caps.has_mmx2); + debug_printf("util_cpu_caps.has_sse = %u\n", util_cpu_caps.has_sse); + debug_printf("util_cpu_caps.has_sse2 = %u\n", util_cpu_caps.has_sse2); + debug_printf("util_cpu_caps.has_sse3 = %u\n", util_cpu_caps.has_sse3); + debug_printf("util_cpu_caps.has_ssse3 = %u\n", util_cpu_caps.has_ssse3); + debug_printf("util_cpu_caps.has_sse4_1 = %u\n", util_cpu_caps.has_sse4_1); + debug_printf("util_cpu_caps.has_sse4_2 = %u\n", util_cpu_caps.has_sse4_2); + debug_printf("util_cpu_caps.has_avx = %u\n", util_cpu_caps.has_avx); + debug_printf("util_cpu_caps.has_3dnow = %u\n", util_cpu_caps.has_3dnow); + debug_printf("util_cpu_caps.has_3dnow_ext = %u\n", util_cpu_caps.has_3dnow_ext); + debug_printf("util_cpu_caps.has_altivec = %u\n", util_cpu_caps.has_altivec); + } +#endif + + util_cpu_detect_initialized = TRUE; +} diff --git a/mesalib/src/gallium/auxiliary/util/u_cpu_detect.h b/mesalib/src/gallium/auxiliary/util/u_cpu_detect.h index fa2f769ae..856e8d7a0 100644 --- a/mesalib/src/gallium/auxiliary/util/u_cpu_detect.h +++ b/mesalib/src/gallium/auxiliary/util/u_cpu_detect.h @@ -1,69 +1,69 @@ -/************************************************************************** - * - * Copyright 2008 Dennis Smit - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to 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 - * AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - ***************************************************************************/ - -/** - * @file - * CPU feature detection. - * - * @author Dennis Smit - * @author Based on the work of Eric Anholt - */ - -#ifndef _UTIL_CPU_DETECT_H -#define _UTIL_CPU_DETECT_H - -#include "pipe/p_compiler.h" -#include "pipe/p_config.h" - -struct util_cpu_caps { - unsigned nr_cpus; - - /* Feature flags */ - int x86_cpu_type; - unsigned cacheline; - - unsigned has_tsc:1; - unsigned has_mmx:1; - unsigned has_mmx2:1; - unsigned has_sse:1; - unsigned has_sse2:1; - unsigned has_sse3:1; - unsigned has_ssse3:1; - unsigned has_sse4_1:1; - unsigned has_sse4_2:1; - unsigned has_avx:1; - unsigned has_3dnow:1; - unsigned has_3dnow_ext:1; - unsigned has_altivec:1; -}; - -extern struct util_cpu_caps -util_cpu_caps; - -void util_cpu_detect(void); - - -#endif /* _UTIL_CPU_DETECT_H */ +/************************************************************************** + * + * Copyright 2008 Dennis Smit + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to 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 + * AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + ***************************************************************************/ + +/** + * @file + * CPU feature detection. + * + * @author Dennis Smit + * @author Based on the work of Eric Anholt + */ + +#ifndef _UTIL_CPU_DETECT_H +#define _UTIL_CPU_DETECT_H + +#include "pipe/p_compiler.h" +#include "pipe/p_config.h" + +struct util_cpu_caps { + unsigned nr_cpus; + + /* Feature flags */ + int x86_cpu_type; + unsigned cacheline; + + unsigned has_tsc:1; + unsigned has_mmx:1; + unsigned has_mmx2:1; + unsigned has_sse:1; + unsigned has_sse2:1; + unsigned has_sse3:1; + unsigned has_ssse3:1; + unsigned has_sse4_1:1; + unsigned has_sse4_2:1; + unsigned has_avx:1; + unsigned has_3dnow:1; + unsigned has_3dnow_ext:1; + unsigned has_altivec:1; +}; + +extern struct util_cpu_caps +util_cpu_caps; + +void util_cpu_detect(void); + + +#endif /* _UTIL_CPU_DETECT_H */ diff --git a/mesalib/src/gallium/auxiliary/util/u_debug_stack.h b/mesalib/src/gallium/auxiliary/util/u_debug_stack.h index 1d9a4a843..f50f04e0f 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug_stack.h +++ b/mesalib/src/gallium/auxiliary/util/u_debug_stack.h @@ -1,65 +1,65 @@ -/************************************************************************** - * - * Copyright 2009 VMware, 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 VMWARE 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 U_DEBUG_STACK_H_ -#define U_DEBUG_STACK_H_ - - -/** - * @file - * Stack backtracing. - * - * @author Jose Fonseca - */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -struct debug_stack_frame -{ - const void *function; -}; - - -void -debug_backtrace_capture(struct debug_stack_frame *backtrace, - unsigned start_frame, - unsigned nr_frames); - -void -debug_backtrace_dump(const struct debug_stack_frame *backtrace, - unsigned nr_frames); - - -#ifdef __cplusplus -} -#endif - -#endif /* U_DEBUG_STACK_H_ */ +/************************************************************************** + * + * Copyright 2009 VMware, 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 VMWARE 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 U_DEBUG_STACK_H_ +#define U_DEBUG_STACK_H_ + + +/** + * @file + * Stack backtracing. + * + * @author Jose Fonseca + */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +struct debug_stack_frame +{ + const void *function; +}; + + +void +debug_backtrace_capture(struct debug_stack_frame *backtrace, + unsigned start_frame, + unsigned nr_frames); + +void +debug_backtrace_dump(const struct debug_stack_frame *backtrace, + unsigned nr_frames); + + +#ifdef __cplusplus +} +#endif + +#endif /* U_DEBUG_STACK_H_ */ diff --git a/mesalib/src/gallium/auxiliary/util/u_debug_symbol.c b/mesalib/src/gallium/auxiliary/util/u_debug_symbol.c index b2f762c66..bae9be87a 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug_symbol.c +++ b/mesalib/src/gallium/auxiliary/util/u_debug_symbol.c @@ -1,243 +1,243 @@ -/************************************************************************** - * - * Copyright 2009 VMware, 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 VMWARE 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 - * Symbol lookup. - * - * @author Jose Fonseca - */ - -#include "pipe/p_compiler.h" -#include "os/os_thread.h" -#include "u_string.h" - -#include "u_debug.h" -#include "u_debug_symbol.h" -#include "u_hash_table.h" - -#if defined(PIPE_OS_WINDOWS) && defined(PIPE_ARCH_X86) - -#include -#include - -#include "dbghelp.h" - - -static BOOL bSymInitialized = FALSE; - -static HMODULE hModule_Dbghelp = NULL; - - -static -FARPROC WINAPI __GetProcAddress(LPCSTR lpProcName) -{ -#ifdef PIPE_CC_GCC - if (!hModule_Dbghelp) { - /* - * bfdhelp.dll is a dbghelp.dll look-alike replacement, which is able to - * understand MinGW symbols using BFD library. It is available from - * http://people.freedesktop.org/~jrfonseca/bfdhelp/ for now. - */ - hModule_Dbghelp = LoadLibraryA("bfdhelp.dll"); - } -#endif - - if (!hModule_Dbghelp) { - hModule_Dbghelp = LoadLibraryA("dbghelp.dll"); - if (!hModule_Dbghelp) { - return NULL; - } - } - - return GetProcAddress(hModule_Dbghelp, lpProcName); -} - - -typedef BOOL (WINAPI *PFNSYMINITIALIZE)(HANDLE, LPSTR, BOOL); -static PFNSYMINITIALIZE pfnSymInitialize = NULL; - -static -BOOL WINAPI j_SymInitialize(HANDLE hProcess, PSTR UserSearchPath, BOOL fInvadeProcess) -{ - if( - (pfnSymInitialize || (pfnSymInitialize = (PFNSYMINITIALIZE) __GetProcAddress("SymInitialize"))) - ) - return pfnSymInitialize(hProcess, UserSearchPath, fInvadeProcess); - else - return FALSE; -} - -typedef DWORD (WINAPI *PFNSYMSETOPTIONS)(DWORD); -static PFNSYMSETOPTIONS pfnSymSetOptions = NULL; - -static -DWORD WINAPI j_SymSetOptions(DWORD SymOptions) -{ - if( - (pfnSymSetOptions || (pfnSymSetOptions = (PFNSYMSETOPTIONS) __GetProcAddress("SymSetOptions"))) - ) - return pfnSymSetOptions(SymOptions); - else - return FALSE; -} - -typedef BOOL (WINAPI *PFNSYMGETSYMFROMADDR)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO); -static PFNSYMGETSYMFROMADDR pfnSymFromAddr = NULL; - -static -BOOL WINAPI j_SymFromAddr(HANDLE hProcess, DWORD64 Address, PDWORD64 Displacement, PSYMBOL_INFO Symbol) -{ - if( - (pfnSymFromAddr || (pfnSymFromAddr = (PFNSYMGETSYMFROMADDR) __GetProcAddress("SymFromAddr"))) - ) - return pfnSymFromAddr(hProcess, Address, Displacement, Symbol); - else - return FALSE; -} - - -static INLINE void -debug_symbol_name_dbghelp(const void *addr, char* buf, unsigned size) -{ - HANDLE hProcess; - BYTE symbolBuffer[1024]; - PSYMBOL_INFO pSymbol = (PSYMBOL_INFO) symbolBuffer; - DWORD64 dwDisplacement = 0; /* Displacement of the input address, relative to the start of the symbol */ - - hProcess = GetCurrentProcess(); - - memset(pSymbol, 0, sizeof *pSymbol); - pSymbol->SizeOfStruct = sizeof(symbolBuffer); - pSymbol->MaxNameLen = sizeof(symbolBuffer) - offsetof(SYMBOL_INFO, Name); - - if(!bSymInitialized) { - j_SymSetOptions(/* SYMOPT_UNDNAME | */ SYMOPT_LOAD_LINES); - if(j_SymInitialize(hProcess, NULL, TRUE)) - bSymInitialized = TRUE; - } - - if(!j_SymFromAddr(hProcess, (DWORD64)(uintptr_t)addr, &dwDisplacement, pSymbol)) - buf[0] = 0; - else - { - strncpy(buf, pSymbol->Name, size); - buf[size - 1] = 0; - } -} -#endif - -#ifdef __GLIBC__ -#include - -/* This can only provide dynamic symbols, or binary offsets into a file. - * - * To fix this, post-process the output with tools/addr2line.sh - */ -static INLINE void -debug_symbol_name_glibc(const void *addr, char* buf, unsigned size) -{ - char** syms = backtrace_symbols((void**)&addr, 1); - strncpy(buf, syms[0], size); - buf[size - 1] = 0; - free(syms); -} -#endif - -void -debug_symbol_name(const void *addr, char* buf, unsigned size) -{ -#if defined(PIPE_OS_WINDOWS) && defined(PIPE_ARCH_X86) - debug_symbol_name_dbghelp(addr, buf, size); - if(buf[0]) - return; -#endif - -#ifdef __GLIBC__ - debug_symbol_name_glibc(addr, buf, size); - if(buf[0]) - return; -#endif - - util_snprintf(buf, size, "%p", addr); - buf[size - 1] = 0; -} - -void -debug_symbol_print(const void *addr) -{ - char buf[1024]; - debug_symbol_name(addr, buf, sizeof(buf)); - debug_printf("\t%s\n", buf); -} - -struct util_hash_table* symbols_hash; -pipe_static_mutex(symbols_mutex); - -static unsigned hash_ptr(void* p) -{ - return (unsigned)(uintptr_t)p; -} - -static int compare_ptr(void* a, void* b) -{ - if(a == b) - return 0; - else if(a < b) - return -1; - else - return 1; -} - -const char* -debug_symbol_name_cached(const void *addr) -{ - const char* name; -#ifdef PIPE_SUBSYSTEM_WINDOWS_USER - static boolean first = TRUE; - - if (first) { - pipe_mutex_init(symbols_mutex); - first = FALSE; - } -#endif - - pipe_mutex_lock(symbols_mutex); - if(!symbols_hash) - symbols_hash = util_hash_table_create(hash_ptr, compare_ptr); - name = util_hash_table_get(symbols_hash, (void*)addr); - if(!name) - { - char buf[1024]; - debug_symbol_name(addr, buf, sizeof(buf)); - name = strdup(buf); - - util_hash_table_set(symbols_hash, (void*)addr, (void*)name); - } - pipe_mutex_unlock(symbols_mutex); - return name; -} +/************************************************************************** + * + * Copyright 2009 VMware, 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 VMWARE 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 + * Symbol lookup. + * + * @author Jose Fonseca + */ + +#include "pipe/p_compiler.h" +#include "os/os_thread.h" +#include "u_string.h" + +#include "u_debug.h" +#include "u_debug_symbol.h" +#include "u_hash_table.h" + +#if defined(PIPE_OS_WINDOWS) && defined(PIPE_ARCH_X86) + +#include +#include + +#include "dbghelp.h" + + +static BOOL bSymInitialized = FALSE; + +static HMODULE hModule_Dbghelp = NULL; + + +static +FARPROC WINAPI __GetProcAddress(LPCSTR lpProcName) +{ +#ifdef PIPE_CC_GCC + if (!hModule_Dbghelp) { + /* + * bfdhelp.dll is a dbghelp.dll look-alike replacement, which is able to + * understand MinGW symbols using BFD library. It is available from + * http://people.freedesktop.org/~jrfonseca/bfdhelp/ for now. + */ + hModule_Dbghelp = LoadLibraryA("bfdhelp.dll"); + } +#endif + + if (!hModule_Dbghelp) { + hModule_Dbghelp = LoadLibraryA("dbghelp.dll"); + if (!hModule_Dbghelp) { + return NULL; + } + } + + return GetProcAddress(hModule_Dbghelp, lpProcName); +} + + +typedef BOOL (WINAPI *PFNSYMINITIALIZE)(HANDLE, LPSTR, BOOL); +static PFNSYMINITIALIZE pfnSymInitialize = NULL; + +static +BOOL WINAPI j_SymInitialize(HANDLE hProcess, PSTR UserSearchPath, BOOL fInvadeProcess) +{ + if( + (pfnSymInitialize || (pfnSymInitialize = (PFNSYMINITIALIZE) __GetProcAddress("SymInitialize"))) + ) + return pfnSymInitialize(hProcess, UserSearchPath, fInvadeProcess); + else + return FALSE; +} + +typedef DWORD (WINAPI *PFNSYMSETOPTIONS)(DWORD); +static PFNSYMSETOPTIONS pfnSymSetOptions = NULL; + +static +DWORD WINAPI j_SymSetOptions(DWORD SymOptions) +{ + if( + (pfnSymSetOptions || (pfnSymSetOptions = (PFNSYMSETOPTIONS) __GetProcAddress("SymSetOptions"))) + ) + return pfnSymSetOptions(SymOptions); + else + return FALSE; +} + +typedef BOOL (WINAPI *PFNSYMGETSYMFROMADDR)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO); +static PFNSYMGETSYMFROMADDR pfnSymFromAddr = NULL; + +static +BOOL WINAPI j_SymFromAddr(HANDLE hProcess, DWORD64 Address, PDWORD64 Displacement, PSYMBOL_INFO Symbol) +{ + if( + (pfnSymFromAddr || (pfnSymFromAddr = (PFNSYMGETSYMFROMADDR) __GetProcAddress("SymFromAddr"))) + ) + return pfnSymFromAddr(hProcess, Address, Displacement, Symbol); + else + return FALSE; +} + + +static INLINE void +debug_symbol_name_dbghelp(const void *addr, char* buf, unsigned size) +{ + HANDLE hProcess; + BYTE symbolBuffer[1024]; + PSYMBOL_INFO pSymbol = (PSYMBOL_INFO) symbolBuffer; + DWORD64 dwDisplacement = 0; /* Displacement of the input address, relative to the start of the symbol */ + + hProcess = GetCurrentProcess(); + + memset(pSymbol, 0, sizeof *pSymbol); + pSymbol->SizeOfStruct = sizeof(symbolBuffer); + pSymbol->MaxNameLen = sizeof(symbolBuffer) - offsetof(SYMBOL_INFO, Name); + + if(!bSymInitialized) { + j_SymSetOptions(/* SYMOPT_UNDNAME | */ SYMOPT_LOAD_LINES); + if(j_SymInitialize(hProcess, NULL, TRUE)) + bSymInitialized = TRUE; + } + + if(!j_SymFromAddr(hProcess, (DWORD64)(uintptr_t)addr, &dwDisplacement, pSymbol)) + buf[0] = 0; + else + { + strncpy(buf, pSymbol->Name, size); + buf[size - 1] = 0; + } +} +#endif + +#ifdef __GLIBC__ +#include + +/* This can only provide dynamic symbols, or binary offsets into a file. + * + * To fix this, post-process the output with tools/addr2line.sh + */ +static INLINE void +debug_symbol_name_glibc(const void *addr, char* buf, unsigned size) +{ + char** syms = backtrace_symbols((void**)&addr, 1); + strncpy(buf, syms[0], size); + buf[size - 1] = 0; + free(syms); +} +#endif + +void +debug_symbol_name(const void *addr, char* buf, unsigned size) +{ +#if defined(PIPE_OS_WINDOWS) && defined(PIPE_ARCH_X86) + debug_symbol_name_dbghelp(addr, buf, size); + if(buf[0]) + return; +#endif + +#ifdef __GLIBC__ + debug_symbol_name_glibc(addr, buf, size); + if(buf[0]) + return; +#endif + + util_snprintf(buf, size, "%p", addr); + buf[size - 1] = 0; +} + +void +debug_symbol_print(const void *addr) +{ + char buf[1024]; + debug_symbol_name(addr, buf, sizeof(buf)); + debug_printf("\t%s\n", buf); +} + +struct util_hash_table* symbols_hash; +pipe_static_mutex(symbols_mutex); + +static unsigned hash_ptr(void* p) +{ + return (unsigned)(uintptr_t)p; +} + +static int compare_ptr(void* a, void* b) +{ + if(a == b) + return 0; + else if(a < b) + return -1; + else + return 1; +} + +const char* +debug_symbol_name_cached(const void *addr) +{ + const char* name; +#ifdef PIPE_SUBSYSTEM_WINDOWS_USER + static boolean first = TRUE; + + if (first) { + pipe_mutex_init(symbols_mutex); + first = FALSE; + } +#endif + + pipe_mutex_lock(symbols_mutex); + if(!symbols_hash) + symbols_hash = util_hash_table_create(hash_ptr, compare_ptr); + name = util_hash_table_get(symbols_hash, (void*)addr); + if(!name) + { + char buf[1024]; + debug_symbol_name(addr, buf, sizeof(buf)); + name = strdup(buf); + + util_hash_table_set(symbols_hash, (void*)addr, (void*)name); + } + pipe_mutex_unlock(symbols_mutex); + return name; +} diff --git a/mesalib/src/gallium/auxiliary/util/u_debug_symbol.h b/mesalib/src/gallium/auxiliary/util/u_debug_symbol.h index 74285e064..b247706c2 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug_symbol.h +++ b/mesalib/src/gallium/auxiliary/util/u_debug_symbol.h @@ -1,58 +1,58 @@ -/************************************************************************** - * - * Copyright 2009 VMware, 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 VMWARE 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 U_DEBUG_SYMBOL_H_ -#define U_DEBUG_SYMBOL_H_ - - -/** - * @file - * Symbol lookup. - * - * @author Jose Fonseca - */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -void -debug_symbol_name(const void *addr, char* buf, unsigned size); - -const char* -debug_symbol_name_cached(const void *addr); - -void -debug_symbol_print(const void *addr); - -#ifdef __cplusplus -} -#endif - -#endif /* U_DEBUG_SYMBOL_H_ */ +/************************************************************************** + * + * Copyright 2009 VMware, 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 VMWARE 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 U_DEBUG_SYMBOL_H_ +#define U_DEBUG_SYMBOL_H_ + + +/** + * @file + * Symbol lookup. + * + * @author Jose Fonseca + */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +void +debug_symbol_name(const void *addr, char* buf, unsigned size); + +const char* +debug_symbol_name_cached(const void *addr); + +void +debug_symbol_print(const void *addr); + +#ifdef __cplusplus +} +#endif + +#endif /* U_DEBUG_SYMBOL_H_ */ diff --git a/mesalib/src/gallium/auxiliary/util/u_dirty_flags.h b/mesalib/src/gallium/auxiliary/util/u_dirty_flags.h index 9b509d591..40539f0b0 100644 --- a/mesalib/src/gallium/auxiliary/util/u_dirty_flags.h +++ b/mesalib/src/gallium/auxiliary/util/u_dirty_flags.h @@ -1,32 +1,32 @@ -#ifndef U_DIRTY_FLAGS_H -#define U_DIRTY_FLAGS_H - -/* Here's a convenient list of dirty flags to use in a driver. Either - * include it directly or use it as a starting point for your own - * list. - */ -#define U_NEW_VIEWPORT 0x1 -#define U_NEW_RASTERIZER 0x2 -#define U_NEW_FS 0x4 -#define U_NEW_FS_CONSTANTS 0x8 -#define U_NEW_FS_SAMPLER_VIEW 0x10 -#define U_NEW_FS_SAMPLER_STATES 0x20 -#define U_NEW_VS 0x40 -#define U_NEW_VS_CONSTANTS 0x80 -#define U_NEW_VS_SAMPLER_VIEW 0x100 -#define U_NEW_VS_SAMPLER_STATES 0x200 -#define U_NEW_BLEND 0x400 -#define U_NEW_CLIP 0x800 -#define U_NEW_SCISSOR 0x1000 -#define U_NEW_POLYGON_STIPPLE 0x2000 -#define U_NEW_FRAMEBUFFER 0x4000 -#define U_NEW_VERTEX_ELEMENTS 0x8000 -#define U_NEW_VERTEX_BUFFER 0x10000 -#define U_NEW_QUERY 0x20000 -#define U_NEW_DEPTH_STENCIL 0x40000 -#define U_NEW_GS 0x80000 -#define U_NEW_GS_CONSTANTS 0x100000 -#define U_NEW_GS_SAMPLER_VIEW 0x200000 -#define U_NEW_GS_SAMPLER_STATES 0x400000 - -#endif +#ifndef U_DIRTY_FLAGS_H +#define U_DIRTY_FLAGS_H + +/* Here's a convenient list of dirty flags to use in a driver. Either + * include it directly or use it as a starting point for your own + * list. + */ +#define U_NEW_VIEWPORT 0x1 +#define U_NEW_RASTERIZER 0x2 +#define U_NEW_FS 0x4 +#define U_NEW_FS_CONSTANTS 0x8 +#define U_NEW_FS_SAMPLER_VIEW 0x10 +#define U_NEW_FS_SAMPLER_STATES 0x20 +#define U_NEW_VS 0x40 +#define U_NEW_VS_CONSTANTS 0x80 +#define U_NEW_VS_SAMPLER_VIEW 0x100 +#define U_NEW_VS_SAMPLER_STATES 0x200 +#define U_NEW_BLEND 0x400 +#define U_NEW_CLIP 0x800 +#define U_NEW_SCISSOR 0x1000 +#define U_NEW_POLYGON_STIPPLE 0x2000 +#define U_NEW_FRAMEBUFFER 0x4000 +#define U_NEW_VERTEX_ELEMENTS 0x8000 +#define U_NEW_VERTEX_BUFFER 0x10000 +#define U_NEW_QUERY 0x20000 +#define U_NEW_DEPTH_STENCIL 0x40000 +#define U_NEW_GS 0x80000 +#define U_NEW_GS_CONSTANTS 0x100000 +#define U_NEW_GS_SAMPLER_VIEW 0x200000 +#define U_NEW_GS_SAMPLER_STATES 0x400000 + +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_dirty_surfaces.h b/mesalib/src/gallium/auxiliary/util/u_dirty_surfaces.h index bbc3179f0..f3618d9be 100644 --- a/mesalib/src/gallium/auxiliary/util/u_dirty_surfaces.h +++ b/mesalib/src/gallium/auxiliary/util/u_dirty_surfaces.h @@ -1,119 +1,119 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 U_DIRTY_SURFACES_H_ -#define U_DIRTY_SURFACES_H_ - -#include "pipe/p_state.h" - -#include "util/u_double_list.h" -#include "util/u_math.h" - -struct pipe_context; - -typedef void (*util_dirty_surface_flush_t) (struct pipe_context *, struct pipe_surface *); - -struct util_dirty_surfaces -{ - struct list_head dirty_list; -}; - -struct util_dirty_surface -{ - struct pipe_surface base; - struct list_head dirty_list; -}; - -static INLINE void -util_dirty_surfaces_init(struct util_dirty_surfaces *ds) -{ - LIST_INITHEAD(&ds->dirty_list); -} - -static INLINE void -util_dirty_surfaces_use_for_sampling(struct pipe_context *pipe, struct util_dirty_surfaces *dss, util_dirty_surface_flush_t flush) -{ - struct list_head *p, *next; - for(p = dss->dirty_list.next; p != &dss->dirty_list; p = next) - { - struct util_dirty_surface *ds = LIST_ENTRY(struct util_dirty_surface, p, dirty_list); - next = p->next; - - flush(pipe, &ds->base); - } -} - -static INLINE void -util_dirty_surfaces_use_levels_for_sampling(struct pipe_context *pipe, struct util_dirty_surfaces *dss, unsigned first, unsigned last, util_dirty_surface_flush_t flush) -{ - struct list_head *p, *next; - if(first > last) - return; - for(p = dss->dirty_list.next; p != &dss->dirty_list; p = next) - { - struct util_dirty_surface *ds = LIST_ENTRY(struct util_dirty_surface, p, dirty_list); - next = p->next; - - if(ds->base.u.tex.level >= first && ds->base.u.tex.level <= last) - flush(pipe, &ds->base); - } -} - -static INLINE void -util_dirty_surfaces_use_for_sampling_with(struct pipe_context *pipe, struct util_dirty_surfaces *dss, struct pipe_sampler_view *psv, struct pipe_sampler_state *pss, util_dirty_surface_flush_t flush) -{ - if(!LIST_IS_EMPTY(&dss->dirty_list)) - util_dirty_surfaces_use_levels_for_sampling(pipe, dss, (unsigned)pss->min_lod + psv->u.tex.first_level, - MIN2((unsigned)ceilf(pss->max_lod) + psv->u.tex.first_level, psv->u.tex.last_level), flush); -} - -static INLINE void -util_dirty_surface_init(struct util_dirty_surface *ds) -{ - LIST_INITHEAD(&ds->dirty_list); -} - -static INLINE boolean -util_dirty_surface_is_dirty(struct util_dirty_surface *ds) -{ - return !LIST_IS_EMPTY(&ds->dirty_list); -} - -static INLINE void -util_dirty_surface_set_dirty(struct util_dirty_surfaces *dss, struct util_dirty_surface *ds) -{ - if(LIST_IS_EMPTY(&ds->dirty_list)) - LIST_ADDTAIL(&ds->dirty_list, &dss->dirty_list); -} - -static INLINE void -util_dirty_surface_set_clean(struct util_dirty_surfaces *dss, struct util_dirty_surface *ds) -{ - if(!LIST_IS_EMPTY(&ds->dirty_list)) - LIST_DELINIT(&ds->dirty_list); -} - -#endif +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 U_DIRTY_SURFACES_H_ +#define U_DIRTY_SURFACES_H_ + +#include "pipe/p_state.h" + +#include "util/u_double_list.h" +#include "util/u_math.h" + +struct pipe_context; + +typedef void (*util_dirty_surface_flush_t) (struct pipe_context *, struct pipe_surface *); + +struct util_dirty_surfaces +{ + struct list_head dirty_list; +}; + +struct util_dirty_surface +{ + struct pipe_surface base; + struct list_head dirty_list; +}; + +static INLINE void +util_dirty_surfaces_init(struct util_dirty_surfaces *ds) +{ + LIST_INITHEAD(&ds->dirty_list); +} + +static INLINE void +util_dirty_surfaces_use_for_sampling(struct pipe_context *pipe, struct util_dirty_surfaces *dss, util_dirty_surface_flush_t flush) +{ + struct list_head *p, *next; + for(p = dss->dirty_list.next; p != &dss->dirty_list; p = next) + { + struct util_dirty_surface *ds = LIST_ENTRY(struct util_dirty_surface, p, dirty_list); + next = p->next; + + flush(pipe, &ds->base); + } +} + +static INLINE void +util_dirty_surfaces_use_levels_for_sampling(struct pipe_context *pipe, struct util_dirty_surfaces *dss, unsigned first, unsigned last, util_dirty_surface_flush_t flush) +{ + struct list_head *p, *next; + if(first > last) + return; + for(p = dss->dirty_list.next; p != &dss->dirty_list; p = next) + { + struct util_dirty_surface *ds = LIST_ENTRY(struct util_dirty_surface, p, dirty_list); + next = p->next; + + if(ds->base.u.tex.level >= first && ds->base.u.tex.level <= last) + flush(pipe, &ds->base); + } +} + +static INLINE void +util_dirty_surfaces_use_for_sampling_with(struct pipe_context *pipe, struct util_dirty_surfaces *dss, struct pipe_sampler_view *psv, struct pipe_sampler_state *pss, util_dirty_surface_flush_t flush) +{ + if(!LIST_IS_EMPTY(&dss->dirty_list)) + util_dirty_surfaces_use_levels_for_sampling(pipe, dss, (unsigned)pss->min_lod + psv->u.tex.first_level, + MIN2((unsigned)ceilf(pss->max_lod) + psv->u.tex.first_level, psv->u.tex.last_level), flush); +} + +static INLINE void +util_dirty_surface_init(struct util_dirty_surface *ds) +{ + LIST_INITHEAD(&ds->dirty_list); +} + +static INLINE boolean +util_dirty_surface_is_dirty(struct util_dirty_surface *ds) +{ + return !LIST_IS_EMPTY(&ds->dirty_list); +} + +static INLINE void +util_dirty_surface_set_dirty(struct util_dirty_surfaces *dss, struct util_dirty_surface *ds) +{ + if(LIST_IS_EMPTY(&ds->dirty_list)) + LIST_ADDTAIL(&ds->dirty_list, &dss->dirty_list); +} + +static INLINE void +util_dirty_surface_set_clean(struct util_dirty_surfaces *dss, struct util_dirty_surface *ds) +{ + if(!LIST_IS_EMPTY(&ds->dirty_list)) + LIST_DELINIT(&ds->dirty_list); +} + +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_dl.c b/mesalib/src/gallium/auxiliary/util/u_dl.c index dcdb7ebdd..aca435d6c 100644 --- a/mesalib/src/gallium/auxiliary/util/u_dl.c +++ b/mesalib/src/gallium/auxiliary/util/u_dl.c @@ -1,94 +1,94 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * Copyright 1999-2008 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, 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS 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. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - **************************************************************************/ - - -#include "pipe/p_config.h" -#include "pipe/p_compiler.h" - -#if defined(PIPE_OS_UNIX) -#include -#endif -#if defined(PIPE_OS_WINDOWS) -#include -#endif - -#include "u_dl.h" -#include "u_pointer.h" - - -struct util_dl_library * -util_dl_open(const char *filename) -{ -#if defined(PIPE_OS_UNIX) - return (struct util_dl_library *)dlopen(filename, RTLD_LAZY | RTLD_GLOBAL); -#elif defined(PIPE_OS_WINDOWS) - return (struct util_dl_library *)LoadLibraryA(filename); -#else - return NULL; -#endif -} - - -util_dl_proc -util_dl_get_proc_address(struct util_dl_library *library, - const char *procname) -{ -#if defined(PIPE_OS_UNIX) - return (util_dl_proc) pointer_to_func(dlsym((void *)library, procname)); -#elif defined(PIPE_OS_WINDOWS) - return (util_dl_proc)GetProcAddress((HMODULE)library, procname); -#else - return (util_dl_proc)NULL; -#endif -} - - -void -util_dl_close(struct util_dl_library *library) -{ -#if defined(PIPE_OS_UNIX) - dlclose((void *)library); -#elif defined(PIPE_OS_WINDOWS) - FreeLibrary((HMODULE)library); -#else - (void)library; -#endif -} - - -const char * -util_dl_error(void) -{ -#if defined(PIPE_OS_UNIX) - return dlerror(); -#elif defined(PIPE_OS_WINDOWS) - return "unknown error"; -#else - return "unknown error"; -#endif -} +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * Copyright 1999-2008 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, 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS 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. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + + +#include "pipe/p_config.h" +#include "pipe/p_compiler.h" + +#if defined(PIPE_OS_UNIX) +#include +#endif +#if defined(PIPE_OS_WINDOWS) +#include +#endif + +#include "u_dl.h" +#include "u_pointer.h" + + +struct util_dl_library * +util_dl_open(const char *filename) +{ +#if defined(PIPE_OS_UNIX) + return (struct util_dl_library *)dlopen(filename, RTLD_LAZY | RTLD_GLOBAL); +#elif defined(PIPE_OS_WINDOWS) + return (struct util_dl_library *)LoadLibraryA(filename); +#else + return NULL; +#endif +} + + +util_dl_proc +util_dl_get_proc_address(struct util_dl_library *library, + const char *procname) +{ +#if defined(PIPE_OS_UNIX) + return (util_dl_proc) pointer_to_func(dlsym((void *)library, procname)); +#elif defined(PIPE_OS_WINDOWS) + return (util_dl_proc)GetProcAddress((HMODULE)library, procname); +#else + return (util_dl_proc)NULL; +#endif +} + + +void +util_dl_close(struct util_dl_library *library) +{ +#if defined(PIPE_OS_UNIX) + dlclose((void *)library); +#elif defined(PIPE_OS_WINDOWS) + FreeLibrary((HMODULE)library); +#else + (void)library; +#endif +} + + +const char * +util_dl_error(void) +{ +#if defined(PIPE_OS_UNIX) + return dlerror(); +#elif defined(PIPE_OS_WINDOWS) + return "unknown error"; +#else + return "unknown error"; +#endif +} diff --git a/mesalib/src/gallium/auxiliary/util/u_dl.h b/mesalib/src/gallium/auxiliary/util/u_dl.h index b24183494..80a00ed67 100644 --- a/mesalib/src/gallium/auxiliary/util/u_dl.h +++ b/mesalib/src/gallium/auxiliary/util/u_dl.h @@ -1,83 +1,83 @@ -/************************************************************************** - * - * Copyright 2009 VMware, 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS 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. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - **************************************************************************/ - - -#ifndef U_DL_H_ -#define U_DL_H_ - - -#include "pipe/p_config.h" - - -#if defined(PIPE_OS_WINDOWS) -# define UTIL_DL_EXT ".dll" -# define UTIL_DL_PREFIX "" -#elif defined(PIPE_OS_APPLE) -# define UTIL_DL_EXT ".dylib" -# define UTIL_DL_PREFIX "lib" -#else -# define UTIL_DL_EXT ".so" -# define UTIL_DL_PREFIX "lib" -#endif - - -struct util_dl_library; - - -typedef void (*util_dl_proc)(void); - - -/** - * Open a library dynamically. - */ -struct util_dl_library * -util_dl_open(const char *filename); - - -/** - * Lookup a function in a library. - */ -util_dl_proc -util_dl_get_proc_address(struct util_dl_library *library, - const char *procname); - - -/** - * Close a library. - */ -void -util_dl_close(struct util_dl_library *library); - - -/** - * Return most recent error message. - */ -const char * -util_dl_error(void); - - -#endif /* U_DL_H_ */ +/************************************************************************** + * + * Copyright 2009 VMware, 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS 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. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + + +#ifndef U_DL_H_ +#define U_DL_H_ + + +#include "pipe/p_config.h" + + +#if defined(PIPE_OS_WINDOWS) +# define UTIL_DL_EXT ".dll" +# define UTIL_DL_PREFIX "" +#elif defined(PIPE_OS_APPLE) +# define UTIL_DL_EXT ".dylib" +# define UTIL_DL_PREFIX "lib" +#else +# define UTIL_DL_EXT ".so" +# define UTIL_DL_PREFIX "lib" +#endif + + +struct util_dl_library; + + +typedef void (*util_dl_proc)(void); + + +/** + * Open a library dynamically. + */ +struct util_dl_library * +util_dl_open(const char *filename); + + +/** + * Lookup a function in a library. + */ +util_dl_proc +util_dl_get_proc_address(struct util_dl_library *library, + const char *procname); + + +/** + * Close a library. + */ +void +util_dl_close(struct util_dl_library *library); + + +/** + * Return most recent error message. + */ +const char * +util_dl_error(void); + + +#endif /* U_DL_H_ */ diff --git a/mesalib/src/gallium/auxiliary/util/u_dump_defines.c b/mesalib/src/gallium/auxiliary/util/u_dump_defines.c index 0a00195aa..692d4447c 100644 --- a/mesalib/src/gallium/auxiliary/util/u_dump_defines.c +++ b/mesalib/src/gallium/auxiliary/util/u_dump_defines.c @@ -1,336 +1,336 @@ -/************************************************************************** - * - * Copyright 2009 VMware, 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 VMWARE 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 "util/u_memory.h" -#include "util/u_debug.h" -#include "util/u_dump.h" - - -#if 0 -static const char * -util_dump_strip_prefix(const char *name, - const char *prefix) -{ - const char *stripped; - assert(name); - assert(prefix); - stripped = name; - while(*prefix) { - if(*stripped != *prefix) - return name; - - ++stripped; - ++prefix; - } - return stripped; -} -#endif - -static const char * -util_dump_enum_continuous(unsigned value, - unsigned num_names, - const char **names) -{ - if (value >= num_names) - return UTIL_DUMP_INVALID_NAME; - return names[value]; -} - - -#define DEFINE_UTIL_DUMP_CONTINUOUS(_name) \ - const char * \ - util_dump_##_name(unsigned value, boolean shortened) \ - { \ - if(shortened) \ - return util_dump_enum_continuous(value, Elements(util_dump_##_name##_short_names), util_dump_##_name##_short_names); \ - else \ - return util_dump_enum_continuous(value, Elements(util_dump_##_name##_names), util_dump_##_name##_names); \ - } - - -static const char * -util_dump_blend_factor_names[] = { - UTIL_DUMP_INVALID_NAME, /* 0x0 */ - "PIPE_BLENDFACTOR_ONE", - "PIPE_BLENDFACTOR_SRC_COLOR", - "PIPE_BLENDFACTOR_SRC_ALPHA", - "PIPE_BLENDFACTOR_DST_ALPHA", - "PIPE_BLENDFACTOR_DST_COLOR", - "PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE", - "PIPE_BLENDFACTOR_CONST_COLOR", - "PIPE_BLENDFACTOR_CONST_ALPHA", - "PIPE_BLENDFACTOR_SRC1_COLOR", - "PIPE_BLENDFACTOR_SRC1_ALPHA", - UTIL_DUMP_INVALID_NAME, /* 0x0b */ - UTIL_DUMP_INVALID_NAME, /* 0x0c */ - UTIL_DUMP_INVALID_NAME, /* 0x0d */ - UTIL_DUMP_INVALID_NAME, /* 0x0e */ - UTIL_DUMP_INVALID_NAME, /* 0x0f */ - UTIL_DUMP_INVALID_NAME, /* 0x10 */ - "PIPE_BLENDFACTOR_ZERO", - "PIPE_BLENDFACTOR_INV_SRC_COLOR", - "PIPE_BLENDFACTOR_INV_SRC_ALPHA", - "PIPE_BLENDFACTOR_INV_DST_ALPHA", - "PIPE_BLENDFACTOR_INV_DST_COLOR", - UTIL_DUMP_INVALID_NAME, /* 0x16 */ - "PIPE_BLENDFACTOR_INV_CONST_COLOR", - "PIPE_BLENDFACTOR_INV_CONST_ALPHA", - "PIPE_BLENDFACTOR_INV_SRC1_COLOR", - "PIPE_BLENDFACTOR_INV_SRC1_ALPHA" -}; - -static const char * -util_dump_blend_factor_short_names[] = { - UTIL_DUMP_INVALID_NAME, /* 0x0 */ - "one", - "src_color", - "src_alpha", - "dst_alpha", - "dst_color", - "src_alpha_saturate", - "const_color", - "const_alpha", - "src1_color", - "src1_alpha", - UTIL_DUMP_INVALID_NAME, /* 0x0b */ - UTIL_DUMP_INVALID_NAME, /* 0x0c */ - UTIL_DUMP_INVALID_NAME, /* 0x0d */ - UTIL_DUMP_INVALID_NAME, /* 0x0e */ - UTIL_DUMP_INVALID_NAME, /* 0x0f */ - UTIL_DUMP_INVALID_NAME, /* 0x10 */ - "zero", - "inv_src_color", - "inv_src_alpha", - "inv_dst_alpha", - "inv_dst_color", - UTIL_DUMP_INVALID_NAME, /* 0x16 */ - "inv_const_color", - "inv_const_alpha", - "inv_src1_color", - "inv_src1_alpha" -}; - -DEFINE_UTIL_DUMP_CONTINUOUS(blend_factor) - - -static const char * -util_dump_blend_func_names[] = { - "PIPE_BLEND_ADD", - "PIPE_BLEND_SUBTRACT", - "PIPE_BLEND_REVERSE_SUBTRACT", - "PIPE_BLEND_MIN", - "PIPE_BLEND_MAX" -}; - -static const char * -util_dump_blend_func_short_names[] = { - "add", - "sub", - "rev_sub", - "min", - "max" -}; - -DEFINE_UTIL_DUMP_CONTINUOUS(blend_func) - - -static const char * -util_dump_logicop_names[] = { - "PIPE_LOGICOP_CLEAR", - "PIPE_LOGICOP_NOR", - "PIPE_LOGICOP_AND_INVERTED", - "PIPE_LOGICOP_COPY_INVERTED", - "PIPE_LOGICOP_AND_REVERSE", - "PIPE_LOGICOP_INVERT", - "PIPE_LOGICOP_XOR", - "PIPE_LOGICOP_NAND", - "PIPE_LOGICOP_AND", - "PIPE_LOGICOP_EQUIV", - "PIPE_LOGICOP_NOOP", - "PIPE_LOGICOP_OR_INVERTED", - "PIPE_LOGICOP_COPY", - "PIPE_LOGICOP_OR_REVERSE", - "PIPE_LOGICOP_OR", - "PIPE_LOGICOP_SET" -}; - -static const char * -util_dump_logicop_short_names[] = { - "clear", - "nor", - "and_inverted", - "copy_inverted", - "and_reverse", - "invert", - "xor", - "nand", - "and", - "equiv", - "noop", - "or_inverted", - "copy", - "or_reverse", - "or", - "set" -}; - -DEFINE_UTIL_DUMP_CONTINUOUS(logicop) - - -static const char * -util_dump_func_names[] = { - "PIPE_FUNC_NEVER", - "PIPE_FUNC_LESS", - "PIPE_FUNC_EQUAL", - "PIPE_FUNC_LEQUAL", - "PIPE_FUNC_GREATER", - "PIPE_FUNC_NOTEQUAL", - "PIPE_FUNC_GEQUAL", - "PIPE_FUNC_ALWAYS" -}; - -static const char * -util_dump_func_short_names[] = { - "never", - "less", - "equal", - "less_equal", - "greater", - "not_equal", - "greater_equal", - "always" -}; - -DEFINE_UTIL_DUMP_CONTINUOUS(func) - - -static const char * -util_dump_stencil_op_names[] = { - "PIPE_STENCIL_OP_KEEP", - "PIPE_STENCIL_OP_ZERO", - "PIPE_STENCIL_OP_REPLACE", - "PIPE_STENCIL_OP_INCR", - "PIPE_STENCIL_OP_DECR", - "PIPE_STENCIL_OP_INCR_WRAP", - "PIPE_STENCIL_OP_DECR_WRAP", - "PIPE_STENCIL_OP_INVERT" -}; - -static const char * -util_dump_stencil_op_short_names[] = { - "keep", - "zero", - "replace", - "incr", - "decr", - "incr_wrap", - "decr_wrap", - "invert" -}; - -DEFINE_UTIL_DUMP_CONTINUOUS(stencil_op) - - -static const char * -util_dump_tex_target_names[] = { - "PIPE_BUFFER", - "PIPE_TEXTURE_1D", - "PIPE_TEXTURE_2D", - "PIPE_TEXTURE_3D", - "PIPE_TEXTURE_CUBE" -}; - -static const char * -util_dump_tex_target_short_names[] = { - "buffer", - "1d", - "2d", - "3d", - "cube" -}; - -DEFINE_UTIL_DUMP_CONTINUOUS(tex_target) - - -static const char * -util_dump_tex_wrap_names[] = { - "PIPE_TEX_WRAP_REPEAT", - "PIPE_TEX_WRAP_CLAMP", - "PIPE_TEX_WRAP_CLAMP_TO_EDGE", - "PIPE_TEX_WRAP_CLAMP_TO_BORDER", - "PIPE_TEX_WRAP_MIRROR_REPEAT", - "PIPE_TEX_WRAP_MIRROR_CLAMP", - "PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE", - "PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER" -}; - -static const char * -util_dump_tex_wrap_short_names[] = { - "repeat", - "clamp", - "clamp_to_edge", - "clamp_to_border", - "mirror_repeat", - "mirror_clamp", - "mirror_clamp_to_edge", - "mirror_clamp_to_border" -}; - -DEFINE_UTIL_DUMP_CONTINUOUS(tex_wrap) - - -static const char * -util_dump_tex_mipfilter_names[] = { - "PIPE_TEX_MIPFILTER_NEAREST", - "PIPE_TEX_MIPFILTER_LINEAR", - "PIPE_TEX_MIPFILTER_NONE" -}; - -static const char * -util_dump_tex_mipfilter_short_names[] = { - "nearest", - "linear", - "none" -}; - -DEFINE_UTIL_DUMP_CONTINUOUS(tex_mipfilter) - - -static const char * -util_dump_tex_filter_names[] = { - "PIPE_TEX_FILTER_NEAREST", - "PIPE_TEX_FILTER_LINEAR" -}; - -static const char * -util_dump_tex_filter_short_names[] = { - "nearest", - "linear" -}; - -DEFINE_UTIL_DUMP_CONTINUOUS(tex_filter) +/************************************************************************** + * + * Copyright 2009 VMware, 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 VMWARE 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 "util/u_memory.h" +#include "util/u_debug.h" +#include "util/u_dump.h" + + +#if 0 +static const char * +util_dump_strip_prefix(const char *name, + const char *prefix) +{ + const char *stripped; + assert(name); + assert(prefix); + stripped = name; + while(*prefix) { + if(*stripped != *prefix) + return name; + + ++stripped; + ++prefix; + } + return stripped; +} +#endif + +static const char * +util_dump_enum_continuous(unsigned value, + unsigned num_names, + const char **names) +{ + if (value >= num_names) + return UTIL_DUMP_INVALID_NAME; + return names[value]; +} + + +#define DEFINE_UTIL_DUMP_CONTINUOUS(_name) \ + const char * \ + util_dump_##_name(unsigned value, boolean shortened) \ + { \ + if(shortened) \ + return util_dump_enum_continuous(value, Elements(util_dump_##_name##_short_names), util_dump_##_name##_short_names); \ + else \ + return util_dump_enum_continuous(value, Elements(util_dump_##_name##_names), util_dump_##_name##_names); \ + } + + +static const char * +util_dump_blend_factor_names[] = { + UTIL_DUMP_INVALID_NAME, /* 0x0 */ + "PIPE_BLENDFACTOR_ONE", + "PIPE_BLENDFACTOR_SRC_COLOR", + "PIPE_BLENDFACTOR_SRC_ALPHA", + "PIPE_BLENDFACTOR_DST_ALPHA", + "PIPE_BLENDFACTOR_DST_COLOR", + "PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE", + "PIPE_BLENDFACTOR_CONST_COLOR", + "PIPE_BLENDFACTOR_CONST_ALPHA", + "PIPE_BLENDFACTOR_SRC1_COLOR", + "PIPE_BLENDFACTOR_SRC1_ALPHA", + UTIL_DUMP_INVALID_NAME, /* 0x0b */ + UTIL_DUMP_INVALID_NAME, /* 0x0c */ + UTIL_DUMP_INVALID_NAME, /* 0x0d */ + UTIL_DUMP_INVALID_NAME, /* 0x0e */ + UTIL_DUMP_INVALID_NAME, /* 0x0f */ + UTIL_DUMP_INVALID_NAME, /* 0x10 */ + "PIPE_BLENDFACTOR_ZERO", + "PIPE_BLENDFACTOR_INV_SRC_COLOR", + "PIPE_BLENDFACTOR_INV_SRC_ALPHA", + "PIPE_BLENDFACTOR_INV_DST_ALPHA", + "PIPE_BLENDFACTOR_INV_DST_COLOR", + UTIL_DUMP_INVALID_NAME, /* 0x16 */ + "PIPE_BLENDFACTOR_INV_CONST_COLOR", + "PIPE_BLENDFACTOR_INV_CONST_ALPHA", + "PIPE_BLENDFACTOR_INV_SRC1_COLOR", + "PIPE_BLENDFACTOR_INV_SRC1_ALPHA" +}; + +static const char * +util_dump_blend_factor_short_names[] = { + UTIL_DUMP_INVALID_NAME, /* 0x0 */ + "one", + "src_color", + "src_alpha", + "dst_alpha", + "dst_color", + "src_alpha_saturate", + "const_color", + "const_alpha", + "src1_color", + "src1_alpha", + UTIL_DUMP_INVALID_NAME, /* 0x0b */ + UTIL_DUMP_INVALID_NAME, /* 0x0c */ + UTIL_DUMP_INVALID_NAME, /* 0x0d */ + UTIL_DUMP_INVALID_NAME, /* 0x0e */ + UTIL_DUMP_INVALID_NAME, /* 0x0f */ + UTIL_DUMP_INVALID_NAME, /* 0x10 */ + "zero", + "inv_src_color", + "inv_src_alpha", + "inv_dst_alpha", + "inv_dst_color", + UTIL_DUMP_INVALID_NAME, /* 0x16 */ + "inv_const_color", + "inv_const_alpha", + "inv_src1_color", + "inv_src1_alpha" +}; + +DEFINE_UTIL_DUMP_CONTINUOUS(blend_factor) + + +static const char * +util_dump_blend_func_names[] = { + "PIPE_BLEND_ADD", + "PIPE_BLEND_SUBTRACT", + "PIPE_BLEND_REVERSE_SUBTRACT", + "PIPE_BLEND_MIN", + "PIPE_BLEND_MAX" +}; + +static const char * +util_dump_blend_func_short_names[] = { + "add", + "sub", + "rev_sub", + "min", + "max" +}; + +DEFINE_UTIL_DUMP_CONTINUOUS(blend_func) + + +static const char * +util_dump_logicop_names[] = { + "PIPE_LOGICOP_CLEAR", + "PIPE_LOGICOP_NOR", + "PIPE_LOGICOP_AND_INVERTED", + "PIPE_LOGICOP_COPY_INVERTED", + "PIPE_LOGICOP_AND_REVERSE", + "PIPE_LOGICOP_INVERT", + "PIPE_LOGICOP_XOR", + "PIPE_LOGICOP_NAND", + "PIPE_LOGICOP_AND", + "PIPE_LOGICOP_EQUIV", + "PIPE_LOGICOP_NOOP", + "PIPE_LOGICOP_OR_INVERTED", + "PIPE_LOGICOP_COPY", + "PIPE_LOGICOP_OR_REVERSE", + "PIPE_LOGICOP_OR", + "PIPE_LOGICOP_SET" +}; + +static const char * +util_dump_logicop_short_names[] = { + "clear", + "nor", + "and_inverted", + "copy_inverted", + "and_reverse", + "invert", + "xor", + "nand", + "and", + "equiv", + "noop", + "or_inverted", + "copy", + "or_reverse", + "or", + "set" +}; + +DEFINE_UTIL_DUMP_CONTINUOUS(logicop) + + +static const char * +util_dump_func_names[] = { + "PIPE_FUNC_NEVER", + "PIPE_FUNC_LESS", + "PIPE_FUNC_EQUAL", + "PIPE_FUNC_LEQUAL", + "PIPE_FUNC_GREATER", + "PIPE_FUNC_NOTEQUAL", + "PIPE_FUNC_GEQUAL", + "PIPE_FUNC_ALWAYS" +}; + +static const char * +util_dump_func_short_names[] = { + "never", + "less", + "equal", + "less_equal", + "greater", + "not_equal", + "greater_equal", + "always" +}; + +DEFINE_UTIL_DUMP_CONTINUOUS(func) + + +static const char * +util_dump_stencil_op_names[] = { + "PIPE_STENCIL_OP_KEEP", + "PIPE_STENCIL_OP_ZERO", + "PIPE_STENCIL_OP_REPLACE", + "PIPE_STENCIL_OP_INCR", + "PIPE_STENCIL_OP_DECR", + "PIPE_STENCIL_OP_INCR_WRAP", + "PIPE_STENCIL_OP_DECR_WRAP", + "PIPE_STENCIL_OP_INVERT" +}; + +static const char * +util_dump_stencil_op_short_names[] = { + "keep", + "zero", + "replace", + "incr", + "decr", + "incr_wrap", + "decr_wrap", + "invert" +}; + +DEFINE_UTIL_DUMP_CONTINUOUS(stencil_op) + + +static const char * +util_dump_tex_target_names[] = { + "PIPE_BUFFER", + "PIPE_TEXTURE_1D", + "PIPE_TEXTURE_2D", + "PIPE_TEXTURE_3D", + "PIPE_TEXTURE_CUBE" +}; + +static const char * +util_dump_tex_target_short_names[] = { + "buffer", + "1d", + "2d", + "3d", + "cube" +}; + +DEFINE_UTIL_DUMP_CONTINUOUS(tex_target) + + +static const char * +util_dump_tex_wrap_names[] = { + "PIPE_TEX_WRAP_REPEAT", + "PIPE_TEX_WRAP_CLAMP", + "PIPE_TEX_WRAP_CLAMP_TO_EDGE", + "PIPE_TEX_WRAP_CLAMP_TO_BORDER", + "PIPE_TEX_WRAP_MIRROR_REPEAT", + "PIPE_TEX_WRAP_MIRROR_CLAMP", + "PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE", + "PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER" +}; + +static const char * +util_dump_tex_wrap_short_names[] = { + "repeat", + "clamp", + "clamp_to_edge", + "clamp_to_border", + "mirror_repeat", + "mirror_clamp", + "mirror_clamp_to_edge", + "mirror_clamp_to_border" +}; + +DEFINE_UTIL_DUMP_CONTINUOUS(tex_wrap) + + +static const char * +util_dump_tex_mipfilter_names[] = { + "PIPE_TEX_MIPFILTER_NEAREST", + "PIPE_TEX_MIPFILTER_LINEAR", + "PIPE_TEX_MIPFILTER_NONE" +}; + +static const char * +util_dump_tex_mipfilter_short_names[] = { + "nearest", + "linear", + "none" +}; + +DEFINE_UTIL_DUMP_CONTINUOUS(tex_mipfilter) + + +static const char * +util_dump_tex_filter_names[] = { + "PIPE_TEX_FILTER_NEAREST", + "PIPE_TEX_FILTER_LINEAR" +}; + +static const char * +util_dump_tex_filter_short_names[] = { + "nearest", + "linear" +}; + +DEFINE_UTIL_DUMP_CONTINUOUS(tex_filter) diff --git a/mesalib/src/gallium/auxiliary/util/u_dynarray.h b/mesalib/src/gallium/auxiliary/util/u_dynarray.h index 4dd6c3eaa..980cadf22 100644 --- a/mesalib/src/gallium/auxiliary/util/u_dynarray.h +++ b/mesalib/src/gallium/auxiliary/util/u_dynarray.h @@ -1,114 +1,114 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 U_DYNARRAY_H -#define U_DYNARRAY_H - -#include "pipe/p_compiler.h" -#include "util/u_memory.h" - -/* A zero-initialized version of this is guaranteed to represent an - * empty array. - * - * Also, size <= capacity and data != 0 if and only if capacity != 0 - * capacity will always be the allocation size of data - */ -struct util_dynarray -{ - void *data; - unsigned size; - unsigned capacity; -}; - -static INLINE void -util_dynarray_init(struct util_dynarray *buf) -{ - memset(buf, 0, sizeof(*buf)); -} - -static INLINE void -util_dynarray_fini(struct util_dynarray *buf) -{ - if(buf->data) - { - FREE(buf->data); - util_dynarray_init(buf); - } -} - -/* use util_dynarray_trim to reduce the allocated storage */ -static INLINE void * -util_dynarray_resize(struct util_dynarray *buf, unsigned newsize) -{ - char *p; - if(newsize > buf->capacity) - { - unsigned newcap = buf->capacity << 1; - if(newsize > newcap) - newcap = newsize; - buf->data = REALLOC(buf->data, buf->capacity, newcap); - buf->capacity = newcap; - } - - p = (char *)buf->data + buf->size; - buf->size = newsize; - return p; -} - -static INLINE void * -util_dynarray_grow(struct util_dynarray *buf, int diff) -{ - return util_dynarray_resize(buf, buf->size + diff); -} - -static INLINE void -util_dynarray_trim(struct util_dynarray *buf) -{ - if (buf->size != buf->capacity) { - if (buf->size) { - buf->data = REALLOC(buf->data, buf->capacity, buf->size); - buf->capacity = buf->size; - } - else { - FREE(buf->data); - buf->data = 0; - buf->capacity = 0; - } - } -} - -#define util_dynarray_append(buf, type, v) do {type __v = (v); memcpy(util_dynarray_grow((buf), sizeof(type)), &__v, sizeof(type));} while(0) -#define util_dynarray_top_ptr(buf, type) (type*)((char*)(buf)->data + (buf)->size - sizeof(type)) -#define util_dynarray_top(buf, type) *util_dynarray_top_ptr(buf, type) -#define util_dynarray_pop_ptr(buf, type) (type*)((char*)(buf)->data + ((buf)->size -= sizeof(type))) -#define util_dynarray_pop(buf, type) *util_dynarray_pop_ptr(buf, type) -#define util_dynarray_contains(buf, type) ((buf)->size >= sizeof(type)) -#define util_dynarray_element(buf, type, idx) ((type*)(buf)->data + (idx)) -#define util_dynarray_begin(buf) ((buf)->data) -#define util_dynarray_end(buf) ((void*)util_dynarray_element((buf), char, (buf)->size)) - -#endif /* U_DYNARRAY_H */ - +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 U_DYNARRAY_H +#define U_DYNARRAY_H + +#include "pipe/p_compiler.h" +#include "util/u_memory.h" + +/* A zero-initialized version of this is guaranteed to represent an + * empty array. + * + * Also, size <= capacity and data != 0 if and only if capacity != 0 + * capacity will always be the allocation size of data + */ +struct util_dynarray +{ + void *data; + unsigned size; + unsigned capacity; +}; + +static INLINE void +util_dynarray_init(struct util_dynarray *buf) +{ + memset(buf, 0, sizeof(*buf)); +} + +static INLINE void +util_dynarray_fini(struct util_dynarray *buf) +{ + if(buf->data) + { + FREE(buf->data); + util_dynarray_init(buf); + } +} + +/* use util_dynarray_trim to reduce the allocated storage */ +static INLINE void * +util_dynarray_resize(struct util_dynarray *buf, unsigned newsize) +{ + char *p; + if(newsize > buf->capacity) + { + unsigned newcap = buf->capacity << 1; + if(newsize > newcap) + newcap = newsize; + buf->data = REALLOC(buf->data, buf->capacity, newcap); + buf->capacity = newcap; + } + + p = (char *)buf->data + buf->size; + buf->size = newsize; + return p; +} + +static INLINE void * +util_dynarray_grow(struct util_dynarray *buf, int diff) +{ + return util_dynarray_resize(buf, buf->size + diff); +} + +static INLINE void +util_dynarray_trim(struct util_dynarray *buf) +{ + if (buf->size != buf->capacity) { + if (buf->size) { + buf->data = REALLOC(buf->data, buf->capacity, buf->size); + buf->capacity = buf->size; + } + else { + FREE(buf->data); + buf->data = 0; + buf->capacity = 0; + } + } +} + +#define util_dynarray_append(buf, type, v) do {type __v = (v); memcpy(util_dynarray_grow((buf), sizeof(type)), &__v, sizeof(type));} while(0) +#define util_dynarray_top_ptr(buf, type) (type*)((char*)(buf)->data + (buf)->size - sizeof(type)) +#define util_dynarray_top(buf, type) *util_dynarray_top_ptr(buf, type) +#define util_dynarray_pop_ptr(buf, type) (type*)((char*)(buf)->data + ((buf)->size -= sizeof(type))) +#define util_dynarray_pop(buf, type) *util_dynarray_pop_ptr(buf, type) +#define util_dynarray_contains(buf, type) ((buf)->size >= sizeof(type)) +#define util_dynarray_element(buf, type, idx) ((type*)(buf)->data + (idx)) +#define util_dynarray_begin(buf) ((buf)->data) +#define util_dynarray_end(buf) ((void*)util_dynarray_element((buf), char, (buf)->size)) + +#endif /* U_DYNARRAY_H */ + diff --git a/mesalib/src/gallium/auxiliary/util/u_fifo.h b/mesalib/src/gallium/auxiliary/util/u_fifo.h index 7c13f119e..9e007de1a 100644 --- a/mesalib/src/gallium/auxiliary/util/u_fifo.h +++ b/mesalib/src/gallium/auxiliary/util/u_fifo.h @@ -1,94 +1,94 @@ -/************************************************************************** - * - * Copyright © 2009 Jakob Bornecrantz - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. - * - **************************************************************************/ - -#ifndef U_FIFO_H -#define U_FIFO_H - -#include "util/u_memory.h" - -struct util_fifo -{ - size_t head; - size_t tail; - size_t num; - size_t size; -}; - -static INLINE struct util_fifo * -u_fifo_create(size_t size) -{ - struct util_fifo *fifo; - fifo = MALLOC(sizeof(*fifo) + size * sizeof(void*)); - - fifo->head = 0; - fifo->tail = 0; - fifo->num = 0; - fifo->size = size; - - return fifo; -} - -static INLINE boolean -u_fifo_add(struct util_fifo *fifo, void *ptr) -{ - void **array = (void**)&fifo[1]; - if (fifo->num >= fifo->size) - return FALSE; - - if (++fifo->head >= fifo->size) - fifo->head = 0; - - array[fifo->head] = ptr; - - ++fifo->num; - - return TRUE; -} - -static INLINE boolean -u_fifo_pop(struct util_fifo *fifo, void **ptr) -{ - void **array = (void**)&fifo[1]; - - if (!fifo->num) - return FALSE; - - if (++fifo->tail >= fifo->size) - fifo->tail = 0; - - *ptr = array[fifo->tail]; - - ++fifo->num; - - return TRUE; -} - -static INLINE void -u_fifo_destroy(struct util_fifo *fifo) -{ - FREE(fifo); -} - -#endif +/************************************************************************** + * + * Copyright © 2009 Jakob Bornecrantz + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. + * + **************************************************************************/ + +#ifndef U_FIFO_H +#define U_FIFO_H + +#include "util/u_memory.h" + +struct util_fifo +{ + size_t head; + size_t tail; + size_t num; + size_t size; +}; + +static INLINE struct util_fifo * +u_fifo_create(size_t size) +{ + struct util_fifo *fifo; + fifo = MALLOC(sizeof(*fifo) + size * sizeof(void*)); + + fifo->head = 0; + fifo->tail = 0; + fifo->num = 0; + fifo->size = size; + + return fifo; +} + +static INLINE boolean +u_fifo_add(struct util_fifo *fifo, void *ptr) +{ + void **array = (void**)&fifo[1]; + if (fifo->num >= fifo->size) + return FALSE; + + if (++fifo->head >= fifo->size) + fifo->head = 0; + + array[fifo->head] = ptr; + + ++fifo->num; + + return TRUE; +} + +static INLINE boolean +u_fifo_pop(struct util_fifo *fifo, void **ptr) +{ + void **array = (void**)&fifo[1]; + + if (!fifo->num) + return FALSE; + + if (++fifo->tail >= fifo->size) + fifo->tail = 0; + + *ptr = array[fifo->tail]; + + ++fifo->num; + + return TRUE; +} + +static INLINE void +u_fifo_destroy(struct util_fifo *fifo) +{ + FREE(fifo); +} + +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_format_latc.h b/mesalib/src/gallium/auxiliary/util/u_format_latc.h index 324717215..1f0888753 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_latc.h +++ b/mesalib/src/gallium/auxiliary/util/u_format_latc.h @@ -1,108 +1,108 @@ -/************************************************************************** - * - * Copyright 2011 Red Hat 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS 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. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - **************************************************************************/ - -#ifndef U_FORMAT_LATC_H_ -#define U_FORMAT_LATC_H_ - -void -util_format_latc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_latc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - - - -void -util_format_latc1_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_latc1_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc1_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - - -void -util_format_latc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_latc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - - -void -util_format_latc2_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_latc2_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc2_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_latc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - - -#endif +/************************************************************************** + * + * Copyright 2011 Red Hat 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS 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. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + +#ifndef U_FORMAT_LATC_H_ +#define U_FORMAT_LATC_H_ + +void +util_format_latc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_latc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + + + +void +util_format_latc1_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_latc1_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc1_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + + +void +util_format_latc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_latc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + + +void +util_format_latc2_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_latc2_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc2_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_latc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + + +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_format_other.c b/mesalib/src/gallium/auxiliary/util/u_format_other.c index b6173a12e..c23f4ee4a 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_other.c +++ b/mesalib/src/gallium/auxiliary/util/u_format_other.c @@ -1,472 +1,472 @@ -/************************************************************************** - * - * Copyright 2010 VMware, 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS 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. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - **************************************************************************/ - - -#include "u_math.h" -#include "u_format_other.h" -#include "u_format_rgb9e5.h" -#include "u_format_r11g11b10f.h" - - -void -util_format_r9g9b9e5_float_unpack_rgba_float(float *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ - unsigned x, y; - for(y = 0; y < height; y += 1) { - float *dst = dst_row; - const uint8_t *src = src_row; - for(x = 0; x < width; x += 1) { - uint32_t value = *(const uint32_t *)src; -#ifdef PIPE_ARCH_BIG_ENDIAN - value = util_bswap32(value); -#endif - rgb9e5_to_float3(value, dst); - dst[3] = 1; /* a */ - src += 4; - dst += 4; - } - src_row += src_stride; - dst_row += dst_stride/sizeof(*dst_row); - } -} - -void -util_format_r9g9b9e5_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, - const float *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ - unsigned x, y; - for(y = 0; y < height; y += 1) { - const float *src = src_row; - uint8_t *dst = dst_row; - for(x = 0; x < width; x += 1) { - uint32_t value = float3_to_rgb9e5(src); -#ifdef PIPE_ARCH_BIG_ENDIAN - value = util_bswap32(value); -#endif - *(uint32_t *)dst = value; - src += 4; - dst += 4; - } - dst_row += dst_stride; - src_row += src_stride/sizeof(*src_row); - } -} - -void -util_format_r9g9b9e5_float_fetch_rgba_float(float *dst, const uint8_t *src, - unsigned i, unsigned j) -{ - uint32_t value = *(const uint32_t *)src; -#ifdef PIPE_ARCH_BIG_ENDIAN - value = util_bswap32(value); -#endif - rgb9e5_to_float3(value, dst); - dst[3] = 1; /* a */ -} - - -void -util_format_r9g9b9e5_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ - unsigned x, y; - float p[3]; - for(y = 0; y < height; y += 1) { - uint8_t *dst = dst_row; - const uint8_t *src = src_row; - for(x = 0; x < width; x += 1) { - uint32_t value = *(const uint32_t *)src; -#ifdef PIPE_ARCH_BIG_ENDIAN - value = util_bswap32(value); -#endif - rgb9e5_to_float3(value, p); - dst[0] = float_to_ubyte(p[0]); /* r */ - dst[1] = float_to_ubyte(p[1]); /* g */ - dst[2] = float_to_ubyte(p[2]); /* b */ - dst[3] = 255; /* a */ - src += 4; - dst += 4; - } - src_row += src_stride; - dst_row += dst_stride/sizeof(*dst_row); - } -} - - -void -util_format_r9g9b9e5_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ - unsigned x, y; - float p[3]; - for(y = 0; y < height; y += 1) { - const uint8_t *src = src_row; - uint8_t *dst = dst_row; - for(x = 0; x < width; x += 1) { - uint32_t value; - p[0] = ubyte_to_float(src[0]); - p[1] = ubyte_to_float(src[1]); - p[2] = ubyte_to_float(src[2]); - value = float3_to_rgb9e5(p); -#ifdef PIPE_ARCH_BIG_ENDIAN - value = util_bswap32(value); -#endif - *(uint32_t *)dst = value; - src += 4; - dst += 4; - } - dst_row += dst_stride; - src_row += src_stride/sizeof(*src_row); - } -} - - -void -util_format_r11g11b10_float_unpack_rgba_float(float *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ - unsigned x, y; - for(y = 0; y < height; y += 1) { - float *dst = dst_row; - const uint8_t *src = src_row; - for(x = 0; x < width; x += 1) { - uint32_t value = *(const uint32_t *)src; -#ifdef PIPE_ARCH_BIG_ENDIAN - value = util_bswap32(value); -#endif - r11g11b10f_to_float3(value, dst); - dst[3] = 1; /* a */ - src += 4; - dst += 4; - } - src_row += src_stride; - dst_row += dst_stride/sizeof(*dst_row); - } -} - -void -util_format_r11g11b10_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, - const float *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ - unsigned x, y; - for(y = 0; y < height; y += 1) { - const float *src = src_row; - uint8_t *dst = dst_row; - for(x = 0; x < width; x += 1) { - uint32_t value = float3_to_r11g11b10f(src); -#ifdef PIPE_ARCH_BIG_ENDIAN - value = util_bswap32(value); -#endif - *(uint32_t *)dst = value; - src += 4; - dst += 4; - } - dst_row += dst_stride; - src_row += src_stride/sizeof(*src_row); - } -} - -void -util_format_r11g11b10_float_fetch_rgba_float(float *dst, const uint8_t *src, - unsigned i, unsigned j) -{ - uint32_t value = *(const uint32_t *)src; -#ifdef PIPE_ARCH_BIG_ENDIAN - value = util_bswap32(value); -#endif - r11g11b10f_to_float3(value, dst); - dst[3] = 1; /* a */ -} - - -void -util_format_r11g11b10_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ - unsigned x, y; - float p[3]; - for(y = 0; y < height; y += 1) { - uint8_t *dst = dst_row; - const uint8_t *src = src_row; - for(x = 0; x < width; x += 1) { - uint32_t value = *(const uint32_t *)src; -#ifdef PIPE_ARCH_BIG_ENDIAN - value = util_bswap32(value); -#endif - r11g11b10f_to_float3(value, p); - dst[0] = float_to_ubyte(p[0]); /* r */ - dst[1] = float_to_ubyte(p[1]); /* g */ - dst[2] = float_to_ubyte(p[2]); /* b */ - dst[3] = 255; /* a */ - src += 4; - dst += 4; - } - src_row += src_stride; - dst_row += dst_stride/sizeof(*dst_row); - } -} - - -void -util_format_r11g11b10_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ - unsigned x, y; - float p[3]; - for(y = 0; y < height; y += 1) { - const uint8_t *src = src_row; - uint8_t *dst = dst_row; - for(x = 0; x < width; x += 1) { - uint32_t value; - p[0] = ubyte_to_float(src[0]); - p[1] = ubyte_to_float(src[1]); - p[2] = ubyte_to_float(src[2]); - value = float3_to_r11g11b10f(p); -#ifdef PIPE_ARCH_BIG_ENDIAN - value = util_bswap32(value); -#endif - *(uint32_t *)dst = value; - src += 4; - dst += 4; - } - dst_row += dst_stride; - src_row += src_stride/sizeof(*src_row); - } -} - - -void -util_format_r1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ - -} - - -void -util_format_r1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, - const float *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ - -} - - -void -util_format_r1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, - unsigned i, unsigned j) -{ - -} - - -void -util_format_r1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ - -} - - -void -util_format_r1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ -} - - -/* - * PIPE_FORMAT_R8G8Bx_SNORM - * - * A.k.a. D3DFMT_CxV8U8 - */ - -static uint8_t -r8g8bx_derive(int16_t r, int16_t g) -{ - /* Derive blue from red and green components. - * Apparently, we must always use integers to perform calculations, - * otherwise the results won't match D3D's CxV8U8 definition. - */ - return (uint8_t)sqrtf(0x7f * 0x7f - r * r - g * g) * 0xff / 0x7f; -} - -void -util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ - unsigned x, y; - - for(y = 0; y < height; y += 1) { - float *dst = dst_row; - const uint16_t *src = (const uint16_t *)src_row; - for(x = 0; x < width; x += 1) { - uint16_t value = *src++; - int16_t r, g; - -#ifdef PIPE_ARCH_BIG_ENDIAN - value = util_bswap32(value); -#endif - - r = ((int16_t)(value << 8)) >> 8; - g = ((int16_t)(value << 0)) >> 8; - - dst[0] = (float)(r * (1.0f/0x7f)); /* r */ - dst[1] = (float)(g * (1.0f/0x7f)); /* g */ - dst[2] = r8g8bx_derive(r, g) * (1.0f/0xff); /* b */ - dst[3] = 1.0f; /* a */ - dst += 4; - } - src_row += src_stride; - dst_row += dst_stride/sizeof(*dst_row); - } -} - - -void -util_format_r8g8bx_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ - unsigned x, y; - for(y = 0; y < height; y += 1) { - uint8_t *dst = dst_row; - const uint16_t *src = (const uint16_t *)src_row; - for(x = 0; x < width; x += 1) { - uint16_t value = *src++; - int16_t r, g; - -#ifdef PIPE_ARCH_BIG_ENDIAN - value = util_bswap32(value); -#endif - - r = ((int16_t)(value << 8)) >> 8; - g = ((int16_t)(value << 0)) >> 8; - - dst[0] = (uint8_t)(((uint16_t)MAX2(r, 0)) * 0xff / 0x7f); /* r */ - dst[1] = (uint8_t)(((uint16_t)MAX2(g, 0)) * 0xff / 0x7f); /* g */ - dst[2] = r8g8bx_derive(r, g); /* b */ - dst[3] = 255; /* a */ - dst += 4; - } - src_row += src_stride; - dst_row += dst_stride/sizeof(*dst_row); - } -} - - -void -util_format_r8g8bx_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, - const float *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ - unsigned x, y; - for(y = 0; y < height; y += 1) { - const float *src = src_row; - uint16_t *dst = (uint16_t *)dst_row; - for(x = 0; x < width; x += 1) { - uint16_t value = 0; - - value |= (uint16_t)(((int8_t)(CLAMP(src[0], -1, 1) * 0x7f)) & 0xff) ; - value |= (uint16_t)((((int8_t)(CLAMP(src[1], -1, 1) * 0x7f)) & 0xff) << 8) ; - -#ifdef PIPE_ARCH_BIG_ENDIAN - value = util_bswap32(value); -#endif - - *dst++ = value; - - src += 4; - } - dst_row += dst_stride; - src_row += src_stride/sizeof(*src_row); - } -} - - -void -util_format_r8g8bx_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height) -{ - unsigned x, y; - - for(y = 0; y < height; y += 1) { - const uint8_t *src = src_row; - uint16_t *dst = (uint16_t *)dst_row; - for(x = 0; x < width; x += 1) { - uint16_t value = 0; - - value |= src[0] >> 1; - value |= (src[1] >> 1) << 8; - -#ifdef PIPE_ARCH_BIG_ENDIAN - value = util_bswap32(value); -#endif - - *dst++ = value; - - src += 4; - } - dst_row += dst_stride; - src_row += src_stride/sizeof(*src_row); - } -} - - -void -util_format_r8g8bx_snorm_fetch_rgba_float(float *dst, const uint8_t *src, - unsigned i, unsigned j) -{ - uint16_t value = *(const uint16_t *)src; - int16_t r, g; - -#ifdef PIPE_ARCH_BIG_ENDIAN - value = util_bswap32(value); -#endif - - r = ((int16_t)(value << 8)) >> 8; - g = ((int16_t)(value << 0)) >> 8; - - dst[0] = r * (1.0f/0x7f); /* r */ - dst[1] = g * (1.0f/0x7f); /* g */ - dst[2] = r8g8bx_derive(r, g) * (1.0f/0xff); /* b */ - dst[3] = 1.0f; /* a */ -} +/************************************************************************** + * + * Copyright 2010 VMware, 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS 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. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + + +#include "u_math.h" +#include "u_format_other.h" +#include "u_format_rgb9e5.h" +#include "u_format_r11g11b10f.h" + + +void +util_format_r9g9b9e5_float_unpack_rgba_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; y += 1) { + float *dst = dst_row; + const uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint32_t value = *(const uint32_t *)src; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + rgb9e5_to_float3(value, dst); + dst[3] = 1; /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_r9g9b9e5_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; y += 1) { + const float *src = src_row; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint32_t value = float3_to_rgb9e5(src); +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_r9g9b9e5_float_fetch_rgba_float(float *dst, const uint8_t *src, + unsigned i, unsigned j) +{ + uint32_t value = *(const uint32_t *)src; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + rgb9e5_to_float3(value, dst); + dst[3] = 1; /* a */ +} + + +void +util_format_r9g9b9e5_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + float p[3]; + for(y = 0; y < height; y += 1) { + uint8_t *dst = dst_row; + const uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint32_t value = *(const uint32_t *)src; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + rgb9e5_to_float3(value, p); + dst[0] = float_to_ubyte(p[0]); /* r */ + dst[1] = float_to_ubyte(p[1]); /* g */ + dst[2] = float_to_ubyte(p[2]); /* b */ + dst[3] = 255; /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + + +void +util_format_r9g9b9e5_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + float p[3]; + for(y = 0; y < height; y += 1) { + const uint8_t *src = src_row; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint32_t value; + p[0] = ubyte_to_float(src[0]); + p[1] = ubyte_to_float(src[1]); + p[2] = ubyte_to_float(src[2]); + value = float3_to_rgb9e5(p); +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + + +void +util_format_r11g11b10_float_unpack_rgba_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; y += 1) { + float *dst = dst_row; + const uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint32_t value = *(const uint32_t *)src; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + r11g11b10f_to_float3(value, dst); + dst[3] = 1; /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_r11g11b10_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; y += 1) { + const float *src = src_row; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint32_t value = float3_to_r11g11b10f(src); +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_r11g11b10_float_fetch_rgba_float(float *dst, const uint8_t *src, + unsigned i, unsigned j) +{ + uint32_t value = *(const uint32_t *)src; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + r11g11b10f_to_float3(value, dst); + dst[3] = 1; /* a */ +} + + +void +util_format_r11g11b10_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + float p[3]; + for(y = 0; y < height; y += 1) { + uint8_t *dst = dst_row; + const uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint32_t value = *(const uint32_t *)src; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + r11g11b10f_to_float3(value, p); + dst[0] = float_to_ubyte(p[0]); /* r */ + dst[1] = float_to_ubyte(p[1]); /* g */ + dst[2] = float_to_ubyte(p[2]); /* b */ + dst[3] = 255; /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + + +void +util_format_r11g11b10_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + float p[3]; + for(y = 0; y < height; y += 1) { + const uint8_t *src = src_row; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint32_t value; + p[0] = ubyte_to_float(src[0]); + p[1] = ubyte_to_float(src[1]); + p[2] = ubyte_to_float(src[2]); + value = float3_to_r11g11b10f(p); +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + + +void +util_format_r1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + +} + + +void +util_format_r1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + +} + + +void +util_format_r1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, + unsigned i, unsigned j) +{ + +} + + +void +util_format_r1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + +} + + +void +util_format_r1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ +} + + +/* + * PIPE_FORMAT_R8G8Bx_SNORM + * + * A.k.a. D3DFMT_CxV8U8 + */ + +static uint8_t +r8g8bx_derive(int16_t r, int16_t g) +{ + /* Derive blue from red and green components. + * Apparently, we must always use integers to perform calculations, + * otherwise the results won't match D3D's CxV8U8 definition. + */ + return (uint8_t)sqrtf(0x7f * 0x7f - r * r - g * g) * 0xff / 0x7f; +} + +void +util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + + for(y = 0; y < height; y += 1) { + float *dst = dst_row; + const uint16_t *src = (const uint16_t *)src_row; + for(x = 0; x < width; x += 1) { + uint16_t value = *src++; + int16_t r, g; + +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + + r = ((int16_t)(value << 8)) >> 8; + g = ((int16_t)(value << 0)) >> 8; + + dst[0] = (float)(r * (1.0f/0x7f)); /* r */ + dst[1] = (float)(g * (1.0f/0x7f)); /* g */ + dst[2] = r8g8bx_derive(r, g) * (1.0f/0xff); /* b */ + dst[3] = 1.0f; /* a */ + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + + +void +util_format_r8g8bx_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; y += 1) { + uint8_t *dst = dst_row; + const uint16_t *src = (const uint16_t *)src_row; + for(x = 0; x < width; x += 1) { + uint16_t value = *src++; + int16_t r, g; + +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + + r = ((int16_t)(value << 8)) >> 8; + g = ((int16_t)(value << 0)) >> 8; + + dst[0] = (uint8_t)(((uint16_t)MAX2(r, 0)) * 0xff / 0x7f); /* r */ + dst[1] = (uint8_t)(((uint16_t)MAX2(g, 0)) * 0xff / 0x7f); /* g */ + dst[2] = r8g8bx_derive(r, g); /* b */ + dst[3] = 255; /* a */ + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + + +void +util_format_r8g8bx_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; y += 1) { + const float *src = src_row; + uint16_t *dst = (uint16_t *)dst_row; + for(x = 0; x < width; x += 1) { + uint16_t value = 0; + + value |= (uint16_t)(((int8_t)(CLAMP(src[0], -1, 1) * 0x7f)) & 0xff) ; + value |= (uint16_t)((((int8_t)(CLAMP(src[1], -1, 1) * 0x7f)) & 0xff) << 8) ; + +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + + *dst++ = value; + + src += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + + +void +util_format_r8g8bx_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + + for(y = 0; y < height; y += 1) { + const uint8_t *src = src_row; + uint16_t *dst = (uint16_t *)dst_row; + for(x = 0; x < width; x += 1) { + uint16_t value = 0; + + value |= src[0] >> 1; + value |= (src[1] >> 1) << 8; + +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + + *dst++ = value; + + src += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + + +void +util_format_r8g8bx_snorm_fetch_rgba_float(float *dst, const uint8_t *src, + unsigned i, unsigned j) +{ + uint16_t value = *(const uint16_t *)src; + int16_t r, g; + +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + + r = ((int16_t)(value << 8)) >> 8; + g = ((int16_t)(value << 0)) >> 8; + + dst[0] = r * (1.0f/0x7f); /* r */ + dst[1] = g * (1.0f/0x7f); /* g */ + dst[2] = r8g8bx_derive(r, g) * (1.0f/0xff); /* b */ + dst[3] = 1.0f; /* a */ +} diff --git a/mesalib/src/gallium/auxiliary/util/u_format_other.h b/mesalib/src/gallium/auxiliary/util/u_format_other.h index d8237da5e..2f6a908bb 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_other.h +++ b/mesalib/src/gallium/auxiliary/util/u_format_other.h @@ -1,134 +1,134 @@ -/************************************************************************** - * - * Copyright 2010 VMware, 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS 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. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - **************************************************************************/ - - -#ifndef U_FORMAT_OTHER_H_ -#define U_FORMAT_OTHER_H_ - - -#include "pipe/p_compiler.h" - - -void -util_format_r9g9b9e5_float_unpack_rgba_float(float *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height); - -void -util_format_r9g9b9e5_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, - const float *src_row, unsigned src_stride, - unsigned width, unsigned height); - -void -util_format_r9g9b9e5_float_fetch_rgba_float(float *dst, const uint8_t *src, - unsigned i, unsigned j); - -void -util_format_r9g9b9e5_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height); - -void -util_format_r9g9b9e5_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height); - - -void -util_format_r11g11b10_float_unpack_rgba_float(float *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height); - -void -util_format_r11g11b10_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, - const float *src_row, unsigned src_stride, - unsigned width, unsigned height); - -void -util_format_r11g11b10_float_fetch_rgba_float(float *dst, const uint8_t *src, - unsigned i, unsigned j); - -void -util_format_r11g11b10_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height); - -void -util_format_r11g11b10_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height); - - -void -util_format_r1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height); - -void -util_format_r1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, - const float *src_row, unsigned src_stride, - unsigned width, unsigned height); - -void -util_format_r1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, - unsigned i, unsigned j); - -void -util_format_r1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height); - -void -util_format_r1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height); - -void -util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height); - -void -util_format_r8g8bx_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, - const float *src_row, unsigned src_stride, - unsigned width, unsigned height); - -void -util_format_r8g8bx_snorm_fetch_rgba_float(float *dst, const uint8_t *src, - unsigned i, unsigned j); - -void -util_format_r8g8bx_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height); - -void -util_format_r8g8bx_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, - const uint8_t *src_row, unsigned src_stride, - unsigned width, unsigned height); - -#endif /* U_FORMAT_OTHER_H_ */ +/************************************************************************** + * + * Copyright 2010 VMware, 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS 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. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + + +#ifndef U_FORMAT_OTHER_H_ +#define U_FORMAT_OTHER_H_ + + +#include "pipe/p_compiler.h" + + +void +util_format_r9g9b9e5_float_unpack_rgba_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_r9g9b9e5_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_r9g9b9e5_float_fetch_rgba_float(float *dst, const uint8_t *src, + unsigned i, unsigned j); + +void +util_format_r9g9b9e5_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_r9g9b9e5_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + + +void +util_format_r11g11b10_float_unpack_rgba_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_r11g11b10_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_r11g11b10_float_fetch_rgba_float(float *dst, const uint8_t *src, + unsigned i, unsigned j); + +void +util_format_r11g11b10_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_r11g11b10_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + + +void +util_format_r1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_r1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_r1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, + unsigned i, unsigned j); + +void +util_format_r1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_r1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_r8g8bx_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_r8g8bx_snorm_fetch_rgba_float(float *dst, const uint8_t *src, + unsigned i, unsigned j); + +void +util_format_r8g8bx_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_r8g8bx_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +#endif /* U_FORMAT_OTHER_H_ */ diff --git a/mesalib/src/gallium/auxiliary/util/u_format_rgb9e5.h b/mesalib/src/gallium/auxiliary/util/u_format_rgb9e5.h index 01f4e2108..c2a3f6f3e 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_rgb9e5.h +++ b/mesalib/src/gallium/auxiliary/util/u_format_rgb9e5.h @@ -1,164 +1,164 @@ -/* - * Copyright (C) 2011 Marek Olšák - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. - */ - -/* Copied from EXT_texture_shared_exponent and edited. */ - -#ifndef RGB9E5_H -#define RGB9E5_H - -#include -#include - -#define RGB9E5_EXPONENT_BITS 5 -#define RGB9E5_MANTISSA_BITS 9 -#define RGB9E5_EXP_BIAS 15 -#define RGB9E5_MAX_VALID_BIASED_EXP 31 - -#define MAX_RGB9E5_EXP (RGB9E5_MAX_VALID_BIASED_EXP - RGB9E5_EXP_BIAS) -#define RGB9E5_MANTISSA_VALUES (1< 0.0) { - if (x >= MAX_RGB9E5) { - return MAX_RGB9E5; - } else { - return x; - } - } else { - /* NaN gets here too since comparisons with NaN always fail! */ - return 0.0; - } -} - -/* Ok, FloorLog2 is not correct for the denorm and zero values, but we - are going to do a max of this value with the minimum rgb9e5 exponent - that will hide these problem cases. */ -static INLINE int rgb9e5_FloorLog2(float x) -{ - float754 f; - - f.value = x; - return (f.field.biasedexponent - 127); -} - -static INLINE unsigned float3_to_rgb9e5(const float rgb[3]) -{ - rgb9e5 retval; - float maxrgb; - int rm, gm, bm; - float rc, gc, bc; - int exp_shared, maxm; - double denom; - - rc = rgb9e5_ClampRange(rgb[0]); - gc = rgb9e5_ClampRange(rgb[1]); - bc = rgb9e5_ClampRange(rgb[2]); - - maxrgb = MAX3(rc, gc, bc); - exp_shared = MAX2(-RGB9E5_EXP_BIAS-1, rgb9e5_FloorLog2(maxrgb)) + 1 + RGB9E5_EXP_BIAS; - assert(exp_shared <= RGB9E5_MAX_VALID_BIASED_EXP); - assert(exp_shared >= 0); - /* This pow function could be replaced by a table. */ - denom = pow(2, exp_shared - RGB9E5_EXP_BIAS - RGB9E5_MANTISSA_BITS); - - maxm = (int) floor(maxrgb / denom + 0.5); - if (maxm == MAX_RGB9E5_MANTISSA+1) { - denom *= 2; - exp_shared += 1; - assert(exp_shared <= RGB9E5_MAX_VALID_BIASED_EXP); - } else { - assert(maxm <= MAX_RGB9E5_MANTISSA); - } - - rm = (int) floor(rc / denom + 0.5); - gm = (int) floor(gc / denom + 0.5); - bm = (int) floor(bc / denom + 0.5); - - assert(rm <= MAX_RGB9E5_MANTISSA); - assert(gm <= MAX_RGB9E5_MANTISSA); - assert(bm <= MAX_RGB9E5_MANTISSA); - assert(rm >= 0); - assert(gm >= 0); - assert(bm >= 0); - - retval.field.r = rm; - retval.field.g = gm; - retval.field.b = bm; - retval.field.biasedexponent = exp_shared; - - return retval.raw; -} - -static INLINE void rgb9e5_to_float3(unsigned rgb, float retval[3]) -{ - rgb9e5 v; - int exponent; - float scale; - - v.raw = rgb; - exponent = v.field.biasedexponent - RGB9E5_EXP_BIAS - RGB9E5_MANTISSA_BITS; - scale = (float) pow(2, exponent); - - retval[0] = v.field.r * scale; - retval[1] = v.field.g * scale; - retval[2] = v.field.b * scale; -} - -#endif +/* + * Copyright (C) 2011 Marek Olšák + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. + */ + +/* Copied from EXT_texture_shared_exponent and edited. */ + +#ifndef RGB9E5_H +#define RGB9E5_H + +#include +#include + +#define RGB9E5_EXPONENT_BITS 5 +#define RGB9E5_MANTISSA_BITS 9 +#define RGB9E5_EXP_BIAS 15 +#define RGB9E5_MAX_VALID_BIASED_EXP 31 + +#define MAX_RGB9E5_EXP (RGB9E5_MAX_VALID_BIASED_EXP - RGB9E5_EXP_BIAS) +#define RGB9E5_MANTISSA_VALUES (1< 0.0) { + if (x >= MAX_RGB9E5) { + return MAX_RGB9E5; + } else { + return x; + } + } else { + /* NaN gets here too since comparisons with NaN always fail! */ + return 0.0; + } +} + +/* Ok, FloorLog2 is not correct for the denorm and zero values, but we + are going to do a max of this value with the minimum rgb9e5 exponent + that will hide these problem cases. */ +static INLINE int rgb9e5_FloorLog2(float x) +{ + float754 f; + + f.value = x; + return (f.field.biasedexponent - 127); +} + +static INLINE unsigned float3_to_rgb9e5(const float rgb[3]) +{ + rgb9e5 retval; + float maxrgb; + int rm, gm, bm; + float rc, gc, bc; + int exp_shared, maxm; + double denom; + + rc = rgb9e5_ClampRange(rgb[0]); + gc = rgb9e5_ClampRange(rgb[1]); + bc = rgb9e5_ClampRange(rgb[2]); + + maxrgb = MAX3(rc, gc, bc); + exp_shared = MAX2(-RGB9E5_EXP_BIAS-1, rgb9e5_FloorLog2(maxrgb)) + 1 + RGB9E5_EXP_BIAS; + assert(exp_shared <= RGB9E5_MAX_VALID_BIASED_EXP); + assert(exp_shared >= 0); + /* This pow function could be replaced by a table. */ + denom = pow(2, exp_shared - RGB9E5_EXP_BIAS - RGB9E5_MANTISSA_BITS); + + maxm = (int) floor(maxrgb / denom + 0.5); + if (maxm == MAX_RGB9E5_MANTISSA+1) { + denom *= 2; + exp_shared += 1; + assert(exp_shared <= RGB9E5_MAX_VALID_BIASED_EXP); + } else { + assert(maxm <= MAX_RGB9E5_MANTISSA); + } + + rm = (int) floor(rc / denom + 0.5); + gm = (int) floor(gc / denom + 0.5); + bm = (int) floor(bc / denom + 0.5); + + assert(rm <= MAX_RGB9E5_MANTISSA); + assert(gm <= MAX_RGB9E5_MANTISSA); + assert(bm <= MAX_RGB9E5_MANTISSA); + assert(rm >= 0); + assert(gm >= 0); + assert(bm >= 0); + + retval.field.r = rm; + retval.field.g = gm; + retval.field.b = bm; + retval.field.biasedexponent = exp_shared; + + return retval.raw; +} + +static INLINE void rgb9e5_to_float3(unsigned rgb, float retval[3]) +{ + rgb9e5 v; + int exponent; + float scale; + + v.raw = rgb; + exponent = v.field.biasedexponent - RGB9E5_EXP_BIAS - RGB9E5_MANTISSA_BITS; + scale = (float) pow(2, exponent); + + retval[0] = v.field.r * scale; + retval[1] = v.field.g * scale; + retval[2] = v.field.b * scale; +} + +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_format_rgtc.h b/mesalib/src/gallium/auxiliary/util/u_format_rgtc.h index 723c9c89a..67ac4728e 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_rgtc.h +++ b/mesalib/src/gallium/auxiliary/util/u_format_rgtc.h @@ -1,114 +1,114 @@ -/************************************************************************** - * - * Copyright 2011 Red Hat 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS 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. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - **************************************************************************/ - -#ifndef U_FORMAT_RGTC_H_ -#define U_FORMAT_RGTC_H_ - -void -util_format_rgtc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_rgtc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rgtc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rgtc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rgtc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rgtc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - - - -void -util_format_rgtc1_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_rgtc1_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rgtc1_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rgtc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rgtc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - - -void -util_format_rgtc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_rgtc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rgtc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rxtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off); - -void -util_format_rgtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rgtc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rgtc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - - -void -util_format_rgtc2_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_rgtc2_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rgtc2_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rgtc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rxtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off); - -void -util_format_rgtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_rgtc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - - -#endif +/************************************************************************** + * + * Copyright 2011 Red Hat 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS 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. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + +#ifndef U_FORMAT_RGTC_H_ +#define U_FORMAT_RGTC_H_ + +void +util_format_rgtc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_rgtc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rgtc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rgtc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rgtc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rgtc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + + + +void +util_format_rgtc1_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_rgtc1_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rgtc1_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rgtc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rgtc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + + +void +util_format_rgtc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_rgtc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rgtc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rxtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off); + +void +util_format_rgtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rgtc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rgtc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + + +void +util_format_rgtc2_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_rgtc2_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rgtc2_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rgtc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rxtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off); + +void +util_format_rgtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_rgtc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + + +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_format_s3tc.h b/mesalib/src/gallium/auxiliary/util/u_format_s3tc.h index 887d11079..97770abd4 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_s3tc.h +++ b/mesalib/src/gallium/auxiliary/util/u_format_s3tc.h @@ -1,218 +1,218 @@ -/************************************************************************** - * - * Copyright 2010 VMware, 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS 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. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - **************************************************************************/ - - -#ifndef U_FORMAT_S3TC_H_ -#define U_FORMAT_S3TC_H_ - - -#include "pipe/p_compiler.h" - - -enum util_format_dxtn { - UTIL_FORMAT_DXT1_RGB = 0x83F0, - UTIL_FORMAT_DXT1_RGBA = 0x83F1, - UTIL_FORMAT_DXT3_RGBA = 0x83F2, - UTIL_FORMAT_DXT5_RGBA = 0x83F3 -}; - - -typedef void -(*util_format_dxtn_fetch_t)( int src_stride, - const uint8_t *src, - int col, int row, - uint8_t *dst ); - -typedef void -(*util_format_dxtn_pack_t)( int src_comps, - int width, int height, - const uint8_t *src, - enum util_format_dxtn dst_format, - uint8_t *dst, - int dst_stride); - -extern boolean util_format_s3tc_enabled; - -extern util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch; -extern util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch; -extern util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch; -extern util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch; - -extern util_format_dxtn_pack_t util_format_dxtn_pack; - - -void -util_format_s3tc_init(void); - - -void -util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); - - -void -util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - -void -util_format_dxt5_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); - -void -util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); - - -#endif /* U_FORMAT_S3TC_H_ */ +/************************************************************************** + * + * Copyright 2010 VMware, 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS 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. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + + +#ifndef U_FORMAT_S3TC_H_ +#define U_FORMAT_S3TC_H_ + + +#include "pipe/p_compiler.h" + + +enum util_format_dxtn { + UTIL_FORMAT_DXT1_RGB = 0x83F0, + UTIL_FORMAT_DXT1_RGBA = 0x83F1, + UTIL_FORMAT_DXT3_RGBA = 0x83F2, + UTIL_FORMAT_DXT5_RGBA = 0x83F3 +}; + + +typedef void +(*util_format_dxtn_fetch_t)( int src_stride, + const uint8_t *src, + int col, int row, + uint8_t *dst ); + +typedef void +(*util_format_dxtn_pack_t)( int src_comps, + int width, int height, + const uint8_t *src, + enum util_format_dxtn dst_format, + uint8_t *dst, + int dst_stride); + +extern boolean util_format_s3tc_enabled; + +extern util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch; +extern util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch; +extern util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch; +extern util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch; + +extern util_format_dxtn_pack_t util_format_dxtn_pack; + + +void +util_format_s3tc_init(void); + + +void +util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + + +void +util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_dxt5_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + + +#endif /* U_FORMAT_S3TC_H_ */ diff --git a/mesalib/src/gallium/auxiliary/util/u_format_srgb.h b/mesalib/src/gallium/auxiliary/util/u_format_srgb.h index a1b12e9de..43213fbeb 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_srgb.h +++ b/mesalib/src/gallium/auxiliary/util/u_format_srgb.h @@ -1,106 +1,106 @@ -/************************************************************************** - * - * Copyright 2010 VMware, 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS 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. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - **************************************************************************/ - -/** - * @file - * SRGB translation. - * - * @author Brian Paul - * @author Michal Krol - * @author Jose Fonseca - */ - -#ifndef U_FORMAT_SRGB_H_ -#define U_FORMAT_SRGB_H_ - - -#include "pipe/p_compiler.h" -#include "u_math.h" - - -extern const float -util_format_srgb_8unorm_to_linear_float_table[256]; - -extern const uint8_t -util_format_srgb_to_linear_8unorm_table[256]; - -extern const uint8_t -util_format_linear_to_srgb_8unorm_table[256]; - - -/** - * Convert a unclamped linear float to srgb value in the [0,255]. - * XXX this hasn't been tested (render to srgb surface). - * XXX this needs optimization. - */ -static INLINE uint8_t -util_format_linear_float_to_srgb_8unorm(float x) -{ - if (x >= 1.0f) - return 255; - else if (x >= 0.0031308f) - return float_to_ubyte(1.055f * powf(x, 0.41666f) - 0.055f); - else if (x > 0.0f) - return float_to_ubyte(12.92f * x); - else - return 0; -} - - -/** - * Convert an 8-bit sRGB value from non-linear space to a - * linear RGB value in [0, 1]. - * Implemented with a 256-entry lookup table. - */ -static INLINE float -util_format_srgb_8unorm_to_linear_float(uint8_t x) -{ - return util_format_srgb_8unorm_to_linear_float_table[x]; -} - - -/** - * Convert a 8bit normalized value from linear to srgb. - */ -static INLINE uint8_t -util_format_linear_to_srgb_8unorm(uint8_t x) -{ - return util_format_linear_to_srgb_8unorm_table[x]; -} - - -/** - * Convert a 8bit normalized value from srgb to linear. - */ -static INLINE uint8_t -util_format_srgb_to_linear_8unorm(uint8_t x) -{ - return util_format_srgb_to_linear_8unorm_table[x]; -} - - -#endif /* U_FORMAT_SRGB_H_ */ +/************************************************************************** + * + * Copyright 2010 VMware, 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS 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. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + +/** + * @file + * SRGB translation. + * + * @author Brian Paul + * @author Michal Krol + * @author Jose Fonseca + */ + +#ifndef U_FORMAT_SRGB_H_ +#define U_FORMAT_SRGB_H_ + + +#include "pipe/p_compiler.h" +#include "u_math.h" + + +extern const float +util_format_srgb_8unorm_to_linear_float_table[256]; + +extern const uint8_t +util_format_srgb_to_linear_8unorm_table[256]; + +extern const uint8_t +util_format_linear_to_srgb_8unorm_table[256]; + + +/** + * Convert a unclamped linear float to srgb value in the [0,255]. + * XXX this hasn't been tested (render to srgb surface). + * XXX this needs optimization. + */ +static INLINE uint8_t +util_format_linear_float_to_srgb_8unorm(float x) +{ + if (x >= 1.0f) + return 255; + else if (x >= 0.0031308f) + return float_to_ubyte(1.055f * powf(x, 0.41666f) - 0.055f); + else if (x > 0.0f) + return float_to_ubyte(12.92f * x); + else + return 0; +} + + +/** + * Convert an 8-bit sRGB value from non-linear space to a + * linear RGB value in [0, 1]. + * Implemented with a 256-entry lookup table. + */ +static INLINE float +util_format_srgb_8unorm_to_linear_float(uint8_t x) +{ + return util_format_srgb_8unorm_to_linear_float_table[x]; +} + + +/** + * Convert a 8bit normalized value from linear to srgb. + */ +static INLINE uint8_t +util_format_linear_to_srgb_8unorm(uint8_t x) +{ + return util_format_linear_to_srgb_8unorm_table[x]; +} + + +/** + * Convert a 8bit normalized value from srgb to linear. + */ +static INLINE uint8_t +util_format_srgb_to_linear_8unorm(uint8_t x) +{ + return util_format_srgb_to_linear_8unorm_table[x]; +} + + +#endif /* U_FORMAT_SRGB_H_ */ diff --git a/mesalib/src/gallium/auxiliary/util/u_format_srgb.py b/mesalib/src/gallium/auxiliary/util/u_format_srgb.py index c7b0464d4..cd63ae789 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_srgb.py +++ b/mesalib/src/gallium/auxiliary/util/u_format_srgb.py @@ -1,100 +1,100 @@ -#!/usr/bin/env python - -CopyRight = ''' -/************************************************************************** - * - * Copyright 2010 VMware, 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 VMWARE 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 - * SRGB translation. - * - * @author Brian Paul - * @author Michal Krol - * @author Jose Fonseca - */ -''' - - -import math - - -def srgb_to_linear(x): - if x <= 0.04045: - return x / 12.92 - else: - return math.pow((x + 0.055) / 1.055, 2.4) - - -def linear_to_srgb(x): - if x >= 0.0031308: - return 1.055 * math.pow(x, 0.41666) - 0.055 - else: - return 12.92 * x - -def generate_srgb_tables(): - print 'const float' - print 'util_format_srgb_8unorm_to_linear_float_table[256] = {' - for j in range(0, 256, 4): - print ' ', - for i in range(j, j + 4): - print '%.7e,' % (srgb_to_linear(i / 255.0),), - print - print '};' - print - print 'const uint8_t' - print 'util_format_srgb_to_linear_8unorm_table[256] = {' - for j in range(0, 256, 16): - print ' ', - for i in range(j, j + 16): - print '%3u,' % (int(srgb_to_linear(i / 255.0) * 255.0 + 0.5),), - print - print '};' - print - print 'const uint8_t' - print 'util_format_linear_to_srgb_8unorm_table[256] = {' - for j in range(0, 256, 16): - print ' ', - for i in range(j, j + 16): - print '%3u,' % (int(linear_to_srgb(i / 255.0) * 255.0 + 0.5),), - print - print '};' - print - - -def main(): - print '/* This file is autogenerated by u_format_srgb.py. Do not edit directly. */' - print - # This will print the copyright message on the top of this file - print CopyRight.strip() - print - print '#include "u_format_srgb.h"' - print - generate_srgb_tables() - - -if __name__ == '__main__': - main() +#!/usr/bin/env python + +CopyRight = ''' +/************************************************************************** + * + * Copyright 2010 VMware, 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 VMWARE 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 + * SRGB translation. + * + * @author Brian Paul + * @author Michal Krol + * @author Jose Fonseca + */ +''' + + +import math + + +def srgb_to_linear(x): + if x <= 0.04045: + return x / 12.92 + else: + return math.pow((x + 0.055) / 1.055, 2.4) + + +def linear_to_srgb(x): + if x >= 0.0031308: + return 1.055 * math.pow(x, 0.41666) - 0.055 + else: + return 12.92 * x + +def generate_srgb_tables(): + print 'const float' + print 'util_format_srgb_8unorm_to_linear_float_table[256] = {' + for j in range(0, 256, 4): + print ' ', + for i in range(j, j + 4): + print '%.7e,' % (srgb_to_linear(i / 255.0),), + print + print '};' + print + print 'const uint8_t' + print 'util_format_srgb_to_linear_8unorm_table[256] = {' + for j in range(0, 256, 16): + print ' ', + for i in range(j, j + 16): + print '%3u,' % (int(srgb_to_linear(i / 255.0) * 255.0 + 0.5),), + print + print '};' + print + print 'const uint8_t' + print 'util_format_linear_to_srgb_8unorm_table[256] = {' + for j in range(0, 256, 16): + print ' ', + for i in range(j, j + 16): + print '%3u,' % (int(linear_to_srgb(i / 255.0) * 255.0 + 0.5),), + print + print '};' + print + + +def main(): + print '/* This file is autogenerated by u_format_srgb.py. Do not edit directly. */' + print + # This will print the copyright message on the top of this file + print CopyRight.strip() + print + print '#include "u_format_srgb.h"' + print + generate_srgb_tables() + + +if __name__ == '__main__': + main() diff --git a/mesalib/src/gallium/auxiliary/util/u_format_tests.h b/mesalib/src/gallium/auxiliary/util/u_format_tests.h index 5de1cb237..f59563f4f 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_tests.h +++ b/mesalib/src/gallium/auxiliary/util/u_format_tests.h @@ -1,71 +1,71 @@ -/************************************************************************** - * - * Copyright 2010 VMware, 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS 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. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - **************************************************************************/ - - -#ifndef U_FORMAT_TESTS_H_ -#define U_FORMAT_TESTS_H_ - - -#include "pipe/p_compiler.h" -#include "pipe/p_format.h" - - -#define UTIL_FORMAT_MAX_PACKED_BYTES 16 -#define UTIL_FORMAT_MAX_UNPACKED_WIDTH 4 -#define UTIL_FORMAT_MAX_UNPACKED_HEIGHT 4 - - -/** - * A (packed, unpacked) color pair. - */ -struct util_format_test_case -{ - enum pipe_format format; - - /** - * Mask of the bits that actually meaningful data. Used to mask out the - * "X" channels. - */ - uint8_t mask[UTIL_FORMAT_MAX_PACKED_BYTES]; - - uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES]; - - /** - * RGBA. - */ - double unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4]; -}; - - -extern const struct util_format_test_case -util_format_test_cases[]; - - -extern const unsigned util_format_nr_test_cases; - - -#endif /* U_FORMAT_TESTS_H_ */ +/************************************************************************** + * + * Copyright 2010 VMware, 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS 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. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + + +#ifndef U_FORMAT_TESTS_H_ +#define U_FORMAT_TESTS_H_ + + +#include "pipe/p_compiler.h" +#include "pipe/p_format.h" + + +#define UTIL_FORMAT_MAX_PACKED_BYTES 16 +#define UTIL_FORMAT_MAX_UNPACKED_WIDTH 4 +#define UTIL_FORMAT_MAX_UNPACKED_HEIGHT 4 + + +/** + * A (packed, unpacked) color pair. + */ +struct util_format_test_case +{ + enum pipe_format format; + + /** + * Mask of the bits that actually meaningful data. Used to mask out the + * "X" channels. + */ + uint8_t mask[UTIL_FORMAT_MAX_PACKED_BYTES]; + + uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES]; + + /** + * RGBA. + */ + double unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4]; +}; + + +extern const struct util_format_test_case +util_format_test_cases[]; + + +extern const unsigned util_format_nr_test_cases; + + +#endif /* U_FORMAT_TESTS_H_ */ diff --git a/mesalib/src/gallium/auxiliary/util/u_framebuffer.c b/mesalib/src/gallium/auxiliary/util/u_framebuffer.c index 8d89c81c7..7803ec6a8 100644 --- a/mesalib/src/gallium/auxiliary/util/u_framebuffer.c +++ b/mesalib/src/gallium/auxiliary/util/u_framebuffer.c @@ -1,148 +1,148 @@ -/************************************************************************** - * - * Copyright 2009-2010 VMware, 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 VMWARE 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 - * Framebuffer utility functions. - * - * @author Brian Paul - */ - - -#include "pipe/p_screen.h" -#include "pipe/p_state.h" -#include "pipe/p_defines.h" -#include "util/u_inlines.h" - -#include "util/u_memory.h" -#include "util/u_framebuffer.h" - - -/** - * Compare pipe_framebuffer_state objects. - * \return TRUE if same, FALSE if different - */ -boolean -util_framebuffer_state_equal(const struct pipe_framebuffer_state *dst, - const struct pipe_framebuffer_state *src) -{ - unsigned i; - - if (dst->width != src->width || - dst->height != src->height) - return FALSE; - - for (i = 0; i < Elements(src->cbufs); i++) { - if (dst->cbufs[i] != src->cbufs[i]) { - return FALSE; - } - } - - if (dst->nr_cbufs != src->nr_cbufs) { - return FALSE; - } - - if (dst->zsbuf != src->zsbuf) { - return FALSE; - } - - return TRUE; -} - - -/** - * Copy framebuffer state from src to dst, updating refcounts. - */ -void -util_copy_framebuffer_state(struct pipe_framebuffer_state *dst, - const struct pipe_framebuffer_state *src) -{ - unsigned i; - - dst->width = src->width; - dst->height = src->height; - - for (i = 0; i < src->nr_cbufs; i++) - pipe_surface_reference(&dst->cbufs[i], src->cbufs[i]); - - for (i = src->nr_cbufs; i < dst->nr_cbufs; i++) - pipe_surface_reference(&dst->cbufs[i], NULL); - - dst->nr_cbufs = src->nr_cbufs; - - pipe_surface_reference(&dst->zsbuf, src->zsbuf); -} - - -void -util_unreference_framebuffer_state(struct pipe_framebuffer_state *fb) -{ - unsigned i; - - for (i = 0; i < fb->nr_cbufs; i++) { - pipe_surface_reference(&fb->cbufs[i], NULL); - } - - pipe_surface_reference(&fb->zsbuf, NULL); - - fb->width = fb->height = 0; - fb->nr_cbufs = 0; -} - - -/* Where multiple sizes are allowed for framebuffer surfaces, find the - * minimum width and height of all bound surfaces. - */ -boolean -util_framebuffer_min_size(const struct pipe_framebuffer_state *fb, - unsigned *width, - unsigned *height) -{ - unsigned w = ~0; - unsigned h = ~0; - unsigned i; - - for (i = 0; i < fb->nr_cbufs; i++) { - w = MIN2(w, fb->cbufs[i]->width); - h = MIN2(h, fb->cbufs[i]->height); - } - - if (fb->zsbuf) { - w = MIN2(w, fb->zsbuf->width); - h = MIN2(h, fb->zsbuf->height); - } - - if (w == ~0) { - *width = 0; - *height = 0; - return FALSE; - } - else { - *width = w; - *height = h; - return TRUE; - } -} +/************************************************************************** + * + * Copyright 2009-2010 VMware, 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 VMWARE 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 + * Framebuffer utility functions. + * + * @author Brian Paul + */ + + +#include "pipe/p_screen.h" +#include "pipe/p_state.h" +#include "pipe/p_defines.h" +#include "util/u_inlines.h" + +#include "util/u_memory.h" +#include "util/u_framebuffer.h" + + +/** + * Compare pipe_framebuffer_state objects. + * \return TRUE if same, FALSE if different + */ +boolean +util_framebuffer_state_equal(const struct pipe_framebuffer_state *dst, + const struct pipe_framebuffer_state *src) +{ + unsigned i; + + if (dst->width != src->width || + dst->height != src->height) + return FALSE; + + for (i = 0; i < Elements(src->cbufs); i++) { + if (dst->cbufs[i] != src->cbufs[i]) { + return FALSE; + } + } + + if (dst->nr_cbufs != src->nr_cbufs) { + return FALSE; + } + + if (dst->zsbuf != src->zsbuf) { + return FALSE; + } + + return TRUE; +} + + +/** + * Copy framebuffer state from src to dst, updating refcounts. + */ +void +util_copy_framebuffer_state(struct pipe_framebuffer_state *dst, + const struct pipe_framebuffer_state *src) +{ + unsigned i; + + dst->width = src->width; + dst->height = src->height; + + for (i = 0; i < src->nr_cbufs; i++) + pipe_surface_reference(&dst->cbufs[i], src->cbufs[i]); + + for (i = src->nr_cbufs; i < dst->nr_cbufs; i++) + pipe_surface_reference(&dst->cbufs[i], NULL); + + dst->nr_cbufs = src->nr_cbufs; + + pipe_surface_reference(&dst->zsbuf, src->zsbuf); +} + + +void +util_unreference_framebuffer_state(struct pipe_framebuffer_state *fb) +{ + unsigned i; + + for (i = 0; i < fb->nr_cbufs; i++) { + pipe_surface_reference(&fb->cbufs[i], NULL); + } + + pipe_surface_reference(&fb->zsbuf, NULL); + + fb->width = fb->height = 0; + fb->nr_cbufs = 0; +} + + +/* Where multiple sizes are allowed for framebuffer surfaces, find the + * minimum width and height of all bound surfaces. + */ +boolean +util_framebuffer_min_size(const struct pipe_framebuffer_state *fb, + unsigned *width, + unsigned *height) +{ + unsigned w = ~0; + unsigned h = ~0; + unsigned i; + + for (i = 0; i < fb->nr_cbufs; i++) { + w = MIN2(w, fb->cbufs[i]->width); + h = MIN2(h, fb->cbufs[i]->height); + } + + if (fb->zsbuf) { + w = MIN2(w, fb->zsbuf->width); + h = MIN2(h, fb->zsbuf->height); + } + + if (w == ~0) { + *width = 0; + *height = 0; + return FALSE; + } + else { + *width = w; + *height = h; + return TRUE; + } +} diff --git a/mesalib/src/gallium/auxiliary/util/u_framebuffer.h b/mesalib/src/gallium/auxiliary/util/u_framebuffer.h index 346672bc7..e7dc1e9e4 100644 --- a/mesalib/src/gallium/auxiliary/util/u_framebuffer.h +++ b/mesalib/src/gallium/auxiliary/util/u_framebuffer.h @@ -1,54 +1,54 @@ -/************************************************************************** - * - * Copyright 2009-2010 VMware, 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 VMWARE 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 U_FRAMEBUFFER_H -#define U_FRAMEBUFFER_H - - -#include "pipe/p_compiler.h" -#include "pipe/p_state.h" - - -extern boolean -util_framebuffer_state_equal(const struct pipe_framebuffer_state *dst, - const struct pipe_framebuffer_state *src); - -extern void -util_copy_framebuffer_state(struct pipe_framebuffer_state *dst, - const struct pipe_framebuffer_state *src); - - -extern void -util_unreference_framebuffer_state(struct pipe_framebuffer_state *fb); - - -extern boolean -util_framebuffer_min_size(const struct pipe_framebuffer_state *fb, - unsigned *width, - unsigned *height); - -#endif /* U_FRAMEBUFFER_H */ +/************************************************************************** + * + * Copyright 2009-2010 VMware, 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 VMWARE 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 U_FRAMEBUFFER_H +#define U_FRAMEBUFFER_H + + +#include "pipe/p_compiler.h" +#include "pipe/p_state.h" + + +extern boolean +util_framebuffer_state_equal(const struct pipe_framebuffer_state *dst, + const struct pipe_framebuffer_state *src); + +extern void +util_copy_framebuffer_state(struct pipe_framebuffer_state *dst, + const struct pipe_framebuffer_state *src); + + +extern void +util_unreference_framebuffer_state(struct pipe_framebuffer_state *fb); + + +extern boolean +util_framebuffer_min_size(const struct pipe_framebuffer_state *fb, + unsigned *width, + unsigned *height); + +#endif /* U_FRAMEBUFFER_H */ diff --git a/mesalib/src/gallium/auxiliary/util/u_half.h b/mesalib/src/gallium/auxiliary/util/u_half.h index b19527981..ad030e90c 100644 --- a/mesalib/src/gallium/auxiliary/util/u_half.h +++ b/mesalib/src/gallium/auxiliary/util/u_half.h @@ -1,90 +1,90 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 U_HALF_H -#define U_HALF_H - -#include "pipe/p_compiler.h" -#include "util/u_math.h" - -#ifdef __cplusplus -extern "C" { -#endif - -extern const uint32_t util_half_to_float_mantissa_table[2048]; -extern const uint32_t util_half_to_float_exponent_table[64]; -extern const uint32_t util_half_to_float_offset_table[64]; -extern const uint16_t util_float_to_half_base_table[512]; -extern const uint8_t util_float_to_half_shift_table[512]; - -/* - * Note that if the half float is a signaling NaN, the x87 FPU will turn - * it into a quiet NaN immediately upon loading into a float. - * - * Additionally, denormals may be flushed to zero. - * - * To avoid this, use the floatui functions instead of the float ones - * when just doing conversion rather than computation on the resulting - * floats. - */ - -static INLINE uint32_t -util_half_to_floatui(uint16_t h) -{ - unsigned exp = h >> 10; - return util_half_to_float_mantissa_table[util_half_to_float_offset_table[exp] + (h & 0x3ff)] + util_half_to_float_exponent_table[exp]; -} - -static INLINE float -util_half_to_float(uint16_t h) -{ - union fi r; - r.ui = util_half_to_floatui(h); - return r.f; -} - -static INLINE uint16_t -util_floatui_to_half(uint32_t v) -{ - unsigned signexp = v >> 23; - return util_float_to_half_base_table[signexp] + ((v & 0x007fffff) >> util_float_to_half_shift_table[signexp]); -} - -static INLINE uint16_t -util_float_to_half(float f) -{ - union fi i; - i.f = f; - return util_floatui_to_half(i.ui); -} - -#ifdef __cplusplus -} -#endif - -#endif /* U_HALF_H */ - +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 U_HALF_H +#define U_HALF_H + +#include "pipe/p_compiler.h" +#include "util/u_math.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern const uint32_t util_half_to_float_mantissa_table[2048]; +extern const uint32_t util_half_to_float_exponent_table[64]; +extern const uint32_t util_half_to_float_offset_table[64]; +extern const uint16_t util_float_to_half_base_table[512]; +extern const uint8_t util_float_to_half_shift_table[512]; + +/* + * Note that if the half float is a signaling NaN, the x87 FPU will turn + * it into a quiet NaN immediately upon loading into a float. + * + * Additionally, denormals may be flushed to zero. + * + * To avoid this, use the floatui functions instead of the float ones + * when just doing conversion rather than computation on the resulting + * floats. + */ + +static INLINE uint32_t +util_half_to_floatui(uint16_t h) +{ + unsigned exp = h >> 10; + return util_half_to_float_mantissa_table[util_half_to_float_offset_table[exp] + (h & 0x3ff)] + util_half_to_float_exponent_table[exp]; +} + +static INLINE float +util_half_to_float(uint16_t h) +{ + union fi r; + r.ui = util_half_to_floatui(h); + return r.f; +} + +static INLINE uint16_t +util_floatui_to_half(uint32_t v) +{ + unsigned signexp = v >> 23; + return util_float_to_half_base_table[signexp] + ((v & 0x007fffff) >> util_float_to_half_shift_table[signexp]); +} + +static INLINE uint16_t +util_float_to_half(float f) +{ + union fi i; + i.f = f; + return util_floatui_to_half(i.ui); +} + +#ifdef __cplusplus +} +#endif + +#endif /* U_HALF_H */ + diff --git a/mesalib/src/gallium/auxiliary/util/u_half.py b/mesalib/src/gallium/auxiliary/util/u_half.py index 88ee43c25..915cf3b92 100644 --- a/mesalib/src/gallium/auxiliary/util/u_half.py +++ b/mesalib/src/gallium/auxiliary/util/u_half.py @@ -1,179 +1,179 @@ -# Copyright 2010 Luca Barbieri -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice (including the -# next paragraph) shall be included in all copies or substantial -# portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. -# -# ************************************************************************* - -# The code is a reimplementation of the algorithm in -# www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf -# "Fast Half Float Conversions" by Jeroen van der Zijp, Nov 2008 -# -# The table contents have been slightly changed so that the exponent -# bias is now in the exponent table instead of the mantissa table (mostly -# for cosmetic reasons, and because it theoretically allows a variant -# that flushes denormal to zero but uses a mantissa table with 24-bit -# entries). -# -# The tables are also constructed slightly differently. -# - -# Note that using a 64K * 4 table is a terrible idea since it will not fit -# in the L1 cache and will massively pollute the L2 cache as well -# -# These should instead fit in the L1 cache. -# -# TODO: we could use a denormal bias table instead of the mantissa/offset -# tables: this would reduce the L1 cache usage from 8704 to 2304 bytes -# but would involve more computation -# -# Note however that if denormals are never encountered, the L1 cache usage -# is only about 4608 bytes anyway. - -table_index = None -table_length = None - -def begin(t, n, l): - global table_length - global table_index - table_index = 0 - table_length = l - print - print "const " + t + " " + n + "[" + str(l) + "] = {" - -def value(v): - global table_index - table_index += 1 - print "\t" + hex(v) + "," - -def end(): - global table_length - global table_index - print "};" - assert table_index == table_length - -print "/* This file is autogenerated by u_half.py. Do not edit directly. */" -print "#include \"util/u_half.h\"" - -begin("uint32_t", "util_half_to_float_mantissa_table", 2048) -# zero -value(0) - -# denormals -for i in xrange(1, 1024): - m = i << 13 - e = 0 - - # normalize number - while (m & 0x00800000) == 0: - e -= 0x00800000 - m <<= 1 - - m &= ~0x00800000 - e += 0x38800000 - value(m | e) - -# normals -for i in xrange(1024, 2048): - value((i - 1024) << 13) -end() - -begin("uint32_t", "util_half_to_float_exponent_table", 64) -# positive zero or denormals -value(0) - -# positive numbers -for i in xrange(1, 31): - value(0x38000000 + (i << 23)) - -# positive infinity/NaN -value(0x7f800000) - -# negative zero or denormals -value(0x80000000) - -# negative numbers -for i in range(33, 63): - value(0xb8000000 + ((i - 32) << 23)) - -# negative infinity/NaN -value(0xff800000) -end() - -begin("uint32_t", "util_half_to_float_offset_table", 64) -# positive zero or denormals -value(0) - -# positive normals -for i in range(1, 32): - value(1024) - -# negative zero or denormals -value(0) - -# negative normals -for i in xrange(33, 64): - value(1024) -end() - -begin("uint16_t", "util_float_to_half_base_table", 512) -for sign in (0, 0x8000): - # very small numbers mapping to zero - for i in xrange(-127, -24): - value(sign | 0) - - # small numbers mapping to denormals - for i in xrange(-24, -14): - value(sign | (0x400 >> (-14 -i))) - - # normal numbers - for i in xrange(-14, 16): - value(sign | ((i + 15) << 10)) - - # large numbers mapping to infinity - for i in xrange(16, 128): - value(sign | 0x7c00) - - # infinity and NaNs - value(sign | 0x7c00) -end() - -begin("uint8_t", "util_float_to_half_shift_table", 512) -for sign in (0, 0x8000): - # very small numbers mapping to zero - for i in xrange(-127, -24): - value(24) - - # small numbers mapping to denormals - for i in xrange(-24, -14): - value(-1 - i) - - # normal numbers - for i in xrange(-14, 16): - value(13) - - # large numbers mapping to infinity - for i in xrange(16, 128): - value(24) - - # infinity and NaNs - value(13) -end() - +# Copyright 2010 Luca Barbieri +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice (including the +# next paragraph) shall be included in all copies or substantial +# portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. +# +# ************************************************************************* + +# The code is a reimplementation of the algorithm in +# www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf +# "Fast Half Float Conversions" by Jeroen van der Zijp, Nov 2008 +# +# The table contents have been slightly changed so that the exponent +# bias is now in the exponent table instead of the mantissa table (mostly +# for cosmetic reasons, and because it theoretically allows a variant +# that flushes denormal to zero but uses a mantissa table with 24-bit +# entries). +# +# The tables are also constructed slightly differently. +# + +# Note that using a 64K * 4 table is a terrible idea since it will not fit +# in the L1 cache and will massively pollute the L2 cache as well +# +# These should instead fit in the L1 cache. +# +# TODO: we could use a denormal bias table instead of the mantissa/offset +# tables: this would reduce the L1 cache usage from 8704 to 2304 bytes +# but would involve more computation +# +# Note however that if denormals are never encountered, the L1 cache usage +# is only about 4608 bytes anyway. + +table_index = None +table_length = None + +def begin(t, n, l): + global table_length + global table_index + table_index = 0 + table_length = l + print + print "const " + t + " " + n + "[" + str(l) + "] = {" + +def value(v): + global table_index + table_index += 1 + print "\t" + hex(v) + "," + +def end(): + global table_length + global table_index + print "};" + assert table_index == table_length + +print "/* This file is autogenerated by u_half.py. Do not edit directly. */" +print "#include \"util/u_half.h\"" + +begin("uint32_t", "util_half_to_float_mantissa_table", 2048) +# zero +value(0) + +# denormals +for i in xrange(1, 1024): + m = i << 13 + e = 0 + + # normalize number + while (m & 0x00800000) == 0: + e -= 0x00800000 + m <<= 1 + + m &= ~0x00800000 + e += 0x38800000 + value(m | e) + +# normals +for i in xrange(1024, 2048): + value((i - 1024) << 13) +end() + +begin("uint32_t", "util_half_to_float_exponent_table", 64) +# positive zero or denormals +value(0) + +# positive numbers +for i in xrange(1, 31): + value(0x38000000 + (i << 23)) + +# positive infinity/NaN +value(0x7f800000) + +# negative zero or denormals +value(0x80000000) + +# negative numbers +for i in range(33, 63): + value(0xb8000000 + ((i - 32) << 23)) + +# negative infinity/NaN +value(0xff800000) +end() + +begin("uint32_t", "util_half_to_float_offset_table", 64) +# positive zero or denormals +value(0) + +# positive normals +for i in range(1, 32): + value(1024) + +# negative zero or denormals +value(0) + +# negative normals +for i in xrange(33, 64): + value(1024) +end() + +begin("uint16_t", "util_float_to_half_base_table", 512) +for sign in (0, 0x8000): + # very small numbers mapping to zero + for i in xrange(-127, -24): + value(sign | 0) + + # small numbers mapping to denormals + for i in xrange(-24, -14): + value(sign | (0x400 >> (-14 -i))) + + # normal numbers + for i in xrange(-14, 16): + value(sign | ((i + 15) << 10)) + + # large numbers mapping to infinity + for i in xrange(16, 128): + value(sign | 0x7c00) + + # infinity and NaNs + value(sign | 0x7c00) +end() + +begin("uint8_t", "util_float_to_half_shift_table", 512) +for sign in (0, 0x8000): + # very small numbers mapping to zero + for i in xrange(-127, -24): + value(24) + + # small numbers mapping to denormals + for i in xrange(-24, -14): + value(-1 - i) + + # normal numbers + for i in xrange(-14, 16): + value(13) + + # large numbers mapping to infinity + for i in xrange(16, 128): + value(24) + + # infinity and NaNs + value(13) +end() + diff --git a/mesalib/src/gallium/auxiliary/util/u_handle_table.c b/mesalib/src/gallium/auxiliary/util/u_handle_table.c index 532d1ea6c..3703718a6 100644 --- a/mesalib/src/gallium/auxiliary/util/u_handle_table.c +++ b/mesalib/src/gallium/auxiliary/util/u_handle_table.c @@ -1,298 +1,298 @@ -/************************************************************************** - * - * Copyright 2008 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. - * - **************************************************************************/ - -/** - * @file - * Generic handle table implementation. - * - * @author José Fonseca - */ - - -#include "pipe/p_compiler.h" -#include "util/u_debug.h" - -#include "util/u_memory.h" -#include "util/u_handle_table.h" - - -#define HANDLE_TABLE_INITIAL_SIZE 16 - - -struct handle_table -{ - /** Object array. Empty handles have a null object */ - void **objects; - - /** Number of objects the handle can currently hold */ - unsigned size; - /** Number of consecutive objects allocated at the start of the table */ - unsigned filled; - - /** Optional object destructor */ - void (*destroy)(void *object); -}; - - -struct handle_table * -handle_table_create(void) -{ - struct handle_table *ht; - - ht = MALLOC_STRUCT(handle_table); - if(!ht) - return NULL; - - ht->objects = (void **)CALLOC(HANDLE_TABLE_INITIAL_SIZE, sizeof(void *)); - if(!ht->objects) { - FREE(ht); - return NULL; - } - - ht->size = HANDLE_TABLE_INITIAL_SIZE; - ht->filled = 0; - - ht->destroy = NULL; - - return ht; -} - - -void -handle_table_set_destroy(struct handle_table *ht, - void (*destroy)(void *object)) -{ - assert(ht); - if (!ht) - return; - ht->destroy = destroy; -} - - -/** - * Resize the table if necessary - */ -static INLINE int -handle_table_resize(struct handle_table *ht, - unsigned minimum_size) -{ - unsigned new_size; - void **new_objects; - - if(ht->size > minimum_size) - return ht->size; - - new_size = ht->size; - while(!(new_size > minimum_size)) - new_size *= 2; - assert(new_size); - - new_objects = (void **)REALLOC((void *)ht->objects, - ht->size*sizeof(void *), - new_size*sizeof(void *)); - if(!new_objects) - return 0; - - memset(new_objects + ht->size, 0, (new_size - ht->size)*sizeof(void *)); - - ht->size = new_size; - ht->objects = new_objects; - - return ht->size; -} - - -static INLINE void -handle_table_clear(struct handle_table *ht, - unsigned index) -{ - void *object; - - /* The order here is important so that the object being destroyed is not - * present in the table when seen by the destroy callback, because the - * destroy callback may directly or indirectly call the other functions in - * this module. - */ - - object = ht->objects[index]; - if(object) { - ht->objects[index] = NULL; - - if(ht->destroy) - ht->destroy(object); - } -} - - -unsigned -handle_table_add(struct handle_table *ht, - void *object) -{ - unsigned index; - unsigned handle; - - assert(ht); - assert(object); - if(!object || !ht) - return 0; - - /* linear search for an empty handle */ - while(ht->filled < ht->size) { - if(!ht->objects[ht->filled]) - break; - ++ht->filled; - } - - index = ht->filled; - handle = index + 1; - - /* check integer overflow */ - if(!handle) - return 0; - - /* grow the table if necessary */ - if(!handle_table_resize(ht, index)) - return 0; - - assert(!ht->objects[index]); - ht->objects[index] = object; - ++ht->filled; - - return handle; -} - - -unsigned -handle_table_set(struct handle_table *ht, - unsigned handle, - void *object) -{ - unsigned index; - - assert(ht); - assert(handle); - if(!handle || !ht) - return 0; - - assert(object); - if(!object) - return 0; - - index = handle - 1; - - /* grow the table if necessary */ - if(!handle_table_resize(ht, index)) - return 0; - - handle_table_clear(ht, index); - - ht->objects[index] = object; - - return handle; -} - - -void * -handle_table_get(struct handle_table *ht, - unsigned handle) -{ - void *object; - - assert(ht); - assert(handle); - if(!handle || !ht || handle > ht->size) - return NULL; - - object = ht->objects[handle - 1]; - - return object; -} - - -void -handle_table_remove(struct handle_table *ht, - unsigned handle) -{ - void *object; - unsigned index; - - assert(ht); - assert(handle); - if(!handle || !ht || handle > ht->size) - return; - - index = handle - 1; - object = ht->objects[index]; - if(!object) - return; - - handle_table_clear(ht, index); - - if(index < ht->filled) - ht->filled = index; -} - - -unsigned -handle_table_get_next_handle(struct handle_table *ht, - unsigned handle) -{ - unsigned index; - - for(index = handle; index < ht->size; ++index) { - if(ht->objects[index]) - return index + 1; - } - - return 0; -} - - -unsigned -handle_table_get_first_handle(struct handle_table *ht) -{ - return handle_table_get_next_handle(ht, 0); -} - - -void -handle_table_destroy(struct handle_table *ht) -{ - unsigned index; - assert(ht); - - if (!ht) - return; - - if(ht->destroy) - for(index = 0; index < ht->size; ++index) - handle_table_clear(ht, index); - - FREE(ht->objects); - FREE(ht); -} - +/************************************************************************** + * + * Copyright 2008 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. + * + **************************************************************************/ + +/** + * @file + * Generic handle table implementation. + * + * @author José Fonseca + */ + + +#include "pipe/p_compiler.h" +#include "util/u_debug.h" + +#include "util/u_memory.h" +#include "util/u_handle_table.h" + + +#define HANDLE_TABLE_INITIAL_SIZE 16 + + +struct handle_table +{ + /** Object array. Empty handles have a null object */ + void **objects; + + /** Number of objects the handle can currently hold */ + unsigned size; + /** Number of consecutive objects allocated at the start of the table */ + unsigned filled; + + /** Optional object destructor */ + void (*destroy)(void *object); +}; + + +struct handle_table * +handle_table_create(void) +{ + struct handle_table *ht; + + ht = MALLOC_STRUCT(handle_table); + if(!ht) + return NULL; + + ht->objects = (void **)CALLOC(HANDLE_TABLE_INITIAL_SIZE, sizeof(void *)); + if(!ht->objects) { + FREE(ht); + return NULL; + } + + ht->size = HANDLE_TABLE_INITIAL_SIZE; + ht->filled = 0; + + ht->destroy = NULL; + + return ht; +} + + +void +handle_table_set_destroy(struct handle_table *ht, + void (*destroy)(void *object)) +{ + assert(ht); + if (!ht) + return; + ht->destroy = destroy; +} + + +/** + * Resize the table if necessary + */ +static INLINE int +handle_table_resize(struct handle_table *ht, + unsigned minimum_size) +{ + unsigned new_size; + void **new_objects; + + if(ht->size > minimum_size) + return ht->size; + + new_size = ht->size; + while(!(new_size > minimum_size)) + new_size *= 2; + assert(new_size); + + new_objects = (void **)REALLOC((void *)ht->objects, + ht->size*sizeof(void *), + new_size*sizeof(void *)); + if(!new_objects) + return 0; + + memset(new_objects + ht->size, 0, (new_size - ht->size)*sizeof(void *)); + + ht->size = new_size; + ht->objects = new_objects; + + return ht->size; +} + + +static INLINE void +handle_table_clear(struct handle_table *ht, + unsigned index) +{ + void *object; + + /* The order here is important so that the object being destroyed is not + * present in the table when seen by the destroy callback, because the + * destroy callback may directly or indirectly call the other functions in + * this module. + */ + + object = ht->objects[index]; + if(object) { + ht->objects[index] = NULL; + + if(ht->destroy) + ht->destroy(object); + } +} + + +unsigned +handle_table_add(struct handle_table *ht, + void *object) +{ + unsigned index; + unsigned handle; + + assert(ht); + assert(object); + if(!object || !ht) + return 0; + + /* linear search for an empty handle */ + while(ht->filled < ht->size) { + if(!ht->objects[ht->filled]) + break; + ++ht->filled; + } + + index = ht->filled; + handle = index + 1; + + /* check integer overflow */ + if(!handle) + return 0; + + /* grow the table if necessary */ + if(!handle_table_resize(ht, index)) + return 0; + + assert(!ht->objects[index]); + ht->objects[index] = object; + ++ht->filled; + + return handle; +} + + +unsigned +handle_table_set(struct handle_table *ht, + unsigned handle, + void *object) +{ + unsigned index; + + assert(ht); + assert(handle); + if(!handle || !ht) + return 0; + + assert(object); + if(!object) + return 0; + + index = handle - 1; + + /* grow the table if necessary */ + if(!handle_table_resize(ht, index)) + return 0; + + handle_table_clear(ht, index); + + ht->objects[index] = object; + + return handle; +} + + +void * +handle_table_get(struct handle_table *ht, + unsigned handle) +{ + void *object; + + assert(ht); + assert(handle); + if(!handle || !ht || handle > ht->size) + return NULL; + + object = ht->objects[handle - 1]; + + return object; +} + + +void +handle_table_remove(struct handle_table *ht, + unsigned handle) +{ + void *object; + unsigned index; + + assert(ht); + assert(handle); + if(!handle || !ht || handle > ht->size) + return; + + index = handle - 1; + object = ht->objects[index]; + if(!object) + return; + + handle_table_clear(ht, index); + + if(index < ht->filled) + ht->filled = index; +} + + +unsigned +handle_table_get_next_handle(struct handle_table *ht, + unsigned handle) +{ + unsigned index; + + for(index = handle; index < ht->size; ++index) { + if(ht->objects[index]) + return index + 1; + } + + return 0; +} + + +unsigned +handle_table_get_first_handle(struct handle_table *ht) +{ + return handle_table_get_next_handle(ht, 0); +} + + +void +handle_table_destroy(struct handle_table *ht) +{ + unsigned index; + assert(ht); + + if (!ht) + return; + + if(ht->destroy) + for(index = 0; index < ht->size; ++index) + handle_table_clear(ht, index); + + FREE(ht->objects); + FREE(ht); +} + diff --git a/mesalib/src/gallium/auxiliary/util/u_handle_table.h b/mesalib/src/gallium/auxiliary/util/u_handle_table.h index a7320830e..d080135c9 100644 --- a/mesalib/src/gallium/auxiliary/util/u_handle_table.h +++ b/mesalib/src/gallium/auxiliary/util/u_handle_table.h @@ -1,116 +1,116 @@ -/************************************************************************** - * - * Copyright 2008 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. - * - **************************************************************************/ - -/** - * @file - * Generic handle table. - * - * @author José Fonseca - */ - -#ifndef U_HANDLE_TABLE_H_ -#define U_HANDLE_TABLE_H_ - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Abstract data type to map integer handles to objects. - * - * Also referred as "pointer array". - */ -struct handle_table; - - -struct handle_table * -handle_table_create(void); - - -/** - * Set an optional destructor callback. - * - * If set, it will be called during handle_table_remove and - * handle_table_destroy calls. - */ -void -handle_table_set_destroy(struct handle_table *ht, - void (*destroy)(void *object)); - - -/** - * Add a new object. - * - * Returns a zero handle on failure (out of memory). - */ -unsigned -handle_table_add(struct handle_table *ht, - void *object); - -/** - * Returns zero on failure (out of memory). - */ -unsigned -handle_table_set(struct handle_table *ht, - unsigned handle, - void *object); - -/** - * Fetch an existing object. - * - * Returns NULL for an invalid handle. - */ -void * -handle_table_get(struct handle_table *ht, - unsigned handle); - - -void -handle_table_remove(struct handle_table *ht, - unsigned handle); - - -void -handle_table_destroy(struct handle_table *ht); - - -unsigned -handle_table_get_first_handle(struct handle_table *ht); - - -unsigned -handle_table_get_next_handle(struct handle_table *ht, - unsigned handle); - - -#ifdef __cplusplus -} -#endif - -#endif /* U_HANDLE_TABLE_H_ */ +/************************************************************************** + * + * Copyright 2008 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. + * + **************************************************************************/ + +/** + * @file + * Generic handle table. + * + * @author José Fonseca + */ + +#ifndef U_HANDLE_TABLE_H_ +#define U_HANDLE_TABLE_H_ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * Abstract data type to map integer handles to objects. + * + * Also referred as "pointer array". + */ +struct handle_table; + + +struct handle_table * +handle_table_create(void); + + +/** + * Set an optional destructor callback. + * + * If set, it will be called during handle_table_remove and + * handle_table_destroy calls. + */ +void +handle_table_set_destroy(struct handle_table *ht, + void (*destroy)(void *object)); + + +/** + * Add a new object. + * + * Returns a zero handle on failure (out of memory). + */ +unsigned +handle_table_add(struct handle_table *ht, + void *object); + +/** + * Returns zero on failure (out of memory). + */ +unsigned +handle_table_set(struct handle_table *ht, + unsigned handle, + void *object); + +/** + * Fetch an existing object. + * + * Returns NULL for an invalid handle. + */ +void * +handle_table_get(struct handle_table *ht, + unsigned handle); + + +void +handle_table_remove(struct handle_table *ht, + unsigned handle); + + +void +handle_table_destroy(struct handle_table *ht); + + +unsigned +handle_table_get_first_handle(struct handle_table *ht); + + +unsigned +handle_table_get_next_handle(struct handle_table *ht, + unsigned handle); + + +#ifdef __cplusplus +} +#endif + +#endif /* U_HANDLE_TABLE_H_ */ diff --git a/mesalib/src/gallium/auxiliary/util/u_hash.c b/mesalib/src/gallium/auxiliary/util/u_hash.c index e0400c277..b67653ec7 100644 --- a/mesalib/src/gallium/auxiliary/util/u_hash.c +++ b/mesalib/src/gallium/auxiliary/util/u_hash.c @@ -1,121 +1,121 @@ -/************************************************************************** - * - * Copyright 2008 VMware, 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 VMWARE 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 - * Hash functions implementation. - * - * @author Jose Fonseca - */ - - -#include "u_hash.h" - - -static const uint32_t -util_crc32_table[256] = { - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, - 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, - 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, - 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, - 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, - 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, - 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, - 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, - 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, - 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, - 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, - 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, - 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, - 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, - 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, - 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, - 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, - 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, - 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, - 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, - 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, - 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, - 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, - 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, - 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, - 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, - 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, - 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, - 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, - 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, - 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, - 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, - 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, - 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, - 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, - 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, - 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, - 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, - 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, - 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, - 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, - 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, - 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, - 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, - 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, - 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, - 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, - 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, - 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, - 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, - 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, - 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, - 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d -}; - - -/** - * @sa http://www.w3.org/TR/PNG/#D-CRCAppendix - */ -uint32_t -util_hash_crc32(const void *data, size_t size) -{ - uint8_t *p = (uint8_t *)data; - uint32_t crc = 0xffffffff; - - while (size--) - crc = util_crc32_table[(crc ^ *p++) & 0xff] ^ (crc >> 8); - - return crc; -} +/************************************************************************** + * + * Copyright 2008 VMware, 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 VMWARE 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 + * Hash functions implementation. + * + * @author Jose Fonseca + */ + + +#include "u_hash.h" + + +static const uint32_t +util_crc32_table[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, + 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, + 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, + 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, + 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, + 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, + 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, + 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, + 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, + 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, + 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, + 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, + 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, + 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, + 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, + 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, + 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, + 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + + +/** + * @sa http://www.w3.org/TR/PNG/#D-CRCAppendix + */ +uint32_t +util_hash_crc32(const void *data, size_t size) +{ + uint8_t *p = (uint8_t *)data; + uint32_t crc = 0xffffffff; + + while (size--) + crc = util_crc32_table[(crc ^ *p++) & 0xff] ^ (crc >> 8); + + return crc; +} diff --git a/mesalib/src/gallium/auxiliary/util/u_hash.h b/mesalib/src/gallium/auxiliary/util/u_hash.h index feda08217..8d92b07c8 100644 --- a/mesalib/src/gallium/auxiliary/util/u_hash.h +++ b/mesalib/src/gallium/auxiliary/util/u_hash.h @@ -1,55 +1,55 @@ -/************************************************************************** - * - * Copyright 2008 VMware, 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 VMWARE 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 - * Hash functions. - * - * @author Jose Fonseca - */ - -#ifndef U_HASH_H_ -#define U_HASH_H_ - - -#include "pipe/p_compiler.h" - - -#ifdef __cplusplus -extern "C" { -#endif - - -uint32_t -util_hash_crc32(const void *data, size_t size); - - -#ifdef __cplusplus -} -#endif - -#endif /* U_HASH_H_ */ +/************************************************************************** + * + * Copyright 2008 VMware, 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 VMWARE 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 + * Hash functions. + * + * @author Jose Fonseca + */ + +#ifndef U_HASH_H_ +#define U_HASH_H_ + + +#include "pipe/p_compiler.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +uint32_t +util_hash_crc32(const void *data, size_t size); + + +#ifdef __cplusplus +} +#endif + +#endif /* U_HASH_H_ */ diff --git a/mesalib/src/gallium/auxiliary/util/u_hash_table.c b/mesalib/src/gallium/auxiliary/util/u_hash_table.c index 417cc15be..5604e3ac3 100644 --- a/mesalib/src/gallium/auxiliary/util/u_hash_table.c +++ b/mesalib/src/gallium/auxiliary/util/u_hash_table.c @@ -1,293 +1,293 @@ -/************************************************************************** - * - * Copyright 2008 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. - * - **************************************************************************/ - -/** - * @file - * General purpose hash table implementation. - * - * Just uses the cso_hash for now, but it might be better switch to a linear - * probing hash table implementation at some point -- as it is said they have - * better lookup and cache performance and it appears to be possible to write - * a lock-free implementation of such hash tables . - * - * @author José Fonseca - */ - - -#include "pipe/p_compiler.h" -#include "util/u_debug.h" - -#include "cso_cache/cso_hash.h" - -#include "util/u_memory.h" -#include "util/u_hash_table.h" - - -struct util_hash_table -{ - struct cso_hash *cso; - - /** Hash function */ - unsigned (*hash)(void *key); - - /** Compare two keys */ - int (*compare)(void *key1, void *key2); - - /* TODO: key, value destructors? */ -}; - - -struct util_hash_table_item -{ - void *key; - void *value; -}; - - -static INLINE struct util_hash_table_item * -util_hash_table_item(struct cso_hash_iter iter) -{ - return (struct util_hash_table_item *)cso_hash_iter_data(iter); -} - - -struct util_hash_table * -util_hash_table_create(unsigned (*hash)(void *key), - int (*compare)(void *key1, void *key2)) -{ - struct util_hash_table *ht; - - ht = MALLOC_STRUCT(util_hash_table); - if(!ht) - return NULL; - - ht->cso = cso_hash_create(); - if(!ht->cso) { - FREE(ht); - return NULL; - } - - ht->hash = hash; - ht->compare = compare; - - return ht; -} - - -static INLINE struct cso_hash_iter -util_hash_table_find_iter(struct util_hash_table *ht, - void *key, - unsigned key_hash) -{ - struct cso_hash_iter iter; - struct util_hash_table_item *item; - - iter = cso_hash_find(ht->cso, key_hash); - while (!cso_hash_iter_is_null(iter)) { - item = (struct util_hash_table_item *)cso_hash_iter_data(iter); - if (!ht->compare(item->key, key)) - break; - iter = cso_hash_iter_next(iter); - } - - return iter; -} - - -static INLINE struct util_hash_table_item * -util_hash_table_find_item(struct util_hash_table *ht, - void *key, - unsigned key_hash) -{ - struct cso_hash_iter iter; - struct util_hash_table_item *item; - - iter = cso_hash_find(ht->cso, key_hash); - while (!cso_hash_iter_is_null(iter)) { - item = (struct util_hash_table_item *)cso_hash_iter_data(iter); - if (!ht->compare(item->key, key)) - return item; - iter = cso_hash_iter_next(iter); - } - - return NULL; -} - - -enum pipe_error -util_hash_table_set(struct util_hash_table *ht, - void *key, - void *value) -{ - unsigned key_hash; - struct util_hash_table_item *item; - struct cso_hash_iter iter; - - assert(ht); - if (!ht) - return PIPE_ERROR_BAD_INPUT; - - key_hash = ht->hash(key); - - item = util_hash_table_find_item(ht, key, key_hash); - if(item) { - /* TODO: key/value destruction? */ - item->value = value; - return PIPE_OK; - } - - item = MALLOC_STRUCT(util_hash_table_item); - if(!item) - return PIPE_ERROR_OUT_OF_MEMORY; - - item->key = key; - item->value = value; - - iter = cso_hash_insert(ht->cso, key_hash, item); - if(cso_hash_iter_is_null(iter)) { - FREE(item); - return PIPE_ERROR_OUT_OF_MEMORY; - } - - return PIPE_OK; -} - - -void * -util_hash_table_get(struct util_hash_table *ht, - void *key) -{ - unsigned key_hash; - struct util_hash_table_item *item; - - assert(ht); - if (!ht) - return NULL; - - key_hash = ht->hash(key); - - item = util_hash_table_find_item(ht, key, key_hash); - if(!item) - return NULL; - - return item->value; -} - - -void -util_hash_table_remove(struct util_hash_table *ht, - void *key) -{ - unsigned key_hash; - struct cso_hash_iter iter; - struct util_hash_table_item *item; - - assert(ht); - if (!ht) - return; - - key_hash = ht->hash(key); - - iter = util_hash_table_find_iter(ht, key, key_hash); - if(cso_hash_iter_is_null(iter)) - return; - - item = util_hash_table_item(iter); - assert(item); - FREE(item); - - cso_hash_erase(ht->cso, iter); -} - - -void -util_hash_table_clear(struct util_hash_table *ht) -{ - struct cso_hash_iter iter; - struct util_hash_table_item *item; - - assert(ht); - if (!ht) - return; - - iter = cso_hash_first_node(ht->cso); - while (!cso_hash_iter_is_null(iter)) { - item = (struct util_hash_table_item *)cso_hash_take(ht->cso, cso_hash_iter_key(iter)); - FREE(item); - iter = cso_hash_first_node(ht->cso); - } -} - - -enum pipe_error -util_hash_table_foreach(struct util_hash_table *ht, - enum pipe_error (*callback) - (void *key, void *value, void *data), - void *data) -{ - struct cso_hash_iter iter; - struct util_hash_table_item *item; - enum pipe_error result; - - assert(ht); - if (!ht) - return PIPE_ERROR_BAD_INPUT; - - iter = cso_hash_first_node(ht->cso); - while (!cso_hash_iter_is_null(iter)) { - item = (struct util_hash_table_item *)cso_hash_iter_data(iter); - result = callback(item->key, item->value, data); - if(result != PIPE_OK) - return result; - iter = cso_hash_iter_next(iter); - } - - return PIPE_OK; -} - - -void -util_hash_table_destroy(struct util_hash_table *ht) -{ - struct cso_hash_iter iter; - struct util_hash_table_item *item; - - assert(ht); - if (!ht) - return; - - iter = cso_hash_first_node(ht->cso); - while (!cso_hash_iter_is_null(iter)) { - item = (struct util_hash_table_item *)cso_hash_iter_data(iter); - FREE(item); - iter = cso_hash_iter_next(iter); - } - - cso_hash_delete(ht->cso); - - FREE(ht); -} +/************************************************************************** + * + * Copyright 2008 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. + * + **************************************************************************/ + +/** + * @file + * General purpose hash table implementation. + * + * Just uses the cso_hash for now, but it might be better switch to a linear + * probing hash table implementation at some point -- as it is said they have + * better lookup and cache performance and it appears to be possible to write + * a lock-free implementation of such hash tables . + * + * @author José Fonseca + */ + + +#include "pipe/p_compiler.h" +#include "util/u_debug.h" + +#include "cso_cache/cso_hash.h" + +#include "util/u_memory.h" +#include "util/u_hash_table.h" + + +struct util_hash_table +{ + struct cso_hash *cso; + + /** Hash function */ + unsigned (*hash)(void *key); + + /** Compare two keys */ + int (*compare)(void *key1, void *key2); + + /* TODO: key, value destructors? */ +}; + + +struct util_hash_table_item +{ + void *key; + void *value; +}; + + +static INLINE struct util_hash_table_item * +util_hash_table_item(struct cso_hash_iter iter) +{ + return (struct util_hash_table_item *)cso_hash_iter_data(iter); +} + + +struct util_hash_table * +util_hash_table_create(unsigned (*hash)(void *key), + int (*compare)(void *key1, void *key2)) +{ + struct util_hash_table *ht; + + ht = MALLOC_STRUCT(util_hash_table); + if(!ht) + return NULL; + + ht->cso = cso_hash_create(); + if(!ht->cso) { + FREE(ht); + return NULL; + } + + ht->hash = hash; + ht->compare = compare; + + return ht; +} + + +static INLINE struct cso_hash_iter +util_hash_table_find_iter(struct util_hash_table *ht, + void *key, + unsigned key_hash) +{ + struct cso_hash_iter iter; + struct util_hash_table_item *item; + + iter = cso_hash_find(ht->cso, key_hash); + while (!cso_hash_iter_is_null(iter)) { + item = (struct util_hash_table_item *)cso_hash_iter_data(iter); + if (!ht->compare(item->key, key)) + break; + iter = cso_hash_iter_next(iter); + } + + return iter; +} + + +static INLINE struct util_hash_table_item * +util_hash_table_find_item(struct util_hash_table *ht, + void *key, + unsigned key_hash) +{ + struct cso_hash_iter iter; + struct util_hash_table_item *item; + + iter = cso_hash_find(ht->cso, key_hash); + while (!cso_hash_iter_is_null(iter)) { + item = (struct util_hash_table_item *)cso_hash_iter_data(iter); + if (!ht->compare(item->key, key)) + return item; + iter = cso_hash_iter_next(iter); + } + + return NULL; +} + + +enum pipe_error +util_hash_table_set(struct util_hash_table *ht, + void *key, + void *value) +{ + unsigned key_hash; + struct util_hash_table_item *item; + struct cso_hash_iter iter; + + assert(ht); + if (!ht) + return PIPE_ERROR_BAD_INPUT; + + key_hash = ht->hash(key); + + item = util_hash_table_find_item(ht, key, key_hash); + if(item) { + /* TODO: key/value destruction? */ + item->value = value; + return PIPE_OK; + } + + item = MALLOC_STRUCT(util_hash_table_item); + if(!item) + return PIPE_ERROR_OUT_OF_MEMORY; + + item->key = key; + item->value = value; + + iter = cso_hash_insert(ht->cso, key_hash, item); + if(cso_hash_iter_is_null(iter)) { + FREE(item); + return PIPE_ERROR_OUT_OF_MEMORY; + } + + return PIPE_OK; +} + + +void * +util_hash_table_get(struct util_hash_table *ht, + void *key) +{ + unsigned key_hash; + struct util_hash_table_item *item; + + assert(ht); + if (!ht) + return NULL; + + key_hash = ht->hash(key); + + item = util_hash_table_find_item(ht, key, key_hash); + if(!item) + return NULL; + + return item->value; +} + + +void +util_hash_table_remove(struct util_hash_table *ht, + void *key) +{ + unsigned key_hash; + struct cso_hash_iter iter; + struct util_hash_table_item *item; + + assert(ht); + if (!ht) + return; + + key_hash = ht->hash(key); + + iter = util_hash_table_find_iter(ht, key, key_hash); + if(cso_hash_iter_is_null(iter)) + return; + + item = util_hash_table_item(iter); + assert(item); + FREE(item); + + cso_hash_erase(ht->cso, iter); +} + + +void +util_hash_table_clear(struct util_hash_table *ht) +{ + struct cso_hash_iter iter; + struct util_hash_table_item *item; + + assert(ht); + if (!ht) + return; + + iter = cso_hash_first_node(ht->cso); + while (!cso_hash_iter_is_null(iter)) { + item = (struct util_hash_table_item *)cso_hash_take(ht->cso, cso_hash_iter_key(iter)); + FREE(item); + iter = cso_hash_first_node(ht->cso); + } +} + + +enum pipe_error +util_hash_table_foreach(struct util_hash_table *ht, + enum pipe_error (*callback) + (void *key, void *value, void *data), + void *data) +{ + struct cso_hash_iter iter; + struct util_hash_table_item *item; + enum pipe_error result; + + assert(ht); + if (!ht) + return PIPE_ERROR_BAD_INPUT; + + iter = cso_hash_first_node(ht->cso); + while (!cso_hash_iter_is_null(iter)) { + item = (struct util_hash_table_item *)cso_hash_iter_data(iter); + result = callback(item->key, item->value, data); + if(result != PIPE_OK) + return result; + iter = cso_hash_iter_next(iter); + } + + return PIPE_OK; +} + + +void +util_hash_table_destroy(struct util_hash_table *ht) +{ + struct cso_hash_iter iter; + struct util_hash_table_item *item; + + assert(ht); + if (!ht) + return; + + iter = cso_hash_first_node(ht->cso); + while (!cso_hash_iter_is_null(iter)) { + item = (struct util_hash_table_item *)cso_hash_iter_data(iter); + FREE(item); + iter = cso_hash_iter_next(iter); + } + + cso_hash_delete(ht->cso); + + FREE(ht); +} diff --git a/mesalib/src/gallium/auxiliary/util/u_hash_table.h b/mesalib/src/gallium/auxiliary/util/u_hash_table.h index 5b14ff72d..51ec10a80 100644 --- a/mesalib/src/gallium/auxiliary/util/u_hash_table.h +++ b/mesalib/src/gallium/auxiliary/util/u_hash_table.h @@ -1,96 +1,96 @@ -/************************************************************************** - * - * Copyright 2008 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. - * - **************************************************************************/ - -/** - * General purpose hash table. - * - * @author José Fonseca - */ - -#ifndef U_HASH_TABLE_H_ -#define U_HASH_TABLE_H_ - - -#include "pipe/p_defines.h" - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Generic purpose hash table. - */ -struct util_hash_table; - - -/** - * Create an hash table. - * - * @param hash hash function - * @param compare should return 0 for two equal keys. - */ -struct util_hash_table * -util_hash_table_create(unsigned (*hash)(void *key), - int (*compare)(void *key1, void *key2)); - - -enum pipe_error -util_hash_table_set(struct util_hash_table *ht, - void *key, - void *value); - -void * -util_hash_table_get(struct util_hash_table *ht, - void *key); - - -void -util_hash_table_remove(struct util_hash_table *ht, - void *key); - - -void -util_hash_table_clear(struct util_hash_table *ht); - - -enum pipe_error -util_hash_table_foreach(struct util_hash_table *ht, - enum pipe_error (*callback) - (void *key, void *value, void *data), - void *data); - -void -util_hash_table_destroy(struct util_hash_table *ht); - - -#ifdef __cplusplus -} -#endif - -#endif /* U_HASH_TABLE_H_ */ +/************************************************************************** + * + * Copyright 2008 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. + * + **************************************************************************/ + +/** + * General purpose hash table. + * + * @author José Fonseca + */ + +#ifndef U_HASH_TABLE_H_ +#define U_HASH_TABLE_H_ + + +#include "pipe/p_defines.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * Generic purpose hash table. + */ +struct util_hash_table; + + +/** + * Create an hash table. + * + * @param hash hash function + * @param compare should return 0 for two equal keys. + */ +struct util_hash_table * +util_hash_table_create(unsigned (*hash)(void *key), + int (*compare)(void *key1, void *key2)); + + +enum pipe_error +util_hash_table_set(struct util_hash_table *ht, + void *key, + void *value); + +void * +util_hash_table_get(struct util_hash_table *ht, + void *key); + + +void +util_hash_table_remove(struct util_hash_table *ht, + void *key); + + +void +util_hash_table_clear(struct util_hash_table *ht); + + +enum pipe_error +util_hash_table_foreach(struct util_hash_table *ht, + enum pipe_error (*callback) + (void *key, void *value, void *data), + void *data); + +void +util_hash_table_destroy(struct util_hash_table *ht); + + +#ifdef __cplusplus +} +#endif + +#endif /* U_HASH_TABLE_H_ */ diff --git a/mesalib/src/gallium/auxiliary/util/u_init.h b/mesalib/src/gallium/auxiliary/util/u_init.h index a1d4f1b04..7bc356a79 100644 --- a/mesalib/src/gallium/auxiliary/util/u_init.h +++ b/mesalib/src/gallium/auxiliary/util/u_init.h @@ -1,52 +1,52 @@ -/* - * Copyright 2010 Luca Barbieri - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 U_INIT_H -#define U_INIT_H - -/* Use UTIL_INIT(f) to have f called at program initialization. - Note that it is only guaranteed to be called if any symbol in the - .c file it is in sis referenced by the program. - - UTIL_INIT functions are called in arbitrary order. -*/ - -#ifdef __cplusplus -/* use a C++ global constructor */ -#define UTIL_INIT(f) struct f##__gctor_t {f##__gctor_t() {x();}} f##__gctor; -#elif defined(_MSC_VER) -/* add a pointer to the section where MSVC stores global constructor pointers */ -/* see http://blogs.msdn.com/vcblog/archive/2006/10/20/crt-initialization.aspx and - http://stackoverflow.com/questions/1113409/attribute-constructor-equivalent-in-vc */ -#pragma section(".CRT$XCU",read) -#define UTIL_INIT(f) static void __cdecl f##__init(void) {f();}; __declspec(allocate(".CRT$XCU")) void (__cdecl* f##__xcu)(void) = f##__init; -#elif defined(__GNUC__) -#define UTIL_INIT(f) static void f##__init(void) __attribute__((constructor)); static void f##__init(void) {f();} -#else -#error Unsupported compiler: please find out how to implement global initializers in C on it -#endif - -#endif - +/* + * Copyright 2010 Luca Barbieri + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 U_INIT_H +#define U_INIT_H + +/* Use UTIL_INIT(f) to have f called at program initialization. + Note that it is only guaranteed to be called if any symbol in the + .c file it is in sis referenced by the program. + + UTIL_INIT functions are called in arbitrary order. +*/ + +#ifdef __cplusplus +/* use a C++ global constructor */ +#define UTIL_INIT(f) struct f##__gctor_t {f##__gctor_t() {x();}} f##__gctor; +#elif defined(_MSC_VER) +/* add a pointer to the section where MSVC stores global constructor pointers */ +/* see http://blogs.msdn.com/vcblog/archive/2006/10/20/crt-initialization.aspx and + http://stackoverflow.com/questions/1113409/attribute-constructor-equivalent-in-vc */ +#pragma section(".CRT$XCU",read) +#define UTIL_INIT(f) static void __cdecl f##__init(void) {f();}; __declspec(allocate(".CRT$XCU")) void (__cdecl* f##__xcu)(void) = f##__init; +#elif defined(__GNUC__) +#define UTIL_INIT(f) static void f##__init(void) __attribute__((constructor)); static void f##__init(void) {f();} +#else +#error Unsupported compiler: please find out how to implement global initializers in C on it +#endif + +#endif + diff --git a/mesalib/src/gallium/auxiliary/util/u_keymap.c b/mesalib/src/gallium/auxiliary/util/u_keymap.c index a06478b21..e161ccd88 100644 --- a/mesalib/src/gallium/auxiliary/util/u_keymap.c +++ b/mesalib/src/gallium/auxiliary/util/u_keymap.c @@ -1,318 +1,318 @@ -/************************************************************************** - * - * Copyright 2008 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. - * - **************************************************************************/ - -/** - * Key lookup/associative container. - * - * Like Jose's util_hash_table, based on CSO cache code for now. - * - * Author: Brian Paul - */ - - -#include "pipe/p_compiler.h" -#include "util/u_debug.h" - -#include "cso_cache/cso_hash.h" - -#include "util/u_memory.h" -#include "util/u_keymap.h" - - -struct keymap -{ - struct cso_hash *cso; - unsigned key_size; - unsigned max_entries; /* XXX not obeyed net */ - unsigned num_entries; - keymap_delete_func delete_func; -}; - - -struct keymap_item -{ - void *key, *value; -}; - - -/** - * This the default key-delete function used when the client doesn't - * provide one. - */ -static void -default_delete_func(const struct keymap *map, - const void *key, void *data, void *user) -{ - FREE((void*) data); -} - - -static INLINE struct keymap_item * -hash_table_item(struct cso_hash_iter iter) -{ - return (struct keymap_item *) cso_hash_iter_data(iter); -} - - -/** - * Return 4-byte hash key for a block of bytes. - */ -static unsigned -hash(const void *key, unsigned keySize) -{ - unsigned i, hash; - - keySize /= 4; /* convert from bytes to uints */ - - hash = 0; - for (i = 0; i < keySize; i++) { - hash ^= (i + 1) * ((const unsigned *) key)[i]; - } - - /*hash = hash ^ (hash >> 11) ^ (hash >> 22);*/ - - return hash; -} - - -/** - * Create a new map. - * \param keySize size of the keys in bytes - * \param maxEntries max number of entries to allow (~0 = infinity) - * \param deleteFunc optional callback to call when entries - * are deleted/replaced - */ -struct keymap * -util_new_keymap(unsigned keySize, unsigned maxEntries, - keymap_delete_func deleteFunc) -{ - struct keymap *map = MALLOC_STRUCT(keymap); - if (!map) - return NULL; - - map->cso = cso_hash_create(); - if (!map->cso) { - FREE(map); - return NULL; - } - - map->max_entries = maxEntries; - map->num_entries = 0; - map->key_size = keySize; - map->delete_func = deleteFunc ? deleteFunc : default_delete_func; - - return map; -} - - -/** - * Delete/free a keymap and all entries. The deleteFunc that was given at - * create time will be called for each entry. - * \param user user-provided pointer passed through to the delete callback - */ -void -util_delete_keymap(struct keymap *map, void *user) -{ - util_keymap_remove_all(map, user); - cso_hash_delete(map->cso); - FREE(map); -} - - -static INLINE struct cso_hash_iter -hash_table_find_iter(const struct keymap *map, const void *key, - unsigned key_hash) -{ - struct cso_hash_iter iter; - struct keymap_item *item; - - iter = cso_hash_find(map->cso, key_hash); - while (!cso_hash_iter_is_null(iter)) { - item = (struct keymap_item *) cso_hash_iter_data(iter); - if (!memcmp(item->key, key, map->key_size)) - break; - iter = cso_hash_iter_next(iter); - } - - return iter; -} - - -static INLINE struct keymap_item * -hash_table_find_item(const struct keymap *map, const void *key, - unsigned key_hash) -{ - struct cso_hash_iter iter = hash_table_find_iter(map, key, key_hash); - if (cso_hash_iter_is_null(iter)) { - return NULL; - } - else { - return hash_table_item(iter); - } -} - - -/** - * Insert a new key + data pointer into the table. - * Note: we create a copy of the key, but not the data! - * If the key is already present in the table, replace the existing - * entry (calling the delete callback on the previous entry). - * If the maximum capacity of the map is reached an old entry - * will be deleted (the delete callback will be called). - */ -boolean -util_keymap_insert(struct keymap *map, const void *key, - const void *data, void *user) -{ - unsigned key_hash; - struct keymap_item *item; - struct cso_hash_iter iter; - - assert(map); - if (!map) - return FALSE; - - key_hash = hash(key, map->key_size); - - item = hash_table_find_item(map, key, key_hash); - if (item) { - /* call delete callback for old entry/item */ - map->delete_func(map, item->key, item->value, user); - item->value = (void *) data; - return TRUE; - } - - item = MALLOC_STRUCT(keymap_item); - if (!item) - return FALSE; - - item->key = mem_dup(key, map->key_size); - item->value = (void *) data; - - iter = cso_hash_insert(map->cso, key_hash, item); - if (cso_hash_iter_is_null(iter)) { - FREE(item); - return FALSE; - } - - map->num_entries++; - - return TRUE; -} - - -/** - * Look up a key in the map and return the associated data pointer. - */ -const void * -util_keymap_lookup(const struct keymap *map, const void *key) -{ - unsigned key_hash; - struct keymap_item *item; - - assert(map); - if (!map) - return NULL; - - key_hash = hash(key, map->key_size); - - item = hash_table_find_item(map, key, key_hash); - if (!item) - return NULL; - - return item->value; -} - - -/** - * Remove an entry from the map. - * The delete callback will be called if the given key/entry is found. - * \param user passed to the delete callback as the last param. - */ -void -util_keymap_remove(struct keymap *map, const void *key, void *user) -{ - unsigned key_hash; - struct cso_hash_iter iter; - struct keymap_item *item; - - assert(map); - if (!map) - return; - - key_hash = hash(key, map->key_size); - - iter = hash_table_find_iter(map, key, key_hash); - if (cso_hash_iter_is_null(iter)) - return; - - item = hash_table_item(iter); - assert(item); - if (!item) - return; - map->delete_func(map, item->key, item->value, user); - FREE(item->key); - FREE(item); - - map->num_entries--; - - cso_hash_erase(map->cso, iter); -} - - -/** - * Remove all entries from the map, calling the delete callback for each. - * \param user passed to the delete callback as the last param. - */ -void -util_keymap_remove_all(struct keymap *map, void *user) -{ - struct cso_hash_iter iter; - struct keymap_item *item; - - assert(map); - if (!map) - return; - - iter = cso_hash_first_node(map->cso); - while (!cso_hash_iter_is_null(iter)) { - item = (struct keymap_item *) - cso_hash_take(map->cso, cso_hash_iter_key(iter)); - map->delete_func(map, item->key, item->value, user); - FREE(item->key); - FREE(item); - iter = cso_hash_first_node(map->cso); - } -} - - -extern void -util_keymap_info(const struct keymap *map) -{ - debug_printf("Keymap %p: %u of max %u entries\n", - (void *) map, map->num_entries, map->max_entries); -} +/************************************************************************** + * + * Copyright 2008 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. + * + **************************************************************************/ + +/** + * Key lookup/associative container. + * + * Like Jose's util_hash_table, based on CSO cache code for now. + * + * Author: Brian Paul + */ + + +#include "pipe/p_compiler.h" +#include "util/u_debug.h" + +#include "cso_cache/cso_hash.h" + +#include "util/u_memory.h" +#include "util/u_keymap.h" + + +struct keymap +{ + struct cso_hash *cso; + unsigned key_size; + unsigned max_entries; /* XXX not obeyed net */ + unsigned num_entries; + keymap_delete_func delete_func; +}; + + +struct keymap_item +{ + void *key, *value; +}; + + +/** + * This the default key-delete function used when the client doesn't + * provide one. + */ +static void +default_delete_func(const struct keymap *map, + const void *key, void *data, void *user) +{ + FREE((void*) data); +} + + +static INLINE struct keymap_item * +hash_table_item(struct cso_hash_iter iter) +{ + return (struct keymap_item *) cso_hash_iter_data(iter); +} + + +/** + * Return 4-byte hash key for a block of bytes. + */ +static unsigned +hash(const void *key, unsigned keySize) +{ + unsigned i, hash; + + keySize /= 4; /* convert from bytes to uints */ + + hash = 0; + for (i = 0; i < keySize; i++) { + hash ^= (i + 1) * ((const unsigned *) key)[i]; + } + + /*hash = hash ^ (hash >> 11) ^ (hash >> 22);*/ + + return hash; +} + + +/** + * Create a new map. + * \param keySize size of the keys in bytes + * \param maxEntries max number of entries to allow (~0 = infinity) + * \param deleteFunc optional callback to call when entries + * are deleted/replaced + */ +struct keymap * +util_new_keymap(unsigned keySize, unsigned maxEntries, + keymap_delete_func deleteFunc) +{ + struct keymap *map = MALLOC_STRUCT(keymap); + if (!map) + return NULL; + + map->cso = cso_hash_create(); + if (!map->cso) { + FREE(map); + return NULL; + } + + map->max_entries = maxEntries; + map->num_entries = 0; + map->key_size = keySize; + map->delete_func = deleteFunc ? deleteFunc : default_delete_func; + + return map; +} + + +/** + * Delete/free a keymap and all entries. The deleteFunc that was given at + * create time will be called for each entry. + * \param user user-provided pointer passed through to the delete callback + */ +void +util_delete_keymap(struct keymap *map, void *user) +{ + util_keymap_remove_all(map, user); + cso_hash_delete(map->cso); + FREE(map); +} + + +static INLINE struct cso_hash_iter +hash_table_find_iter(const struct keymap *map, const void *key, + unsigned key_hash) +{ + struct cso_hash_iter iter; + struct keymap_item *item; + + iter = cso_hash_find(map->cso, key_hash); + while (!cso_hash_iter_is_null(iter)) { + item = (struct keymap_item *) cso_hash_iter_data(iter); + if (!memcmp(item->key, key, map->key_size)) + break; + iter = cso_hash_iter_next(iter); + } + + return iter; +} + + +static INLINE struct keymap_item * +hash_table_find_item(const struct keymap *map, const void *key, + unsigned key_hash) +{ + struct cso_hash_iter iter = hash_table_find_iter(map, key, key_hash); + if (cso_hash_iter_is_null(iter)) { + return NULL; + } + else { + return hash_table_item(iter); + } +} + + +/** + * Insert a new key + data pointer into the table. + * Note: we create a copy of the key, but not the data! + * If the key is already present in the table, replace the existing + * entry (calling the delete callback on the previous entry). + * If the maximum capacity of the map is reached an old entry + * will be deleted (the delete callback will be called). + */ +boolean +util_keymap_insert(struct keymap *map, const void *key, + const void *data, void *user) +{ + unsigned key_hash; + struct keymap_item *item; + struct cso_hash_iter iter; + + assert(map); + if (!map) + return FALSE; + + key_hash = hash(key, map->key_size); + + item = hash_table_find_item(map, key, key_hash); + if (item) { + /* call delete callback for old entry/item */ + map->delete_func(map, item->key, item->value, user); + item->value = (void *) data; + return TRUE; + } + + item = MALLOC_STRUCT(keymap_item); + if (!item) + return FALSE; + + item->key = mem_dup(key, map->key_size); + item->value = (void *) data; + + iter = cso_hash_insert(map->cso, key_hash, item); + if (cso_hash_iter_is_null(iter)) { + FREE(item); + return FALSE; + } + + map->num_entries++; + + return TRUE; +} + + +/** + * Look up a key in the map and return the associated data pointer. + */ +const void * +util_keymap_lookup(const struct keymap *map, const void *key) +{ + unsigned key_hash; + struct keymap_item *item; + + assert(map); + if (!map) + return NULL; + + key_hash = hash(key, map->key_size); + + item = hash_table_find_item(map, key, key_hash); + if (!item) + return NULL; + + return item->value; +} + + +/** + * Remove an entry from the map. + * The delete callback will be called if the given key/entry is found. + * \param user passed to the delete callback as the last param. + */ +void +util_keymap_remove(struct keymap *map, const void *key, void *user) +{ + unsigned key_hash; + struct cso_hash_iter iter; + struct keymap_item *item; + + assert(map); + if (!map) + return; + + key_hash = hash(key, map->key_size); + + iter = hash_table_find_iter(map, key, key_hash); + if (cso_hash_iter_is_null(iter)) + return; + + item = hash_table_item(iter); + assert(item); + if (!item) + return; + map->delete_func(map, item->key, item->value, user); + FREE(item->key); + FREE(item); + + map->num_entries--; + + cso_hash_erase(map->cso, iter); +} + + +/** + * Remove all entries from the map, calling the delete callback for each. + * \param user passed to the delete callback as the last param. + */ +void +util_keymap_remove_all(struct keymap *map, void *user) +{ + struct cso_hash_iter iter; + struct keymap_item *item; + + assert(map); + if (!map) + return; + + iter = cso_hash_first_node(map->cso); + while (!cso_hash_iter_is_null(iter)) { + item = (struct keymap_item *) + cso_hash_take(map->cso, cso_hash_iter_key(iter)); + map->delete_func(map, item->key, item->value, user); + FREE(item->key); + FREE(item); + iter = cso_hash_first_node(map->cso); + } +} + + +extern void +util_keymap_info(const struct keymap *map) +{ + debug_printf("Keymap %p: %u of max %u entries\n", + (void *) map, map->num_entries, map->max_entries); +} diff --git a/mesalib/src/gallium/auxiliary/util/u_keymap.h b/mesalib/src/gallium/auxiliary/util/u_keymap.h index e38e6fec6..8d60a76fc 100644 --- a/mesalib/src/gallium/auxiliary/util/u_keymap.h +++ b/mesalib/src/gallium/auxiliary/util/u_keymap.h @@ -1,68 +1,68 @@ -/************************************************************************** - * - * Copyright 2008 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 U_KEYMAP_H -#define U_KEYMAP_H - -#include "pipe/p_compiler.h" - - -/** opaque keymap type */ -struct keymap; - - -/** Delete/callback function type */ -typedef void (*keymap_delete_func)(const struct keymap *map, - const void *key, void *data, - void *user); - - -extern struct keymap * -util_new_keymap(unsigned keySize, unsigned maxEntries, - keymap_delete_func deleteFunc); - -extern void -util_delete_keymap(struct keymap *map, void *user); - -extern boolean -util_keymap_insert(struct keymap *map, const void *key, - const void *data, void *user); - -extern const void * -util_keymap_lookup(const struct keymap *map, const void *key); - -extern void -util_keymap_remove(struct keymap *map, const void *key, void *user); - -extern void -util_keymap_remove_all(struct keymap *map, void *user); - -extern void -util_keymap_info(const struct keymap *map); - - -#endif /* U_KEYMAP_H */ +/************************************************************************** + * + * Copyright 2008 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 U_KEYMAP_H +#define U_KEYMAP_H + +#include "pipe/p_compiler.h" + + +/** opaque keymap type */ +struct keymap; + + +/** Delete/callback function type */ +typedef void (*keymap_delete_func)(const struct keymap *map, + const void *key, void *data, + void *user); + + +extern struct keymap * +util_new_keymap(unsigned keySize, unsigned maxEntries, + keymap_delete_func deleteFunc); + +extern void +util_delete_keymap(struct keymap *map, void *user); + +extern boolean +util_keymap_insert(struct keymap *map, const void *key, + const void *data, void *user); + +extern const void * +util_keymap_lookup(const struct keymap *map, const void *key); + +extern void +util_keymap_remove(struct keymap *map, const void *key, void *user); + +extern void +util_keymap_remove_all(struct keymap *map, void *user); + +extern void +util_keymap_info(const struct keymap *map); + + +#endif /* U_KEYMAP_H */ diff --git a/mesalib/src/gallium/auxiliary/util/u_linear.c b/mesalib/src/gallium/auxiliary/util/u_linear.c index 8f8935d8a..f1aef2167 100644 --- a/mesalib/src/gallium/auxiliary/util/u_linear.c +++ b/mesalib/src/gallium/auxiliary/util/u_linear.c @@ -1,101 +1,101 @@ -/************************************************************************** - * - * Copyright 2009 VMware, 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 VMWARE 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. - * - **************************************************************************/ - -/** - * Functions for converting tiled data to linear and vice versa. - */ - - -#include "util/u_debug.h" -#include "u_linear.h" - -void -pipe_linear_to_tile(size_t src_stride, const void *src_ptr, - struct pipe_tile_info *t, void *dst_ptr) -{ - int x, y, z; - char *ptr; - size_t bytes = t->cols * t->block.size; - char *dst_ptr2 = (char *) dst_ptr; - - assert(pipe_linear_check_tile(t)); - - /* lets write lineary to the tiled buffer */ - for (y = 0; y < t->tiles_y; y++) { - for (x = 0; x < t->tiles_x; x++) { - /* this inner loop could be replace with SSE magic */ - ptr = (char*)src_ptr + src_stride * t->rows * y + bytes * x; - for (z = 0; z < t->rows; z++) { - memcpy(dst_ptr2, ptr, bytes); - dst_ptr2 += bytes; - ptr += src_stride; - } - } - } -} - -void pipe_linear_from_tile(struct pipe_tile_info *t, const void *src_ptr, - size_t dst_stride, void *dst_ptr) -{ - int x, y, z; - char *ptr; - size_t bytes = t->cols * t->block.size; - const char *src_ptr2 = (const char *) src_ptr; - - /* lets read lineary from the tiled buffer */ - for (y = 0; y < t->tiles_y; y++) { - for (x = 0; x < t->tiles_x; x++) { - /* this inner loop could be replace with SSE magic */ - ptr = (char*)dst_ptr + dst_stride * t->rows * y + bytes * x; - for (z = 0; z < t->rows; z++) { - memcpy(ptr, src_ptr2, bytes); - src_ptr2 += bytes; - ptr += dst_stride; - } - } - } -} - -void -pipe_linear_fill_info(struct pipe_tile_info *t, - const struct u_linear_format_block *block, - unsigned tile_width, unsigned tile_height, - unsigned tiles_x, unsigned tiles_y) -{ - t->block = *block; - - t->tile.width = tile_width; - t->tile.height = tile_height; - t->cols = t->tile.width / t->block.width; - t->rows = t->tile.height / t->block.height; - t->tile.size = t->cols * t->rows * t->block.size; - - t->tiles_x = tiles_x; - t->tiles_y = tiles_y; - t->stride = t->cols * t->tiles_x * t->block.size; - t->size = t->tiles_x * t->tiles_y * t->tile.size; -} +/************************************************************************** + * + * Copyright 2009 VMware, 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 VMWARE 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. + * + **************************************************************************/ + +/** + * Functions for converting tiled data to linear and vice versa. + */ + + +#include "util/u_debug.h" +#include "u_linear.h" + +void +pipe_linear_to_tile(size_t src_stride, const void *src_ptr, + struct pipe_tile_info *t, void *dst_ptr) +{ + int x, y, z; + char *ptr; + size_t bytes = t->cols * t->block.size; + char *dst_ptr2 = (char *) dst_ptr; + + assert(pipe_linear_check_tile(t)); + + /* lets write lineary to the tiled buffer */ + for (y = 0; y < t->tiles_y; y++) { + for (x = 0; x < t->tiles_x; x++) { + /* this inner loop could be replace with SSE magic */ + ptr = (char*)src_ptr + src_stride * t->rows * y + bytes * x; + for (z = 0; z < t->rows; z++) { + memcpy(dst_ptr2, ptr, bytes); + dst_ptr2 += bytes; + ptr += src_stride; + } + } + } +} + +void pipe_linear_from_tile(struct pipe_tile_info *t, const void *src_ptr, + size_t dst_stride, void *dst_ptr) +{ + int x, y, z; + char *ptr; + size_t bytes = t->cols * t->block.size; + const char *src_ptr2 = (const char *) src_ptr; + + /* lets read lineary from the tiled buffer */ + for (y = 0; y < t->tiles_y; y++) { + for (x = 0; x < t->tiles_x; x++) { + /* this inner loop could be replace with SSE magic */ + ptr = (char*)dst_ptr + dst_stride * t->rows * y + bytes * x; + for (z = 0; z < t->rows; z++) { + memcpy(ptr, src_ptr2, bytes); + src_ptr2 += bytes; + ptr += dst_stride; + } + } + } +} + +void +pipe_linear_fill_info(struct pipe_tile_info *t, + const struct u_linear_format_block *block, + unsigned tile_width, unsigned tile_height, + unsigned tiles_x, unsigned tiles_y) +{ + t->block = *block; + + t->tile.width = tile_width; + t->tile.height = tile_height; + t->cols = t->tile.width / t->block.width; + t->rows = t->tile.height / t->block.height; + t->tile.size = t->cols * t->rows * t->block.size; + + t->tiles_x = tiles_x; + t->tiles_y = tiles_y; + t->stride = t->cols * t->tiles_x * t->block.size; + t->size = t->tiles_x * t->tiles_y * t->tile.size; +} diff --git a/mesalib/src/gallium/auxiliary/util/u_linear.h b/mesalib/src/gallium/auxiliary/util/u_linear.h index 38a790e3f..81ffc9fb2 100644 --- a/mesalib/src/gallium/auxiliary/util/u_linear.h +++ b/mesalib/src/gallium/auxiliary/util/u_linear.h @@ -1,106 +1,106 @@ -/************************************************************************** - * - * Copyright 2009 VMware, 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 VMWARE 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. - * - **************************************************************************/ - -/** - * Functions for converting tiled data to linear and vice versa. - */ - - -#ifndef U_LINEAR_H -#define U_LINEAR_H - -#include "pipe/p_compiler.h" -#include "pipe/p_format.h" - -struct u_linear_format_block -{ - /** Block size in bytes */ - unsigned size; - - /** Block width in pixels */ - unsigned width; - - /** Block height in pixels */ - unsigned height; -}; - - -struct pipe_tile_info -{ - unsigned size; - unsigned stride; - - /* The number of tiles */ - unsigned tiles_x; - unsigned tiles_y; - - /* size of each tile expressed in blocks */ - unsigned cols; - unsigned rows; - - /* Describe the tile in pixels */ - struct u_linear_format_block tile; - - /* Describe each block within the tile */ - struct u_linear_format_block block; -}; - -void pipe_linear_to_tile(size_t src_stride, const void *src_ptr, - struct pipe_tile_info *t, void *dst_ptr); - -void pipe_linear_from_tile(struct pipe_tile_info *t, const void *src_ptr, - size_t dst_stride, void *dst_ptr); - -/** - * Convenience function to fillout a pipe_tile_info struct. - * @t info to fill out. - * @block block info about pixel layout - * @tile_width the width of the tile in pixels - * @tile_height the height of the tile in pixels - * @tiles_x number of tiles in x axis - * @tiles_y number of tiles in y axis - */ -void pipe_linear_fill_info(struct pipe_tile_info *t, - const struct u_linear_format_block *block, - unsigned tile_width, unsigned tile_height, - unsigned tiles_x, unsigned tiles_y); - -static INLINE boolean pipe_linear_check_tile(const struct pipe_tile_info *t) -{ - if (t->tile.size != t->block.size * t->cols * t->rows) - return FALSE; - - if (t->stride != t->block.size * t->cols * t->tiles_x) - return FALSE; - - if (t->size < t->stride * t->rows * t->tiles_y) - return FALSE; - - return TRUE; -} - -#endif /* U_LINEAR_H */ +/************************************************************************** + * + * Copyright 2009 VMware, 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 VMWARE 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. + * + **************************************************************************/ + +/** + * Functions for converting tiled data to linear and vice versa. + */ + + +#ifndef U_LINEAR_H +#define U_LINEAR_H + +#include "pipe/p_compiler.h" +#include "pipe/p_format.h" + +struct u_linear_format_block +{ + /** Block size in bytes */ + unsigned size; + + /** Block width in pixels */ + unsigned width; + + /** Block height in pixels */ + unsigned height; +}; + + +struct pipe_tile_info +{ + unsigned size; + unsigned stride; + + /* The number of tiles */ + unsigned tiles_x; + unsigned tiles_y; + + /* size of each tile expressed in blocks */ + unsigned cols; + unsigned rows; + + /* Describe the tile in pixels */ + struct u_linear_format_block tile; + + /* Describe each block within the tile */ + struct u_linear_format_block block; +}; + +void pipe_linear_to_tile(size_t src_stride, const void *src_ptr, + struct pipe_tile_info *t, void *dst_ptr); + +void pipe_linear_from_tile(struct pipe_tile_info *t, const void *src_ptr, + size_t dst_stride, void *dst_ptr); + +/** + * Convenience function to fillout a pipe_tile_info struct. + * @t info to fill out. + * @block block info about pixel layout + * @tile_width the width of the tile in pixels + * @tile_height the height of the tile in pixels + * @tiles_x number of tiles in x axis + * @tiles_y number of tiles in y axis + */ +void pipe_linear_fill_info(struct pipe_tile_info *t, + const struct u_linear_format_block *block, + unsigned tile_width, unsigned tile_height, + unsigned tiles_x, unsigned tiles_y); + +static INLINE boolean pipe_linear_check_tile(const struct pipe_tile_info *t) +{ + if (t->tile.size != t->block.size * t->cols * t->rows) + return FALSE; + + if (t->stride != t->block.size * t->cols * t->tiles_x) + return FALSE; + + if (t->size < t->stride * t->rows * t->tiles_y) + return FALSE; + + return TRUE; +} + +#endif /* U_LINEAR_H */ diff --git a/mesalib/src/gallium/auxiliary/util/u_linkage.c b/mesalib/src/gallium/auxiliary/util/u_linkage.c index 89d67accc..2f6f41ba8 100644 --- a/mesalib/src/gallium/auxiliary/util/u_linkage.c +++ b/mesalib/src/gallium/auxiliary/util/u_linkage.c @@ -1,149 +1,149 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 "util/u_debug.h" -#include "pipe/p_shader_tokens.h" -#include "tgsi/tgsi_parse.h" -#include "tgsi/tgsi_scan.h" -#include "util/u_linkage.h" - -/* we must only record the registers that are actually used, not just declared */ -static INLINE boolean -util_semantic_set_test_and_set(struct util_semantic_set *set, unsigned value) -{ - unsigned mask = 1 << (value % (sizeof(long) * 8)); - unsigned long *p = &set->masks[value / (sizeof(long) * 8)]; - unsigned long v = *p & mask; - *p |= mask; - return !!v; -} - -unsigned -util_semantic_set_from_program_file(struct util_semantic_set *set, const struct tgsi_token *tokens, enum tgsi_file_type file) -{ - struct tgsi_shader_info info; - struct tgsi_parse_context parse; - unsigned count = 0; - ubyte *semantic_name; - ubyte *semantic_index; - - tgsi_scan_shader(tokens, &info); - - if(file == TGSI_FILE_INPUT) - { - semantic_name = info.input_semantic_name; - semantic_index = info.input_semantic_index; - } - else if(file == TGSI_FILE_OUTPUT) - { - semantic_name = info.output_semantic_name; - semantic_index = info.output_semantic_index; - } - else - { - assert(0); - semantic_name = NULL; - semantic_index = NULL; - } - - tgsi_parse_init(&parse, tokens); - - memset(set->masks, 0, sizeof(set->masks)); - while(!tgsi_parse_end_of_tokens(&parse)) - { - tgsi_parse_token(&parse); - - if(parse.FullToken.Token.Type == TGSI_TOKEN_TYPE_INSTRUCTION) - { - const struct tgsi_full_instruction *finst = &parse.FullToken.FullInstruction; - unsigned i; - for(i = 0; i < finst->Instruction.NumDstRegs; ++i) - { - if(finst->Dst[i].Register.File == file) - { - unsigned idx = finst->Dst[i].Register.Index; - if(semantic_name[idx] == TGSI_SEMANTIC_GENERIC) - { - if(!util_semantic_set_test_and_set(set, semantic_index[idx])) - ++count; - } - } - } - - for(i = 0; i < finst->Instruction.NumSrcRegs; ++i) - { - if(finst->Src[i].Register.File == file) - { - unsigned idx = finst->Src[i].Register.Index; - if(semantic_name[idx] == TGSI_SEMANTIC_GENERIC) - { - if(!util_semantic_set_test_and_set(set, semantic_index[idx])) - ++count; - } - } - } - } - } - tgsi_parse_free(&parse); - - return count; -} - -#define UTIL_SEMANTIC_SET_FOR_EACH(i, set) for(i = 0; i < 256; ++i) if(set->masks[i / (sizeof(long) * 8)] & (1 << (i % (sizeof(long) * 8)))) - -void -util_semantic_layout_from_set(unsigned char *layout, const struct util_semantic_set *set, unsigned efficient_slots, unsigned num_slots) -{ - int first = -1; - int last = -1; - unsigned i; - - memset(layout, 0xff, num_slots); - - UTIL_SEMANTIC_SET_FOR_EACH(i, set) - { - if(first < 0) - first = i; - last = i; - } - - if(last < efficient_slots) - { - UTIL_SEMANTIC_SET_FOR_EACH(i, set) - layout[i] = i; - } - else if((last - first) < efficient_slots) - { - UTIL_SEMANTIC_SET_FOR_EACH(i, set) - layout[i - first] = i; - } - else - { - unsigned idx = 0; - UTIL_SEMANTIC_SET_FOR_EACH(i, set) - layout[idx++] = i; - } -} +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 "util/u_debug.h" +#include "pipe/p_shader_tokens.h" +#include "tgsi/tgsi_parse.h" +#include "tgsi/tgsi_scan.h" +#include "util/u_linkage.h" + +/* we must only record the registers that are actually used, not just declared */ +static INLINE boolean +util_semantic_set_test_and_set(struct util_semantic_set *set, unsigned value) +{ + unsigned mask = 1 << (value % (sizeof(long) * 8)); + unsigned long *p = &set->masks[value / (sizeof(long) * 8)]; + unsigned long v = *p & mask; + *p |= mask; + return !!v; +} + +unsigned +util_semantic_set_from_program_file(struct util_semantic_set *set, const struct tgsi_token *tokens, enum tgsi_file_type file) +{ + struct tgsi_shader_info info; + struct tgsi_parse_context parse; + unsigned count = 0; + ubyte *semantic_name; + ubyte *semantic_index; + + tgsi_scan_shader(tokens, &info); + + if(file == TGSI_FILE_INPUT) + { + semantic_name = info.input_semantic_name; + semantic_index = info.input_semantic_index; + } + else if(file == TGSI_FILE_OUTPUT) + { + semantic_name = info.output_semantic_name; + semantic_index = info.output_semantic_index; + } + else + { + assert(0); + semantic_name = NULL; + semantic_index = NULL; + } + + tgsi_parse_init(&parse, tokens); + + memset(set->masks, 0, sizeof(set->masks)); + while(!tgsi_parse_end_of_tokens(&parse)) + { + tgsi_parse_token(&parse); + + if(parse.FullToken.Token.Type == TGSI_TOKEN_TYPE_INSTRUCTION) + { + const struct tgsi_full_instruction *finst = &parse.FullToken.FullInstruction; + unsigned i; + for(i = 0; i < finst->Instruction.NumDstRegs; ++i) + { + if(finst->Dst[i].Register.File == file) + { + unsigned idx = finst->Dst[i].Register.Index; + if(semantic_name[idx] == TGSI_SEMANTIC_GENERIC) + { + if(!util_semantic_set_test_and_set(set, semantic_index[idx])) + ++count; + } + } + } + + for(i = 0; i < finst->Instruction.NumSrcRegs; ++i) + { + if(finst->Src[i].Register.File == file) + { + unsigned idx = finst->Src[i].Register.Index; + if(semantic_name[idx] == TGSI_SEMANTIC_GENERIC) + { + if(!util_semantic_set_test_and_set(set, semantic_index[idx])) + ++count; + } + } + } + } + } + tgsi_parse_free(&parse); + + return count; +} + +#define UTIL_SEMANTIC_SET_FOR_EACH(i, set) for(i = 0; i < 256; ++i) if(set->masks[i / (sizeof(long) * 8)] & (1 << (i % (sizeof(long) * 8)))) + +void +util_semantic_layout_from_set(unsigned char *layout, const struct util_semantic_set *set, unsigned efficient_slots, unsigned num_slots) +{ + int first = -1; + int last = -1; + unsigned i; + + memset(layout, 0xff, num_slots); + + UTIL_SEMANTIC_SET_FOR_EACH(i, set) + { + if(first < 0) + first = i; + last = i; + } + + if(last < efficient_slots) + { + UTIL_SEMANTIC_SET_FOR_EACH(i, set) + layout[i] = i; + } + else if((last - first) < efficient_slots) + { + UTIL_SEMANTIC_SET_FOR_EACH(i, set) + layout[i - first] = i; + } + else + { + unsigned idx = 0; + UTIL_SEMANTIC_SET_FOR_EACH(i, set) + layout[idx++] = i; + } +} diff --git a/mesalib/src/gallium/auxiliary/util/u_math.c b/mesalib/src/gallium/auxiliary/util/u_math.c index 3044f5da8..2811475fa 100644 --- a/mesalib/src/gallium/auxiliary/util/u_math.c +++ b/mesalib/src/gallium/auxiliary/util/u_math.c @@ -1,73 +1,73 @@ -/************************************************************************** - * - * Copyright 2008 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 "util/u_math.h" - - -/** 2^x, for x in [-1.0, 1.0) */ -float pow2_table[POW2_TABLE_SIZE]; - - -static void -init_pow2_table(void) -{ - int i; - for (i = 0; i < POW2_TABLE_SIZE; i++) - pow2_table[i] = (float) pow(2.0, (i - POW2_TABLE_OFFSET) / POW2_TABLE_SCALE); -} - - -/** log2(x), for x in [1.0, 2.0) */ -float log2_table[LOG2_TABLE_SIZE]; - - -static void -init_log2_table(void) -{ - unsigned i; - for (i = 0; i < LOG2_TABLE_SIZE; i++) - log2_table[i] = (float) log2(1.0 + i * (1.0 / LOG2_TABLE_SCALE)); -} - - -/** - * One time init for math utilities. - */ -void -util_init_math(void) -{ - static boolean initialized = FALSE; - if (!initialized) { - init_pow2_table(); - init_log2_table(); - initialized = TRUE; - } -} - - +/************************************************************************** + * + * Copyright 2008 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 "util/u_math.h" + + +/** 2^x, for x in [-1.0, 1.0) */ +float pow2_table[POW2_TABLE_SIZE]; + + +static void +init_pow2_table(void) +{ + int i; + for (i = 0; i < POW2_TABLE_SIZE; i++) + pow2_table[i] = (float) pow(2.0, (i - POW2_TABLE_OFFSET) / POW2_TABLE_SCALE); +} + + +/** log2(x), for x in [1.0, 2.0) */ +float log2_table[LOG2_TABLE_SIZE]; + + +static void +init_log2_table(void) +{ + unsigned i; + for (i = 0; i < LOG2_TABLE_SIZE; i++) + log2_table[i] = (float) log2(1.0 + i * (1.0 / LOG2_TABLE_SCALE)); +} + + +/** + * One time init for math utilities. + */ +void +util_init_math(void) +{ + static boolean initialized = FALSE; + if (!initialized) { + init_pow2_table(); + init_log2_table(); + initialized = TRUE; + } +} + + diff --git a/mesalib/src/gallium/auxiliary/util/u_memory.h b/mesalib/src/gallium/auxiliary/util/u_memory.h index 4eb798469..53d56599f 100644 --- a/mesalib/src/gallium/auxiliary/util/u_memory.h +++ b/mesalib/src/gallium/auxiliary/util/u_memory.h @@ -1,100 +1,100 @@ -/************************************************************************** - * - * Copyright 2008 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. - * - **************************************************************************/ - - -/* - * Memory functions - */ - - -#ifndef U_MEMORY_H -#define U_MEMORY_H - - -#include "util/u_pointer.h" -#include "util/u_debug.h" -#include "os/os_memory.h" - - -#ifdef __cplusplus -extern "C" { -#endif - - -#define MALLOC(_size) os_malloc(_size) - -#define CALLOC(_count, _size) os_calloc(_count, _size) - -#define FREE(_ptr ) os_free(_ptr) - -#define REALLOC(_ptr, _old_size, _size) os_realloc(_ptr, _old_size, _size) - -#define MALLOC_STRUCT(T) (struct T *) MALLOC(sizeof(struct T)) - -#define CALLOC_STRUCT(T) (struct T *) CALLOC(1, sizeof(struct T)) - -#define CALLOC_VARIANT_LENGTH_STRUCT(T,more_size) ((struct T *) CALLOC(1, sizeof(struct T) + more_size)) - - -#define align_malloc(_size, _alignment) os_malloc_aligned(_size, _alignment) -#define align_free(_ptr) os_free_aligned(_ptr) - - -/** - * Duplicate a block of memory. - */ -static INLINE void * -mem_dup(const void *src, uint size) -{ - void *dup = MALLOC(size); - if (dup) - memcpy(dup, src, size); - return dup; -} - - -/** - * Number of elements in an array. - */ -#ifndef Elements -#define Elements(x) (sizeof(x)/sizeof((x)[0])) -#endif - - -/** - * Offset of a field in a struct, in bytes. - */ -#define Offset(TYPE, MEMBER) ((uintptr_t)&(((TYPE *)NULL)->MEMBER)) - - - -#ifdef __cplusplus -} -#endif - - -#endif /* U_MEMORY_H */ +/************************************************************************** + * + * Copyright 2008 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. + * + **************************************************************************/ + + +/* + * Memory functions + */ + + +#ifndef U_MEMORY_H +#define U_MEMORY_H + + +#include "util/u_pointer.h" +#include "util/u_debug.h" +#include "os/os_memory.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +#define MALLOC(_size) os_malloc(_size) + +#define CALLOC(_count, _size) os_calloc(_count, _size) + +#define FREE(_ptr ) os_free(_ptr) + +#define REALLOC(_ptr, _old_size, _size) os_realloc(_ptr, _old_size, _size) + +#define MALLOC_STRUCT(T) (struct T *) MALLOC(sizeof(struct T)) + +#define CALLOC_STRUCT(T) (struct T *) CALLOC(1, sizeof(struct T)) + +#define CALLOC_VARIANT_LENGTH_STRUCT(T,more_size) ((struct T *) CALLOC(1, sizeof(struct T) + more_size)) + + +#define align_malloc(_size, _alignment) os_malloc_aligned(_size, _alignment) +#define align_free(_ptr) os_free_aligned(_ptr) + + +/** + * Duplicate a block of memory. + */ +static INLINE void * +mem_dup(const void *src, uint size) +{ + void *dup = MALLOC(size); + if (dup) + memcpy(dup, src, size); + return dup; +} + + +/** + * Number of elements in an array. + */ +#ifndef Elements +#define Elements(x) (sizeof(x)/sizeof((x)[0])) +#endif + + +/** + * Offset of a field in a struct, in bytes. + */ +#define Offset(TYPE, MEMBER) ((uintptr_t)&(((TYPE *)NULL)->MEMBER)) + + + +#ifdef __cplusplus +} +#endif + + +#endif /* U_MEMORY_H */ diff --git a/mesalib/src/gallium/auxiliary/util/u_mm.c b/mesalib/src/gallium/auxiliary/util/u_mm.c index 874f1f40f..82f83702d 100644 --- a/mesalib/src/gallium/auxiliary/util/u_mm.c +++ b/mesalib/src/gallium/auxiliary/util/u_mm.c @@ -1,296 +1,296 @@ -/************************************************************************** - * - * Copyright (C) 1999 Wittawat Yamwong - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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 - * WITTAWAT YAMWONG, 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 "pipe/p_compiler.h" -#include "util/u_debug.h" - -#include "util/u_memory.h" -#include "util/u_mm.h" - - -void -u_mmDumpMemInfo(const struct mem_block *heap) -{ - debug_printf("Memory heap %p:\n", (void *) heap); - if (heap == 0) { - debug_printf(" heap == 0\n"); - } - else { - const struct mem_block *p; - int total_used = 0, total_free = 0; - - for (p = heap->next; p != heap; p = p->next) { - debug_printf(" Offset:%08x, Size:%08x, %c%c\n", p->ofs, p->size, - p->free ? 'F':'.', - p->reserved ? 'R':'.'); - if (p->free) - total_free += p->size; - else - total_used += p->size; - } - - debug_printf("'\nMemory stats: total = %d, used = %d, free = %d\n", - total_used + total_free, total_used, total_free); - debug_printf("\nFree list:\n"); - - for (p = heap->next_free; p != heap; p = p->next_free) { - debug_printf(" FREE Offset:%08x, Size:%08x, %c%c\n", p->ofs, p->size, - p->free ? 'F':'.', - p->reserved ? 'R':'.'); - } - - } - debug_printf("End of memory blocks\n"); -} - - -struct mem_block * -u_mmInit(int ofs, int size) -{ - struct mem_block *heap, *block; - - if (size <= 0) - return NULL; - - heap = CALLOC_STRUCT(mem_block); - if (!heap) - return NULL; - - block = CALLOC_STRUCT(mem_block); - if (!block) { - FREE(heap); - return NULL; - } - - heap->next = block; - heap->prev = block; - heap->next_free = block; - heap->prev_free = block; - - block->heap = heap; - block->next = heap; - block->prev = heap; - block->next_free = heap; - block->prev_free = heap; - - block->ofs = ofs; - block->size = size; - block->free = 1; - - return heap; -} - - -static struct mem_block * -SliceBlock(struct mem_block *p, - int startofs, int size, - int reserved, int alignment) -{ - struct mem_block *newblock; - - /* break left [p, newblock, p->next], then p = newblock */ - if (startofs > p->ofs) { - newblock = CALLOC_STRUCT(mem_block); - if (!newblock) - return NULL; - newblock->ofs = startofs; - newblock->size = p->size - (startofs - p->ofs); - newblock->free = 1; - newblock->heap = p->heap; - - newblock->next = p->next; - newblock->prev = p; - p->next->prev = newblock; - p->next = newblock; - - newblock->next_free = p->next_free; - newblock->prev_free = p; - p->next_free->prev_free = newblock; - p->next_free = newblock; - - p->size -= newblock->size; - p = newblock; - } - - /* break right, also [p, newblock, p->next] */ - if (size < p->size) { - newblock = CALLOC_STRUCT(mem_block); - if (!newblock) - return NULL; - newblock->ofs = startofs + size; - newblock->size = p->size - size; - newblock->free = 1; - newblock->heap = p->heap; - - newblock->next = p->next; - newblock->prev = p; - p->next->prev = newblock; - p->next = newblock; - - newblock->next_free = p->next_free; - newblock->prev_free = p; - p->next_free->prev_free = newblock; - p->next_free = newblock; - - p->size = size; - } - - /* p = middle block */ - p->free = 0; - - /* Remove p from the free list: - */ - p->next_free->prev_free = p->prev_free; - p->prev_free->next_free = p->next_free; - - p->next_free = 0; - p->prev_free = 0; - - p->reserved = reserved; - return p; -} - - -struct mem_block * -u_mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch) -{ - struct mem_block *p; - const int mask = (1 << align2)-1; - int startofs = 0; - int endofs; - - assert(size >= 0); - assert(align2 >= 0); - assert(align2 <= 12); /* sanity check, 2^12 (4KB) enough? */ - - if (!heap || align2 < 0 || size <= 0) - return NULL; - - for (p = heap->next_free; p != heap; p = p->next_free) { - assert(p->free); - - startofs = (p->ofs + mask) & ~mask; - if ( startofs < startSearch ) { - startofs = startSearch; - } - endofs = startofs+size; - if (endofs <= (p->ofs+p->size)) - break; - } - - if (p == heap) - return NULL; - - assert(p->free); - p = SliceBlock(p,startofs,size,0,mask+1); - - return p; -} - - -struct mem_block * -u_mmFindBlock(struct mem_block *heap, int start) -{ - struct mem_block *p; - - for (p = heap->next; p != heap; p = p->next) { - if (p->ofs == start) - return p; - } - - return NULL; -} - - -static INLINE int -Join2Blocks(struct mem_block *p) -{ - /* XXX there should be some assertions here */ - - /* NOTE: heap->free == 0 */ - - if (p->free && p->next->free) { - struct mem_block *q = p->next; - - assert(p->ofs + p->size == q->ofs); - p->size += q->size; - - p->next = q->next; - q->next->prev = p; - - q->next_free->prev_free = q->prev_free; - q->prev_free->next_free = q->next_free; - - FREE(q); - return 1; - } - return 0; -} - -int -u_mmFreeMem(struct mem_block *b) -{ - if (!b) - return 0; - - if (b->free) { - debug_printf("block already free\n"); - return -1; - } - if (b->reserved) { - debug_printf("block is reserved\n"); - return -1; - } - - b->free = 1; - b->next_free = b->heap->next_free; - b->prev_free = b->heap; - b->next_free->prev_free = b; - b->prev_free->next_free = b; - - Join2Blocks(b); - if (b->prev != b->heap) - Join2Blocks(b->prev); - - return 0; -} - - -void -u_mmDestroy(struct mem_block *heap) -{ - struct mem_block *p; - - if (!heap) - return; - - for (p = heap->next; p != heap; ) { - struct mem_block *next = p->next; - FREE(p); - p = next; - } - - FREE(heap); -} +/************************************************************************** + * + * Copyright (C) 1999 Wittawat Yamwong + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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 + * WITTAWAT YAMWONG, 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 "pipe/p_compiler.h" +#include "util/u_debug.h" + +#include "util/u_memory.h" +#include "util/u_mm.h" + + +void +u_mmDumpMemInfo(const struct mem_block *heap) +{ + debug_printf("Memory heap %p:\n", (void *) heap); + if (heap == 0) { + debug_printf(" heap == 0\n"); + } + else { + const struct mem_block *p; + int total_used = 0, total_free = 0; + + for (p = heap->next; p != heap; p = p->next) { + debug_printf(" Offset:%08x, Size:%08x, %c%c\n", p->ofs, p->size, + p->free ? 'F':'.', + p->reserved ? 'R':'.'); + if (p->free) + total_free += p->size; + else + total_used += p->size; + } + + debug_printf("'\nMemory stats: total = %d, used = %d, free = %d\n", + total_used + total_free, total_used, total_free); + debug_printf("\nFree list:\n"); + + for (p = heap->next_free; p != heap; p = p->next_free) { + debug_printf(" FREE Offset:%08x, Size:%08x, %c%c\n", p->ofs, p->size, + p->free ? 'F':'.', + p->reserved ? 'R':'.'); + } + + } + debug_printf("End of memory blocks\n"); +} + + +struct mem_block * +u_mmInit(int ofs, int size) +{ + struct mem_block *heap, *block; + + if (size <= 0) + return NULL; + + heap = CALLOC_STRUCT(mem_block); + if (!heap) + return NULL; + + block = CALLOC_STRUCT(mem_block); + if (!block) { + FREE(heap); + return NULL; + } + + heap->next = block; + heap->prev = block; + heap->next_free = block; + heap->prev_free = block; + + block->heap = heap; + block->next = heap; + block->prev = heap; + block->next_free = heap; + block->prev_free = heap; + + block->ofs = ofs; + block->size = size; + block->free = 1; + + return heap; +} + + +static struct mem_block * +SliceBlock(struct mem_block *p, + int startofs, int size, + int reserved, int alignment) +{ + struct mem_block *newblock; + + /* break left [p, newblock, p->next], then p = newblock */ + if (startofs > p->ofs) { + newblock = CALLOC_STRUCT(mem_block); + if (!newblock) + return NULL; + newblock->ofs = startofs; + newblock->size = p->size - (startofs - p->ofs); + newblock->free = 1; + newblock->heap = p->heap; + + newblock->next = p->next; + newblock->prev = p; + p->next->prev = newblock; + p->next = newblock; + + newblock->next_free = p->next_free; + newblock->prev_free = p; + p->next_free->prev_free = newblock; + p->next_free = newblock; + + p->size -= newblock->size; + p = newblock; + } + + /* break right, also [p, newblock, p->next] */ + if (size < p->size) { + newblock = CALLOC_STRUCT(mem_block); + if (!newblock) + return NULL; + newblock->ofs = startofs + size; + newblock->size = p->size - size; + newblock->free = 1; + newblock->heap = p->heap; + + newblock->next = p->next; + newblock->prev = p; + p->next->prev = newblock; + p->next = newblock; + + newblock->next_free = p->next_free; + newblock->prev_free = p; + p->next_free->prev_free = newblock; + p->next_free = newblock; + + p->size = size; + } + + /* p = middle block */ + p->free = 0; + + /* Remove p from the free list: + */ + p->next_free->prev_free = p->prev_free; + p->prev_free->next_free = p->next_free; + + p->next_free = 0; + p->prev_free = 0; + + p->reserved = reserved; + return p; +} + + +struct mem_block * +u_mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch) +{ + struct mem_block *p; + const int mask = (1 << align2)-1; + int startofs = 0; + int endofs; + + assert(size >= 0); + assert(align2 >= 0); + assert(align2 <= 12); /* sanity check, 2^12 (4KB) enough? */ + + if (!heap || align2 < 0 || size <= 0) + return NULL; + + for (p = heap->next_free; p != heap; p = p->next_free) { + assert(p->free); + + startofs = (p->ofs + mask) & ~mask; + if ( startofs < startSearch ) { + startofs = startSearch; + } + endofs = startofs+size; + if (endofs <= (p->ofs+p->size)) + break; + } + + if (p == heap) + return NULL; + + assert(p->free); + p = SliceBlock(p,startofs,size,0,mask+1); + + return p; +} + + +struct mem_block * +u_mmFindBlock(struct mem_block *heap, int start) +{ + struct mem_block *p; + + for (p = heap->next; p != heap; p = p->next) { + if (p->ofs == start) + return p; + } + + return NULL; +} + + +static INLINE int +Join2Blocks(struct mem_block *p) +{ + /* XXX there should be some assertions here */ + + /* NOTE: heap->free == 0 */ + + if (p->free && p->next->free) { + struct mem_block *q = p->next; + + assert(p->ofs + p->size == q->ofs); + p->size += q->size; + + p->next = q->next; + q->next->prev = p; + + q->next_free->prev_free = q->prev_free; + q->prev_free->next_free = q->next_free; + + FREE(q); + return 1; + } + return 0; +} + +int +u_mmFreeMem(struct mem_block *b) +{ + if (!b) + return 0; + + if (b->free) { + debug_printf("block already free\n"); + return -1; + } + if (b->reserved) { + debug_printf("block is reserved\n"); + return -1; + } + + b->free = 1; + b->next_free = b->heap->next_free; + b->prev_free = b->heap; + b->next_free->prev_free = b; + b->prev_free->next_free = b; + + Join2Blocks(b); + if (b->prev != b->heap) + Join2Blocks(b->prev); + + return 0; +} + + +void +u_mmDestroy(struct mem_block *heap) +{ + struct mem_block *p; + + if (!heap) + return; + + for (p = heap->next; p != heap; ) { + struct mem_block *next = p->next; + FREE(p); + p = next; + } + + FREE(heap); +} diff --git a/mesalib/src/gallium/auxiliary/util/u_mm.h b/mesalib/src/gallium/auxiliary/util/u_mm.h index 3818181db..6b158aae6 100644 --- a/mesalib/src/gallium/auxiliary/util/u_mm.h +++ b/mesalib/src/gallium/auxiliary/util/u_mm.h @@ -1,91 +1,91 @@ -/************************************************************************** - * - * Copyright (C) 1999 Wittawat Yamwong - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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. - * - **************************************************************************/ - - -/** - * @file - * Memory manager code. Primarily used by device drivers to manage texture - * heaps, etc. - */ - - -#ifndef _U_MM_H_ -#define _U_MM_H_ - - -struct mem_block { - struct mem_block *next, *prev; - struct mem_block *next_free, *prev_free; - struct mem_block *heap; - int ofs,size; - unsigned int free:1; - unsigned int reserved:1; -}; - - - -/** - * input: total size in bytes - * return: a heap pointer if OK, NULL if error - */ -extern struct mem_block *u_mmInit(int ofs, int size); - -/** - * Allocate 'size' bytes with 2^align2 bytes alignment, - * restrict the search to free memory after 'startSearch' - * depth and back buffers should be in different 4mb banks - * to get better page hits if possible - * input: size = size of block - * align2 = 2^align2 bytes alignment - * startSearch = linear offset from start of heap to begin search - * return: pointer to the allocated block, 0 if error - */ -extern struct mem_block *u_mmAllocMem(struct mem_block *heap, int size, int align2, - int startSearch); - -/** - * Free block starts at offset - * input: pointer to a block - * return: 0 if OK, -1 if error - */ -extern int u_mmFreeMem(struct mem_block *b); - -/** - * Free block starts at offset - * input: pointer to a heap, start offset - * return: pointer to a block - */ -extern struct mem_block *u_mmFindBlock(struct mem_block *heap, int start); - -/** - * destroy MM - */ -extern void u_mmDestroy(struct mem_block *mmInit); - -/** - * For debugging purposes. - */ -extern void u_mmDumpMemInfo(const struct mem_block *mmInit); - -#endif +/************************************************************************** + * + * Copyright (C) 1999 Wittawat Yamwong + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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. + * + **************************************************************************/ + + +/** + * @file + * Memory manager code. Primarily used by device drivers to manage texture + * heaps, etc. + */ + + +#ifndef _U_MM_H_ +#define _U_MM_H_ + + +struct mem_block { + struct mem_block *next, *prev; + struct mem_block *next_free, *prev_free; + struct mem_block *heap; + int ofs,size; + unsigned int free:1; + unsigned int reserved:1; +}; + + + +/** + * input: total size in bytes + * return: a heap pointer if OK, NULL if error + */ +extern struct mem_block *u_mmInit(int ofs, int size); + +/** + * Allocate 'size' bytes with 2^align2 bytes alignment, + * restrict the search to free memory after 'startSearch' + * depth and back buffers should be in different 4mb banks + * to get better page hits if possible + * input: size = size of block + * align2 = 2^align2 bytes alignment + * startSearch = linear offset from start of heap to begin search + * return: pointer to the allocated block, 0 if error + */ +extern struct mem_block *u_mmAllocMem(struct mem_block *heap, int size, int align2, + int startSearch); + +/** + * Free block starts at offset + * input: pointer to a block + * return: 0 if OK, -1 if error + */ +extern int u_mmFreeMem(struct mem_block *b); + +/** + * Free block starts at offset + * input: pointer to a heap, start offset + * return: pointer to a block + */ +extern struct mem_block *u_mmFindBlock(struct mem_block *heap, int start); + +/** + * destroy MM + */ +extern void u_mmDestroy(struct mem_block *mmInit); + +/** + * For debugging purposes. + */ +extern void u_mmDumpMemInfo(const struct mem_block *mmInit); + +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_pointer.h b/mesalib/src/gallium/auxiliary/util/u_pointer.h index f75ce012b..cce0c7430 100644 --- a/mesalib/src/gallium/auxiliary/util/u_pointer.h +++ b/mesalib/src/gallium/auxiliary/util/u_pointer.h @@ -1,130 +1,130 @@ -/************************************************************************** - * - * Copyright 2007-2008 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 U_POINTER_H -#define U_POINTER_H - -#include "pipe/p_compiler.h" - -#ifdef __cplusplus -extern "C" { -#endif - -static INLINE intptr_t -pointer_to_intptr( const void *p ) -{ - union { - const void *p; - intptr_t i; - } pi; - pi.p = p; - return pi.i; -} - -static INLINE void * -intptr_to_pointer( intptr_t i ) -{ - union { - void *p; - intptr_t i; - } pi; - pi.i = i; - return pi.p; -} - -static INLINE uintptr_t -pointer_to_uintptr( const void *ptr ) -{ - union { - const void *p; - uintptr_t u; - } pu; - pu.p = ptr; - return pu.u; -} - -static INLINE void * -uintptr_to_pointer( uintptr_t u ) -{ - union { - void *p; - uintptr_t u; - } pu; - pu.u = u; - return pu.p; -} - -/** - * Return a pointer aligned to next multiple of N bytes. - */ -static INLINE void * -align_pointer( const void *unaligned, uintptr_t alignment ) -{ - uintptr_t aligned = (pointer_to_uintptr( unaligned ) + alignment - 1) & ~(alignment - 1); - return uintptr_to_pointer( aligned ); -} - - -/** - * Return a pointer aligned to next multiple of 16 bytes. - */ -static INLINE void * -align16( void *unaligned ) -{ - return align_pointer( unaligned, 16 ); -} - -typedef void (*func_pointer)(void); - -static INLINE func_pointer -pointer_to_func( void *p ) -{ - union { - void *p; - func_pointer f; - } pf; - pf.p = p; - return pf.f; -} - -static INLINE void * -func_to_pointer( func_pointer f ) -{ - union { - void *p; - func_pointer f; - } pf; - pf.f = f; - return pf.p; -} - - -#ifdef __cplusplus -} -#endif - -#endif /* U_POINTER_H */ +/************************************************************************** + * + * Copyright 2007-2008 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 U_POINTER_H +#define U_POINTER_H + +#include "pipe/p_compiler.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static INLINE intptr_t +pointer_to_intptr( const void *p ) +{ + union { + const void *p; + intptr_t i; + } pi; + pi.p = p; + return pi.i; +} + +static INLINE void * +intptr_to_pointer( intptr_t i ) +{ + union { + void *p; + intptr_t i; + } pi; + pi.i = i; + return pi.p; +} + +static INLINE uintptr_t +pointer_to_uintptr( const void *ptr ) +{ + union { + const void *p; + uintptr_t u; + } pu; + pu.p = ptr; + return pu.u; +} + +static INLINE void * +uintptr_to_pointer( uintptr_t u ) +{ + union { + void *p; + uintptr_t u; + } pu; + pu.u = u; + return pu.p; +} + +/** + * Return a pointer aligned to next multiple of N bytes. + */ +static INLINE void * +align_pointer( const void *unaligned, uintptr_t alignment ) +{ + uintptr_t aligned = (pointer_to_uintptr( unaligned ) + alignment - 1) & ~(alignment - 1); + return uintptr_to_pointer( aligned ); +} + + +/** + * Return a pointer aligned to next multiple of 16 bytes. + */ +static INLINE void * +align16( void *unaligned ) +{ + return align_pointer( unaligned, 16 ); +} + +typedef void (*func_pointer)(void); + +static INLINE func_pointer +pointer_to_func( void *p ) +{ + union { + void *p; + func_pointer f; + } pf; + pf.p = p; + return pf.f; +} + +static INLINE void * +func_to_pointer( func_pointer f ) +{ + union { + void *p; + func_pointer f; + } pf; + pf.f = f; + return pf.p; +} + + +#ifdef __cplusplus +} +#endif + +#endif /* U_POINTER_H */ diff --git a/mesalib/src/gallium/auxiliary/util/u_pstipple.h b/mesalib/src/gallium/auxiliary/util/u_pstipple.h index 451e37417..1c2f5f48a 100644 --- a/mesalib/src/gallium/auxiliary/util/u_pstipple.h +++ b/mesalib/src/gallium/auxiliary/util/u_pstipple.h @@ -1,56 +1,56 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * Copyright 2010 VMware, 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 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 U_PSTIPPLE_H -#define U_PSTIPPLE_H - -#include "pipe/p_compiler.h" - -struct pipe_context; -struct pipe_resource; -struct pipe_shader_state; - - -extern struct pipe_resource * -util_pstipple_create_stipple_texture(struct pipe_context *pipe, - const uint32_t pattern[32]); - -extern struct pipe_sampler_view * -util_pstipple_create_sampler_view(struct pipe_context *pipe, - struct pipe_resource *tex); - -extern void * -util_pstipple_create_sampler(struct pipe_context *pipe); - -extern struct pipe_shader_state * -util_pstipple_create_fragment_shader(struct pipe_context *pipe, - struct pipe_shader_state *fs, - unsigned *samplerUnitOut); - - -#endif +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2010 VMware, 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 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 U_PSTIPPLE_H +#define U_PSTIPPLE_H + +#include "pipe/p_compiler.h" + +struct pipe_context; +struct pipe_resource; +struct pipe_shader_state; + + +extern struct pipe_resource * +util_pstipple_create_stipple_texture(struct pipe_context *pipe, + const uint32_t pattern[32]); + +extern struct pipe_sampler_view * +util_pstipple_create_sampler_view(struct pipe_context *pipe, + struct pipe_resource *tex); + +extern void * +util_pstipple_create_sampler(struct pipe_context *pipe); + +extern struct pipe_shader_state * +util_pstipple_create_fragment_shader(struct pipe_context *pipe, + struct pipe_shader_state *fs, + unsigned *samplerUnitOut); + + +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_rect.h b/mesalib/src/gallium/auxiliary/util/u_rect.h index d16f106bf..4cb90d3c3 100644 --- a/mesalib/src/gallium/auxiliary/util/u_rect.h +++ b/mesalib/src/gallium/auxiliary/util/u_rect.h @@ -1,103 +1,103 @@ -/************************************************************************** - * - * Copyright 2008 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 U_RECT_H -#define U_RECT_H - -#include "pipe/p_compiler.h" - -struct u_rect { - int x0, x1; - int y0, y1; -}; - -/* Do two rectangles intersect? - */ -static INLINE boolean -u_rect_test_intersection(const struct u_rect *a, - const struct u_rect *b) -{ - return (!(a->x1 < b->x0 || - b->x1 < a->x0 || - a->y1 < b->y0 || - b->y1 < a->y0)); -} - -/* Find the intersection of two rectangles known to intersect. - */ -static INLINE void -u_rect_find_intersection(const struct u_rect *a, - struct u_rect *b) -{ - /* Caller should verify intersection exists before calling. - */ - if (b->x0 < a->x0) b->x0 = a->x0; - if (b->x1 > a->x1) b->x1 = a->x1; - if (b->y0 < a->y0) b->y0 = a->y0; - if (b->y1 > a->y1) b->y1 = a->y1; -} - - -static INLINE void -u_rect_possible_intersection(const struct u_rect *a, - struct u_rect *b) -{ - if (u_rect_test_intersection(a,b)) { - u_rect_find_intersection(a,b); - } - else { - b->x0 = b->x1 = b->y0 = b->y1 = 0; - } -} - -#include "pipe/p_format.h" -#include "util/u_pack_color.h" - - - -/********************************************************************** - * Pipe copy/fill rect helpers. - */ - -/* These really should move to a different file: - */ -#include "pipe/p_format.h" - -extern void -util_copy_rect(ubyte * dst, enum pipe_format format, - unsigned dst_stride, unsigned dst_x, unsigned dst_y, - unsigned width, unsigned height, const ubyte * src, - int src_stride, unsigned src_x, unsigned src_y); - -extern void -util_fill_rect(ubyte * dst, enum pipe_format format, - unsigned dst_stride, unsigned dst_x, unsigned dst_y, - unsigned width, unsigned height, union util_color *uc); - - -#endif /* U_RECT_H */ +/************************************************************************** + * + * Copyright 2008 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 U_RECT_H +#define U_RECT_H + +#include "pipe/p_compiler.h" + +struct u_rect { + int x0, x1; + int y0, y1; +}; + +/* Do two rectangles intersect? + */ +static INLINE boolean +u_rect_test_intersection(const struct u_rect *a, + const struct u_rect *b) +{ + return (!(a->x1 < b->x0 || + b->x1 < a->x0 || + a->y1 < b->y0 || + b->y1 < a->y0)); +} + +/* Find the intersection of two rectangles known to intersect. + */ +static INLINE void +u_rect_find_intersection(const struct u_rect *a, + struct u_rect *b) +{ + /* Caller should verify intersection exists before calling. + */ + if (b->x0 < a->x0) b->x0 = a->x0; + if (b->x1 > a->x1) b->x1 = a->x1; + if (b->y0 < a->y0) b->y0 = a->y0; + if (b->y1 > a->y1) b->y1 = a->y1; +} + + +static INLINE void +u_rect_possible_intersection(const struct u_rect *a, + struct u_rect *b) +{ + if (u_rect_test_intersection(a,b)) { + u_rect_find_intersection(a,b); + } + else { + b->x0 = b->x1 = b->y0 = b->y1 = 0; + } +} + +#include "pipe/p_format.h" +#include "util/u_pack_color.h" + + + +/********************************************************************** + * Pipe copy/fill rect helpers. + */ + +/* These really should move to a different file: + */ +#include "pipe/p_format.h" + +extern void +util_copy_rect(ubyte * dst, enum pipe_format format, + unsigned dst_stride, unsigned dst_x, unsigned dst_y, + unsigned width, unsigned height, const ubyte * src, + int src_stride, unsigned src_x, unsigned src_y); + +extern void +util_fill_rect(ubyte * dst, enum pipe_format format, + unsigned dst_stride, unsigned dst_x, unsigned dst_y, + unsigned width, unsigned height, union util_color *uc); + + +#endif /* U_RECT_H */ diff --git a/mesalib/src/gallium/auxiliary/util/u_resource.c b/mesalib/src/gallium/auxiliary/util/u_resource.c index 7efedef07..50a7cd4d5 100644 --- a/mesalib/src/gallium/auxiliary/util/u_resource.c +++ b/mesalib/src/gallium/auxiliary/util/u_resource.c @@ -1,88 +1,88 @@ - - -#include "util/u_inlines.h" -#include "util/u_transfer.h" - -static INLINE struct u_resource * -u_resource( struct pipe_resource *res ) -{ - return (struct u_resource *)res; -} - -boolean u_resource_get_handle_vtbl(struct pipe_screen *screen, - struct pipe_resource *resource, - struct winsys_handle *handle) -{ - struct u_resource *ur = u_resource(resource); - return ur->vtbl->resource_get_handle(screen, resource, handle); -} - -void u_resource_destroy_vtbl(struct pipe_screen *screen, - struct pipe_resource *resource) -{ - struct u_resource *ur = u_resource(resource); - ur->vtbl->resource_destroy(screen, resource); -} - -struct pipe_transfer *u_get_transfer_vtbl(struct pipe_context *context, - struct pipe_resource *resource, - unsigned level, - unsigned usage, - const struct pipe_box *box) -{ - struct u_resource *ur = u_resource(resource); - return ur->vtbl->get_transfer(context, resource, level, usage, box); -} - -void u_transfer_destroy_vtbl(struct pipe_context *pipe, - struct pipe_transfer *transfer) -{ - struct u_resource *ur = u_resource(transfer->resource); - ur->vtbl->transfer_destroy(pipe, transfer); -} - -void *u_transfer_map_vtbl( struct pipe_context *pipe, - struct pipe_transfer *transfer ) -{ - struct u_resource *ur = u_resource(transfer->resource); - return ur->vtbl->transfer_map(pipe, transfer); -} - -void u_transfer_flush_region_vtbl( struct pipe_context *pipe, - struct pipe_transfer *transfer, - const struct pipe_box *box) -{ - struct u_resource *ur = u_resource(transfer->resource); - ur->vtbl->transfer_flush_region(pipe, transfer, box); -} - -void u_transfer_unmap_vtbl( struct pipe_context *pipe, - struct pipe_transfer *transfer ) -{ - struct u_resource *ur = u_resource(transfer->resource); - ur->vtbl->transfer_unmap(pipe, transfer); -} - -void u_transfer_inline_write_vtbl( struct pipe_context *pipe, - struct pipe_resource *resource, - unsigned level, - unsigned usage, - const struct pipe_box *box, - const void *data, - unsigned stride, - unsigned layer_stride) -{ - struct u_resource *ur = u_resource(resource); - ur->vtbl->transfer_inline_write(pipe, - resource, - level, - usage, - box, - data, - stride, - layer_stride); -} - - - - + + +#include "util/u_inlines.h" +#include "util/u_transfer.h" + +static INLINE struct u_resource * +u_resource( struct pipe_resource *res ) +{ + return (struct u_resource *)res; +} + +boolean u_resource_get_handle_vtbl(struct pipe_screen *screen, + struct pipe_resource *resource, + struct winsys_handle *handle) +{ + struct u_resource *ur = u_resource(resource); + return ur->vtbl->resource_get_handle(screen, resource, handle); +} + +void u_resource_destroy_vtbl(struct pipe_screen *screen, + struct pipe_resource *resource) +{ + struct u_resource *ur = u_resource(resource); + ur->vtbl->resource_destroy(screen, resource); +} + +struct pipe_transfer *u_get_transfer_vtbl(struct pipe_context *context, + struct pipe_resource *resource, + unsigned level, + unsigned usage, + const struct pipe_box *box) +{ + struct u_resource *ur = u_resource(resource); + return ur->vtbl->get_transfer(context, resource, level, usage, box); +} + +void u_transfer_destroy_vtbl(struct pipe_context *pipe, + struct pipe_transfer *transfer) +{ + struct u_resource *ur = u_resource(transfer->resource); + ur->vtbl->transfer_destroy(pipe, transfer); +} + +void *u_transfer_map_vtbl( struct pipe_context *pipe, + struct pipe_transfer *transfer ) +{ + struct u_resource *ur = u_resource(transfer->resource); + return ur->vtbl->transfer_map(pipe, transfer); +} + +void u_transfer_flush_region_vtbl( struct pipe_context *pipe, + struct pipe_transfer *transfer, + const struct pipe_box *box) +{ + struct u_resource *ur = u_resource(transfer->resource); + ur->vtbl->transfer_flush_region(pipe, transfer, box); +} + +void u_transfer_unmap_vtbl( struct pipe_context *pipe, + struct pipe_transfer *transfer ) +{ + struct u_resource *ur = u_resource(transfer->resource); + ur->vtbl->transfer_unmap(pipe, transfer); +} + +void u_transfer_inline_write_vtbl( struct pipe_context *pipe, + struct pipe_resource *resource, + unsigned level, + unsigned usage, + const struct pipe_box *box, + const void *data, + unsigned stride, + unsigned layer_stride) +{ + struct u_resource *ur = u_resource(resource); + ur->vtbl->transfer_inline_write(pipe, + resource, + level, + usage, + box, + data, + stride, + layer_stride); +} + + + + diff --git a/mesalib/src/gallium/auxiliary/util/u_ringbuffer.c b/mesalib/src/gallium/auxiliary/util/u_ringbuffer.c index ad4066aa1..648b105b1 100644 --- a/mesalib/src/gallium/auxiliary/util/u_ringbuffer.c +++ b/mesalib/src/gallium/auxiliary/util/u_ringbuffer.c @@ -1,160 +1,160 @@ - -#include "os/os_thread.h" -#include "pipe/p_defines.h" -#include "util/u_ringbuffer.h" -#include "util/u_math.h" -#include "util/u_memory.h" - -/* Generic ringbuffer: - */ -struct util_ringbuffer -{ - struct util_packet *buf; - unsigned mask; - - /* Can this be done with atomic variables?? - */ - unsigned head; - unsigned tail; - pipe_condvar change; - pipe_mutex mutex; -}; - - -struct util_ringbuffer *util_ringbuffer_create( unsigned dwords ) -{ - struct util_ringbuffer *ring = CALLOC_STRUCT(util_ringbuffer); - if (ring == NULL) - return NULL; - - assert(util_is_power_of_two(dwords)); - - ring->buf = MALLOC( dwords * sizeof(unsigned) ); - if (ring->buf == NULL) - goto fail; - - ring->mask = dwords - 1; - - pipe_condvar_init(ring->change); - pipe_mutex_init(ring->mutex); - return ring; - -fail: - FREE(ring->buf); - FREE(ring); - return NULL; -} - -void util_ringbuffer_destroy( struct util_ringbuffer *ring ) -{ - pipe_condvar_destroy(ring->change); - pipe_mutex_destroy(ring->mutex); - FREE(ring->buf); - FREE(ring); -} - -/** - * Return number of free entries in the ring - */ -static INLINE unsigned util_ringbuffer_space( const struct util_ringbuffer *ring ) -{ - return (ring->tail - (ring->head + 1)) & ring->mask; -} - -/** - * Is the ring buffer empty? - */ -static INLINE boolean util_ringbuffer_empty( const struct util_ringbuffer *ring ) -{ - return util_ringbuffer_space(ring) == ring->mask; -} - -void util_ringbuffer_enqueue( struct util_ringbuffer *ring, - const struct util_packet *packet ) -{ - unsigned i; - - /* XXX: over-reliance on mutexes, etc: - */ - pipe_mutex_lock(ring->mutex); - - /* make sure we don't request an impossible amount of space - */ - assert(packet->dwords <= ring->mask); - - /* Wait for free space: - */ - while (util_ringbuffer_space(ring) < packet->dwords) - pipe_condvar_wait(ring->change, ring->mutex); - - /* Copy data to ring: - */ - for (i = 0; i < packet->dwords; i++) { - - /* Copy all dwords of the packet. Note we're abusing the - * typesystem a little - we're being passed a pointer to - * something, but probably not an array of packet structs: - */ - ring->buf[ring->head] = packet[i]; - ring->head++; - ring->head &= ring->mask; - } - - /* Signal change: - */ - pipe_condvar_signal(ring->change); - pipe_mutex_unlock(ring->mutex); -} - -enum pipe_error util_ringbuffer_dequeue( struct util_ringbuffer *ring, - struct util_packet *packet, - unsigned max_dwords, - boolean wait ) -{ - const struct util_packet *ring_packet; - unsigned i; - int ret = PIPE_OK; - - /* XXX: over-reliance on mutexes, etc: - */ - pipe_mutex_lock(ring->mutex); - - /* Get next ring entry: - */ - if (wait) { - while (util_ringbuffer_empty(ring)) - pipe_condvar_wait(ring->change, ring->mutex); - } - else { - if (util_ringbuffer_empty(ring)) { - ret = PIPE_ERROR_OUT_OF_MEMORY; - goto out; - } - } - - ring_packet = &ring->buf[ring->tail]; - - /* Both of these are considered bugs. Raise an assert on debug builds. - */ - if (ring_packet->dwords > ring->mask + 1 - util_ringbuffer_space(ring) || - ring_packet->dwords > max_dwords) { - assert(0); - ret = PIPE_ERROR_BAD_INPUT; - goto out; - } - - /* Copy data from ring: - */ - for (i = 0; i < ring_packet->dwords; i++) { - packet[i] = ring->buf[ring->tail]; - ring->tail++; - ring->tail &= ring->mask; - } - -out: - /* Signal change: - */ - pipe_condvar_signal(ring->change); - pipe_mutex_unlock(ring->mutex); - return ret; -} + +#include "os/os_thread.h" +#include "pipe/p_defines.h" +#include "util/u_ringbuffer.h" +#include "util/u_math.h" +#include "util/u_memory.h" + +/* Generic ringbuffer: + */ +struct util_ringbuffer +{ + struct util_packet *buf; + unsigned mask; + + /* Can this be done with atomic variables?? + */ + unsigned head; + unsigned tail; + pipe_condvar change; + pipe_mutex mutex; +}; + + +struct util_ringbuffer *util_ringbuffer_create( unsigned dwords ) +{ + struct util_ringbuffer *ring = CALLOC_STRUCT(util_ringbuffer); + if (ring == NULL) + return NULL; + + assert(util_is_power_of_two(dwords)); + + ring->buf = MALLOC( dwords * sizeof(unsigned) ); + if (ring->buf == NULL) + goto fail; + + ring->mask = dwords - 1; + + pipe_condvar_init(ring->change); + pipe_mutex_init(ring->mutex); + return ring; + +fail: + FREE(ring->buf); + FREE(ring); + return NULL; +} + +void util_ringbuffer_destroy( struct util_ringbuffer *ring ) +{ + pipe_condvar_destroy(ring->change); + pipe_mutex_destroy(ring->mutex); + FREE(ring->buf); + FREE(ring); +} + +/** + * Return number of free entries in the ring + */ +static INLINE unsigned util_ringbuffer_space( const struct util_ringbuffer *ring ) +{ + return (ring->tail - (ring->head + 1)) & ring->mask; +} + +/** + * Is the ring buffer empty? + */ +static INLINE boolean util_ringbuffer_empty( const struct util_ringbuffer *ring ) +{ + return util_ringbuffer_space(ring) == ring->mask; +} + +void util_ringbuffer_enqueue( struct util_ringbuffer *ring, + const struct util_packet *packet ) +{ + unsigned i; + + /* XXX: over-reliance on mutexes, etc: + */ + pipe_mutex_lock(ring->mutex); + + /* make sure we don't request an impossible amount of space + */ + assert(packet->dwords <= ring->mask); + + /* Wait for free space: + */ + while (util_ringbuffer_space(ring) < packet->dwords) + pipe_condvar_wait(ring->change, ring->mutex); + + /* Copy data to ring: + */ + for (i = 0; i < packet->dwords; i++) { + + /* Copy all dwords of the packet. Note we're abusing the + * typesystem a little - we're being passed a pointer to + * something, but probably not an array of packet structs: + */ + ring->buf[ring->head] = packet[i]; + ring->head++; + ring->head &= ring->mask; + } + + /* Signal change: + */ + pipe_condvar_signal(ring->change); + pipe_mutex_unlock(ring->mutex); +} + +enum pipe_error util_ringbuffer_dequeue( struct util_ringbuffer *ring, + struct util_packet *packet, + unsigned max_dwords, + boolean wait ) +{ + const struct util_packet *ring_packet; + unsigned i; + int ret = PIPE_OK; + + /* XXX: over-reliance on mutexes, etc: + */ + pipe_mutex_lock(ring->mutex); + + /* Get next ring entry: + */ + if (wait) { + while (util_ringbuffer_empty(ring)) + pipe_condvar_wait(ring->change, ring->mutex); + } + else { + if (util_ringbuffer_empty(ring)) { + ret = PIPE_ERROR_OUT_OF_MEMORY; + goto out; + } + } + + ring_packet = &ring->buf[ring->tail]; + + /* Both of these are considered bugs. Raise an assert on debug builds. + */ + if (ring_packet->dwords > ring->mask + 1 - util_ringbuffer_space(ring) || + ring_packet->dwords > max_dwords) { + assert(0); + ret = PIPE_ERROR_BAD_INPUT; + goto out; + } + + /* Copy data from ring: + */ + for (i = 0; i < ring_packet->dwords; i++) { + packet[i] = ring->buf[ring->tail]; + ring->tail++; + ring->tail &= ring->mask; + } + +out: + /* Signal change: + */ + pipe_condvar_signal(ring->change); + pipe_mutex_unlock(ring->mutex); + return ret; +} diff --git a/mesalib/src/gallium/auxiliary/util/u_ringbuffer.h b/mesalib/src/gallium/auxiliary/util/u_ringbuffer.h index 177199e94..85f0ad6c1 100644 --- a/mesalib/src/gallium/auxiliary/util/u_ringbuffer.h +++ b/mesalib/src/gallium/auxiliary/util/u_ringbuffer.h @@ -1,29 +1,29 @@ - -#ifndef UTIL_RINGBUFFER_H -#define UTIL_RINGBUFFER_H - -#include "pipe/p_compiler.h" -#include "pipe/p_defines.h" /* only for pipe_error! */ - -/* Generic header - */ -struct util_packet { - unsigned dwords:8; - unsigned data24:24; -}; - -struct util_ringbuffer; - -struct util_ringbuffer *util_ringbuffer_create( unsigned dwords ); - -void util_ringbuffer_destroy( struct util_ringbuffer *ring ); - -void util_ringbuffer_enqueue( struct util_ringbuffer *ring, - const struct util_packet *packet ); - -enum pipe_error util_ringbuffer_dequeue( struct util_ringbuffer *ring, - struct util_packet *packet, - unsigned max_dwords, - boolean wait ); - -#endif + +#ifndef UTIL_RINGBUFFER_H +#define UTIL_RINGBUFFER_H + +#include "pipe/p_compiler.h" +#include "pipe/p_defines.h" /* only for pipe_error! */ + +/* Generic header + */ +struct util_packet { + unsigned dwords:8; + unsigned data24:24; +}; + +struct util_ringbuffer; + +struct util_ringbuffer *util_ringbuffer_create( unsigned dwords ); + +void util_ringbuffer_destroy( struct util_ringbuffer *ring ); + +void util_ringbuffer_enqueue( struct util_ringbuffer *ring, + const struct util_packet *packet ); + +enum pipe_error util_ringbuffer_dequeue( struct util_ringbuffer *ring, + struct util_packet *packet, + unsigned max_dwords, + boolean wait ); + +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_sampler.h b/mesalib/src/gallium/auxiliary/util/u_sampler.h index c7dc03c2f..f3dad7417 100644 --- a/mesalib/src/gallium/auxiliary/util/u_sampler.h +++ b/mesalib/src/gallium/auxiliary/util/u_sampler.h @@ -1,57 +1,57 @@ -/************************************************************************** - * - * Copyright 2010 VMware, 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 VMWARE 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 U_SAMPLER_H -#define U_SAMPLER_H - - -#include "pipe/p_defines.h" -#include "pipe/p_format.h" -#include "pipe/p_state.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -void -u_sampler_view_default_template(struct pipe_sampler_view *view, - const struct pipe_resource *texture, - enum pipe_format format); - -void -u_sampler_view_default_dx9_template(struct pipe_sampler_view *view, - const struct pipe_resource *texture, - enum pipe_format format); - - -#ifdef __cplusplus -} /* extern "C" { */ -#endif - -#endif /* U_SAMPLER_H */ +/************************************************************************** + * + * Copyright 2010 VMware, 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 VMWARE 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 U_SAMPLER_H +#define U_SAMPLER_H + + +#include "pipe/p_defines.h" +#include "pipe/p_format.h" +#include "pipe/p_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +void +u_sampler_view_default_template(struct pipe_sampler_view *view, + const struct pipe_resource *texture, + enum pipe_format format); + +void +u_sampler_view_default_dx9_template(struct pipe_sampler_view *view, + const struct pipe_resource *texture, + enum pipe_format format); + + +#ifdef __cplusplus +} /* extern "C" { */ +#endif + +#endif /* U_SAMPLER_H */ diff --git a/mesalib/src/gallium/auxiliary/util/u_simple_list.h b/mesalib/src/gallium/auxiliary/util/u_simple_list.h index e8d12cced..fe5977137 100644 --- a/mesalib/src/gallium/auxiliary/util/u_simple_list.h +++ b/mesalib/src/gallium/auxiliary/util/u_simple_list.h @@ -1,199 +1,199 @@ -/** - * \file simple_list.h - * Simple macros for type-safe, intrusive lists. - * - * Intended to work with a list sentinal which is created as an empty - * list. Insert & delete are O(1). - * - * \author - * (C) 1997, Keith Whitwell - */ - -/* - * 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 _U_SIMPLE_LIST_H_ -#define _U_SIMPLE_LIST_H_ - -/** - * Remove an element from list. - * - * \param elem element to remove. - */ -#define remove_from_list(elem) \ -do { \ - (elem)->next->prev = (elem)->prev; \ - (elem)->prev->next = (elem)->next; \ - (elem)->next = elem; \ - (elem)->prev = elem; \ -} while (0) - -/** - * Insert an element to the list head. - * - * \param list list. - * \param elem element to insert. - */ -#define insert_at_head(list, elem) \ -do { \ - (elem)->prev = list; \ - (elem)->next = (list)->next; \ - (list)->next->prev = elem; \ - (list)->next = elem; \ -} while(0) - -/** - * Insert an element to the list tail. - * - * \param list list. - * \param elem element to insert. - */ -#define insert_at_tail(list, elem) \ -do { \ - (elem)->next = list; \ - (elem)->prev = (list)->prev; \ - (list)->prev->next = elem; \ - (list)->prev = elem; \ -} while(0) - -/** - * Move an element to the list head. - * - * \param list list. - * \param elem element to move. - */ -#define move_to_head(list, elem) \ -do { \ - remove_from_list(elem); \ - insert_at_head(list, elem); \ -} while (0) - -/** - * Move an element to the list tail. - * - * \param list list. - * \param elem element to move. - */ -#define move_to_tail(list, elem) \ -do { \ - remove_from_list(elem); \ - insert_at_tail(list, elem); \ -} while (0) - -/** - * Make a empty list empty. - * - * \param sentinal list (sentinal element). - */ -#define make_empty_list(sentinal) \ -do { \ - (sentinal)->next = sentinal; \ - (sentinal)->prev = sentinal; \ -} while (0) - -/** - * Get list first element. - * - * \param list list. - * - * \return pointer to first element. - */ -#define first_elem(list) ((list)->next) - -/** - * Get list last element. - * - * \param list list. - * - * \return pointer to last element. - */ -#define last_elem(list) ((list)->prev) - -/** - * Get next element. - * - * \param elem element. - * - * \return pointer to next element. - */ -#define next_elem(elem) ((elem)->next) - -/** - * Get previous element. - * - * \param elem element. - * - * \return pointer to previous element. - */ -#define prev_elem(elem) ((elem)->prev) - -/** - * Test whether element is at end of the list. - * - * \param list list. - * \param elem element. - * - * \return non-zero if element is at end of list, or zero otherwise. - */ -#define at_end(list, elem) ((elem) == (list)) - -/** - * Test if a list is empty. - * - * \param list list. - * - * \return non-zero if list empty, or zero otherwise. - */ -#define is_empty_list(list) ((list)->next == (list)) - -/** - * Walk through the elements of a list. - * - * \param ptr pointer to the current element. - * \param list list. - * - * \note It should be followed by a { } block or a single statement, as in a \c - * for loop. - */ -#define foreach(ptr, list) \ - for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next ) - -/** - * Walk through the elements of a list. - * - * Same as #foreach but lets you unlink the current value during a list - * traversal. Useful for freeing a list, element by element. - * - * \param ptr pointer to the current element. - * \param t temporary pointer. - * \param list list. - * - * \note It should be followed by a { } block or a single statement, as in a \c - * for loop. - */ -#define foreach_s(ptr, t, list) \ - for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next) - -#endif /* _U_SIMPLE_LIST_H_ */ +/** + * \file simple_list.h + * Simple macros for type-safe, intrusive lists. + * + * Intended to work with a list sentinal which is created as an empty + * list. Insert & delete are O(1). + * + * \author + * (C) 1997, Keith Whitwell + */ + +/* + * 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 _U_SIMPLE_LIST_H_ +#define _U_SIMPLE_LIST_H_ + +/** + * Remove an element from list. + * + * \param elem element to remove. + */ +#define remove_from_list(elem) \ +do { \ + (elem)->next->prev = (elem)->prev; \ + (elem)->prev->next = (elem)->next; \ + (elem)->next = elem; \ + (elem)->prev = elem; \ +} while (0) + +/** + * Insert an element to the list head. + * + * \param list list. + * \param elem element to insert. + */ +#define insert_at_head(list, elem) \ +do { \ + (elem)->prev = list; \ + (elem)->next = (list)->next; \ + (list)->next->prev = elem; \ + (list)->next = elem; \ +} while(0) + +/** + * Insert an element to the list tail. + * + * \param list list. + * \param elem element to insert. + */ +#define insert_at_tail(list, elem) \ +do { \ + (elem)->next = list; \ + (elem)->prev = (list)->prev; \ + (list)->prev->next = elem; \ + (list)->prev = elem; \ +} while(0) + +/** + * Move an element to the list head. + * + * \param list list. + * \param elem element to move. + */ +#define move_to_head(list, elem) \ +do { \ + remove_from_list(elem); \ + insert_at_head(list, elem); \ +} while (0) + +/** + * Move an element to the list tail. + * + * \param list list. + * \param elem element to move. + */ +#define move_to_tail(list, elem) \ +do { \ + remove_from_list(elem); \ + insert_at_tail(list, elem); \ +} while (0) + +/** + * Make a empty list empty. + * + * \param sentinal list (sentinal element). + */ +#define make_empty_list(sentinal) \ +do { \ + (sentinal)->next = sentinal; \ + (sentinal)->prev = sentinal; \ +} while (0) + +/** + * Get list first element. + * + * \param list list. + * + * \return pointer to first element. + */ +#define first_elem(list) ((list)->next) + +/** + * Get list last element. + * + * \param list list. + * + * \return pointer to last element. + */ +#define last_elem(list) ((list)->prev) + +/** + * Get next element. + * + * \param elem element. + * + * \return pointer to next element. + */ +#define next_elem(elem) ((elem)->next) + +/** + * Get previous element. + * + * \param elem element. + * + * \return pointer to previous element. + */ +#define prev_elem(elem) ((elem)->prev) + +/** + * Test whether element is at end of the list. + * + * \param list list. + * \param elem element. + * + * \return non-zero if element is at end of list, or zero otherwise. + */ +#define at_end(list, elem) ((elem) == (list)) + +/** + * Test if a list is empty. + * + * \param list list. + * + * \return non-zero if list empty, or zero otherwise. + */ +#define is_empty_list(list) ((list)->next == (list)) + +/** + * Walk through the elements of a list. + * + * \param ptr pointer to the current element. + * \param list list. + * + * \note It should be followed by a { } block or a single statement, as in a \c + * for loop. + */ +#define foreach(ptr, list) \ + for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next ) + +/** + * Walk through the elements of a list. + * + * Same as #foreach but lets you unlink the current value during a list + * traversal. Useful for freeing a list, element by element. + * + * \param ptr pointer to the current element. + * \param t temporary pointer. + * \param list list. + * + * \note It should be followed by a { } block or a single statement, as in a \c + * for loop. + */ +#define foreach_s(ptr, t, list) \ + for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next) + +#endif /* _U_SIMPLE_LIST_H_ */ diff --git a/mesalib/src/gallium/auxiliary/util/u_split_prim.h b/mesalib/src/gallium/auxiliary/util/u_split_prim.h index 9c83d6461..7f80fc127 100644 --- a/mesalib/src/gallium/auxiliary/util/u_split_prim.h +++ b/mesalib/src/gallium/auxiliary/util/u_split_prim.h @@ -1,114 +1,114 @@ -/* Originally written by Ben Skeggs for the nv50 driver*/ - -#ifndef U_SPLIT_PRIM_H -#define U_SPLIT_PRIM_H - -#include "pipe/p_defines.h" -#include "pipe/p_compiler.h" - -#include "util/u_debug.h" - -struct util_split_prim { - void *priv; - void (*emit)(void *priv, unsigned start, unsigned count); - void (*edge)(void *priv, boolean enabled); - - unsigned mode; - unsigned start; - unsigned p_start; - unsigned p_end; - - uint repeat_first:1; - uint close_first:1; - uint edgeflag_off:1; -}; - -static INLINE void -util_split_prim_init(struct util_split_prim *s, - unsigned mode, unsigned start, unsigned count) -{ - if (mode == PIPE_PRIM_LINE_LOOP) { - s->mode = PIPE_PRIM_LINE_STRIP; - s->close_first = 1; - } else { - s->mode = mode; - s->close_first = 0; - } - s->start = start; - s->p_start = start; - s->p_end = start + count; - s->edgeflag_off = 0; - s->repeat_first = 0; -} - -static INLINE boolean -util_split_prim_next(struct util_split_prim *s, unsigned max_verts) -{ - int repeat = 0; - - if (s->repeat_first) { - s->emit(s->priv, s->start, 1); - max_verts--; - if (s->edgeflag_off) { - s->edge(s->priv, TRUE); - s->edgeflag_off = FALSE; - } - } - - if ((s->p_end - s->p_start) + s->close_first <= max_verts) { - s->emit(s->priv, s->p_start, s->p_end - s->p_start); - if (s->close_first) - s->emit(s->priv, s->start, 1); - return TRUE; - } - - switch (s->mode) { - case PIPE_PRIM_LINES: - max_verts &= ~1; - break; - case PIPE_PRIM_LINE_STRIP: - repeat = 1; - break; - case PIPE_PRIM_POLYGON: - max_verts--; - s->emit(s->priv, s->p_start, max_verts); - s->edge(s->priv, FALSE); - s->emit(s->priv, s->p_start + max_verts, 1); - s->p_start += max_verts; - s->repeat_first = TRUE; - s->edgeflag_off = TRUE; - return FALSE; - case PIPE_PRIM_TRIANGLES: - max_verts = max_verts - (max_verts % 3); - break; - case PIPE_PRIM_TRIANGLE_STRIP: - /* to ensure winding stays correct, always split - * on an even number of generated triangles - */ - max_verts = max_verts & ~1; - repeat = 2; - break; - case PIPE_PRIM_TRIANGLE_FAN: - s->repeat_first = TRUE; - repeat = 1; - break; - case PIPE_PRIM_QUADS: - max_verts &= ~3; - break; - case PIPE_PRIM_QUAD_STRIP: - max_verts &= ~1; - repeat = 2; - break; - case PIPE_PRIM_POINTS: - break; - default: - /* TODO: implement adjacency primitives */ - assert(0); - } - - s->emit (s->priv, s->p_start, max_verts); - s->p_start += (max_verts - repeat); - return FALSE; -} - -#endif /* U_SPLIT_PRIM_H */ +/* Originally written by Ben Skeggs for the nv50 driver*/ + +#ifndef U_SPLIT_PRIM_H +#define U_SPLIT_PRIM_H + +#include "pipe/p_defines.h" +#include "pipe/p_compiler.h" + +#include "util/u_debug.h" + +struct util_split_prim { + void *priv; + void (*emit)(void *priv, unsigned start, unsigned count); + void (*edge)(void *priv, boolean enabled); + + unsigned mode; + unsigned start; + unsigned p_start; + unsigned p_end; + + uint repeat_first:1; + uint close_first:1; + uint edgeflag_off:1; +}; + +static INLINE void +util_split_prim_init(struct util_split_prim *s, + unsigned mode, unsigned start, unsigned count) +{ + if (mode == PIPE_PRIM_LINE_LOOP) { + s->mode = PIPE_PRIM_LINE_STRIP; + s->close_first = 1; + } else { + s->mode = mode; + s->close_first = 0; + } + s->start = start; + s->p_start = start; + s->p_end = start + count; + s->edgeflag_off = 0; + s->repeat_first = 0; +} + +static INLINE boolean +util_split_prim_next(struct util_split_prim *s, unsigned max_verts) +{ + int repeat = 0; + + if (s->repeat_first) { + s->emit(s->priv, s->start, 1); + max_verts--; + if (s->edgeflag_off) { + s->edge(s->priv, TRUE); + s->edgeflag_off = FALSE; + } + } + + if ((s->p_end - s->p_start) + s->close_first <= max_verts) { + s->emit(s->priv, s->p_start, s->p_end - s->p_start); + if (s->close_first) + s->emit(s->priv, s->start, 1); + return TRUE; + } + + switch (s->mode) { + case PIPE_PRIM_LINES: + max_verts &= ~1; + break; + case PIPE_PRIM_LINE_STRIP: + repeat = 1; + break; + case PIPE_PRIM_POLYGON: + max_verts--; + s->emit(s->priv, s->p_start, max_verts); + s->edge(s->priv, FALSE); + s->emit(s->priv, s->p_start + max_verts, 1); + s->p_start += max_verts; + s->repeat_first = TRUE; + s->edgeflag_off = TRUE; + return FALSE; + case PIPE_PRIM_TRIANGLES: + max_verts = max_verts - (max_verts % 3); + break; + case PIPE_PRIM_TRIANGLE_STRIP: + /* to ensure winding stays correct, always split + * on an even number of generated triangles + */ + max_verts = max_verts & ~1; + repeat = 2; + break; + case PIPE_PRIM_TRIANGLE_FAN: + s->repeat_first = TRUE; + repeat = 1; + break; + case PIPE_PRIM_QUADS: + max_verts &= ~3; + break; + case PIPE_PRIM_QUAD_STRIP: + max_verts &= ~1; + repeat = 2; + break; + case PIPE_PRIM_POINTS: + break; + default: + /* TODO: implement adjacency primitives */ + assert(0); + } + + s->emit (s->priv, s->p_start, max_verts); + s->p_start += (max_verts - repeat); + return FALSE; +} + +#endif /* U_SPLIT_PRIM_H */ diff --git a/mesalib/src/gallium/auxiliary/util/u_sse.h b/mesalib/src/gallium/auxiliary/util/u_sse.h index d000c0fd7..1df6c8726 100644 --- a/mesalib/src/gallium/auxiliary/util/u_sse.h +++ b/mesalib/src/gallium/auxiliary/util/u_sse.h @@ -1,255 +1,255 @@ -/************************************************************************** - * - * Copyright 2008 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. - * - **************************************************************************/ - -/** - * @file - * SSE intrinsics portability header. - * - * Although the SSE intrinsics are support by all modern x86 and x86-64 - * compilers, there are some intrisincs missing in some implementations - * (especially older MSVC versions). This header abstracts that away. - */ - -#ifndef U_SSE_H_ -#define U_SSE_H_ - -#include "pipe/p_config.h" - -#if defined(PIPE_ARCH_SSE) - -#include - - -/* MSVC before VC8 does not support the _mm_castxxx_yyy */ -#if defined(_MSC_VER) && _MSC_VER < 1500 - -union __declspec(align(16)) m128_types { - __m128 m128; - __m128i m128i; - __m128d m128d; -}; - -static __inline __m128 -_mm_castsi128_ps(__m128i a) -{ - union m128_types u; - u.m128i = a; - return u.m128; -} - -static __inline __m128i -_mm_castps_si128(__m128 a) -{ - union m128_types u; - u.m128 = a; - return u.m128i; -} - -#endif /* defined(_MSC_VER) && _MSC_VER < 1500 */ - -union m128i { - __m128i m; - ubyte ub[16]; - ushort us[8]; - uint ui[4]; -}; - -static INLINE void u_print_epi8(const char *name, __m128i r) -{ - union { __m128i m; ubyte ub[16]; } u; - u.m = r; - - debug_printf("%s: " - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x/" - "%02x\n", - name, - u.ub[0], u.ub[1], u.ub[2], u.ub[3], - u.ub[4], u.ub[5], u.ub[6], u.ub[7], - u.ub[8], u.ub[9], u.ub[10], u.ub[11], - u.ub[12], u.ub[13], u.ub[14], u.ub[15]); -} - -static INLINE void u_print_epi16(const char *name, __m128i r) -{ - union { __m128i m; ushort us[8]; } u; - u.m = r; - - debug_printf("%s: " - "%04x/" - "%04x/" - "%04x/" - "%04x/" - "%04x/" - "%04x/" - "%04x/" - "%04x\n", - name, - u.us[0], u.us[1], u.us[2], u.us[3], - u.us[4], u.us[5], u.us[6], u.us[7]); -} - -static INLINE void u_print_epi32(const char *name, __m128i r) -{ - union { __m128i m; uint ui[4]; } u; - u.m = r; - - debug_printf("%s: " - "%08x/" - "%08x/" - "%08x/" - "%08x\n", - name, - u.ui[0], u.ui[1], u.ui[2], u.ui[3]); -} - -static INLINE void u_print_ps(const char *name, __m128 r) -{ - union { __m128 m; float f[4]; } u; - u.m = r; - - debug_printf("%s: " - "%f/" - "%f/" - "%f/" - "%f\n", - name, - u.f[0], u.f[1], u.f[2], u.f[3]); -} - - -#define U_DUMP_EPI32(a) u_print_epi32(#a, a) -#define U_DUMP_EPI16(a) u_print_epi16(#a, a) -#define U_DUMP_EPI8(a) u_print_epi8(#a, a) -#define U_DUMP_PS(a) u_print_ps(#a, a) - - - -#if defined(PIPE_ARCH_SSSE3) - -#include - -#else /* !PIPE_ARCH_SSSE3 */ - -/** - * Describe _mm_shuffle_epi8() with gcc extended inline assembly, for cases - * where -mssse3 is not supported/enabled. - * - * MSVC will never get in here as its intrinsics support do not rely on - * compiler command line options. - */ -static __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -_mm_shuffle_epi8(__m128i a, __m128i mask) -{ - __m128i result; - __asm__("pshufb %1, %0" - : "=x" (result) - : "xm" (mask), "0" (a)); - return result; -} - -#endif /* !PIPE_ARCH_SSSE3 */ - - - - -/* Provide an SSE2 implementation of _mm_mullo_epi32() in terms of - * _mm_mul_epu32(). - * - * I suspect this works fine for us because one of our operands is - * always positive, but not sure that this can be used for general - * signed integer multiplication. - * - * This seems close enough to the speed of SSE4 and the real - * _mm_mullo_epi32() intrinsic as to not justify adding an sse4 - * dependency at this point. - */ -static INLINE __m128i mm_mullo_epi32(const __m128i a, const __m128i b) -{ - __m128i a4 = _mm_srli_epi64(a, 32); /* shift by one dword */ - __m128i b4 = _mm_srli_epi64(b, 32); /* shift by one dword */ - __m128i ba = _mm_mul_epu32(b, a); /* multply dwords 0, 2 */ - __m128i b4a4 = _mm_mul_epu32(b4, a4); /* multiply dwords 1, 3 */ - - /* Interleave the results, either with shuffles or (slightly - * faster) direct bit operations: - */ -#if 0 - __m128i ba8 = _mm_shuffle_epi32(ba, 8); - __m128i b4a48 = _mm_shuffle_epi32(b4a4, 8); - __m128i result = _mm_unpacklo_epi32(ba8, b4a48); -#else - __m128i mask = _mm_setr_epi32(~0,0,~0,0); - __m128i ba_mask = _mm_and_si128(ba, mask); - __m128i b4a4_mask_shift = _mm_slli_epi64(b4a4, 32); - __m128i result = _mm_or_si128(ba_mask, b4a4_mask_shift); -#endif - - return result; -} - - -static INLINE void -transpose4_epi32(const __m128i * restrict a, - const __m128i * restrict b, - const __m128i * restrict c, - const __m128i * restrict d, - __m128i * restrict o, - __m128i * restrict p, - __m128i * restrict q, - __m128i * restrict r) -{ - __m128i t0 = _mm_unpacklo_epi32(*a, *b); - __m128i t1 = _mm_unpacklo_epi32(*c, *d); - __m128i t2 = _mm_unpackhi_epi32(*a, *b); - __m128i t3 = _mm_unpackhi_epi32(*c, *d); - - *o = _mm_unpacklo_epi64(t0, t1); - *p = _mm_unpackhi_epi64(t0, t1); - *q = _mm_unpacklo_epi64(t2, t3); - *r = _mm_unpackhi_epi64(t2, t3); -} - -#define SCALAR_EPI32(m, i) _mm_shuffle_epi32((m), _MM_SHUFFLE(i,i,i,i)) - - -#endif /* PIPE_ARCH_SSE */ - -#endif /* U_SSE_H_ */ +/************************************************************************** + * + * Copyright 2008 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. + * + **************************************************************************/ + +/** + * @file + * SSE intrinsics portability header. + * + * Although the SSE intrinsics are support by all modern x86 and x86-64 + * compilers, there are some intrisincs missing in some implementations + * (especially older MSVC versions). This header abstracts that away. + */ + +#ifndef U_SSE_H_ +#define U_SSE_H_ + +#include "pipe/p_config.h" + +#if defined(PIPE_ARCH_SSE) + +#include + + +/* MSVC before VC8 does not support the _mm_castxxx_yyy */ +#if defined(_MSC_VER) && _MSC_VER < 1500 + +union __declspec(align(16)) m128_types { + __m128 m128; + __m128i m128i; + __m128d m128d; +}; + +static __inline __m128 +_mm_castsi128_ps(__m128i a) +{ + union m128_types u; + u.m128i = a; + return u.m128; +} + +static __inline __m128i +_mm_castps_si128(__m128 a) +{ + union m128_types u; + u.m128 = a; + return u.m128i; +} + +#endif /* defined(_MSC_VER) && _MSC_VER < 1500 */ + +union m128i { + __m128i m; + ubyte ub[16]; + ushort us[8]; + uint ui[4]; +}; + +static INLINE void u_print_epi8(const char *name, __m128i r) +{ + union { __m128i m; ubyte ub[16]; } u; + u.m = r; + + debug_printf("%s: " + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x/" + "%02x\n", + name, + u.ub[0], u.ub[1], u.ub[2], u.ub[3], + u.ub[4], u.ub[5], u.ub[6], u.ub[7], + u.ub[8], u.ub[9], u.ub[10], u.ub[11], + u.ub[12], u.ub[13], u.ub[14], u.ub[15]); +} + +static INLINE void u_print_epi16(const char *name, __m128i r) +{ + union { __m128i m; ushort us[8]; } u; + u.m = r; + + debug_printf("%s: " + "%04x/" + "%04x/" + "%04x/" + "%04x/" + "%04x/" + "%04x/" + "%04x/" + "%04x\n", + name, + u.us[0], u.us[1], u.us[2], u.us[3], + u.us[4], u.us[5], u.us[6], u.us[7]); +} + +static INLINE void u_print_epi32(const char *name, __m128i r) +{ + union { __m128i m; uint ui[4]; } u; + u.m = r; + + debug_printf("%s: " + "%08x/" + "%08x/" + "%08x/" + "%08x\n", + name, + u.ui[0], u.ui[1], u.ui[2], u.ui[3]); +} + +static INLINE void u_print_ps(const char *name, __m128 r) +{ + union { __m128 m; float f[4]; } u; + u.m = r; + + debug_printf("%s: " + "%f/" + "%f/" + "%f/" + "%f\n", + name, + u.f[0], u.f[1], u.f[2], u.f[3]); +} + + +#define U_DUMP_EPI32(a) u_print_epi32(#a, a) +#define U_DUMP_EPI16(a) u_print_epi16(#a, a) +#define U_DUMP_EPI8(a) u_print_epi8(#a, a) +#define U_DUMP_PS(a) u_print_ps(#a, a) + + + +#if defined(PIPE_ARCH_SSSE3) + +#include + +#else /* !PIPE_ARCH_SSSE3 */ + +/** + * Describe _mm_shuffle_epi8() with gcc extended inline assembly, for cases + * where -mssse3 is not supported/enabled. + * + * MSVC will never get in here as its intrinsics support do not rely on + * compiler command line options. + */ +static __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_mm_shuffle_epi8(__m128i a, __m128i mask) +{ + __m128i result; + __asm__("pshufb %1, %0" + : "=x" (result) + : "xm" (mask), "0" (a)); + return result; +} + +#endif /* !PIPE_ARCH_SSSE3 */ + + + + +/* Provide an SSE2 implementation of _mm_mullo_epi32() in terms of + * _mm_mul_epu32(). + * + * I suspect this works fine for us because one of our operands is + * always positive, but not sure that this can be used for general + * signed integer multiplication. + * + * This seems close enough to the speed of SSE4 and the real + * _mm_mullo_epi32() intrinsic as to not justify adding an sse4 + * dependency at this point. + */ +static INLINE __m128i mm_mullo_epi32(const __m128i a, const __m128i b) +{ + __m128i a4 = _mm_srli_epi64(a, 32); /* shift by one dword */ + __m128i b4 = _mm_srli_epi64(b, 32); /* shift by one dword */ + __m128i ba = _mm_mul_epu32(b, a); /* multply dwords 0, 2 */ + __m128i b4a4 = _mm_mul_epu32(b4, a4); /* multiply dwords 1, 3 */ + + /* Interleave the results, either with shuffles or (slightly + * faster) direct bit operations: + */ +#if 0 + __m128i ba8 = _mm_shuffle_epi32(ba, 8); + __m128i b4a48 = _mm_shuffle_epi32(b4a4, 8); + __m128i result = _mm_unpacklo_epi32(ba8, b4a48); +#else + __m128i mask = _mm_setr_epi32(~0,0,~0,0); + __m128i ba_mask = _mm_and_si128(ba, mask); + __m128i b4a4_mask_shift = _mm_slli_epi64(b4a4, 32); + __m128i result = _mm_or_si128(ba_mask, b4a4_mask_shift); +#endif + + return result; +} + + +static INLINE void +transpose4_epi32(const __m128i * restrict a, + const __m128i * restrict b, + const __m128i * restrict c, + const __m128i * restrict d, + __m128i * restrict o, + __m128i * restrict p, + __m128i * restrict q, + __m128i * restrict r) +{ + __m128i t0 = _mm_unpacklo_epi32(*a, *b); + __m128i t1 = _mm_unpacklo_epi32(*c, *d); + __m128i t2 = _mm_unpackhi_epi32(*a, *b); + __m128i t3 = _mm_unpackhi_epi32(*c, *d); + + *o = _mm_unpacklo_epi64(t0, t1); + *p = _mm_unpackhi_epi64(t0, t1); + *q = _mm_unpacklo_epi64(t2, t3); + *r = _mm_unpackhi_epi64(t2, t3); +} + +#define SCALAR_EPI32(m, i) _mm_shuffle_epi32((m), _MM_SHUFFLE(i,i,i,i)) + + +#endif /* PIPE_ARCH_SSE */ + +#endif /* U_SSE_H_ */ diff --git a/mesalib/src/gallium/auxiliary/util/u_surfaces.c b/mesalib/src/gallium/auxiliary/util/u_surfaces.c index 9a42c9d29..b0cfec2a8 100644 --- a/mesalib/src/gallium/auxiliary/util/u_surfaces.c +++ b/mesalib/src/gallium/auxiliary/util/u_surfaces.c @@ -1,124 +1,124 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 "u_surfaces.h" -#include "util/u_hash_table.h" -#include "util/u_inlines.h" -#include "util/u_memory.h" - -boolean -util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, - struct pipe_context *ctx, struct pipe_resource *pt, - unsigned level, unsigned layer, unsigned flags, - struct pipe_surface **res) -{ - struct pipe_surface *ps; - - if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE) - { /* or 2D array */ - if(!us->u.hash) - us->u.hash = cso_hash_create(); - - ps = cso_hash_iter_data(cso_hash_find(us->u.hash, (layer << 8) | level)); - } - else - { - if(!us->u.array) - us->u.array = CALLOC(pt->last_level + 1, sizeof(struct pipe_surface *)); - ps = us->u.array[level]; - } - - if(ps && ps->context == ctx) - { - p_atomic_inc(&ps->reference.count); - *res = ps; - return FALSE; - } - - ps = (struct pipe_surface *)CALLOC(1, surface_struct_size); - if(!ps) - { - *res = NULL; - return FALSE; - } - - pipe_surface_init(ctx, ps, pt, level, layer, flags); - - if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE) - cso_hash_insert(us->u.hash, (layer << 8) | level, ps); - else - us->u.array[level] = ps; - - *res = ps; - return TRUE; -} - -void -util_surfaces_do_detach(struct util_surfaces *us, struct pipe_surface *ps) -{ - struct pipe_resource *pt = ps->texture; - if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE) - { /* or 2D array */ - cso_hash_erase(us->u.hash, cso_hash_find(us->u.hash, (ps->u.tex.first_layer << 8) | ps->u.tex.level)); - } - else - us->u.array[ps->u.tex.level] = 0; -} - -void -util_surfaces_destroy(struct util_surfaces *us, struct pipe_resource *pt, void (*destroy_surface) (struct pipe_surface *)) -{ - if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE) - { /* or 2D array */ - if(us->u.hash) - { - struct cso_hash_iter iter; - iter = cso_hash_first_node(us->u.hash); - while (!cso_hash_iter_is_null(iter)) { - destroy_surface(cso_hash_iter_data(iter)); - iter = cso_hash_iter_next(iter); - } - - cso_hash_delete(us->u.hash); - us->u.hash = NULL; - } - } - else - { - if(us->u.array) - { - unsigned i; - for(i = 0; i <= pt->last_level; ++i) - { - struct pipe_surface *ps = us->u.array[i]; - if(ps) - destroy_surface(ps); - } - FREE(us->u.array); - us->u.array = NULL; - } - } -} +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 "u_surfaces.h" +#include "util/u_hash_table.h" +#include "util/u_inlines.h" +#include "util/u_memory.h" + +boolean +util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, + struct pipe_context *ctx, struct pipe_resource *pt, + unsigned level, unsigned layer, unsigned flags, + struct pipe_surface **res) +{ + struct pipe_surface *ps; + + if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE) + { /* or 2D array */ + if(!us->u.hash) + us->u.hash = cso_hash_create(); + + ps = cso_hash_iter_data(cso_hash_find(us->u.hash, (layer << 8) | level)); + } + else + { + if(!us->u.array) + us->u.array = CALLOC(pt->last_level + 1, sizeof(struct pipe_surface *)); + ps = us->u.array[level]; + } + + if(ps && ps->context == ctx) + { + p_atomic_inc(&ps->reference.count); + *res = ps; + return FALSE; + } + + ps = (struct pipe_surface *)CALLOC(1, surface_struct_size); + if(!ps) + { + *res = NULL; + return FALSE; + } + + pipe_surface_init(ctx, ps, pt, level, layer, flags); + + if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE) + cso_hash_insert(us->u.hash, (layer << 8) | level, ps); + else + us->u.array[level] = ps; + + *res = ps; + return TRUE; +} + +void +util_surfaces_do_detach(struct util_surfaces *us, struct pipe_surface *ps) +{ + struct pipe_resource *pt = ps->texture; + if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE) + { /* or 2D array */ + cso_hash_erase(us->u.hash, cso_hash_find(us->u.hash, (ps->u.tex.first_layer << 8) | ps->u.tex.level)); + } + else + us->u.array[ps->u.tex.level] = 0; +} + +void +util_surfaces_destroy(struct util_surfaces *us, struct pipe_resource *pt, void (*destroy_surface) (struct pipe_surface *)) +{ + if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE) + { /* or 2D array */ + if(us->u.hash) + { + struct cso_hash_iter iter; + iter = cso_hash_first_node(us->u.hash); + while (!cso_hash_iter_is_null(iter)) { + destroy_surface(cso_hash_iter_data(iter)); + iter = cso_hash_iter_next(iter); + } + + cso_hash_delete(us->u.hash); + us->u.hash = NULL; + } + } + else + { + if(us->u.array) + { + unsigned i; + for(i = 0; i <= pt->last_level; ++i) + { + struct pipe_surface *ps = us->u.array[i]; + if(ps) + destroy_surface(ps); + } + FREE(us->u.array); + us->u.array = NULL; + } + } +} diff --git a/mesalib/src/gallium/auxiliary/util/u_surfaces.h b/mesalib/src/gallium/auxiliary/util/u_surfaces.h index 2402e8841..9581feda7 100644 --- a/mesalib/src/gallium/auxiliary/util/u_surfaces.h +++ b/mesalib/src/gallium/auxiliary/util/u_surfaces.h @@ -1,101 +1,101 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 U_SURFACES_H_ -#define U_SURFACES_H_ - -#include "pipe/p_compiler.h" -#include "pipe/p_state.h" -#include "util/u_atomic.h" -#include "cso_cache/cso_hash.h" - -struct util_surfaces -{ - union - { - struct cso_hash *hash; - struct pipe_surface **array; - void* pv; - } u; -}; - -/* Return value indicates if the pipe surface result is new */ -boolean -util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, - struct pipe_context *ctx, struct pipe_resource *pt, - unsigned level, unsigned layer, unsigned flags, - struct pipe_surface **res); - -/* fast inline path for the very common case */ -static INLINE boolean -util_surfaces_get(struct util_surfaces *us, unsigned surface_struct_size, - struct pipe_context *ctx, struct pipe_resource *pt, - unsigned level, unsigned layer, unsigned flags, - struct pipe_surface **res) -{ - if(likely((pt->target == PIPE_TEXTURE_2D || pt->target == PIPE_TEXTURE_RECT) && us->u.array)) - { - struct pipe_surface *ps = us->u.array[level]; - if(ps && ps->context == ctx) - { - p_atomic_inc(&ps->reference.count); - *res = ps; - return FALSE; - } - } - - return util_surfaces_do_get(us, surface_struct_size, ctx, pt, level, layer, flags, res); -} - -static INLINE struct pipe_surface * -util_surfaces_peek(struct util_surfaces *us, struct pipe_resource *pt, unsigned level, unsigned layer) -{ - if(!us->u.pv) - return 0; - - if(unlikely(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE)) - return cso_hash_iter_data(cso_hash_find(us->u.hash, (layer << 8) | level)); - else - return us->u.array[level]; -} - -void util_surfaces_do_detach(struct util_surfaces *us, struct pipe_surface *ps); - -static INLINE void -util_surfaces_detach(struct util_surfaces *us, struct pipe_surface *ps) -{ - if(likely(ps->texture->target == PIPE_TEXTURE_2D || ps->texture->target == PIPE_TEXTURE_RECT)) - { - us->u.array[ps->u.tex.level] = 0; - return; - } - - util_surfaces_do_detach(us, ps); -} - -void util_surfaces_destroy(struct util_surfaces *us, struct pipe_resource *pt, void (*destroy_surface) (struct pipe_surface *)); - -#endif +/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 U_SURFACES_H_ +#define U_SURFACES_H_ + +#include "pipe/p_compiler.h" +#include "pipe/p_state.h" +#include "util/u_atomic.h" +#include "cso_cache/cso_hash.h" + +struct util_surfaces +{ + union + { + struct cso_hash *hash; + struct pipe_surface **array; + void* pv; + } u; +}; + +/* Return value indicates if the pipe surface result is new */ +boolean +util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, + struct pipe_context *ctx, struct pipe_resource *pt, + unsigned level, unsigned layer, unsigned flags, + struct pipe_surface **res); + +/* fast inline path for the very common case */ +static INLINE boolean +util_surfaces_get(struct util_surfaces *us, unsigned surface_struct_size, + struct pipe_context *ctx, struct pipe_resource *pt, + unsigned level, unsigned layer, unsigned flags, + struct pipe_surface **res) +{ + if(likely((pt->target == PIPE_TEXTURE_2D || pt->target == PIPE_TEXTURE_RECT) && us->u.array)) + { + struct pipe_surface *ps = us->u.array[level]; + if(ps && ps->context == ctx) + { + p_atomic_inc(&ps->reference.count); + *res = ps; + return FALSE; + } + } + + return util_surfaces_do_get(us, surface_struct_size, ctx, pt, level, layer, flags, res); +} + +static INLINE struct pipe_surface * +util_surfaces_peek(struct util_surfaces *us, struct pipe_resource *pt, unsigned level, unsigned layer) +{ + if(!us->u.pv) + return 0; + + if(unlikely(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE)) + return cso_hash_iter_data(cso_hash_find(us->u.hash, (layer << 8) | level)); + else + return us->u.array[level]; +} + +void util_surfaces_do_detach(struct util_surfaces *us, struct pipe_surface *ps); + +static INLINE void +util_surfaces_detach(struct util_surfaces *us, struct pipe_surface *ps) +{ + if(likely(ps->texture->target == PIPE_TEXTURE_2D || ps->texture->target == PIPE_TEXTURE_RECT)) + { + us->u.array[ps->u.tex.level] = 0; + return; + } + + util_surfaces_do_detach(us, ps); +} + +void util_surfaces_destroy(struct util_surfaces *us, struct pipe_resource *pt, void (*destroy_surface) (struct pipe_surface *)); + +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_texture.c b/mesalib/src/gallium/auxiliary/util/u_texture.c index 1e72843f0..d97e57a79 100644 --- a/mesalib/src/gallium/auxiliary/util/u_texture.c +++ b/mesalib/src/gallium/auxiliary/util/u_texture.c @@ -1,103 +1,103 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * Copyright 2008 VMware, Inc. All rights reserved. - * Copyright 2009 Marek Olšák - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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. - * - **************************************************************************/ - -/** - * @file - * Texture mapping utility functions. - * - * @author Brian Paul - * Marek Olšák - */ - -#include "pipe/p_defines.h" - -#include "util/u_debug.h" -#include "util/u_texture.h" - -void util_map_texcoords2d_onto_cubemap(unsigned face, - const float *in_st, unsigned in_stride, - float *out_str, unsigned out_stride) -{ - int i; - float rx, ry, rz; - - /* loop over quad verts */ - for (i = 0; i < 4; i++) { - /* Compute sc = +/-scale and tc = +/-scale. - * Not +/-1 to avoid cube face selection ambiguity near the edges, - * though that can still sometimes happen with this scale factor... - */ - const float scale = 0.9999f; - const float sc = (2 * in_st[0] - 1) * scale; - const float tc = (2 * in_st[1] - 1) * scale; - - switch (face) { - case PIPE_TEX_FACE_POS_X: - rx = 1; - ry = -tc; - rz = -sc; - break; - case PIPE_TEX_FACE_NEG_X: - rx = -1; - ry = -tc; - rz = sc; - break; - case PIPE_TEX_FACE_POS_Y: - rx = sc; - ry = 1; - rz = tc; - break; - case PIPE_TEX_FACE_NEG_Y: - rx = sc; - ry = -1; - rz = -tc; - break; - case PIPE_TEX_FACE_POS_Z: - rx = sc; - ry = -tc; - rz = 1; - break; - case PIPE_TEX_FACE_NEG_Z: - rx = -sc; - ry = -tc; - rz = -1; - break; - default: - rx = ry = rz = 0; - assert(0); - } - - out_str[0] = rx; /*s*/ - out_str[1] = ry; /*t*/ - out_str[2] = rz; /*r*/ - - in_st += in_stride; - out_str += out_stride; - } -} +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * Copyright 2008 VMware, Inc. All rights reserved. + * Copyright 2009 Marek Olšák + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and 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. + * + **************************************************************************/ + +/** + * @file + * Texture mapping utility functions. + * + * @author Brian Paul + * Marek Olšák + */ + +#include "pipe/p_defines.h" + +#include "util/u_debug.h" +#include "util/u_texture.h" + +void util_map_texcoords2d_onto_cubemap(unsigned face, + const float *in_st, unsigned in_stride, + float *out_str, unsigned out_stride) +{ + int i; + float rx, ry, rz; + + /* loop over quad verts */ + for (i = 0; i < 4; i++) { + /* Compute sc = +/-scale and tc = +/-scale. + * Not +/-1 to avoid cube face selection ambiguity near the edges, + * though that can still sometimes happen with this scale factor... + */ + const float scale = 0.9999f; + const float sc = (2 * in_st[0] - 1) * scale; + const float tc = (2 * in_st[1] - 1) * scale; + + switch (face) { + case PIPE_TEX_FACE_POS_X: + rx = 1; + ry = -tc; + rz = -sc; + break; + case PIPE_TEX_FACE_NEG_X: + rx = -1; + ry = -tc; + rz = sc; + break; + case PIPE_TEX_FACE_POS_Y: + rx = sc; + ry = 1; + rz = tc; + break; + case PIPE_TEX_FACE_NEG_Y: + rx = sc; + ry = -1; + rz = -tc; + break; + case PIPE_TEX_FACE_POS_Z: + rx = sc; + ry = -tc; + rz = 1; + break; + case PIPE_TEX_FACE_NEG_Z: + rx = -sc; + ry = -tc; + rz = -1; + break; + default: + rx = ry = rz = 0; + assert(0); + } + + out_str[0] = rx; /*s*/ + out_str[1] = ry; /*t*/ + out_str[2] = rz; /*r*/ + + in_st += in_stride; + out_str += out_stride; + } +} diff --git a/mesalib/src/gallium/auxiliary/util/u_texture.h b/mesalib/src/gallium/auxiliary/util/u_texture.h index 3e03911ec..93b2f1e4c 100644 --- a/mesalib/src/gallium/auxiliary/util/u_texture.h +++ b/mesalib/src/gallium/auxiliary/util/u_texture.h @@ -1,54 +1,54 @@ -/************************************************************************** - * - * Copyright 2009 Marek Olšák - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 U_TEXTURE_H -#define U_TEXTURE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Convert 2D texture coordinates of 4 vertices into cubemap coordinates - * in the given face. - * Coordinates must be in the range [0,1]. - * - * \param face Cubemap face. - * \param in_st 4 pairs of 2D texture coordinates to convert. - * \param in_stride Stride of in_st in floats. - * \param out_str STR cubemap texture coordinates to compute. - * \param out_stride Stride of out_str in floats. - */ -void util_map_texcoords2d_onto_cubemap(unsigned face, - const float *in_st, unsigned in_stride, - float *out_str, unsigned out_stride); - - -#ifdef __cplusplus -} -#endif - -#endif +/************************************************************************** + * + * Copyright 2009 Marek Olšák + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and 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 U_TEXTURE_H +#define U_TEXTURE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Convert 2D texture coordinates of 4 vertices into cubemap coordinates + * in the given face. + * Coordinates must be in the range [0,1]. + * + * \param face Cubemap face. + * \param in_st 4 pairs of 2D texture coordinates to convert. + * \param in_stride Stride of in_st in floats. + * \param out_str STR cubemap texture coordinates to compute. + * \param out_stride Stride of out_str in floats. + */ +void util_map_texcoords2d_onto_cubemap(unsigned face, + const float *in_st, unsigned in_stride, + float *out_str, unsigned out_stride); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_time.h b/mesalib/src/gallium/auxiliary/util/u_time.h index a65cd59fe..15899c2c8 100644 --- a/mesalib/src/gallium/auxiliary/util/u_time.h +++ b/mesalib/src/gallium/auxiliary/util/u_time.h @@ -1,150 +1,150 @@ -/************************************************************************** - * - * Copyright 2008 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. - * - **************************************************************************/ - -/** - * @file - * OS independent time-manipulation functions. - * - * @author Jose Fonseca - */ - -#ifndef U_TIME_H_ -#define U_TIME_H_ - - -#include "pipe/p_config.h" - -#include "os/os_time.h" - -#include "pipe/p_compiler.h" - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Time abstraction. - * - * Do not access this structure directly. Use the provided function instead. - */ -struct util_time -{ - int64_t counter; -}; - - -PIPE_DEPRECATED -static INLINE void -util_time_get(struct util_time *t) -{ - t->counter = os_time_get(); -} - - -/** - * Return t2 = t1 + usecs - */ -PIPE_DEPRECATED -static INLINE void -util_time_add(const struct util_time *t1, - int64_t usecs, - struct util_time *t2) -{ - t2->counter = t1->counter + usecs; -} - - -/** - * Return difference between times, in microseconds - */ -PIPE_DEPRECATED -static INLINE int64_t -util_time_diff(const struct util_time *t1, - const struct util_time *t2) -{ - return t2->counter - t1->counter; -} - - -/** - * Compare two time values. - * - * Not publicly available because it does not take in account wrap-arounds. - * Use util_time_timeout instead. - */ -static INLINE int -_util_time_compare(const struct util_time *t1, - const struct util_time *t2) -{ - if (t1->counter < t2->counter) - return -1; - else if(t1->counter > t2->counter) - return 1; - else - return 0; -} - - -/** - * Returns non-zero when the timeout expires. - */ -PIPE_DEPRECATED -static INLINE boolean -util_time_timeout(const struct util_time *start, - const struct util_time *end, - const struct util_time *curr) -{ - return os_time_timeout(start->counter, end->counter, curr->counter); -} - - -/** - * Return current time in microseconds - */ -PIPE_DEPRECATED -static INLINE int64_t -util_time_micros(void) -{ - return os_time_get(); -} - - -PIPE_DEPRECATED -static INLINE void -util_time_sleep(int64_t usecs) -{ - os_time_sleep(usecs); -} - - -#ifdef __cplusplus -} -#endif - -#endif /* U_TIME_H_ */ +/************************************************************************** + * + * Copyright 2008 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. + * + **************************************************************************/ + +/** + * @file + * OS independent time-manipulation functions. + * + * @author Jose Fonseca + */ + +#ifndef U_TIME_H_ +#define U_TIME_H_ + + +#include "pipe/p_config.h" + +#include "os/os_time.h" + +#include "pipe/p_compiler.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * Time abstraction. + * + * Do not access this structure directly. Use the provided function instead. + */ +struct util_time +{ + int64_t counter; +}; + + +PIPE_DEPRECATED +static INLINE void +util_time_get(struct util_time *t) +{ + t->counter = os_time_get(); +} + + +/** + * Return t2 = t1 + usecs + */ +PIPE_DEPRECATED +static INLINE void +util_time_add(const struct util_time *t1, + int64_t usecs, + struct util_time *t2) +{ + t2->counter = t1->counter + usecs; +} + + +/** + * Return difference between times, in microseconds + */ +PIPE_DEPRECATED +static INLINE int64_t +util_time_diff(const struct util_time *t1, + const struct util_time *t2) +{ + return t2->counter - t1->counter; +} + + +/** + * Compare two time values. + * + * Not publicly available because it does not take in account wrap-arounds. + * Use util_time_timeout instead. + */ +static INLINE int +_util_time_compare(const struct util_time *t1, + const struct util_time *t2) +{ + if (t1->counter < t2->counter) + return -1; + else if(t1->counter > t2->counter) + return 1; + else + return 0; +} + + +/** + * Returns non-zero when the timeout expires. + */ +PIPE_DEPRECATED +static INLINE boolean +util_time_timeout(const struct util_time *start, + const struct util_time *end, + const struct util_time *curr) +{ + return os_time_timeout(start->counter, end->counter, curr->counter); +} + + +/** + * Return current time in microseconds + */ +PIPE_DEPRECATED +static INLINE int64_t +util_time_micros(void) +{ + return os_time_get(); +} + + +PIPE_DEPRECATED +static INLINE void +util_time_sleep(int64_t usecs) +{ + os_time_sleep(usecs); +} + + +#ifdef __cplusplus +} +#endif + +#endif /* U_TIME_H_ */ diff --git a/mesalib/src/glsl/.gitignore b/mesalib/src/glsl/.gitignore new file mode 100644 index 000000000..d26839a3e --- /dev/null +++ b/mesalib/src/glsl/.gitignore @@ -0,0 +1,8 @@ +glsl_compiler +glsl_lexer.cpp +glsl_parser.cpp +glsl_parser.h +glsl_parser.output +builtin_function.cpp +builtin_compiler +glsl_test diff --git a/mesalib/src/glsl/glcpp/.gitignore b/mesalib/src/glsl/glcpp/.gitignore new file mode 100644 index 000000000..41b34bb30 --- /dev/null +++ b/mesalib/src/glsl/glcpp/.gitignore @@ -0,0 +1,9 @@ +glcpp +glcpp-lex.c +glcpp-parse.output +glcpp-parse.c +glcpp-parse.h +*.o +*.lo +*~ +tests/*.out diff --git a/mesalib/src/glsl/glcpp/README b/mesalib/src/glsl/glcpp/README index 735b27d44..0b5ef508c 100644 --- a/mesalib/src/glsl/glcpp/README +++ b/mesalib/src/glsl/glcpp/README @@ -1,32 +1,32 @@ -glcpp -- GLSL "C" preprocessor - -This is a simple preprocessor designed to provide the preprocessing -needs of the GLSL language. The requirements for this preprocessor are -specified in the GLSL 1.30 specification availble from: - -http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.30.10.pdf - -This specification is not precise on some semantics, (for example, -#define and #if), defining these merely "as is standard for C++ -preprocessors". To fill in these details, I've been using a draft of -the C99 standard as available from: - -http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf - -Any downstream compiler accepting output from glcpp should be prepared -to encounter and deal with the following preprocessor macros: - - #line - #pragma - #extension - -All other macros will be handles according to the GLSL specification -and will not appear in the output. - -Known limitations ------------------ -The __LINE__ and __FILE__ macros are not yet supported. - -A file that ends with a function-like macro name as the last -non-whitespace token will result in a parse error, (where it should be +glcpp -- GLSL "C" preprocessor + +This is a simple preprocessor designed to provide the preprocessing +needs of the GLSL language. The requirements for this preprocessor are +specified in the GLSL 1.30 specification availble from: + +http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.30.10.pdf + +This specification is not precise on some semantics, (for example, +#define and #if), defining these merely "as is standard for C++ +preprocessors". To fill in these details, I've been using a draft of +the C99 standard as available from: + +http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf + +Any downstream compiler accepting output from glcpp should be prepared +to encounter and deal with the following preprocessor macros: + + #line + #pragma + #extension + +All other macros will be handles according to the GLSL specification +and will not appear in the output. + +Known limitations +----------------- +The __LINE__ and __FILE__ macros are not yet supported. + +A file that ends with a function-like macro name as the last +non-whitespace token will result in a parse error, (where it should be passed through as is). \ No newline at end of file diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y index 47ba54ddf..9e8f9b2d6 100644 --- a/mesalib/src/glsl/glcpp/glcpp-parse.y +++ b/mesalib/src/glsl/glcpp/glcpp-parse.y @@ -1141,6 +1141,9 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api) if (extensions->OES_EGL_image_external) add_builtin_define(parser, "GL_OES_EGL_image_external", 1); + + if (extensions->ARB_shader_bit_encoding) + add_builtin_define(parser, "GL_ARB_shader_bit_encoding", 1); } language_version = 110; diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index 46f21dd07..02c398616 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -295,6 +295,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { EXT(AMD_shader_stencil_export, false, false, true, true, false, ARB_shader_stencil_export), EXT(OES_texture_3D, true, false, true, false, true, EXT_texture3D), EXT(OES_EGL_image_external, true, false, true, false, true, OES_EGL_image_external), + EXT(ARB_shader_bit_encoding, true, true, true, true, false, ARB_shader_bit_encoding), }; #undef EXT diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h index 1a909c68b..246fc8141 100644 --- a/mesalib/src/glsl/glsl_parser_extras.h +++ b/mesalib/src/glsl/glsl_parser_extras.h @@ -205,6 +205,8 @@ struct _mesa_glsl_parse_state { bool OES_texture_3D_warn; bool OES_EGL_image_external_enable; bool OES_EGL_image_external_warn; + bool ARB_shader_bit_encoding_enable; + bool ARB_shader_bit_encoding_warn; /*@}*/ /** Extensions supported by the OpenGL implementation. */ diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp index 970d8f3ba..69954998b 100644 --- a/mesalib/src/glsl/ir.cpp +++ b/mesalib/src/glsl/ir.cpp @@ -273,6 +273,7 @@ ir_expression::ir_expression(int op, ir_rvalue *op0) case ir_unop_f2i: case ir_unop_b2i: case ir_unop_u2i: + case ir_unop_bitcast_f2i: this->type = glsl_type::get_instance(GLSL_TYPE_INT, op0->type->vector_elements, 1); break; @@ -280,6 +281,8 @@ ir_expression::ir_expression(int op, ir_rvalue *op0) case ir_unop_b2f: case ir_unop_i2f: case ir_unop_u2f: + case ir_unop_bitcast_i2f: + case ir_unop_bitcast_u2f: this->type = glsl_type::get_instance(GLSL_TYPE_FLOAT, op0->type->vector_elements, 1); break; @@ -291,6 +294,7 @@ ir_expression::ir_expression(int op, ir_rvalue *op0) break; case ir_unop_i2u: + case ir_unop_bitcast_f2u: this->type = glsl_type::get_instance(GLSL_TYPE_UINT, op0->type->vector_elements, 1); break; @@ -427,6 +431,10 @@ static const char *const operator_strs[] = { "u2f", "i2u", "u2i", + "bitcast_i2f", + "bitcast_f2i", + "bitcast_u2f", + "bitcast_f2u", "any", "trunc", "ceil", diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h index 9c7961ab9..2c4723627 100644 --- a/mesalib/src/glsl/ir.h +++ b/mesalib/src/glsl/ir.h @@ -864,19 +864,23 @@ enum ir_expression_operation { ir_unop_rcp, ir_unop_rsq, ir_unop_sqrt, - ir_unop_exp, /**< Log base e on gentype */ - ir_unop_log, /**< Natural log on gentype */ + ir_unop_exp, /**< Log base e on gentype */ + ir_unop_log, /**< Natural log on gentype */ ir_unop_exp2, ir_unop_log2, - ir_unop_f2i, /**< Float-to-integer conversion. */ - ir_unop_i2f, /**< Integer-to-float conversion. */ - ir_unop_f2b, /**< Float-to-boolean conversion */ - ir_unop_b2f, /**< Boolean-to-float conversion */ - ir_unop_i2b, /**< int-to-boolean conversion */ - ir_unop_b2i, /**< Boolean-to-int conversion */ - ir_unop_u2f, /**< Unsigned-to-float conversion. */ - ir_unop_i2u, /**< Integer-to-unsigned conversion. */ - ir_unop_u2i, /**< Unsigned-to-integer conversion. */ + ir_unop_f2i, /**< Float-to-integer conversion. */ + ir_unop_i2f, /**< Integer-to-float conversion. */ + ir_unop_f2b, /**< Float-to-boolean conversion */ + ir_unop_b2f, /**< Boolean-to-float conversion */ + ir_unop_i2b, /**< int-to-boolean conversion */ + ir_unop_b2i, /**< Boolean-to-int conversion */ + ir_unop_u2f, /**< Unsigned-to-float conversion. */ + ir_unop_i2u, /**< Integer-to-unsigned conversion. */ + ir_unop_u2i, /**< Unsigned-to-integer conversion. */ + ir_unop_bitcast_i2f, /**< Bit-identical int-to-float "conversion" */ + ir_unop_bitcast_f2i, /**< Bit-identical float-to-int "conversion" */ + ir_unop_bitcast_u2f, /**< Bit-identical uint-to-float "conversion" */ + ir_unop_bitcast_f2u, /**< Bit-identical float-to-uint "conversion" */ ir_unop_any, /** diff --git a/mesalib/src/glsl/ir_constant_expression.cpp b/mesalib/src/glsl/ir_constant_expression.cpp index 08a33285b..7a4d15f43 100644 --- a/mesalib/src/glsl/ir_constant_expression.cpp +++ b/mesalib/src/glsl/ir_constant_expression.cpp @@ -71,6 +71,29 @@ dot(ir_constant *op0, ir_constant *op1) return result; } +/* This method is the only one supported by gcc. Unions in particular + * are iffy, and read-through-converted-pointer is killed by strict + * aliasing. OTOH, the compiler sees through the memcpy, so the + * resulting asm is reasonable. + */ +static float +bitcast_u2f(unsigned int u) +{ + assert(sizeof(float) == sizeof(unsigned int)); + float f; + memcpy(&f, &u, sizeof(f)); + return f; +} + +static unsigned int +bitcast_f2u(float f) +{ + assert(sizeof(float) == sizeof(unsigned int)); + unsigned int u; + memcpy(&u, &f, sizeof(f)); + return u; +} + ir_constant * ir_rvalue::constant_expression_value(struct hash_table *variable_context) { @@ -207,6 +230,30 @@ ir_expression::constant_expression_value(struct hash_table *variable_context) data.u[c] = op[0]->value.i[c]; } break; + case ir_unop_bitcast_i2f: + assert(op[0]->type->base_type == GLSL_TYPE_INT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = bitcast_u2f(op[0]->value.i[c]); + } + break; + case ir_unop_bitcast_f2i: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.i[c] = bitcast_f2u(op[0]->value.f[c]); + } + break; + case ir_unop_bitcast_u2f: + assert(op[0]->type->base_type == GLSL_TYPE_UINT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = bitcast_u2f(op[0]->value.u[c]); + } + break; + case ir_unop_bitcast_f2u: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.u[c] = bitcast_f2u(op[0]->value.f[c]); + } + break; case ir_unop_any: assert(op[0]->type->is_boolean()); data.b[0] = false; diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp index 7efb43477..5721717a5 100644 --- a/mesalib/src/glsl/ir_validate.cpp +++ b/mesalib/src/glsl/ir_validate.cpp @@ -288,6 +288,22 @@ ir_validate::visit_leave(ir_expression *ir) assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT); assert(ir->type->base_type == GLSL_TYPE_INT); break; + case ir_unop_bitcast_i2f: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT); + assert(ir->type->base_type == GLSL_TYPE_FLOAT); + break; + case ir_unop_bitcast_f2i: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->type->base_type == GLSL_TYPE_INT); + break; + case ir_unop_bitcast_u2f: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT); + assert(ir->type->base_type == GLSL_TYPE_FLOAT); + break; + case ir_unop_bitcast_f2u: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->type->base_type == GLSL_TYPE_UINT); + break; case ir_unop_any: assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL); diff --git a/mesalib/src/glsl/loop_analysis.h b/mesalib/src/glsl/loop_analysis.h index 8bed1db02..05c982fc1 100644 --- a/mesalib/src/glsl/loop_analysis.h +++ b/mesalib/src/glsl/loop_analysis.h @@ -140,6 +140,23 @@ public: { hash_table_dtor(this->var_hash); } + + static void* operator new(size_t size, void *ctx) + { + void *lvs = ralloc_size(ctx, size); + assert(lvs != NULL); + + ralloc_set_destructor(lvs, (void (*)(void*)) destructor); + + return lvs; + } + +private: + static void + destructor(loop_variable_state *lvs) + { + lvs->~loop_variable_state(); + } }; diff --git a/mesalib/src/glsl/opt_noop_swizzle.cpp b/mesalib/src/glsl/opt_noop_swizzle.cpp index c034d7339..0a906aaf1 100644 --- a/mesalib/src/glsl/opt_noop_swizzle.cpp +++ b/mesalib/src/glsl/opt_noop_swizzle.cpp @@ -1,80 +1,80 @@ -/* - * Copyright © 2010 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -/** - * \file opt_noop_swizzle.cpp - * - * If a swizzle doesn't change the order or count of components, then - * remove the swizzle so that other optimization passes see the value - * behind it. - */ - -#include "ir.h" -#include "ir_visitor.h" -#include "ir_rvalue_visitor.h" -#include "ir_print_visitor.h" -#include "glsl_types.h" - -class ir_noop_swizzle_visitor : public ir_rvalue_visitor { -public: - ir_noop_swizzle_visitor() - { - this->progress = false; - } - - void handle_rvalue(ir_rvalue **rvalue); - bool progress; -}; - -void -ir_noop_swizzle_visitor::handle_rvalue(ir_rvalue **rvalue) -{ - if (!*rvalue) - return; - - ir_swizzle *swiz = (*rvalue)->as_swizzle(); - if (!swiz || swiz->type != swiz->val->type) - return; - - int elems = swiz->val->type->vector_elements; - if (swiz->mask.x != 0) - return; - if (elems >= 2 && swiz->mask.y != 1) - return; - if (elems >= 3 && swiz->mask.z != 2) - return; - if (elems >= 4 && swiz->mask.w != 3) - return; - - this->progress = true; - *rvalue = swiz->val; -} - -bool -do_noop_swizzle(exec_list *instructions) -{ - ir_noop_swizzle_visitor v; - visit_list_elements(&v, instructions); - - return v.progress; -} +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file opt_noop_swizzle.cpp + * + * If a swizzle doesn't change the order or count of components, then + * remove the swizzle so that other optimization passes see the value + * behind it. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_rvalue_visitor.h" +#include "ir_print_visitor.h" +#include "glsl_types.h" + +class ir_noop_swizzle_visitor : public ir_rvalue_visitor { +public: + ir_noop_swizzle_visitor() + { + this->progress = false; + } + + void handle_rvalue(ir_rvalue **rvalue); + bool progress; +}; + +void +ir_noop_swizzle_visitor::handle_rvalue(ir_rvalue **rvalue) +{ + if (!*rvalue) + return; + + ir_swizzle *swiz = (*rvalue)->as_swizzle(); + if (!swiz || swiz->type != swiz->val->type) + return; + + int elems = swiz->val->type->vector_elements; + if (swiz->mask.x != 0) + return; + if (elems >= 2 && swiz->mask.y != 1) + return; + if (elems >= 3 && swiz->mask.z != 2) + return; + if (elems >= 4 && swiz->mask.w != 3) + return; + + this->progress = true; + *rvalue = swiz->val; +} + +bool +do_noop_swizzle(exec_list *instructions) +{ + ir_noop_swizzle_visitor v; + visit_list_elements(&v, instructions); + + return v.progress; +} diff --git a/mesalib/src/glsl/opt_redundant_jumps.cpp b/mesalib/src/glsl/opt_redundant_jumps.cpp index eb60519e2..f350fa947 100644 --- a/mesalib/src/glsl/opt_redundant_jumps.cpp +++ b/mesalib/src/glsl/opt_redundant_jumps.cpp @@ -1,120 +1,120 @@ -/* - * Copyright © 2010 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -/** - * \file opt_redundant_jumps.cpp - * Remove certain types of redundant jumps - */ - -#include "ir.h" - -class redundant_jumps_visitor : public ir_hierarchical_visitor { -public: - redundant_jumps_visitor() - { - this->progress = false; - } - - virtual ir_visitor_status visit_leave(ir_if *); - virtual ir_visitor_status visit_leave(ir_loop *); - virtual ir_visitor_status visit_enter(ir_assignment *); - - bool progress; -}; - -/* We only care about the top level instructions, so don't descend - * into expressions. - */ -ir_visitor_status -redundant_jumps_visitor::visit_enter(ir_assignment *ir) -{ - return visit_continue_with_parent; -} - -ir_visitor_status -redundant_jumps_visitor::visit_leave(ir_if *ir) -{ - /* If the last instruction in both branches is a 'break' or a 'continue', - * pull it out of the branches and insert it after the if-statment. Note - * that both must be the same type (either 'break' or 'continue'). - */ - ir_instruction *const last_then = - (ir_instruction *) ir->then_instructions.get_tail(); - ir_instruction *const last_else = - (ir_instruction *) ir->else_instructions.get_tail(); - - if ((last_then == NULL) || (last_else == NULL)) - return visit_continue; - - if ((last_then->ir_type != ir_type_loop_jump) - || (last_else->ir_type != ir_type_loop_jump)) - return visit_continue; - - ir_loop_jump *const then_jump = (ir_loop_jump *) last_then; - ir_loop_jump *const else_jump = (ir_loop_jump *) last_else; - - if (then_jump->mode != else_jump->mode) - return visit_continue; - - then_jump->remove(); - else_jump->remove(); - this->progress = true; - - ir->insert_after(then_jump); - - /* If both branchs of the if-statement are now empty, remove the - * if-statement. - */ - if (ir->then_instructions.is_empty() && ir->else_instructions.is_empty()) - ir->remove(); - - return visit_continue; -} - - -ir_visitor_status -redundant_jumps_visitor::visit_leave(ir_loop *ir) -{ - /* If the last instruction of a loop body is a 'continue', remove it. - */ - ir_instruction *const last = - (ir_instruction *) ir->body_instructions.get_tail(); - - if (last && (last->ir_type == ir_type_loop_jump) - && (((ir_loop_jump *) last)->mode == ir_loop_jump::jump_continue)) { - last->remove(); - this->progress = true; - } - - return visit_continue; -} - - -bool -optimize_redundant_jumps(exec_list *instructions) -{ - redundant_jumps_visitor v; - - v.run(instructions); - return v.progress; -} +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file opt_redundant_jumps.cpp + * Remove certain types of redundant jumps + */ + +#include "ir.h" + +class redundant_jumps_visitor : public ir_hierarchical_visitor { +public: + redundant_jumps_visitor() + { + this->progress = false; + } + + virtual ir_visitor_status visit_leave(ir_if *); + virtual ir_visitor_status visit_leave(ir_loop *); + virtual ir_visitor_status visit_enter(ir_assignment *); + + bool progress; +}; + +/* We only care about the top level instructions, so don't descend + * into expressions. + */ +ir_visitor_status +redundant_jumps_visitor::visit_enter(ir_assignment *ir) +{ + return visit_continue_with_parent; +} + +ir_visitor_status +redundant_jumps_visitor::visit_leave(ir_if *ir) +{ + /* If the last instruction in both branches is a 'break' or a 'continue', + * pull it out of the branches and insert it after the if-statment. Note + * that both must be the same type (either 'break' or 'continue'). + */ + ir_instruction *const last_then = + (ir_instruction *) ir->then_instructions.get_tail(); + ir_instruction *const last_else = + (ir_instruction *) ir->else_instructions.get_tail(); + + if ((last_then == NULL) || (last_else == NULL)) + return visit_continue; + + if ((last_then->ir_type != ir_type_loop_jump) + || (last_else->ir_type != ir_type_loop_jump)) + return visit_continue; + + ir_loop_jump *const then_jump = (ir_loop_jump *) last_then; + ir_loop_jump *const else_jump = (ir_loop_jump *) last_else; + + if (then_jump->mode != else_jump->mode) + return visit_continue; + + then_jump->remove(); + else_jump->remove(); + this->progress = true; + + ir->insert_after(then_jump); + + /* If both branchs of the if-statement are now empty, remove the + * if-statement. + */ + if (ir->then_instructions.is_empty() && ir->else_instructions.is_empty()) + ir->remove(); + + return visit_continue; +} + + +ir_visitor_status +redundant_jumps_visitor::visit_leave(ir_loop *ir) +{ + /* If the last instruction of a loop body is a 'continue', remove it. + */ + ir_instruction *const last = + (ir_instruction *) ir->body_instructions.get_tail(); + + if (last && (last->ir_type == ir_type_loop_jump) + && (((ir_loop_jump *) last)->mode == ir_loop_jump::jump_continue)) { + last->remove(); + this->progress = true; + } + + return visit_continue; +} + + +bool +optimize_redundant_jumps(exec_list *instructions) +{ + redundant_jumps_visitor v; + + v.run(instructions); + return v.progress; +} diff --git a/mesalib/src/glsl/standalone_scaffolding.cpp b/mesalib/src/glsl/standalone_scaffolding.cpp index f15f2d882..679714e38 100644 --- a/mesalib/src/glsl/standalone_scaffolding.cpp +++ b/mesalib/src/glsl/standalone_scaffolding.cpp @@ -79,6 +79,7 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api) ctx->Extensions.NV_texture_rectangle = true; ctx->Extensions.EXT_texture3D = true; ctx->Extensions.OES_EGL_image_external = true; + ctx->Extensions.ARB_shader_bit_encoding = true; ctx->Const.GLSLVersion = 120; diff --git a/mesalib/src/glsl/strtod.h b/mesalib/src/glsl/strtod.h index c9ff0a87f..0cf6409d4 100644 --- a/mesalib/src/glsl/strtod.h +++ b/mesalib/src/glsl/strtod.h @@ -1,43 +1,43 @@ -/* - * Copyright 2010 VMware, 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 VMWARE 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 STRTOD_H -#define STRTOD_H - -#ifdef __cplusplus -extern "C" { -#endif - -extern double -glsl_strtod(const char *s, char **end); - - -#ifdef __cplusplus -} -#endif - - -#endif +/* + * Copyright 2010 VMware, 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 VMWARE 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 STRTOD_H +#define STRTOD_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern double +glsl_strtod(const char *s, char **end); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/mesalib/src/glu/.gitignore b/mesalib/src/glu/.gitignore new file mode 100644 index 000000000..279ea7d43 --- /dev/null +++ b/mesalib/src/glu/.gitignore @@ -0,0 +1 @@ +exptmp diff --git a/mesalib/src/glu/sgi/.gitignore b/mesalib/src/glu/sgi/.gitignore new file mode 100644 index 000000000..279ea7d43 --- /dev/null +++ b/mesalib/src/glu/sgi/.gitignore @@ -0,0 +1 @@ +exptmp diff --git a/mesalib/src/mapi/glapi/.gitignore b/mesalib/src/mapi/glapi/.gitignore new file mode 100644 index 000000000..21edf4f58 --- /dev/null +++ b/mesalib/src/mapi/glapi/.gitignore @@ -0,0 +1,20 @@ +.cvsignore +glX_proto_common.pyo +glX_proto_common.pyc +typeexpr.pyo +typeexpr.pyc +license.pyo +license.pyc +gl_XML.pyo +gl_XML.pyc +glX_XML.pyo +glX_XML.pyc +glapi_gentable.c +glapi_gentable.h +glapi_mapi_tmp.h +glapi_sparc.S +glapi_x86-64.S +glapi_x86.S +glapitable.h +glapitemp.h +glprocs.h diff --git a/mesalib/src/mapi/glapi/gen/ARB_ES2_compatibility.xml b/mesalib/src/mapi/glapi/gen/ARB_ES2_compatibility.xml index 5e348544a..d52a88c60 100644 --- a/mesalib/src/mapi/glapi/gen/ARB_ES2_compatibility.xml +++ b/mesalib/src/mapi/glapi/gen/ARB_ES2_compatibility.xml @@ -1,58 +1,58 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/ARB_draw_buffers_blend.xml b/mesalib/src/mapi/glapi/gen/ARB_draw_buffers_blend.xml index b65f26b3d..0b6947cc5 100644 --- a/mesalib/src/mapi/glapi/gen/ARB_draw_buffers_blend.xml +++ b/mesalib/src/mapi/glapi/gen/ARB_draw_buffers_blend.xml @@ -1,38 +1,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/ARB_draw_instanced.xml b/mesalib/src/mapi/glapi/gen/ARB_draw_instanced.xml index 016e64799..57bb776ac 100644 --- a/mesalib/src/mapi/glapi/gen/ARB_draw_instanced.xml +++ b/mesalib/src/mapi/glapi/gen/ARB_draw_instanced.xml @@ -1,49 +1,49 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/ARB_instanced_arrays.xml b/mesalib/src/mapi/glapi/gen/ARB_instanced_arrays.xml index 86d78df0a..822f54374 100644 --- a/mesalib/src/mapi/glapi/gen/ARB_instanced_arrays.xml +++ b/mesalib/src/mapi/glapi/gen/ARB_instanced_arrays.xml @@ -1,21 +1,21 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/ARB_texture_buffer_object.xml b/mesalib/src/mapi/glapi/gen/ARB_texture_buffer_object.xml index 82f0ec1dc..57680f553 100644 --- a/mesalib/src/mapi/glapi/gen/ARB_texture_buffer_object.xml +++ b/mesalib/src/mapi/glapi/gen/ARB_texture_buffer_object.xml @@ -1,22 +1,22 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/EXT_separate_shader_objects.xml b/mesalib/src/mapi/glapi/gen/EXT_separate_shader_objects.xml index f338aa3b6..6ec56157c 100644 --- a/mesalib/src/mapi/glapi/gen/EXT_separate_shader_objects.xml +++ b/mesalib/src/mapi/glapi/gen/EXT_separate_shader_objects.xml @@ -1,26 +1,26 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/EXT_texture_integer.xml b/mesalib/src/mapi/glapi/gen/EXT_texture_integer.xml index c33c12d1d..7e5a8cbeb 100644 --- a/mesalib/src/mapi/glapi/gen/EXT_texture_integer.xml +++ b/mesalib/src/mapi/glapi/gen/EXT_texture_integer.xml @@ -1,98 +1,98 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/EXT_transform_feedback.xml b/mesalib/src/mapi/glapi/gen/EXT_transform_feedback.xml index bf9887a71..051f1e0cc 100644 --- a/mesalib/src/mapi/glapi/gen/EXT_transform_feedback.xml +++ b/mesalib/src/mapi/glapi/gen/EXT_transform_feedback.xml @@ -1,118 +1,118 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/NV_primitive_restart.xml b/mesalib/src/mapi/glapi/gen/NV_primitive_restart.xml index 0b5588fd4..abe7dda00 100644 --- a/mesalib/src/mapi/glapi/gen/NV_primitive_restart.xml +++ b/mesalib/src/mapi/glapi/gen/NV_primitive_restart.xml @@ -1,23 +1,23 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/NV_texture_barrier.xml b/mesalib/src/mapi/glapi/gen/NV_texture_barrier.xml index dc707d0ab..52b1a3c08 100644 --- a/mesalib/src/mapi/glapi/gen/NV_texture_barrier.xml +++ b/mesalib/src/mapi/glapi/gen/NV_texture_barrier.xml @@ -1,13 +1,13 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/glX_API.xml b/mesalib/src/mapi/glapi/gen/glX_API.xml index 7e6a06685..b7f4a7770 100644 --- a/mesalib/src/mapi/glapi/gen/glX_API.xml +++ b/mesalib/src/mapi/glapi/gen/glX_API.xml @@ -1,234 +1,234 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/gl_SPARC_asm.py b/mesalib/src/mapi/glapi/gen/gl_SPARC_asm.py index bd904bee2..400e684da 100644 --- a/mesalib/src/mapi/glapi/gen/gl_SPARC_asm.py +++ b/mesalib/src/mapi/glapi/gen/gl_SPARC_asm.py @@ -1,273 +1,273 @@ -#!/usr/bin/env python - -# (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 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: -# Ian Romanick - -import license -import gl_XML, glX_XML -import sys, getopt - -class PrintGenericStubs(gl_XML.gl_print_base): - def __init__(self): - gl_XML.gl_print_base.__init__(self) - self.name = "gl_SPARC_asm.py (from Mesa)" - self.license = license.bsd_license_template % ( \ -"""Copyright (C) 1999-2003 Brian Paul All Rights Reserved. -(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM") - - - def printRealHeader(self): - print '#ifdef __arch64__' - print '#define GL_OFF(N)\t((N) * 8)' - print '#define GL_LL\t\tldx' - print '#define GL_TIE_LD(SYM)\t%tie_ldx(SYM)' - print '#define GL_STACK_SIZE\t128' - print '#else' - print '#define GL_OFF(N)\t((N) * 4)' - print '#define GL_LL\t\tld' - print '#define GL_TIE_LD(SYM)\t%tie_ld(SYM)' - print '#define GL_STACK_SIZE\t64' - print '#endif' - print '' - print '#define GLOBL_FN(x) .globl x ; .type x, @function' - print '#define HIDDEN(x) .hidden x' - print '' - print '\t.register %g2, #scratch' - print '\t.register %g3, #scratch' - print '' - print '\t.text' - print '' - print '\tGLOBL_FN(__glapi_sparc_icache_flush)' - print '\tHIDDEN(__glapi_sparc_icache_flush)' - print '\t.type\t__glapi_sparc_icache_flush, @function' - print '__glapi_sparc_icache_flush: /* %o0 = insn_addr */' - print '\tflush\t%o0' - print '\tretl' - print '\t nop' - print '' - print '\t.align\t32' - print '' - print '\t.type\t__glapi_sparc_get_pc, @function' - print '__glapi_sparc_get_pc:' - print '\tretl' - print '\t add\t%o7, %g2, %g2' - print '\t.size\t__glapi_sparc_get_pc, .-__glapi_sparc_get_pc' - print '' - print '#ifdef GLX_USE_TLS' - print '' - print '\tGLOBL_FN(__glapi_sparc_get_dispatch)' - print '\tHIDDEN(__glapi_sparc_get_dispatch)' - print '__glapi_sparc_get_dispatch:' - print '\tmov\t%o7, %g1' - print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2' - print '\tcall\t__glapi_sparc_get_pc' - print '\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2' - print '\tmov\t%g1, %o7' - print '\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1' - print '\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1' - print '\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)' - print '\tretl' - print '\t mov\t%g2, %o0' - print '' - print '\t.data' - print '\t.align\t32' - print '' - print '\t/* --> sethi %hi(_glapi_tls_Dispatch), %g1 */' - print '\t/* --> or %g1, %lo(_glapi_tls_Dispatch), %g1 */' - print '\tGLOBL_FN(__glapi_sparc_tls_stub)' - print '\tHIDDEN(__glapi_sparc_tls_stub)' - print '__glapi_sparc_tls_stub: /* Call offset in %g3 */' - print '\tmov\t%o7, %g1' - print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2' - print '\tcall\t__glapi_sparc_get_pc' - print '\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2' - print '\tmov\t%g1, %o7' - print '\tsrl\t%g3, 10, %g3' - print '\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1' - print '\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1' - print '\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)' - print '\tGL_LL\t[%g7+%g2], %g1' - print '\tGL_LL\t[%g1 + %g3], %g1' - print '\tjmp\t%g1' - print '\t nop' - print '\t.size\t__glapi_sparc_tls_stub, .-__glapi_sparc_tls_stub' - print '' - print '#define GL_STUB(fn, off)\t\t\t\t\\' - print '\tGLOBL_FN(fn);\t\t\t\t\t\\' - print 'fn:\tba\t__glapi_sparc_tls_stub;\t\t\t\\' - print '\t sethi\tGL_OFF(off), %g3;\t\t\t\\' - print '\t.size\tfn,.-fn;' - print '' - print '#elif defined(PTHREADS)' - print '' - print '\t/* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */' - print '\t/* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */' - print '\t/* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */' - print '\t/* 64-bit 0x0c --> sllx %g1, 32, %g1 */' - print '\t/* 64-bit 0x10 --> add %g1, %g2, %g1 */' - print '\t/* 64-bit 0x14 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */' - print '' - print '\t/* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */' - print '\t/* 32-bit 0x04 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */' - print '' - print '\t.data' - print '\t.align\t32' - print '' - print '\tGLOBL_FN(__glapi_sparc_pthread_stub)' - print '\tHIDDEN(__glapi_sparc_pthread_stub)' - print '__glapi_sparc_pthread_stub: /* Call offset in %g3 */' - print '\tmov\t%o7, %g1' - print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2' - print '\tcall\t__glapi_sparc_get_pc' - print '\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2' - print '\tmov\t%g1, %o7' - print '\tsethi\t%hi(_glapi_Dispatch), %g1' - print '\tor\t%g1, %lo(_glapi_Dispatch), %g1' - print '\tsrl\t%g3, 10, %g3' - print '\tGL_LL\t[%g2+%g1], %g2' - print '\tGL_LL\t[%g2], %g1' - print '\tcmp\t%g1, 0' - print '\tbe\t2f' - print '\t nop' - print '1:\tGL_LL\t[%g1 + %g3], %g1' - print '\tjmp\t%g1' - print '\t nop' - print '2:\tsave\t%sp, GL_STACK_SIZE, %sp' - print '\tmov\t%g3, %l0' - print '\tcall\t_glapi_get_dispatch' - print '\t nop' - print '\tmov\t%o0, %g1' - print '\tmov\t%l0, %g3' - print '\tba\t1b' - print '\t restore %g0, %g0, %g0' - print '\t.size\t__glapi_sparc_pthread_stub, .-__glapi_sparc_pthread_stub' - print '' - print '#define GL_STUB(fn, off)\t\t\t\\' - print '\tGLOBL_FN(fn);\t\t\t\t\\' - print 'fn:\tba\t__glapi_sparc_pthread_stub;\t\\' - print '\t sethi\tGL_OFF(off), %g3;\t\t\\' - print '\t.size\tfn,.-fn;' - print '' - print '#else /* Non-threaded version. */' - print '' - print '\t.type __glapi_sparc_nothread_stub, @function' - print '__glapi_sparc_nothread_stub: /* Call offset in %g3 */' - print '\tmov\t%o7, %g1' - print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2' - print '\tcall\t__glapi_sparc_get_pc' - print '\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2' - print '\tmov\t%g1, %o7' - print '\tsrl\t%g3, 10, %g3' - print '\tsethi\t%hi(_glapi_Dispatch), %g1' - print '\tor\t%g1, %lo(_glapi_Dispatch), %g1' - print '\tGL_LL\t[%g2+%g1], %g2' - print '\tGL_LL\t[%g2], %g1' - print '\tGL_LL\t[%g1 + %g3], %g1' - print '\tjmp\t%g1' - print '\t nop' - print '\t.size\t__glapi_sparc_nothread_stub, .-__glapi_sparc_nothread_stub' - print '' - print '#define GL_STUB(fn, off)\t\t\t\\' - print '\tGLOBL_FN(fn);\t\t\t\t\\' - print 'fn:\tba\t__glapi_sparc_nothread_stub;\t\\' - print '\t sethi\tGL_OFF(off), %g3;\t\t\\' - print '\t.size\tfn,.-fn;' - print '' - print '#endif' - print '' - print '#define GL_STUB_ALIAS(fn, alias) \\' - print ' .globl fn; \\' - print ' .set fn, alias' - print '' - print '\t.text' - print '\t.align\t32' - print '' - print '\t.globl\tgl_dispatch_functions_start' - print '\tHIDDEN(gl_dispatch_functions_start)' - print 'gl_dispatch_functions_start:' - print '' - return - - def printRealFooter(self): - print '' - print '\t.globl\tgl_dispatch_functions_end' - print '\tHIDDEN(gl_dispatch_functions_end)' - print 'gl_dispatch_functions_end:' - return - - def printBody(self, api): - for f in api.functionIterateByOffset(): - name = f.dispatch_name() - - print '\tGL_STUB(gl%s, %d)' % (name, f.offset) - - if not f.is_static_entry_point(f.name): - print '\tHIDDEN(gl%s)' % (name) - - for f in api.functionIterateByOffset(): - name = f.dispatch_name() - - if f.is_static_entry_point(f.name): - for n in f.entry_points: - if n != f.name: - text = '\tGL_STUB_ALIAS(gl%s, gl%s)' % (n, f.name) - - if f.has_different_protocol(n): - print '#ifndef GLX_INDIRECT_RENDERING' - print text - print '#endif' - else: - print text - - return - - -def show_usage(): - print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0] - sys.exit(1) - -if __name__ == '__main__': - file_name = "gl_API.xml" - mode = "generic" - - try: - (args, trail) = getopt.getopt(sys.argv[1:], "m:f:") - except Exception,e: - show_usage() - - for (arg,val) in args: - if arg == '-m': - mode = val - elif arg == "-f": - file_name = val - - if mode == "generic": - printer = PrintGenericStubs() - else: - print "ERROR: Invalid mode \"%s\" specified." % mode - show_usage() - - api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory()) - printer.Print(api) +#!/usr/bin/env python + +# (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 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: +# Ian Romanick + +import license +import gl_XML, glX_XML +import sys, getopt + +class PrintGenericStubs(gl_XML.gl_print_base): + def __init__(self): + gl_XML.gl_print_base.__init__(self) + self.name = "gl_SPARC_asm.py (from Mesa)" + self.license = license.bsd_license_template % ( \ +"""Copyright (C) 1999-2003 Brian Paul All Rights Reserved. +(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM") + + + def printRealHeader(self): + print '#ifdef __arch64__' + print '#define GL_OFF(N)\t((N) * 8)' + print '#define GL_LL\t\tldx' + print '#define GL_TIE_LD(SYM)\t%tie_ldx(SYM)' + print '#define GL_STACK_SIZE\t128' + print '#else' + print '#define GL_OFF(N)\t((N) * 4)' + print '#define GL_LL\t\tld' + print '#define GL_TIE_LD(SYM)\t%tie_ld(SYM)' + print '#define GL_STACK_SIZE\t64' + print '#endif' + print '' + print '#define GLOBL_FN(x) .globl x ; .type x, @function' + print '#define HIDDEN(x) .hidden x' + print '' + print '\t.register %g2, #scratch' + print '\t.register %g3, #scratch' + print '' + print '\t.text' + print '' + print '\tGLOBL_FN(__glapi_sparc_icache_flush)' + print '\tHIDDEN(__glapi_sparc_icache_flush)' + print '\t.type\t__glapi_sparc_icache_flush, @function' + print '__glapi_sparc_icache_flush: /* %o0 = insn_addr */' + print '\tflush\t%o0' + print '\tretl' + print '\t nop' + print '' + print '\t.align\t32' + print '' + print '\t.type\t__glapi_sparc_get_pc, @function' + print '__glapi_sparc_get_pc:' + print '\tretl' + print '\t add\t%o7, %g2, %g2' + print '\t.size\t__glapi_sparc_get_pc, .-__glapi_sparc_get_pc' + print '' + print '#ifdef GLX_USE_TLS' + print '' + print '\tGLOBL_FN(__glapi_sparc_get_dispatch)' + print '\tHIDDEN(__glapi_sparc_get_dispatch)' + print '__glapi_sparc_get_dispatch:' + print '\tmov\t%o7, %g1' + print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2' + print '\tcall\t__glapi_sparc_get_pc' + print '\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2' + print '\tmov\t%g1, %o7' + print '\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1' + print '\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1' + print '\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)' + print '\tretl' + print '\t mov\t%g2, %o0' + print '' + print '\t.data' + print '\t.align\t32' + print '' + print '\t/* --> sethi %hi(_glapi_tls_Dispatch), %g1 */' + print '\t/* --> or %g1, %lo(_glapi_tls_Dispatch), %g1 */' + print '\tGLOBL_FN(__glapi_sparc_tls_stub)' + print '\tHIDDEN(__glapi_sparc_tls_stub)' + print '__glapi_sparc_tls_stub: /* Call offset in %g3 */' + print '\tmov\t%o7, %g1' + print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2' + print '\tcall\t__glapi_sparc_get_pc' + print '\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2' + print '\tmov\t%g1, %o7' + print '\tsrl\t%g3, 10, %g3' + print '\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1' + print '\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1' + print '\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)' + print '\tGL_LL\t[%g7+%g2], %g1' + print '\tGL_LL\t[%g1 + %g3], %g1' + print '\tjmp\t%g1' + print '\t nop' + print '\t.size\t__glapi_sparc_tls_stub, .-__glapi_sparc_tls_stub' + print '' + print '#define GL_STUB(fn, off)\t\t\t\t\\' + print '\tGLOBL_FN(fn);\t\t\t\t\t\\' + print 'fn:\tba\t__glapi_sparc_tls_stub;\t\t\t\\' + print '\t sethi\tGL_OFF(off), %g3;\t\t\t\\' + print '\t.size\tfn,.-fn;' + print '' + print '#elif defined(PTHREADS)' + print '' + print '\t/* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */' + print '\t/* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */' + print '\t/* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */' + print '\t/* 64-bit 0x0c --> sllx %g1, 32, %g1 */' + print '\t/* 64-bit 0x10 --> add %g1, %g2, %g1 */' + print '\t/* 64-bit 0x14 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */' + print '' + print '\t/* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */' + print '\t/* 32-bit 0x04 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */' + print '' + print '\t.data' + print '\t.align\t32' + print '' + print '\tGLOBL_FN(__glapi_sparc_pthread_stub)' + print '\tHIDDEN(__glapi_sparc_pthread_stub)' + print '__glapi_sparc_pthread_stub: /* Call offset in %g3 */' + print '\tmov\t%o7, %g1' + print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2' + print '\tcall\t__glapi_sparc_get_pc' + print '\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2' + print '\tmov\t%g1, %o7' + print '\tsethi\t%hi(_glapi_Dispatch), %g1' + print '\tor\t%g1, %lo(_glapi_Dispatch), %g1' + print '\tsrl\t%g3, 10, %g3' + print '\tGL_LL\t[%g2+%g1], %g2' + print '\tGL_LL\t[%g2], %g1' + print '\tcmp\t%g1, 0' + print '\tbe\t2f' + print '\t nop' + print '1:\tGL_LL\t[%g1 + %g3], %g1' + print '\tjmp\t%g1' + print '\t nop' + print '2:\tsave\t%sp, GL_STACK_SIZE, %sp' + print '\tmov\t%g3, %l0' + print '\tcall\t_glapi_get_dispatch' + print '\t nop' + print '\tmov\t%o0, %g1' + print '\tmov\t%l0, %g3' + print '\tba\t1b' + print '\t restore %g0, %g0, %g0' + print '\t.size\t__glapi_sparc_pthread_stub, .-__glapi_sparc_pthread_stub' + print '' + print '#define GL_STUB(fn, off)\t\t\t\\' + print '\tGLOBL_FN(fn);\t\t\t\t\\' + print 'fn:\tba\t__glapi_sparc_pthread_stub;\t\\' + print '\t sethi\tGL_OFF(off), %g3;\t\t\\' + print '\t.size\tfn,.-fn;' + print '' + print '#else /* Non-threaded version. */' + print '' + print '\t.type __glapi_sparc_nothread_stub, @function' + print '__glapi_sparc_nothread_stub: /* Call offset in %g3 */' + print '\tmov\t%o7, %g1' + print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2' + print '\tcall\t__glapi_sparc_get_pc' + print '\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2' + print '\tmov\t%g1, %o7' + print '\tsrl\t%g3, 10, %g3' + print '\tsethi\t%hi(_glapi_Dispatch), %g1' + print '\tor\t%g1, %lo(_glapi_Dispatch), %g1' + print '\tGL_LL\t[%g2+%g1], %g2' + print '\tGL_LL\t[%g2], %g1' + print '\tGL_LL\t[%g1 + %g3], %g1' + print '\tjmp\t%g1' + print '\t nop' + print '\t.size\t__glapi_sparc_nothread_stub, .-__glapi_sparc_nothread_stub' + print '' + print '#define GL_STUB(fn, off)\t\t\t\\' + print '\tGLOBL_FN(fn);\t\t\t\t\\' + print 'fn:\tba\t__glapi_sparc_nothread_stub;\t\\' + print '\t sethi\tGL_OFF(off), %g3;\t\t\\' + print '\t.size\tfn,.-fn;' + print '' + print '#endif' + print '' + print '#define GL_STUB_ALIAS(fn, alias) \\' + print ' .globl fn; \\' + print ' .set fn, alias' + print '' + print '\t.text' + print '\t.align\t32' + print '' + print '\t.globl\tgl_dispatch_functions_start' + print '\tHIDDEN(gl_dispatch_functions_start)' + print 'gl_dispatch_functions_start:' + print '' + return + + def printRealFooter(self): + print '' + print '\t.globl\tgl_dispatch_functions_end' + print '\tHIDDEN(gl_dispatch_functions_end)' + print 'gl_dispatch_functions_end:' + return + + def printBody(self, api): + for f in api.functionIterateByOffset(): + name = f.dispatch_name() + + print '\tGL_STUB(gl%s, %d)' % (name, f.offset) + + if not f.is_static_entry_point(f.name): + print '\tHIDDEN(gl%s)' % (name) + + for f in api.functionIterateByOffset(): + name = f.dispatch_name() + + if f.is_static_entry_point(f.name): + for n in f.entry_points: + if n != f.name: + text = '\tGL_STUB_ALIAS(gl%s, gl%s)' % (n, f.name) + + if f.has_different_protocol(n): + print '#ifndef GLX_INDIRECT_RENDERING' + print text + print '#endif' + else: + print text + + return + + +def show_usage(): + print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0] + sys.exit(1) + +if __name__ == '__main__': + file_name = "gl_API.xml" + mode = "generic" + + try: + (args, trail) = getopt.getopt(sys.argv[1:], "m:f:") + except Exception,e: + show_usage() + + for (arg,val) in args: + if arg == '-m': + mode = val + elif arg == "-f": + file_name = val + + if mode == "generic": + printer = PrintGenericStubs() + else: + print "ERROR: Invalid mode \"%s\" specified." % mode + show_usage() + + api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory()) + printer.Print(api) diff --git a/mesalib/src/mapi/glapi/gen/gl_procs.py b/mesalib/src/mapi/glapi/gen/gl_procs.py index f1522baec..a9ba48297 100644 --- a/mesalib/src/mapi/glapi/gen/gl_procs.py +++ b/mesalib/src/mapi/glapi/gen/gl_procs.py @@ -1,215 +1,215 @@ -#!/usr/bin/env python - -# (C) Copyright IBM Corporation 2004, 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 -# 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 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: -# Ian Romanick - -import license -import gl_XML, glX_XML -import sys, getopt - -class PrintGlProcs(gl_XML.gl_print_base): - def __init__(self, long_strings, es=False): - gl_XML.gl_print_base.__init__(self) - - self.es = es - self.long_strings = long_strings - self.name = "gl_procs.py (from Mesa)" - self.license = license.bsd_license_template % ( \ -"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved. -(C) Copyright IBM Corporation 2004, 2006""", "BRIAN PAUL, IBM") - - - def printRealHeader(self): - print """ -/* This file is only included by glapi.c and is used for - * the GetProcAddress() function - */ - -typedef struct { - GLint Name_offset; -#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) - _glapi_proc Address; -#endif - GLuint Offset; -} glprocs_table_t; - -#if !defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING) -# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , o } -#elif defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING) -# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f1 , o } -#elif defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING) -# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f2 , o } -#elif !defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING) -# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f3 , o } -#endif - -""" - return - - def printRealFooter(self): - print '' - print '#undef NAME_FUNC_OFFSET' - return - - def printFunctionString(self, name): - if self.long_strings: - print ' "gl%s\\0"' % (name) - else: - print " 'g','l',", - for c in name: - print "'%s'," % (c), - - print "'\\0'," - - - def printBody(self, api): - print '' - if self.long_strings: - print 'static const char gl_string_table[] =' - else: - print 'static const char gl_string_table[] = {' - - base_offset = 0 - table = [] - for func in api.functionIterateByOffset(): - name = func.dispatch_name() - self.printFunctionString(func.name) - table.append((base_offset, "gl" + name, "gl" + name, "NULL", func.offset)) - - # The length of the function's name, plus 2 for "gl", - # plus 1 for the NUL. - - base_offset += len(func.name) + 3 - - - for func in api.functionIterateByOffset(): - for n in func.entry_points: - if n != func.name: - name = func.dispatch_name() - self.printFunctionString( n ) - - if func.has_different_protocol(n): - alt_name = "gl" + func.static_glx_name(n) - table.append((base_offset, "gl" + name, alt_name, alt_name, func.offset)) - else: - table.append((base_offset, "gl" + name, "gl" + name, "NULL", func.offset)) - - base_offset += len(n) + 3 - - - if self.long_strings: - print ' ;' - else: - print '};' - - print '' - print '' - print "#ifdef USE_MGL_NAMESPACE" - for func in api.functionIterateByOffset(): - for n in func.entry_points: - if (not func.is_static_entry_point(func.name)) or (func.has_different_protocol(n) and not func.is_static_entry_point(n)): - print '#define gl_dispatch_stub_%u mgl_dispatch_stub_%u' % (func.offset, func.offset) - break - print "#endif /* USE_MGL_NAMESPACE */" - print '' - print '' - print '#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)' - for func in api.functionIterateByOffset(): - for n in func.entry_points: - if (not func.is_static_entry_point(func.name)) or (func.has_different_protocol(n) and not func.is_static_entry_point(n)): - print '%s GLAPIENTRY gl_dispatch_stub_%u(%s);' % (func.return_type, func.offset, func.get_parameter_string()) - break - - if self.es: - categories = {} - for func in api.functionIterateByOffset(): - for n in func.entry_points: - cat, num = api.get_category_for_name(n) - if (cat.startswith("es") or cat.startswith("GL_OES")): - if not categories.has_key(cat): - categories[cat] = [] - proto = 'GLAPI %s GLAPIENTRY %s(%s);' \ - % (func.return_type, "gl" + n, func.get_parameter_string(n)) - categories[cat].append(proto) - if categories: - print '' - print '/* OpenGL ES specific prototypes */' - print '' - keys = categories.keys() - keys.sort() - for key in keys: - print '/* category %s */' % key - print "\n".join(categories[key]) - print '' - - print '#endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */' - - print '' - print 'static const glprocs_table_t static_functions[] = {' - - for info in table: - print ' NAME_FUNC_OFFSET(%5u, %s, %s, %s, %d),' % info - - print ' NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)' - print '};' - return - - -def show_usage(): - print "Usage: %s [-f input_file_name] [-m mode] [-c]" % sys.argv[0] - print "-c Enable compatibility with OpenGL ES." - print "-m mode mode can be one of:" - print " long - Create code for compilers that can handle very" - print " long string constants. (default)" - print " short - Create code for compilers that can only handle" - print " ANSI C89 string constants." - sys.exit(1) - -if __name__ == '__main__': - file_name = "gl_API.xml" - - try: - (args, trail) = getopt.getopt(sys.argv[1:], "f:m:c") - except Exception,e: - show_usage() - - long_string = 1 - es = False - for (arg,val) in args: - if arg == "-f": - file_name = val - elif arg == "-m": - if val == "short": - long_string = 0 - elif val == "long": - long_string = 1 - else: - show_usage() - elif arg == "-c": - es = True - - api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory()) - printer = PrintGlProcs(long_string, es) - printer.Print(api) +#!/usr/bin/env python + +# (C) Copyright IBM Corporation 2004, 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 +# 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 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: +# Ian Romanick + +import license +import gl_XML, glX_XML +import sys, getopt + +class PrintGlProcs(gl_XML.gl_print_base): + def __init__(self, long_strings, es=False): + gl_XML.gl_print_base.__init__(self) + + self.es = es + self.long_strings = long_strings + self.name = "gl_procs.py (from Mesa)" + self.license = license.bsd_license_template % ( \ +"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved. +(C) Copyright IBM Corporation 2004, 2006""", "BRIAN PAUL, IBM") + + + def printRealHeader(self): + print """ +/* This file is only included by glapi.c and is used for + * the GetProcAddress() function + */ + +typedef struct { + GLint Name_offset; +#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) + _glapi_proc Address; +#endif + GLuint Offset; +} glprocs_table_t; + +#if !defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING) +# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , o } +#elif defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING) +# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f1 , o } +#elif defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING) +# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f2 , o } +#elif !defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING) +# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f3 , o } +#endif + +""" + return + + def printRealFooter(self): + print '' + print '#undef NAME_FUNC_OFFSET' + return + + def printFunctionString(self, name): + if self.long_strings: + print ' "gl%s\\0"' % (name) + else: + print " 'g','l',", + for c in name: + print "'%s'," % (c), + + print "'\\0'," + + + def printBody(self, api): + print '' + if self.long_strings: + print 'static const char gl_string_table[] =' + else: + print 'static const char gl_string_table[] = {' + + base_offset = 0 + table = [] + for func in api.functionIterateByOffset(): + name = func.dispatch_name() + self.printFunctionString(func.name) + table.append((base_offset, "gl" + name, "gl" + name, "NULL", func.offset)) + + # The length of the function's name, plus 2 for "gl", + # plus 1 for the NUL. + + base_offset += len(func.name) + 3 + + + for func in api.functionIterateByOffset(): + for n in func.entry_points: + if n != func.name: + name = func.dispatch_name() + self.printFunctionString( n ) + + if func.has_different_protocol(n): + alt_name = "gl" + func.static_glx_name(n) + table.append((base_offset, "gl" + name, alt_name, alt_name, func.offset)) + else: + table.append((base_offset, "gl" + name, "gl" + name, "NULL", func.offset)) + + base_offset += len(n) + 3 + + + if self.long_strings: + print ' ;' + else: + print '};' + + print '' + print '' + print "#ifdef USE_MGL_NAMESPACE" + for func in api.functionIterateByOffset(): + for n in func.entry_points: + if (not func.is_static_entry_point(func.name)) or (func.has_different_protocol(n) and not func.is_static_entry_point(n)): + print '#define gl_dispatch_stub_%u mgl_dispatch_stub_%u' % (func.offset, func.offset) + break + print "#endif /* USE_MGL_NAMESPACE */" + print '' + print '' + print '#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)' + for func in api.functionIterateByOffset(): + for n in func.entry_points: + if (not func.is_static_entry_point(func.name)) or (func.has_different_protocol(n) and not func.is_static_entry_point(n)): + print '%s GLAPIENTRY gl_dispatch_stub_%u(%s);' % (func.return_type, func.offset, func.get_parameter_string()) + break + + if self.es: + categories = {} + for func in api.functionIterateByOffset(): + for n in func.entry_points: + cat, num = api.get_category_for_name(n) + if (cat.startswith("es") or cat.startswith("GL_OES")): + if not categories.has_key(cat): + categories[cat] = [] + proto = 'GLAPI %s GLAPIENTRY %s(%s);' \ + % (func.return_type, "gl" + n, func.get_parameter_string(n)) + categories[cat].append(proto) + if categories: + print '' + print '/* OpenGL ES specific prototypes */' + print '' + keys = categories.keys() + keys.sort() + for key in keys: + print '/* category %s */' % key + print "\n".join(categories[key]) + print '' + + print '#endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */' + + print '' + print 'static const glprocs_table_t static_functions[] = {' + + for info in table: + print ' NAME_FUNC_OFFSET(%5u, %s, %s, %s, %d),' % info + + print ' NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)' + print '};' + return + + +def show_usage(): + print "Usage: %s [-f input_file_name] [-m mode] [-c]" % sys.argv[0] + print "-c Enable compatibility with OpenGL ES." + print "-m mode mode can be one of:" + print " long - Create code for compilers that can handle very" + print " long string constants. (default)" + print " short - Create code for compilers that can only handle" + print " ANSI C89 string constants." + sys.exit(1) + +if __name__ == '__main__': + file_name = "gl_API.xml" + + try: + (args, trail) = getopt.getopt(sys.argv[1:], "f:m:c") + except Exception,e: + show_usage() + + long_string = 1 + es = False + for (arg,val) in args: + if arg == "-f": + file_name = val + elif arg == "-m": + if val == "short": + long_string = 0 + elif val == "long": + long_string = 1 + else: + show_usage() + elif arg == "-c": + es = True + + api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory()) + printer = PrintGlProcs(long_string, es) + printer.Print(api) diff --git a/mesalib/src/mapi/glapi/gen/next_available_offset.sh b/mesalib/src/mapi/glapi/gen/next_available_offset.sh index 20d45ec54..e7d6c2f4a 100644 --- a/mesalib/src/mapi/glapi/gen/next_available_offset.sh +++ b/mesalib/src/mapi/glapi/gen/next_available_offset.sh @@ -1,39 +1,39 @@ -#!/usr/bin/env bash -# -# (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 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: -# Ian Romanick - -# Trivial shell script to search the API definition file and print out the -# next numerically available API entry-point offset. This could probably -# be made smarter, but it would be better to use the existin Python -# framework to do that. This is just a quick-and-dirty hack. - -num=$(grep 'offset="' gl_API.xml |\ - sed 's/.\+ offset="//g;s/".*$//g' |\ - grep -v '?' |\ - sort -rn |\ - head -1) - -echo $((num + 1)) +#!/usr/bin/env bash +# +# (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 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: +# Ian Romanick + +# Trivial shell script to search the API definition file and print out the +# next numerically available API entry-point offset. This could probably +# be made smarter, but it would be better to use the existin Python +# framework to do that. This is just a quick-and-dirty hack. + +num=$(grep 'offset="' gl_API.xml |\ + sed 's/.\+ offset="//g;s/".*$//g' |\ + grep -v '?' |\ + sort -rn |\ + head -1) + +echo $((num + 1)) diff --git a/mesalib/src/mapi/glapi/glapi.c b/mesalib/src/mapi/glapi/glapi.c index 77f75faed..f7655c558 100644 --- a/mesalib/src/mapi/glapi/glapi.c +++ b/mesalib/src/mapi/glapi/glapi.c @@ -1,65 +1,65 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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: - * Chia-I Wu - */ - -#include "glapi/glapi.h" -#include "mapi/u_current.h" - -/* - * Global variables, _glapi_get_context, and _glapi_get_dispatch are defined in - * u_current.c. - */ - -#ifdef GLX_USE_TLS -/* not used, but defined for compatibility */ -const struct _glapi_table *_glapi_Dispatch; -const void *_glapi_Context; -#endif /* GLX_USE_TLS */ - -void -_glapi_destroy_multithread(void) -{ - u_current_destroy(); -} - -void -_glapi_check_multithread(void) -{ - u_current_init(); -} - -void -_glapi_set_context(void *context) -{ - u_current_set_user((const void *) context); -} - -void -_glapi_set_dispatch(struct _glapi_table *dispatch) -{ - u_current_set((const struct mapi_table *) dispatch); -} +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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: + * Chia-I Wu + */ + +#include "glapi/glapi.h" +#include "mapi/u_current.h" + +/* + * Global variables, _glapi_get_context, and _glapi_get_dispatch are defined in + * u_current.c. + */ + +#ifdef GLX_USE_TLS +/* not used, but defined for compatibility */ +const struct _glapi_table *_glapi_Dispatch; +const void *_glapi_Context; +#endif /* GLX_USE_TLS */ + +void +_glapi_destroy_multithread(void) +{ + u_current_destroy(); +} + +void +_glapi_check_multithread(void) +{ + u_current_init(); +} + +void +_glapi_set_context(void *context) +{ + u_current_set_user((const void *) context); +} + +void +_glapi_set_dispatch(struct _glapi_table *dispatch) +{ + u_current_set((const struct mapi_table *) dispatch); +} diff --git a/mesalib/src/mapi/glapi/glapi_dispatch.c b/mesalib/src/mapi/glapi/glapi_dispatch.c index be8c4e71d..989f4a3fc 100644 --- a/mesalib/src/mapi/glapi/glapi_dispatch.c +++ b/mesalib/src/mapi/glapi/glapi_dispatch.c @@ -1,92 +1,92 @@ -/* - * 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. - */ - - -/** - * \file glapi_dispatch.c - * - * This file generates all the gl* function entrypoints. This code is not - * used if optimized assembly stubs are available (e.g., using - * glapi/glapi_x86.S on IA32 or glapi/glapi_sparc.S on SPARC). - * - * \note - * This file is also used to build the client-side libGL that loads DRI-based - * device drivers. At build-time it is symlinked to src/glx. - * - * \author Brian Paul - */ - -#include "glapi/glapi_priv.h" -#include "glapi/glapitable.h" - - -#if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM)) - -#if defined(WIN32) -#define KEYWORD1 GLAPI -#else -#define KEYWORD1 PUBLIC -#endif - -#define KEYWORD2 GLAPIENTRY - -#if defined(USE_MGL_NAMESPACE) -#define NAME(func) mgl##func -#else -#define NAME(func) gl##func -#endif - -#if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */ - -#define F stdout -#define DISPATCH(FUNC, ARGS, MESSAGE) \ - fprintf MESSAGE; \ - GET_DISPATCH()->FUNC ARGS - -#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ - fprintf MESSAGE; \ - return GET_DISPATCH()->FUNC ARGS - -#else - -#define DISPATCH(FUNC, ARGS, MESSAGE) \ - GET_DISPATCH()->FUNC ARGS - -#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ - return GET_DISPATCH()->FUNC ARGS - -#endif /* logging */ - - -#ifndef GLAPIENTRY -#define GLAPIENTRY -#endif - -#ifdef GLX_INDIRECT_RENDERING -/* those link to libglapi.a should provide the entry points */ -#define _GLAPI_SKIP_PROTO_ENTRY_POINTS -#endif -#include "glapi/glapitemp.h" - -#endif /* USE_X86_ASM */ +/* + * 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. + */ + + +/** + * \file glapi_dispatch.c + * + * This file generates all the gl* function entrypoints. This code is not + * used if optimized assembly stubs are available (e.g., using + * glapi/glapi_x86.S on IA32 or glapi/glapi_sparc.S on SPARC). + * + * \note + * This file is also used to build the client-side libGL that loads DRI-based + * device drivers. At build-time it is symlinked to src/glx. + * + * \author Brian Paul + */ + +#include "glapi/glapi_priv.h" +#include "glapi/glapitable.h" + + +#if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM)) + +#if defined(WIN32) +#define KEYWORD1 GLAPI +#else +#define KEYWORD1 PUBLIC +#endif + +#define KEYWORD2 GLAPIENTRY + +#if defined(USE_MGL_NAMESPACE) +#define NAME(func) mgl##func +#else +#define NAME(func) gl##func +#endif + +#if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */ + +#define F stdout +#define DISPATCH(FUNC, ARGS, MESSAGE) \ + fprintf MESSAGE; \ + GET_DISPATCH()->FUNC ARGS + +#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ + fprintf MESSAGE; \ + return GET_DISPATCH()->FUNC ARGS + +#else + +#define DISPATCH(FUNC, ARGS, MESSAGE) \ + GET_DISPATCH()->FUNC ARGS + +#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ + return GET_DISPATCH()->FUNC ARGS + +#endif /* logging */ + + +#ifndef GLAPIENTRY +#define GLAPIENTRY +#endif + +#ifdef GLX_INDIRECT_RENDERING +/* those link to libglapi.a should provide the entry points */ +#define _GLAPI_SKIP_PROTO_ENTRY_POINTS +#endif +#include "glapi/glapitemp.h" + +#endif /* USE_X86_ASM */ diff --git a/mesalib/src/mapi/glapi/glapi_getproc.c b/mesalib/src/mapi/glapi/glapi_getproc.c index 21380ea41..0a6ff7795 100644 --- a/mesalib/src/mapi/glapi/glapi_getproc.c +++ b/mesalib/src/mapi/glapi/glapi_getproc.c @@ -1,666 +1,666 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 1999-2008 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. - */ - -/** - * \file glapi_getproc.c - * - * Code for implementing glXGetProcAddress(), etc. - * This was originally in glapi.c but refactored out. - */ - - -#include "glapi/glapi_priv.h" -#include "glapi/glapitable.h" - - -#define FIRST_DYNAMIC_OFFSET (sizeof(struct _glapi_table) / sizeof(void *)) - - -/********************************************************************** - * Static function management. - */ - - -#if !defined(DISPATCH_FUNCTION_SIZE) -# define NEED_FUNCTION_POINTER -#endif -#include "glapi/glprocs.h" - - -/** - * Search the table of static entrypoint functions for the named function - * and return the corresponding glprocs_table_t entry. - */ -static const glprocs_table_t * -get_static_proc( const char * n ) -{ - GLuint i; - for (i = 0; static_functions[i].Name_offset >= 0; i++) { - const char *testName = gl_string_table + static_functions[i].Name_offset; -#ifdef MANGLE - /* skip the prefix on the name */ - if (strcmp(testName, n + 1) == 0) -#else - if (strcmp(testName, n) == 0) -#endif - { - return &static_functions[i]; - } - } - return NULL; -} - - -/** - * Return dispatch table offset of the named static (built-in) function. - * Return -1 if function not found. - */ -static GLint -get_static_proc_offset(const char *funcName) -{ - const glprocs_table_t * const f = get_static_proc( funcName ); - if (f == NULL) { - return -1; - } - - return f->Offset; -} - - - -/** - * Return dispatch function address for the named static (built-in) function. - * Return NULL if function not found. - */ -static _glapi_proc -get_static_proc_address(const char *funcName) -{ - const glprocs_table_t * const f = get_static_proc( funcName ); - if (f == NULL) { - return NULL; - } - -#if defined(DISPATCH_FUNCTION_SIZE) && defined(GLX_INDIRECT_RENDERING) - return (f->Address == NULL) - ? get_entrypoint_address(f->Offset) - : f->Address; -#elif defined(DISPATCH_FUNCTION_SIZE) - return get_entrypoint_address(f->Offset); -#else - return f->Address; -#endif -} - - - -/** - * Return the name of the function at the given offset in the dispatch - * table. For debugging only. - */ -static const char * -get_static_proc_name( GLuint offset ) -{ - GLuint i; - for (i = 0; static_functions[i].Name_offset >= 0; i++) { - if (static_functions[i].Offset == offset) { - return gl_string_table + static_functions[i].Name_offset; - } - } - return NULL; -} - - - -/********************************************************************** - * Extension function management. - */ - - -/** - * Track information about a function added to the GL API. - */ -struct _glapi_function { - /** - * Name of the function. - */ - const char * name; - - - /** - * Text string that describes the types of the parameters passed to the - * named function. Parameter types are converted to characters using the - * following rules: - * - 'i' for \c GLint, \c GLuint, and \c GLenum - * - 'p' for any pointer type - * - 'f' for \c GLfloat and \c GLclampf - * - 'd' for \c GLdouble and \c GLclampd - */ - const char * parameter_signature; - - - /** - * Offset in the dispatch table where the pointer to the real function is - * located. If the driver has not requested that the named function be - * added to the dispatch table, this will have the value ~0. - */ - unsigned dispatch_offset; - - - /** - * Pointer to the dispatch stub for the named function. - * - * \todo - * The semantic of this field should be changed slightly. Currently, it - * is always expected to be non-\c NULL. However, it would be better to - * only allocate the entry-point stub when the application requests the - * function via \c glXGetProcAddress. This would save memory for all the - * functions that the driver exports but that the application never wants - * to call. - */ - _glapi_proc dispatch_stub; -}; - - -static struct _glapi_function ExtEntryTable[MAX_EXTENSION_FUNCS]; -static GLuint NumExtEntryPoints = 0; - - -static struct _glapi_function * -get_extension_proc(const char *funcName) -{ - GLuint i; - for (i = 0; i < NumExtEntryPoints; i++) { - if (strcmp(ExtEntryTable[i].name, funcName) == 0) { - return & ExtEntryTable[i]; - } - } - return NULL; -} - - -static GLint -get_extension_proc_offset(const char *funcName) -{ - const struct _glapi_function * const f = get_extension_proc( funcName ); - if (f == NULL) { - return -1; - } - - return f->dispatch_offset; -} - - -static _glapi_proc -get_extension_proc_address(const char *funcName) -{ - const struct _glapi_function * const f = get_extension_proc( funcName ); - if (f == NULL) { - return NULL; - } - - return f->dispatch_stub; -} - - -static const char * -get_extension_proc_name(GLuint offset) -{ - GLuint i; - for (i = 0; i < NumExtEntryPoints; i++) { - if (ExtEntryTable[i].dispatch_offset == offset) { - return ExtEntryTable[i].name; - } - } - return NULL; -} - - -/** - * strdup() is actually not a standard ANSI C or POSIX routine. - * Irix will not define it if ANSI mode is in effect. - */ -static char * -str_dup(const char *str) -{ - char *copy; - copy = (char*) malloc(strlen(str) + 1); - if (!copy) - return NULL; - strcpy(copy, str); - return copy; -} - - -/** - * Generate new entrypoint - * - * Use a temporary dispatch offset of ~0 (i.e. -1). Later, when the driver - * calls \c _glapi_add_dispatch we'll put in the proper offset. If that - * never happens, and the user calls this function, he'll segfault. That's - * what you get when you try calling a GL function that doesn't really exist. - * - * \param funcName Name of the function to create an entry-point for. - * - * \sa _glapi_add_entrypoint - */ - -static struct _glapi_function * -add_function_name( const char * funcName ) -{ - struct _glapi_function * entry = NULL; - _glapi_proc entrypoint = NULL; - char * name_dup = NULL; - - if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS) - return NULL; - - if (funcName == NULL) - return NULL; - - name_dup = str_dup(funcName); - if (name_dup == NULL) - return NULL; - - entrypoint = generate_entrypoint(~0); - - if (entrypoint == NULL) { - free(name_dup); - return NULL; - } - - entry = & ExtEntryTable[NumExtEntryPoints]; - NumExtEntryPoints++; - - entry->name = name_dup; - entry->parameter_signature = NULL; - entry->dispatch_offset = ~0; - entry->dispatch_stub = entrypoint; - - return entry; -} - - -static struct _glapi_function * -set_entry_info( struct _glapi_function * entry, const char * signature, unsigned offset ) -{ - char * sig_dup = NULL; - - if (signature == NULL) - return NULL; - - sig_dup = str_dup(signature); - if (sig_dup == NULL) - return NULL; - - fill_in_entrypoint_offset(entry->dispatch_stub, offset); - - entry->parameter_signature = sig_dup; - entry->dispatch_offset = offset; - - return entry; -} - - -/** - * Fill-in the dispatch stub for the named function. - * - * This function is intended to be called by a hardware driver. When called, - * a dispatch stub may be created created for the function. A pointer to this - * dispatch function will be returned by glXGetProcAddress. - * - * \param function_names Array of pointers to function names that should - * share a common dispatch offset. - * \param parameter_signature String representing the types of the parameters - * passed to the named function. Parameter types - * are converted to characters using the following - * rules: - * - 'i' for \c GLint, \c GLuint, and \c GLenum - * - 'p' for any pointer type - * - 'f' for \c GLfloat and \c GLclampf - * - 'd' for \c GLdouble and \c GLclampd - * - * \returns - * The offset in the dispatch table of the named function. A pointer to the - * driver's implementation of the named function should be stored at - * \c dispatch_table[\c offset]. Return -1 if error/problem. - * - * \sa glXGetProcAddress - * - * \warning - * This function can only handle up to 8 names at a time. As far as I know, - * the maximum number of names ever associated with an existing GL function is - * 4 (\c glPointParameterfSGIS, \c glPointParameterfEXT, - * \c glPointParameterfARB, and \c glPointParameterf), so this should not be - * too painful of a limitation. - * - * \todo - * Determine whether or not \c parameter_signature should be allowed to be - * \c NULL. It doesn't seem like much of a hardship for drivers to have to - * pass in an empty string. - * - * \todo - * Determine if code should be added to reject function names that start with - * 'glX'. - * - * \bug - * Add code to compare \c parameter_signature with the parameter signature of - * a static function. In order to do that, we need to find a way to \b get - * the parameter signature of a static function. - */ - -int -_glapi_add_dispatch( const char * const * function_names, - const char * parameter_signature ) -{ - static int next_dynamic_offset = FIRST_DYNAMIC_OFFSET; - const char * const real_sig = (parameter_signature != NULL) - ? parameter_signature : ""; - struct _glapi_function * entry[8]; - GLboolean is_static[8]; - unsigned i; - int offset = ~0; - - init_glapi_relocs_once(); - - (void) memset( is_static, 0, sizeof( is_static ) ); - (void) memset( entry, 0, sizeof( entry ) ); - - /* Find the _single_ dispatch offset for all function names that already - * exist (and have a dispatch offset). - */ - - for ( i = 0 ; function_names[i] != NULL ; i++ ) { - const char * funcName = function_names[i]; - int static_offset; - int extension_offset; - - if (funcName[0] != 'g' || funcName[1] != 'l') - return -1; - - /* search built-in functions */ - static_offset = get_static_proc_offset(funcName); - - if (static_offset >= 0) { - - is_static[i] = GL_TRUE; - - /* FIXME: Make sure the parameter signatures match! How do we get - * FIXME: the parameter signature for static functions? - */ - - if ( (offset != ~0) && (static_offset != offset) ) { - return -1; - } - - offset = static_offset; - - continue; - } - - /* search added extension functions */ - entry[i] = get_extension_proc(funcName); - - if (entry[i] != NULL) { - extension_offset = entry[i]->dispatch_offset; - - /* The offset may be ~0 if the function name was added by - * glXGetProcAddress but never filled in by the driver. - */ - - if (extension_offset == ~0) { - continue; - } - - if (strcmp(real_sig, entry[i]->parameter_signature) != 0) { - return -1; - } - - if ( (offset != ~0) && (extension_offset != offset) ) { - return -1; - } - - offset = extension_offset; - } - } - - /* If all function names are either new (or with no dispatch offset), - * allocate a new dispatch offset. - */ - - if (offset == ~0) { - offset = next_dynamic_offset; - next_dynamic_offset++; - } - - /* Fill in the dispatch offset for the new function names (and those with - * no dispatch offset). - */ - - for ( i = 0 ; function_names[i] != NULL ; i++ ) { - if (is_static[i]) { - continue; - } - - /* generate entrypoints for new function names */ - if (entry[i] == NULL) { - entry[i] = add_function_name( function_names[i] ); - if (entry[i] == NULL) { - /* FIXME: Possible memory leak here. */ - return -1; - } - } - - if (entry[i]->dispatch_offset == ~0) { - set_entry_info( entry[i], real_sig, offset ); - } - } - - return offset; -} - - -/** - * Return offset of entrypoint for named function within dispatch table. - */ -GLint -_glapi_get_proc_offset(const char *funcName) -{ - GLint offset; - - /* search extension functions first */ - offset = get_extension_proc_offset(funcName); - if (offset >= 0) - return offset; - - /* search static functions */ - return get_static_proc_offset(funcName); -} - - - -/** - * Return pointer to the named function. If the function name isn't found - * in the name of static functions, try generating a new API entrypoint on - * the fly with assembly language. - */ -_glapi_proc -_glapi_get_proc_address(const char *funcName) -{ - _glapi_proc func; - struct _glapi_function * entry; - - init_glapi_relocs_once(); - -#ifdef MANGLE - /* skip the prefix on the name */ - if (funcName[1] != 'g' || funcName[2] != 'l') - return NULL; -#else - if (funcName[0] != 'g' || funcName[1] != 'l') - return NULL; -#endif - - /* search extension functions first */ - func = get_extension_proc_address(funcName); - if (func) - return func; - - /* search static functions */ - func = get_static_proc_address(funcName); - if (func) - return func; - - /* generate entrypoint, dispatch offset must be filled in by the driver */ - entry = add_function_name(funcName); - if (entry == NULL) - return NULL; - - return entry->dispatch_stub; -} - - - -/** - * Return the name of the function at the given dispatch offset. - * This is only intended for debugging. - */ -const char * -_glapi_get_proc_name(GLuint offset) -{ - const char * n; - - /* search built-in functions */ - n = get_static_proc_name(offset); - if ( n != NULL ) { - return n; - } - - /* search added extension functions */ - return get_extension_proc_name(offset); -} - - - -/********************************************************************** - * GL API table functions. - */ - - -/** - * Return size of dispatch table struct as number of functions (or - * slots). - */ -GLuint -_glapi_get_dispatch_table_size(void) -{ - /* - * The dispatch table size (number of entries) is the size of the - * _glapi_table struct plus the number of dynamic entries we can add. - * The extra slots can be filled in by DRI drivers that register new - * extension functions. - */ - return FIRST_DYNAMIC_OFFSET + MAX_EXTENSION_FUNCS; -} - - -/** - * Make sure there are no NULL pointers in the given dispatch table. - * Intended for debugging purposes. - */ -void -_glapi_check_table_not_null(const struct _glapi_table *table) -{ -#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */ - const GLuint entries = _glapi_get_dispatch_table_size(); - const void **tab = (const void **) table; - GLuint i; - for (i = 1; i < entries; i++) { - assert(tab[i]); - } -#else - (void) table; -#endif -} - - -/** - * Do some spot checks to be sure that the dispatch table - * slots are assigned correctly. For debugging only. - */ -void -_glapi_check_table(const struct _glapi_table *table) -{ -#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */ - { - GLuint BeginOffset = _glapi_get_proc_offset("glBegin"); - char *BeginFunc = (char*) &table->Begin; - GLuint offset = (BeginFunc - (char *) table) / sizeof(void *); - assert(BeginOffset == offset); - } - { - GLuint viewportOffset = _glapi_get_proc_offset("glViewport"); - char *viewportFunc = (char*) &table->Viewport; - GLuint offset = (viewportFunc - (char *) table) / sizeof(void *); - assert(viewportOffset == offset); - } - { - GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer"); - char *VertexPointerFunc = (char*) &table->VertexPointer; - GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *); - assert(VertexPointerOffset == offset); - } - { - GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax"); - char *ResetMinMaxFunc = (char*) &table->ResetMinmax; - GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *); - assert(ResetMinMaxOffset == offset); - } - { - GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor"); - char *blendColorFunc = (char*) &table->BlendColor; - GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *); - assert(blendColorOffset == offset); - } - { - GLuint secondaryColor3fOffset = _glapi_get_proc_offset("glSecondaryColor3fEXT"); - char *secondaryColor3fFunc = (char*) &table->SecondaryColor3fEXT; - GLuint offset = (secondaryColor3fFunc - (char *) table) / sizeof(void *); - assert(secondaryColor3fOffset == offset); - } - { - GLuint pointParameterivOffset = _glapi_get_proc_offset("glPointParameterivNV"); - char *pointParameterivFunc = (char*) &table->PointParameterivNV; - GLuint offset = (pointParameterivFunc - (char *) table) / sizeof(void *); - assert(pointParameterivOffset == offset); - } - { - GLuint setFenceOffset = _glapi_get_proc_offset("glSetFenceNV"); - char *setFenceFunc = (char*) &table->SetFenceNV; - GLuint offset = (setFenceFunc - (char *) table) / sizeof(void *); - assert(setFenceOffset == offset); - } -#else - (void) table; -#endif -} +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 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. + */ + +/** + * \file glapi_getproc.c + * + * Code for implementing glXGetProcAddress(), etc. + * This was originally in glapi.c but refactored out. + */ + + +#include "glapi/glapi_priv.h" +#include "glapi/glapitable.h" + + +#define FIRST_DYNAMIC_OFFSET (sizeof(struct _glapi_table) / sizeof(void *)) + + +/********************************************************************** + * Static function management. + */ + + +#if !defined(DISPATCH_FUNCTION_SIZE) +# define NEED_FUNCTION_POINTER +#endif +#include "glapi/glprocs.h" + + +/** + * Search the table of static entrypoint functions for the named function + * and return the corresponding glprocs_table_t entry. + */ +static const glprocs_table_t * +get_static_proc( const char * n ) +{ + GLuint i; + for (i = 0; static_functions[i].Name_offset >= 0; i++) { + const char *testName = gl_string_table + static_functions[i].Name_offset; +#ifdef MANGLE + /* skip the prefix on the name */ + if (strcmp(testName, n + 1) == 0) +#else + if (strcmp(testName, n) == 0) +#endif + { + return &static_functions[i]; + } + } + return NULL; +} + + +/** + * Return dispatch table offset of the named static (built-in) function. + * Return -1 if function not found. + */ +static GLint +get_static_proc_offset(const char *funcName) +{ + const glprocs_table_t * const f = get_static_proc( funcName ); + if (f == NULL) { + return -1; + } + + return f->Offset; +} + + + +/** + * Return dispatch function address for the named static (built-in) function. + * Return NULL if function not found. + */ +static _glapi_proc +get_static_proc_address(const char *funcName) +{ + const glprocs_table_t * const f = get_static_proc( funcName ); + if (f == NULL) { + return NULL; + } + +#if defined(DISPATCH_FUNCTION_SIZE) && defined(GLX_INDIRECT_RENDERING) + return (f->Address == NULL) + ? get_entrypoint_address(f->Offset) + : f->Address; +#elif defined(DISPATCH_FUNCTION_SIZE) + return get_entrypoint_address(f->Offset); +#else + return f->Address; +#endif +} + + + +/** + * Return the name of the function at the given offset in the dispatch + * table. For debugging only. + */ +static const char * +get_static_proc_name( GLuint offset ) +{ + GLuint i; + for (i = 0; static_functions[i].Name_offset >= 0; i++) { + if (static_functions[i].Offset == offset) { + return gl_string_table + static_functions[i].Name_offset; + } + } + return NULL; +} + + + +/********************************************************************** + * Extension function management. + */ + + +/** + * Track information about a function added to the GL API. + */ +struct _glapi_function { + /** + * Name of the function. + */ + const char * name; + + + /** + * Text string that describes the types of the parameters passed to the + * named function. Parameter types are converted to characters using the + * following rules: + * - 'i' for \c GLint, \c GLuint, and \c GLenum + * - 'p' for any pointer type + * - 'f' for \c GLfloat and \c GLclampf + * - 'd' for \c GLdouble and \c GLclampd + */ + const char * parameter_signature; + + + /** + * Offset in the dispatch table where the pointer to the real function is + * located. If the driver has not requested that the named function be + * added to the dispatch table, this will have the value ~0. + */ + unsigned dispatch_offset; + + + /** + * Pointer to the dispatch stub for the named function. + * + * \todo + * The semantic of this field should be changed slightly. Currently, it + * is always expected to be non-\c NULL. However, it would be better to + * only allocate the entry-point stub when the application requests the + * function via \c glXGetProcAddress. This would save memory for all the + * functions that the driver exports but that the application never wants + * to call. + */ + _glapi_proc dispatch_stub; +}; + + +static struct _glapi_function ExtEntryTable[MAX_EXTENSION_FUNCS]; +static GLuint NumExtEntryPoints = 0; + + +static struct _glapi_function * +get_extension_proc(const char *funcName) +{ + GLuint i; + for (i = 0; i < NumExtEntryPoints; i++) { + if (strcmp(ExtEntryTable[i].name, funcName) == 0) { + return & ExtEntryTable[i]; + } + } + return NULL; +} + + +static GLint +get_extension_proc_offset(const char *funcName) +{ + const struct _glapi_function * const f = get_extension_proc( funcName ); + if (f == NULL) { + return -1; + } + + return f->dispatch_offset; +} + + +static _glapi_proc +get_extension_proc_address(const char *funcName) +{ + const struct _glapi_function * const f = get_extension_proc( funcName ); + if (f == NULL) { + return NULL; + } + + return f->dispatch_stub; +} + + +static const char * +get_extension_proc_name(GLuint offset) +{ + GLuint i; + for (i = 0; i < NumExtEntryPoints; i++) { + if (ExtEntryTable[i].dispatch_offset == offset) { + return ExtEntryTable[i].name; + } + } + return NULL; +} + + +/** + * strdup() is actually not a standard ANSI C or POSIX routine. + * Irix will not define it if ANSI mode is in effect. + */ +static char * +str_dup(const char *str) +{ + char *copy; + copy = (char*) malloc(strlen(str) + 1); + if (!copy) + return NULL; + strcpy(copy, str); + return copy; +} + + +/** + * Generate new entrypoint + * + * Use a temporary dispatch offset of ~0 (i.e. -1). Later, when the driver + * calls \c _glapi_add_dispatch we'll put in the proper offset. If that + * never happens, and the user calls this function, he'll segfault. That's + * what you get when you try calling a GL function that doesn't really exist. + * + * \param funcName Name of the function to create an entry-point for. + * + * \sa _glapi_add_entrypoint + */ + +static struct _glapi_function * +add_function_name( const char * funcName ) +{ + struct _glapi_function * entry = NULL; + _glapi_proc entrypoint = NULL; + char * name_dup = NULL; + + if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS) + return NULL; + + if (funcName == NULL) + return NULL; + + name_dup = str_dup(funcName); + if (name_dup == NULL) + return NULL; + + entrypoint = generate_entrypoint(~0); + + if (entrypoint == NULL) { + free(name_dup); + return NULL; + } + + entry = & ExtEntryTable[NumExtEntryPoints]; + NumExtEntryPoints++; + + entry->name = name_dup; + entry->parameter_signature = NULL; + entry->dispatch_offset = ~0; + entry->dispatch_stub = entrypoint; + + return entry; +} + + +static struct _glapi_function * +set_entry_info( struct _glapi_function * entry, const char * signature, unsigned offset ) +{ + char * sig_dup = NULL; + + if (signature == NULL) + return NULL; + + sig_dup = str_dup(signature); + if (sig_dup == NULL) + return NULL; + + fill_in_entrypoint_offset(entry->dispatch_stub, offset); + + entry->parameter_signature = sig_dup; + entry->dispatch_offset = offset; + + return entry; +} + + +/** + * Fill-in the dispatch stub for the named function. + * + * This function is intended to be called by a hardware driver. When called, + * a dispatch stub may be created created for the function. A pointer to this + * dispatch function will be returned by glXGetProcAddress. + * + * \param function_names Array of pointers to function names that should + * share a common dispatch offset. + * \param parameter_signature String representing the types of the parameters + * passed to the named function. Parameter types + * are converted to characters using the following + * rules: + * - 'i' for \c GLint, \c GLuint, and \c GLenum + * - 'p' for any pointer type + * - 'f' for \c GLfloat and \c GLclampf + * - 'd' for \c GLdouble and \c GLclampd + * + * \returns + * The offset in the dispatch table of the named function. A pointer to the + * driver's implementation of the named function should be stored at + * \c dispatch_table[\c offset]. Return -1 if error/problem. + * + * \sa glXGetProcAddress + * + * \warning + * This function can only handle up to 8 names at a time. As far as I know, + * the maximum number of names ever associated with an existing GL function is + * 4 (\c glPointParameterfSGIS, \c glPointParameterfEXT, + * \c glPointParameterfARB, and \c glPointParameterf), so this should not be + * too painful of a limitation. + * + * \todo + * Determine whether or not \c parameter_signature should be allowed to be + * \c NULL. It doesn't seem like much of a hardship for drivers to have to + * pass in an empty string. + * + * \todo + * Determine if code should be added to reject function names that start with + * 'glX'. + * + * \bug + * Add code to compare \c parameter_signature with the parameter signature of + * a static function. In order to do that, we need to find a way to \b get + * the parameter signature of a static function. + */ + +int +_glapi_add_dispatch( const char * const * function_names, + const char * parameter_signature ) +{ + static int next_dynamic_offset = FIRST_DYNAMIC_OFFSET; + const char * const real_sig = (parameter_signature != NULL) + ? parameter_signature : ""; + struct _glapi_function * entry[8]; + GLboolean is_static[8]; + unsigned i; + int offset = ~0; + + init_glapi_relocs_once(); + + (void) memset( is_static, 0, sizeof( is_static ) ); + (void) memset( entry, 0, sizeof( entry ) ); + + /* Find the _single_ dispatch offset for all function names that already + * exist (and have a dispatch offset). + */ + + for ( i = 0 ; function_names[i] != NULL ; i++ ) { + const char * funcName = function_names[i]; + int static_offset; + int extension_offset; + + if (funcName[0] != 'g' || funcName[1] != 'l') + return -1; + + /* search built-in functions */ + static_offset = get_static_proc_offset(funcName); + + if (static_offset >= 0) { + + is_static[i] = GL_TRUE; + + /* FIXME: Make sure the parameter signatures match! How do we get + * FIXME: the parameter signature for static functions? + */ + + if ( (offset != ~0) && (static_offset != offset) ) { + return -1; + } + + offset = static_offset; + + continue; + } + + /* search added extension functions */ + entry[i] = get_extension_proc(funcName); + + if (entry[i] != NULL) { + extension_offset = entry[i]->dispatch_offset; + + /* The offset may be ~0 if the function name was added by + * glXGetProcAddress but never filled in by the driver. + */ + + if (extension_offset == ~0) { + continue; + } + + if (strcmp(real_sig, entry[i]->parameter_signature) != 0) { + return -1; + } + + if ( (offset != ~0) && (extension_offset != offset) ) { + return -1; + } + + offset = extension_offset; + } + } + + /* If all function names are either new (or with no dispatch offset), + * allocate a new dispatch offset. + */ + + if (offset == ~0) { + offset = next_dynamic_offset; + next_dynamic_offset++; + } + + /* Fill in the dispatch offset for the new function names (and those with + * no dispatch offset). + */ + + for ( i = 0 ; function_names[i] != NULL ; i++ ) { + if (is_static[i]) { + continue; + } + + /* generate entrypoints for new function names */ + if (entry[i] == NULL) { + entry[i] = add_function_name( function_names[i] ); + if (entry[i] == NULL) { + /* FIXME: Possible memory leak here. */ + return -1; + } + } + + if (entry[i]->dispatch_offset == ~0) { + set_entry_info( entry[i], real_sig, offset ); + } + } + + return offset; +} + + +/** + * Return offset of entrypoint for named function within dispatch table. + */ +GLint +_glapi_get_proc_offset(const char *funcName) +{ + GLint offset; + + /* search extension functions first */ + offset = get_extension_proc_offset(funcName); + if (offset >= 0) + return offset; + + /* search static functions */ + return get_static_proc_offset(funcName); +} + + + +/** + * Return pointer to the named function. If the function name isn't found + * in the name of static functions, try generating a new API entrypoint on + * the fly with assembly language. + */ +_glapi_proc +_glapi_get_proc_address(const char *funcName) +{ + _glapi_proc func; + struct _glapi_function * entry; + + init_glapi_relocs_once(); + +#ifdef MANGLE + /* skip the prefix on the name */ + if (funcName[1] != 'g' || funcName[2] != 'l') + return NULL; +#else + if (funcName[0] != 'g' || funcName[1] != 'l') + return NULL; +#endif + + /* search extension functions first */ + func = get_extension_proc_address(funcName); + if (func) + return func; + + /* search static functions */ + func = get_static_proc_address(funcName); + if (func) + return func; + + /* generate entrypoint, dispatch offset must be filled in by the driver */ + entry = add_function_name(funcName); + if (entry == NULL) + return NULL; + + return entry->dispatch_stub; +} + + + +/** + * Return the name of the function at the given dispatch offset. + * This is only intended for debugging. + */ +const char * +_glapi_get_proc_name(GLuint offset) +{ + const char * n; + + /* search built-in functions */ + n = get_static_proc_name(offset); + if ( n != NULL ) { + return n; + } + + /* search added extension functions */ + return get_extension_proc_name(offset); +} + + + +/********************************************************************** + * GL API table functions. + */ + + +/** + * Return size of dispatch table struct as number of functions (or + * slots). + */ +GLuint +_glapi_get_dispatch_table_size(void) +{ + /* + * The dispatch table size (number of entries) is the size of the + * _glapi_table struct plus the number of dynamic entries we can add. + * The extra slots can be filled in by DRI drivers that register new + * extension functions. + */ + return FIRST_DYNAMIC_OFFSET + MAX_EXTENSION_FUNCS; +} + + +/** + * Make sure there are no NULL pointers in the given dispatch table. + * Intended for debugging purposes. + */ +void +_glapi_check_table_not_null(const struct _glapi_table *table) +{ +#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */ + const GLuint entries = _glapi_get_dispatch_table_size(); + const void **tab = (const void **) table; + GLuint i; + for (i = 1; i < entries; i++) { + assert(tab[i]); + } +#else + (void) table; +#endif +} + + +/** + * Do some spot checks to be sure that the dispatch table + * slots are assigned correctly. For debugging only. + */ +void +_glapi_check_table(const struct _glapi_table *table) +{ +#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */ + { + GLuint BeginOffset = _glapi_get_proc_offset("glBegin"); + char *BeginFunc = (char*) &table->Begin; + GLuint offset = (BeginFunc - (char *) table) / sizeof(void *); + assert(BeginOffset == offset); + } + { + GLuint viewportOffset = _glapi_get_proc_offset("glViewport"); + char *viewportFunc = (char*) &table->Viewport; + GLuint offset = (viewportFunc - (char *) table) / sizeof(void *); + assert(viewportOffset == offset); + } + { + GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer"); + char *VertexPointerFunc = (char*) &table->VertexPointer; + GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *); + assert(VertexPointerOffset == offset); + } + { + GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax"); + char *ResetMinMaxFunc = (char*) &table->ResetMinmax; + GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *); + assert(ResetMinMaxOffset == offset); + } + { + GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor"); + char *blendColorFunc = (char*) &table->BlendColor; + GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *); + assert(blendColorOffset == offset); + } + { + GLuint secondaryColor3fOffset = _glapi_get_proc_offset("glSecondaryColor3fEXT"); + char *secondaryColor3fFunc = (char*) &table->SecondaryColor3fEXT; + GLuint offset = (secondaryColor3fFunc - (char *) table) / sizeof(void *); + assert(secondaryColor3fOffset == offset); + } + { + GLuint pointParameterivOffset = _glapi_get_proc_offset("glPointParameterivNV"); + char *pointParameterivFunc = (char*) &table->PointParameterivNV; + GLuint offset = (pointParameterivFunc - (char *) table) / sizeof(void *); + assert(pointParameterivOffset == offset); + } + { + GLuint setFenceOffset = _glapi_get_proc_offset("glSetFenceNV"); + char *setFenceFunc = (char*) &table->SetFenceNV; + GLuint offset = (setFenceFunc - (char *) table) / sizeof(void *); + assert(setFenceOffset == offset); + } +#else + (void) table; +#endif +} diff --git a/mesalib/src/mapi/mapi/entry.c b/mesalib/src/mapi/mapi/entry.c index 410a68f2b..3d9168a72 100644 --- a/mesalib/src/mapi/mapi/entry.c +++ b/mesalib/src/mapi/mapi/entry.c @@ -1,98 +1,98 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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: - * Chia-I Wu - */ - -#include "entry.h" -#include "u_current.h" -#include "u_macros.h" - -/* define macros for use by assembly dispatchers */ -#define ENTRY_CURRENT_TABLE U_STRINGIFY(u_current_table) - -/* in bridge mode, mapi is a user of glapi */ -#ifdef MAPI_MODE_BRIDGE -#define ENTRY_CURRENT_TABLE_GET "_glapi_get_dispatch" -#else -#define ENTRY_CURRENT_TABLE_GET U_STRINGIFY(u_current_get_internal) -#endif - -#if defined(USE_X86_ASM) && defined(__GNUC__) -# ifdef GLX_USE_TLS -# include "entry_x86_tls.h" -# else -# include "entry_x86_tsd.h" -# endif -#elif defined(USE_X86_64_ASM) && defined(__GNUC__) && defined(GLX_USE_TLS) -# include "entry_x86-64_tls.h" -#else - -#include - -static INLINE const struct mapi_table * -entry_current_get(void) -{ -#ifdef MAPI_MODE_BRIDGE - return GET_DISPATCH(); -#else - return u_current_get(); -#endif -} - -/* C version of the public entries */ -#define MAPI_TMP_DEFINES -#define MAPI_TMP_PUBLIC_DECLARES -#define MAPI_TMP_PUBLIC_ENTRIES -#include "mapi_tmp.h" - -#ifndef MAPI_MODE_BRIDGE - -void -entry_patch_public(void) -{ -} - -mapi_func -entry_get_public(int slot) -{ - /* pubic_entries are defined by MAPI_TMP_PUBLIC_ENTRIES */ - return public_entries[slot]; -} - -mapi_func -entry_generate(int slot) -{ - return NULL; -} - -void -entry_patch(mapi_func entry, int slot) -{ -} - -#endif /* MAPI_MODE_BRIDGE */ - -#endif /* asm */ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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: + * Chia-I Wu + */ + +#include "entry.h" +#include "u_current.h" +#include "u_macros.h" + +/* define macros for use by assembly dispatchers */ +#define ENTRY_CURRENT_TABLE U_STRINGIFY(u_current_table) + +/* in bridge mode, mapi is a user of glapi */ +#ifdef MAPI_MODE_BRIDGE +#define ENTRY_CURRENT_TABLE_GET "_glapi_get_dispatch" +#else +#define ENTRY_CURRENT_TABLE_GET U_STRINGIFY(u_current_get_internal) +#endif + +#if defined(USE_X86_ASM) && defined(__GNUC__) +# ifdef GLX_USE_TLS +# include "entry_x86_tls.h" +# else +# include "entry_x86_tsd.h" +# endif +#elif defined(USE_X86_64_ASM) && defined(__GNUC__) && defined(GLX_USE_TLS) +# include "entry_x86-64_tls.h" +#else + +#include + +static INLINE const struct mapi_table * +entry_current_get(void) +{ +#ifdef MAPI_MODE_BRIDGE + return GET_DISPATCH(); +#else + return u_current_get(); +#endif +} + +/* C version of the public entries */ +#define MAPI_TMP_DEFINES +#define MAPI_TMP_PUBLIC_DECLARES +#define MAPI_TMP_PUBLIC_ENTRIES +#include "mapi_tmp.h" + +#ifndef MAPI_MODE_BRIDGE + +void +entry_patch_public(void) +{ +} + +mapi_func +entry_get_public(int slot) +{ + /* pubic_entries are defined by MAPI_TMP_PUBLIC_ENTRIES */ + return public_entries[slot]; +} + +mapi_func +entry_generate(int slot) +{ + return NULL; +} + +void +entry_patch(mapi_func entry, int slot) +{ +} + +#endif /* MAPI_MODE_BRIDGE */ + +#endif /* asm */ diff --git a/mesalib/src/mapi/mapi/entry.h b/mesalib/src/mapi/mapi/entry.h index 3ef37deeb..9df810004 100644 --- a/mesalib/src/mapi/mapi/entry.h +++ b/mesalib/src/mapi/mapi/entry.h @@ -1,48 +1,48 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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: - * Chia-I Wu - */ - -#ifndef _ENTRY_H_ -#define _ENTRY_H_ - -#include "u_compiler.h" - -typedef void (*mapi_func)(void); - -void -entry_patch_public(void); - -mapi_func -entry_get_public(int slot); - -mapi_func -entry_generate(int slot); - -void -entry_patch(mapi_func entry, int slot); - -#endif /* _ENTRY_H_ */ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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: + * Chia-I Wu + */ + +#ifndef _ENTRY_H_ +#define _ENTRY_H_ + +#include "u_compiler.h" + +typedef void (*mapi_func)(void); + +void +entry_patch_public(void); + +mapi_func +entry_get_public(int slot); + +mapi_func +entry_generate(int slot); + +void +entry_patch(mapi_func entry, int slot); + +#endif /* _ENTRY_H_ */ diff --git a/mesalib/src/mapi/mapi/mapi.c b/mesalib/src/mapi/mapi/mapi.c index c9115b702..b471c40b1 100644 --- a/mesalib/src/mapi/mapi/mapi.c +++ b/mesalib/src/mapi/mapi/mapi.c @@ -1,191 +1,191 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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: - * Chia-I Wu - */ - -#include -#include - -#include "u_current.h" -#include "u_thread.h" -#include "mapi.h" -#include "stub.h" -#include "table.h" - -/* dynamic stubs will run out before this array */ -static const struct mapi_stub *mapi_stub_map[MAPI_TABLE_NUM_SLOTS]; -static int mapi_num_stubs; - -static const struct mapi_stub * -get_stub(const char *name, const struct mapi_stub *alias) -{ - const struct mapi_stub *stub; - - stub = stub_find_public(name); - if (!stub) { - struct mapi_stub *dyn = stub_find_dynamic(name, 1); - if (dyn) { - stub_fix_dynamic(dyn, alias); - stub = dyn; - } - } - - return stub; -} - -/** - * Initialize mapi. spec consists of NULL-separated strings. The first string - * denotes the version. It is followed by variable numbers of entries. Each - * entry can have multiple names. An empty name terminates an entry. An empty - * entry terminates the spec. A spec of two entries, Foo and Bar, is as - * follows - * - * "1\0" - * "Foo\0" - * "FooEXT\0" - * "\0" - * "Bar\0" - * "\0" - */ -void -mapi_init(const char *spec) -{ - u_mutex_declare_static(mutex); - const char *p; - int ver, count; - - u_mutex_lock(mutex); - - /* already initialized */ - if (mapi_num_stubs) { - u_mutex_unlock(mutex); - return; - } - - count = 0; - p = spec; - - /* parse version string */ - ver = atoi(p); - if (ver != 1) { - u_mutex_unlock(mutex); - return; - } - p += strlen(p) + 1; - - while (*p) { - const struct mapi_stub *stub; - - stub = get_stub(p, NULL); - /* out of dynamic entries */ - if (!stub) - break; - p += strlen(p) + 1; - - while (*p) { - get_stub(p, stub); - p += strlen(p) + 1; - } - - mapi_stub_map[count++] = stub; - p++; - } - - mapi_num_stubs = count; - - u_mutex_unlock(mutex); -} - -/** - * Return the address of an entry. Optionally generate the entry if it does - * not exist. - */ -mapi_proc -mapi_get_proc_address(const char *name) -{ - const struct mapi_stub *stub; - - stub = stub_find_public(name); - if (!stub) - stub = stub_find_dynamic(name, 0); - - return (stub) ? (mapi_proc) stub_get_addr(stub) : NULL; -} - -/** - * Create a dispatch table. - */ -struct mapi_table * -mapi_table_create(void) -{ - const struct mapi_table *noop = table_get_noop(); - struct mapi_table *tbl; - - tbl = malloc(MAPI_TABLE_SIZE); - if (tbl) - memcpy(tbl, noop, MAPI_TABLE_SIZE); - - return tbl; -} - -/** - * Destroy a dispatch table. - */ -void -mapi_table_destroy(struct mapi_table *tbl) -{ - free(tbl); -} - -/** - * Fill a dispatch table. The order of the procs is determined when mapi_init - * is called. - */ -void -mapi_table_fill(struct mapi_table *tbl, const mapi_proc *procs) -{ - const struct mapi_table *noop = table_get_noop(); - int i; - - for (i = 0; i < mapi_num_stubs; i++) { - const struct mapi_stub *stub = mapi_stub_map[i]; - int slot = stub_get_slot(stub); - mapi_func func = (mapi_func) procs[i]; - - if (!func) - func = table_get_func(noop, slot); - table_set_func(tbl, slot, func); - } -} - -/** - * Make a dispatch table current. - */ -void -mapi_table_make_current(const struct mapi_table *tbl) -{ - u_current_set(tbl); -} +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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: + * Chia-I Wu + */ + +#include +#include + +#include "u_current.h" +#include "u_thread.h" +#include "mapi.h" +#include "stub.h" +#include "table.h" + +/* dynamic stubs will run out before this array */ +static const struct mapi_stub *mapi_stub_map[MAPI_TABLE_NUM_SLOTS]; +static int mapi_num_stubs; + +static const struct mapi_stub * +get_stub(const char *name, const struct mapi_stub *alias) +{ + const struct mapi_stub *stub; + + stub = stub_find_public(name); + if (!stub) { + struct mapi_stub *dyn = stub_find_dynamic(name, 1); + if (dyn) { + stub_fix_dynamic(dyn, alias); + stub = dyn; + } + } + + return stub; +} + +/** + * Initialize mapi. spec consists of NULL-separated strings. The first string + * denotes the version. It is followed by variable numbers of entries. Each + * entry can have multiple names. An empty name terminates an entry. An empty + * entry terminates the spec. A spec of two entries, Foo and Bar, is as + * follows + * + * "1\0" + * "Foo\0" + * "FooEXT\0" + * "\0" + * "Bar\0" + * "\0" + */ +void +mapi_init(const char *spec) +{ + u_mutex_declare_static(mutex); + const char *p; + int ver, count; + + u_mutex_lock(mutex); + + /* already initialized */ + if (mapi_num_stubs) { + u_mutex_unlock(mutex); + return; + } + + count = 0; + p = spec; + + /* parse version string */ + ver = atoi(p); + if (ver != 1) { + u_mutex_unlock(mutex); + return; + } + p += strlen(p) + 1; + + while (*p) { + const struct mapi_stub *stub; + + stub = get_stub(p, NULL); + /* out of dynamic entries */ + if (!stub) + break; + p += strlen(p) + 1; + + while (*p) { + get_stub(p, stub); + p += strlen(p) + 1; + } + + mapi_stub_map[count++] = stub; + p++; + } + + mapi_num_stubs = count; + + u_mutex_unlock(mutex); +} + +/** + * Return the address of an entry. Optionally generate the entry if it does + * not exist. + */ +mapi_proc +mapi_get_proc_address(const char *name) +{ + const struct mapi_stub *stub; + + stub = stub_find_public(name); + if (!stub) + stub = stub_find_dynamic(name, 0); + + return (stub) ? (mapi_proc) stub_get_addr(stub) : NULL; +} + +/** + * Create a dispatch table. + */ +struct mapi_table * +mapi_table_create(void) +{ + const struct mapi_table *noop = table_get_noop(); + struct mapi_table *tbl; + + tbl = malloc(MAPI_TABLE_SIZE); + if (tbl) + memcpy(tbl, noop, MAPI_TABLE_SIZE); + + return tbl; +} + +/** + * Destroy a dispatch table. + */ +void +mapi_table_destroy(struct mapi_table *tbl) +{ + free(tbl); +} + +/** + * Fill a dispatch table. The order of the procs is determined when mapi_init + * is called. + */ +void +mapi_table_fill(struct mapi_table *tbl, const mapi_proc *procs) +{ + const struct mapi_table *noop = table_get_noop(); + int i; + + for (i = 0; i < mapi_num_stubs; i++) { + const struct mapi_stub *stub = mapi_stub_map[i]; + int slot = stub_get_slot(stub); + mapi_func func = (mapi_func) procs[i]; + + if (!func) + func = table_get_func(noop, slot); + table_set_func(tbl, slot, func); + } +} + +/** + * Make a dispatch table current. + */ +void +mapi_table_make_current(const struct mapi_table *tbl) +{ + u_current_set(tbl); +} diff --git a/mesalib/src/mapi/mapi/stub.c b/mesalib/src/mapi/mapi/stub.c index 8d9eb4c8b..99b475a3b 100644 --- a/mesalib/src/mapi/mapi/stub.c +++ b/mesalib/src/mapi/mapi/stub.c @@ -1,207 +1,207 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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: - * Chia-I Wu - */ - -#include -#include -#include - -#include "u_current.h" -#include "u_thread.h" -#include "entry.h" -#include "stub.h" -#include "table.h" - -#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) - -struct mapi_stub { - const void *name; - int slot; - mapi_func addr; -}; - -/* define public_string_pool and public_stubs */ -#define MAPI_TMP_PUBLIC_STUBS -#include "mapi_tmp.h" - -static struct mapi_stub dynamic_stubs[MAPI_TABLE_NUM_DYNAMIC]; -static int num_dynamic_stubs; -static int next_dynamic_slot = MAPI_TABLE_NUM_STATIC; - -void -stub_init_once(void) -{ -#ifdef PTHREADS - static pthread_once_t once = PTHREAD_ONCE_INIT; - pthread_once(&once, entry_patch_public); -#else - static int first = 1; - if (first) { - first = 0; - entry_patch_public(); - } -#endif -} - -static int -stub_compare(const void *key, const void *elem) -{ - const char *name = (const char *) key; - const struct mapi_stub *stub = (const struct mapi_stub *) elem; - const char *stub_name; - - stub_name = &public_string_pool[(unsigned long) stub->name]; - - return strcmp(name, stub_name); -} - -/** - * Return the public stub with the given name. - */ -const struct mapi_stub * -stub_find_public(const char *name) -{ - return (const struct mapi_stub *) bsearch(name, public_stubs, - ARRAY_SIZE(public_stubs), sizeof(public_stubs[0]), stub_compare); -} - -/** - * Add a dynamic stub. - */ -static struct mapi_stub * -stub_add_dynamic(const char *name) -{ - struct mapi_stub *stub; - int idx; - - idx = num_dynamic_stubs; - /* minus 1 to make sure we can never reach the last slot */ - if (idx >= MAPI_TABLE_NUM_DYNAMIC - 1) - return NULL; - - stub = &dynamic_stubs[idx]; - - /* dispatch to the last slot, which is reserved for no-op */ - stub->addr = entry_generate( - MAPI_TABLE_NUM_STATIC + MAPI_TABLE_NUM_DYNAMIC - 1); - if (!stub->addr) - return NULL; - - stub->name = (const void *) name; - /* to be fixed later */ - stub->slot = -1; - - num_dynamic_stubs = idx + 1; - - return stub; -} - -/** - * Return the dynamic stub with the given name. If no such stub exists and - * generate is true, a new stub is generated. - */ -struct mapi_stub * -stub_find_dynamic(const char *name, int generate) -{ - u_mutex_declare_static(dynamic_mutex); - struct mapi_stub *stub = NULL; - int count, i; - - u_mutex_lock(dynamic_mutex); - - if (generate) - assert(!stub_find_public(name)); - - count = num_dynamic_stubs; - for (i = 0; i < count; i++) { - if (strcmp(name, (const char *) dynamic_stubs[i].name) == 0) { - stub = &dynamic_stubs[i]; - break; - } - } - - /* generate a dynamic stub */ - if (generate && !stub) - stub = stub_add_dynamic(name); - - u_mutex_unlock(dynamic_mutex); - - return stub; -} - -void -stub_fix_dynamic(struct mapi_stub *stub, const struct mapi_stub *alias) -{ - int slot; - - if (stub->slot >= 0) - return; - - if (alias) - slot = alias->slot; - else - slot = next_dynamic_slot++; - - entry_patch(stub->addr, slot); - stub->slot = slot; -} - -/** - * Return the name of a stub. - */ -const char * -stub_get_name(const struct mapi_stub *stub) -{ - const char *name; - - if (stub >= public_stubs && - stub < public_stubs + ARRAY_SIZE(public_stubs)) - name = &public_string_pool[(unsigned long) stub->name]; - else - name = (const char *) stub->name; - - return name; -} - -/** - * Return the slot of a stub. - */ -int -stub_get_slot(const struct mapi_stub *stub) -{ - return stub->slot; -} - -/** - * Return the address of a stub. - */ -mapi_func -stub_get_addr(const struct mapi_stub *stub) -{ - assert(stub->addr || (unsigned int) stub->slot < MAPI_TABLE_NUM_STATIC); - return (stub->addr) ? stub->addr : entry_get_public(stub->slot); -} +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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: + * Chia-I Wu + */ + +#include +#include +#include + +#include "u_current.h" +#include "u_thread.h" +#include "entry.h" +#include "stub.h" +#include "table.h" + +#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) + +struct mapi_stub { + const void *name; + int slot; + mapi_func addr; +}; + +/* define public_string_pool and public_stubs */ +#define MAPI_TMP_PUBLIC_STUBS +#include "mapi_tmp.h" + +static struct mapi_stub dynamic_stubs[MAPI_TABLE_NUM_DYNAMIC]; +static int num_dynamic_stubs; +static int next_dynamic_slot = MAPI_TABLE_NUM_STATIC; + +void +stub_init_once(void) +{ +#ifdef PTHREADS + static pthread_once_t once = PTHREAD_ONCE_INIT; + pthread_once(&once, entry_patch_public); +#else + static int first = 1; + if (first) { + first = 0; + entry_patch_public(); + } +#endif +} + +static int +stub_compare(const void *key, const void *elem) +{ + const char *name = (const char *) key; + const struct mapi_stub *stub = (const struct mapi_stub *) elem; + const char *stub_name; + + stub_name = &public_string_pool[(unsigned long) stub->name]; + + return strcmp(name, stub_name); +} + +/** + * Return the public stub with the given name. + */ +const struct mapi_stub * +stub_find_public(const char *name) +{ + return (const struct mapi_stub *) bsearch(name, public_stubs, + ARRAY_SIZE(public_stubs), sizeof(public_stubs[0]), stub_compare); +} + +/** + * Add a dynamic stub. + */ +static struct mapi_stub * +stub_add_dynamic(const char *name) +{ + struct mapi_stub *stub; + int idx; + + idx = num_dynamic_stubs; + /* minus 1 to make sure we can never reach the last slot */ + if (idx >= MAPI_TABLE_NUM_DYNAMIC - 1) + return NULL; + + stub = &dynamic_stubs[idx]; + + /* dispatch to the last slot, which is reserved for no-op */ + stub->addr = entry_generate( + MAPI_TABLE_NUM_STATIC + MAPI_TABLE_NUM_DYNAMIC - 1); + if (!stub->addr) + return NULL; + + stub->name = (const void *) name; + /* to be fixed later */ + stub->slot = -1; + + num_dynamic_stubs = idx + 1; + + return stub; +} + +/** + * Return the dynamic stub with the given name. If no such stub exists and + * generate is true, a new stub is generated. + */ +struct mapi_stub * +stub_find_dynamic(const char *name, int generate) +{ + u_mutex_declare_static(dynamic_mutex); + struct mapi_stub *stub = NULL; + int count, i; + + u_mutex_lock(dynamic_mutex); + + if (generate) + assert(!stub_find_public(name)); + + count = num_dynamic_stubs; + for (i = 0; i < count; i++) { + if (strcmp(name, (const char *) dynamic_stubs[i].name) == 0) { + stub = &dynamic_stubs[i]; + break; + } + } + + /* generate a dynamic stub */ + if (generate && !stub) + stub = stub_add_dynamic(name); + + u_mutex_unlock(dynamic_mutex); + + return stub; +} + +void +stub_fix_dynamic(struct mapi_stub *stub, const struct mapi_stub *alias) +{ + int slot; + + if (stub->slot >= 0) + return; + + if (alias) + slot = alias->slot; + else + slot = next_dynamic_slot++; + + entry_patch(stub->addr, slot); + stub->slot = slot; +} + +/** + * Return the name of a stub. + */ +const char * +stub_get_name(const struct mapi_stub *stub) +{ + const char *name; + + if (stub >= public_stubs && + stub < public_stubs + ARRAY_SIZE(public_stubs)) + name = &public_string_pool[(unsigned long) stub->name]; + else + name = (const char *) stub->name; + + return name; +} + +/** + * Return the slot of a stub. + */ +int +stub_get_slot(const struct mapi_stub *stub) +{ + return stub->slot; +} + +/** + * Return the address of a stub. + */ +mapi_func +stub_get_addr(const struct mapi_stub *stub) +{ + assert(stub->addr || (unsigned int) stub->slot < MAPI_TABLE_NUM_STATIC); + return (stub->addr) ? stub->addr : entry_get_public(stub->slot); +} diff --git a/mesalib/src/mapi/mapi/stub.h b/mesalib/src/mapi/mapi/stub.h index 6d45bdb5a..b2b6f1839 100644 --- a/mesalib/src/mapi/mapi/stub.h +++ b/mesalib/src/mapi/mapi/stub.h @@ -1,57 +1,57 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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: - * Chia-I Wu - */ - -#ifndef _STUB_H_ -#define _STUB_H_ - -#include "entry.h" - -struct mapi_stub; - -void -stub_init_once(void); - -const struct mapi_stub * -stub_find_public(const char *name); - -struct mapi_stub * -stub_find_dynamic(const char *name, int generate); - -void -stub_fix_dynamic(struct mapi_stub *stub, const struct mapi_stub *alias); - -const char * -stub_get_name(const struct mapi_stub *stub); - -int -stub_get_slot(const struct mapi_stub *stub); - -mapi_func -stub_get_addr(const struct mapi_stub *stub); - -#endif /* _STUB_H_ */ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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: + * Chia-I Wu + */ + +#ifndef _STUB_H_ +#define _STUB_H_ + +#include "entry.h" + +struct mapi_stub; + +void +stub_init_once(void); + +const struct mapi_stub * +stub_find_public(const char *name); + +struct mapi_stub * +stub_find_dynamic(const char *name, int generate); + +void +stub_fix_dynamic(struct mapi_stub *stub, const struct mapi_stub *alias); + +const char * +stub_get_name(const struct mapi_stub *stub); + +int +stub_get_slot(const struct mapi_stub *stub); + +mapi_func +stub_get_addr(const struct mapi_stub *stub); + +#endif /* _STUB_H_ */ diff --git a/mesalib/src/mapi/mapi/table.c b/mesalib/src/mapi/mapi/table.c index df2272c98..9bb9f654a 100644 --- a/mesalib/src/mapi/mapi/table.c +++ b/mesalib/src/mapi/mapi/table.c @@ -1,56 +1,56 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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: - * Chia-I Wu - */ - -#include -#include - -#include "table.h" - -static void -noop_warn(const char *name) -{ - static int debug = -1; - - if (debug < 0) - debug = (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")); - - if (debug) - fprintf(stderr, "%s is no-op\n", name); -} - -static int -noop_generic(void) -{ - noop_warn("function"); - return 0; -} - -/* define noop_array */ -#define MAPI_TMP_DEFINES -#define MAPI_TMP_NOOP_ARRAY -#include "mapi_tmp.h" +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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: + * Chia-I Wu + */ + +#include +#include + +#include "table.h" + +static void +noop_warn(const char *name) +{ + static int debug = -1; + + if (debug < 0) + debug = (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")); + + if (debug) + fprintf(stderr, "%s is no-op\n", name); +} + +static int +noop_generic(void) +{ + noop_warn("function"); + return 0; +} + +/* define noop_array */ +#define MAPI_TMP_DEFINES +#define MAPI_TMP_NOOP_ARRAY +#include "mapi_tmp.h" diff --git a/mesalib/src/mapi/mapi/table.h b/mesalib/src/mapi/mapi/table.h index a77e1ab56..d84523f77 100644 --- a/mesalib/src/mapi/mapi/table.h +++ b/mesalib/src/mapi/mapi/table.h @@ -1,72 +1,72 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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: - * Chia-I Wu - */ - -#ifndef _TABLE_H_ -#define _TABLE_H_ - -#include "u_compiler.h" -#include "entry.h" - -#define MAPI_TMP_TABLE -#include "mapi_tmp.h" - -#define MAPI_TABLE_NUM_SLOTS (MAPI_TABLE_NUM_STATIC + MAPI_TABLE_NUM_DYNAMIC) -#define MAPI_TABLE_SIZE (MAPI_TABLE_NUM_SLOTS * sizeof(mapi_func)) - -extern const mapi_func table_noop_array[]; - -/** - * Get the no-op dispatch table. - */ -static INLINE const struct mapi_table * -table_get_noop(void) -{ - return (const struct mapi_table *) table_noop_array; -} - -/** - * Set the function of a slot. - */ -static INLINE void -table_set_func(struct mapi_table *tbl, int slot, mapi_func func) -{ - mapi_func *funcs = (mapi_func *) tbl; - funcs[slot] = func; -} - -/** - * Return the function of a slot. - */ -static INLINE mapi_func -table_get_func(const struct mapi_table *tbl, int slot) -{ - const mapi_func *funcs = (const mapi_func *) tbl; - return funcs[slot]; -} - -#endif /* _TABLE_H_ */ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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: + * Chia-I Wu + */ + +#ifndef _TABLE_H_ +#define _TABLE_H_ + +#include "u_compiler.h" +#include "entry.h" + +#define MAPI_TMP_TABLE +#include "mapi_tmp.h" + +#define MAPI_TABLE_NUM_SLOTS (MAPI_TABLE_NUM_STATIC + MAPI_TABLE_NUM_DYNAMIC) +#define MAPI_TABLE_SIZE (MAPI_TABLE_NUM_SLOTS * sizeof(mapi_func)) + +extern const mapi_func table_noop_array[]; + +/** + * Get the no-op dispatch table. + */ +static INLINE const struct mapi_table * +table_get_noop(void) +{ + return (const struct mapi_table *) table_noop_array; +} + +/** + * Set the function of a slot. + */ +static INLINE void +table_set_func(struct mapi_table *tbl, int slot, mapi_func func) +{ + mapi_func *funcs = (mapi_func *) tbl; + funcs[slot] = func; +} + +/** + * Return the function of a slot. + */ +static INLINE mapi_func +table_get_func(const struct mapi_table *tbl, int slot) +{ + const mapi_func *funcs = (const mapi_func *) tbl; + return funcs[slot]; +} + +#endif /* _TABLE_H_ */ diff --git a/mesalib/src/mesa/.gitignore b/mesalib/src/mesa/.gitignore new file mode 100644 index 000000000..ce83eaf47 --- /dev/null +++ b/mesalib/src/mesa/.gitignore @@ -0,0 +1,5 @@ +*/gen_matypes +*/matypes.h +depend.es* +depend.es* +objs-es* diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c index ca120578d..93fa3c745 100644 --- a/mesalib/src/mesa/drivers/common/driverfuncs.c +++ b/mesalib/src/mesa/drivers/common/driverfuncs.c @@ -91,24 +91,14 @@ _mesa_init_driver_functions(struct dd_function_table *driver) /* Texture functions */ driver->ChooseTextureFormat = _mesa_choose_tex_format; - driver->TexImage1D = _mesa_store_teximage1d; - driver->TexImage2D = _mesa_store_teximage2d; - driver->TexImage3D = _mesa_store_teximage3d; - driver->TexSubImage1D = _mesa_store_texsubimage1d; - driver->TexSubImage2D = _mesa_store_texsubimage2d; - driver->TexSubImage3D = _mesa_store_texsubimage3d; + driver->TexImage = _mesa_store_teximage; + driver->TexSubImage = _mesa_store_texsubimage; driver->GetTexImage = _mesa_meta_GetTexImage; - driver->CopyTexSubImage1D = _mesa_meta_CopyTexSubImage1D; - driver->CopyTexSubImage2D = _mesa_meta_CopyTexSubImage2D; - driver->CopyTexSubImage3D = _mesa_meta_CopyTexSubImage3D; + driver->CopyTexSubImage = _mesa_meta_CopyTexSubImage; driver->GenerateMipmap = _mesa_meta_GenerateMipmap; driver->TestProxyTexImage = _mesa_test_proxy_teximage; - driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d; - driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d; - driver->CompressedTexImage3D = _mesa_store_compressed_teximage3d; - driver->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d; - driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d; - driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d; + driver->CompressedTexImage = _mesa_store_compressed_teximage; + driver->CompressedTexSubImage = _mesa_store_compressed_texsubimage; driver->GetCompressedTexImage = _mesa_get_compressed_teximage; driver->BindTexture = NULL; driver->NewTextureObject = _mesa_new_texture_object; diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.h b/mesalib/src/mesa/drivers/common/driverfuncs.h index 31549f65a..212f30742 100644 --- a/mesalib/src/mesa/drivers/common/driverfuncs.h +++ b/mesalib/src/mesa/drivers/common/driverfuncs.h @@ -1,37 +1,37 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 1999-2007 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 DRIVERFUNCS_H -#define DRIVERFUNCS_H - -extern void -_mesa_init_driver_functions(struct dd_function_table *driver); - - -extern void -_mesa_init_driver_state(struct gl_context *ctx); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 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 DRIVERFUNCS_H +#define DRIVERFUNCS_H + +extern void +_mesa_init_driver_functions(struct dd_function_table *driver); + + +extern void +_mesa_init_driver_state(struct gl_context *ctx); + + +#endif diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index a20e41972..8d7e90126 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -3117,17 +3117,15 @@ get_temp_image_type(struct gl_context *ctx, GLenum baseFormat) * Helper for _mesa_meta_CopyTexSubImage1/2/3D() functions. * Have to be careful with locking and meta state for pixel transfer. */ -static void -copy_tex_sub_image(struct gl_context *ctx, - GLuint dims, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height) +void +_mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + struct gl_renderbuffer *rb, + GLint x, GLint y, + GLsizei width, GLsizei height) { struct gl_texture_object *texObj = texImage->TexObject; - const GLenum target = texObj->Target; GLenum format, type; GLint bpp; void *buf; @@ -3152,7 +3150,7 @@ copy_tex_sub_image(struct gl_context *ctx, type = get_temp_image_type(ctx, format); bpp = _mesa_bytes_per_pixel(format, type); if (bpp <= 0) { - _mesa_problem(ctx, "Bad bpp in meta copy_tex_sub_image()"); + _mesa_problem(ctx, "Bad bpp in _mesa_meta_CopyTexSubImage()"); return; } @@ -3181,21 +3179,11 @@ copy_tex_sub_image(struct gl_context *ctx, * Store texture data (with pixel transfer ops) */ _mesa_meta_begin(ctx, MESA_META_PIXEL_STORE); - if (target == GL_TEXTURE_1D) { - ctx->Driver.TexSubImage1D(ctx, texImage, - xoffset, width, - format, type, buf, &ctx->Unpack); - } - else if (target == GL_TEXTURE_3D) { - ctx->Driver.TexSubImage3D(ctx, texImage, - xoffset, yoffset, zoffset, width, height, 1, - format, type, buf, &ctx->Unpack); - } - else { - ctx->Driver.TexSubImage2D(ctx, texImage, - xoffset, yoffset, width, height, - format, type, buf, &ctx->Unpack); - } + + ctx->Driver.TexSubImage(ctx, dims, texImage, + xoffset, yoffset, zoffset, width, height, 1, + format, type, buf, &ctx->Unpack); + _mesa_meta_end(ctx); _mesa_lock_texture(ctx, texObj); /* re-lock */ @@ -3204,44 +3192,6 @@ copy_tex_sub_image(struct gl_context *ctx, } -void -_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, GLsizei width) -{ - copy_tex_sub_image(ctx, 1, texImage, xoffset, 0, 0, - rb, x, y, width, 1); -} - - -void -_mesa_meta_CopyTexSubImage2D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height) -{ - copy_tex_sub_image(ctx, 2, texImage, xoffset, yoffset, 0, - rb, x, y, width, height); -} - - -void -_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height) -{ - copy_tex_sub_image(ctx, 3, texImage, xoffset, yoffset, zoffset, - rb, x, y, width, height); -} - - /** * Decompress a texture image by drawing a quad with the compressed * texture and reading the pixels out of the color buffer. @@ -3269,6 +3219,7 @@ decompress_texture_image(struct gl_context *ctx, }; struct vertex verts[4]; GLuint fboDrawSave, fboReadSave; + GLuint rbSave; if (slice > 0) { assert(target == GL_TEXTURE_3D || @@ -3285,6 +3236,7 @@ decompress_texture_image(struct gl_context *ctx, /* save fbo bindings (not saved by _mesa_meta_begin()) */ fboDrawSave = ctx->DrawBuffer->Name; fboReadSave = ctx->ReadBuffer->Name; + rbSave = ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0; _mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_PIXEL_STORE); @@ -3305,6 +3257,7 @@ decompress_texture_image(struct gl_context *ctx, /* alloc dest surface */ if (width > decompress->Width || height > decompress->Height) { + _mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, decompress->RBO); _mesa_RenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA, width, height); decompress->Width = width; @@ -3437,6 +3390,7 @@ decompress_texture_image(struct gl_context *ctx, _mesa_BindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fboDrawSave); _mesa_BindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fboReadSave); } + _mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, rbSave); } diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h index de039b575..7a80b1dde 100644 --- a/mesalib/src/mesa/drivers/common/meta.h +++ b/mesalib/src/mesa/drivers/common/meta.h @@ -111,27 +111,12 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj); extern void -_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, GLsizei width); - -extern void -_mesa_meta_CopyTexSubImage2D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height); - -extern void -_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height); +_mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + struct gl_renderbuffer *rb, + GLint x, GLint y, + GLsizei width, GLsizei height); extern void _mesa_meta_GetTexImage(struct gl_context *ctx, diff --git a/mesalib/src/mesa/drivers/dri/.gitignore b/mesalib/src/mesa/drivers/dri/.gitignore new file mode 100644 index 000000000..f3c7a7c5d --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/.gitignore b/mesalib/src/mesa/drivers/dri/common/xmlpool/.gitignore new file mode 100644 index 000000000..a5a437849 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/.gitignore @@ -0,0 +1,5 @@ +de +es +fr +nl +sv diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile b/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile index ae3d89938..b71629e9f 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile @@ -1,96 +1,96 @@ -# 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 -# .po file. - -# More information: -# - info gettext - -# The set of supported languages. Add languages as needed. -POS=de.po es.po nl.po fr.po sv.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 - $(PYTHON2) $(PYTHON_FLAGS) 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 +# 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 +# .po file. + +# More information: +# - info gettext + +# The set of supported languages. Add languages as needed. +POS=de.po es.po nl.po fr.po sv.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 + $(PYTHON2) $(PYTHON_FLAGS) 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/mesalib/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py b/mesalib/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py index f5ac5e25b..7398c4cd0 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py @@ -1,191 +1,191 @@ -#!/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= \3 \4=gettext(" \5= \6=") \7 -# ENUM format: \1 \2=gettext(" \3= \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*') -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 - 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) +#!/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= \3 \4=gettext(" \5= \6=") \7 +# ENUM format: \1 \2=gettext(" \3= \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*') +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 + 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/mesalib/src/mesa/drivers/dri/swrast/.gitignore b/mesalib/src/mesa/drivers/dri/swrast/.gitignore new file mode 100644 index 000000000..f3c7a7c5d --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/swrast/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/mesalib/src/mesa/gl.pc.in b/mesalib/src/mesa/gl.pc.in index 616819063..2d3bc917e 100644 --- a/mesalib/src/mesa/gl.pc.in +++ b/mesalib/src/mesa/gl.pc.in @@ -1,13 +1,13 @@ -prefix=@INSTALL_DIR@ -exec_prefix=${prefix} -libdir=@INSTALL_LIB_DIR@ -includedir=@INSTALL_INC_DIR@ - -Name: gl -Description: Mesa OpenGL library -Requires.private: @GL_PC_REQ_PRIV@ -Version: @VERSION@ -Libs: -L${libdir} -l@GL_LIB@ -Libs.private: @GL_PC_LIB_PRIV@ -Cflags: -I${includedir} @GL_PC_CFLAGS@ -glx_tls: @GLX_TLS@ +prefix=@INSTALL_DIR@ +exec_prefix=${prefix} +libdir=@INSTALL_LIB_DIR@ +includedir=@INSTALL_INC_DIR@ + +Name: gl +Description: Mesa OpenGL library +Requires.private: @GL_PC_REQ_PRIV@ +Version: @VERSION@ +Libs: -L${libdir} -l@GL_LIB@ +Libs.private: @GL_PC_LIB_PRIV@ +Cflags: -I${includedir} @GL_PC_CFLAGS@ +glx_tls: @GLX_TLS@ diff --git a/mesalib/src/mesa/main/.gitignore b/mesalib/src/mesa/main/.gitignore new file mode 100644 index 000000000..caed74f40 --- /dev/null +++ b/mesalib/src/mesa/main/.gitignore @@ -0,0 +1,13 @@ +api_exec_es1.c +api_exec_es2.c +dispatch.h +enums.c +get_es1.c +get_es2.c +git_sha1.h +git_sha1.h.tmp +api_exec_es1_dispatch.h +api_exec_es1_remap_helper.h +api_exec_es2_dispatch.h +api_exec_es2_remap_helper.h +remap_helper.h diff --git a/mesalib/src/mesa/main/api_loopback.c b/mesalib/src/mesa/main/api_loopback.c index fb9d781f7..c438307d8 100644 --- a/mesalib/src/mesa/main/api_loopback.c +++ b/mesalib/src/mesa/main/api_loopback.c @@ -1,1725 +1,1725 @@ -/** - * \file api_loopback.c - * - * \author Keith Whitwell - */ - -/* - * 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. - */ - - -#include "glheader.h" -#include "macros.h" -#include "api_loopback.h" -#include "mtypes.h" -#include "glapi/glapi.h" -#include "glapi/glthread.h" -#include "main/dispatch.h" -#include "mfeatures.h" - -/* KW: A set of functions to convert unusual Color/Normal/Vertex/etc - * calls to a smaller set of driver-provided formats. Currently just - * go back to dispatch to find these (eg. call glNormal3f directly), - * hence 'loopback'. - * - * The driver must supply all of the remaining entry points, which are - * listed in dd.h. The easiest way for a driver to do this is to - * install the supplied software t&l module. - */ -#define COLORF(r,g,b,a) CALL_Color4f(GET_DISPATCH(), (r,g,b,a)) -#define VERTEX2(x,y) CALL_Vertex2f(GET_DISPATCH(), (x,y)) -#define VERTEX3(x,y,z) CALL_Vertex3f(GET_DISPATCH(), (x,y,z)) -#define VERTEX4(x,y,z,w) CALL_Vertex4f(GET_DISPATCH(), (x,y,z,w)) -#define NORMAL(x,y,z) CALL_Normal3f(GET_DISPATCH(), (x,y,z)) -#define TEXCOORD1(s) CALL_TexCoord1f(GET_DISPATCH(), (s)) -#define TEXCOORD2(s,t) CALL_TexCoord2f(GET_DISPATCH(), (s,t)) -#define TEXCOORD3(s,t,u) CALL_TexCoord3f(GET_DISPATCH(), (s,t,u)) -#define TEXCOORD4(s,t,u,v) CALL_TexCoord4f(GET_DISPATCH(), (s,t,u,v)) -#define INDEX(c) CALL_Indexf(GET_DISPATCH(), (c)) -#define MULTI_TEXCOORD1(z,s) CALL_MultiTexCoord1fARB(GET_DISPATCH(), (z,s)) -#define MULTI_TEXCOORD2(z,s,t) CALL_MultiTexCoord2fARB(GET_DISPATCH(), (z,s,t)) -#define MULTI_TEXCOORD3(z,s,t,u) CALL_MultiTexCoord3fARB(GET_DISPATCH(), (z,s,t,u)) -#define MULTI_TEXCOORD4(z,s,t,u,v) CALL_MultiTexCoord4fARB(GET_DISPATCH(), (z,s,t,u,v)) -#define EVALCOORD1(x) CALL_EvalCoord1f(GET_DISPATCH(), (x)) -#define EVALCOORD2(x,y) CALL_EvalCoord2f(GET_DISPATCH(), (x,y)) -#define MATERIALFV(a,b,c) CALL_Materialfv(GET_DISPATCH(), (a,b,c)) -#define RECTF(a,b,c,d) CALL_Rectf(GET_DISPATCH(), (a,b,c,d)) - -#define FOGCOORDF(x) CALL_FogCoordfEXT(GET_DISPATCH(), (x)) -#define SECONDARYCOLORF(a,b,c) CALL_SecondaryColor3fEXT(GET_DISPATCH(), (a,b,c)) - -#define ATTRIB1NV(index,x) CALL_VertexAttrib1fNV(GET_DISPATCH(), (index,x)) -#define ATTRIB2NV(index,x,y) CALL_VertexAttrib2fNV(GET_DISPATCH(), (index,x,y)) -#define ATTRIB3NV(index,x,y,z) CALL_VertexAttrib3fNV(GET_DISPATCH(), (index,x,y,z)) -#define ATTRIB4NV(index,x,y,z,w) CALL_VertexAttrib4fNV(GET_DISPATCH(), (index,x,y,z,w)) - -#define ATTRIB1ARB(index,x) CALL_VertexAttrib1fARB(GET_DISPATCH(), (index,x)) -#define ATTRIB2ARB(index,x,y) CALL_VertexAttrib2fARB(GET_DISPATCH(), (index,x,y)) -#define ATTRIB3ARB(index,x,y,z) CALL_VertexAttrib3fARB(GET_DISPATCH(), (index,x,y,z)) -#define ATTRIB4ARB(index,x,y,z,w) CALL_VertexAttrib4fARB(GET_DISPATCH(), (index,x,y,z,w)) - -#define ATTRIBI_1I(index,x) CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index,x)) -#define ATTRIBI_1UI(index,x) CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index,x)) -#define ATTRIBI_4I(index,x,y,z,w) CALL_VertexAttribI4iEXT(GET_DISPATCH(), (index,x,y,z,w)) - -#define ATTRIBI_4UI(index,x,y,z,w) CALL_VertexAttribI4uiEXT(GET_DISPATCH(), (index,x,y,z,w)) - - -#if FEATURE_beginend - - -static void GLAPIENTRY -loopback_Color3b_f( GLbyte red, GLbyte green, GLbyte blue ) -{ - COLORF( BYTE_TO_FLOAT(red), - BYTE_TO_FLOAT(green), - BYTE_TO_FLOAT(blue), - 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3d_f( GLdouble red, GLdouble green, GLdouble blue ) -{ - COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3i_f( GLint red, GLint green, GLint blue ) -{ - COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), - INT_TO_FLOAT(blue), 1.0); -} - -static void GLAPIENTRY -loopback_Color3s_f( GLshort red, GLshort green, GLshort blue ) -{ - COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), - SHORT_TO_FLOAT(blue), 1.0); -} - -static void GLAPIENTRY -loopback_Color3ui_f( GLuint red, GLuint green, GLuint blue ) -{ - COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), - UINT_TO_FLOAT(blue), 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3us_f( GLushort red, GLushort green, GLushort blue ) -{ - COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), - USHORT_TO_FLOAT(blue), 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3ub_f( GLubyte red, GLubyte green, GLubyte blue ) -{ - COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), - UBYTE_TO_FLOAT(blue), 1.0 ); -} - - -static void GLAPIENTRY -loopback_Color3bv_f( const GLbyte *v ) -{ - COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), - BYTE_TO_FLOAT(v[2]), 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3dv_f( const GLdouble *v ) -{ - COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3iv_f( const GLint *v ) -{ - COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), - INT_TO_FLOAT(v[2]), 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3sv_f( const GLshort *v ) -{ - COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), - SHORT_TO_FLOAT(v[2]), 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3uiv_f( const GLuint *v ) -{ - COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), - UINT_TO_FLOAT(v[2]), 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3usv_f( const GLushort *v ) -{ - COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), - USHORT_TO_FLOAT(v[2]), 1.0 ); -} - -static void GLAPIENTRY -loopback_Color3ubv_f( const GLubyte *v ) -{ - COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), - UBYTE_TO_FLOAT(v[2]), 1.0 ); -} - - -static void GLAPIENTRY -loopback_Color4b_f( GLbyte red, GLbyte green, GLbyte blue, - GLbyte alpha ) -{ - COLORF( BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green), - BYTE_TO_FLOAT(blue), BYTE_TO_FLOAT(alpha) ); -} - -static void GLAPIENTRY -loopback_Color4d_f( GLdouble red, GLdouble green, GLdouble blue, - GLdouble alpha ) -{ - COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, (GLfloat) alpha ); -} - -static void GLAPIENTRY -loopback_Color4i_f( GLint red, GLint green, GLint blue, GLint alpha ) -{ - COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), - INT_TO_FLOAT(blue), INT_TO_FLOAT(alpha) ); -} - -static void GLAPIENTRY -loopback_Color4s_f( GLshort red, GLshort green, GLshort blue, - GLshort alpha ) -{ - COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), - SHORT_TO_FLOAT(blue), SHORT_TO_FLOAT(alpha) ); -} - -static void GLAPIENTRY -loopback_Color4ui_f( GLuint red, GLuint green, GLuint blue, GLuint alpha ) -{ - COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), - UINT_TO_FLOAT(blue), UINT_TO_FLOAT(alpha) ); -} - -static void GLAPIENTRY -loopback_Color4us_f( GLushort red, GLushort green, GLushort blue, GLushort alpha ) -{ - COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), - USHORT_TO_FLOAT(blue), USHORT_TO_FLOAT(alpha) ); -} - -static void GLAPIENTRY -loopback_Color4ub_f( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) -{ - COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), - UBYTE_TO_FLOAT(blue), UBYTE_TO_FLOAT(alpha) ); -} - - -static void GLAPIENTRY -loopback_Color4iv_f( const GLint *v ) -{ - COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), - INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) ); -} - - -static void GLAPIENTRY -loopback_Color4bv_f( const GLbyte *v ) -{ - COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), - BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3]) ); -} - -static void GLAPIENTRY -loopback_Color4dv_f( const GLdouble *v ) -{ - COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); -} - - -static void GLAPIENTRY -loopback_Color4sv_f( const GLshort *v) -{ - COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), - SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3]) ); -} - - -static void GLAPIENTRY -loopback_Color4uiv_f( const GLuint *v) -{ - COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), - UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3]) ); -} - -static void GLAPIENTRY -loopback_Color4usv_f( const GLushort *v) -{ - COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), - USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3]) ); -} - -static void GLAPIENTRY -loopback_Color4ubv_f( const GLubyte *v) -{ - COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), - UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]) ); -} - - -static void GLAPIENTRY -loopback_FogCoorddEXT( GLdouble d ) -{ - FOGCOORDF( (GLfloat) d ); -} - -static void GLAPIENTRY -loopback_FogCoorddvEXT( const GLdouble *v ) -{ - FOGCOORDF( (GLfloat) *v ); -} - - -static void GLAPIENTRY -loopback_Indexd( GLdouble c ) -{ - INDEX( (GLfloat) c ); -} - -static void GLAPIENTRY -loopback_Indexi( GLint c ) -{ - INDEX( (GLfloat) c ); -} - -static void GLAPIENTRY -loopback_Indexs( GLshort c ) -{ - INDEX( (GLfloat) c ); -} - -static void GLAPIENTRY -loopback_Indexub( GLubyte c ) -{ - INDEX( (GLfloat) c ); -} - -static void GLAPIENTRY -loopback_Indexdv( const GLdouble *c ) -{ - INDEX( (GLfloat) *c ); -} - -static void GLAPIENTRY -loopback_Indexiv( const GLint *c ) -{ - INDEX( (GLfloat) *c ); -} - -static void GLAPIENTRY -loopback_Indexsv( const GLshort *c ) -{ - INDEX( (GLfloat) *c ); -} - -static void GLAPIENTRY -loopback_Indexubv( const GLubyte *c ) -{ - INDEX( (GLfloat) *c ); -} - - -static void GLAPIENTRY -loopback_EdgeFlagv(const GLboolean *flag) -{ - CALL_EdgeFlag(GET_DISPATCH(), (*flag)); -} - - -static void GLAPIENTRY -loopback_Normal3b( GLbyte nx, GLbyte ny, GLbyte nz ) -{ - NORMAL( BYTE_TO_FLOAT(nx), BYTE_TO_FLOAT(ny), BYTE_TO_FLOAT(nz) ); -} - -static void GLAPIENTRY -loopback_Normal3d( GLdouble nx, GLdouble ny, GLdouble nz ) -{ - NORMAL((GLfloat) nx, (GLfloat) ny, (GLfloat) nz); -} - -static void GLAPIENTRY -loopback_Normal3i( GLint nx, GLint ny, GLint nz ) -{ - NORMAL( INT_TO_FLOAT(nx), INT_TO_FLOAT(ny), INT_TO_FLOAT(nz) ); -} - -static void GLAPIENTRY -loopback_Normal3s( GLshort nx, GLshort ny, GLshort nz ) -{ - NORMAL( SHORT_TO_FLOAT(nx), SHORT_TO_FLOAT(ny), SHORT_TO_FLOAT(nz) ); -} - -static void GLAPIENTRY -loopback_Normal3bv( const GLbyte *v ) -{ - NORMAL( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]) ); -} - -static void GLAPIENTRY -loopback_Normal3dv( const GLdouble *v ) -{ - NORMAL( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} - -static void GLAPIENTRY -loopback_Normal3iv( const GLint *v ) -{ - NORMAL( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]) ); -} - -static void GLAPIENTRY -loopback_Normal3sv( const GLshort *v ) -{ - NORMAL( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]) ); -} - -static void GLAPIENTRY -loopback_TexCoord1d( GLdouble s ) -{ - TEXCOORD1((GLfloat) s); -} - -static void GLAPIENTRY -loopback_TexCoord1i( GLint s ) -{ - TEXCOORD1((GLfloat) s); -} - -static void GLAPIENTRY -loopback_TexCoord1s( GLshort s ) -{ - TEXCOORD1((GLfloat) s); -} - -static void GLAPIENTRY -loopback_TexCoord2d( GLdouble s, GLdouble t ) -{ - TEXCOORD2((GLfloat) s,(GLfloat) t); -} - -static void GLAPIENTRY -loopback_TexCoord2s( GLshort s, GLshort t ) -{ - TEXCOORD2((GLfloat) s,(GLfloat) t); -} - -static void GLAPIENTRY -loopback_TexCoord2i( GLint s, GLint t ) -{ - TEXCOORD2((GLfloat) s,(GLfloat) t); -} - -static void GLAPIENTRY -loopback_TexCoord3d( GLdouble s, GLdouble t, GLdouble r ) -{ - TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); -} - -static void GLAPIENTRY -loopback_TexCoord3i( GLint s, GLint t, GLint r ) -{ - TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); -} - -static void GLAPIENTRY -loopback_TexCoord3s( GLshort s, GLshort t, GLshort r ) -{ - TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); -} - -static void GLAPIENTRY -loopback_TexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ) -{ - TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); -} - -static void GLAPIENTRY -loopback_TexCoord4i( GLint s, GLint t, GLint r, GLint q ) -{ - TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); -} - -static void GLAPIENTRY -loopback_TexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ) -{ - TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); -} - -static void GLAPIENTRY -loopback_TexCoord1dv( const GLdouble *v ) -{ - TEXCOORD1((GLfloat) v[0]); -} - -static void GLAPIENTRY -loopback_TexCoord1iv( const GLint *v ) -{ - TEXCOORD1((GLfloat) v[0]); -} - -static void GLAPIENTRY -loopback_TexCoord1sv( const GLshort *v ) -{ - TEXCOORD1((GLfloat) v[0]); -} - -static void GLAPIENTRY -loopback_TexCoord2dv( const GLdouble *v ) -{ - TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); -} - -static void GLAPIENTRY -loopback_TexCoord2iv( const GLint *v ) -{ - TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); -} - -static void GLAPIENTRY -loopback_TexCoord2sv( const GLshort *v ) -{ - TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); -} - -static void GLAPIENTRY -loopback_TexCoord3dv( const GLdouble *v ) -{ - TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); -} - -static void GLAPIENTRY -loopback_TexCoord3iv( const GLint *v ) -{ - TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); -} - -static void GLAPIENTRY -loopback_TexCoord3sv( const GLshort *v ) -{ - TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); -} - -static void GLAPIENTRY -loopback_TexCoord4dv( const GLdouble *v ) -{ - TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_TexCoord4iv( const GLint *v ) -{ - TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_TexCoord4sv( const GLshort *v ) -{ - TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_Vertex2d( GLdouble x, GLdouble y ) -{ - VERTEX2( (GLfloat) x, (GLfloat) y ); -} - -static void GLAPIENTRY -loopback_Vertex2i( GLint x, GLint y ) -{ - VERTEX2( (GLfloat) x, (GLfloat) y ); -} - -static void GLAPIENTRY -loopback_Vertex2s( GLshort x, GLshort y ) -{ - VERTEX2( (GLfloat) x, (GLfloat) y ); -} - -static void GLAPIENTRY -loopback_Vertex3d( GLdouble x, GLdouble y, GLdouble z ) -{ - VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); -} - -static void GLAPIENTRY -loopback_Vertex3i( GLint x, GLint y, GLint z ) -{ - VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); -} - -static void GLAPIENTRY -loopback_Vertex3s( GLshort x, GLshort y, GLshort z ) -{ - VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); -} - -static void GLAPIENTRY -loopback_Vertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) -{ - VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); -} - -static void GLAPIENTRY -loopback_Vertex4i( GLint x, GLint y, GLint z, GLint w ) -{ - VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); -} - -static void GLAPIENTRY -loopback_Vertex4s( GLshort x, GLshort y, GLshort z, GLshort w ) -{ - VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); -} - -static void GLAPIENTRY -loopback_Vertex2dv( const GLdouble *v ) -{ - VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); -} - -static void GLAPIENTRY -loopback_Vertex2iv( const GLint *v ) -{ - VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); -} - -static void GLAPIENTRY -loopback_Vertex2sv( const GLshort *v ) -{ - VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); -} - -static void GLAPIENTRY -loopback_Vertex3dv( const GLdouble *v ) -{ - VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} - -static void GLAPIENTRY -loopback_Vertex3iv( const GLint *v ) -{ - VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} - -static void GLAPIENTRY -loopback_Vertex3sv( const GLshort *v ) -{ - VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} - -static void GLAPIENTRY -loopback_Vertex4dv( const GLdouble *v ) -{ - VERTEX4( (GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3] ); -} - -static void GLAPIENTRY -loopback_Vertex4iv( const GLint *v ) -{ - VERTEX4( (GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3] ); -} - -static void GLAPIENTRY -loopback_Vertex4sv( const GLshort *v ) -{ - VERTEX4( (GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord1dARB(GLenum target, GLdouble s) -{ - MULTI_TEXCOORD1( target, (GLfloat) s ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord1dvARB(GLenum target, const GLdouble *v) -{ - MULTI_TEXCOORD1( target, (GLfloat) v[0] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord1iARB(GLenum target, GLint s) -{ - MULTI_TEXCOORD1( target, (GLfloat) s ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord1ivARB(GLenum target, const GLint *v) -{ - MULTI_TEXCOORD1( target, (GLfloat) v[0] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord1sARB(GLenum target, GLshort s) -{ - MULTI_TEXCOORD1( target, (GLfloat) s ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord1svARB(GLenum target, const GLshort *v) -{ - MULTI_TEXCOORD1( target, (GLfloat) v[0] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t) -{ - MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord2dvARB(GLenum target, const GLdouble *v) -{ - MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord2iARB(GLenum target, GLint s, GLint t) -{ - MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord2ivARB(GLenum target, const GLint *v) -{ - MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord2sARB(GLenum target, GLshort s, GLshort t) -{ - MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord2svARB(GLenum target, const GLshort *v) -{ - MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r) -{ - MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord3dvARB(GLenum target, const GLdouble *v) -{ - MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r) -{ - MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord3ivARB(GLenum target, const GLint *v) -{ - MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r) -{ - MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord3svARB(GLenum target, const GLshort *v) -{ - MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) -{ - MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, - (GLfloat) r, (GLfloat) q ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord4dvARB(GLenum target, const GLdouble *v) -{ - MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q) -{ - MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, - (GLfloat) r, (GLfloat) q ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord4ivARB(GLenum target, const GLint *v) -{ - MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3] ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) -{ - MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, - (GLfloat) r, (GLfloat) q ); -} - -static void GLAPIENTRY -loopback_MultiTexCoord4svARB(GLenum target, const GLshort *v) -{ - MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3] ); -} - -static void GLAPIENTRY -loopback_EvalCoord2dv( const GLdouble *u ) -{ - EVALCOORD2( (GLfloat) u[0], (GLfloat) u[1] ); -} - -static void GLAPIENTRY -loopback_EvalCoord2fv( const GLfloat *u ) -{ - EVALCOORD2( u[0], u[1] ); -} - -static void GLAPIENTRY -loopback_EvalCoord2d( GLdouble u, GLdouble v ) -{ - EVALCOORD2( (GLfloat) u, (GLfloat) v ); -} - -static void GLAPIENTRY -loopback_EvalCoord1dv( const GLdouble *u ) -{ - EVALCOORD1( (GLfloat) *u ); -} - -static void GLAPIENTRY -loopback_EvalCoord1fv( const GLfloat *u ) -{ - EVALCOORD1( (GLfloat) *u ); -} - -static void GLAPIENTRY -loopback_EvalCoord1d( GLdouble u ) -{ - EVALCOORD1( (GLfloat) u ); -} - -static void GLAPIENTRY -loopback_Materialf( GLenum face, GLenum pname, GLfloat param ) -{ - GLfloat fparam[4]; - fparam[0] = param; - MATERIALFV( face, pname, fparam ); -} - -static void GLAPIENTRY -loopback_Materiali(GLenum face, GLenum pname, GLint param ) -{ - GLfloat p = (GLfloat) param; - MATERIALFV(face, pname, &p); -} - -static void GLAPIENTRY -loopback_Materialiv(GLenum face, GLenum pname, const GLint *params ) -{ - GLfloat fparam[4]; - switch (pname) { - case GL_AMBIENT: - case GL_DIFFUSE: - case GL_SPECULAR: - case GL_EMISSION: - case GL_AMBIENT_AND_DIFFUSE: - fparam[0] = INT_TO_FLOAT( params[0] ); - fparam[1] = INT_TO_FLOAT( params[1] ); - fparam[2] = INT_TO_FLOAT( params[2] ); - fparam[3] = INT_TO_FLOAT( params[3] ); - break; - case GL_SHININESS: - fparam[0] = (GLfloat) params[0]; - break; - case GL_COLOR_INDEXES: - fparam[0] = (GLfloat) params[0]; - fparam[1] = (GLfloat) params[1]; - fparam[2] = (GLfloat) params[2]; - break; - default: - ; - } - MATERIALFV(face, pname, fparam); -} - - -static void GLAPIENTRY -loopback_Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) -{ - RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); -} - -static void GLAPIENTRY -loopback_Rectdv(const GLdouble *v1, const GLdouble *v2) -{ - RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); -} - -static void GLAPIENTRY -loopback_Rectfv(const GLfloat *v1, const GLfloat *v2) -{ - RECTF(v1[0], v1[1], v2[0], v2[1]); -} - -static void GLAPIENTRY -loopback_Recti(GLint x1, GLint y1, GLint x2, GLint y2) -{ - RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); -} - -static void GLAPIENTRY -loopback_Rectiv(const GLint *v1, const GLint *v2) -{ - RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); -} - -static void GLAPIENTRY -loopback_Rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2) -{ - RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); -} - -static void GLAPIENTRY -loopback_Rectsv(const GLshort *v1, const GLshort *v2) -{ - RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); -} - -static void GLAPIENTRY -loopback_SecondaryColor3bEXT_f( GLbyte red, GLbyte green, GLbyte blue ) -{ - SECONDARYCOLORF( BYTE_TO_FLOAT(red), - BYTE_TO_FLOAT(green), - BYTE_TO_FLOAT(blue) ); -} - -static void GLAPIENTRY -loopback_SecondaryColor3dEXT_f( GLdouble red, GLdouble green, GLdouble blue ) -{ - SECONDARYCOLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue ); -} - -static void GLAPIENTRY -loopback_SecondaryColor3iEXT_f( GLint red, GLint green, GLint blue ) -{ - SECONDARYCOLORF( INT_TO_FLOAT(red), - INT_TO_FLOAT(green), - INT_TO_FLOAT(blue)); -} - -static void GLAPIENTRY -loopback_SecondaryColor3sEXT_f( GLshort red, GLshort green, GLshort blue ) -{ - SECONDARYCOLORF(SHORT_TO_FLOAT(red), - SHORT_TO_FLOAT(green), - SHORT_TO_FLOAT(blue)); -} - -static void GLAPIENTRY -loopback_SecondaryColor3uiEXT_f( GLuint red, GLuint green, GLuint blue ) -{ - SECONDARYCOLORF(UINT_TO_FLOAT(red), - UINT_TO_FLOAT(green), - UINT_TO_FLOAT(blue)); -} - -static void GLAPIENTRY -loopback_SecondaryColor3usEXT_f( GLushort red, GLushort green, GLushort blue ) -{ - SECONDARYCOLORF(USHORT_TO_FLOAT(red), - USHORT_TO_FLOAT(green), - USHORT_TO_FLOAT(blue)); -} - -static void GLAPIENTRY -loopback_SecondaryColor3ubEXT_f( GLubyte red, GLubyte green, GLubyte blue ) -{ - SECONDARYCOLORF(UBYTE_TO_FLOAT(red), - UBYTE_TO_FLOAT(green), - UBYTE_TO_FLOAT(blue)); -} - -static void GLAPIENTRY -loopback_SecondaryColor3bvEXT_f( const GLbyte *v ) -{ - SECONDARYCOLORF(BYTE_TO_FLOAT(v[0]), - BYTE_TO_FLOAT(v[1]), - BYTE_TO_FLOAT(v[2])); -} - -static void GLAPIENTRY -loopback_SecondaryColor3dvEXT_f( const GLdouble *v ) -{ - SECONDARYCOLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); -} -static void GLAPIENTRY -loopback_SecondaryColor3ivEXT_f( const GLint *v ) -{ - SECONDARYCOLORF(INT_TO_FLOAT(v[0]), - INT_TO_FLOAT(v[1]), - INT_TO_FLOAT(v[2])); -} - -static void GLAPIENTRY -loopback_SecondaryColor3svEXT_f( const GLshort *v ) -{ - SECONDARYCOLORF(SHORT_TO_FLOAT(v[0]), - SHORT_TO_FLOAT(v[1]), - SHORT_TO_FLOAT(v[2])); -} - -static void GLAPIENTRY -loopback_SecondaryColor3uivEXT_f( const GLuint *v ) -{ - SECONDARYCOLORF(UINT_TO_FLOAT(v[0]), - UINT_TO_FLOAT(v[1]), - UINT_TO_FLOAT(v[2])); -} - -static void GLAPIENTRY -loopback_SecondaryColor3usvEXT_f( const GLushort *v ) -{ - SECONDARYCOLORF(USHORT_TO_FLOAT(v[0]), - USHORT_TO_FLOAT(v[1]), - USHORT_TO_FLOAT(v[2])); -} - -static void GLAPIENTRY -loopback_SecondaryColor3ubvEXT_f( const GLubyte *v ) -{ - SECONDARYCOLORF(UBYTE_TO_FLOAT(v[0]), - UBYTE_TO_FLOAT(v[1]), - UBYTE_TO_FLOAT(v[2])); -} - - -/* - * GL_NV_vertex_program: - * Always loop-back to one of the VertexAttrib[1234]f[v]NV functions. - * Note that attribute indexes DO alias conventional vertex attributes. - */ - -static void GLAPIENTRY -loopback_VertexAttrib1sNV(GLuint index, GLshort x) -{ - ATTRIB1NV(index, (GLfloat) x); -} - -static void GLAPIENTRY -loopback_VertexAttrib1dNV(GLuint index, GLdouble x) -{ - ATTRIB1NV(index, (GLfloat) x); -} - -static void GLAPIENTRY -loopback_VertexAttrib2sNV(GLuint index, GLshort x, GLshort y) -{ - ATTRIB2NV(index, (GLfloat) x, y); -} - -static void GLAPIENTRY -loopback_VertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y) -{ - ATTRIB2NV(index, (GLfloat) x, (GLfloat) y); -} - -static void GLAPIENTRY -loopback_VertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z) -{ - ATTRIB3NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z); -} - -static void GLAPIENTRY -loopback_VertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z) -{ - ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); -} - -static void GLAPIENTRY -loopback_VertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) -{ - ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -loopback_VertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -loopback_VertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) -{ - ATTRIB4NV(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), - UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); -} - -static void GLAPIENTRY -loopback_VertexAttrib1svNV(GLuint index, const GLshort *v) -{ - ATTRIB1NV(index, (GLfloat) v[0]); -} - -static void GLAPIENTRY -loopback_VertexAttrib1dvNV(GLuint index, const GLdouble *v) -{ - ATTRIB1NV(index, (GLfloat) v[0]); -} - -static void GLAPIENTRY -loopback_VertexAttrib2svNV(GLuint index, const GLshort *v) -{ - ATTRIB2NV(index, (GLfloat) v[0], (GLfloat) v[1]); -} - -static void GLAPIENTRY -loopback_VertexAttrib2dvNV(GLuint index, const GLdouble *v) -{ - ATTRIB2NV(index, (GLfloat) v[0], (GLfloat) v[1]); -} - -static void GLAPIENTRY -loopback_VertexAttrib3svNV(GLuint index, const GLshort *v) -{ - ATTRIB3NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); -} - -static void GLAPIENTRY -loopback_VertexAttrib3dvNV(GLuint index, const GLdouble *v) -{ - ATTRIB3NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4svNV(GLuint index, const GLshort *v) -{ - ATTRIB4NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], - (GLfloat)v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4dvNV(GLuint index, const GLdouble *v) -{ - ATTRIB4NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4ubvNV(GLuint index, const GLubyte *v) -{ - ATTRIB4NV(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), - UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); -} - - -static void GLAPIENTRY -loopback_VertexAttribs1svNV(GLuint index, GLsizei n, const GLshort *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib1svNV(index + i, v + i); -} - -static void GLAPIENTRY -loopback_VertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - ATTRIB1NV(index + i, v[i]); -} - -static void GLAPIENTRY -loopback_VertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib1dvNV(index + i, v + i); -} - -static void GLAPIENTRY -loopback_VertexAttribs2svNV(GLuint index, GLsizei n, const GLshort *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib2svNV(index + i, v + 2 * i); -} - -static void GLAPIENTRY -loopback_VertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - ATTRIB2NV(index + i, v[2 * i], v[2 * i + 1]); -} - -static void GLAPIENTRY -loopback_VertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib2dvNV(index + i, v + 2 * i); -} - -static void GLAPIENTRY -loopback_VertexAttribs3svNV(GLuint index, GLsizei n, const GLshort *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib3svNV(index + i, v + 3 * i); -} - -static void GLAPIENTRY -loopback_VertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - ATTRIB3NV(index + i, v[3 * i], v[3 * i + 1], v[3 * i + 2]); -} - -static void GLAPIENTRY -loopback_VertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib3dvNV(index + i, v + 3 * i); -} - -static void GLAPIENTRY -loopback_VertexAttribs4svNV(GLuint index, GLsizei n, const GLshort *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib4svNV(index + i, v + 4 * i); -} - -static void GLAPIENTRY -loopback_VertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - ATTRIB4NV(index + i, v[4 * i], v[4 * i + 1], v[4 * i + 2], v[4 * i + 3]); -} - -static void GLAPIENTRY -loopback_VertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib4dvNV(index + i, v + 4 * i); -} - -static void GLAPIENTRY -loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v) -{ - GLint i; - for (i = n - 1; i >= 0; i--) - loopback_VertexAttrib4ubvNV(index + i, v + 4 * i); -} - - -/* - * GL_ARB_vertex_program - * Always loop-back to one of the VertexAttrib[1234]f[v]ARB functions. - * Note that attribute indexes do NOT alias conventional attributes. - */ - -static void GLAPIENTRY -loopback_VertexAttrib1sARB(GLuint index, GLshort x) -{ - ATTRIB1ARB(index, (GLfloat) x); -} - -static void GLAPIENTRY -loopback_VertexAttrib1dARB(GLuint index, GLdouble x) -{ - ATTRIB1ARB(index, (GLfloat) x); -} - -static void GLAPIENTRY -loopback_VertexAttrib2sARB(GLuint index, GLshort x, GLshort y) -{ - ATTRIB2ARB(index, (GLfloat) x, y); -} - -static void GLAPIENTRY -loopback_VertexAttrib2dARB(GLuint index, GLdouble x, GLdouble y) -{ - ATTRIB2ARB(index, (GLfloat) x, (GLfloat) y); -} - -static void GLAPIENTRY -loopback_VertexAttrib3sARB(GLuint index, GLshort x, GLshort y, GLshort z) -{ - ATTRIB3ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z); -} - -static void GLAPIENTRY -loopback_VertexAttrib3dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z) -{ - ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); -} - -static void GLAPIENTRY -loopback_VertexAttrib4sARB(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) -{ - ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -loopback_VertexAttrib4dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -loopback_VertexAttrib1svARB(GLuint index, const GLshort *v) -{ - ATTRIB1ARB(index, (GLfloat) v[0]); -} - -static void GLAPIENTRY -loopback_VertexAttrib1dvARB(GLuint index, const GLdouble *v) -{ - ATTRIB1ARB(index, (GLfloat) v[0]); -} - -static void GLAPIENTRY -loopback_VertexAttrib2svARB(GLuint index, const GLshort *v) -{ - ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]); -} - -static void GLAPIENTRY -loopback_VertexAttrib2dvARB(GLuint index, const GLdouble *v) -{ - ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]); -} - -static void GLAPIENTRY -loopback_VertexAttrib3svARB(GLuint index, const GLshort *v) -{ - ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); -} - -static void GLAPIENTRY -loopback_VertexAttrib3dvARB(GLuint index, const GLdouble *v) -{ - ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4svARB(GLuint index, const GLshort *v) -{ - ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], - (GLfloat)v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4dvARB(GLuint index, const GLdouble *v) -{ - ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4bvARB(GLuint index, const GLbyte * v) -{ - ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4ivARB(GLuint index, const GLint * v) -{ - ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4ubvARB(GLuint index, const GLubyte * v) -{ - ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4usvARB(GLuint index, const GLushort * v) -{ - ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4uivARB(GLuint index, const GLuint * v) -{ - ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttrib4NbvARB(GLuint index, const GLbyte * v) -{ - ATTRIB4ARB(index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), - BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3])); -} - -static void GLAPIENTRY -loopback_VertexAttrib4NsvARB(GLuint index, const GLshort * v) -{ - ATTRIB4ARB(index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), - SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3])); -} - -static void GLAPIENTRY -loopback_VertexAttrib4NivARB(GLuint index, const GLint * v) -{ - ATTRIB4ARB(index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), - INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3])); -} - -static void GLAPIENTRY -loopback_VertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) -{ - ATTRIB4ARB(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), - UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); -} - -static void GLAPIENTRY -loopback_VertexAttrib4NubvARB(GLuint index, const GLubyte * v) -{ - ATTRIB4ARB(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), - UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); -} - -static void GLAPIENTRY -loopback_VertexAttrib4NusvARB(GLuint index, const GLushort * v) -{ - ATTRIB4ARB(index, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), - USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3])); -} - -static void GLAPIENTRY -loopback_VertexAttrib4NuivARB(GLuint index, const GLuint * v) -{ - ATTRIB4ARB(index, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), - UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3])); -} - - - -/** - * GL_EXT_gpu_shader / GL 3.0 signed/unsigned integer-valued attributes. - * Note that attribute indexes do NOT alias conventional attributes. - */ - -static void GLAPIENTRY -loopback_VertexAttribI1iv(GLuint index, const GLint *v) -{ - ATTRIBI_1I(index, v[0]); -} - -static void GLAPIENTRY -loopback_VertexAttribI1uiv(GLuint index, const GLuint *v) -{ - ATTRIBI_1UI(index, v[0]); -} - -static void GLAPIENTRY -loopback_VertexAttribI4bv(GLuint index, const GLbyte *v) -{ - ATTRIBI_4I(index, v[0], v[1], v[2], v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttribI4sv(GLuint index, const GLshort *v) -{ - ATTRIBI_4I(index, v[0], v[1], v[2], v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttribI4ubv(GLuint index, const GLubyte *v) -{ - ATTRIBI_4UI(index, v[0], v[1], v[2], v[3]); -} - -static void GLAPIENTRY -loopback_VertexAttribI4usv(GLuint index, const GLushort *v) -{ - ATTRIBI_4UI(index, v[0], v[1], v[2], v[3]); -} - - - - -/* - * This code never registers handlers for any of the entry points - * listed in vtxfmt.h. - */ -void -_mesa_loopback_init_api_table( struct _glapi_table *dest ) -{ - SET_Color3b(dest, loopback_Color3b_f); - SET_Color3d(dest, loopback_Color3d_f); - SET_Color3i(dest, loopback_Color3i_f); - SET_Color3s(dest, loopback_Color3s_f); - SET_Color3ui(dest, loopback_Color3ui_f); - SET_Color3us(dest, loopback_Color3us_f); - SET_Color3ub(dest, loopback_Color3ub_f); - SET_Color4b(dest, loopback_Color4b_f); - SET_Color4d(dest, loopback_Color4d_f); - SET_Color4i(dest, loopback_Color4i_f); - SET_Color4s(dest, loopback_Color4s_f); - SET_Color4ui(dest, loopback_Color4ui_f); - SET_Color4us(dest, loopback_Color4us_f); - SET_Color4ub(dest, loopback_Color4ub_f); - SET_Color3bv(dest, loopback_Color3bv_f); - SET_Color3dv(dest, loopback_Color3dv_f); - SET_Color3iv(dest, loopback_Color3iv_f); - SET_Color3sv(dest, loopback_Color3sv_f); - SET_Color3uiv(dest, loopback_Color3uiv_f); - SET_Color3usv(dest, loopback_Color3usv_f); - SET_Color3ubv(dest, loopback_Color3ubv_f); - SET_Color4bv(dest, loopback_Color4bv_f); - SET_Color4dv(dest, loopback_Color4dv_f); - SET_Color4iv(dest, loopback_Color4iv_f); - SET_Color4sv(dest, loopback_Color4sv_f); - SET_Color4uiv(dest, loopback_Color4uiv_f); - SET_Color4usv(dest, loopback_Color4usv_f); - SET_Color4ubv(dest, loopback_Color4ubv_f); - - SET_SecondaryColor3bEXT(dest, loopback_SecondaryColor3bEXT_f); - SET_SecondaryColor3dEXT(dest, loopback_SecondaryColor3dEXT_f); - SET_SecondaryColor3iEXT(dest, loopback_SecondaryColor3iEXT_f); - SET_SecondaryColor3sEXT(dest, loopback_SecondaryColor3sEXT_f); - SET_SecondaryColor3uiEXT(dest, loopback_SecondaryColor3uiEXT_f); - SET_SecondaryColor3usEXT(dest, loopback_SecondaryColor3usEXT_f); - SET_SecondaryColor3ubEXT(dest, loopback_SecondaryColor3ubEXT_f); - SET_SecondaryColor3bvEXT(dest, loopback_SecondaryColor3bvEXT_f); - SET_SecondaryColor3dvEXT(dest, loopback_SecondaryColor3dvEXT_f); - SET_SecondaryColor3ivEXT(dest, loopback_SecondaryColor3ivEXT_f); - SET_SecondaryColor3svEXT(dest, loopback_SecondaryColor3svEXT_f); - SET_SecondaryColor3uivEXT(dest, loopback_SecondaryColor3uivEXT_f); - SET_SecondaryColor3usvEXT(dest, loopback_SecondaryColor3usvEXT_f); - SET_SecondaryColor3ubvEXT(dest, loopback_SecondaryColor3ubvEXT_f); - - SET_EdgeFlagv(dest, loopback_EdgeFlagv); - - SET_Indexd(dest, loopback_Indexd); - SET_Indexi(dest, loopback_Indexi); - SET_Indexs(dest, loopback_Indexs); - SET_Indexub(dest, loopback_Indexub); - SET_Indexdv(dest, loopback_Indexdv); - SET_Indexiv(dest, loopback_Indexiv); - SET_Indexsv(dest, loopback_Indexsv); - SET_Indexubv(dest, loopback_Indexubv); - SET_Normal3b(dest, loopback_Normal3b); - SET_Normal3d(dest, loopback_Normal3d); - SET_Normal3i(dest, loopback_Normal3i); - SET_Normal3s(dest, loopback_Normal3s); - SET_Normal3bv(dest, loopback_Normal3bv); - SET_Normal3dv(dest, loopback_Normal3dv); - SET_Normal3iv(dest, loopback_Normal3iv); - SET_Normal3sv(dest, loopback_Normal3sv); - SET_TexCoord1d(dest, loopback_TexCoord1d); - SET_TexCoord1i(dest, loopback_TexCoord1i); - SET_TexCoord1s(dest, loopback_TexCoord1s); - SET_TexCoord2d(dest, loopback_TexCoord2d); - SET_TexCoord2s(dest, loopback_TexCoord2s); - SET_TexCoord2i(dest, loopback_TexCoord2i); - SET_TexCoord3d(dest, loopback_TexCoord3d); - SET_TexCoord3i(dest, loopback_TexCoord3i); - SET_TexCoord3s(dest, loopback_TexCoord3s); - SET_TexCoord4d(dest, loopback_TexCoord4d); - SET_TexCoord4i(dest, loopback_TexCoord4i); - SET_TexCoord4s(dest, loopback_TexCoord4s); - SET_TexCoord1dv(dest, loopback_TexCoord1dv); - SET_TexCoord1iv(dest, loopback_TexCoord1iv); - SET_TexCoord1sv(dest, loopback_TexCoord1sv); - SET_TexCoord2dv(dest, loopback_TexCoord2dv); - SET_TexCoord2iv(dest, loopback_TexCoord2iv); - SET_TexCoord2sv(dest, loopback_TexCoord2sv); - SET_TexCoord3dv(dest, loopback_TexCoord3dv); - SET_TexCoord3iv(dest, loopback_TexCoord3iv); - SET_TexCoord3sv(dest, loopback_TexCoord3sv); - SET_TexCoord4dv(dest, loopback_TexCoord4dv); - SET_TexCoord4iv(dest, loopback_TexCoord4iv); - SET_TexCoord4sv(dest, loopback_TexCoord4sv); - SET_Vertex2d(dest, loopback_Vertex2d); - SET_Vertex2i(dest, loopback_Vertex2i); - SET_Vertex2s(dest, loopback_Vertex2s); - SET_Vertex3d(dest, loopback_Vertex3d); - SET_Vertex3i(dest, loopback_Vertex3i); - SET_Vertex3s(dest, loopback_Vertex3s); - SET_Vertex4d(dest, loopback_Vertex4d); - SET_Vertex4i(dest, loopback_Vertex4i); - SET_Vertex4s(dest, loopback_Vertex4s); - SET_Vertex2dv(dest, loopback_Vertex2dv); - SET_Vertex2iv(dest, loopback_Vertex2iv); - SET_Vertex2sv(dest, loopback_Vertex2sv); - SET_Vertex3dv(dest, loopback_Vertex3dv); - SET_Vertex3iv(dest, loopback_Vertex3iv); - SET_Vertex3sv(dest, loopback_Vertex3sv); - SET_Vertex4dv(dest, loopback_Vertex4dv); - SET_Vertex4iv(dest, loopback_Vertex4iv); - SET_Vertex4sv(dest, loopback_Vertex4sv); - SET_MultiTexCoord1dARB(dest, loopback_MultiTexCoord1dARB); - SET_MultiTexCoord1dvARB(dest, loopback_MultiTexCoord1dvARB); - SET_MultiTexCoord1iARB(dest, loopback_MultiTexCoord1iARB); - SET_MultiTexCoord1ivARB(dest, loopback_MultiTexCoord1ivARB); - SET_MultiTexCoord1sARB(dest, loopback_MultiTexCoord1sARB); - SET_MultiTexCoord1svARB(dest, loopback_MultiTexCoord1svARB); - SET_MultiTexCoord2dARB(dest, loopback_MultiTexCoord2dARB); - SET_MultiTexCoord2dvARB(dest, loopback_MultiTexCoord2dvARB); - SET_MultiTexCoord2iARB(dest, loopback_MultiTexCoord2iARB); - SET_MultiTexCoord2ivARB(dest, loopback_MultiTexCoord2ivARB); - SET_MultiTexCoord2sARB(dest, loopback_MultiTexCoord2sARB); - SET_MultiTexCoord2svARB(dest, loopback_MultiTexCoord2svARB); - SET_MultiTexCoord3dARB(dest, loopback_MultiTexCoord3dARB); - SET_MultiTexCoord3dvARB(dest, loopback_MultiTexCoord3dvARB); - SET_MultiTexCoord3iARB(dest, loopback_MultiTexCoord3iARB); - SET_MultiTexCoord3ivARB(dest, loopback_MultiTexCoord3ivARB); - SET_MultiTexCoord3sARB(dest, loopback_MultiTexCoord3sARB); - SET_MultiTexCoord3svARB(dest, loopback_MultiTexCoord3svARB); - SET_MultiTexCoord4dARB(dest, loopback_MultiTexCoord4dARB); - SET_MultiTexCoord4dvARB(dest, loopback_MultiTexCoord4dvARB); - SET_MultiTexCoord4iARB(dest, loopback_MultiTexCoord4iARB); - SET_MultiTexCoord4ivARB(dest, loopback_MultiTexCoord4ivARB); - SET_MultiTexCoord4sARB(dest, loopback_MultiTexCoord4sARB); - SET_MultiTexCoord4svARB(dest, loopback_MultiTexCoord4svARB); - SET_EvalCoord2dv(dest, loopback_EvalCoord2dv); - SET_EvalCoord2fv(dest, loopback_EvalCoord2fv); - SET_EvalCoord2d(dest, loopback_EvalCoord2d); - SET_EvalCoord1dv(dest, loopback_EvalCoord1dv); - SET_EvalCoord1fv(dest, loopback_EvalCoord1fv); - SET_EvalCoord1d(dest, loopback_EvalCoord1d); - SET_Materialf(dest, loopback_Materialf); - SET_Materiali(dest, loopback_Materiali); - SET_Materialiv(dest, loopback_Materialiv); - SET_Rectd(dest, loopback_Rectd); - SET_Rectdv(dest, loopback_Rectdv); - SET_Rectfv(dest, loopback_Rectfv); - SET_Recti(dest, loopback_Recti); - SET_Rectiv(dest, loopback_Rectiv); - SET_Rects(dest, loopback_Rects); - SET_Rectsv(dest, loopback_Rectsv); - SET_FogCoorddEXT(dest, loopback_FogCoorddEXT); - SET_FogCoorddvEXT(dest, loopback_FogCoorddvEXT); - - SET_VertexAttrib1sNV(dest, loopback_VertexAttrib1sNV); - SET_VertexAttrib1dNV(dest, loopback_VertexAttrib1dNV); - SET_VertexAttrib2sNV(dest, loopback_VertexAttrib2sNV); - SET_VertexAttrib2dNV(dest, loopback_VertexAttrib2dNV); - SET_VertexAttrib3sNV(dest, loopback_VertexAttrib3sNV); - SET_VertexAttrib3dNV(dest, loopback_VertexAttrib3dNV); - SET_VertexAttrib4sNV(dest, loopback_VertexAttrib4sNV); - SET_VertexAttrib4dNV(dest, loopback_VertexAttrib4dNV); - SET_VertexAttrib4ubNV(dest, loopback_VertexAttrib4ubNV); - SET_VertexAttrib1svNV(dest, loopback_VertexAttrib1svNV); - SET_VertexAttrib1dvNV(dest, loopback_VertexAttrib1dvNV); - SET_VertexAttrib2svNV(dest, loopback_VertexAttrib2svNV); - SET_VertexAttrib2dvNV(dest, loopback_VertexAttrib2dvNV); - SET_VertexAttrib3svNV(dest, loopback_VertexAttrib3svNV); - SET_VertexAttrib3dvNV(dest, loopback_VertexAttrib3dvNV); - SET_VertexAttrib4svNV(dest, loopback_VertexAttrib4svNV); - SET_VertexAttrib4dvNV(dest, loopback_VertexAttrib4dvNV); - SET_VertexAttrib4ubvNV(dest, loopback_VertexAttrib4ubvNV); - SET_VertexAttribs1svNV(dest, loopback_VertexAttribs1svNV); - SET_VertexAttribs1fvNV(dest, loopback_VertexAttribs1fvNV); - SET_VertexAttribs1dvNV(dest, loopback_VertexAttribs1dvNV); - SET_VertexAttribs2svNV(dest, loopback_VertexAttribs2svNV); - SET_VertexAttribs2fvNV(dest, loopback_VertexAttribs2fvNV); - SET_VertexAttribs2dvNV(dest, loopback_VertexAttribs2dvNV); - SET_VertexAttribs3svNV(dest, loopback_VertexAttribs3svNV); - SET_VertexAttribs3fvNV(dest, loopback_VertexAttribs3fvNV); - SET_VertexAttribs3dvNV(dest, loopback_VertexAttribs3dvNV); - SET_VertexAttribs4svNV(dest, loopback_VertexAttribs4svNV); - SET_VertexAttribs4fvNV(dest, loopback_VertexAttribs4fvNV); - SET_VertexAttribs4dvNV(dest, loopback_VertexAttribs4dvNV); - SET_VertexAttribs4ubvNV(dest, loopback_VertexAttribs4ubvNV); - - SET_VertexAttrib1sARB(dest, loopback_VertexAttrib1sARB); - SET_VertexAttrib1dARB(dest, loopback_VertexAttrib1dARB); - SET_VertexAttrib2sARB(dest, loopback_VertexAttrib2sARB); - SET_VertexAttrib2dARB(dest, loopback_VertexAttrib2dARB); - SET_VertexAttrib3sARB(dest, loopback_VertexAttrib3sARB); - SET_VertexAttrib3dARB(dest, loopback_VertexAttrib3dARB); - SET_VertexAttrib4sARB(dest, loopback_VertexAttrib4sARB); - SET_VertexAttrib4dARB(dest, loopback_VertexAttrib4dARB); - SET_VertexAttrib1svARB(dest, loopback_VertexAttrib1svARB); - SET_VertexAttrib1dvARB(dest, loopback_VertexAttrib1dvARB); - SET_VertexAttrib2svARB(dest, loopback_VertexAttrib2svARB); - SET_VertexAttrib2dvARB(dest, loopback_VertexAttrib2dvARB); - SET_VertexAttrib3svARB(dest, loopback_VertexAttrib3svARB); - SET_VertexAttrib3dvARB(dest, loopback_VertexAttrib3dvARB); - SET_VertexAttrib4svARB(dest, loopback_VertexAttrib4svARB); - SET_VertexAttrib4dvARB(dest, loopback_VertexAttrib4dvARB); - SET_VertexAttrib4NubARB(dest, loopback_VertexAttrib4NubARB); - SET_VertexAttrib4NubvARB(dest, loopback_VertexAttrib4NubvARB); - SET_VertexAttrib4bvARB(dest, loopback_VertexAttrib4bvARB); - SET_VertexAttrib4ivARB(dest, loopback_VertexAttrib4ivARB); - SET_VertexAttrib4ubvARB(dest, loopback_VertexAttrib4ubvARB); - SET_VertexAttrib4usvARB(dest, loopback_VertexAttrib4usvARB); - SET_VertexAttrib4uivARB(dest, loopback_VertexAttrib4uivARB); - SET_VertexAttrib4NbvARB(dest, loopback_VertexAttrib4NbvARB); - SET_VertexAttrib4NsvARB(dest, loopback_VertexAttrib4NsvARB); - SET_VertexAttrib4NivARB(dest, loopback_VertexAttrib4NivARB); - SET_VertexAttrib4NusvARB(dest, loopback_VertexAttrib4NusvARB); - SET_VertexAttrib4NuivARB(dest, loopback_VertexAttrib4NuivARB); - - /* GL_EXT_gpu_shader4, GL 3.0 */ - SET_VertexAttribI1ivEXT(dest, loopback_VertexAttribI1iv); - SET_VertexAttribI1uivEXT(dest, loopback_VertexAttribI1uiv); - SET_VertexAttribI4bvEXT(dest, loopback_VertexAttribI4bv); - SET_VertexAttribI4svEXT(dest, loopback_VertexAttribI4sv); - SET_VertexAttribI4ubvEXT(dest, loopback_VertexAttribI4ubv); - SET_VertexAttribI4usvEXT(dest, loopback_VertexAttribI4usv); -} - - -#endif /* FEATURE_beginend */ +/** + * \file api_loopback.c + * + * \author Keith Whitwell + */ + +/* + * 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. + */ + + +#include "glheader.h" +#include "macros.h" +#include "api_loopback.h" +#include "mtypes.h" +#include "glapi/glapi.h" +#include "glapi/glthread.h" +#include "main/dispatch.h" +#include "mfeatures.h" + +/* KW: A set of functions to convert unusual Color/Normal/Vertex/etc + * calls to a smaller set of driver-provided formats. Currently just + * go back to dispatch to find these (eg. call glNormal3f directly), + * hence 'loopback'. + * + * The driver must supply all of the remaining entry points, which are + * listed in dd.h. The easiest way for a driver to do this is to + * install the supplied software t&l module. + */ +#define COLORF(r,g,b,a) CALL_Color4f(GET_DISPATCH(), (r,g,b,a)) +#define VERTEX2(x,y) CALL_Vertex2f(GET_DISPATCH(), (x,y)) +#define VERTEX3(x,y,z) CALL_Vertex3f(GET_DISPATCH(), (x,y,z)) +#define VERTEX4(x,y,z,w) CALL_Vertex4f(GET_DISPATCH(), (x,y,z,w)) +#define NORMAL(x,y,z) CALL_Normal3f(GET_DISPATCH(), (x,y,z)) +#define TEXCOORD1(s) CALL_TexCoord1f(GET_DISPATCH(), (s)) +#define TEXCOORD2(s,t) CALL_TexCoord2f(GET_DISPATCH(), (s,t)) +#define TEXCOORD3(s,t,u) CALL_TexCoord3f(GET_DISPATCH(), (s,t,u)) +#define TEXCOORD4(s,t,u,v) CALL_TexCoord4f(GET_DISPATCH(), (s,t,u,v)) +#define INDEX(c) CALL_Indexf(GET_DISPATCH(), (c)) +#define MULTI_TEXCOORD1(z,s) CALL_MultiTexCoord1fARB(GET_DISPATCH(), (z,s)) +#define MULTI_TEXCOORD2(z,s,t) CALL_MultiTexCoord2fARB(GET_DISPATCH(), (z,s,t)) +#define MULTI_TEXCOORD3(z,s,t,u) CALL_MultiTexCoord3fARB(GET_DISPATCH(), (z,s,t,u)) +#define MULTI_TEXCOORD4(z,s,t,u,v) CALL_MultiTexCoord4fARB(GET_DISPATCH(), (z,s,t,u,v)) +#define EVALCOORD1(x) CALL_EvalCoord1f(GET_DISPATCH(), (x)) +#define EVALCOORD2(x,y) CALL_EvalCoord2f(GET_DISPATCH(), (x,y)) +#define MATERIALFV(a,b,c) CALL_Materialfv(GET_DISPATCH(), (a,b,c)) +#define RECTF(a,b,c,d) CALL_Rectf(GET_DISPATCH(), (a,b,c,d)) + +#define FOGCOORDF(x) CALL_FogCoordfEXT(GET_DISPATCH(), (x)) +#define SECONDARYCOLORF(a,b,c) CALL_SecondaryColor3fEXT(GET_DISPATCH(), (a,b,c)) + +#define ATTRIB1NV(index,x) CALL_VertexAttrib1fNV(GET_DISPATCH(), (index,x)) +#define ATTRIB2NV(index,x,y) CALL_VertexAttrib2fNV(GET_DISPATCH(), (index,x,y)) +#define ATTRIB3NV(index,x,y,z) CALL_VertexAttrib3fNV(GET_DISPATCH(), (index,x,y,z)) +#define ATTRIB4NV(index,x,y,z,w) CALL_VertexAttrib4fNV(GET_DISPATCH(), (index,x,y,z,w)) + +#define ATTRIB1ARB(index,x) CALL_VertexAttrib1fARB(GET_DISPATCH(), (index,x)) +#define ATTRIB2ARB(index,x,y) CALL_VertexAttrib2fARB(GET_DISPATCH(), (index,x,y)) +#define ATTRIB3ARB(index,x,y,z) CALL_VertexAttrib3fARB(GET_DISPATCH(), (index,x,y,z)) +#define ATTRIB4ARB(index,x,y,z,w) CALL_VertexAttrib4fARB(GET_DISPATCH(), (index,x,y,z,w)) + +#define ATTRIBI_1I(index,x) CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index,x)) +#define ATTRIBI_1UI(index,x) CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index,x)) +#define ATTRIBI_4I(index,x,y,z,w) CALL_VertexAttribI4iEXT(GET_DISPATCH(), (index,x,y,z,w)) + +#define ATTRIBI_4UI(index,x,y,z,w) CALL_VertexAttribI4uiEXT(GET_DISPATCH(), (index,x,y,z,w)) + + +#if FEATURE_beginend + + +static void GLAPIENTRY +loopback_Color3b_f( GLbyte red, GLbyte green, GLbyte blue ) +{ + COLORF( BYTE_TO_FLOAT(red), + BYTE_TO_FLOAT(green), + BYTE_TO_FLOAT(blue), + 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3d_f( GLdouble red, GLdouble green, GLdouble blue ) +{ + COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3i_f( GLint red, GLint green, GLint blue ) +{ + COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), + INT_TO_FLOAT(blue), 1.0); +} + +static void GLAPIENTRY +loopback_Color3s_f( GLshort red, GLshort green, GLshort blue ) +{ + COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), + SHORT_TO_FLOAT(blue), 1.0); +} + +static void GLAPIENTRY +loopback_Color3ui_f( GLuint red, GLuint green, GLuint blue ) +{ + COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), + UINT_TO_FLOAT(blue), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3us_f( GLushort red, GLushort green, GLushort blue ) +{ + COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), + USHORT_TO_FLOAT(blue), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3ub_f( GLubyte red, GLubyte green, GLubyte blue ) +{ + COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), + UBYTE_TO_FLOAT(blue), 1.0 ); +} + + +static void GLAPIENTRY +loopback_Color3bv_f( const GLbyte *v ) +{ + COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2]), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3dv_f( const GLdouble *v ) +{ + COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3iv_f( const GLint *v ) +{ + COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2]), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3sv_f( const GLshort *v ) +{ + COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2]), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3uiv_f( const GLuint *v ) +{ + COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2]), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3usv_f( const GLushort *v ) +{ + COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2]), 1.0 ); +} + +static void GLAPIENTRY +loopback_Color3ubv_f( const GLubyte *v ) +{ + COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), 1.0 ); +} + + +static void GLAPIENTRY +loopback_Color4b_f( GLbyte red, GLbyte green, GLbyte blue, + GLbyte alpha ) +{ + COLORF( BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green), + BYTE_TO_FLOAT(blue), BYTE_TO_FLOAT(alpha) ); +} + +static void GLAPIENTRY +loopback_Color4d_f( GLdouble red, GLdouble green, GLdouble blue, + GLdouble alpha ) +{ + COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, (GLfloat) alpha ); +} + +static void GLAPIENTRY +loopback_Color4i_f( GLint red, GLint green, GLint blue, GLint alpha ) +{ + COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), + INT_TO_FLOAT(blue), INT_TO_FLOAT(alpha) ); +} + +static void GLAPIENTRY +loopback_Color4s_f( GLshort red, GLshort green, GLshort blue, + GLshort alpha ) +{ + COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), + SHORT_TO_FLOAT(blue), SHORT_TO_FLOAT(alpha) ); +} + +static void GLAPIENTRY +loopback_Color4ui_f( GLuint red, GLuint green, GLuint blue, GLuint alpha ) +{ + COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), + UINT_TO_FLOAT(blue), UINT_TO_FLOAT(alpha) ); +} + +static void GLAPIENTRY +loopback_Color4us_f( GLushort red, GLushort green, GLushort blue, GLushort alpha ) +{ + COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), + USHORT_TO_FLOAT(blue), USHORT_TO_FLOAT(alpha) ); +} + +static void GLAPIENTRY +loopback_Color4ub_f( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) +{ + COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), + UBYTE_TO_FLOAT(blue), UBYTE_TO_FLOAT(alpha) ); +} + + +static void GLAPIENTRY +loopback_Color4iv_f( const GLint *v ) +{ + COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) ); +} + + +static void GLAPIENTRY +loopback_Color4bv_f( const GLbyte *v ) +{ + COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3]) ); +} + +static void GLAPIENTRY +loopback_Color4dv_f( const GLdouble *v ) +{ + COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); +} + + +static void GLAPIENTRY +loopback_Color4sv_f( const GLshort *v) +{ + COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3]) ); +} + + +static void GLAPIENTRY +loopback_Color4uiv_f( const GLuint *v) +{ + COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3]) ); +} + +static void GLAPIENTRY +loopback_Color4usv_f( const GLushort *v) +{ + COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3]) ); +} + +static void GLAPIENTRY +loopback_Color4ubv_f( const GLubyte *v) +{ + COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]) ); +} + + +static void GLAPIENTRY +loopback_FogCoorddEXT( GLdouble d ) +{ + FOGCOORDF( (GLfloat) d ); +} + +static void GLAPIENTRY +loopback_FogCoorddvEXT( const GLdouble *v ) +{ + FOGCOORDF( (GLfloat) *v ); +} + + +static void GLAPIENTRY +loopback_Indexd( GLdouble c ) +{ + INDEX( (GLfloat) c ); +} + +static void GLAPIENTRY +loopback_Indexi( GLint c ) +{ + INDEX( (GLfloat) c ); +} + +static void GLAPIENTRY +loopback_Indexs( GLshort c ) +{ + INDEX( (GLfloat) c ); +} + +static void GLAPIENTRY +loopback_Indexub( GLubyte c ) +{ + INDEX( (GLfloat) c ); +} + +static void GLAPIENTRY +loopback_Indexdv( const GLdouble *c ) +{ + INDEX( (GLfloat) *c ); +} + +static void GLAPIENTRY +loopback_Indexiv( const GLint *c ) +{ + INDEX( (GLfloat) *c ); +} + +static void GLAPIENTRY +loopback_Indexsv( const GLshort *c ) +{ + INDEX( (GLfloat) *c ); +} + +static void GLAPIENTRY +loopback_Indexubv( const GLubyte *c ) +{ + INDEX( (GLfloat) *c ); +} + + +static void GLAPIENTRY +loopback_EdgeFlagv(const GLboolean *flag) +{ + CALL_EdgeFlag(GET_DISPATCH(), (*flag)); +} + + +static void GLAPIENTRY +loopback_Normal3b( GLbyte nx, GLbyte ny, GLbyte nz ) +{ + NORMAL( BYTE_TO_FLOAT(nx), BYTE_TO_FLOAT(ny), BYTE_TO_FLOAT(nz) ); +} + +static void GLAPIENTRY +loopback_Normal3d( GLdouble nx, GLdouble ny, GLdouble nz ) +{ + NORMAL((GLfloat) nx, (GLfloat) ny, (GLfloat) nz); +} + +static void GLAPIENTRY +loopback_Normal3i( GLint nx, GLint ny, GLint nz ) +{ + NORMAL( INT_TO_FLOAT(nx), INT_TO_FLOAT(ny), INT_TO_FLOAT(nz) ); +} + +static void GLAPIENTRY +loopback_Normal3s( GLshort nx, GLshort ny, GLshort nz ) +{ + NORMAL( SHORT_TO_FLOAT(nx), SHORT_TO_FLOAT(ny), SHORT_TO_FLOAT(nz) ); +} + +static void GLAPIENTRY +loopback_Normal3bv( const GLbyte *v ) +{ + NORMAL( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]) ); +} + +static void GLAPIENTRY +loopback_Normal3dv( const GLdouble *v ) +{ + NORMAL( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_Normal3iv( const GLint *v ) +{ + NORMAL( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]) ); +} + +static void GLAPIENTRY +loopback_Normal3sv( const GLshort *v ) +{ + NORMAL( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]) ); +} + +static void GLAPIENTRY +loopback_TexCoord1d( GLdouble s ) +{ + TEXCOORD1((GLfloat) s); +} + +static void GLAPIENTRY +loopback_TexCoord1i( GLint s ) +{ + TEXCOORD1((GLfloat) s); +} + +static void GLAPIENTRY +loopback_TexCoord1s( GLshort s ) +{ + TEXCOORD1((GLfloat) s); +} + +static void GLAPIENTRY +loopback_TexCoord2d( GLdouble s, GLdouble t ) +{ + TEXCOORD2((GLfloat) s,(GLfloat) t); +} + +static void GLAPIENTRY +loopback_TexCoord2s( GLshort s, GLshort t ) +{ + TEXCOORD2((GLfloat) s,(GLfloat) t); +} + +static void GLAPIENTRY +loopback_TexCoord2i( GLint s, GLint t ) +{ + TEXCOORD2((GLfloat) s,(GLfloat) t); +} + +static void GLAPIENTRY +loopback_TexCoord3d( GLdouble s, GLdouble t, GLdouble r ) +{ + TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); +} + +static void GLAPIENTRY +loopback_TexCoord3i( GLint s, GLint t, GLint r ) +{ + TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); +} + +static void GLAPIENTRY +loopback_TexCoord3s( GLshort s, GLshort t, GLshort r ) +{ + TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); +} + +static void GLAPIENTRY +loopback_TexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ) +{ + TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); +} + +static void GLAPIENTRY +loopback_TexCoord4i( GLint s, GLint t, GLint r, GLint q ) +{ + TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); +} + +static void GLAPIENTRY +loopback_TexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ) +{ + TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); +} + +static void GLAPIENTRY +loopback_TexCoord1dv( const GLdouble *v ) +{ + TEXCOORD1((GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_TexCoord1iv( const GLint *v ) +{ + TEXCOORD1((GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_TexCoord1sv( const GLshort *v ) +{ + TEXCOORD1((GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_TexCoord2dv( const GLdouble *v ) +{ + TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_TexCoord2iv( const GLint *v ) +{ + TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_TexCoord2sv( const GLshort *v ) +{ + TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_TexCoord3dv( const GLdouble *v ) +{ + TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_TexCoord3iv( const GLint *v ) +{ + TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_TexCoord3sv( const GLshort *v ) +{ + TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_TexCoord4dv( const GLdouble *v ) +{ + TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_TexCoord4iv( const GLint *v ) +{ + TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_TexCoord4sv( const GLshort *v ) +{ + TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_Vertex2d( GLdouble x, GLdouble y ) +{ + VERTEX2( (GLfloat) x, (GLfloat) y ); +} + +static void GLAPIENTRY +loopback_Vertex2i( GLint x, GLint y ) +{ + VERTEX2( (GLfloat) x, (GLfloat) y ); +} + +static void GLAPIENTRY +loopback_Vertex2s( GLshort x, GLshort y ) +{ + VERTEX2( (GLfloat) x, (GLfloat) y ); +} + +static void GLAPIENTRY +loopback_Vertex3d( GLdouble x, GLdouble y, GLdouble z ) +{ + VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); +} + +static void GLAPIENTRY +loopback_Vertex3i( GLint x, GLint y, GLint z ) +{ + VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); +} + +static void GLAPIENTRY +loopback_Vertex3s( GLshort x, GLshort y, GLshort z ) +{ + VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); +} + +static void GLAPIENTRY +loopback_Vertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) +{ + VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); +} + +static void GLAPIENTRY +loopback_Vertex4i( GLint x, GLint y, GLint z, GLint w ) +{ + VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); +} + +static void GLAPIENTRY +loopback_Vertex4s( GLshort x, GLshort y, GLshort z, GLshort w ) +{ + VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); +} + +static void GLAPIENTRY +loopback_Vertex2dv( const GLdouble *v ) +{ + VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_Vertex2iv( const GLint *v ) +{ + VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_Vertex2sv( const GLshort *v ) +{ + VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_Vertex3dv( const GLdouble *v ) +{ + VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_Vertex3iv( const GLint *v ) +{ + VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_Vertex3sv( const GLshort *v ) +{ + VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_Vertex4dv( const GLdouble *v ) +{ + VERTEX4( (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_Vertex4iv( const GLint *v ) +{ + VERTEX4( (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_Vertex4sv( const GLshort *v ) +{ + VERTEX4( (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1dARB(GLenum target, GLdouble s) +{ + MULTI_TEXCOORD1( target, (GLfloat) s ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1dvARB(GLenum target, const GLdouble *v) +{ + MULTI_TEXCOORD1( target, (GLfloat) v[0] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1iARB(GLenum target, GLint s) +{ + MULTI_TEXCOORD1( target, (GLfloat) s ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1ivARB(GLenum target, const GLint *v) +{ + MULTI_TEXCOORD1( target, (GLfloat) v[0] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1sARB(GLenum target, GLshort s) +{ + MULTI_TEXCOORD1( target, (GLfloat) s ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord1svARB(GLenum target, const GLshort *v) +{ + MULTI_TEXCOORD1( target, (GLfloat) v[0] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t) +{ + MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2dvARB(GLenum target, const GLdouble *v) +{ + MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2iARB(GLenum target, GLint s, GLint t) +{ + MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2ivARB(GLenum target, const GLint *v) +{ + MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2sARB(GLenum target, GLshort s, GLshort t) +{ + MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord2svARB(GLenum target, const GLshort *v) +{ + MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r) +{ + MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3dvARB(GLenum target, const GLdouble *v) +{ + MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r) +{ + MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3ivARB(GLenum target, const GLint *v) +{ + MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r) +{ + MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord3svARB(GLenum target, const GLshort *v) +{ + MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) +{ + MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, + (GLfloat) r, (GLfloat) q ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4dvARB(GLenum target, const GLdouble *v) +{ + MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q) +{ + MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, + (GLfloat) r, (GLfloat) q ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4ivARB(GLenum target, const GLint *v) +{ + MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) +{ + MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, + (GLfloat) r, (GLfloat) q ); +} + +static void GLAPIENTRY +loopback_MultiTexCoord4svARB(GLenum target, const GLshort *v) +{ + MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3] ); +} + +static void GLAPIENTRY +loopback_EvalCoord2dv( const GLdouble *u ) +{ + EVALCOORD2( (GLfloat) u[0], (GLfloat) u[1] ); +} + +static void GLAPIENTRY +loopback_EvalCoord2fv( const GLfloat *u ) +{ + EVALCOORD2( u[0], u[1] ); +} + +static void GLAPIENTRY +loopback_EvalCoord2d( GLdouble u, GLdouble v ) +{ + EVALCOORD2( (GLfloat) u, (GLfloat) v ); +} + +static void GLAPIENTRY +loopback_EvalCoord1dv( const GLdouble *u ) +{ + EVALCOORD1( (GLfloat) *u ); +} + +static void GLAPIENTRY +loopback_EvalCoord1fv( const GLfloat *u ) +{ + EVALCOORD1( (GLfloat) *u ); +} + +static void GLAPIENTRY +loopback_EvalCoord1d( GLdouble u ) +{ + EVALCOORD1( (GLfloat) u ); +} + +static void GLAPIENTRY +loopback_Materialf( GLenum face, GLenum pname, GLfloat param ) +{ + GLfloat fparam[4]; + fparam[0] = param; + MATERIALFV( face, pname, fparam ); +} + +static void GLAPIENTRY +loopback_Materiali(GLenum face, GLenum pname, GLint param ) +{ + GLfloat p = (GLfloat) param; + MATERIALFV(face, pname, &p); +} + +static void GLAPIENTRY +loopback_Materialiv(GLenum face, GLenum pname, const GLint *params ) +{ + GLfloat fparam[4]; + switch (pname) { + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_EMISSION: + case GL_AMBIENT_AND_DIFFUSE: + fparam[0] = INT_TO_FLOAT( params[0] ); + fparam[1] = INT_TO_FLOAT( params[1] ); + fparam[2] = INT_TO_FLOAT( params[2] ); + fparam[3] = INT_TO_FLOAT( params[3] ); + break; + case GL_SHININESS: + fparam[0] = (GLfloat) params[0]; + break; + case GL_COLOR_INDEXES: + fparam[0] = (GLfloat) params[0]; + fparam[1] = (GLfloat) params[1]; + fparam[2] = (GLfloat) params[2]; + break; + default: + ; + } + MATERIALFV(face, pname, fparam); +} + + +static void GLAPIENTRY +loopback_Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) +{ + RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); +} + +static void GLAPIENTRY +loopback_Rectdv(const GLdouble *v1, const GLdouble *v2) +{ + RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); +} + +static void GLAPIENTRY +loopback_Rectfv(const GLfloat *v1, const GLfloat *v2) +{ + RECTF(v1[0], v1[1], v2[0], v2[1]); +} + +static void GLAPIENTRY +loopback_Recti(GLint x1, GLint y1, GLint x2, GLint y2) +{ + RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); +} + +static void GLAPIENTRY +loopback_Rectiv(const GLint *v1, const GLint *v2) +{ + RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); +} + +static void GLAPIENTRY +loopback_Rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2) +{ + RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); +} + +static void GLAPIENTRY +loopback_Rectsv(const GLshort *v1, const GLshort *v2) +{ + RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); +} + +static void GLAPIENTRY +loopback_SecondaryColor3bEXT_f( GLbyte red, GLbyte green, GLbyte blue ) +{ + SECONDARYCOLORF( BYTE_TO_FLOAT(red), + BYTE_TO_FLOAT(green), + BYTE_TO_FLOAT(blue) ); +} + +static void GLAPIENTRY +loopback_SecondaryColor3dEXT_f( GLdouble red, GLdouble green, GLdouble blue ) +{ + SECONDARYCOLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue ); +} + +static void GLAPIENTRY +loopback_SecondaryColor3iEXT_f( GLint red, GLint green, GLint blue ) +{ + SECONDARYCOLORF( INT_TO_FLOAT(red), + INT_TO_FLOAT(green), + INT_TO_FLOAT(blue)); +} + +static void GLAPIENTRY +loopback_SecondaryColor3sEXT_f( GLshort red, GLshort green, GLshort blue ) +{ + SECONDARYCOLORF(SHORT_TO_FLOAT(red), + SHORT_TO_FLOAT(green), + SHORT_TO_FLOAT(blue)); +} + +static void GLAPIENTRY +loopback_SecondaryColor3uiEXT_f( GLuint red, GLuint green, GLuint blue ) +{ + SECONDARYCOLORF(UINT_TO_FLOAT(red), + UINT_TO_FLOAT(green), + UINT_TO_FLOAT(blue)); +} + +static void GLAPIENTRY +loopback_SecondaryColor3usEXT_f( GLushort red, GLushort green, GLushort blue ) +{ + SECONDARYCOLORF(USHORT_TO_FLOAT(red), + USHORT_TO_FLOAT(green), + USHORT_TO_FLOAT(blue)); +} + +static void GLAPIENTRY +loopback_SecondaryColor3ubEXT_f( GLubyte red, GLubyte green, GLubyte blue ) +{ + SECONDARYCOLORF(UBYTE_TO_FLOAT(red), + UBYTE_TO_FLOAT(green), + UBYTE_TO_FLOAT(blue)); +} + +static void GLAPIENTRY +loopback_SecondaryColor3bvEXT_f( const GLbyte *v ) +{ + SECONDARYCOLORF(BYTE_TO_FLOAT(v[0]), + BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2])); +} + +static void GLAPIENTRY +loopback_SecondaryColor3dvEXT_f( const GLdouble *v ) +{ + SECONDARYCOLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); +} +static void GLAPIENTRY +loopback_SecondaryColor3ivEXT_f( const GLint *v ) +{ + SECONDARYCOLORF(INT_TO_FLOAT(v[0]), + INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2])); +} + +static void GLAPIENTRY +loopback_SecondaryColor3svEXT_f( const GLshort *v ) +{ + SECONDARYCOLORF(SHORT_TO_FLOAT(v[0]), + SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2])); +} + +static void GLAPIENTRY +loopback_SecondaryColor3uivEXT_f( const GLuint *v ) +{ + SECONDARYCOLORF(UINT_TO_FLOAT(v[0]), + UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2])); +} + +static void GLAPIENTRY +loopback_SecondaryColor3usvEXT_f( const GLushort *v ) +{ + SECONDARYCOLORF(USHORT_TO_FLOAT(v[0]), + USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2])); +} + +static void GLAPIENTRY +loopback_SecondaryColor3ubvEXT_f( const GLubyte *v ) +{ + SECONDARYCOLORF(UBYTE_TO_FLOAT(v[0]), + UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2])); +} + + +/* + * GL_NV_vertex_program: + * Always loop-back to one of the VertexAttrib[1234]f[v]NV functions. + * Note that attribute indexes DO alias conventional vertex attributes. + */ + +static void GLAPIENTRY +loopback_VertexAttrib1sNV(GLuint index, GLshort x) +{ + ATTRIB1NV(index, (GLfloat) x); +} + +static void GLAPIENTRY +loopback_VertexAttrib1dNV(GLuint index, GLdouble x) +{ + ATTRIB1NV(index, (GLfloat) x); +} + +static void GLAPIENTRY +loopback_VertexAttrib2sNV(GLuint index, GLshort x, GLshort y) +{ + ATTRIB2NV(index, (GLfloat) x, y); +} + +static void GLAPIENTRY +loopback_VertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y) +{ + ATTRIB2NV(index, (GLfloat) x, (GLfloat) y); +} + +static void GLAPIENTRY +loopback_VertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z) +{ + ATTRIB3NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z); +} + +static void GLAPIENTRY +loopback_VertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ + ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void GLAPIENTRY +loopback_VertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) +{ + ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +loopback_VertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +loopback_VertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) +{ + ATTRIB4NV(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), + UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); +} + +static void GLAPIENTRY +loopback_VertexAttrib1svNV(GLuint index, const GLshort *v) +{ + ATTRIB1NV(index, (GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttrib1dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB1NV(index, (GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttrib2svNV(GLuint index, const GLshort *v) +{ + ATTRIB2NV(index, (GLfloat) v[0], (GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_VertexAttrib2dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB2NV(index, (GLfloat) v[0], (GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_VertexAttrib3svNV(GLuint index, const GLshort *v) +{ + ATTRIB3NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_VertexAttrib3dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB3NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4svNV(GLuint index, const GLshort *v) +{ + ATTRIB4NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], + (GLfloat)v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB4NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4ubvNV(GLuint index, const GLubyte *v) +{ + ATTRIB4NV(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); +} + + +static void GLAPIENTRY +loopback_VertexAttribs1svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib1svNV(index + i, v + i); +} + +static void GLAPIENTRY +loopback_VertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + ATTRIB1NV(index + i, v[i]); +} + +static void GLAPIENTRY +loopback_VertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib1dvNV(index + i, v + i); +} + +static void GLAPIENTRY +loopback_VertexAttribs2svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib2svNV(index + i, v + 2 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + ATTRIB2NV(index + i, v[2 * i], v[2 * i + 1]); +} + +static void GLAPIENTRY +loopback_VertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib2dvNV(index + i, v + 2 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs3svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib3svNV(index + i, v + 3 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + ATTRIB3NV(index + i, v[3 * i], v[3 * i + 1], v[3 * i + 2]); +} + +static void GLAPIENTRY +loopback_VertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib3dvNV(index + i, v + 3 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs4svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4svNV(index + i, v + 4 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + ATTRIB4NV(index + i, v[4 * i], v[4 * i + 1], v[4 * i + 2], v[4 * i + 3]); +} + +static void GLAPIENTRY +loopback_VertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4dvNV(index + i, v + 4 * i); +} + +static void GLAPIENTRY +loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4ubvNV(index + i, v + 4 * i); +} + + +/* + * GL_ARB_vertex_program + * Always loop-back to one of the VertexAttrib[1234]f[v]ARB functions. + * Note that attribute indexes do NOT alias conventional attributes. + */ + +static void GLAPIENTRY +loopback_VertexAttrib1sARB(GLuint index, GLshort x) +{ + ATTRIB1ARB(index, (GLfloat) x); +} + +static void GLAPIENTRY +loopback_VertexAttrib1dARB(GLuint index, GLdouble x) +{ + ATTRIB1ARB(index, (GLfloat) x); +} + +static void GLAPIENTRY +loopback_VertexAttrib2sARB(GLuint index, GLshort x, GLshort y) +{ + ATTRIB2ARB(index, (GLfloat) x, y); +} + +static void GLAPIENTRY +loopback_VertexAttrib2dARB(GLuint index, GLdouble x, GLdouble y) +{ + ATTRIB2ARB(index, (GLfloat) x, (GLfloat) y); +} + +static void GLAPIENTRY +loopback_VertexAttrib3sARB(GLuint index, GLshort x, GLshort y, GLshort z) +{ + ATTRIB3ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z); +} + +static void GLAPIENTRY +loopback_VertexAttrib3dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ + ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void GLAPIENTRY +loopback_VertexAttrib4sARB(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) +{ + ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +loopback_VertexAttrib4dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +loopback_VertexAttrib1svARB(GLuint index, const GLshort *v) +{ + ATTRIB1ARB(index, (GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttrib1dvARB(GLuint index, const GLdouble *v) +{ + ATTRIB1ARB(index, (GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttrib2svARB(GLuint index, const GLshort *v) +{ + ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_VertexAttrib2dvARB(GLuint index, const GLdouble *v) +{ + ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_VertexAttrib3svARB(GLuint index, const GLshort *v) +{ + ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_VertexAttrib3dvARB(GLuint index, const GLdouble *v) +{ + ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4svARB(GLuint index, const GLshort *v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], + (GLfloat)v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4dvARB(GLuint index, const GLdouble *v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4bvARB(GLuint index, const GLbyte * v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4ivARB(GLuint index, const GLint * v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4ubvARB(GLuint index, const GLubyte * v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4usvARB(GLuint index, const GLushort * v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4uivARB(GLuint index, const GLuint * v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NbvARB(GLuint index, const GLbyte * v) +{ + ATTRIB4ARB(index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), + BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3])); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NsvARB(GLuint index, const GLshort * v) +{ + ATTRIB4ARB(index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), + SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3])); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NivARB(GLuint index, const GLint * v) +{ + ATTRIB4ARB(index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), + INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3])); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) +{ + ATTRIB4ARB(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), + UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NubvARB(GLuint index, const GLubyte * v) +{ + ATTRIB4ARB(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NusvARB(GLuint index, const GLushort * v) +{ + ATTRIB4ARB(index, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), + USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3])); +} + +static void GLAPIENTRY +loopback_VertexAttrib4NuivARB(GLuint index, const GLuint * v) +{ + ATTRIB4ARB(index, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), + UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3])); +} + + + +/** + * GL_EXT_gpu_shader / GL 3.0 signed/unsigned integer-valued attributes. + * Note that attribute indexes do NOT alias conventional attributes. + */ + +static void GLAPIENTRY +loopback_VertexAttribI1iv(GLuint index, const GLint *v) +{ + ATTRIBI_1I(index, v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttribI1uiv(GLuint index, const GLuint *v) +{ + ATTRIBI_1UI(index, v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttribI4bv(GLuint index, const GLbyte *v) +{ + ATTRIBI_4I(index, v[0], v[1], v[2], v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttribI4sv(GLuint index, const GLshort *v) +{ + ATTRIBI_4I(index, v[0], v[1], v[2], v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttribI4ubv(GLuint index, const GLubyte *v) +{ + ATTRIBI_4UI(index, v[0], v[1], v[2], v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttribI4usv(GLuint index, const GLushort *v) +{ + ATTRIBI_4UI(index, v[0], v[1], v[2], v[3]); +} + + + + +/* + * This code never registers handlers for any of the entry points + * listed in vtxfmt.h. + */ +void +_mesa_loopback_init_api_table( struct _glapi_table *dest ) +{ + SET_Color3b(dest, loopback_Color3b_f); + SET_Color3d(dest, loopback_Color3d_f); + SET_Color3i(dest, loopback_Color3i_f); + SET_Color3s(dest, loopback_Color3s_f); + SET_Color3ui(dest, loopback_Color3ui_f); + SET_Color3us(dest, loopback_Color3us_f); + SET_Color3ub(dest, loopback_Color3ub_f); + SET_Color4b(dest, loopback_Color4b_f); + SET_Color4d(dest, loopback_Color4d_f); + SET_Color4i(dest, loopback_Color4i_f); + SET_Color4s(dest, loopback_Color4s_f); + SET_Color4ui(dest, loopback_Color4ui_f); + SET_Color4us(dest, loopback_Color4us_f); + SET_Color4ub(dest, loopback_Color4ub_f); + SET_Color3bv(dest, loopback_Color3bv_f); + SET_Color3dv(dest, loopback_Color3dv_f); + SET_Color3iv(dest, loopback_Color3iv_f); + SET_Color3sv(dest, loopback_Color3sv_f); + SET_Color3uiv(dest, loopback_Color3uiv_f); + SET_Color3usv(dest, loopback_Color3usv_f); + SET_Color3ubv(dest, loopback_Color3ubv_f); + SET_Color4bv(dest, loopback_Color4bv_f); + SET_Color4dv(dest, loopback_Color4dv_f); + SET_Color4iv(dest, loopback_Color4iv_f); + SET_Color4sv(dest, loopback_Color4sv_f); + SET_Color4uiv(dest, loopback_Color4uiv_f); + SET_Color4usv(dest, loopback_Color4usv_f); + SET_Color4ubv(dest, loopback_Color4ubv_f); + + SET_SecondaryColor3bEXT(dest, loopback_SecondaryColor3bEXT_f); + SET_SecondaryColor3dEXT(dest, loopback_SecondaryColor3dEXT_f); + SET_SecondaryColor3iEXT(dest, loopback_SecondaryColor3iEXT_f); + SET_SecondaryColor3sEXT(dest, loopback_SecondaryColor3sEXT_f); + SET_SecondaryColor3uiEXT(dest, loopback_SecondaryColor3uiEXT_f); + SET_SecondaryColor3usEXT(dest, loopback_SecondaryColor3usEXT_f); + SET_SecondaryColor3ubEXT(dest, loopback_SecondaryColor3ubEXT_f); + SET_SecondaryColor3bvEXT(dest, loopback_SecondaryColor3bvEXT_f); + SET_SecondaryColor3dvEXT(dest, loopback_SecondaryColor3dvEXT_f); + SET_SecondaryColor3ivEXT(dest, loopback_SecondaryColor3ivEXT_f); + SET_SecondaryColor3svEXT(dest, loopback_SecondaryColor3svEXT_f); + SET_SecondaryColor3uivEXT(dest, loopback_SecondaryColor3uivEXT_f); + SET_SecondaryColor3usvEXT(dest, loopback_SecondaryColor3usvEXT_f); + SET_SecondaryColor3ubvEXT(dest, loopback_SecondaryColor3ubvEXT_f); + + SET_EdgeFlagv(dest, loopback_EdgeFlagv); + + SET_Indexd(dest, loopback_Indexd); + SET_Indexi(dest, loopback_Indexi); + SET_Indexs(dest, loopback_Indexs); + SET_Indexub(dest, loopback_Indexub); + SET_Indexdv(dest, loopback_Indexdv); + SET_Indexiv(dest, loopback_Indexiv); + SET_Indexsv(dest, loopback_Indexsv); + SET_Indexubv(dest, loopback_Indexubv); + SET_Normal3b(dest, loopback_Normal3b); + SET_Normal3d(dest, loopback_Normal3d); + SET_Normal3i(dest, loopback_Normal3i); + SET_Normal3s(dest, loopback_Normal3s); + SET_Normal3bv(dest, loopback_Normal3bv); + SET_Normal3dv(dest, loopback_Normal3dv); + SET_Normal3iv(dest, loopback_Normal3iv); + SET_Normal3sv(dest, loopback_Normal3sv); + SET_TexCoord1d(dest, loopback_TexCoord1d); + SET_TexCoord1i(dest, loopback_TexCoord1i); + SET_TexCoord1s(dest, loopback_TexCoord1s); + SET_TexCoord2d(dest, loopback_TexCoord2d); + SET_TexCoord2s(dest, loopback_TexCoord2s); + SET_TexCoord2i(dest, loopback_TexCoord2i); + SET_TexCoord3d(dest, loopback_TexCoord3d); + SET_TexCoord3i(dest, loopback_TexCoord3i); + SET_TexCoord3s(dest, loopback_TexCoord3s); + SET_TexCoord4d(dest, loopback_TexCoord4d); + SET_TexCoord4i(dest, loopback_TexCoord4i); + SET_TexCoord4s(dest, loopback_TexCoord4s); + SET_TexCoord1dv(dest, loopback_TexCoord1dv); + SET_TexCoord1iv(dest, loopback_TexCoord1iv); + SET_TexCoord1sv(dest, loopback_TexCoord1sv); + SET_TexCoord2dv(dest, loopback_TexCoord2dv); + SET_TexCoord2iv(dest, loopback_TexCoord2iv); + SET_TexCoord2sv(dest, loopback_TexCoord2sv); + SET_TexCoord3dv(dest, loopback_TexCoord3dv); + SET_TexCoord3iv(dest, loopback_TexCoord3iv); + SET_TexCoord3sv(dest, loopback_TexCoord3sv); + SET_TexCoord4dv(dest, loopback_TexCoord4dv); + SET_TexCoord4iv(dest, loopback_TexCoord4iv); + SET_TexCoord4sv(dest, loopback_TexCoord4sv); + SET_Vertex2d(dest, loopback_Vertex2d); + SET_Vertex2i(dest, loopback_Vertex2i); + SET_Vertex2s(dest, loopback_Vertex2s); + SET_Vertex3d(dest, loopback_Vertex3d); + SET_Vertex3i(dest, loopback_Vertex3i); + SET_Vertex3s(dest, loopback_Vertex3s); + SET_Vertex4d(dest, loopback_Vertex4d); + SET_Vertex4i(dest, loopback_Vertex4i); + SET_Vertex4s(dest, loopback_Vertex4s); + SET_Vertex2dv(dest, loopback_Vertex2dv); + SET_Vertex2iv(dest, loopback_Vertex2iv); + SET_Vertex2sv(dest, loopback_Vertex2sv); + SET_Vertex3dv(dest, loopback_Vertex3dv); + SET_Vertex3iv(dest, loopback_Vertex3iv); + SET_Vertex3sv(dest, loopback_Vertex3sv); + SET_Vertex4dv(dest, loopback_Vertex4dv); + SET_Vertex4iv(dest, loopback_Vertex4iv); + SET_Vertex4sv(dest, loopback_Vertex4sv); + SET_MultiTexCoord1dARB(dest, loopback_MultiTexCoord1dARB); + SET_MultiTexCoord1dvARB(dest, loopback_MultiTexCoord1dvARB); + SET_MultiTexCoord1iARB(dest, loopback_MultiTexCoord1iARB); + SET_MultiTexCoord1ivARB(dest, loopback_MultiTexCoord1ivARB); + SET_MultiTexCoord1sARB(dest, loopback_MultiTexCoord1sARB); + SET_MultiTexCoord1svARB(dest, loopback_MultiTexCoord1svARB); + SET_MultiTexCoord2dARB(dest, loopback_MultiTexCoord2dARB); + SET_MultiTexCoord2dvARB(dest, loopback_MultiTexCoord2dvARB); + SET_MultiTexCoord2iARB(dest, loopback_MultiTexCoord2iARB); + SET_MultiTexCoord2ivARB(dest, loopback_MultiTexCoord2ivARB); + SET_MultiTexCoord2sARB(dest, loopback_MultiTexCoord2sARB); + SET_MultiTexCoord2svARB(dest, loopback_MultiTexCoord2svARB); + SET_MultiTexCoord3dARB(dest, loopback_MultiTexCoord3dARB); + SET_MultiTexCoord3dvARB(dest, loopback_MultiTexCoord3dvARB); + SET_MultiTexCoord3iARB(dest, loopback_MultiTexCoord3iARB); + SET_MultiTexCoord3ivARB(dest, loopback_MultiTexCoord3ivARB); + SET_MultiTexCoord3sARB(dest, loopback_MultiTexCoord3sARB); + SET_MultiTexCoord3svARB(dest, loopback_MultiTexCoord3svARB); + SET_MultiTexCoord4dARB(dest, loopback_MultiTexCoord4dARB); + SET_MultiTexCoord4dvARB(dest, loopback_MultiTexCoord4dvARB); + SET_MultiTexCoord4iARB(dest, loopback_MultiTexCoord4iARB); + SET_MultiTexCoord4ivARB(dest, loopback_MultiTexCoord4ivARB); + SET_MultiTexCoord4sARB(dest, loopback_MultiTexCoord4sARB); + SET_MultiTexCoord4svARB(dest, loopback_MultiTexCoord4svARB); + SET_EvalCoord2dv(dest, loopback_EvalCoord2dv); + SET_EvalCoord2fv(dest, loopback_EvalCoord2fv); + SET_EvalCoord2d(dest, loopback_EvalCoord2d); + SET_EvalCoord1dv(dest, loopback_EvalCoord1dv); + SET_EvalCoord1fv(dest, loopback_EvalCoord1fv); + SET_EvalCoord1d(dest, loopback_EvalCoord1d); + SET_Materialf(dest, loopback_Materialf); + SET_Materiali(dest, loopback_Materiali); + SET_Materialiv(dest, loopback_Materialiv); + SET_Rectd(dest, loopback_Rectd); + SET_Rectdv(dest, loopback_Rectdv); + SET_Rectfv(dest, loopback_Rectfv); + SET_Recti(dest, loopback_Recti); + SET_Rectiv(dest, loopback_Rectiv); + SET_Rects(dest, loopback_Rects); + SET_Rectsv(dest, loopback_Rectsv); + SET_FogCoorddEXT(dest, loopback_FogCoorddEXT); + SET_FogCoorddvEXT(dest, loopback_FogCoorddvEXT); + + SET_VertexAttrib1sNV(dest, loopback_VertexAttrib1sNV); + SET_VertexAttrib1dNV(dest, loopback_VertexAttrib1dNV); + SET_VertexAttrib2sNV(dest, loopback_VertexAttrib2sNV); + SET_VertexAttrib2dNV(dest, loopback_VertexAttrib2dNV); + SET_VertexAttrib3sNV(dest, loopback_VertexAttrib3sNV); + SET_VertexAttrib3dNV(dest, loopback_VertexAttrib3dNV); + SET_VertexAttrib4sNV(dest, loopback_VertexAttrib4sNV); + SET_VertexAttrib4dNV(dest, loopback_VertexAttrib4dNV); + SET_VertexAttrib4ubNV(dest, loopback_VertexAttrib4ubNV); + SET_VertexAttrib1svNV(dest, loopback_VertexAttrib1svNV); + SET_VertexAttrib1dvNV(dest, loopback_VertexAttrib1dvNV); + SET_VertexAttrib2svNV(dest, loopback_VertexAttrib2svNV); + SET_VertexAttrib2dvNV(dest, loopback_VertexAttrib2dvNV); + SET_VertexAttrib3svNV(dest, loopback_VertexAttrib3svNV); + SET_VertexAttrib3dvNV(dest, loopback_VertexAttrib3dvNV); + SET_VertexAttrib4svNV(dest, loopback_VertexAttrib4svNV); + SET_VertexAttrib4dvNV(dest, loopback_VertexAttrib4dvNV); + SET_VertexAttrib4ubvNV(dest, loopback_VertexAttrib4ubvNV); + SET_VertexAttribs1svNV(dest, loopback_VertexAttribs1svNV); + SET_VertexAttribs1fvNV(dest, loopback_VertexAttribs1fvNV); + SET_VertexAttribs1dvNV(dest, loopback_VertexAttribs1dvNV); + SET_VertexAttribs2svNV(dest, loopback_VertexAttribs2svNV); + SET_VertexAttribs2fvNV(dest, loopback_VertexAttribs2fvNV); + SET_VertexAttribs2dvNV(dest, loopback_VertexAttribs2dvNV); + SET_VertexAttribs3svNV(dest, loopback_VertexAttribs3svNV); + SET_VertexAttribs3fvNV(dest, loopback_VertexAttribs3fvNV); + SET_VertexAttribs3dvNV(dest, loopback_VertexAttribs3dvNV); + SET_VertexAttribs4svNV(dest, loopback_VertexAttribs4svNV); + SET_VertexAttribs4fvNV(dest, loopback_VertexAttribs4fvNV); + SET_VertexAttribs4dvNV(dest, loopback_VertexAttribs4dvNV); + SET_VertexAttribs4ubvNV(dest, loopback_VertexAttribs4ubvNV); + + SET_VertexAttrib1sARB(dest, loopback_VertexAttrib1sARB); + SET_VertexAttrib1dARB(dest, loopback_VertexAttrib1dARB); + SET_VertexAttrib2sARB(dest, loopback_VertexAttrib2sARB); + SET_VertexAttrib2dARB(dest, loopback_VertexAttrib2dARB); + SET_VertexAttrib3sARB(dest, loopback_VertexAttrib3sARB); + SET_VertexAttrib3dARB(dest, loopback_VertexAttrib3dARB); + SET_VertexAttrib4sARB(dest, loopback_VertexAttrib4sARB); + SET_VertexAttrib4dARB(dest, loopback_VertexAttrib4dARB); + SET_VertexAttrib1svARB(dest, loopback_VertexAttrib1svARB); + SET_VertexAttrib1dvARB(dest, loopback_VertexAttrib1dvARB); + SET_VertexAttrib2svARB(dest, loopback_VertexAttrib2svARB); + SET_VertexAttrib2dvARB(dest, loopback_VertexAttrib2dvARB); + SET_VertexAttrib3svARB(dest, loopback_VertexAttrib3svARB); + SET_VertexAttrib3dvARB(dest, loopback_VertexAttrib3dvARB); + SET_VertexAttrib4svARB(dest, loopback_VertexAttrib4svARB); + SET_VertexAttrib4dvARB(dest, loopback_VertexAttrib4dvARB); + SET_VertexAttrib4NubARB(dest, loopback_VertexAttrib4NubARB); + SET_VertexAttrib4NubvARB(dest, loopback_VertexAttrib4NubvARB); + SET_VertexAttrib4bvARB(dest, loopback_VertexAttrib4bvARB); + SET_VertexAttrib4ivARB(dest, loopback_VertexAttrib4ivARB); + SET_VertexAttrib4ubvARB(dest, loopback_VertexAttrib4ubvARB); + SET_VertexAttrib4usvARB(dest, loopback_VertexAttrib4usvARB); + SET_VertexAttrib4uivARB(dest, loopback_VertexAttrib4uivARB); + SET_VertexAttrib4NbvARB(dest, loopback_VertexAttrib4NbvARB); + SET_VertexAttrib4NsvARB(dest, loopback_VertexAttrib4NsvARB); + SET_VertexAttrib4NivARB(dest, loopback_VertexAttrib4NivARB); + SET_VertexAttrib4NusvARB(dest, loopback_VertexAttrib4NusvARB); + SET_VertexAttrib4NuivARB(dest, loopback_VertexAttrib4NuivARB); + + /* GL_EXT_gpu_shader4, GL 3.0 */ + SET_VertexAttribI1ivEXT(dest, loopback_VertexAttribI1iv); + SET_VertexAttribI1uivEXT(dest, loopback_VertexAttribI1uiv); + SET_VertexAttribI4bvEXT(dest, loopback_VertexAttribI4bv); + SET_VertexAttribI4svEXT(dest, loopback_VertexAttribI4sv); + SET_VertexAttribI4ubvEXT(dest, loopback_VertexAttribI4ubv); + SET_VertexAttribI4usvEXT(dest, loopback_VertexAttribI4usv); +} + + +#endif /* FEATURE_beginend */ diff --git a/mesalib/src/mesa/main/atifragshader.c b/mesalib/src/mesa/main/atifragshader.c index ff7b042d2..c74c999f8 100644 --- a/mesalib/src/mesa/main/atifragshader.c +++ b/mesalib/src/mesa/main/atifragshader.c @@ -1,796 +1,796 @@ -/** - * \file atifragshader.c - * \author David Airlie - * Copyright (C) 2004 David Airlie All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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 AIRLIE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "main/glheader.h" -#include "main/context.h" -#include "main/hash.h" -#include "main/imports.h" -#include "main/macros.h" -#include "main/mfeatures.h" -#include "main/enums.h" -#include "main/mtypes.h" -#include "main/dispatch.h" -#include "main/atifragshader.h" - -#if FEATURE_ATI_fragment_shader - -#define MESA_DEBUG_ATI_FS 0 - -static struct ati_fragment_shader DummyShader; - - -void -_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp) -{ - SET_GenFragmentShadersATI(disp, _mesa_GenFragmentShadersATI); - SET_BindFragmentShaderATI(disp, _mesa_BindFragmentShaderATI); - SET_DeleteFragmentShaderATI(disp, _mesa_DeleteFragmentShaderATI); - SET_BeginFragmentShaderATI(disp, _mesa_BeginFragmentShaderATI); - SET_EndFragmentShaderATI(disp, _mesa_EndFragmentShaderATI); - SET_PassTexCoordATI(disp, _mesa_PassTexCoordATI); - SET_SampleMapATI(disp, _mesa_SampleMapATI); - SET_ColorFragmentOp1ATI(disp, _mesa_ColorFragmentOp1ATI); - SET_ColorFragmentOp2ATI(disp, _mesa_ColorFragmentOp2ATI); - SET_ColorFragmentOp3ATI(disp, _mesa_ColorFragmentOp3ATI); - SET_AlphaFragmentOp1ATI(disp, _mesa_AlphaFragmentOp1ATI); - SET_AlphaFragmentOp2ATI(disp, _mesa_AlphaFragmentOp2ATI); - SET_AlphaFragmentOp3ATI(disp, _mesa_AlphaFragmentOp3ATI); - SET_SetFragmentShaderConstantATI(disp, _mesa_SetFragmentShaderConstantATI); -} - - -/** - * Allocate and initialize a new ATI fragment shader object. - */ -struct ati_fragment_shader * -_mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id) -{ - struct ati_fragment_shader *s = CALLOC_STRUCT(ati_fragment_shader); - (void) ctx; - if (s) { - s->Id = id; - s->RefCount = 1; - } - return s; -} - - -/** - * Delete the given ati fragment shader - */ -void -_mesa_delete_ati_fragment_shader(struct gl_context *ctx, struct ati_fragment_shader *s) -{ - GLuint i; - for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { - if (s->Instructions[i]) - free(s->Instructions[i]); - if (s->SetupInst[i]) - free(s->SetupInst[i]); - } - free(s); -} - - - -static void -new_arith_inst(struct ati_fragment_shader *prog) -{ -/* set "default" instruction as not all may get defined. - there is no specified way to express a nop with ati fragment shaders we use - GL_NONE as the op enum and just set some params to 0 - so nothing to do here */ - prog->numArithInstr[prog->cur_pass >> 1]++; -} - -static void -new_tex_inst(struct ati_fragment_shader *prog) -{ -} - -static void match_pair_inst(struct ati_fragment_shader *curProg, GLuint optype) -{ - if (optype == curProg->last_optype) { - curProg->last_optype = 1; - } -} - -#if MESA_DEBUG_ATI_FS -static char * -create_dst_mod_str(GLuint mod) -{ - static char ret_str[1024]; - - memset(ret_str, 0, 1024); - if (mod & GL_2X_BIT_ATI) - strncat(ret_str, "|2X", 1024); - - if (mod & GL_4X_BIT_ATI) - strncat(ret_str, "|4X", 1024); - - if (mod & GL_8X_BIT_ATI) - strncat(ret_str, "|8X", 1024); - if (mod & GL_HALF_BIT_ATI) - strncat(ret_str, "|HA", 1024); - if (mod & GL_QUARTER_BIT_ATI) - strncat(ret_str, "|QU", 1024); - if (mod & GL_EIGHTH_BIT_ATI) - strncat(ret_str, "|EI", 1024); - - if (mod & GL_SATURATE_BIT_ATI) - strncat(ret_str, "|SAT", 1024); - - if (strlen(ret_str) == 0) - strncat(ret_str, "NONE", 1024); - return ret_str; -} - -static char *atifs_ops[] = {"ColorFragmentOp1ATI", "ColorFragmentOp2ATI", "ColorFragmentOp3ATI", - "AlphaFragmentOp1ATI", "AlphaFragmentOp2ATI", "AlphaFragmentOp3ATI" }; - -static void debug_op(GLint optype, GLuint arg_count, GLenum op, GLuint dst, - GLuint dstMask, GLuint dstMod, GLuint arg1, - GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, - GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, - GLuint arg3Rep, GLuint arg3Mod) -{ - char *op_name; - - op_name = atifs_ops[(arg_count-1)+(optype?3:0)]; - - fprintf(stderr, "%s(%s, %s", op_name, _mesa_lookup_enum_by_nr(op), - _mesa_lookup_enum_by_nr(dst)); - if (!optype) - fprintf(stderr, ", %d", dstMask); - - fprintf(stderr, ", %s", create_dst_mod_str(dstMod)); - - fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg1), - _mesa_lookup_enum_by_nr(arg1Rep), arg1Mod); - if (arg_count>1) - fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg2), - _mesa_lookup_enum_by_nr(arg2Rep), arg2Mod); - if (arg_count>2) - fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg3), - _mesa_lookup_enum_by_nr(arg3Rep), arg3Mod); - - fprintf(stderr,")\n"); - -} -#endif - -static int check_arith_arg(struct ati_fragment_shader *curProg, - GLuint optype, GLuint arg, GLuint argRep) -{ - GET_CURRENT_CONTEXT(ctx); - - if (((arg < GL_CON_0_ATI) || (arg > GL_CON_7_ATI)) && - ((arg < GL_REG_0_ATI) || (arg > GL_REG_5_ATI)) && - (arg != GL_ZERO) && (arg != GL_ONE) && - (arg != GL_PRIMARY_COLOR_ARB) && (arg != GL_SECONDARY_INTERPOLATOR_ATI)) { - _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(arg)"); - return 0; - } - if ((arg == GL_SECONDARY_INTERPOLATOR_ATI) && (((optype == 0) && (argRep == GL_ALPHA)) || - ((optype == 1) && ((arg == GL_ALPHA) || (argRep == GL_NONE))))) { - _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(sec_interp)"); - return 0; - } - if ((arg == GL_SECONDARY_INTERPOLATOR_ATI) && (((optype == 0) && (argRep == GL_ALPHA)) || - ((optype == 1) && ((arg == GL_ALPHA) || (argRep == GL_NONE))))) { - _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(sec_interp)"); - return 0; - } - if ((curProg->cur_pass == 1) && - ((arg == GL_PRIMARY_COLOR_ARB) || (arg == GL_SECONDARY_INTERPOLATOR_ATI))) { - curProg->interpinp1 = GL_TRUE; - } - return 1; -} - -GLuint GLAPIENTRY -_mesa_GenFragmentShadersATI(GLuint range) -{ - GLuint first; - GLuint i; - GET_CURRENT_CONTEXT(ctx); - - if (range == 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGenFragmentShadersATI(range)"); - return 0; - } - - if (ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGenFragmentShadersATI(insideShader)"); - return 0; - } - - first = _mesa_HashFindFreeKeyBlock(ctx->Shared->ATIShaders, range); - for (i = 0; i < range; i++) { - _mesa_HashInsert(ctx->Shared->ATIShaders, first + i, &DummyShader); - } - - return first; -} - -void GLAPIENTRY -_mesa_BindFragmentShaderATI(GLuint id) -{ - GET_CURRENT_CONTEXT(ctx); - struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; - struct ati_fragment_shader *newProg; - - if (ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBindFragmentShaderATI(insideShader)"); - return; - } - - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - - if (curProg->Id == id) { - return; - } - - /* unbind current */ - if (curProg->Id != 0) { - curProg->RefCount--; - if (curProg->RefCount <= 0) { - _mesa_HashRemove(ctx->Shared->ATIShaders, id); - } - } - - /* find new shader */ - if (id == 0) { - newProg = ctx->Shared->DefaultFragmentShader; - } - else { - newProg = (struct ati_fragment_shader *) - _mesa_HashLookup(ctx->Shared->ATIShaders, id); - if (!newProg || newProg == &DummyShader) { - /* allocate a new program now */ - newProg = _mesa_new_ati_fragment_shader(ctx, id); - if (!newProg) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindFragmentShaderATI"); - return; - } - _mesa_HashInsert(ctx->Shared->ATIShaders, id, newProg); - } - - } - - /* do actual bind */ - ctx->ATIFragmentShader.Current = newProg; - - ASSERT(ctx->ATIFragmentShader.Current); - if (newProg) - newProg->RefCount++; - - /*if (ctx->Driver.BindProgram) - ctx->Driver.BindProgram(ctx, target, prog); */ -} - -void GLAPIENTRY -_mesa_DeleteFragmentShaderATI(GLuint id) -{ - GET_CURRENT_CONTEXT(ctx); - - if (ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteFragmentShaderATI(insideShader)"); - return; - } - - if (id != 0) { - struct ati_fragment_shader *prog = (struct ati_fragment_shader *) - _mesa_HashLookup(ctx->Shared->ATIShaders, id); - if (prog == &DummyShader) { - _mesa_HashRemove(ctx->Shared->ATIShaders, id); - } - else if (prog) { - if (ctx->ATIFragmentShader.Current && - ctx->ATIFragmentShader.Current->Id == id) { - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - _mesa_BindFragmentShaderATI(0); - } - } - - /* The ID is immediately available for re-use now */ - _mesa_HashRemove(ctx->Shared->ATIShaders, id); - if (prog) { - prog->RefCount--; - if (prog->RefCount <= 0) { - assert(prog != &DummyShader); - free(prog); - } - } - } -} - - -void GLAPIENTRY -_mesa_BeginFragmentShaderATI(void) -{ - GLint i; - GET_CURRENT_CONTEXT(ctx); - - if (ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginFragmentShaderATI(insideShader)"); - return; - } - - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - - /* if the shader was already defined free instructions and get new ones - (or, could use the same mem but would need to reinitialize) */ - /* no idea if it's allowed to redefine a shader */ - for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { - if (ctx->ATIFragmentShader.Current->Instructions[i]) - free(ctx->ATIFragmentShader.Current->Instructions[i]); - if (ctx->ATIFragmentShader.Current->SetupInst[i]) - free(ctx->ATIFragmentShader.Current->SetupInst[i]); - } - - /* malloc the instructions here - not sure if the best place but its - a start */ - for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { - ctx->ATIFragmentShader.Current->Instructions[i] = - (struct atifs_instruction *) - calloc(1, sizeof(struct atifs_instruction) * - (MAX_NUM_INSTRUCTIONS_PER_PASS_ATI)); - ctx->ATIFragmentShader.Current->SetupInst[i] = - (struct atifs_setupinst *) - calloc(1, sizeof(struct atifs_setupinst) * - (MAX_NUM_FRAGMENT_REGISTERS_ATI)); - } - -/* can't rely on calloc for initialization as it's possible to redefine a shader (?) */ - ctx->ATIFragmentShader.Current->LocalConstDef = 0; - ctx->ATIFragmentShader.Current->numArithInstr[0] = 0; - ctx->ATIFragmentShader.Current->numArithInstr[1] = 0; - ctx->ATIFragmentShader.Current->regsAssigned[0] = 0; - ctx->ATIFragmentShader.Current->regsAssigned[1] = 0; - ctx->ATIFragmentShader.Current->NumPasses = 0; - ctx->ATIFragmentShader.Current->cur_pass = 0; - ctx->ATIFragmentShader.Current->last_optype = 0; - ctx->ATIFragmentShader.Current->interpinp1 = GL_FALSE; - ctx->ATIFragmentShader.Current->isValid = GL_FALSE; - ctx->ATIFragmentShader.Current->swizzlerq = 0; - ctx->ATIFragmentShader.Compiling = 1; -} - -void GLAPIENTRY -_mesa_EndFragmentShaderATI(void) -{ - GET_CURRENT_CONTEXT(ctx); - struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; -#if MESA_DEBUG_ATI_FS - GLint i, j; -#endif - - if (!ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glEndFragmentShaderATI(outsideShader)"); - return; - } - if (curProg->interpinp1 && (ctx->ATIFragmentShader.Current->cur_pass > 1)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glEndFragmentShaderATI(interpinfirstpass)"); - /* according to spec, DON'T return here */ - } - - match_pair_inst(curProg, 0); - ctx->ATIFragmentShader.Compiling = 0; - ctx->ATIFragmentShader.Current->isValid = GL_TRUE; - if ((ctx->ATIFragmentShader.Current->cur_pass == 0) || - (ctx->ATIFragmentShader.Current->cur_pass == 2)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glEndFragmentShaderATI(noarithinst)"); - } - if (ctx->ATIFragmentShader.Current->cur_pass > 1) - ctx->ATIFragmentShader.Current->NumPasses = 2; - else - ctx->ATIFragmentShader.Current->NumPasses = 1; - - ctx->ATIFragmentShader.Current->cur_pass = 0; - -#if MESA_DEBUG_ATI_FS - for (j = 0; j < MAX_NUM_PASSES_ATI; j++) { - for (i = 0; i < MAX_NUM_FRAGMENT_REGISTERS_ATI; i++) { - GLuint op = curProg->SetupInst[j][i].Opcode; - const char *op_enum = op > 5 ? _mesa_lookup_enum_by_nr(op) : "0"; - GLuint src = curProg->SetupInst[j][i].src; - GLuint swizzle = curProg->SetupInst[j][i].swizzle; - fprintf(stderr, "%2d %04X %s %d %04X\n", i, op, op_enum, src, - swizzle); - } - for (i = 0; i < curProg->numArithInstr[j]; i++) { - GLuint op0 = curProg->Instructions[j][i].Opcode[0]; - GLuint op1 = curProg->Instructions[j][i].Opcode[1]; - const char *op0_enum = op0 > 5 ? _mesa_lookup_enum_by_nr(op0) : "0"; - const char *op1_enum = op1 > 5 ? _mesa_lookup_enum_by_nr(op1) : "0"; - GLuint count0 = curProg->Instructions[j][i].ArgCount[0]; - GLuint count1 = curProg->Instructions[j][i].ArgCount[1]; - fprintf(stderr, "%2d %04X %s %d %04X %s %d\n", i, op0, op0_enum, count0, - op1, op1_enum, count1); - } - } -#endif - - if (!ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_SHADER_ATI, NULL)) { - ctx->ATIFragmentShader.Current->isValid = GL_FALSE; - /* XXX is this the right error? */ - _mesa_error(ctx, GL_INVALID_OPERATION, - "glEndFragmentShaderATI(driver rejected shader)"); - } -} - -void GLAPIENTRY -_mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle) -{ - GET_CURRENT_CONTEXT(ctx); - struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; - struct atifs_setupinst *curI; - - if (!ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(outsideShader)"); - return; - } - - if (curProg->cur_pass == 1) { - match_pair_inst(curProg, 0); - curProg->cur_pass = 2; - } - if ((curProg->cur_pass > 2) || - ((1 << (dst - GL_REG_0_ATI)) & curProg->regsAssigned[curProg->cur_pass >> 1])) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoord(pass)"); - return; - } - if ((dst < GL_REG_0_ATI) || (dst > GL_REG_5_ATI) || - ((dst - GL_REG_0_ATI) >= ctx->Const.MaxTextureUnits)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glPassTexCoordATI(dst)"); - return; - } - if (((coord < GL_REG_0_ATI) || (coord > GL_REG_5_ATI)) && - ((coord < GL_TEXTURE0_ARB) || (coord > GL_TEXTURE7_ARB) || - ((coord - GL_TEXTURE0_ARB) >= ctx->Const.MaxTextureUnits))) { - _mesa_error(ctx, GL_INVALID_ENUM, "glPassTexCoordATI(coord)"); - return; - } - if ((curProg->cur_pass == 0) && (coord >= GL_REG_0_ATI)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(coord)"); - return; - } - if (!(swizzle >= GL_SWIZZLE_STR_ATI) && (swizzle <= GL_SWIZZLE_STQ_DQ_ATI)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glPassTexCoordATI(swizzle)"); - return; - } - if ((swizzle & 1) && (coord >= GL_REG_0_ATI)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(swizzle)"); - return; - } - if (coord <= GL_TEXTURE7_ARB) { - GLuint tmp = coord - GL_TEXTURE0_ARB; - if ((((curProg->swizzlerq >> (tmp * 2)) & 3) != 0) && - (((swizzle & 1) + 1) != ((curProg->swizzlerq >> (tmp * 2)) & 3))) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(swizzle)"); - return; - } else { - curProg->swizzlerq |= (((swizzle & 1) + 1) << (tmp * 2)); - } - } - - curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI); - new_tex_inst(curProg); - - /* add the instructions */ - curI = &curProg->SetupInst[curProg->cur_pass >> 1][dst - GL_REG_0_ATI]; - - curI->Opcode = ATI_FRAGMENT_SHADER_PASS_OP; - curI->src = coord; - curI->swizzle = swizzle; - -#if MESA_DEBUG_ATI_FS - _mesa_debug(ctx, "%s(%s, %s, %s)\n", __FUNCTION__, - _mesa_lookup_enum_by_nr(dst), _mesa_lookup_enum_by_nr(coord), - _mesa_lookup_enum_by_nr(swizzle)); -#endif -} - -void GLAPIENTRY -_mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum swizzle) -{ - GET_CURRENT_CONTEXT(ctx); - struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; - struct atifs_setupinst *curI; - - if (!ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(outsideShader)"); - return; - } - - if (curProg->cur_pass == 1) { - match_pair_inst(curProg, 0); - curProg->cur_pass = 2; - } - if ((curProg->cur_pass > 2) || - ((1 << (dst - GL_REG_0_ATI)) & curProg->regsAssigned[curProg->cur_pass >> 1])) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(pass)"); - return; - } - if ((dst < GL_REG_0_ATI) || (dst > GL_REG_5_ATI) || - ((dst - GL_REG_0_ATI) >= ctx->Const.MaxTextureUnits)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glSampleMapATI(dst)"); - return; - } - if (((interp < GL_REG_0_ATI) || (interp > GL_REG_5_ATI)) && - ((interp < GL_TEXTURE0_ARB) || (interp > GL_TEXTURE7_ARB) || - ((interp - GL_TEXTURE0_ARB) >= ctx->Const.MaxTextureUnits))) { - /* is this texture5 or texture7? spec is a bit unclear there */ - _mesa_error(ctx, GL_INVALID_ENUM, "glSampleMapATI(interp)"); - return; - } - if ((curProg->cur_pass == 0) && (interp >= GL_REG_0_ATI)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(interp)"); - return; - } - if (!(swizzle >= GL_SWIZZLE_STR_ATI) && (swizzle <= GL_SWIZZLE_STQ_DQ_ATI)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glSampleMapATI(swizzle)"); - return; - } - if ((swizzle & 1) && (interp >= GL_REG_0_ATI)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(swizzle)"); - return; - } - if (interp <= GL_TEXTURE7_ARB) { - GLuint tmp = interp - GL_TEXTURE0_ARB; - if ((((curProg->swizzlerq >> (tmp * 2)) & 3) != 0) && - (((swizzle & 1) + 1) != ((curProg->swizzlerq >> (tmp * 2)) & 3))) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(swizzle)"); - return; - } else { - curProg->swizzlerq |= (((swizzle & 1) + 1) << (tmp * 2)); - } - } - - curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI); - new_tex_inst(curProg); - - /* add the instructions */ - curI = &curProg->SetupInst[curProg->cur_pass >> 1][dst - GL_REG_0_ATI]; - - curI->Opcode = ATI_FRAGMENT_SHADER_SAMPLE_OP; - curI->src = interp; - curI->swizzle = swizzle; - -#if MESA_DEBUG_ATI_FS - _mesa_debug(ctx, "%s(%s, %s, %s)\n", __FUNCTION__, - _mesa_lookup_enum_by_nr(dst), _mesa_lookup_enum_by_nr(interp), - _mesa_lookup_enum_by_nr(swizzle)); -#endif -} - -static void -_mesa_FragmentOpXATI(GLint optype, GLuint arg_count, GLenum op, GLuint dst, - GLuint dstMask, GLuint dstMod, GLuint arg1, - GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, - GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, - GLuint arg3Rep, GLuint arg3Mod) -{ - GET_CURRENT_CONTEXT(ctx); - struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; - GLint ci; - struct atifs_instruction *curI; - GLuint modtemp = dstMod & ~GL_SATURATE_BIT_ATI; - - if (!ctx->ATIFragmentShader.Compiling) { - _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(outsideShader)"); - return; - } - - if (curProg->cur_pass==0) - curProg->cur_pass=1; - - else if (curProg->cur_pass==2) - curProg->cur_pass=3; - - /* decide whether this is a new instruction or not ... all color instructions are new, - and alpha instructions might also be new if there was no preceding color inst */ - if ((optype == 0) || (curProg->last_optype == optype)) { - if (curProg->numArithInstr[curProg->cur_pass >> 1] > 7) { - _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(instrCount)"); - return; - } - /* easier to do that here slight side effect invalid instr will still be inserted as nops */ - match_pair_inst(curProg, optype); - new_arith_inst(curProg); - } - curProg->last_optype = optype; - ci = curProg->numArithInstr[curProg->cur_pass >> 1] - 1; - - /* add the instructions */ - curI = &curProg->Instructions[curProg->cur_pass >> 1][ci]; - - /* error checking */ - if ((dst < GL_REG_0_ATI) || (dst > GL_REG_5_ATI)) { - _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(dst)"); - return; - } - if ((modtemp != GL_NONE) && (modtemp != GL_2X_BIT_ATI) && - (modtemp != GL_4X_BIT_ATI) && (modtemp != GL_8X_BIT_ATI) && - (modtemp != GL_HALF_BIT_ATI) && !(modtemp != GL_QUARTER_BIT_ATI) && - (modtemp != GL_EIGHTH_BIT_ATI)) { - _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(dstMod)%x", modtemp); - return; - } - /* op checking? Actually looks like that's missing in the spec but we'll do it anyway */ - if (((op < GL_ADD_ATI) || (op > GL_DOT2_ADD_ATI)) && !(op == GL_MOV_ATI)) { - _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(op)"); - return; - } - if (optype == 1) { - if (((op == GL_DOT2_ADD_ATI) && (curI->Opcode[0] != GL_DOT2_ADD_ATI)) || - ((op == GL_DOT3_ATI) && (curI->Opcode[0] != GL_DOT3_ATI)) || - ((op == GL_DOT4_ATI) && (curI->Opcode[0] != GL_DOT4_ATI)) || - ((op != GL_DOT4_ATI) && (curI->Opcode[0] == GL_DOT4_ATI))) { - _mesa_error(ctx, GL_INVALID_OPERATION, "AFragmentOpATI(op)"); - return; - } - } - if ((op == GL_DOT4_ATI) && - (((arg1 == GL_SECONDARY_INTERPOLATOR_ATI) && ((arg1Rep == GL_ALPHA) || (arg1Rep == GL_NONE))) || - (((arg2 == GL_SECONDARY_INTERPOLATOR_ATI) && ((arg2Rep == GL_ALPHA) || (arg2Rep == GL_NONE)))))) { - _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(sec_interp)"); - } - - if (!check_arith_arg(curProg, optype, arg1, arg1Rep)) { - return; - } - if (arg2) { - if (!check_arith_arg(curProg, optype, arg2, arg2Rep)) { - return; - } - } - if (arg3) { - if (!check_arith_arg(curProg, optype, arg3, arg3Rep)) { - return; - } - if ((arg1 >= GL_CON_0_ATI) && (arg1 <= GL_CON_7_ATI) && - (arg2 >= GL_CON_0_ATI) && (arg2 <= GL_CON_7_ATI) && - (arg3 >= GL_CON_0_ATI) && (arg3 <= GL_CON_7_ATI) && - (arg1 != arg2) && (arg1 != arg3) && (arg2 != arg3)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(3Consts)"); - return; - } - } - - /* all ok - not all fully validated though (e.g. argNMod - spec doesn't say anything) */ - - curI->Opcode[optype] = op; - curI->SrcReg[optype][0].Index = arg1; - curI->SrcReg[optype][0].argRep = arg1Rep; - curI->SrcReg[optype][0].argMod = arg1Mod; - curI->ArgCount[optype] = arg_count; - - if (arg2) { - curI->SrcReg[optype][1].Index = arg2; - curI->SrcReg[optype][1].argRep = arg2Rep; - curI->SrcReg[optype][1].argMod = arg2Mod; - } - - if (arg3) { - curI->SrcReg[optype][2].Index = arg3; - curI->SrcReg[optype][2].argRep = arg3Rep; - curI->SrcReg[optype][2].argMod = arg3Mod; - } - - curI->DstReg[optype].Index = dst; - curI->DstReg[optype].dstMod = dstMod; - curI->DstReg[optype].dstMask = dstMask; - -#if MESA_DEBUG_ATI_FS - debug_op(optype, arg_count, op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod); -#endif - -} - -void GLAPIENTRY -_mesa_ColorFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMask, - GLuint dstMod, GLuint arg1, GLuint arg1Rep, - GLuint arg1Mod) -{ - _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 1, op, dst, dstMask, - dstMod, arg1, arg1Rep, arg1Mod, 0, 0, 0, 0, 0, 0); -} - -void GLAPIENTRY -_mesa_ColorFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMask, - GLuint dstMod, GLuint arg1, GLuint arg1Rep, - GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, - GLuint arg2Mod) -{ - _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 2, op, dst, dstMask, - dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, - arg2Mod, 0, 0, 0); -} - -void GLAPIENTRY -_mesa_ColorFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMask, - GLuint dstMod, GLuint arg1, GLuint arg1Rep, - GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, - GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, - GLuint arg3Mod) -{ - _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 3, op, dst, dstMask, - dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, - arg2Mod, arg3, arg3Rep, arg3Mod); -} - -void GLAPIENTRY -_mesa_AlphaFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, - GLuint arg1Rep, GLuint arg1Mod) -{ - _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 1, op, dst, 0, dstMod, - arg1, arg1Rep, arg1Mod, 0, 0, 0, 0, 0, 0); -} - -void GLAPIENTRY -_mesa_AlphaFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, - GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, - GLuint arg2Rep, GLuint arg2Mod) -{ - _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 2, op, dst, 0, dstMod, - arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, 0, 0, - 0); -} - -void GLAPIENTRY -_mesa_AlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, - GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, - GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, - GLuint arg3Rep, GLuint arg3Mod) -{ - _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 3, op, dst, 0, dstMod, - arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, - arg3Rep, arg3Mod); -} - -void GLAPIENTRY -_mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value) -{ - GLuint dstindex; - GET_CURRENT_CONTEXT(ctx); - - if ((dst < GL_CON_0_ATI) || (dst > GL_CON_7_ATI)) { - /* spec says nothing about what should happen here but we can't just segfault...*/ - _mesa_error(ctx, GL_INVALID_ENUM, "glSetFragmentShaderConstantATI(dst)"); - return; - } - - dstindex = dst - GL_CON_0_ATI; - if (ctx->ATIFragmentShader.Compiling) { - struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; - COPY_4V(curProg->Constants[dstindex], value); - curProg->LocalConstDef |= 1 << dstindex; - } - else { - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - COPY_4V(ctx->ATIFragmentShader.GlobalConstants[dstindex], value); - } -} - -#endif /* FEATURE_ATI_fragment_shader */ +/** + * \file atifragshader.c + * \author David Airlie + * Copyright (C) 2004 David Airlie All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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 AIRLIE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "main/glheader.h" +#include "main/context.h" +#include "main/hash.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/mfeatures.h" +#include "main/enums.h" +#include "main/mtypes.h" +#include "main/dispatch.h" +#include "main/atifragshader.h" + +#if FEATURE_ATI_fragment_shader + +#define MESA_DEBUG_ATI_FS 0 + +static struct ati_fragment_shader DummyShader; + + +void +_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp) +{ + SET_GenFragmentShadersATI(disp, _mesa_GenFragmentShadersATI); + SET_BindFragmentShaderATI(disp, _mesa_BindFragmentShaderATI); + SET_DeleteFragmentShaderATI(disp, _mesa_DeleteFragmentShaderATI); + SET_BeginFragmentShaderATI(disp, _mesa_BeginFragmentShaderATI); + SET_EndFragmentShaderATI(disp, _mesa_EndFragmentShaderATI); + SET_PassTexCoordATI(disp, _mesa_PassTexCoordATI); + SET_SampleMapATI(disp, _mesa_SampleMapATI); + SET_ColorFragmentOp1ATI(disp, _mesa_ColorFragmentOp1ATI); + SET_ColorFragmentOp2ATI(disp, _mesa_ColorFragmentOp2ATI); + SET_ColorFragmentOp3ATI(disp, _mesa_ColorFragmentOp3ATI); + SET_AlphaFragmentOp1ATI(disp, _mesa_AlphaFragmentOp1ATI); + SET_AlphaFragmentOp2ATI(disp, _mesa_AlphaFragmentOp2ATI); + SET_AlphaFragmentOp3ATI(disp, _mesa_AlphaFragmentOp3ATI); + SET_SetFragmentShaderConstantATI(disp, _mesa_SetFragmentShaderConstantATI); +} + + +/** + * Allocate and initialize a new ATI fragment shader object. + */ +struct ati_fragment_shader * +_mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id) +{ + struct ati_fragment_shader *s = CALLOC_STRUCT(ati_fragment_shader); + (void) ctx; + if (s) { + s->Id = id; + s->RefCount = 1; + } + return s; +} + + +/** + * Delete the given ati fragment shader + */ +void +_mesa_delete_ati_fragment_shader(struct gl_context *ctx, struct ati_fragment_shader *s) +{ + GLuint i; + for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { + if (s->Instructions[i]) + free(s->Instructions[i]); + if (s->SetupInst[i]) + free(s->SetupInst[i]); + } + free(s); +} + + + +static void +new_arith_inst(struct ati_fragment_shader *prog) +{ +/* set "default" instruction as not all may get defined. + there is no specified way to express a nop with ati fragment shaders we use + GL_NONE as the op enum and just set some params to 0 - so nothing to do here */ + prog->numArithInstr[prog->cur_pass >> 1]++; +} + +static void +new_tex_inst(struct ati_fragment_shader *prog) +{ +} + +static void match_pair_inst(struct ati_fragment_shader *curProg, GLuint optype) +{ + if (optype == curProg->last_optype) { + curProg->last_optype = 1; + } +} + +#if MESA_DEBUG_ATI_FS +static char * +create_dst_mod_str(GLuint mod) +{ + static char ret_str[1024]; + + memset(ret_str, 0, 1024); + if (mod & GL_2X_BIT_ATI) + strncat(ret_str, "|2X", 1024); + + if (mod & GL_4X_BIT_ATI) + strncat(ret_str, "|4X", 1024); + + if (mod & GL_8X_BIT_ATI) + strncat(ret_str, "|8X", 1024); + if (mod & GL_HALF_BIT_ATI) + strncat(ret_str, "|HA", 1024); + if (mod & GL_QUARTER_BIT_ATI) + strncat(ret_str, "|QU", 1024); + if (mod & GL_EIGHTH_BIT_ATI) + strncat(ret_str, "|EI", 1024); + + if (mod & GL_SATURATE_BIT_ATI) + strncat(ret_str, "|SAT", 1024); + + if (strlen(ret_str) == 0) + strncat(ret_str, "NONE", 1024); + return ret_str; +} + +static char *atifs_ops[] = {"ColorFragmentOp1ATI", "ColorFragmentOp2ATI", "ColorFragmentOp3ATI", + "AlphaFragmentOp1ATI", "AlphaFragmentOp2ATI", "AlphaFragmentOp3ATI" }; + +static void debug_op(GLint optype, GLuint arg_count, GLenum op, GLuint dst, + GLuint dstMask, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, + GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, + GLuint arg3Rep, GLuint arg3Mod) +{ + char *op_name; + + op_name = atifs_ops[(arg_count-1)+(optype?3:0)]; + + fprintf(stderr, "%s(%s, %s", op_name, _mesa_lookup_enum_by_nr(op), + _mesa_lookup_enum_by_nr(dst)); + if (!optype) + fprintf(stderr, ", %d", dstMask); + + fprintf(stderr, ", %s", create_dst_mod_str(dstMod)); + + fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg1), + _mesa_lookup_enum_by_nr(arg1Rep), arg1Mod); + if (arg_count>1) + fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg2), + _mesa_lookup_enum_by_nr(arg2Rep), arg2Mod); + if (arg_count>2) + fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg3), + _mesa_lookup_enum_by_nr(arg3Rep), arg3Mod); + + fprintf(stderr,")\n"); + +} +#endif + +static int check_arith_arg(struct ati_fragment_shader *curProg, + GLuint optype, GLuint arg, GLuint argRep) +{ + GET_CURRENT_CONTEXT(ctx); + + if (((arg < GL_CON_0_ATI) || (arg > GL_CON_7_ATI)) && + ((arg < GL_REG_0_ATI) || (arg > GL_REG_5_ATI)) && + (arg != GL_ZERO) && (arg != GL_ONE) && + (arg != GL_PRIMARY_COLOR_ARB) && (arg != GL_SECONDARY_INTERPOLATOR_ATI)) { + _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(arg)"); + return 0; + } + if ((arg == GL_SECONDARY_INTERPOLATOR_ATI) && (((optype == 0) && (argRep == GL_ALPHA)) || + ((optype == 1) && ((arg == GL_ALPHA) || (argRep == GL_NONE))))) { + _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(sec_interp)"); + return 0; + } + if ((arg == GL_SECONDARY_INTERPOLATOR_ATI) && (((optype == 0) && (argRep == GL_ALPHA)) || + ((optype == 1) && ((arg == GL_ALPHA) || (argRep == GL_NONE))))) { + _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(sec_interp)"); + return 0; + } + if ((curProg->cur_pass == 1) && + ((arg == GL_PRIMARY_COLOR_ARB) || (arg == GL_SECONDARY_INTERPOLATOR_ATI))) { + curProg->interpinp1 = GL_TRUE; + } + return 1; +} + +GLuint GLAPIENTRY +_mesa_GenFragmentShadersATI(GLuint range) +{ + GLuint first; + GLuint i; + GET_CURRENT_CONTEXT(ctx); + + if (range == 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGenFragmentShadersATI(range)"); + return 0; + } + + if (ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGenFragmentShadersATI(insideShader)"); + return 0; + } + + first = _mesa_HashFindFreeKeyBlock(ctx->Shared->ATIShaders, range); + for (i = 0; i < range; i++) { + _mesa_HashInsert(ctx->Shared->ATIShaders, first + i, &DummyShader); + } + + return first; +} + +void GLAPIENTRY +_mesa_BindFragmentShaderATI(GLuint id) +{ + GET_CURRENT_CONTEXT(ctx); + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + struct ati_fragment_shader *newProg; + + if (ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glBindFragmentShaderATI(insideShader)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + + if (curProg->Id == id) { + return; + } + + /* unbind current */ + if (curProg->Id != 0) { + curProg->RefCount--; + if (curProg->RefCount <= 0) { + _mesa_HashRemove(ctx->Shared->ATIShaders, id); + } + } + + /* find new shader */ + if (id == 0) { + newProg = ctx->Shared->DefaultFragmentShader; + } + else { + newProg = (struct ati_fragment_shader *) + _mesa_HashLookup(ctx->Shared->ATIShaders, id); + if (!newProg || newProg == &DummyShader) { + /* allocate a new program now */ + newProg = _mesa_new_ati_fragment_shader(ctx, id); + if (!newProg) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindFragmentShaderATI"); + return; + } + _mesa_HashInsert(ctx->Shared->ATIShaders, id, newProg); + } + + } + + /* do actual bind */ + ctx->ATIFragmentShader.Current = newProg; + + ASSERT(ctx->ATIFragmentShader.Current); + if (newProg) + newProg->RefCount++; + + /*if (ctx->Driver.BindProgram) + ctx->Driver.BindProgram(ctx, target, prog); */ +} + +void GLAPIENTRY +_mesa_DeleteFragmentShaderATI(GLuint id) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteFragmentShaderATI(insideShader)"); + return; + } + + if (id != 0) { + struct ati_fragment_shader *prog = (struct ati_fragment_shader *) + _mesa_HashLookup(ctx->Shared->ATIShaders, id); + if (prog == &DummyShader) { + _mesa_HashRemove(ctx->Shared->ATIShaders, id); + } + else if (prog) { + if (ctx->ATIFragmentShader.Current && + ctx->ATIFragmentShader.Current->Id == id) { + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _mesa_BindFragmentShaderATI(0); + } + } + + /* The ID is immediately available for re-use now */ + _mesa_HashRemove(ctx->Shared->ATIShaders, id); + if (prog) { + prog->RefCount--; + if (prog->RefCount <= 0) { + assert(prog != &DummyShader); + free(prog); + } + } + } +} + + +void GLAPIENTRY +_mesa_BeginFragmentShaderATI(void) +{ + GLint i; + GET_CURRENT_CONTEXT(ctx); + + if (ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginFragmentShaderATI(insideShader)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + + /* if the shader was already defined free instructions and get new ones + (or, could use the same mem but would need to reinitialize) */ + /* no idea if it's allowed to redefine a shader */ + for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { + if (ctx->ATIFragmentShader.Current->Instructions[i]) + free(ctx->ATIFragmentShader.Current->Instructions[i]); + if (ctx->ATIFragmentShader.Current->SetupInst[i]) + free(ctx->ATIFragmentShader.Current->SetupInst[i]); + } + + /* malloc the instructions here - not sure if the best place but its + a start */ + for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { + ctx->ATIFragmentShader.Current->Instructions[i] = + (struct atifs_instruction *) + calloc(1, sizeof(struct atifs_instruction) * + (MAX_NUM_INSTRUCTIONS_PER_PASS_ATI)); + ctx->ATIFragmentShader.Current->SetupInst[i] = + (struct atifs_setupinst *) + calloc(1, sizeof(struct atifs_setupinst) * + (MAX_NUM_FRAGMENT_REGISTERS_ATI)); + } + +/* can't rely on calloc for initialization as it's possible to redefine a shader (?) */ + ctx->ATIFragmentShader.Current->LocalConstDef = 0; + ctx->ATIFragmentShader.Current->numArithInstr[0] = 0; + ctx->ATIFragmentShader.Current->numArithInstr[1] = 0; + ctx->ATIFragmentShader.Current->regsAssigned[0] = 0; + ctx->ATIFragmentShader.Current->regsAssigned[1] = 0; + ctx->ATIFragmentShader.Current->NumPasses = 0; + ctx->ATIFragmentShader.Current->cur_pass = 0; + ctx->ATIFragmentShader.Current->last_optype = 0; + ctx->ATIFragmentShader.Current->interpinp1 = GL_FALSE; + ctx->ATIFragmentShader.Current->isValid = GL_FALSE; + ctx->ATIFragmentShader.Current->swizzlerq = 0; + ctx->ATIFragmentShader.Compiling = 1; +} + +void GLAPIENTRY +_mesa_EndFragmentShaderATI(void) +{ + GET_CURRENT_CONTEXT(ctx); + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; +#if MESA_DEBUG_ATI_FS + GLint i, j; +#endif + + if (!ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glEndFragmentShaderATI(outsideShader)"); + return; + } + if (curProg->interpinp1 && (ctx->ATIFragmentShader.Current->cur_pass > 1)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glEndFragmentShaderATI(interpinfirstpass)"); + /* according to spec, DON'T return here */ + } + + match_pair_inst(curProg, 0); + ctx->ATIFragmentShader.Compiling = 0; + ctx->ATIFragmentShader.Current->isValid = GL_TRUE; + if ((ctx->ATIFragmentShader.Current->cur_pass == 0) || + (ctx->ATIFragmentShader.Current->cur_pass == 2)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glEndFragmentShaderATI(noarithinst)"); + } + if (ctx->ATIFragmentShader.Current->cur_pass > 1) + ctx->ATIFragmentShader.Current->NumPasses = 2; + else + ctx->ATIFragmentShader.Current->NumPasses = 1; + + ctx->ATIFragmentShader.Current->cur_pass = 0; + +#if MESA_DEBUG_ATI_FS + for (j = 0; j < MAX_NUM_PASSES_ATI; j++) { + for (i = 0; i < MAX_NUM_FRAGMENT_REGISTERS_ATI; i++) { + GLuint op = curProg->SetupInst[j][i].Opcode; + const char *op_enum = op > 5 ? _mesa_lookup_enum_by_nr(op) : "0"; + GLuint src = curProg->SetupInst[j][i].src; + GLuint swizzle = curProg->SetupInst[j][i].swizzle; + fprintf(stderr, "%2d %04X %s %d %04X\n", i, op, op_enum, src, + swizzle); + } + for (i = 0; i < curProg->numArithInstr[j]; i++) { + GLuint op0 = curProg->Instructions[j][i].Opcode[0]; + GLuint op1 = curProg->Instructions[j][i].Opcode[1]; + const char *op0_enum = op0 > 5 ? _mesa_lookup_enum_by_nr(op0) : "0"; + const char *op1_enum = op1 > 5 ? _mesa_lookup_enum_by_nr(op1) : "0"; + GLuint count0 = curProg->Instructions[j][i].ArgCount[0]; + GLuint count1 = curProg->Instructions[j][i].ArgCount[1]; + fprintf(stderr, "%2d %04X %s %d %04X %s %d\n", i, op0, op0_enum, count0, + op1, op1_enum, count1); + } + } +#endif + + if (!ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_SHADER_ATI, NULL)) { + ctx->ATIFragmentShader.Current->isValid = GL_FALSE; + /* XXX is this the right error? */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glEndFragmentShaderATI(driver rejected shader)"); + } +} + +void GLAPIENTRY +_mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle) +{ + GET_CURRENT_CONTEXT(ctx); + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + struct atifs_setupinst *curI; + + if (!ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(outsideShader)"); + return; + } + + if (curProg->cur_pass == 1) { + match_pair_inst(curProg, 0); + curProg->cur_pass = 2; + } + if ((curProg->cur_pass > 2) || + ((1 << (dst - GL_REG_0_ATI)) & curProg->regsAssigned[curProg->cur_pass >> 1])) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoord(pass)"); + return; + } + if ((dst < GL_REG_0_ATI) || (dst > GL_REG_5_ATI) || + ((dst - GL_REG_0_ATI) >= ctx->Const.MaxTextureUnits)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glPassTexCoordATI(dst)"); + return; + } + if (((coord < GL_REG_0_ATI) || (coord > GL_REG_5_ATI)) && + ((coord < GL_TEXTURE0_ARB) || (coord > GL_TEXTURE7_ARB) || + ((coord - GL_TEXTURE0_ARB) >= ctx->Const.MaxTextureUnits))) { + _mesa_error(ctx, GL_INVALID_ENUM, "glPassTexCoordATI(coord)"); + return; + } + if ((curProg->cur_pass == 0) && (coord >= GL_REG_0_ATI)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(coord)"); + return; + } + if (!(swizzle >= GL_SWIZZLE_STR_ATI) && (swizzle <= GL_SWIZZLE_STQ_DQ_ATI)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glPassTexCoordATI(swizzle)"); + return; + } + if ((swizzle & 1) && (coord >= GL_REG_0_ATI)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(swizzle)"); + return; + } + if (coord <= GL_TEXTURE7_ARB) { + GLuint tmp = coord - GL_TEXTURE0_ARB; + if ((((curProg->swizzlerq >> (tmp * 2)) & 3) != 0) && + (((swizzle & 1) + 1) != ((curProg->swizzlerq >> (tmp * 2)) & 3))) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glPassTexCoordATI(swizzle)"); + return; + } else { + curProg->swizzlerq |= (((swizzle & 1) + 1) << (tmp * 2)); + } + } + + curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI); + new_tex_inst(curProg); + + /* add the instructions */ + curI = &curProg->SetupInst[curProg->cur_pass >> 1][dst - GL_REG_0_ATI]; + + curI->Opcode = ATI_FRAGMENT_SHADER_PASS_OP; + curI->src = coord; + curI->swizzle = swizzle; + +#if MESA_DEBUG_ATI_FS + _mesa_debug(ctx, "%s(%s, %s, %s)\n", __FUNCTION__, + _mesa_lookup_enum_by_nr(dst), _mesa_lookup_enum_by_nr(coord), + _mesa_lookup_enum_by_nr(swizzle)); +#endif +} + +void GLAPIENTRY +_mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum swizzle) +{ + GET_CURRENT_CONTEXT(ctx); + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + struct atifs_setupinst *curI; + + if (!ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(outsideShader)"); + return; + } + + if (curProg->cur_pass == 1) { + match_pair_inst(curProg, 0); + curProg->cur_pass = 2; + } + if ((curProg->cur_pass > 2) || + ((1 << (dst - GL_REG_0_ATI)) & curProg->regsAssigned[curProg->cur_pass >> 1])) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(pass)"); + return; + } + if ((dst < GL_REG_0_ATI) || (dst > GL_REG_5_ATI) || + ((dst - GL_REG_0_ATI) >= ctx->Const.MaxTextureUnits)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glSampleMapATI(dst)"); + return; + } + if (((interp < GL_REG_0_ATI) || (interp > GL_REG_5_ATI)) && + ((interp < GL_TEXTURE0_ARB) || (interp > GL_TEXTURE7_ARB) || + ((interp - GL_TEXTURE0_ARB) >= ctx->Const.MaxTextureUnits))) { + /* is this texture5 or texture7? spec is a bit unclear there */ + _mesa_error(ctx, GL_INVALID_ENUM, "glSampleMapATI(interp)"); + return; + } + if ((curProg->cur_pass == 0) && (interp >= GL_REG_0_ATI)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(interp)"); + return; + } + if (!(swizzle >= GL_SWIZZLE_STR_ATI) && (swizzle <= GL_SWIZZLE_STQ_DQ_ATI)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glSampleMapATI(swizzle)"); + return; + } + if ((swizzle & 1) && (interp >= GL_REG_0_ATI)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(swizzle)"); + return; + } + if (interp <= GL_TEXTURE7_ARB) { + GLuint tmp = interp - GL_TEXTURE0_ARB; + if ((((curProg->swizzlerq >> (tmp * 2)) & 3) != 0) && + (((swizzle & 1) + 1) != ((curProg->swizzlerq >> (tmp * 2)) & 3))) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMapATI(swizzle)"); + return; + } else { + curProg->swizzlerq |= (((swizzle & 1) + 1) << (tmp * 2)); + } + } + + curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI); + new_tex_inst(curProg); + + /* add the instructions */ + curI = &curProg->SetupInst[curProg->cur_pass >> 1][dst - GL_REG_0_ATI]; + + curI->Opcode = ATI_FRAGMENT_SHADER_SAMPLE_OP; + curI->src = interp; + curI->swizzle = swizzle; + +#if MESA_DEBUG_ATI_FS + _mesa_debug(ctx, "%s(%s, %s, %s)\n", __FUNCTION__, + _mesa_lookup_enum_by_nr(dst), _mesa_lookup_enum_by_nr(interp), + _mesa_lookup_enum_by_nr(swizzle)); +#endif +} + +static void +_mesa_FragmentOpXATI(GLint optype, GLuint arg_count, GLenum op, GLuint dst, + GLuint dstMask, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, + GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, + GLuint arg3Rep, GLuint arg3Mod) +{ + GET_CURRENT_CONTEXT(ctx); + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + GLint ci; + struct atifs_instruction *curI; + GLuint modtemp = dstMod & ~GL_SATURATE_BIT_ATI; + + if (!ctx->ATIFragmentShader.Compiling) { + _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(outsideShader)"); + return; + } + + if (curProg->cur_pass==0) + curProg->cur_pass=1; + + else if (curProg->cur_pass==2) + curProg->cur_pass=3; + + /* decide whether this is a new instruction or not ... all color instructions are new, + and alpha instructions might also be new if there was no preceding color inst */ + if ((optype == 0) || (curProg->last_optype == optype)) { + if (curProg->numArithInstr[curProg->cur_pass >> 1] > 7) { + _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(instrCount)"); + return; + } + /* easier to do that here slight side effect invalid instr will still be inserted as nops */ + match_pair_inst(curProg, optype); + new_arith_inst(curProg); + } + curProg->last_optype = optype; + ci = curProg->numArithInstr[curProg->cur_pass >> 1] - 1; + + /* add the instructions */ + curI = &curProg->Instructions[curProg->cur_pass >> 1][ci]; + + /* error checking */ + if ((dst < GL_REG_0_ATI) || (dst > GL_REG_5_ATI)) { + _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(dst)"); + return; + } + if ((modtemp != GL_NONE) && (modtemp != GL_2X_BIT_ATI) && + (modtemp != GL_4X_BIT_ATI) && (modtemp != GL_8X_BIT_ATI) && + (modtemp != GL_HALF_BIT_ATI) && !(modtemp != GL_QUARTER_BIT_ATI) && + (modtemp != GL_EIGHTH_BIT_ATI)) { + _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(dstMod)%x", modtemp); + return; + } + /* op checking? Actually looks like that's missing in the spec but we'll do it anyway */ + if (((op < GL_ADD_ATI) || (op > GL_DOT2_ADD_ATI)) && !(op == GL_MOV_ATI)) { + _mesa_error(ctx, GL_INVALID_ENUM, "C/AFragmentOpATI(op)"); + return; + } + if (optype == 1) { + if (((op == GL_DOT2_ADD_ATI) && (curI->Opcode[0] != GL_DOT2_ADD_ATI)) || + ((op == GL_DOT3_ATI) && (curI->Opcode[0] != GL_DOT3_ATI)) || + ((op == GL_DOT4_ATI) && (curI->Opcode[0] != GL_DOT4_ATI)) || + ((op != GL_DOT4_ATI) && (curI->Opcode[0] == GL_DOT4_ATI))) { + _mesa_error(ctx, GL_INVALID_OPERATION, "AFragmentOpATI(op)"); + return; + } + } + if ((op == GL_DOT4_ATI) && + (((arg1 == GL_SECONDARY_INTERPOLATOR_ATI) && ((arg1Rep == GL_ALPHA) || (arg1Rep == GL_NONE))) || + (((arg2 == GL_SECONDARY_INTERPOLATOR_ATI) && ((arg2Rep == GL_ALPHA) || (arg2Rep == GL_NONE)))))) { + _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(sec_interp)"); + } + + if (!check_arith_arg(curProg, optype, arg1, arg1Rep)) { + return; + } + if (arg2) { + if (!check_arith_arg(curProg, optype, arg2, arg2Rep)) { + return; + } + } + if (arg3) { + if (!check_arith_arg(curProg, optype, arg3, arg3Rep)) { + return; + } + if ((arg1 >= GL_CON_0_ATI) && (arg1 <= GL_CON_7_ATI) && + (arg2 >= GL_CON_0_ATI) && (arg2 <= GL_CON_7_ATI) && + (arg3 >= GL_CON_0_ATI) && (arg3 <= GL_CON_7_ATI) && + (arg1 != arg2) && (arg1 != arg3) && (arg2 != arg3)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(3Consts)"); + return; + } + } + + /* all ok - not all fully validated though (e.g. argNMod - spec doesn't say anything) */ + + curI->Opcode[optype] = op; + curI->SrcReg[optype][0].Index = arg1; + curI->SrcReg[optype][0].argRep = arg1Rep; + curI->SrcReg[optype][0].argMod = arg1Mod; + curI->ArgCount[optype] = arg_count; + + if (arg2) { + curI->SrcReg[optype][1].Index = arg2; + curI->SrcReg[optype][1].argRep = arg2Rep; + curI->SrcReg[optype][1].argMod = arg2Mod; + } + + if (arg3) { + curI->SrcReg[optype][2].Index = arg3; + curI->SrcReg[optype][2].argRep = arg3Rep; + curI->SrcReg[optype][2].argMod = arg3Mod; + } + + curI->DstReg[optype].Index = dst; + curI->DstReg[optype].dstMod = dstMod; + curI->DstReg[optype].dstMask = dstMask; + +#if MESA_DEBUG_ATI_FS + debug_op(optype, arg_count, op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod); +#endif + +} + +void GLAPIENTRY +_mesa_ColorFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMask, + GLuint dstMod, GLuint arg1, GLuint arg1Rep, + GLuint arg1Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 1, op, dst, dstMask, + dstMod, arg1, arg1Rep, arg1Mod, 0, 0, 0, 0, 0, 0); +} + +void GLAPIENTRY +_mesa_ColorFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMask, + GLuint dstMod, GLuint arg1, GLuint arg1Rep, + GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, + GLuint arg2Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 2, op, dst, dstMask, + dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, + arg2Mod, 0, 0, 0); +} + +void GLAPIENTRY +_mesa_ColorFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMask, + GLuint dstMod, GLuint arg1, GLuint arg1Rep, + GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, + GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, + GLuint arg3Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 3, op, dst, dstMask, + dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, + arg2Mod, arg3, arg3Rep, arg3Mod); +} + +void GLAPIENTRY +_mesa_AlphaFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 1, op, dst, 0, dstMod, + arg1, arg1Rep, arg1Mod, 0, 0, 0, 0, 0, 0); +} + +void GLAPIENTRY +_mesa_AlphaFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, + GLuint arg2Rep, GLuint arg2Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 2, op, dst, 0, dstMod, + arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, 0, 0, + 0); +} + +void GLAPIENTRY +_mesa_AlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, + GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, + GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, + GLuint arg3Rep, GLuint arg3Mod) +{ + _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 3, op, dst, 0, dstMod, + arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, + arg3Rep, arg3Mod); +} + +void GLAPIENTRY +_mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value) +{ + GLuint dstindex; + GET_CURRENT_CONTEXT(ctx); + + if ((dst < GL_CON_0_ATI) || (dst > GL_CON_7_ATI)) { + /* spec says nothing about what should happen here but we can't just segfault...*/ + _mesa_error(ctx, GL_INVALID_ENUM, "glSetFragmentShaderConstantATI(dst)"); + return; + } + + dstindex = dst - GL_CON_0_ATI; + if (ctx->ATIFragmentShader.Compiling) { + struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; + COPY_4V(curProg->Constants[dstindex], value); + curProg->LocalConstDef |= 1 << dstindex; + } + else { + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + COPY_4V(ctx->ATIFragmentShader.GlobalConstants[dstindex], value); + } +} + +#endif /* FEATURE_ATI_fragment_shader */ diff --git a/mesalib/src/mesa/main/blend.h b/mesalib/src/mesa/main/blend.h index b0a6b0135..d74f17ef1 100644 --- a/mesalib/src/mesa/main/blend.h +++ b/mesalib/src/mesa/main/blend.h @@ -1,106 +1,106 @@ -/** - * \file blend.h - * Blending functions operations. - */ - -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 1999-2006 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 BLEND_H -#define BLEND_H - - -#include "glheader.h" - -struct gl_context; - - -extern void GLAPIENTRY -_mesa_BlendFunc( GLenum sfactor, GLenum dfactor ); - - -extern void GLAPIENTRY -_mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, - GLenum sfactorA, GLenum dfactorA ); - - -extern void GLAPIENTRY -_mesa_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor); - - -extern void GLAPIENTRY -_mesa_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB, - GLenum sfactorA, GLenum dfactorA); - - -extern void GLAPIENTRY -_mesa_BlendEquation( GLenum mode ); - - -extern void GLAPIENTRY -_mesa_BlendEquationi(GLuint buf, GLenum mode); - - -extern void GLAPIENTRY -_mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA ); - - -extern void GLAPIENTRY -_mesa_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA); - - -extern void GLAPIENTRY -_mesa_BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - - -extern void GLAPIENTRY -_mesa_AlphaFunc( GLenum func, GLclampf ref ); - - -extern void GLAPIENTRY -_mesa_LogicOp( GLenum opcode ); - - -extern void GLAPIENTRY -_mesa_IndexMask( GLuint mask ); - -extern void GLAPIENTRY -_mesa_ColorMask( GLboolean red, GLboolean green, - GLboolean blue, GLboolean alpha ); - -extern void GLAPIENTRY -_mesa_ColorMaskIndexed( GLuint buf, GLboolean red, GLboolean green, - GLboolean blue, GLboolean alpha ); - - -extern void GLAPIENTRY -_mesa_ClampColorARB(GLenum target, GLenum clamp); - - -extern void -_mesa_init_color( struct gl_context * ctx ); - -#endif +/** + * \file blend.h + * Blending functions operations. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.5.2 + * + * Copyright (C) 1999-2006 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 BLEND_H +#define BLEND_H + + +#include "glheader.h" + +struct gl_context; + + +extern void GLAPIENTRY +_mesa_BlendFunc( GLenum sfactor, GLenum dfactor ); + + +extern void GLAPIENTRY +_mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorA, GLenum dfactorA ); + + +extern void GLAPIENTRY +_mesa_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor); + + +extern void GLAPIENTRY +_mesa_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorA, GLenum dfactorA); + + +extern void GLAPIENTRY +_mesa_BlendEquation( GLenum mode ); + + +extern void GLAPIENTRY +_mesa_BlendEquationi(GLuint buf, GLenum mode); + + +extern void GLAPIENTRY +_mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA ); + + +extern void GLAPIENTRY +_mesa_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA); + + +extern void GLAPIENTRY +_mesa_BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + + +extern void GLAPIENTRY +_mesa_AlphaFunc( GLenum func, GLclampf ref ); + + +extern void GLAPIENTRY +_mesa_LogicOp( GLenum opcode ); + + +extern void GLAPIENTRY +_mesa_IndexMask( GLuint mask ); + +extern void GLAPIENTRY +_mesa_ColorMask( GLboolean red, GLboolean green, + GLboolean blue, GLboolean alpha ); + +extern void GLAPIENTRY +_mesa_ColorMaskIndexed( GLuint buf, GLboolean red, GLboolean green, + GLboolean blue, GLboolean alpha ); + + +extern void GLAPIENTRY +_mesa_ClampColorARB(GLenum target, GLenum clamp); + + +extern void +_mesa_init_color( struct gl_context * ctx ); + +#endif diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index ae7bac14d..36a761986 100644 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -42,6 +42,7 @@ #include "mfeatures.h" #include "mtypes.h" #include "texobj.h" +#include "transformfeedback.h" /* Debug flags */ @@ -821,6 +822,24 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) _mesa_BindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 ); } + /* unbind ARB_copy_buffer binding points */ + if (ctx->CopyReadBuffer == bufObj) { + _mesa_BindBufferARB( GL_COPY_READ_BUFFER, 0 ); + } + if (ctx->CopyWriteBuffer == bufObj) { + _mesa_BindBufferARB( GL_COPY_WRITE_BUFFER, 0 ); + } + + /* unbind transform feedback binding points */ + if (ctx->TransformFeedback.CurrentBuffer == bufObj) { + _mesa_BindBufferARB( GL_TRANSFORM_FEEDBACK_BUFFER, 0 ); + } + for (j = 0; j < MAX_FEEDBACK_ATTRIBS; j++) { + if (ctx->TransformFeedback.CurrentObject->Buffers[j] == bufObj) { + _mesa_BindBufferBase( GL_TRANSFORM_FEEDBACK_BUFFER, j, 0 ); + } + } + /* unbind any pixel pack/unpack pointers bound to this buffer */ if (ctx->Pack.BufferObj == bufObj) { _mesa_BindBufferARB( GL_PIXEL_PACK_BUFFER_EXT, 0 ); diff --git a/mesalib/src/mesa/main/clear.h b/mesalib/src/mesa/main/clear.h index d3d64fd62..783271920 100644 --- a/mesalib/src/mesa/main/clear.h +++ b/mesalib/src/mesa/main/clear.h @@ -1,64 +1,64 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 1999-2007 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 CLEAR_H -#define CLEAR_H - - -#include "glheader.h" - - -extern void GLAPIENTRY -_mesa_ClearIndex( GLfloat c ); - -extern void GLAPIENTRY -_mesa_ClearColor( GLclampf red, GLclampf green, - GLclampf blue, GLclampf alpha ); - -extern void GLAPIENTRY -_mesa_ClearColorIiEXT(GLint r, GLint g, GLint b, GLint a); - -extern void GLAPIENTRY -_mesa_ClearColorIuiEXT(GLuint r, GLuint g, GLuint b, GLuint a); - - -extern void GLAPIENTRY -_mesa_Clear( GLbitfield mask ); - - -extern void GLAPIENTRY -_mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value); - -extern void GLAPIENTRY -_mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value); - -extern void GLAPIENTRY -_mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value); - -extern void GLAPIENTRY -_mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer, - GLfloat depth, GLint stencil); - -#endif +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 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 CLEAR_H +#define CLEAR_H + + +#include "glheader.h" + + +extern void GLAPIENTRY +_mesa_ClearIndex( GLfloat c ); + +extern void GLAPIENTRY +_mesa_ClearColor( GLclampf red, GLclampf green, + GLclampf blue, GLclampf alpha ); + +extern void GLAPIENTRY +_mesa_ClearColorIiEXT(GLint r, GLint g, GLint b, GLint a); + +extern void GLAPIENTRY +_mesa_ClearColorIuiEXT(GLuint r, GLuint g, GLuint b, GLuint a); + + +extern void GLAPIENTRY +_mesa_Clear( GLbitfield mask ); + + +extern void GLAPIENTRY +_mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value); + +extern void GLAPIENTRY +_mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value); + +extern void GLAPIENTRY +_mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value); + +extern void GLAPIENTRY +_mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer, + GLfloat depth, GLint stencil); + +#endif diff --git a/mesalib/src/mesa/main/clip.c b/mesalib/src/mesa/main/clip.c index 6b9b3b58c..ba2028cf2 100644 --- a/mesalib/src/mesa/main/clip.c +++ b/mesalib/src/mesa/main/clip.c @@ -1,116 +1,116 @@ -/* - * 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. - */ - - -#include "glheader.h" -#include "clip.h" -#include "context.h" -#include "macros.h" -#include "mtypes.h" - -#include "math/m_matrix.h" - - -/** - * Update derived clip plane state. - */ -void -_mesa_update_clip_plane(struct gl_context *ctx, GLuint plane) -{ - if (_math_matrix_is_dirty(ctx->ProjectionMatrixStack.Top)) - _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); - - /* Clip-Space Plane = Eye-Space Plane * Projection Matrix */ - _mesa_transform_vector(ctx->Transform._ClipUserPlane[plane], - ctx->Transform.EyeUserPlane[plane], - ctx->ProjectionMatrixStack.Top->inv); -} - - -void GLAPIENTRY -_mesa_ClipPlane( GLenum plane, const GLdouble *eq ) -{ - GET_CURRENT_CONTEXT(ctx); - GLint p; - GLfloat equation[4]; - ASSERT_OUTSIDE_BEGIN_END(ctx); - - p = (GLint) plane - (GLint) GL_CLIP_PLANE0; - if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { - _mesa_error( ctx, GL_INVALID_ENUM, "glClipPlane" ); - return; - } - - equation[0] = (GLfloat) eq[0]; - equation[1] = (GLfloat) eq[1]; - equation[2] = (GLfloat) eq[2]; - equation[3] = (GLfloat) eq[3]; - - /* - * The equation is transformed by the transpose of the inverse of the - * current modelview matrix and stored in the resulting eye coordinates. - * - * KW: Eqn is then transformed to the current clip space, where user - * clipping now takes place. The clip-space equations are recalculated - * whenever the projection matrix changes. - */ - if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) - _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); - - _mesa_transform_vector( equation, equation, - ctx->ModelviewMatrixStack.Top->inv ); - - if (TEST_EQ_4V(ctx->Transform.EyeUserPlane[p], equation)) - return; - - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - COPY_4FV(ctx->Transform.EyeUserPlane[p], equation); - - if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { - _mesa_update_clip_plane(ctx, p); - } - - if (ctx->Driver.ClipPlane) - ctx->Driver.ClipPlane( ctx, plane, equation ); -} - - -void GLAPIENTRY -_mesa_GetClipPlane( GLenum plane, GLdouble *equation ) -{ - GET_CURRENT_CONTEXT(ctx); - GLint p; - ASSERT_OUTSIDE_BEGIN_END(ctx); - - p = (GLint) (plane - GL_CLIP_PLANE0); - if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetClipPlane" ); - return; - } - - equation[0] = (GLdouble) ctx->Transform.EyeUserPlane[p][0]; - equation[1] = (GLdouble) ctx->Transform.EyeUserPlane[p][1]; - equation[2] = (GLdouble) ctx->Transform.EyeUserPlane[p][2]; - equation[3] = (GLdouble) ctx->Transform.EyeUserPlane[p][3]; -} +/* + * 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. + */ + + +#include "glheader.h" +#include "clip.h" +#include "context.h" +#include "macros.h" +#include "mtypes.h" + +#include "math/m_matrix.h" + + +/** + * Update derived clip plane state. + */ +void +_mesa_update_clip_plane(struct gl_context *ctx, GLuint plane) +{ + if (_math_matrix_is_dirty(ctx->ProjectionMatrixStack.Top)) + _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); + + /* Clip-Space Plane = Eye-Space Plane * Projection Matrix */ + _mesa_transform_vector(ctx->Transform._ClipUserPlane[plane], + ctx->Transform.EyeUserPlane[plane], + ctx->ProjectionMatrixStack.Top->inv); +} + + +void GLAPIENTRY +_mesa_ClipPlane( GLenum plane, const GLdouble *eq ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint p; + GLfloat equation[4]; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + p = (GLint) plane - (GLint) GL_CLIP_PLANE0; + if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { + _mesa_error( ctx, GL_INVALID_ENUM, "glClipPlane" ); + return; + } + + equation[0] = (GLfloat) eq[0]; + equation[1] = (GLfloat) eq[1]; + equation[2] = (GLfloat) eq[2]; + equation[3] = (GLfloat) eq[3]; + + /* + * The equation is transformed by the transpose of the inverse of the + * current modelview matrix and stored in the resulting eye coordinates. + * + * KW: Eqn is then transformed to the current clip space, where user + * clipping now takes place. The clip-space equations are recalculated + * whenever the projection matrix changes. + */ + if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); + + _mesa_transform_vector( equation, equation, + ctx->ModelviewMatrixStack.Top->inv ); + + if (TEST_EQ_4V(ctx->Transform.EyeUserPlane[p], equation)) + return; + + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + COPY_4FV(ctx->Transform.EyeUserPlane[p], equation); + + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { + _mesa_update_clip_plane(ctx, p); + } + + if (ctx->Driver.ClipPlane) + ctx->Driver.ClipPlane( ctx, plane, equation ); +} + + +void GLAPIENTRY +_mesa_GetClipPlane( GLenum plane, GLdouble *equation ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint p; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + p = (GLint) (plane - GL_CLIP_PLANE0); + if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetClipPlane" ); + return; + } + + equation[0] = (GLdouble) ctx->Transform.EyeUserPlane[p][0]; + equation[1] = (GLdouble) ctx->Transform.EyeUserPlane[p][1]; + equation[2] = (GLdouble) ctx->Transform.EyeUserPlane[p][2]; + equation[3] = (GLdouble) ctx->Transform.EyeUserPlane[p][3]; +} diff --git a/mesalib/src/mesa/main/clip.h b/mesalib/src/mesa/main/clip.h index 9a94542ec..a8e6d7687 100644 --- a/mesalib/src/mesa/main/clip.h +++ b/mesalib/src/mesa/main/clip.h @@ -1,47 +1,47 @@ -/** - * \file clip.h - */ - -/* - * 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 CLIP_H -#define CLIP_H - -#include "glheader.h" - -struct gl_context; - -extern void -_mesa_update_clip_plane(struct gl_context *ctx, GLuint plane); - -extern void GLAPIENTRY -_mesa_ClipPlane( GLenum plane, const GLdouble *equation ); - -extern void GLAPIENTRY -_mesa_GetClipPlane( GLenum plane, GLdouble *equation ); - -#endif +/** + * \file clip.h + */ + +/* + * 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 CLIP_H +#define CLIP_H + +#include "glheader.h" + +struct gl_context; + +extern void +_mesa_update_clip_plane(struct gl_context *ctx, GLuint plane); + +extern void GLAPIENTRY +_mesa_ClipPlane( GLenum plane, const GLdouble *equation ); + +extern void GLAPIENTRY +_mesa_GetClipPlane( GLenum plane, GLdouble *equation ); + +#endif diff --git a/mesalib/src/mesa/main/condrender.h b/mesalib/src/mesa/main/condrender.h index 49e9953be..cf6d4ca28 100644 --- a/mesalib/src/mesa/main/condrender.h +++ b/mesalib/src/mesa/main/condrender.h @@ -1,45 +1,45 @@ -/* - * Mesa 3-D graphics library - * Version: 7.8 - * - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE 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. - */ - -#ifndef CONDRENDER_H -#define CONDRENDER_H - - -#include "glheader.h" -#include "context.h" - - -extern void GLAPIENTRY -_mesa_BeginConditionalRender(GLuint queryId, GLenum mode); - -extern void APIENTRY -_mesa_EndConditionalRender(void); - -extern GLboolean -_mesa_check_conditional_render(struct gl_context *ctx); - - -#endif /* CONDRENDER_H */ +/* + * Mesa 3-D graphics library + * Version: 7.8 + * + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE 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. + */ + +#ifndef CONDRENDER_H +#define CONDRENDER_H + + +#include "glheader.h" +#include "context.h" + + +extern void GLAPIENTRY +_mesa_BeginConditionalRender(GLuint queryId, GLenum mode); + +extern void APIENTRY +_mesa_EndConditionalRender(void); + +extern GLboolean +_mesa_check_conditional_render(struct gl_context *ctx); + + +#endif /* CONDRENDER_H */ diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h index 582eb5d49..1582a8c81 100644 --- a/mesalib/src/mesa/main/dd.h +++ b/mesalib/src/mesa/main/dd.h @@ -198,81 +198,32 @@ struct dd_function_table { GLenum srcFormat, GLenum srcType ); /** - * Called by glTexImage1D(). Simply copy the source texture data into the - * destination texture memory. The gl_texture_image fields, etc. will be - * fully initialized. - * The parameters are the same as glTexImage1D(), plus: + * Called by glTexImage[123]D() and glCopyTexImage[12]D() + * Allocate texture memory and copy the user's image to the buffer. + * The gl_texture_image fields, etc. will be fully initialized. + * The parameters are the same as glTexImage3D(), plus: + * \param dims 1, 2, or 3 indicating glTexImage1/2/3D() * \param packing describes how to unpack the source data. * \param texImage is the destination texture image. */ - void (*TexImage1D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); + void (*TexImage)(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint depth, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); /** - * Called by glTexImage2D(). - * - * \sa dd_function_table::TexImage1D. + * Called by glTexSubImage[123]D(). + * Replace a subset of the target texture with new texel data. */ - void (*TexImage2D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - /** - * Called by glTexImage3D(). - * - * \sa dd_function_table::TexImage1D. - */ - void (*TexImage3D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint depth, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - /** - * Called by glTexSubImage1D(). Replace a subset of the target texture - * with new texel data. - * \sa dd_function_table::TexImage1D. - */ - void (*TexSubImage1D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLsizei width, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - /** - * Called by glTexSubImage2D(). - * - * \sa dd_function_table::TexSubImage1D. - */ - void (*TexSubImage2D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - /** - * Called by glTexSubImage3D(). - * - * \sa dd_function_table::TexSubImage1D. - */ - void (*TexSubImage3D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLint depth, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); + void (*TexSubImage)(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLint depth, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); /** @@ -283,33 +234,14 @@ struct dd_function_table { struct gl_texture_image *texImage ); /** - * Called by glCopyTexSubImage1D() and glCopyTexImage1D(). + * Called by glCopyTex[Sub]Image[123]D(). */ - void (*CopyTexSubImage1D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, GLsizei width); - - /** - * Called by glCopyTexSubImage2D() and glCopyTexImage2D(). - */ - void (*CopyTexSubImage2D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height); - - /** - * Called by glCopyTexSubImage3D() and glCopyTexImage3D(). - */ - void (*CopyTexSubImage3D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height); + void (*CopyTexSubImage)(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + struct gl_renderbuffer *rb, + GLint x, GLint y, + GLsizei width, GLsizei height); /** * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled. @@ -337,66 +269,24 @@ struct dd_function_table { /*@{*/ /** - * Called by glCompressedTexImage1D(). - * The parameters are the same as for glCompressedTexImage1D(), plus a - * pointer to the destination texure image. - */ - void (*CompressedTexImage1D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLsizei width, GLint border, - GLsizei imageSize, const GLvoid *data); - /** - * Called by glCompressedTexImage2D(). - * - * \sa dd_function_table::CompressedTexImage1D. - */ - void (*CompressedTexImage2D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLsizei width, GLsizei height, GLint border, - GLsizei imageSize, const GLvoid *data); - - /** - * Called by glCompressedTexImage3D(). - * - * \sa dd_function_table::CompressedTexImage3D. - */ - void (*CompressedTexImage3D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLsizei width, GLsizei height, GLsizei depth, - GLint border, - GLsizei imageSize, const GLvoid *data); - - /** - * Called by glCompressedTexSubImage1D(). + * Called by glCompressedTexImage[123]D(). */ - void (*CompressedTexSubImage1D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLsizei width, - GLenum format, - GLsizei imageSize, const GLvoid *data); + void (*CompressedTexImage)(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLsizei width, GLsizei height, GLsizei depth, + GLint border, + GLsizei imageSize, const GLvoid *data); /** - * Called by glCompressedTexSubImage2D(). + * Called by glCompressedTexSubImage[123]D(). */ - void (*CompressedTexSubImage2D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - GLsizei width, GLint height, - GLenum format, - GLsizei imageSize, const GLvoid *data); - - /** - * Called by glCompressedTexSubImage3D(). - */ - void (*CompressedTexSubImage3D)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLint height, GLint depth, - GLenum format, - GLsizei imageSize, const GLvoid *data); + void (*CompressedTexSubImage)(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLint height, GLint depth, + GLenum format, + GLsizei imageSize, const GLvoid *data); /** * Called by glGetCompressedTexImage. diff --git a/mesalib/src/mesa/main/depth.h b/mesalib/src/mesa/main/depth.h index b1ed1f3fd..2f428629f 100644 --- a/mesalib/src/mesa/main/depth.h +++ b/mesalib/src/mesa/main/depth.h @@ -1,68 +1,68 @@ -/** - * \file depth.h - * Depth buffer operations. - */ - -/* - * 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. - */ - - -#ifndef DEPTH_H -#define DEPTH_H - - -#include "glheader.h" -#include "mfeatures.h" - -struct gl_context; - - -#if _HAVE_FULL_GL - -extern void GLAPIENTRY -_mesa_ClearDepth( GLclampd depth ); - -extern void GLAPIENTRY -_mesa_ClearDepthf( GLclampf depth ); - -extern void GLAPIENTRY -_mesa_DepthFunc( GLenum func ); - -extern void GLAPIENTRY -_mesa_DepthMask( GLboolean flag ); - -extern void GLAPIENTRY -_mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ); - -extern void -_mesa_init_depth( struct gl_context * ctx ); - -#else - -/** No-op */ -#define _mesa_init_depth( c ) ((void)0) - -#endif - -#endif +/** + * \file depth.h + * Depth buffer operations. + */ + +/* + * 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. + */ + + +#ifndef DEPTH_H +#define DEPTH_H + + +#include "glheader.h" +#include "mfeatures.h" + +struct gl_context; + + +#if _HAVE_FULL_GL + +extern void GLAPIENTRY +_mesa_ClearDepth( GLclampd depth ); + +extern void GLAPIENTRY +_mesa_ClearDepthf( GLclampf depth ); + +extern void GLAPIENTRY +_mesa_DepthFunc( GLenum func ); + +extern void GLAPIENTRY +_mesa_DepthMask( GLboolean flag ); + +extern void GLAPIENTRY +_mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ); + +extern void +_mesa_init_depth( struct gl_context * ctx ); + +#else + +/** No-op */ +#define _mesa_init_depth( c ) ((void)0) + +#endif + +#endif diff --git a/mesalib/src/mesa/main/drawtex.h b/mesalib/src/mesa/main/drawtex.h index 78bbd5b45..13ff6f97e 100644 --- a/mesalib/src/mesa/main/drawtex.h +++ b/mesalib/src/mesa/main/drawtex.h @@ -1,61 +1,61 @@ -/* - * Copyright (C) 2009 Chia-I Wu - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. - */ - -#ifndef DRAWTEX_H -#define DRAWTEX_H - - -#include "glheader.h" -#include "mfeatures.h" - - -#if FEATURE_OES_draw_texture - -extern void GLAPIENTRY -_mesa_DrawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); - -extern void GLAPIENTRY -_mesa_DrawTexfv(const GLfloat *coords); - -extern void GLAPIENTRY -_mesa_DrawTexi(GLint x, GLint y, GLint z, GLint width, GLint height); - -extern void GLAPIENTRY -_mesa_DrawTexiv(const GLint *coords); - -extern void GLAPIENTRY -_mesa_DrawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); - -extern void GLAPIENTRY -_mesa_DrawTexsv(const GLshort *coords); - -extern void GLAPIENTRY -_mesa_DrawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); - -extern void GLAPIENTRY -_mesa_DrawTexxv(const GLfixed *coords); - -#endif /* FEATURE_OES_draw_texture */ - - -#endif /* DRAWTEX_H */ +/* + * Copyright (C) 2009 Chia-I Wu + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. + */ + +#ifndef DRAWTEX_H +#define DRAWTEX_H + + +#include "glheader.h" +#include "mfeatures.h" + + +#if FEATURE_OES_draw_texture + +extern void GLAPIENTRY +_mesa_DrawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); + +extern void GLAPIENTRY +_mesa_DrawTexfv(const GLfloat *coords); + +extern void GLAPIENTRY +_mesa_DrawTexi(GLint x, GLint y, GLint z, GLint width, GLint height); + +extern void GLAPIENTRY +_mesa_DrawTexiv(const GLint *coords); + +extern void GLAPIENTRY +_mesa_DrawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); + +extern void GLAPIENTRY +_mesa_DrawTexsv(const GLshort *coords); + +extern void GLAPIENTRY +_mesa_DrawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); + +extern void GLAPIENTRY +_mesa_DrawTexxv(const GLfixed *coords); + +#endif /* FEATURE_OES_draw_texture */ + + +#endif /* DRAWTEX_H */ diff --git a/mesalib/src/mesa/main/enable.h b/mesalib/src/mesa/main/enable.h index 685e11d47..6d90c170c 100644 --- a/mesalib/src/mesa/main/enable.h +++ b/mesalib/src/mesa/main/enable.h @@ -1,71 +1,71 @@ -/** - * \file enable.h - * Enable/disable/query GL capabilities. - */ - -/* - * 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 ENABLE_H -#define ENABLE_H - - -#include "glheader.h" - -struct gl_context; - - -extern void -_mesa_set_enable( struct gl_context* ctx, GLenum cap, GLboolean state ); - -extern void GLAPIENTRY -_mesa_Disable( GLenum cap ); - -extern void GLAPIENTRY -_mesa_Enable( GLenum cap ); - -extern GLboolean GLAPIENTRY -_mesa_IsEnabled( GLenum cap ); - -extern void -_mesa_set_enablei(struct gl_context *ctx, GLenum cap, GLuint index, GLboolean state); - -extern void GLAPIENTRY -_mesa_DisableIndexed( GLenum cap, GLuint index ); - -extern void GLAPIENTRY -_mesa_EnableIndexed( GLenum cap, GLuint index ); - -extern GLboolean GLAPIENTRY -_mesa_IsEnabledIndexed( GLenum cap, GLuint index ); - -extern void GLAPIENTRY -_mesa_EnableClientState( GLenum cap ); - -extern void GLAPIENTRY -_mesa_DisableClientState( GLenum cap ); - - -#endif +/** + * \file enable.h + * Enable/disable/query GL capabilities. + */ + +/* + * 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 ENABLE_H +#define ENABLE_H + + +#include "glheader.h" + +struct gl_context; + + +extern void +_mesa_set_enable( struct gl_context* ctx, GLenum cap, GLboolean state ); + +extern void GLAPIENTRY +_mesa_Disable( GLenum cap ); + +extern void GLAPIENTRY +_mesa_Enable( GLenum cap ); + +extern GLboolean GLAPIENTRY +_mesa_IsEnabled( GLenum cap ); + +extern void +_mesa_set_enablei(struct gl_context *ctx, GLenum cap, GLuint index, GLboolean state); + +extern void GLAPIENTRY +_mesa_DisableIndexed( GLenum cap, GLuint index ); + +extern void GLAPIENTRY +_mesa_EnableIndexed( GLenum cap, GLuint index ); + +extern GLboolean GLAPIENTRY +_mesa_IsEnabledIndexed( GLenum cap, GLuint index ); + +extern void GLAPIENTRY +_mesa_EnableClientState( GLenum cap ); + +extern void GLAPIENTRY +_mesa_DisableClientState( GLenum cap ); + + +#endif diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index cd76eeb3d..2688f7ace 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -112,6 +112,7 @@ static const struct extension extension_table[] = { { "GL_ARB_robustness", o(dummy_true), GL, 2010 }, { "GL_ARB_sampler_objects", o(ARB_sampler_objects), GL, 2009 }, { "GL_ARB_seamless_cube_map", o(ARB_seamless_cube_map), GL, 2009 }, + { "GL_ARB_shader_bit_encoding", o(ARB_shader_bit_encoding), GL, 2010 }, { "GL_ARB_shader_objects", o(ARB_shader_objects), GL, 2002 }, { "GL_ARB_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 }, { "GL_ARB_shader_texture_lod", o(ARB_shader_texture_lod), GL, 2009 }, diff --git a/mesalib/src/mesa/main/ffvertex_prog.h b/mesalib/src/mesa/main/ffvertex_prog.h index 6d485bb2a..837a15efc 100644 --- a/mesalib/src/mesa/main/ffvertex_prog.h +++ b/mesalib/src/mesa/main/ffvertex_prog.h @@ -1,40 +1,40 @@ -/************************************************************************** - * - * Copyright 2007 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 FFVERTEX_PROG_H -#define FFVERTEX_PROG_H - - -struct gl_context; - -struct gl_vertex_program * -_mesa_get_fixed_func_vertex_program(struct gl_context *ctx); - - - -#endif /* FFVERTEX_PROG_H */ +/************************************************************************** + * + * Copyright 2007 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 FFVERTEX_PROG_H +#define FFVERTEX_PROG_H + + +struct gl_context; + +struct gl_vertex_program * +_mesa_get_fixed_func_vertex_program(struct gl_context *ctx); + + + +#endif /* FFVERTEX_PROG_H */ diff --git a/mesalib/src/mesa/main/fog.h b/mesalib/src/mesa/main/fog.h index 72a0657af..9191a4a54 100644 --- a/mesalib/src/mesa/main/fog.h +++ b/mesalib/src/mesa/main/fog.h @@ -1,69 +1,69 @@ -/** - * \file fog.h - * Fog operations. - * - * \if subset - * (No-op) - * - * \endif - */ - -/* - * 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 FOG_H -#define FOG_H - - -#include "glheader.h" -#include "mfeatures.h" - -struct gl_context; - - -#if _HAVE_FULL_GL - -extern void GLAPIENTRY -_mesa_Fogf(GLenum pname, GLfloat param); - -extern void GLAPIENTRY -_mesa_Fogi(GLenum pname, GLint param ); - -extern void GLAPIENTRY -_mesa_Fogfv(GLenum pname, const GLfloat *params ); - -extern void GLAPIENTRY -_mesa_Fogiv(GLenum pname, const GLint *params ); - -extern void _mesa_init_fog( struct gl_context * ctx ); - -#else - -/** No-op */ -#define _mesa_init_fog( c ) ((void)0) - -#endif - -#endif +/** + * \file fog.h + * Fog operations. + * + * \if subset + * (No-op) + * + * \endif + */ + +/* + * 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 FOG_H +#define FOG_H + + +#include "glheader.h" +#include "mfeatures.h" + +struct gl_context; + + +#if _HAVE_FULL_GL + +extern void GLAPIENTRY +_mesa_Fogf(GLenum pname, GLfloat param); + +extern void GLAPIENTRY +_mesa_Fogi(GLenum pname, GLint param ); + +extern void GLAPIENTRY +_mesa_Fogfv(GLenum pname, const GLfloat *params ); + +extern void GLAPIENTRY +_mesa_Fogiv(GLenum pname, const GLint *params ); + +extern void _mesa_init_fog( struct gl_context * ctx ); + +#else + +/** No-op */ +#define _mesa_init_fog( c ) ((void)0) + +#endif + +#endif diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index cecb70c01..ccc0b1707 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -1319,7 +1319,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = "MESA_FORMAT_RED_RGTC1", GL_RED, GL_UNSIGNED_NORMALIZED, - 4, 0, 0, 0, + 8, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, @@ -1328,7 +1328,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = "MESA_FORMAT_SIGNED_RED_RGTC1", GL_RED, GL_SIGNED_NORMALIZED, - 4, 0, 0, 0, + 8, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, @@ -1337,7 +1337,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = "MESA_FORMAT_RG_RGTC2", GL_RG, GL_UNSIGNED_NORMALIZED, - 4, 4, 0, 0, + 8, 8, 0, 0, 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, @@ -1346,7 +1346,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = "MESA_FORMAT_SIGNED_RG_RGTC2", GL_RG, GL_SIGNED_NORMALIZED, - 4, 4, 0, 0, + 8, 8, 0, 0, 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, diff --git a/mesalib/src/mesa/main/hint.h b/mesalib/src/mesa/main/hint.h index 3cdd2d650..6c6206874 100644 --- a/mesalib/src/mesa/main/hint.h +++ b/mesalib/src/mesa/main/hint.h @@ -1,59 +1,59 @@ -/** - * \file hint.h - * Hints operations. - * - * \if subset - * (No-op) - * - * \endif - */ - -/* - * 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. - */ - - -#ifndef HINT_H -#define HINT_H - -#include "glheader.h" -#include "mfeatures.h" - -struct gl_context; - -#if _HAVE_FULL_GL - -extern void GLAPIENTRY -_mesa_Hint( GLenum target, GLenum mode ); - -extern void -_mesa_init_hint( struct gl_context * ctx ); - -#else - -/** No-op */ -#define _mesa_init_hint( c ) ((void) 0) - -#endif - -#endif +/** + * \file hint.h + * Hints operations. + * + * \if subset + * (No-op) + * + * \endif + */ + +/* + * 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. + */ + + +#ifndef HINT_H +#define HINT_H + +#include "glheader.h" +#include "mfeatures.h" + +struct gl_context; + +#if _HAVE_FULL_GL + +extern void GLAPIENTRY +_mesa_Hint( GLenum target, GLenum mode ); + +extern void +_mesa_init_hint( struct gl_context * ctx ); + +#else + +/** No-op */ +#define _mesa_init_hint( c ) ((void) 0) + +#endif + +#endif diff --git a/mesalib/src/mesa/main/lines.h b/mesalib/src/mesa/main/lines.h index c882fc679..8e8b3f8d6 100644 --- a/mesalib/src/mesa/main/lines.h +++ b/mesalib/src/mesa/main/lines.h @@ -1,49 +1,49 @@ -/** - * \file lines.h - * Line operations. - */ - -/* - * 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 LINES_H -#define LINES_H - - -#include "glheader.h" - -struct gl_context; - -extern void GLAPIENTRY -_mesa_LineWidth( GLfloat width ); - -extern void GLAPIENTRY -_mesa_LineStipple( GLint factor, GLushort pattern ); - -extern void GLAPIENTRY -_mesa_init_line( struct gl_context * ctx ); - -#endif +/** + * \file lines.h + * Line operations. + */ + +/* + * 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 LINES_H +#define LINES_H + + +#include "glheader.h" + +struct gl_context; + +extern void GLAPIENTRY +_mesa_LineWidth( GLfloat width ); + +extern void GLAPIENTRY +_mesa_LineStipple( GLint factor, GLushort pattern ); + +extern void GLAPIENTRY +_mesa_init_line( struct gl_context * ctx ); + +#endif diff --git a/mesalib/src/mesa/main/matrix.h b/mesalib/src/mesa/main/matrix.h index a4e7f7cfd..2878cc134 100644 --- a/mesalib/src/mesa/main/matrix.h +++ b/mesalib/src/mesa/main/matrix.h @@ -1,113 +1,113 @@ -/* - * Mesa 3-D graphics library - * Version: 7.5 - * - * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 MATRIX_H -#define MATRIX_H - - -#include "glheader.h" - -struct gl_context; - -extern void GLAPIENTRY -_mesa_Frustum( GLdouble left, GLdouble right, - GLdouble bottom, GLdouble top, - GLdouble nearval, GLdouble farval ); - -extern void GLAPIENTRY -_mesa_Ortho( GLdouble left, GLdouble right, - GLdouble bottom, GLdouble top, - GLdouble nearval, GLdouble farval ); - -extern void GLAPIENTRY -_mesa_PushMatrix( void ); - -extern void GLAPIENTRY -_mesa_PopMatrix( void ); - -extern void GLAPIENTRY -_mesa_LoadIdentity( void ); - -extern void GLAPIENTRY -_mesa_LoadMatrixf( const GLfloat *m ); - -extern void GLAPIENTRY -_mesa_LoadMatrixd( const GLdouble *m ); - -extern void GLAPIENTRY -_mesa_MatrixMode( GLenum mode ); - -extern void GLAPIENTRY -_mesa_MultMatrixf( const GLfloat *m ); - -extern void GLAPIENTRY -_mesa_MultMatrixd( const GLdouble *m ); - -extern void GLAPIENTRY -_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ); - -extern void GLAPIENTRY -_mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ); - -extern void GLAPIENTRY -_mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ); - -extern void GLAPIENTRY -_mesa_Scaled( GLdouble x, GLdouble y, GLdouble z ); - -extern void GLAPIENTRY -_mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ); - -extern void GLAPIENTRY -_mesa_Translated( GLdouble x, GLdouble y, GLdouble z ); - -extern void GLAPIENTRY -_mesa_LoadTransposeMatrixfARB( const GLfloat *m ); - -extern void GLAPIENTRY -_mesa_LoadTransposeMatrixdARB( const GLdouble *m ); - -extern void GLAPIENTRY -_mesa_MultTransposeMatrixfARB( const GLfloat *m ); - -extern void GLAPIENTRY -_mesa_MultTransposeMatrixdARB( const GLdouble *m ); - - -extern void -_mesa_init_matrix( struct gl_context * ctx ); - -extern void -_mesa_init_transform( struct gl_context *ctx ); - -extern void -_mesa_free_matrix_data( struct gl_context *ctx ); - -extern void -_mesa_update_modelview_project( struct gl_context *ctx, GLuint newstate ); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 7.5 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 MATRIX_H +#define MATRIX_H + + +#include "glheader.h" + +struct gl_context; + +extern void GLAPIENTRY +_mesa_Frustum( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble nearval, GLdouble farval ); + +extern void GLAPIENTRY +_mesa_Ortho( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble nearval, GLdouble farval ); + +extern void GLAPIENTRY +_mesa_PushMatrix( void ); + +extern void GLAPIENTRY +_mesa_PopMatrix( void ); + +extern void GLAPIENTRY +_mesa_LoadIdentity( void ); + +extern void GLAPIENTRY +_mesa_LoadMatrixf( const GLfloat *m ); + +extern void GLAPIENTRY +_mesa_LoadMatrixd( const GLdouble *m ); + +extern void GLAPIENTRY +_mesa_MatrixMode( GLenum mode ); + +extern void GLAPIENTRY +_mesa_MultMatrixf( const GLfloat *m ); + +extern void GLAPIENTRY +_mesa_MultMatrixd( const GLdouble *m ); + +extern void GLAPIENTRY +_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ); + +extern void GLAPIENTRY +_mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ); + +extern void GLAPIENTRY +_mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ); + +extern void GLAPIENTRY +_mesa_Scaled( GLdouble x, GLdouble y, GLdouble z ); + +extern void GLAPIENTRY +_mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ); + +extern void GLAPIENTRY +_mesa_Translated( GLdouble x, GLdouble y, GLdouble z ); + +extern void GLAPIENTRY +_mesa_LoadTransposeMatrixfARB( const GLfloat *m ); + +extern void GLAPIENTRY +_mesa_LoadTransposeMatrixdARB( const GLdouble *m ); + +extern void GLAPIENTRY +_mesa_MultTransposeMatrixfARB( const GLfloat *m ); + +extern void GLAPIENTRY +_mesa_MultTransposeMatrixdARB( const GLdouble *m ); + + +extern void +_mesa_init_matrix( struct gl_context * ctx ); + +extern void +_mesa_init_transform( struct gl_context *ctx ); + +extern void +_mesa_free_matrix_data( struct gl_context *ctx ); + +extern void +_mesa_update_modelview_project( struct gl_context *ctx, GLuint newstate ); + + +#endif diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c index abd26b8d3..250d3c6dc 100644 --- a/mesalib/src/mesa/main/mipmap.c +++ b/mesalib/src/mesa/main/mipmap.c @@ -2133,10 +2133,10 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, } /* The image space was allocated above so use glTexSubImage now */ - ctx->Driver.TexSubImage2D(ctx, dstImage, - 0, 0, dstWidth, dstHeight, - temp_base_format, temp_datatype, - temp_dst, &ctx->DefaultPacking); + ctx->Driver.TexSubImage(ctx, 2, dstImage, + 0, 0, 0, dstWidth, dstHeight, 1, + temp_base_format, temp_datatype, + temp_dst, &ctx->DefaultPacking); /* swap src and dest pointers */ { diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 3a8cac9c5..ea40ffc9c 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2895,6 +2895,7 @@ struct gl_extensions GLboolean ARB_point_sprite; GLboolean ARB_sampler_objects; GLboolean ARB_seamless_cube_map; + GLboolean ARB_shader_bit_encoding; GLboolean ARB_shader_objects; GLboolean ARB_shader_stencil_export; GLboolean ARB_shader_texture_lod; diff --git a/mesalib/src/mesa/main/multisample.c b/mesalib/src/mesa/main/multisample.c index 4eb1ab3a3..67fdb8c9d 100644 --- a/mesalib/src/mesa/main/multisample.c +++ b/mesalib/src/mesa/main/multisample.c @@ -1,62 +1,62 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 1999-2007 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 "main/glheader.h" -#include "main/context.h" -#include "main/macros.h" -#include "main/multisample.h" -#include "main/mtypes.h" - - -/** - * Called via glSampleCoverageARB - */ -void GLAPIENTRY -_mesa_SampleCoverageARB(GLclampf value, GLboolean invert) -{ - GET_CURRENT_CONTEXT(ctx); - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); - - ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0); - ctx->Multisample.SampleCoverageInvert = invert; - ctx->NewState |= _NEW_MULTISAMPLE; -} - - -/** - * Initialize the context's multisample state. - * \param ctx the GL context. - */ -void -_mesa_init_multisample(struct gl_context *ctx) -{ - ctx->Multisample.Enabled = GL_TRUE; - ctx->Multisample.SampleAlphaToCoverage = GL_FALSE; - ctx->Multisample.SampleAlphaToOne = GL_FALSE; - ctx->Multisample.SampleCoverage = GL_FALSE; - ctx->Multisample.SampleCoverageValue = 1.0; - ctx->Multisample.SampleCoverageInvert = GL_FALSE; -} +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 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 "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/multisample.h" +#include "main/mtypes.h" + + +/** + * Called via glSampleCoverageARB + */ +void GLAPIENTRY +_mesa_SampleCoverageARB(GLclampf value, GLboolean invert) +{ + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); + + ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0); + ctx->Multisample.SampleCoverageInvert = invert; + ctx->NewState |= _NEW_MULTISAMPLE; +} + + +/** + * Initialize the context's multisample state. + * \param ctx the GL context. + */ +void +_mesa_init_multisample(struct gl_context *ctx) +{ + ctx->Multisample.Enabled = GL_TRUE; + ctx->Multisample.SampleAlphaToCoverage = GL_FALSE; + ctx->Multisample.SampleAlphaToOne = GL_FALSE; + ctx->Multisample.SampleCoverage = GL_FALSE; + ctx->Multisample.SampleCoverageValue = 1.0; + ctx->Multisample.SampleCoverageInvert = GL_FALSE; +} diff --git a/mesalib/src/mesa/main/multisample.h b/mesalib/src/mesa/main/multisample.h index c1c967bbe..e86d4092b 100644 --- a/mesalib/src/mesa/main/multisample.h +++ b/mesalib/src/mesa/main/multisample.h @@ -1,41 +1,41 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 1999-2007 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 MULTISAMPLE_H -#define MULTISAMPLE_H - -#include "glheader.h" - -struct gl_context; - -extern void GLAPIENTRY -_mesa_SampleCoverageARB(GLclampf value, GLboolean invert); - - -extern void -_mesa_init_multisample(struct gl_context *ctx); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 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 MULTISAMPLE_H +#define MULTISAMPLE_H + +#include "glheader.h" + +struct gl_context; + +extern void GLAPIENTRY +_mesa_SampleCoverageARB(GLclampf value, GLboolean invert); + + +extern void +_mesa_init_multisample(struct gl_context *ctx); + + +#endif diff --git a/mesalib/src/mesa/main/pixelstore.h b/mesalib/src/mesa/main/pixelstore.h index 2995beb10..eb5081974 100644 --- a/mesalib/src/mesa/main/pixelstore.h +++ b/mesalib/src/mesa/main/pixelstore.h @@ -1,52 +1,52 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 1999-2008 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. - */ - -/** - * \file pixelstore.h - * glPixelStore functions. - */ - - -#ifndef PIXELSTORE_H -#define PIXELSTORE_H - - -#include "glheader.h" - -struct gl_context; - - -extern void GLAPIENTRY -_mesa_PixelStorei( GLenum pname, GLint param ); - - -extern void GLAPIENTRY -_mesa_PixelStoref( GLenum pname, GLfloat param ); - - -extern void -_mesa_init_pixelstore( struct gl_context *ctx ); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 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. + */ + +/** + * \file pixelstore.h + * glPixelStore functions. + */ + + +#ifndef PIXELSTORE_H +#define PIXELSTORE_H + + +#include "glheader.h" + +struct gl_context; + + +extern void GLAPIENTRY +_mesa_PixelStorei( GLenum pname, GLint param ); + + +extern void GLAPIENTRY +_mesa_PixelStoref( GLenum pname, GLfloat param ); + + +extern void +_mesa_init_pixelstore( struct gl_context *ctx ); + + +#endif diff --git a/mesalib/src/mesa/main/points.c b/mesalib/src/mesa/main/points.c index 78d40f61c..87bfae27e 100644 --- a/mesalib/src/mesa/main/points.c +++ b/mesalib/src/mesa/main/points.c @@ -1,272 +1,272 @@ -/** - * \file points.c - * Point operations. - */ - -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 1999-2007 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 "glheader.h" -#include "context.h" -#include "macros.h" -#include "points.h" -#include "mtypes.h" - - -/** - * Set current point size. - * \param size point diameter in pixels - * \sa glPointSize(). - */ -void GLAPIENTRY -_mesa_PointSize( GLfloat size ) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (size <= 0.0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPointSize" ); - return; - } - - if (ctx->Point.Size == size) - return; - - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.Size = size; - - if (ctx->Driver.PointSize) - ctx->Driver.PointSize(ctx, size); -} - - -#if _HAVE_FULL_GL - - -void GLAPIENTRY -_mesa_PointParameteri( GLenum pname, GLint param ) -{ - GLfloat p[3]; - p[0] = (GLfloat) param; - p[1] = p[2] = 0.0F; - _mesa_PointParameterfv(pname, p); -} - - -void GLAPIENTRY -_mesa_PointParameteriv( GLenum pname, const GLint *params ) -{ - GLfloat p[3]; - p[0] = (GLfloat) params[0]; - if (pname == GL_DISTANCE_ATTENUATION_EXT) { - p[1] = (GLfloat) params[1]; - p[2] = (GLfloat) params[2]; - } - _mesa_PointParameterfv(pname, p); -} - - -void GLAPIENTRY -_mesa_PointParameterf( GLenum pname, GLfloat param) -{ - GLfloat p[3]; - p[0] = param; - p[1] = p[2] = 0.0F; - _mesa_PointParameterfv(pname, p); -} - - -void GLAPIENTRY -_mesa_PointParameterfv( GLenum pname, const GLfloat *params) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - switch (pname) { - case GL_DISTANCE_ATTENUATION_EXT: - if (ctx->Extensions.EXT_point_parameters) { - if (TEST_EQ_3V(ctx->Point.Params, params)) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - COPY_3V(ctx->Point.Params, params); - ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 || - ctx->Point.Params[1] != 0.0 || - ctx->Point.Params[2] != 0.0); - - if (ctx->Point._Attenuated) - ctx->_TriangleCaps |= DD_POINT_ATTEN; - else - ctx->_TriangleCaps &= ~DD_POINT_ATTEN; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glPointParameterf[v]{EXT,ARB}(pname)"); - return; - } - break; - case GL_POINT_SIZE_MIN_EXT: - if (ctx->Extensions.EXT_point_parameters) { - if (params[0] < 0.0F) { - _mesa_error( ctx, GL_INVALID_VALUE, - "glPointParameterf[v]{EXT,ARB}(param)" ); - return; - } - if (ctx->Point.MinSize == params[0]) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.MinSize = params[0]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glPointParameterf[v]{EXT,ARB}(pname)"); - return; - } - break; - case GL_POINT_SIZE_MAX_EXT: - if (ctx->Extensions.EXT_point_parameters) { - if (params[0] < 0.0F) { - _mesa_error( ctx, GL_INVALID_VALUE, - "glPointParameterf[v]{EXT,ARB}(param)" ); - return; - } - if (ctx->Point.MaxSize == params[0]) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.MaxSize = params[0]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glPointParameterf[v]{EXT,ARB}(pname)"); - return; - } - break; - case GL_POINT_FADE_THRESHOLD_SIZE_EXT: - if (ctx->Extensions.EXT_point_parameters) { - if (params[0] < 0.0F) { - _mesa_error( ctx, GL_INVALID_VALUE, - "glPointParameterf[v]{EXT,ARB}(param)" ); - return; - } - if (ctx->Point.Threshold == params[0]) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.Threshold = params[0]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glPointParameterf[v]{EXT,ARB}(pname)"); - return; - } - break; - case GL_POINT_SPRITE_R_MODE_NV: - /* This is one area where ARB_point_sprite and NV_point_sprite - * differ. In ARB_point_sprite the POINT_SPRITE_R_MODE is - * always ZERO. NV_point_sprite adds the S and R modes. - */ - if (ctx->Extensions.NV_point_sprite) { - GLenum value = (GLenum) params[0]; - if (value != GL_ZERO && value != GL_S && value != GL_R) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glPointParameterf[v]{EXT,ARB}(param)"); - return; - } - if (ctx->Point.SpriteRMode == value) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.SpriteRMode = value; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glPointParameterf[v]{EXT,ARB}(pname)"); - return; - } - break; - case GL_POINT_SPRITE_COORD_ORIGIN: - /* This is not completely correct. GL_POINT_SPRITE_COORD_ORIGIN was - * added to point sprites when the extension was merged into OpenGL - * 2.0. It is expected that an implementation supporting OpenGL 1.4 - * and GL_ARB_point_sprite will generate an error here. - */ - if (ctx->Extensions.ARB_point_sprite) { - GLenum value = (GLenum) params[0]; - if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glPointParameterf[v]{EXT,ARB}(param)"); - return; - } - if (ctx->Point.SpriteOrigin == value) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.SpriteOrigin = value; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glPointParameterf[v]{EXT,ARB}(pname)"); - return; - } - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, - "glPointParameterf[v]{EXT,ARB}(pname)" ); - return; - } - - if (ctx->Driver.PointParameterfv) - (*ctx->Driver.PointParameterfv)(ctx, pname, params); -} -#endif - - - -/** - * Initialize the context point state. - * - * \param ctx GL context. - * - * Initializes __struct gl_contextRec::Point and point related constants in - * __struct gl_contextRec::Const. - */ -void -_mesa_init_point(struct gl_context *ctx) -{ - GLuint i; - - ctx->Point.SmoothFlag = GL_FALSE; - ctx->Point.Size = 1.0; - ctx->Point.Params[0] = 1.0; - ctx->Point.Params[1] = 0.0; - ctx->Point.Params[2] = 0.0; - ctx->Point._Attenuated = GL_FALSE; - ctx->Point.MinSize = 0.0; - ctx->Point.MaxSize - = MAX2(ctx->Const.MaxPointSize, ctx->Const.MaxPointSizeAA); - ctx->Point.Threshold = 1.0; - ctx->Point.PointSprite = GL_FALSE; /* GL_ARB/NV_point_sprite */ - ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */ - ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */ - for (i = 0; i < Elements(ctx->Point.CoordReplace); i++) { - ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_ARB/NV_point_sprite */ - } -} +/** + * \file points.c + * Point operations. + */ + +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 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 "glheader.h" +#include "context.h" +#include "macros.h" +#include "points.h" +#include "mtypes.h" + + +/** + * Set current point size. + * \param size point diameter in pixels + * \sa glPointSize(). + */ +void GLAPIENTRY +_mesa_PointSize( GLfloat size ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (size <= 0.0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPointSize" ); + return; + } + + if (ctx->Point.Size == size) + return; + + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.Size = size; + + if (ctx->Driver.PointSize) + ctx->Driver.PointSize(ctx, size); +} + + +#if _HAVE_FULL_GL + + +void GLAPIENTRY +_mesa_PointParameteri( GLenum pname, GLint param ) +{ + GLfloat p[3]; + p[0] = (GLfloat) param; + p[1] = p[2] = 0.0F; + _mesa_PointParameterfv(pname, p); +} + + +void GLAPIENTRY +_mesa_PointParameteriv( GLenum pname, const GLint *params ) +{ + GLfloat p[3]; + p[0] = (GLfloat) params[0]; + if (pname == GL_DISTANCE_ATTENUATION_EXT) { + p[1] = (GLfloat) params[1]; + p[2] = (GLfloat) params[2]; + } + _mesa_PointParameterfv(pname, p); +} + + +void GLAPIENTRY +_mesa_PointParameterf( GLenum pname, GLfloat param) +{ + GLfloat p[3]; + p[0] = param; + p[1] = p[2] = 0.0F; + _mesa_PointParameterfv(pname, p); +} + + +void GLAPIENTRY +_mesa_PointParameterfv( GLenum pname, const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (pname) { + case GL_DISTANCE_ATTENUATION_EXT: + if (ctx->Extensions.EXT_point_parameters) { + if (TEST_EQ_3V(ctx->Point.Params, params)) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + COPY_3V(ctx->Point.Params, params); + ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 || + ctx->Point.Params[1] != 0.0 || + ctx->Point.Params[2] != 0.0); + + if (ctx->Point._Attenuated) + ctx->_TriangleCaps |= DD_POINT_ATTEN; + else + ctx->_TriangleCaps &= ~DD_POINT_ATTEN; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); + return; + } + break; + case GL_POINT_SIZE_MIN_EXT: + if (ctx->Extensions.EXT_point_parameters) { + if (params[0] < 0.0F) { + _mesa_error( ctx, GL_INVALID_VALUE, + "glPointParameterf[v]{EXT,ARB}(param)" ); + return; + } + if (ctx->Point.MinSize == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.MinSize = params[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); + return; + } + break; + case GL_POINT_SIZE_MAX_EXT: + if (ctx->Extensions.EXT_point_parameters) { + if (params[0] < 0.0F) { + _mesa_error( ctx, GL_INVALID_VALUE, + "glPointParameterf[v]{EXT,ARB}(param)" ); + return; + } + if (ctx->Point.MaxSize == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.MaxSize = params[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); + return; + } + break; + case GL_POINT_FADE_THRESHOLD_SIZE_EXT: + if (ctx->Extensions.EXT_point_parameters) { + if (params[0] < 0.0F) { + _mesa_error( ctx, GL_INVALID_VALUE, + "glPointParameterf[v]{EXT,ARB}(param)" ); + return; + } + if (ctx->Point.Threshold == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.Threshold = params[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); + return; + } + break; + case GL_POINT_SPRITE_R_MODE_NV: + /* This is one area where ARB_point_sprite and NV_point_sprite + * differ. In ARB_point_sprite the POINT_SPRITE_R_MODE is + * always ZERO. NV_point_sprite adds the S and R modes. + */ + if (ctx->Extensions.NV_point_sprite) { + GLenum value = (GLenum) params[0]; + if (value != GL_ZERO && value != GL_S && value != GL_R) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glPointParameterf[v]{EXT,ARB}(param)"); + return; + } + if (ctx->Point.SpriteRMode == value) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.SpriteRMode = value; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); + return; + } + break; + case GL_POINT_SPRITE_COORD_ORIGIN: + /* This is not completely correct. GL_POINT_SPRITE_COORD_ORIGIN was + * added to point sprites when the extension was merged into OpenGL + * 2.0. It is expected that an implementation supporting OpenGL 1.4 + * and GL_ARB_point_sprite will generate an error here. + */ + if (ctx->Extensions.ARB_point_sprite) { + GLenum value = (GLenum) params[0]; + if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glPointParameterf[v]{EXT,ARB}(param)"); + return; + } + if (ctx->Point.SpriteOrigin == value) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.SpriteOrigin = value; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); + return; + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)" ); + return; + } + + if (ctx->Driver.PointParameterfv) + (*ctx->Driver.PointParameterfv)(ctx, pname, params); +} +#endif + + + +/** + * Initialize the context point state. + * + * \param ctx GL context. + * + * Initializes __struct gl_contextRec::Point and point related constants in + * __struct gl_contextRec::Const. + */ +void +_mesa_init_point(struct gl_context *ctx) +{ + GLuint i; + + ctx->Point.SmoothFlag = GL_FALSE; + ctx->Point.Size = 1.0; + ctx->Point.Params[0] = 1.0; + ctx->Point.Params[1] = 0.0; + ctx->Point.Params[2] = 0.0; + ctx->Point._Attenuated = GL_FALSE; + ctx->Point.MinSize = 0.0; + ctx->Point.MaxSize + = MAX2(ctx->Const.MaxPointSize, ctx->Const.MaxPointSizeAA); + ctx->Point.Threshold = 1.0; + ctx->Point.PointSprite = GL_FALSE; /* GL_ARB/NV_point_sprite */ + ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */ + ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */ + for (i = 0; i < Elements(ctx->Point.CoordReplace); i++) { + ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_ARB/NV_point_sprite */ + } +} diff --git a/mesalib/src/mesa/main/points.h b/mesalib/src/mesa/main/points.h index 442053c8f..306a8a572 100644 --- a/mesalib/src/mesa/main/points.h +++ b/mesalib/src/mesa/main/points.h @@ -1,59 +1,59 @@ -/** - * \file points.h - * Point operations. - */ - -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * 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. - */ - - -#ifndef POINTS_H -#define POINTS_H - - -#include "glheader.h" - -struct gl_context; - - -extern void GLAPIENTRY -_mesa_PointSize( GLfloat size ); - -extern void GLAPIENTRY -_mesa_PointParameteri( GLenum pname, GLint param ); - -extern void GLAPIENTRY -_mesa_PointParameteriv( GLenum pname, const GLint *params ); - -extern void GLAPIENTRY -_mesa_PointParameterf( GLenum pname, GLfloat param ); - -extern void GLAPIENTRY -_mesa_PointParameterfv( GLenum pname, const GLfloat *params ); - -extern void -_mesa_init_point( struct gl_context * ctx ); - - -#endif +/** + * \file points.h + * Point operations. + */ + +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * 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. + */ + + +#ifndef POINTS_H +#define POINTS_H + + +#include "glheader.h" + +struct gl_context; + + +extern void GLAPIENTRY +_mesa_PointSize( GLfloat size ); + +extern void GLAPIENTRY +_mesa_PointParameteri( GLenum pname, GLint param ); + +extern void GLAPIENTRY +_mesa_PointParameteriv( GLenum pname, const GLint *params ); + +extern void GLAPIENTRY +_mesa_PointParameterf( GLenum pname, GLfloat param ); + +extern void GLAPIENTRY +_mesa_PointParameterfv( GLenum pname, const GLfloat *params ); + +extern void +_mesa_init_point( struct gl_context * ctx ); + + +#endif diff --git a/mesalib/src/mesa/main/rastpos.c b/mesalib/src/mesa/main/rastpos.c index 70f67d398..a1f6f4234 100644 --- a/mesalib/src/mesa/main/rastpos.c +++ b/mesalib/src/mesa/main/rastpos.c @@ -1,566 +1,566 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 1999-2007 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. - */ - - -/** - * \file rastpos.c - * Raster position operations. - */ - -#include "glheader.h" -#include "context.h" -#include "feedback.h" -#include "macros.h" -#include "mfeatures.h" -#include "mtypes.h" -#include "rastpos.h" -#include "state.h" -#include "main/dispatch.h" - - -#if FEATURE_rastpos - - -/** - * Helper function for all the RasterPos functions. - */ -static void -rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - GET_CURRENT_CONTEXT(ctx); - GLfloat p[4]; - - p[0] = x; - p[1] = y; - p[2] = z; - p[3] = w; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - FLUSH_CURRENT(ctx, 0); - - if (ctx->NewState) - _mesa_update_state( ctx ); - - ctx->Driver.RasterPos(ctx, p); -} - - -static void GLAPIENTRY -_mesa_RasterPos2d(GLdouble x, GLdouble y) -{ - rasterpos((GLfloat)x, (GLfloat)y, (GLfloat)0.0, (GLfloat)1.0); -} - -static void GLAPIENTRY -_mesa_RasterPos2f(GLfloat x, GLfloat y) -{ - rasterpos(x, y, 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos2i(GLint x, GLint y) -{ - rasterpos((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos2s(GLshort x, GLshort y) -{ - rasterpos(x, y, 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) -{ - rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) -{ - rasterpos(x, y, z, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3i(GLint x, GLint y, GLint z) -{ - rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z) -{ - rasterpos(x, y, z, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - rasterpos(x, y, z, w); -} - -static void GLAPIENTRY -_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w) -{ - rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) -{ - rasterpos(x, y, z, w); -} - -static void GLAPIENTRY -_mesa_RasterPos2dv(const GLdouble *v) -{ - rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos2fv(const GLfloat *v) -{ - rasterpos(v[0], v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos2iv(const GLint *v) -{ - rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos2sv(const GLshort *v) -{ - rasterpos(v[0], v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3dv(const GLdouble *v) -{ - rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3fv(const GLfloat *v) -{ - rasterpos(v[0], v[1], v[2], 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3iv(const GLint *v) -{ - rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos3sv(const GLshort *v) -{ - rasterpos(v[0], v[1], v[2], 1.0F); -} - -static void GLAPIENTRY -_mesa_RasterPos4dv(const GLdouble *v) -{ - rasterpos((GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -_mesa_RasterPos4fv(const GLfloat *v) -{ - rasterpos(v[0], v[1], v[2], v[3]); -} - -static void GLAPIENTRY -_mesa_RasterPos4iv(const GLint *v) -{ - rasterpos((GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -_mesa_RasterPos4sv(const GLshort *v) -{ - rasterpos(v[0], v[1], v[2], v[3]); -} - - -/**********************************************************************/ -/*** GL_ARB_window_pos / GL_MESA_window_pos ***/ -/**********************************************************************/ - - -/** - * All glWindowPosMESA and glWindowPosARB commands call this function to - * update the current raster position. - */ -static void -window_pos3f(GLfloat x, GLfloat y, GLfloat z) -{ - GET_CURRENT_CONTEXT(ctx); - GLfloat z2; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - FLUSH_CURRENT(ctx, 0); - - z2 = CLAMP(z, 0.0F, 1.0F) * (ctx->Viewport.Far - ctx->Viewport.Near) - + ctx->Viewport.Near; - - /* set raster position */ - ctx->Current.RasterPos[0] = x; - ctx->Current.RasterPos[1] = y; - ctx->Current.RasterPos[2] = z2; - ctx->Current.RasterPos[3] = 1.0F; - - ctx->Current.RasterPosValid = GL_TRUE; - - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) - ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; - else - ctx->Current.RasterDistance = 0.0; - - /* raster color = current color or index */ - ctx->Current.RasterColor[0] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0], 0.0F, 1.0F); - ctx->Current.RasterColor[1] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1], 0.0F, 1.0F); - ctx->Current.RasterColor[2] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2], 0.0F, 1.0F); - ctx->Current.RasterColor[3] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3], 0.0F, 1.0F); - ctx->Current.RasterSecondaryColor[0] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0], 0.0F, 1.0F); - ctx->Current.RasterSecondaryColor[1] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1], 0.0F, 1.0F); - ctx->Current.RasterSecondaryColor[2] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2], 0.0F, 1.0F); - ctx->Current.RasterSecondaryColor[3] - = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F); - - /* raster texcoord = current texcoord */ - { - GLuint texSet; - for (texSet = 0; texSet < ctx->Const.MaxTextureCoordUnits; texSet++) { - assert(texSet < Elements(ctx->Current.RasterTexCoords)); - COPY_4FV( ctx->Current.RasterTexCoords[texSet], - ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] ); - } - } - - if (ctx->RenderMode==GL_SELECT) { - _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); - } -} - - -/* This is just to support the GL_MESA_window_pos version */ -static void -window_pos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - GET_CURRENT_CONTEXT(ctx); - window_pos3f(x, y, z); - ctx->Current.RasterPos[3] = w; -} - - -static void GLAPIENTRY -_mesa_WindowPos2dMESA(GLdouble x, GLdouble y) -{ - window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos2fMESA(GLfloat x, GLfloat y) -{ - window_pos4f(x, y, 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos2iMESA(GLint x, GLint y) -{ - window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos2sMESA(GLshort x, GLshort y) -{ - window_pos4f(x, y, 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) -{ - window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) -{ - window_pos4f(x, y, z, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z) -{ - window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) -{ - window_pos4f(x, y, z, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - window_pos4f(x, y, z, w); -} - -static void GLAPIENTRY -_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) -{ - window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - -static void GLAPIENTRY -_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) -{ - window_pos4f(x, y, z, w); -} - -static void GLAPIENTRY -_mesa_WindowPos2dvMESA(const GLdouble *v) -{ - window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos2fvMESA(const GLfloat *v) -{ - window_pos4f(v[0], v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos2ivMESA(const GLint *v) -{ - window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos2svMESA(const GLshort *v) -{ - window_pos4f(v[0], v[1], 0.0F, 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos3dvMESA(const GLdouble *v) -{ - window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos3fvMESA(const GLfloat *v) -{ - window_pos4f(v[0], v[1], v[2], 1.0); -} - -static void GLAPIENTRY -_mesa_WindowPos3ivMESA(const GLint *v) -{ - window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos3svMESA(const GLshort *v) -{ - window_pos4f(v[0], v[1], v[2], 1.0F); -} - -static void GLAPIENTRY -_mesa_WindowPos4dvMESA(const GLdouble *v) -{ - window_pos4f((GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -_mesa_WindowPos4fvMESA(const GLfloat *v) -{ - window_pos4f(v[0], v[1], v[2], v[3]); -} - -static void GLAPIENTRY -_mesa_WindowPos4ivMESA(const GLint *v) -{ - window_pos4f((GLfloat) v[0], (GLfloat) v[1], - (GLfloat) v[2], (GLfloat) v[3]); -} - -static void GLAPIENTRY -_mesa_WindowPos4svMESA(const GLshort *v) -{ - window_pos4f(v[0], v[1], v[2], v[3]); -} - - -#if 0 - -/* - * OpenGL implementation of glWindowPos*MESA() - */ -void glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) -{ - GLfloat fx, fy; - - /* Push current matrix mode and viewport attributes */ - glPushAttrib( GL_TRANSFORM_BIT | GL_VIEWPORT_BIT ); - - /* Setup projection parameters */ - glMatrixMode( GL_PROJECTION ); - glPushMatrix(); - glLoadIdentity(); - glMatrixMode( GL_MODELVIEW ); - glPushMatrix(); - glLoadIdentity(); - - glDepthRange( z, z ); - glViewport( (int) x - 1, (int) y - 1, 2, 2 ); - - /* set the raster (window) position */ - fx = x - (int) x; - fy = y - (int) y; - glRasterPos4f( fx, fy, 0.0, w ); - - /* restore matrices, viewport and matrix mode */ - glPopMatrix(); - glMatrixMode( GL_PROJECTION ); - glPopMatrix(); - - glPopAttrib(); -} - -#endif - - -void -_mesa_init_rastpos_dispatch(struct _glapi_table *disp) -{ - SET_RasterPos2f(disp, _mesa_RasterPos2f); - SET_RasterPos2fv(disp, _mesa_RasterPos2fv); - SET_RasterPos2i(disp, _mesa_RasterPos2i); - SET_RasterPos2iv(disp, _mesa_RasterPos2iv); - SET_RasterPos2d(disp, _mesa_RasterPos2d); - SET_RasterPos2dv(disp, _mesa_RasterPos2dv); - SET_RasterPos2s(disp, _mesa_RasterPos2s); - SET_RasterPos2sv(disp, _mesa_RasterPos2sv); - SET_RasterPos3d(disp, _mesa_RasterPos3d); - SET_RasterPos3dv(disp, _mesa_RasterPos3dv); - SET_RasterPos3f(disp, _mesa_RasterPos3f); - SET_RasterPos3fv(disp, _mesa_RasterPos3fv); - SET_RasterPos3i(disp, _mesa_RasterPos3i); - SET_RasterPos3iv(disp, _mesa_RasterPos3iv); - SET_RasterPos3s(disp, _mesa_RasterPos3s); - SET_RasterPos3sv(disp, _mesa_RasterPos3sv); - SET_RasterPos4d(disp, _mesa_RasterPos4d); - SET_RasterPos4dv(disp, _mesa_RasterPos4dv); - SET_RasterPos4f(disp, _mesa_RasterPos4f); - SET_RasterPos4fv(disp, _mesa_RasterPos4fv); - SET_RasterPos4i(disp, _mesa_RasterPos4i); - SET_RasterPos4iv(disp, _mesa_RasterPos4iv); - SET_RasterPos4s(disp, _mesa_RasterPos4s); - SET_RasterPos4sv(disp, _mesa_RasterPos4sv); - - /* 197. GL_MESA_window_pos */ - SET_WindowPos2dMESA(disp, _mesa_WindowPos2dMESA); - SET_WindowPos2dvMESA(disp, _mesa_WindowPos2dvMESA); - SET_WindowPos2fMESA(disp, _mesa_WindowPos2fMESA); - SET_WindowPos2fvMESA(disp, _mesa_WindowPos2fvMESA); - SET_WindowPos2iMESA(disp, _mesa_WindowPos2iMESA); - SET_WindowPos2ivMESA(disp, _mesa_WindowPos2ivMESA); - SET_WindowPos2sMESA(disp, _mesa_WindowPos2sMESA); - SET_WindowPos2svMESA(disp, _mesa_WindowPos2svMESA); - SET_WindowPos3dMESA(disp, _mesa_WindowPos3dMESA); - SET_WindowPos3dvMESA(disp, _mesa_WindowPos3dvMESA); - SET_WindowPos3fMESA(disp, _mesa_WindowPos3fMESA); - SET_WindowPos3fvMESA(disp, _mesa_WindowPos3fvMESA); - SET_WindowPos3iMESA(disp, _mesa_WindowPos3iMESA); - SET_WindowPos3ivMESA(disp, _mesa_WindowPos3ivMESA); - SET_WindowPos3sMESA(disp, _mesa_WindowPos3sMESA); - SET_WindowPos3svMESA(disp, _mesa_WindowPos3svMESA); - SET_WindowPos4dMESA(disp, _mesa_WindowPos4dMESA); - SET_WindowPos4dvMESA(disp, _mesa_WindowPos4dvMESA); - SET_WindowPos4fMESA(disp, _mesa_WindowPos4fMESA); - SET_WindowPos4fvMESA(disp, _mesa_WindowPos4fvMESA); - SET_WindowPos4iMESA(disp, _mesa_WindowPos4iMESA); - SET_WindowPos4ivMESA(disp, _mesa_WindowPos4ivMESA); - SET_WindowPos4sMESA(disp, _mesa_WindowPos4sMESA); - SET_WindowPos4svMESA(disp, _mesa_WindowPos4svMESA); -} - - -#endif /* FEATURE_rastpos */ - - -/**********************************************************************/ -/** \name Initialization */ -/**********************************************************************/ -/*@{*/ - -/** - * Initialize the context current raster position information. - * - * \param ctx GL context. - * - * Initialize the current raster position information in - * __struct gl_contextRec::Current, and adds the extension entry points to the - * dispatcher. - */ -void _mesa_init_rastpos( struct gl_context * ctx ) -{ - int i; - - ASSIGN_4V( ctx->Current.RasterPos, 0.0, 0.0, 0.0, 1.0 ); - ctx->Current.RasterDistance = 0.0; - ASSIGN_4V( ctx->Current.RasterColor, 1.0, 1.0, 1.0, 1.0 ); - ASSIGN_4V( ctx->Current.RasterSecondaryColor, 0.0, 0.0, 0.0, 1.0 ); - for (i = 0; i < Elements(ctx->Current.RasterTexCoords); i++) - ASSIGN_4V( ctx->Current.RasterTexCoords[i], 0.0, 0.0, 0.0, 1.0 ); - ctx->Current.RasterPosValid = GL_TRUE; -} - -/*@}*/ +/* + * Mesa 3-D graphics library + * Version: 6.5.3 + * + * Copyright (C) 1999-2007 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. + */ + + +/** + * \file rastpos.c + * Raster position operations. + */ + +#include "glheader.h" +#include "context.h" +#include "feedback.h" +#include "macros.h" +#include "mfeatures.h" +#include "mtypes.h" +#include "rastpos.h" +#include "state.h" +#include "main/dispatch.h" + + +#if FEATURE_rastpos + + +/** + * Helper function for all the RasterPos functions. + */ +static void +rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat p[4]; + + p[0] = x; + p[1] = y; + p[2] = z; + p[3] = w; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT(ctx, 0); + + if (ctx->NewState) + _mesa_update_state( ctx ); + + ctx->Driver.RasterPos(ctx, p); +} + + +static void GLAPIENTRY +_mesa_RasterPos2d(GLdouble x, GLdouble y) +{ + rasterpos((GLfloat)x, (GLfloat)y, (GLfloat)0.0, (GLfloat)1.0); +} + +static void GLAPIENTRY +_mesa_RasterPos2f(GLfloat x, GLfloat y) +{ + rasterpos(x, y, 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos2i(GLint x, GLint y) +{ + rasterpos((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos2s(GLshort x, GLshort y) +{ + rasterpos(x, y, 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) +{ + rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) +{ + rasterpos(x, y, z, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3i(GLint x, GLint y, GLint z) +{ + rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z) +{ + rasterpos(x, y, z, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + rasterpos(x, y, z, w); +} + +static void GLAPIENTRY +_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w) +{ + rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) +{ + rasterpos(x, y, z, w); +} + +static void GLAPIENTRY +_mesa_RasterPos2dv(const GLdouble *v) +{ + rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos2fv(const GLfloat *v) +{ + rasterpos(v[0], v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos2iv(const GLint *v) +{ + rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos2sv(const GLshort *v) +{ + rasterpos(v[0], v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3dv(const GLdouble *v) +{ + rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3fv(const GLfloat *v) +{ + rasterpos(v[0], v[1], v[2], 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3iv(const GLint *v) +{ + rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos3sv(const GLshort *v) +{ + rasterpos(v[0], v[1], v[2], 1.0F); +} + +static void GLAPIENTRY +_mesa_RasterPos4dv(const GLdouble *v) +{ + rasterpos((GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +_mesa_RasterPos4fv(const GLfloat *v) +{ + rasterpos(v[0], v[1], v[2], v[3]); +} + +static void GLAPIENTRY +_mesa_RasterPos4iv(const GLint *v) +{ + rasterpos((GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +_mesa_RasterPos4sv(const GLshort *v) +{ + rasterpos(v[0], v[1], v[2], v[3]); +} + + +/**********************************************************************/ +/*** GL_ARB_window_pos / GL_MESA_window_pos ***/ +/**********************************************************************/ + + +/** + * All glWindowPosMESA and glWindowPosARB commands call this function to + * update the current raster position. + */ +static void +window_pos3f(GLfloat x, GLfloat y, GLfloat z) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat z2; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT(ctx, 0); + + z2 = CLAMP(z, 0.0F, 1.0F) * (ctx->Viewport.Far - ctx->Viewport.Near) + + ctx->Viewport.Near; + + /* set raster position */ + ctx->Current.RasterPos[0] = x; + ctx->Current.RasterPos[1] = y; + ctx->Current.RasterPos[2] = z2; + ctx->Current.RasterPos[3] = 1.0F; + + ctx->Current.RasterPosValid = GL_TRUE; + + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) + ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; + else + ctx->Current.RasterDistance = 0.0; + + /* raster color = current color or index */ + ctx->Current.RasterColor[0] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0], 0.0F, 1.0F); + ctx->Current.RasterColor[1] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1], 0.0F, 1.0F); + ctx->Current.RasterColor[2] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2], 0.0F, 1.0F); + ctx->Current.RasterColor[3] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[0] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[1] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[2] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[3] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F); + + /* raster texcoord = current texcoord */ + { + GLuint texSet; + for (texSet = 0; texSet < ctx->Const.MaxTextureCoordUnits; texSet++) { + assert(texSet < Elements(ctx->Current.RasterTexCoords)); + COPY_4FV( ctx->Current.RasterTexCoords[texSet], + ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] ); + } + } + + if (ctx->RenderMode==GL_SELECT) { + _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); + } +} + + +/* This is just to support the GL_MESA_window_pos version */ +static void +window_pos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + GET_CURRENT_CONTEXT(ctx); + window_pos3f(x, y, z); + ctx->Current.RasterPos[3] = w; +} + + +static void GLAPIENTRY +_mesa_WindowPos2dMESA(GLdouble x, GLdouble y) +{ + window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos2fMESA(GLfloat x, GLfloat y) +{ + window_pos4f(x, y, 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos2iMESA(GLint x, GLint y) +{ + window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos2sMESA(GLshort x, GLshort y) +{ + window_pos4f(x, y, 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) +{ + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) +{ + window_pos4f(x, y, z, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z) +{ + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) +{ + window_pos4f(x, y, z, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + window_pos4f(x, y, z, w); +} + +static void GLAPIENTRY +_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) +{ + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) +{ + window_pos4f(x, y, z, w); +} + +static void GLAPIENTRY +_mesa_WindowPos2dvMESA(const GLdouble *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos2fvMESA(const GLfloat *v) +{ + window_pos4f(v[0], v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos2ivMESA(const GLint *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos2svMESA(const GLshort *v) +{ + window_pos4f(v[0], v[1], 0.0F, 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos3dvMESA(const GLdouble *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos3fvMESA(const GLfloat *v) +{ + window_pos4f(v[0], v[1], v[2], 1.0); +} + +static void GLAPIENTRY +_mesa_WindowPos3ivMESA(const GLint *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos3svMESA(const GLshort *v) +{ + window_pos4f(v[0], v[1], v[2], 1.0F); +} + +static void GLAPIENTRY +_mesa_WindowPos4dvMESA(const GLdouble *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +_mesa_WindowPos4fvMESA(const GLfloat *v) +{ + window_pos4f(v[0], v[1], v[2], v[3]); +} + +static void GLAPIENTRY +_mesa_WindowPos4ivMESA(const GLint *v) +{ + window_pos4f((GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +_mesa_WindowPos4svMESA(const GLshort *v) +{ + window_pos4f(v[0], v[1], v[2], v[3]); +} + + +#if 0 + +/* + * OpenGL implementation of glWindowPos*MESA() + */ +void glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + GLfloat fx, fy; + + /* Push current matrix mode and viewport attributes */ + glPushAttrib( GL_TRANSFORM_BIT | GL_VIEWPORT_BIT ); + + /* Setup projection parameters */ + glMatrixMode( GL_PROJECTION ); + glPushMatrix(); + glLoadIdentity(); + glMatrixMode( GL_MODELVIEW ); + glPushMatrix(); + glLoadIdentity(); + + glDepthRange( z, z ); + glViewport( (int) x - 1, (int) y - 1, 2, 2 ); + + /* set the raster (window) position */ + fx = x - (int) x; + fy = y - (int) y; + glRasterPos4f( fx, fy, 0.0, w ); + + /* restore matrices, viewport and matrix mode */ + glPopMatrix(); + glMatrixMode( GL_PROJECTION ); + glPopMatrix(); + + glPopAttrib(); +} + +#endif + + +void +_mesa_init_rastpos_dispatch(struct _glapi_table *disp) +{ + SET_RasterPos2f(disp, _mesa_RasterPos2f); + SET_RasterPos2fv(disp, _mesa_RasterPos2fv); + SET_RasterPos2i(disp, _mesa_RasterPos2i); + SET_RasterPos2iv(disp, _mesa_RasterPos2iv); + SET_RasterPos2d(disp, _mesa_RasterPos2d); + SET_RasterPos2dv(disp, _mesa_RasterPos2dv); + SET_RasterPos2s(disp, _mesa_RasterPos2s); + SET_RasterPos2sv(disp, _mesa_RasterPos2sv); + SET_RasterPos3d(disp, _mesa_RasterPos3d); + SET_RasterPos3dv(disp, _mesa_RasterPos3dv); + SET_RasterPos3f(disp, _mesa_RasterPos3f); + SET_RasterPos3fv(disp, _mesa_RasterPos3fv); + SET_RasterPos3i(disp, _mesa_RasterPos3i); + SET_RasterPos3iv(disp, _mesa_RasterPos3iv); + SET_RasterPos3s(disp, _mesa_RasterPos3s); + SET_RasterPos3sv(disp, _mesa_RasterPos3sv); + SET_RasterPos4d(disp, _mesa_RasterPos4d); + SET_RasterPos4dv(disp, _mesa_RasterPos4dv); + SET_RasterPos4f(disp, _mesa_RasterPos4f); + SET_RasterPos4fv(disp, _mesa_RasterPos4fv); + SET_RasterPos4i(disp, _mesa_RasterPos4i); + SET_RasterPos4iv(disp, _mesa_RasterPos4iv); + SET_RasterPos4s(disp, _mesa_RasterPos4s); + SET_RasterPos4sv(disp, _mesa_RasterPos4sv); + + /* 197. GL_MESA_window_pos */ + SET_WindowPos2dMESA(disp, _mesa_WindowPos2dMESA); + SET_WindowPos2dvMESA(disp, _mesa_WindowPos2dvMESA); + SET_WindowPos2fMESA(disp, _mesa_WindowPos2fMESA); + SET_WindowPos2fvMESA(disp, _mesa_WindowPos2fvMESA); + SET_WindowPos2iMESA(disp, _mesa_WindowPos2iMESA); + SET_WindowPos2ivMESA(disp, _mesa_WindowPos2ivMESA); + SET_WindowPos2sMESA(disp, _mesa_WindowPos2sMESA); + SET_WindowPos2svMESA(disp, _mesa_WindowPos2svMESA); + SET_WindowPos3dMESA(disp, _mesa_WindowPos3dMESA); + SET_WindowPos3dvMESA(disp, _mesa_WindowPos3dvMESA); + SET_WindowPos3fMESA(disp, _mesa_WindowPos3fMESA); + SET_WindowPos3fvMESA(disp, _mesa_WindowPos3fvMESA); + SET_WindowPos3iMESA(disp, _mesa_WindowPos3iMESA); + SET_WindowPos3ivMESA(disp, _mesa_WindowPos3ivMESA); + SET_WindowPos3sMESA(disp, _mesa_WindowPos3sMESA); + SET_WindowPos3svMESA(disp, _mesa_WindowPos3svMESA); + SET_WindowPos4dMESA(disp, _mesa_WindowPos4dMESA); + SET_WindowPos4dvMESA(disp, _mesa_WindowPos4dvMESA); + SET_WindowPos4fMESA(disp, _mesa_WindowPos4fMESA); + SET_WindowPos4fvMESA(disp, _mesa_WindowPos4fvMESA); + SET_WindowPos4iMESA(disp, _mesa_WindowPos4iMESA); + SET_WindowPos4ivMESA(disp, _mesa_WindowPos4ivMESA); + SET_WindowPos4sMESA(disp, _mesa_WindowPos4sMESA); + SET_WindowPos4svMESA(disp, _mesa_WindowPos4svMESA); +} + + +#endif /* FEATURE_rastpos */ + + +/**********************************************************************/ +/** \name Initialization */ +/**********************************************************************/ +/*@{*/ + +/** + * Initialize the context current raster position information. + * + * \param ctx GL context. + * + * Initialize the current raster position information in + * __struct gl_contextRec::Current, and adds the extension entry points to the + * dispatcher. + */ +void _mesa_init_rastpos( struct gl_context * ctx ) +{ + int i; + + ASSIGN_4V( ctx->Current.RasterPos, 0.0, 0.0, 0.0, 1.0 ); + ctx->Current.RasterDistance = 0.0; + ASSIGN_4V( ctx->Current.RasterColor, 1.0, 1.0, 1.0, 1.0 ); + ASSIGN_4V( ctx->Current.RasterSecondaryColor, 0.0, 0.0, 0.0, 1.0 ); + for (i = 0; i < Elements(ctx->Current.RasterTexCoords); i++) + ASSIGN_4V( ctx->Current.RasterTexCoords[i], 0.0, 0.0, 0.0, 1.0 ); + ctx->Current.RasterPosValid = GL_TRUE; +} + +/*@}*/ diff --git a/mesalib/src/mesa/main/remap.c b/mesalib/src/mesa/main/remap.c index 6da31deb3..c89fba453 100644 --- a/mesalib/src/mesa/main/remap.c +++ b/mesalib/src/mesa/main/remap.c @@ -1,226 +1,226 @@ -/* - * Mesa 3-D graphics library - * Version: 7.7 - * - * Copyright (C) 2009 Chia-I Wu - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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. - */ - - -/** - * \file remap.c - * Remap table management. - * - * Entries in the dispatch table are either static or dynamic. The - * dispatch table is shared by mesa core and glapi. When they are - * built separately, it is possible that a static entry in mesa core - * is dynamic, or assigned a different static offset, in glapi. The - * remap table is in charge of mapping a static entry in mesa core to - * a dynamic entry, or the corresponding static entry, in glapi. - */ - -#include "mfeatures.h" - -#if FEATURE_remap_table - -#include "remap.h" -#include "imports.h" -#include "glapi/glapi.h" - -#define MAX_ENTRY_POINTS 16 - -#define need_MESA_remap_table -#include "main/remap_helper.h" - - -/* this is global for quick access */ -int driDispatchRemapTable[driDispatchRemapTable_size]; - - -/** - * Return the spec string associated with the given function index. - * The index is available from including remap_helper.h. - * - * \param func_index an opaque function index. - * - * \return the spec string associated with the function index, or NULL. - */ -const char * -_mesa_get_function_spec(GLint func_index) -{ - if (func_index < Elements(_mesa_function_pool)) - return _mesa_function_pool + func_index; - else - return NULL; -} - - -/** - * Map a function by its spec. The function will be added to glapi, - * and the dispatch offset will be returned. - * - * \param spec a '\0'-separated string array specifying a function. - * It begins with the parameter signature of the function, - * followed by the names of the entry points. An empty entry - * point name terminates the array. - * - * \return the offset of the (re-)mapped function in the dispatch - * table, or -1. - */ -GLint -_mesa_map_function_spec(const char *spec) -{ - const char *signature; - const char *names[MAX_ENTRY_POINTS + 1]; - GLint num_names = 0; - - if (!spec) - return -1; - - signature = spec; - spec += strlen(spec) + 1; - - /* spec is terminated by an empty string */ - while (*spec) { - names[num_names] = spec; - num_names++; - if (num_names >= MAX_ENTRY_POINTS) - break; - spec += strlen(spec) + 1; - } - if (!num_names) - return -1; - - names[num_names] = NULL; - - /* add the entry points to the dispatch table */ - return _glapi_add_dispatch(names, signature); -} - - -/** - * Map an array of functions. This is a convenient function for - * use with arrays available from including remap_helper.h. - * - * Note that the dispatch offsets of the functions are not returned. - * If they are needed, _mesa_map_function_spec() should be used. - * - * \param func_array an array of function remaps. - */ -void -_mesa_map_function_array(const struct gl_function_remap *func_array) -{ - GLint i; - - if (!func_array) - return; - - for (i = 0; func_array[i].func_index != -1; i++) { - const char *spec; - GLint offset; - - spec = _mesa_get_function_spec(func_array[i].func_index); - if (!spec) { - _mesa_problem(NULL, "invalid function index %d", - func_array[i].func_index); - continue; - } - - offset = _mesa_map_function_spec(spec); - /* error checks */ - if (offset < 0) { - const char *name = spec + strlen(spec) + 1; - _mesa_warning(NULL, "failed to remap %s", name); - } - else if (func_array[i].dispatch_offset >= 0 && - offset != func_array[i].dispatch_offset) { - const char *name = spec + strlen(spec) + 1; - _mesa_problem(NULL, "%s should be mapped to %d, not %d", - name, func_array[i].dispatch_offset, offset); - } - } -} - - -/** - * Map the functions which are already static. - * - * When a extension function are incorporated into the ABI, the - * extension suffix is usually stripped. Mapping such functions - * makes sure the alternative names are available. - * - * Note that functions mapped by _mesa_init_remap_table() are - * excluded. - */ -void -_mesa_map_static_functions(void) -{ - /* Remap static functions which have alternative names and are in the ABI. - * This is to be on the safe side. glapi should have defined those names. - */ - _mesa_map_function_array(MESA_alt_functions); -} - - -/** - * Initialize the remap table. This is called in one_time_init(). - * The remap table needs to be initialized before calling the - * CALL/GET/SET macros defined in main/dispatch.h. - */ -static void -_mesa_do_init_remap_table(const char *pool, - int size, - const struct gl_function_pool_remap *remap) -{ - static GLboolean initialized = GL_FALSE; - GLint i; - - if (initialized) - return; - initialized = GL_TRUE; - - /* initialize the remap table */ - for (i = 0; i < size; i++) { - GLint offset; - const char *spec; - - /* sanity check */ - ASSERT(i == remap[i].remap_index); - spec = _mesa_function_pool + remap[i].pool_index; - - offset = _mesa_map_function_spec(spec); - /* store the dispatch offset in the remap table */ - driDispatchRemapTable[i] = offset; - if (offset < 0) - _mesa_warning(NULL, "failed to remap index %d", i); - } -} - - -void -_mesa_init_remap_table(void) -{ - _mesa_do_init_remap_table(_mesa_function_pool, - driDispatchRemapTable_size, - MESA_remap_table_functions); -} - - -#endif /* FEATURE_remap_table */ +/* + * Mesa 3-D graphics library + * Version: 7.7 + * + * Copyright (C) 2009 Chia-I Wu + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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. + */ + + +/** + * \file remap.c + * Remap table management. + * + * Entries in the dispatch table are either static or dynamic. The + * dispatch table is shared by mesa core and glapi. When they are + * built separately, it is possible that a static entry in mesa core + * is dynamic, or assigned a different static offset, in glapi. The + * remap table is in charge of mapping a static entry in mesa core to + * a dynamic entry, or the corresponding static entry, in glapi. + */ + +#include "mfeatures.h" + +#if FEATURE_remap_table + +#include "remap.h" +#include "imports.h" +#include "glapi/glapi.h" + +#define MAX_ENTRY_POINTS 16 + +#define need_MESA_remap_table +#include "main/remap_helper.h" + + +/* this is global for quick access */ +int driDispatchRemapTable[driDispatchRemapTable_size]; + + +/** + * Return the spec string associated with the given function index. + * The index is available from including remap_helper.h. + * + * \param func_index an opaque function index. + * + * \return the spec string associated with the function index, or NULL. + */ +const char * +_mesa_get_function_spec(GLint func_index) +{ + if (func_index < Elements(_mesa_function_pool)) + return _mesa_function_pool + func_index; + else + return NULL; +} + + +/** + * Map a function by its spec. The function will be added to glapi, + * and the dispatch offset will be returned. + * + * \param spec a '\0'-separated string array specifying a function. + * It begins with the parameter signature of the function, + * followed by the names of the entry points. An empty entry + * point name terminates the array. + * + * \return the offset of the (re-)mapped function in the dispatch + * table, or -1. + */ +GLint +_mesa_map_function_spec(const char *spec) +{ + const char *signature; + const char *names[MAX_ENTRY_POINTS + 1]; + GLint num_names = 0; + + if (!spec) + return -1; + + signature = spec; + spec += strlen(spec) + 1; + + /* spec is terminated by an empty string */ + while (*spec) { + names[num_names] = spec; + num_names++; + if (num_names >= MAX_ENTRY_POINTS) + break; + spec += strlen(spec) + 1; + } + if (!num_names) + return -1; + + names[num_names] = NULL; + + /* add the entry points to the dispatch table */ + return _glapi_add_dispatch(names, signature); +} + + +/** + * Map an array of functions. This is a convenient function for + * use with arrays available from including remap_helper.h. + * + * Note that the dispatch offsets of the functions are not returned. + * If they are needed, _mesa_map_function_spec() should be used. + * + * \param func_array an array of function remaps. + */ +void +_mesa_map_function_array(const struct gl_function_remap *func_array) +{ + GLint i; + + if (!func_array) + return; + + for (i = 0; func_array[i].func_index != -1; i++) { + const char *spec; + GLint offset; + + spec = _mesa_get_function_spec(func_array[i].func_index); + if (!spec) { + _mesa_problem(NULL, "invalid function index %d", + func_array[i].func_index); + continue; + } + + offset = _mesa_map_function_spec(spec); + /* error checks */ + if (offset < 0) { + const char *name = spec + strlen(spec) + 1; + _mesa_warning(NULL, "failed to remap %s", name); + } + else if (func_array[i].dispatch_offset >= 0 && + offset != func_array[i].dispatch_offset) { + const char *name = spec + strlen(spec) + 1; + _mesa_problem(NULL, "%s should be mapped to %d, not %d", + name, func_array[i].dispatch_offset, offset); + } + } +} + + +/** + * Map the functions which are already static. + * + * When a extension function are incorporated into the ABI, the + * extension suffix is usually stripped. Mapping such functions + * makes sure the alternative names are available. + * + * Note that functions mapped by _mesa_init_remap_table() are + * excluded. + */ +void +_mesa_map_static_functions(void) +{ + /* Remap static functions which have alternative names and are in the ABI. + * This is to be on the safe side. glapi should have defined those names. + */ + _mesa_map_function_array(MESA_alt_functions); +} + + +/** + * Initialize the remap table. This is called in one_time_init(). + * The remap table needs to be initialized before calling the + * CALL/GET/SET macros defined in main/dispatch.h. + */ +static void +_mesa_do_init_remap_table(const char *pool, + int size, + const struct gl_function_pool_remap *remap) +{ + static GLboolean initialized = GL_FALSE; + GLint i; + + if (initialized) + return; + initialized = GL_TRUE; + + /* initialize the remap table */ + for (i = 0; i < size; i++) { + GLint offset; + const char *spec; + + /* sanity check */ + ASSERT(i == remap[i].remap_index); + spec = _mesa_function_pool + remap[i].pool_index; + + offset = _mesa_map_function_spec(spec); + /* store the dispatch offset in the remap table */ + driDispatchRemapTable[i] = offset; + if (offset < 0) + _mesa_warning(NULL, "failed to remap index %d", i); + } +} + + +void +_mesa_init_remap_table(void) +{ + _mesa_do_init_remap_table(_mesa_function_pool, + driDispatchRemapTable_size, + MESA_remap_table_functions); +} + + +#endif /* FEATURE_remap_table */ diff --git a/mesalib/src/mesa/main/scissor.c b/mesalib/src/mesa/main/scissor.c index 16e8438c5..df665994a 100644 --- a/mesalib/src/mesa/main/scissor.c +++ b/mesalib/src/mesa/main/scissor.c @@ -1,100 +1,100 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 1999-2007 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 "main/glheader.h" -#include "main/context.h" -#include "main/mtypes.h" -#include "main/scissor.h" - - -/** - * Called via glScissor - */ -void GLAPIENTRY -_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height); - - if (width < 0 || height < 0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" ); - return; - } - - _mesa_set_scissor(ctx, x, y, width, height); -} - - -/** - * Define the scissor box. - * - * \param x, y coordinates of the scissor box lower-left corner. - * \param width width of the scissor box. - * \param height height of the scissor box. - * - * \sa glScissor(). - * - * Verifies the parameters and updates __struct gl_contextRec::Scissor. On a - * change flushes the vertices and notifies the driver via - * the dd_function_table::Scissor callback. - */ -void -_mesa_set_scissor(struct gl_context *ctx, - GLint x, GLint y, GLsizei width, GLsizei height) -{ - if (x == ctx->Scissor.X && - y == ctx->Scissor.Y && - width == ctx->Scissor.Width && - height == ctx->Scissor.Height) - return; - - FLUSH_VERTICES(ctx, _NEW_SCISSOR); - ctx->Scissor.X = x; - ctx->Scissor.Y = y; - ctx->Scissor.Width = width; - ctx->Scissor.Height = height; - - if (ctx->Driver.Scissor) - ctx->Driver.Scissor( ctx, x, y, width, height ); -} - - -/** - * Initialize the context's scissor state. - * \param ctx the GL context. - */ -void -_mesa_init_scissor(struct gl_context *ctx) -{ - /* Scissor group */ - ctx->Scissor.Enabled = GL_FALSE; - ctx->Scissor.X = 0; - ctx->Scissor.Y = 0; - ctx->Scissor.Width = 0; - ctx->Scissor.Height = 0; -} +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 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 "main/glheader.h" +#include "main/context.h" +#include "main/mtypes.h" +#include "main/scissor.h" + + +/** + * Called via glScissor + */ +void GLAPIENTRY +_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height); + + if (width < 0 || height < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" ); + return; + } + + _mesa_set_scissor(ctx, x, y, width, height); +} + + +/** + * Define the scissor box. + * + * \param x, y coordinates of the scissor box lower-left corner. + * \param width width of the scissor box. + * \param height height of the scissor box. + * + * \sa glScissor(). + * + * Verifies the parameters and updates __struct gl_contextRec::Scissor. On a + * change flushes the vertices and notifies the driver via + * the dd_function_table::Scissor callback. + */ +void +_mesa_set_scissor(struct gl_context *ctx, + GLint x, GLint y, GLsizei width, GLsizei height) +{ + if (x == ctx->Scissor.X && + y == ctx->Scissor.Y && + width == ctx->Scissor.Width && + height == ctx->Scissor.Height) + return; + + FLUSH_VERTICES(ctx, _NEW_SCISSOR); + ctx->Scissor.X = x; + ctx->Scissor.Y = y; + ctx->Scissor.Width = width; + ctx->Scissor.Height = height; + + if (ctx->Driver.Scissor) + ctx->Driver.Scissor( ctx, x, y, width, height ); +} + + +/** + * Initialize the context's scissor state. + * \param ctx the GL context. + */ +void +_mesa_init_scissor(struct gl_context *ctx) +{ + /* Scissor group */ + ctx->Scissor.Enabled = GL_FALSE; + ctx->Scissor.X = 0; + ctx->Scissor.Y = 0; + ctx->Scissor.Width = 0; + ctx->Scissor.Height = 0; +} diff --git a/mesalib/src/mesa/main/scissor.h b/mesalib/src/mesa/main/scissor.h index 8735ec0cd..da9385e2b 100644 --- a/mesalib/src/mesa/main/scissor.h +++ b/mesalib/src/mesa/main/scissor.h @@ -1,47 +1,47 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 1999-2007 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 SCISSOR_H -#define SCISSOR_H - - -#include "glheader.h" - -struct gl_context; - -extern void GLAPIENTRY -_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ); - - -extern void -_mesa_set_scissor(struct gl_context *ctx, - GLint x, GLint y, GLsizei width, GLsizei height); - - -extern void -_mesa_init_scissor(struct gl_context *ctx); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 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 SCISSOR_H +#define SCISSOR_H + + +#include "glheader.h" + +struct gl_context; + +extern void GLAPIENTRY +_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ); + + +extern void +_mesa_set_scissor(struct gl_context *ctx, + GLint x, GLint y, GLsizei width, GLsizei height); + + +extern void +_mesa_init_scissor(struct gl_context *ctx); + + +#endif diff --git a/mesalib/src/mesa/main/stencil.h b/mesalib/src/mesa/main/stencil.h index f3a33db70..b772bfd6e 100644 --- a/mesalib/src/mesa/main/stencil.h +++ b/mesalib/src/mesa/main/stencil.h @@ -1,81 +1,81 @@ -/** - * \file stencil.h - * Stencil operations. - */ - -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 1999-2007 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 STENCIL_H -#define STENCIL_H - - -#include "glheader.h" - -struct gl_context; - -extern void GLAPIENTRY -_mesa_ClearStencil( GLint s ); - - -extern void GLAPIENTRY -_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ); - - -extern void GLAPIENTRY -_mesa_StencilMask( GLuint mask ); - - -extern void GLAPIENTRY -_mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ); - - -extern void GLAPIENTRY -_mesa_ActiveStencilFaceEXT(GLenum face); - - -extern void GLAPIENTRY -_mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); - - -extern void GLAPIENTRY -_mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); - - -extern void GLAPIENTRY -_mesa_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); - -extern void GLAPIENTRY -_mesa_StencilMaskSeparate(GLenum face, GLuint mask); - - -extern void -_mesa_update_stencil(struct gl_context *ctx); - - -extern void -_mesa_init_stencil( struct gl_context * ctx ); - -#endif +/** + * \file stencil.h + * Stencil operations. + */ + +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 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 STENCIL_H +#define STENCIL_H + + +#include "glheader.h" + +struct gl_context; + +extern void GLAPIENTRY +_mesa_ClearStencil( GLint s ); + + +extern void GLAPIENTRY +_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ); + + +extern void GLAPIENTRY +_mesa_StencilMask( GLuint mask ); + + +extern void GLAPIENTRY +_mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ); + + +extern void GLAPIENTRY +_mesa_ActiveStencilFaceEXT(GLenum face); + + +extern void GLAPIENTRY +_mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); + + +extern void GLAPIENTRY +_mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); + + +extern void GLAPIENTRY +_mesa_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); + +extern void GLAPIENTRY +_mesa_StencilMaskSeparate(GLenum face, GLuint mask); + + +extern void +_mesa_update_stencil(struct gl_context *ctx); + + +extern void +_mesa_init_stencil( struct gl_context * ctx ); + +#endif diff --git a/mesalib/src/mesa/main/syncobj.c b/mesalib/src/mesa/main/syncobj.c index 676038430..e1a5c6c0f 100644 --- a/mesalib/src/mesa/main/syncobj.c +++ b/mesalib/src/mesa/main/syncobj.c @@ -1,426 +1,426 @@ -/* - * Copyright © 2009 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -/** - * \file syncobj.c - * Sync object management. - * - * Unlike textures and other objects that are shared between contexts, sync - * objects are not bound to the context. As a result, the reference counting - * and delete behavior of sync objects is slightly different. References to - * sync objects are added: - * - * - By \c glFencSynce. This sets the initial reference count to 1. - * - At the start of \c glClientWaitSync. The reference is held for the - * duration of the wait call. - * - * References are removed: - * - * - By \c glDeleteSync. - * - At the end of \c glClientWaitSync. - * - * Additionally, drivers may call \c _mesa_ref_sync_object and - * \c _mesa_unref_sync_object as needed to implement \c ServerWaitSync. - * - * As with shader objects, sync object names become invalid as soon as - * \c glDeleteSync is called. For this reason \c glDeleteSync sets the - * \c DeletePending flag. All functions validate object handles by testing - * this flag. - * - * \note - * Only \c GL_ARB_sync objects are shared between contexts. If support is ever - * added for either \c GL_NV_fence or \c GL_APPLE_fence different semantics - * will need to be implemented. - * - * \author Ian Romanick - */ - -#include "glheader.h" -#include "imports.h" -#include "context.h" -#include "macros.h" -#include "mfeatures.h" -#include "get.h" -#include "dispatch.h" -#include "mtypes.h" - -#if FEATURE_ARB_sync -#include "syncobj.h" - -static struct gl_sync_object * -_mesa_new_sync_object(struct gl_context *ctx, GLenum type) -{ - struct gl_sync_object *s = MALLOC_STRUCT(gl_sync_object); - (void) ctx; - (void) type; - - return s; -} - - -static void -_mesa_delete_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) -{ - (void) ctx; - free(syncObj); -} - - -static void -_mesa_fence_sync(struct gl_context *ctx, struct gl_sync_object *syncObj, - GLenum condition, GLbitfield flags) -{ - (void) ctx; - (void) condition; - (void) flags; - - syncObj->StatusFlag = 1; -} - - -static void -_mesa_check_sync(struct gl_context *ctx, struct gl_sync_object *syncObj) -{ - (void) ctx; - (void) syncObj; - - /* No-op for software rendering. Hardware drivers will need to determine - * whether the state of the sync object has changed. - */ -} - - -static void -_mesa_wait_sync(struct gl_context *ctx, struct gl_sync_object *syncObj, - GLbitfield flags, GLuint64 timeout) -{ - (void) ctx; - (void) syncObj; - (void) flags; - (void) timeout; - - /* No-op for software rendering. Hardware drivers will need to wait until - * the state of the sync object changes or the timeout expires. - */ -} - - -void -_mesa_init_sync_object_functions(struct dd_function_table *driver) -{ - driver->NewSyncObject = _mesa_new_sync_object; - driver->FenceSync = _mesa_fence_sync; - driver->DeleteSyncObject = _mesa_delete_sync_object; - driver->CheckSync = _mesa_check_sync; - - /* Use the same no-op wait function for both. - */ - driver->ClientWaitSync = _mesa_wait_sync; - driver->ServerWaitSync = _mesa_wait_sync; -} - - -void -_mesa_init_sync_dispatch(struct _glapi_table *disp) -{ - SET_IsSync(disp, _mesa_IsSync); - SET_DeleteSync(disp, _mesa_DeleteSync); - SET_FenceSync(disp, _mesa_FenceSync); - SET_ClientWaitSync(disp, _mesa_ClientWaitSync); - SET_WaitSync(disp, _mesa_WaitSync); - SET_GetInteger64v(disp, _mesa_GetInteger64v); - SET_GetSynciv(disp, _mesa_GetSynciv); -} - - -/** - * Allocate/init the context state related to sync objects. - */ -void -_mesa_init_sync(struct gl_context *ctx) -{ - (void) ctx; -} - - -/** - * Free the context state related to sync objects. - */ -void -_mesa_free_sync_data(struct gl_context *ctx) -{ - (void) ctx; -} - - -static int -_mesa_validate_sync(struct gl_sync_object *syncObj) -{ - return (syncObj != NULL) - && (syncObj->Type == GL_SYNC_FENCE) - && !syncObj->DeletePending; -} - - -void -_mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) -{ - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); - syncObj->RefCount++; - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); -} - - -void -_mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) -{ - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); - syncObj->RefCount--; - if (syncObj->RefCount == 0) { - remove_from_list(& syncObj->link); - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); - - ctx->Driver.DeleteSyncObject(ctx, syncObj); - } else { - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); - } -} - - -GLboolean GLAPIENTRY -_mesa_IsSync(GLsync sync) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); - - return _mesa_validate_sync(syncObj) ? GL_TRUE : GL_FALSE; -} - - -void GLAPIENTRY -_mesa_DeleteSync(GLsync sync) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; - ASSERT_OUTSIDE_BEGIN_END(ctx); - - /* From the GL_ARB_sync spec: - * - * DeleteSync will silently ignore a value of zero. An - * INVALID_VALUE error is generated if is neither zero nor the - * name of a sync object. - */ - if (sync == 0) { - return; - } - - if (!_mesa_validate_sync(syncObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteSync"); - return; - } - - /* If there are no client-waits or server-waits pending on this sync, delete - * the underlying object. - */ - syncObj->DeletePending = GL_TRUE; - _mesa_unref_sync_object(ctx, syncObj); -} - - -GLsync GLAPIENTRY -_mesa_FenceSync(GLenum condition, GLbitfield flags) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_sync_object *syncObj; - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); - - if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) { - _mesa_error(ctx, GL_INVALID_ENUM, "glFenceSync(condition=0x%x)", - condition); - return 0; - } - - if (flags != 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glFenceSync(flags=0x%x)", - condition); - return 0; - } - - syncObj = ctx->Driver.NewSyncObject(ctx, GL_SYNC_FENCE); - if (syncObj != NULL) { - syncObj->Type = GL_SYNC_FENCE; - /* The name is not currently used, and it is never visible to - * applications. If sync support is extended to provide support for - * NV_fence, this field will be used. We'll also need to add an object - * ID hashtable. - */ - syncObj->Name = 1; - syncObj->RefCount = 1; - syncObj->DeletePending = GL_FALSE; - syncObj->SyncCondition = condition; - syncObj->Flags = flags; - syncObj->StatusFlag = 0; - - ctx->Driver.FenceSync(ctx, syncObj, condition, flags); - - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); - insert_at_tail(& ctx->Shared->SyncObjects, & syncObj->link); - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); - - return (GLsync) syncObj; - } - - return NULL; -} - - -GLenum GLAPIENTRY -_mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; - GLenum ret; - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_WAIT_FAILED); - - if (!_mesa_validate_sync(syncObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glClientWaitSync"); - return GL_WAIT_FAILED; - } - - if ((flags & ~GL_SYNC_FLUSH_COMMANDS_BIT) != 0) { - _mesa_error(ctx, GL_INVALID_ENUM, "glClientWaitSync(flags=0x%x)", flags); - return GL_WAIT_FAILED; - } - - _mesa_ref_sync_object(ctx, syncObj); - - /* From the GL_ARB_sync spec: - * - * ClientWaitSync returns one of four status values. A return value of - * ALREADY_SIGNALED indicates that was signaled at the time - * ClientWaitSync was called. ALREADY_SIGNALED will always be returned - * if was signaled, even if the value of is zero. - */ - ctx->Driver.CheckSync(ctx, syncObj); - if (syncObj->StatusFlag) { - ret = GL_ALREADY_SIGNALED; - } else { - ctx->Driver.ClientWaitSync(ctx, syncObj, flags, timeout); - - ret = syncObj->StatusFlag ? GL_CONDITION_SATISFIED : GL_TIMEOUT_EXPIRED; - } - - _mesa_unref_sync_object(ctx, syncObj); - return ret; -} - - -void GLAPIENTRY -_mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (!_mesa_validate_sync(syncObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glWaitSync"); - return; - } - - if (flags != 0) { - _mesa_error(ctx, GL_INVALID_ENUM, "glWaitSync(flags=0x%x)", flags); - return; - } - - /* From the GL_ARB_sync spec: - * - * If the value of is zero, then WaitSync does nothing. - */ - if (timeout == 0) { - return; - } - - ctx->Driver.ServerWaitSync(ctx, syncObj, flags, timeout); -} - - -void GLAPIENTRY -_mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, - GLint *values) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; - GLsizei size = 0; - GLint v[1]; - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (!_mesa_validate_sync(syncObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetSynciv"); - return; - } - - switch (pname) { - case GL_OBJECT_TYPE: - v[0] = syncObj->Type; - size = 1; - break; - - case GL_SYNC_CONDITION: - v[0] = syncObj->SyncCondition; - size = 1; - break; - - case GL_SYNC_STATUS: - /* Update the state of the sync by dipping into the driver. Note that - * this call won't block. It just updates state in the common object - * data from the current driver state. - */ - ctx->Driver.CheckSync(ctx, syncObj); - - v[0] = (syncObj->StatusFlag) ? GL_SIGNALED : GL_UNSIGNALED; - size = 1; - break; - - case GL_SYNC_FLAGS: - v[0] = syncObj->Flags; - size = 1; - break; - - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetSynciv(pname=0x%x)\n", pname); - return; - } - - if (size > 0) { - const GLsizei copy_count = MIN2(size, bufSize); - - memcpy(values, v, sizeof(GLint) * copy_count); - } - - if (length != NULL) { - *length = size; - } -} - -#endif /* FEATURE_ARB_sync */ +/* + * Copyright © 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file syncobj.c + * Sync object management. + * + * Unlike textures and other objects that are shared between contexts, sync + * objects are not bound to the context. As a result, the reference counting + * and delete behavior of sync objects is slightly different. References to + * sync objects are added: + * + * - By \c glFencSynce. This sets the initial reference count to 1. + * - At the start of \c glClientWaitSync. The reference is held for the + * duration of the wait call. + * + * References are removed: + * + * - By \c glDeleteSync. + * - At the end of \c glClientWaitSync. + * + * Additionally, drivers may call \c _mesa_ref_sync_object and + * \c _mesa_unref_sync_object as needed to implement \c ServerWaitSync. + * + * As with shader objects, sync object names become invalid as soon as + * \c glDeleteSync is called. For this reason \c glDeleteSync sets the + * \c DeletePending flag. All functions validate object handles by testing + * this flag. + * + * \note + * Only \c GL_ARB_sync objects are shared between contexts. If support is ever + * added for either \c GL_NV_fence or \c GL_APPLE_fence different semantics + * will need to be implemented. + * + * \author Ian Romanick + */ + +#include "glheader.h" +#include "imports.h" +#include "context.h" +#include "macros.h" +#include "mfeatures.h" +#include "get.h" +#include "dispatch.h" +#include "mtypes.h" + +#if FEATURE_ARB_sync +#include "syncobj.h" + +static struct gl_sync_object * +_mesa_new_sync_object(struct gl_context *ctx, GLenum type) +{ + struct gl_sync_object *s = MALLOC_STRUCT(gl_sync_object); + (void) ctx; + (void) type; + + return s; +} + + +static void +_mesa_delete_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) +{ + (void) ctx; + free(syncObj); +} + + +static void +_mesa_fence_sync(struct gl_context *ctx, struct gl_sync_object *syncObj, + GLenum condition, GLbitfield flags) +{ + (void) ctx; + (void) condition; + (void) flags; + + syncObj->StatusFlag = 1; +} + + +static void +_mesa_check_sync(struct gl_context *ctx, struct gl_sync_object *syncObj) +{ + (void) ctx; + (void) syncObj; + + /* No-op for software rendering. Hardware drivers will need to determine + * whether the state of the sync object has changed. + */ +} + + +static void +_mesa_wait_sync(struct gl_context *ctx, struct gl_sync_object *syncObj, + GLbitfield flags, GLuint64 timeout) +{ + (void) ctx; + (void) syncObj; + (void) flags; + (void) timeout; + + /* No-op for software rendering. Hardware drivers will need to wait until + * the state of the sync object changes or the timeout expires. + */ +} + + +void +_mesa_init_sync_object_functions(struct dd_function_table *driver) +{ + driver->NewSyncObject = _mesa_new_sync_object; + driver->FenceSync = _mesa_fence_sync; + driver->DeleteSyncObject = _mesa_delete_sync_object; + driver->CheckSync = _mesa_check_sync; + + /* Use the same no-op wait function for both. + */ + driver->ClientWaitSync = _mesa_wait_sync; + driver->ServerWaitSync = _mesa_wait_sync; +} + + +void +_mesa_init_sync_dispatch(struct _glapi_table *disp) +{ + SET_IsSync(disp, _mesa_IsSync); + SET_DeleteSync(disp, _mesa_DeleteSync); + SET_FenceSync(disp, _mesa_FenceSync); + SET_ClientWaitSync(disp, _mesa_ClientWaitSync); + SET_WaitSync(disp, _mesa_WaitSync); + SET_GetInteger64v(disp, _mesa_GetInteger64v); + SET_GetSynciv(disp, _mesa_GetSynciv); +} + + +/** + * Allocate/init the context state related to sync objects. + */ +void +_mesa_init_sync(struct gl_context *ctx) +{ + (void) ctx; +} + + +/** + * Free the context state related to sync objects. + */ +void +_mesa_free_sync_data(struct gl_context *ctx) +{ + (void) ctx; +} + + +static int +_mesa_validate_sync(struct gl_sync_object *syncObj) +{ + return (syncObj != NULL) + && (syncObj->Type == GL_SYNC_FENCE) + && !syncObj->DeletePending; +} + + +void +_mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) +{ + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + syncObj->RefCount++; + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); +} + + +void +_mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) +{ + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + syncObj->RefCount--; + if (syncObj->RefCount == 0) { + remove_from_list(& syncObj->link); + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + + ctx->Driver.DeleteSyncObject(ctx, syncObj); + } else { + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + } +} + + +GLboolean GLAPIENTRY +_mesa_IsSync(GLsync sync) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + return _mesa_validate_sync(syncObj) ? GL_TRUE : GL_FALSE; +} + + +void GLAPIENTRY +_mesa_DeleteSync(GLsync sync) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + /* From the GL_ARB_sync spec: + * + * DeleteSync will silently ignore a value of zero. An + * INVALID_VALUE error is generated if is neither zero nor the + * name of a sync object. + */ + if (sync == 0) { + return; + } + + if (!_mesa_validate_sync(syncObj)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteSync"); + return; + } + + /* If there are no client-waits or server-waits pending on this sync, delete + * the underlying object. + */ + syncObj->DeletePending = GL_TRUE; + _mesa_unref_sync_object(ctx, syncObj); +} + + +GLsync GLAPIENTRY +_mesa_FenceSync(GLenum condition, GLbitfield flags) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_sync_object *syncObj; + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); + + if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) { + _mesa_error(ctx, GL_INVALID_ENUM, "glFenceSync(condition=0x%x)", + condition); + return 0; + } + + if (flags != 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glFenceSync(flags=0x%x)", + condition); + return 0; + } + + syncObj = ctx->Driver.NewSyncObject(ctx, GL_SYNC_FENCE); + if (syncObj != NULL) { + syncObj->Type = GL_SYNC_FENCE; + /* The name is not currently used, and it is never visible to + * applications. If sync support is extended to provide support for + * NV_fence, this field will be used. We'll also need to add an object + * ID hashtable. + */ + syncObj->Name = 1; + syncObj->RefCount = 1; + syncObj->DeletePending = GL_FALSE; + syncObj->SyncCondition = condition; + syncObj->Flags = flags; + syncObj->StatusFlag = 0; + + ctx->Driver.FenceSync(ctx, syncObj, condition, flags); + + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + insert_at_tail(& ctx->Shared->SyncObjects, & syncObj->link); + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + + return (GLsync) syncObj; + } + + return NULL; +} + + +GLenum GLAPIENTRY +_mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; + GLenum ret; + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_WAIT_FAILED); + + if (!_mesa_validate_sync(syncObj)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glClientWaitSync"); + return GL_WAIT_FAILED; + } + + if ((flags & ~GL_SYNC_FLUSH_COMMANDS_BIT) != 0) { + _mesa_error(ctx, GL_INVALID_ENUM, "glClientWaitSync(flags=0x%x)", flags); + return GL_WAIT_FAILED; + } + + _mesa_ref_sync_object(ctx, syncObj); + + /* From the GL_ARB_sync spec: + * + * ClientWaitSync returns one of four status values. A return value of + * ALREADY_SIGNALED indicates that was signaled at the time + * ClientWaitSync was called. ALREADY_SIGNALED will always be returned + * if was signaled, even if the value of is zero. + */ + ctx->Driver.CheckSync(ctx, syncObj); + if (syncObj->StatusFlag) { + ret = GL_ALREADY_SIGNALED; + } else { + ctx->Driver.ClientWaitSync(ctx, syncObj, flags, timeout); + + ret = syncObj->StatusFlag ? GL_CONDITION_SATISFIED : GL_TIMEOUT_EXPIRED; + } + + _mesa_unref_sync_object(ctx, syncObj); + return ret; +} + + +void GLAPIENTRY +_mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!_mesa_validate_sync(syncObj)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glWaitSync"); + return; + } + + if (flags != 0) { + _mesa_error(ctx, GL_INVALID_ENUM, "glWaitSync(flags=0x%x)", flags); + return; + } + + /* From the GL_ARB_sync spec: + * + * If the value of is zero, then WaitSync does nothing. + */ + if (timeout == 0) { + return; + } + + ctx->Driver.ServerWaitSync(ctx, syncObj, flags, timeout); +} + + +void GLAPIENTRY +_mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, + GLint *values) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; + GLsizei size = 0; + GLint v[1]; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!_mesa_validate_sync(syncObj)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetSynciv"); + return; + } + + switch (pname) { + case GL_OBJECT_TYPE: + v[0] = syncObj->Type; + size = 1; + break; + + case GL_SYNC_CONDITION: + v[0] = syncObj->SyncCondition; + size = 1; + break; + + case GL_SYNC_STATUS: + /* Update the state of the sync by dipping into the driver. Note that + * this call won't block. It just updates state in the common object + * data from the current driver state. + */ + ctx->Driver.CheckSync(ctx, syncObj); + + v[0] = (syncObj->StatusFlag) ? GL_SIGNALED : GL_UNSIGNALED; + size = 1; + break; + + case GL_SYNC_FLAGS: + v[0] = syncObj->Flags; + size = 1; + break; + + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetSynciv(pname=0x%x)\n", pname); + return; + } + + if (size > 0) { + const GLsizei copy_count = MIN2(size, bufSize); + + memcpy(values, v, sizeof(GLint) * copy_count); + } + + if (length != NULL) { + *length = size; + } +} + +#endif /* FEATURE_ARB_sync */ diff --git a/mesalib/src/mesa/main/texformat.h b/mesalib/src/mesa/main/texformat.h index b84117995..3cf09213a 100644 --- a/mesalib/src/mesa/main/texformat.h +++ b/mesalib/src/mesa/main/texformat.h @@ -1,39 +1,39 @@ -/* - * Mesa 3-D graphics library - * Version: 7.75 - * - * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * Copyright (c) 2008-2009 VMware, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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 TEXFORMAT_H -#define TEXFORMAT_H - - -#include "formats.h" - -struct gl_context; - -extern gl_format -_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, - GLenum format, GLenum type ); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 7.75 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (c) 2008-2009 VMware, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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 TEXFORMAT_H +#define TEXFORMAT_H + + +#include "formats.h" + +struct gl_context; + +extern gl_format +_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, + GLenum format, GLenum type ); + + +#endif diff --git a/mesalib/src/mesa/main/texgen.c b/mesalib/src/mesa/main/texgen.c index 10eaa89ad..0ace0b936 100644 --- a/mesalib/src/mesa/main/texgen.c +++ b/mesalib/src/mesa/main/texgen.c @@ -1,401 +1,401 @@ -/* - * Mesa 3-D graphics library - * Version: 7.5 - * - * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. - */ - -/** - * \file texgen.c - * - * glTexGen-related functions - */ - - -#include "main/glheader.h" -#include "main/context.h" -#include "main/enums.h" -#include "main/macros.h" -#include "main/mfeatures.h" -#include "main/texgen.h" -#include "main/texstate.h" -#include "math/m_matrix.h" -#include "main/dispatch.h" - - -#if FEATURE_texgen - - -/** - * Return texgen state for given coordinate - */ -static struct gl_texgen * -get_texgen(struct gl_texture_unit *texUnit, GLenum coord) -{ - switch (coord) { - case GL_S: - return &texUnit->GenS; - case GL_T: - return &texUnit->GenT; - case GL_R: - return &texUnit->GenR; - case GL_Q: - return &texUnit->GenQ; - default: - return NULL; - } -} - - -void GLAPIENTRY -_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) -{ - struct gl_texture_unit *texUnit; - struct gl_texgen *texgen; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n", - _mesa_lookup_enum_by_nr(coord), - _mesa_lookup_enum_by_nr(pname), - *params, - _mesa_lookup_enum_by_nr((GLenum) (GLint) *params)); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glTexGen(current unit)"); - return; - } - - texUnit = _mesa_get_current_tex_unit(ctx); - - texgen = get_texgen(texUnit, coord); - if (!texgen) { - _mesa_error(ctx, GL_INVALID_ENUM, "glTexGen(coord)"); - return; - } - - switch (pname) { - case GL_TEXTURE_GEN_MODE: - { - GLenum mode = (GLenum) (GLint) params[0]; - GLbitfield bit = 0x0; - if (texgen->Mode == mode) - return; - switch (mode) { - case GL_OBJECT_LINEAR: - bit = TEXGEN_OBJ_LINEAR; - break; - case GL_EYE_LINEAR: - bit = TEXGEN_EYE_LINEAR; - break; - case GL_SPHERE_MAP: - if (coord == GL_S || coord == GL_T) - bit = TEXGEN_SPHERE_MAP; - break; - case GL_REFLECTION_MAP_NV: - if (coord != GL_Q) - bit = TEXGEN_REFLECTION_MAP_NV; - break; - case GL_NORMAL_MAP_NV: - if (coord != GL_Q) - bit = TEXGEN_NORMAL_MAP_NV; - break; - default: - ; /* nop */ - } - if (!bit) { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); - return; - } - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texgen->Mode = mode; - texgen->_ModeBit = bit; - } - break; - - case GL_OBJECT_PLANE: - { - if (TEST_EQ_4V(texgen->ObjectPlane, params)) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - COPY_4FV(texgen->ObjectPlane, params); - } - break; - - case GL_EYE_PLANE: - { - GLfloat tmp[4]; - /* Transform plane equation by the inverse modelview matrix */ - if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { - _math_matrix_analyse(ctx->ModelviewMatrixStack.Top); - } - _mesa_transform_vector(tmp, params, - ctx->ModelviewMatrixStack.Top->inv); - if (TEST_EQ_4V(texgen->EyePlane, tmp)) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - COPY_4FV(texgen->EyePlane, tmp); - } - break; - - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); - return; - } - - if (ctx->Driver.TexGen) - ctx->Driver.TexGen( ctx, coord, pname, params ); -} - - -static void GLAPIENTRY -_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) -{ - GLfloat p[4]; - p[0] = (GLfloat) params[0]; - if (pname == GL_TEXTURE_GEN_MODE) { - p[1] = p[2] = p[3] = 0.0F; - } - else { - p[1] = (GLfloat) params[1]; - p[2] = (GLfloat) params[2]; - p[3] = (GLfloat) params[3]; - } - _mesa_TexGenfv(coord, pname, p); -} - - -static void GLAPIENTRY -_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) -{ - GLfloat p[4]; - p[0] = (GLfloat) param; - p[1] = p[2] = p[3] = 0.0F; - _mesa_TexGenfv( coord, pname, p ); -} - -#if FEATURE_ES1 - -void GLAPIENTRY -_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params) -{ - ASSERT(coord == GL_TEXTURE_GEN_STR_OES); - _mesa_GetTexGenfv(GL_S, pname, params); -} - - -void GLAPIENTRY -_es_TexGenf(GLenum coord, GLenum pname, GLfloat param) -{ - ASSERT(coord == GL_TEXTURE_GEN_STR_OES); - /* set S, T, and R at the same time */ - _mesa_TexGenf(GL_S, pname, param); - _mesa_TexGenf(GL_T, pname, param); - _mesa_TexGenf(GL_R, pname, param); -} - - -void GLAPIENTRY -_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params) -{ - ASSERT(coord == GL_TEXTURE_GEN_STR_OES); - /* set S, T, and R at the same time */ - _mesa_TexGenfv(GL_S, pname, params); - _mesa_TexGenfv(GL_T, pname, params); - _mesa_TexGenfv(GL_R, pname, params); -} - -#endif - -static void GLAPIENTRY -_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) -{ - GLfloat p[4]; - p[0] = (GLfloat) params[0]; - if (pname == GL_TEXTURE_GEN_MODE) { - p[1] = p[2] = p[3] = 0.0F; - } - else { - p[1] = (GLfloat) params[1]; - p[2] = (GLfloat) params[2]; - p[3] = (GLfloat) params[3]; - } - _mesa_TexGenfv( coord, pname, p ); -} - - -void GLAPIENTRY -_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) -{ - GLfloat p[4]; - p[0] = param; - p[1] = p[2] = p[3] = 0.0F; - _mesa_TexGenfv(coord, pname, p); -} - - -void GLAPIENTRY -_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) -{ - GLint p[4]; - p[0] = param; - p[1] = p[2] = p[3] = 0; - _mesa_TexGeniv( coord, pname, p ); -} - - - -static void GLAPIENTRY -_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) -{ - struct gl_texture_unit *texUnit; - struct gl_texgen *texgen; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)"); - return; - } - - texUnit = _mesa_get_current_tex_unit(ctx); - - texgen = get_texgen(texUnit, coord); - if (!texgen) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)"); - return; - } - - switch (pname) { - case GL_TEXTURE_GEN_MODE: - params[0] = ENUM_TO_DOUBLE(texgen->Mode); - break; - case GL_OBJECT_PLANE: - COPY_4V(params, texgen->ObjectPlane); - break; - case GL_EYE_PLANE: - COPY_4V(params, texgen->EyePlane); - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); - } -} - - - -void GLAPIENTRY -_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) -{ - struct gl_texture_unit *texUnit; - struct gl_texgen *texgen; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)"); - return; - } - - texUnit = _mesa_get_current_tex_unit(ctx); - - texgen = get_texgen(texUnit, coord); - if (!texgen) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)"); - return; - } - - switch (pname) { - case GL_TEXTURE_GEN_MODE: - params[0] = ENUM_TO_FLOAT(texgen->Mode); - break; - case GL_OBJECT_PLANE: - COPY_4V(params, texgen->ObjectPlane); - break; - case GL_EYE_PLANE: - COPY_4V(params, texgen->EyePlane); - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); - } -} - - - -static void GLAPIENTRY -_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) -{ - struct gl_texture_unit *texUnit; - struct gl_texgen *texgen; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)"); - return; - } - - texUnit = _mesa_get_current_tex_unit(ctx); - - texgen = get_texgen(texUnit, coord); - if (!texgen) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)"); - return; - } - - switch (pname) { - case GL_TEXTURE_GEN_MODE: - params[0] = texgen->Mode; - break; - case GL_OBJECT_PLANE: - params[0] = (GLint) texgen->ObjectPlane[0]; - params[1] = (GLint) texgen->ObjectPlane[1]; - params[2] = (GLint) texgen->ObjectPlane[2]; - params[3] = (GLint) texgen->ObjectPlane[3]; - break; - case GL_EYE_PLANE: - params[0] = (GLint) texgen->EyePlane[0]; - params[1] = (GLint) texgen->EyePlane[1]; - params[2] = (GLint) texgen->EyePlane[2]; - params[3] = (GLint) texgen->EyePlane[3]; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); - } -} - - -void -_mesa_init_texgen_dispatch(struct _glapi_table *disp) -{ - SET_GetTexGendv(disp, _mesa_GetTexGendv); - SET_GetTexGenfv(disp, _mesa_GetTexGenfv); - SET_GetTexGeniv(disp, _mesa_GetTexGeniv); - SET_TexGend(disp, _mesa_TexGend); - SET_TexGendv(disp, _mesa_TexGendv); - SET_TexGenf(disp, _mesa_TexGenf); - SET_TexGenfv(disp, _mesa_TexGenfv); - SET_TexGeni(disp, _mesa_TexGeni); - SET_TexGeniv(disp, _mesa_TexGeniv); -} - - -#endif /* FEATURE_texgen */ +/* + * Mesa 3-D graphics library + * Version: 7.5 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. + */ + +/** + * \file texgen.c + * + * glTexGen-related functions + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/macros.h" +#include "main/mfeatures.h" +#include "main/texgen.h" +#include "main/texstate.h" +#include "math/m_matrix.h" +#include "main/dispatch.h" + + +#if FEATURE_texgen + + +/** + * Return texgen state for given coordinate + */ +static struct gl_texgen * +get_texgen(struct gl_texture_unit *texUnit, GLenum coord) +{ + switch (coord) { + case GL_S: + return &texUnit->GenS; + case GL_T: + return &texUnit->GenT; + case GL_R: + return &texUnit->GenR; + case GL_Q: + return &texUnit->GenQ; + default: + return NULL; + } +} + + +void GLAPIENTRY +_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) +{ + struct gl_texture_unit *texUnit; + struct gl_texgen *texgen; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n", + _mesa_lookup_enum_by_nr(coord), + _mesa_lookup_enum_by_nr(pname), + *params, + _mesa_lookup_enum_by_nr((GLenum) (GLint) *params)); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glTexGen(current unit)"); + return; + } + + texUnit = _mesa_get_current_tex_unit(ctx); + + texgen = get_texgen(texUnit, coord); + if (!texgen) { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexGen(coord)"); + return; + } + + switch (pname) { + case GL_TEXTURE_GEN_MODE: + { + GLenum mode = (GLenum) (GLint) params[0]; + GLbitfield bit = 0x0; + if (texgen->Mode == mode) + return; + switch (mode) { + case GL_OBJECT_LINEAR: + bit = TEXGEN_OBJ_LINEAR; + break; + case GL_EYE_LINEAR: + bit = TEXGEN_EYE_LINEAR; + break; + case GL_SPHERE_MAP: + if (coord == GL_S || coord == GL_T) + bit = TEXGEN_SPHERE_MAP; + break; + case GL_REFLECTION_MAP_NV: + if (coord != GL_Q) + bit = TEXGEN_REFLECTION_MAP_NV; + break; + case GL_NORMAL_MAP_NV: + if (coord != GL_Q) + bit = TEXGEN_NORMAL_MAP_NV; + break; + default: + ; /* nop */ + } + if (!bit) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); + return; + } + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texgen->Mode = mode; + texgen->_ModeBit = bit; + } + break; + + case GL_OBJECT_PLANE: + { + if (TEST_EQ_4V(texgen->ObjectPlane, params)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texgen->ObjectPlane, params); + } + break; + + case GL_EYE_PLANE: + { + GLfloat tmp[4]; + /* Transform plane equation by the inverse modelview matrix */ + if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { + _math_matrix_analyse(ctx->ModelviewMatrixStack.Top); + } + _mesa_transform_vector(tmp, params, + ctx->ModelviewMatrixStack.Top->inv); + if (TEST_EQ_4V(texgen->EyePlane, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texgen->EyePlane, tmp); + } + break; + + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); + return; + } + + if (ctx->Driver.TexGen) + ctx->Driver.TexGen( ctx, coord, pname, params ); +} + + +static void GLAPIENTRY +_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) +{ + GLfloat p[4]; + p[0] = (GLfloat) params[0]; + if (pname == GL_TEXTURE_GEN_MODE) { + p[1] = p[2] = p[3] = 0.0F; + } + else { + p[1] = (GLfloat) params[1]; + p[2] = (GLfloat) params[2]; + p[3] = (GLfloat) params[3]; + } + _mesa_TexGenfv(coord, pname, p); +} + + +static void GLAPIENTRY +_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) +{ + GLfloat p[4]; + p[0] = (GLfloat) param; + p[1] = p[2] = p[3] = 0.0F; + _mesa_TexGenfv( coord, pname, p ); +} + +#if FEATURE_ES1 + +void GLAPIENTRY +_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params) +{ + ASSERT(coord == GL_TEXTURE_GEN_STR_OES); + _mesa_GetTexGenfv(GL_S, pname, params); +} + + +void GLAPIENTRY +_es_TexGenf(GLenum coord, GLenum pname, GLfloat param) +{ + ASSERT(coord == GL_TEXTURE_GEN_STR_OES); + /* set S, T, and R at the same time */ + _mesa_TexGenf(GL_S, pname, param); + _mesa_TexGenf(GL_T, pname, param); + _mesa_TexGenf(GL_R, pname, param); +} + + +void GLAPIENTRY +_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params) +{ + ASSERT(coord == GL_TEXTURE_GEN_STR_OES); + /* set S, T, and R at the same time */ + _mesa_TexGenfv(GL_S, pname, params); + _mesa_TexGenfv(GL_T, pname, params); + _mesa_TexGenfv(GL_R, pname, params); +} + +#endif + +static void GLAPIENTRY +_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) +{ + GLfloat p[4]; + p[0] = (GLfloat) params[0]; + if (pname == GL_TEXTURE_GEN_MODE) { + p[1] = p[2] = p[3] = 0.0F; + } + else { + p[1] = (GLfloat) params[1]; + p[2] = (GLfloat) params[2]; + p[3] = (GLfloat) params[3]; + } + _mesa_TexGenfv( coord, pname, p ); +} + + +void GLAPIENTRY +_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) +{ + GLfloat p[4]; + p[0] = param; + p[1] = p[2] = p[3] = 0.0F; + _mesa_TexGenfv(coord, pname, p); +} + + +void GLAPIENTRY +_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) +{ + GLint p[4]; + p[0] = param; + p[1] = p[2] = p[3] = 0; + _mesa_TexGeniv( coord, pname, p ); +} + + + +static void GLAPIENTRY +_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) +{ + struct gl_texture_unit *texUnit; + struct gl_texgen *texgen; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)"); + return; + } + + texUnit = _mesa_get_current_tex_unit(ctx); + + texgen = get_texgen(texUnit, coord); + if (!texgen) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)"); + return; + } + + switch (pname) { + case GL_TEXTURE_GEN_MODE: + params[0] = ENUM_TO_DOUBLE(texgen->Mode); + break; + case GL_OBJECT_PLANE: + COPY_4V(params, texgen->ObjectPlane); + break; + case GL_EYE_PLANE: + COPY_4V(params, texgen->EyePlane); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); + } +} + + + +void GLAPIENTRY +_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) +{ + struct gl_texture_unit *texUnit; + struct gl_texgen *texgen; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)"); + return; + } + + texUnit = _mesa_get_current_tex_unit(ctx); + + texgen = get_texgen(texUnit, coord); + if (!texgen) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)"); + return; + } + + switch (pname) { + case GL_TEXTURE_GEN_MODE: + params[0] = ENUM_TO_FLOAT(texgen->Mode); + break; + case GL_OBJECT_PLANE: + COPY_4V(params, texgen->ObjectPlane); + break; + case GL_EYE_PLANE: + COPY_4V(params, texgen->EyePlane); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); + } +} + + + +static void GLAPIENTRY +_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) +{ + struct gl_texture_unit *texUnit; + struct gl_texgen *texgen; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)"); + return; + } + + texUnit = _mesa_get_current_tex_unit(ctx); + + texgen = get_texgen(texUnit, coord); + if (!texgen) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)"); + return; + } + + switch (pname) { + case GL_TEXTURE_GEN_MODE: + params[0] = texgen->Mode; + break; + case GL_OBJECT_PLANE: + params[0] = (GLint) texgen->ObjectPlane[0]; + params[1] = (GLint) texgen->ObjectPlane[1]; + params[2] = (GLint) texgen->ObjectPlane[2]; + params[3] = (GLint) texgen->ObjectPlane[3]; + break; + case GL_EYE_PLANE: + params[0] = (GLint) texgen->EyePlane[0]; + params[1] = (GLint) texgen->EyePlane[1]; + params[2] = (GLint) texgen->EyePlane[2]; + params[3] = (GLint) texgen->EyePlane[3]; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); + } +} + + +void +_mesa_init_texgen_dispatch(struct _glapi_table *disp) +{ + SET_GetTexGendv(disp, _mesa_GetTexGendv); + SET_GetTexGenfv(disp, _mesa_GetTexGenfv); + SET_GetTexGeniv(disp, _mesa_GetTexGeniv); + SET_TexGend(disp, _mesa_TexGend); + SET_TexGendv(disp, _mesa_TexGendv); + SET_TexGenf(disp, _mesa_TexGenf); + SET_TexGenfv(disp, _mesa_TexGenfv); + SET_TexGeni(disp, _mesa_TexGeni); + SET_TexGeniv(disp, _mesa_TexGeniv); +} + + +#endif /* FEATURE_texgen */ diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 694f6fa00..b16baaf91 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -2606,26 +2606,9 @@ teximage(struct gl_context *ctx, GLuint dims, border, internalFormat, texFormat); /* Give the texture to the driver. may be null. */ - ASSERT(ctx->Driver.TexImage3D); - switch (dims) { - case 1: - ctx->Driver.TexImage1D(ctx, texImage, internalFormat, - width, border, format, - type, pixels, unpack); - break; - case 2: - ctx->Driver.TexImage2D(ctx, texImage, internalFormat, - width, height, border, format, - type, pixels, unpack); - break; - case 3: - ctx->Driver.TexImage3D(ctx, texImage, internalFormat, - width, height, depth, border, format, - type, pixels, unpack); - break; - default: - _mesa_problem(ctx, "invalid dims=%u in teximage()", dims); - } + ctx->Driver.TexImage(ctx, dims, texImage, internalFormat, + width, height, depth, border, format, + type, pixels, unpack); check_gen_mipmap(ctx, target, texObj, level); @@ -2809,26 +2792,10 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, xoffset += texImage->Border; } - switch (dims) { - case 1: - ctx->Driver.TexSubImage1D(ctx, texImage, - xoffset, width, - format, type, pixels, &ctx->Unpack); - break; - case 2: - ctx->Driver.TexSubImage2D(ctx, texImage, - xoffset, yoffset, width, height, - format, type, pixels, &ctx->Unpack); - break; - case 3: - ctx->Driver.TexSubImage3D(ctx, texImage, - xoffset, yoffset, zoffset, - width, height, depth, - format, type, pixels, &ctx->Unpack); - break; - default: - _mesa_problem(ctx, "unexpected dims in subteximage()"); - } + ctx->Driver.TexSubImage(ctx, dims, texImage, + xoffset, yoffset, zoffset, + width, height, depth, + format, type, pixels, &ctx->Unpack); check_gen_mipmap(ctx, target, texObj, level); @@ -2959,7 +2926,7 @@ copyteximage(struct gl_context *ctx, GLuint dims, GL_NONE, GL_NONE); if (legal_texture_size(ctx, texFormat, width, height, 1)) { - GLint srcX = x, srcY = y, dstX = 0, dstY = 0; + GLint srcX = x, srcY = y, dstX = 0, dstY = 0, dstZ = 0; /* Free old texture image */ ctx->Driver.FreeTextureImageBuffer(ctx, texImage); @@ -2968,29 +2935,17 @@ copyteximage(struct gl_context *ctx, GLuint dims, border, internalFormat, texFormat); /* Allocate texture memory (no pixel data yet) */ - if (dims == 1) { - ctx->Driver.TexImage1D(ctx, texImage, internalFormat, - width, border, GL_NONE, GL_NONE, NULL, - &ctx->Unpack); - } - else { - ctx->Driver.TexImage2D(ctx, texImage, internalFormat, - width, height, border, GL_NONE, GL_NONE, - NULL, &ctx->Unpack); - } + ctx->Driver.TexImage(ctx, dims, texImage, internalFormat, + width, height, 1, border, GL_NONE, GL_NONE, + NULL, &ctx->Unpack); if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY, &width, &height)) { struct gl_renderbuffer *srcRb = get_copy_tex_image_source(ctx, texImage->TexFormat); - if (dims == 1) - ctx->Driver.CopyTexSubImage1D(ctx, texImage, dstX, - srcRb, srcX, srcY, width); - - else - ctx->Driver.CopyTexSubImage2D(ctx, texImage, dstX, dstY, - srcRb, srcX, srcY, width, height); + ctx->Driver.CopyTexSubImage(ctx, dims, texImage, dstX, dstY, dstZ, + srcRb, srcX, srcY, width, height); } check_gen_mipmap(ctx, target, texObj, level); @@ -3089,23 +3044,9 @@ copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, struct gl_renderbuffer *srcRb = get_copy_tex_image_source(ctx, texImage->TexFormat); - switch (dims) { - case 1: - ctx->Driver.CopyTexSubImage1D(ctx, texImage, xoffset, - srcRb, x, y, width); - break; - case 2: - ctx->Driver.CopyTexSubImage2D(ctx, texImage, xoffset, yoffset, - srcRb, x, y, width, height); - break; - case 3: - ctx->Driver.CopyTexSubImage3D(ctx, texImage, - xoffset, yoffset, zoffset, - srcRb, x, y, width, height); - break; - default: - _mesa_problem(ctx, "bad dims in copytexsubimage()"); - } + ctx->Driver.CopyTexSubImage(ctx, dims, texImage, + xoffset, yoffset, zoffset, + srcRb, x, y, width, height); check_gen_mipmap(ctx, target, texObj, level); @@ -3600,31 +3541,10 @@ compressedteximage(struct gl_context *ctx, GLuint dims, width, height, depth, border, internalFormat, texFormat); - switch (dims) { - case 1: - ASSERT(ctx->Driver.CompressedTexImage1D); - ctx->Driver.CompressedTexImage1D(ctx, texImage, - internalFormat, - width, - border, imageSize, data); - break; - case 2: - ASSERT(ctx->Driver.CompressedTexImage2D); - ctx->Driver.CompressedTexImage2D(ctx, texImage, - internalFormat, - width, height, - border, imageSize, data); - break; - case 3: - ASSERT(ctx->Driver.CompressedTexImage3D); - ctx->Driver.CompressedTexImage3D(ctx, texImage, - internalFormat, - width, height, depth, - border, imageSize, data); - break; - default: - _mesa_problem(ctx, "bad dims in compressedteximage"); - } + ctx->Driver.CompressedTexImage(ctx, dims, texImage, + internalFormat, + width, height, depth, + border, imageSize, data); check_gen_mipmap(ctx, target, texObj, level); @@ -3713,33 +3633,10 @@ compressed_tex_sub_image(GLuint dims, GLenum target, GLint level, /* error was recorded */ } else if (width > 0 && height > 0 && depth > 0) { - switch (dims) { - case 1: - if (ctx->Driver.CompressedTexSubImage1D) { - ctx->Driver.CompressedTexSubImage1D(ctx, texImage, - xoffset, width, - format, imageSize, data); - } - break; - case 2: - if (ctx->Driver.CompressedTexSubImage2D) { - ctx->Driver.CompressedTexSubImage2D(ctx, texImage, - xoffset, yoffset, - width, height, - format, imageSize, data); - } - break; - case 3: - if (ctx->Driver.CompressedTexSubImage3D) { - ctx->Driver.CompressedTexSubImage3D(ctx, texImage, - xoffset, yoffset, zoffset, - width, height, depth, - format, imageSize, data); - } - break; - default: - ; - } + ctx->Driver.CompressedTexSubImage(ctx, dims, texImage, + xoffset, yoffset, zoffset, + width, height, depth, + format, imageSize, data); check_gen_mipmap(ctx, target, texObj, level); diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index a471bad22..e0494c940 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -807,30 +807,10 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex) 0, /* border */ GL_RGBA, texFormat); - switch (dims) { - case 0: - break; - case 1: - ctx->Driver.TexImage1D(ctx, texImage, GL_RGBA, - width, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texel, - &ctx->DefaultPacking); - break; - case 2: - ctx->Driver.TexImage2D(ctx, texImage, GL_RGBA, - width, height, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texel, - &ctx->DefaultPacking); - break; - case 3: - ctx->Driver.TexImage3D(ctx, texImage, GL_RGBA, - width, height, depth, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texel, - &ctx->DefaultPacking); - break; - default: - _mesa_problem(ctx, "bad dims in _mesa_get_fallback_texture()"); - } + ctx->Driver.TexImage(ctx, dims, texImage, GL_RGBA, + width, height, depth, 0, + GL_RGBA, GL_UNSIGNED_BYTE, texel, + &ctx->DefaultPacking); } _mesa_test_texobj_completeness(ctx, texObj); diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index d368b1868..1ced8aac9 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -4261,170 +4261,71 @@ store_texsubimage(struct gl_context *ctx, /** - * This is the fallback for Driver.TexImage1D(). + * Fallback code for ctx->Driver.TexImage(). + * Basically, allocate storage for the texture image, then copy the + * user's image into it. */ void -_mesa_store_teximage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing) +_mesa_store_teximage(struct gl_context *ctx, + GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint depth, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing) { - if (width == 0) - return; - - /* allocate storage for texture data */ - if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat, - width, 1, 1)) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); - return; - } - - store_texsubimage(ctx, texImage, - 0, 0, 0, width, 1, 1, - format, type, pixels, packing, "glTexImage1D"); -} - - -/** - * This is the fallback for Driver.TexImage2D(). - */ -void -_mesa_store_teximage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing) -{ - if (width == 0 || height == 0) - return; - - /* allocate storage for texture data */ - if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat, - width, height, 1)) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); - return; - } - - store_texsubimage(ctx, texImage, - 0, 0, 0, width, height, 1, - format, type, pixels, packing, "glTexImage2D"); -} - + assert(dims == 1 || dims == 2 || dims == 3); - -/** - * This is the fallback for Driver.TexImage3D(). - */ -void -_mesa_store_teximage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint depth, GLint border, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing) -{ if (width == 0 || height == 0 || depth == 0) return; /* allocate storage for texture data */ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat, width, height, depth)) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims); return; } store_texsubimage(ctx, texImage, 0, 0, 0, width, height, depth, - format, type, pixels, packing, "glTexImage3D"); + format, type, pixels, packing, "glTexImage"); } - - /* - * This is the fallback for Driver.TexSubImage1D(). + * Fallback for Driver.TexSubImage(). */ void -_mesa_store_texsubimage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint width, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing) -{ - store_texsubimage(ctx, texImage, - xoffset, 0, 0, width, 1, 1, - format, type, pixels, packing, "glTexSubImage1D"); -} - - - -/** - * This is the fallback for Driver.TexSubImage2D(). - */ -void -_mesa_store_texsubimage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - GLint width, GLint height, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing) -{ - store_texsubimage(ctx, texImage, - xoffset, yoffset, 0, width, height, 1, - format, type, pixels, packing, "glTexSubImage2D"); -} - - -/* - * This is the fallback for Driver.TexSubImage3D(). - */ -void -_mesa_store_texsubimage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLint width, GLint height, GLint depth, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing) +_mesa_store_texsubimage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint width, GLint height, GLint depth, + GLenum format, GLenum type, const void *pixels, + const struct gl_pixelstore_attrib *packing) { store_texsubimage(ctx, texImage, xoffset, yoffset, zoffset, width, height, depth, - format, type, pixels, packing, "glTexSubImage3D"); -} - - -/* - * Fallback for Driver.CompressedTexImage1D() - */ -void -_mesa_store_compressed_teximage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint border, - GLsizei imageSize, const GLvoid *data) -{ - /* no compressed 1D image formats at this time */ - (void) ctx; - (void) internalFormat; - (void) width; (void) border; - (void) imageSize; (void) data; - (void) texImage; + format, type, pixels, packing, "glTexSubImage"); } - /** - * Fallback for Driver.CompressedTexImage2D() + * Fallback for Driver.CompressedTexImage() */ void -_mesa_store_compressed_teximage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLsizei imageSize, const GLvoid *data) +_mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint depth, + GLint border, + GLsizei imageSize, const GLvoid *data) { + /* only 2D compressed images are supported at this time */ + if (dims != 2) { + _mesa_problem(ctx, "Unexpected glCompressedTexImage1D/3D call"); + return; + } + /* This is pretty simple, because unlike the general texstore path we don't * have to worry about the usual image unpacking or image transfer * operations. @@ -4441,66 +4342,24 @@ _mesa_store_compressed_teximage2d(struct gl_context *ctx, return; } - _mesa_store_compressed_texsubimage2d(ctx, texImage, - 0, 0, - width, height, - texImage->TexFormat, - imageSize, data); -} - - - -/* - * Fallback for Driver.CompressedTexImage3D() - */ -void -_mesa_store_compressed_teximage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint depth, - GLint border, - GLsizei imageSize, const GLvoid *data) -{ - /* this space intentionally left blank */ - (void) ctx; - (void) internalFormat; - (void) width; (void) height; (void) depth; - (void) border; - (void) imageSize; (void) data; - (void) texImage; -} - - - -/** - * Fallback for Driver.CompressedTexSubImage1D() - */ -void -_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLsizei width, - GLenum format, - GLsizei imageSize, const GLvoid *data) -{ - /* there are no compressed 1D texture formats yet */ - (void) ctx; - (void) xoffset; (void) width; - (void) format; - (void) imageSize; (void) data; - (void) texImage; + _mesa_store_compressed_texsubimage(ctx, dims, texImage, + 0, 0, 0, + width, height, depth, + texImage->TexFormat, + imageSize, data); } /** - * Fallback for Driver.CompressedTexSubImage2D() + * Fallback for Driver.CompressedTexSubImage() */ void -_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, - GLsizei imageSize, const GLvoid *data) +_mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, + GLsizei imageSize, const GLvoid *data) { GLint bytesPerRow, dstRowStride, srcRowStride; GLint i, rows; @@ -4509,6 +4368,11 @@ _mesa_store_compressed_texsubimage2d(struct gl_context *ctx, const gl_format texFormat = texImage->TexFormat; GLuint bw, bh; + if (dims != 2) { + _mesa_problem(ctx, "Unexpected 1D/3D compressed texsubimage call"); + return; + } + _mesa_get_format_block_size(texFormat, &bw, &bh); /* these should have been caught sooner */ @@ -4552,24 +4416,3 @@ _mesa_store_compressed_texsubimage2d(struct gl_context *ctx, _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack); } - - -/** - * Fallback for Driver.CompressedTexSubImage3D() - */ -void -_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLsizei depth, - GLenum format, - GLsizei imageSize, const GLvoid *data) -{ - /* there are no compressed 3D texture formats yet */ - (void) ctx; - (void) xoffset; (void) yoffset; (void) zoffset; - (void) width; (void) height; (void) depth; - (void) format; - (void) imageSize; (void) data; - (void) texImage; -} diff --git a/mesalib/src/mesa/main/texstore.h b/mesalib/src/mesa/main/texstore.h index 85e33b0fe..5a1c01423 100644 --- a/mesalib/src/mesa/main/texstore.h +++ b/mesalib/src/mesa/main/texstore.h @@ -90,103 +90,40 @@ _mesa_make_temp_float_image(struct gl_context *ctx, GLuint dims, GLbitfield transferOps); extern void -_mesa_store_teximage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); +_mesa_store_teximage(struct gl_context *ctx, + GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint depth, GLint border, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); extern void -_mesa_store_teximage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); +_mesa_store_texsubimage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint width, GLint height, GLint depth, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing); extern void -_mesa_store_teximage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint depth, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); +_mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint depth, + GLint border, + GLsizei imageSize, const GLvoid *data); extern void -_mesa_store_texsubimage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint width, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - -extern void -_mesa_store_texsubimage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - GLint width, GLint height, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - -extern void -_mesa_store_texsubimage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLint width, GLint height, GLint depth, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - -extern void -_mesa_store_compressed_teximage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint border, - GLsizei imageSize, const GLvoid *data); - -extern void -_mesa_store_compressed_teximage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLsizei imageSize, const GLvoid *data); - -extern void -_mesa_store_compressed_teximage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint depth, - GLint border, - GLsizei imageSize, const GLvoid *data); - - -extern void -_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLsizei width, - GLenum format, - GLsizei imageSize, const GLvoid *data); - -extern void -_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, - GLsizei imageSize, const GLvoid *data); - -extern void -_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLsizei depth, - GLenum format, - GLsizei imageSize, const GLvoid *data); +_mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, + GLsizei imageSize, const GLvoid *data); #endif diff --git a/mesalib/src/mesa/main/texturebarrier.c b/mesalib/src/mesa/main/texturebarrier.c index ef4bd45e6..56cc8718c 100644 --- a/mesalib/src/mesa/main/texturebarrier.c +++ b/mesalib/src/mesa/main/texturebarrier.c @@ -1,54 +1,54 @@ -/* - * Copyright © 2011 Marek Olšák - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. - */ - -/** - * \file texturebarrier.c - * Implementation of glTextureBarrierNV. - * - * \author Marek Olšák - */ - -#include "context.h" -#include "texturebarrier.h" - - -static void -_mesa_texture_barrier(struct gl_context *ctx) -{ - /* no-op */ -} - -void -_mesa_init_texture_barrier_functions(struct dd_function_table *driver) -{ - driver->TextureBarrier = _mesa_texture_barrier; -} - -void GLAPIENTRY -_mesa_TextureBarrierNV(void) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - ctx->Driver.TextureBarrier(ctx); -} +/* + * Copyright © 2011 Marek Olšák + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. + */ + +/** + * \file texturebarrier.c + * Implementation of glTextureBarrierNV. + * + * \author Marek Olšák + */ + +#include "context.h" +#include "texturebarrier.h" + + +static void +_mesa_texture_barrier(struct gl_context *ctx) +{ + /* no-op */ +} + +void +_mesa_init_texture_barrier_functions(struct dd_function_table *driver) +{ + driver->TextureBarrier = _mesa_texture_barrier; +} + +void GLAPIENTRY +_mesa_TextureBarrierNV(void) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + ctx->Driver.TextureBarrier(ctx); +} diff --git a/mesalib/src/mesa/main/texturebarrier.h b/mesalib/src/mesa/main/texturebarrier.h index ef35989b4..a84a85b21 100644 --- a/mesalib/src/mesa/main/texturebarrier.h +++ b/mesalib/src/mesa/main/texturebarrier.h @@ -1,44 +1,44 @@ -/* - * Copyright © 2011 Marek Olšák - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. - */ - -/** - * \file texturebarrier.h - * GL_NV_texture_barrier - * - * \author Marek Olšák - */ - -#ifndef TEXTUREBARRIER_H -#define TEXTUREBARRIER_H - -#include "glheader.h" - -struct dd_function_table; - -extern void -_mesa_init_texture_barrier_functions(struct dd_function_table *driver); - -extern void GLAPIENTRY -_mesa_TextureBarrierNV(void); - -#endif /* TEXTUREBARRIER_H */ +/* + * Copyright © 2011 Marek Olšák + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. + */ + +/** + * \file texturebarrier.h + * GL_NV_texture_barrier + * + * \author Marek Olšák + */ + +#ifndef TEXTUREBARRIER_H +#define TEXTUREBARRIER_H + +#include "glheader.h" + +struct dd_function_table; + +extern void +_mesa_init_texture_barrier_functions(struct dd_function_table *driver); + +extern void GLAPIENTRY +_mesa_TextureBarrierNV(void); + +#endif /* TEXTUREBARRIER_H */ diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c index f2c1435d9..1bd76d130 100644 --- a/mesalib/src/mesa/main/transformfeedback.c +++ b/mesalib/src/mesa/main/transformfeedback.c @@ -470,7 +470,12 @@ _mesa_BindBufferRange(GLenum target, GLuint index, return; } - bufObj = _mesa_lookup_bufferobj(ctx, buffer); + if (buffer == 0) { + bufObj = ctx->Shared->NullBufferObj; + } else { + bufObj = _mesa_lookup_bufferobj(ctx, buffer); + } + if (!bufObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindBufferRange(invalid buffer=%u)", buffer); @@ -518,7 +523,12 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer) return; } - bufObj = _mesa_lookup_bufferobj(ctx, buffer); + if (buffer == 0) { + bufObj = ctx->Shared->NullBufferObj; + } else { + bufObj = _mesa_lookup_bufferobj(ctx, buffer); + } + if (!bufObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindBufferBase(invalid buffer=%u)", buffer); @@ -574,7 +584,12 @@ _mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer, return; } - bufObj = _mesa_lookup_bufferobj(ctx, buffer); + if (buffer == 0) { + bufObj = ctx->Shared->NullBufferObj; + } else { + bufObj = _mesa_lookup_bufferobj(ctx, buffer); + } + if (!bufObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindBufferOffsetEXT(invalid buffer=%u)", buffer); diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c index 90afecb5d..efaaf58de 100644 --- a/mesalib/src/mesa/main/version.c +++ b/mesalib/src/mesa/main/version.c @@ -171,6 +171,7 @@ compute_version(struct gl_context *ctx) ctx->Extensions.ARB_instanced_arrays && ctx->Extensions.ARB_occlusion_query2 && ctx->Extensions.ARB_sampler_objects && + ctx->Extensions.ARB_shader_bit_encoding && ctx->Extensions.ARB_texture_rgb10_a2ui && ctx->Extensions.ARB_timer_query && ctx->Extensions.ARB_vertex_type_2_10_10_10_rev && diff --git a/mesalib/src/mesa/main/viewport.c b/mesalib/src/mesa/main/viewport.c index 9186d1bb8..a58697ab3 100644 --- a/mesalib/src/mesa/main/viewport.c +++ b/mesalib/src/mesa/main/viewport.c @@ -1,185 +1,185 @@ -/* - * Mesa 3-D graphics library - * Version: 7.5 - * - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. - */ - - -/** - * \file viewport.c - * glViewport and glDepthRange functions. - */ - - -#include "context.h" -#include "macros.h" -#include "mtypes.h" -#include "viewport.h" - - -/** - * Set the viewport. - * \sa Called via glViewport() or display list execution. - * - * Flushes the vertices and calls _mesa_set_viewport() with the given - * parameters. - */ -void GLAPIENTRY -_mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - _mesa_set_viewport(ctx, x, y, width, height); -} - - -/** - * Set new viewport parameters and update derived state (the _WindowMap - * matrix). Usually called from _mesa_Viewport(). - * - * \param ctx GL context. - * \param x, y coordinates of the lower left corner of the viewport rectangle. - * \param width width of the viewport rectangle. - * \param height height of the viewport rectangle. - */ -void -_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y, - GLsizei width, GLsizei height) -{ - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height); - - if (width < 0 || height < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glViewport(%d, %d, %d, %d)", x, y, width, height); - return; - } - - /* clamp width and height to the implementation dependent range */ - width = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth); - height = MIN2(height, (GLsizei) ctx->Const.MaxViewportHeight); - - ctx->Viewport.X = x; - ctx->Viewport.Width = width; - ctx->Viewport.Y = y; - ctx->Viewport.Height = height; - ctx->NewState |= _NEW_VIEWPORT; - -#if 1 - /* XXX remove this someday. Currently the DRI drivers rely on - * the WindowMap matrix being up to date in the driver's Viewport - * and DepthRange functions. - */ - _math_matrix_viewport(&ctx->Viewport._WindowMap, - ctx->Viewport.X, ctx->Viewport.Y, - ctx->Viewport.Width, ctx->Viewport.Height, - ctx->Viewport.Near, ctx->Viewport.Far, - ctx->DrawBuffer->_DepthMaxF); -#endif - - if (ctx->Driver.Viewport) { - /* Many drivers will use this call to check for window size changes - * and reallocate the z/stencil/accum/etc buffers if needed. - */ - ctx->Driver.Viewport(ctx, x, y, width, height); - } -} - - -/** - * Called by glDepthRange - * - * \param nearval specifies the Z buffer value which should correspond to - * the near clip plane - * \param farval specifies the Z buffer value which should correspond to - * the far clip plane - */ -void GLAPIENTRY -_mesa_DepthRange(GLclampd nearval, GLclampd farval) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - if (MESA_VERBOSE&VERBOSE_API) - _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval); - - if (ctx->Viewport.Near == nearval && - ctx->Viewport.Far == farval) - return; - - ctx->Viewport.Near = (GLfloat) CLAMP(nearval, 0.0, 1.0); - ctx->Viewport.Far = (GLfloat) CLAMP(farval, 0.0, 1.0); - ctx->NewState |= _NEW_VIEWPORT; - -#if 1 - /* XXX remove this someday. Currently the DRI drivers rely on - * the WindowMap matrix being up to date in the driver's Viewport - * and DepthRange functions. - */ - _math_matrix_viewport(&ctx->Viewport._WindowMap, - ctx->Viewport.X, ctx->Viewport.Y, - ctx->Viewport.Width, ctx->Viewport.Height, - ctx->Viewport.Near, ctx->Viewport.Far, - ctx->DrawBuffer->_DepthMaxF); -#endif - - if (ctx->Driver.DepthRange) { - ctx->Driver.DepthRange(ctx, nearval, farval); - } -} - -void GLAPIENTRY -_mesa_DepthRangef(GLclampf nearval, GLclampf farval) -{ - _mesa_DepthRange(nearval, farval); -} - -/** - * Initialize the context viewport attribute group. - * \param ctx the GL context. - */ -void _mesa_init_viewport(struct gl_context *ctx) -{ - GLfloat depthMax = 65535.0F; /* sorf of arbitrary */ - - /* Viewport group */ - ctx->Viewport.X = 0; - ctx->Viewport.Y = 0; - ctx->Viewport.Width = 0; - ctx->Viewport.Height = 0; - ctx->Viewport.Near = 0.0; - ctx->Viewport.Far = 1.0; - _math_matrix_ctr(&ctx->Viewport._WindowMap); - - _math_matrix_viewport(&ctx->Viewport._WindowMap, 0, 0, 0, 0, - 0.0F, 1.0F, depthMax); -} - - -/** - * Free the context viewport attribute group data. - * \param ctx the GL context. - */ -void _mesa_free_viewport_data(struct gl_context *ctx) -{ - _math_matrix_dtr(&ctx->Viewport._WindowMap); -} - +/* + * Mesa 3-D graphics library + * Version: 7.5 + * + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. + */ + + +/** + * \file viewport.c + * glViewport and glDepthRange functions. + */ + + +#include "context.h" +#include "macros.h" +#include "mtypes.h" +#include "viewport.h" + + +/** + * Set the viewport. + * \sa Called via glViewport() or display list execution. + * + * Flushes the vertices and calls _mesa_set_viewport() with the given + * parameters. + */ +void GLAPIENTRY +_mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + _mesa_set_viewport(ctx, x, y, width, height); +} + + +/** + * Set new viewport parameters and update derived state (the _WindowMap + * matrix). Usually called from _mesa_Viewport(). + * + * \param ctx GL context. + * \param x, y coordinates of the lower left corner of the viewport rectangle. + * \param width width of the viewport rectangle. + * \param height height of the viewport rectangle. + */ +void +_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y, + GLsizei width, GLsizei height) +{ + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height); + + if (width < 0 || height < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glViewport(%d, %d, %d, %d)", x, y, width, height); + return; + } + + /* clamp width and height to the implementation dependent range */ + width = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth); + height = MIN2(height, (GLsizei) ctx->Const.MaxViewportHeight); + + ctx->Viewport.X = x; + ctx->Viewport.Width = width; + ctx->Viewport.Y = y; + ctx->Viewport.Height = height; + ctx->NewState |= _NEW_VIEWPORT; + +#if 1 + /* XXX remove this someday. Currently the DRI drivers rely on + * the WindowMap matrix being up to date in the driver's Viewport + * and DepthRange functions. + */ + _math_matrix_viewport(&ctx->Viewport._WindowMap, + ctx->Viewport.X, ctx->Viewport.Y, + ctx->Viewport.Width, ctx->Viewport.Height, + ctx->Viewport.Near, ctx->Viewport.Far, + ctx->DrawBuffer->_DepthMaxF); +#endif + + if (ctx->Driver.Viewport) { + /* Many drivers will use this call to check for window size changes + * and reallocate the z/stencil/accum/etc buffers if needed. + */ + ctx->Driver.Viewport(ctx, x, y, width, height); + } +} + + +/** + * Called by glDepthRange + * + * \param nearval specifies the Z buffer value which should correspond to + * the near clip plane + * \param farval specifies the Z buffer value which should correspond to + * the far clip plane + */ +void GLAPIENTRY +_mesa_DepthRange(GLclampd nearval, GLclampd farval) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (MESA_VERBOSE&VERBOSE_API) + _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval); + + if (ctx->Viewport.Near == nearval && + ctx->Viewport.Far == farval) + return; + + ctx->Viewport.Near = (GLfloat) CLAMP(nearval, 0.0, 1.0); + ctx->Viewport.Far = (GLfloat) CLAMP(farval, 0.0, 1.0); + ctx->NewState |= _NEW_VIEWPORT; + +#if 1 + /* XXX remove this someday. Currently the DRI drivers rely on + * the WindowMap matrix being up to date in the driver's Viewport + * and DepthRange functions. + */ + _math_matrix_viewport(&ctx->Viewport._WindowMap, + ctx->Viewport.X, ctx->Viewport.Y, + ctx->Viewport.Width, ctx->Viewport.Height, + ctx->Viewport.Near, ctx->Viewport.Far, + ctx->DrawBuffer->_DepthMaxF); +#endif + + if (ctx->Driver.DepthRange) { + ctx->Driver.DepthRange(ctx, nearval, farval); + } +} + +void GLAPIENTRY +_mesa_DepthRangef(GLclampf nearval, GLclampf farval) +{ + _mesa_DepthRange(nearval, farval); +} + +/** + * Initialize the context viewport attribute group. + * \param ctx the GL context. + */ +void _mesa_init_viewport(struct gl_context *ctx) +{ + GLfloat depthMax = 65535.0F; /* sorf of arbitrary */ + + /* Viewport group */ + ctx->Viewport.X = 0; + ctx->Viewport.Y = 0; + ctx->Viewport.Width = 0; + ctx->Viewport.Height = 0; + ctx->Viewport.Near = 0.0; + ctx->Viewport.Far = 1.0; + _math_matrix_ctr(&ctx->Viewport._WindowMap); + + _math_matrix_viewport(&ctx->Viewport._WindowMap, 0, 0, 0, 0, + 0.0F, 1.0F, depthMax); +} + + +/** + * Free the context viewport attribute group data. + * \param ctx the GL context. + */ +void _mesa_free_viewport_data(struct gl_context *ctx) +{ + _math_matrix_dtr(&ctx->Viewport._WindowMap); +} + diff --git a/mesalib/src/mesa/main/viewport.h b/mesalib/src/mesa/main/viewport.h index 2f66c6a67..db4507bea 100644 --- a/mesalib/src/mesa/main/viewport.h +++ b/mesalib/src/mesa/main/viewport.h @@ -1,58 +1,58 @@ -/* - * Mesa 3-D graphics library - * Version: 7.5 - * - * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 VIEWPORT_H -#define VIEWPORT_H - -#include "glheader.h" - -struct gl_context; - -extern void GLAPIENTRY -_mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height); - - -extern void -_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y, - GLsizei width, GLsizei height); - - -extern void GLAPIENTRY -_mesa_DepthRange(GLclampd nearval, GLclampd farval); - -extern void GLAPIENTRY -_mesa_DepthRangef(GLclampf nearval, GLclampf farval); - - -extern void -_mesa_init_viewport(struct gl_context *ctx); - - -extern void -_mesa_free_viewport_data(struct gl_context *ctx); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 7.5 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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 VIEWPORT_H +#define VIEWPORT_H + +#include "glheader.h" + +struct gl_context; + +extern void GLAPIENTRY +_mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height); + + +extern void +_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y, + GLsizei width, GLsizei height); + + +extern void GLAPIENTRY +_mesa_DepthRange(GLclampd nearval, GLclampd farval); + +extern void GLAPIENTRY +_mesa_DepthRangef(GLclampf nearval, GLclampf farval); + + +extern void +_mesa_init_viewport(struct gl_context *ctx); + + +extern void +_mesa_free_viewport_data(struct gl_context *ctx); + + +#endif diff --git a/mesalib/src/mesa/math/m_debug_clip.c b/mesalib/src/mesa/math/m_debug_clip.c index 36d2a9e64..bbad6ef02 100644 --- a/mesalib/src/mesa/math/m_debug_clip.c +++ b/mesalib/src/mesa/math/m_debug_clip.c @@ -1,409 +1,409 @@ -/* - * Mesa 3-D graphics library - * Version: 6.1 - * - * 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. - * - * Authors: - * Gareth Hughes - */ - -#include "main/glheader.h" -#include "main/context.h" -#include "main/macros.h" -#include "main/imports.h" - -#include "m_matrix.h" -#include "m_xform.h" - -#include "m_debug.h" -#include "m_debug_util.h" - -#ifdef __UNIXOS2__ -/* The linker doesn't like empty files */ -static char dummy; -#endif - -#ifdef DEBUG_MATH /* This code only used for debugging */ - -static clip_func *clip_tab[2] = { - _mesa_clip_tab, - _mesa_clip_np_tab -}; -static char *cnames[2] = { - "_mesa_clip_tab", - "_mesa_clip_np_tab" -}; -#ifdef RUN_DEBUG_BENCHMARK -static char *cstrings[2] = { - "clip, perspective divide", - "clip, no divide" -}; -#endif - - -/* ============================================================= - * Reference cliptests - */ - -static GLvector4f *ref_cliptest_points4( GLvector4f *clip_vec, - GLvector4f *proj_vec, - GLubyte clipMask[], - GLubyte *orMask, - GLubyte *andMask, - GLboolean viewport_z_clip ) -{ - const GLuint stride = clip_vec->stride; - const GLuint count = clip_vec->count; - const GLfloat *from = (GLfloat *)clip_vec->start; - GLuint c = 0; - GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start; - GLubyte tmpAndMask = *andMask; - GLubyte tmpOrMask = *orMask; - GLuint i; - for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) { - const GLfloat cx = from[0]; - const GLfloat cy = from[1]; - const GLfloat cz = from[2]; - const GLfloat cw = from[3]; - GLubyte mask = 0; - if ( -cx + cw < 0 ) mask |= CLIP_RIGHT_BIT; - if ( cx + cw < 0 ) mask |= CLIP_LEFT_BIT; - if ( -cy + cw < 0 ) mask |= CLIP_TOP_BIT; - if ( cy + cw < 0 ) mask |= CLIP_BOTTOM_BIT; - if (viewport_z_clip) { - if ( -cz + cw < 0 ) mask |= CLIP_FAR_BIT; - if ( cz + cw < 0 ) mask |= CLIP_NEAR_BIT; - } - clipMask[i] = mask; - if ( mask ) { - c++; - tmpAndMask &= mask; - tmpOrMask |= mask; - vProj[i][0] = 0; - vProj[i][1] = 0; - vProj[i][2] = 0; - vProj[i][3] = 1; - } else { - GLfloat oow = 1.0F / cw; - vProj[i][0] = cx * oow; - vProj[i][1] = cy * oow; - vProj[i][2] = cz * oow; - vProj[i][3] = oow; - } - } - - *orMask = tmpOrMask; - *andMask = (GLubyte) (c < count ? 0 : tmpAndMask); - - proj_vec->flags |= VEC_SIZE_4; - proj_vec->size = 4; - proj_vec->count = clip_vec->count; - return proj_vec; -} - -/* Keep these here for now, even though we don't use them... - */ -static GLvector4f *ref_cliptest_points3( GLvector4f *clip_vec, - GLvector4f *proj_vec, - GLubyte clipMask[], - GLubyte *orMask, - GLubyte *andMask, - GLboolean viewport_z_clip ) -{ - const GLuint stride = clip_vec->stride; - const GLuint count = clip_vec->count; - const GLfloat *from = (GLfloat *)clip_vec->start; - - GLubyte tmpOrMask = *orMask; - GLubyte tmpAndMask = *andMask; - GLuint i; - for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) { - const GLfloat cx = from[0], cy = from[1], cz = from[2]; - GLubyte mask = 0; - if ( cx > 1.0 ) mask |= CLIP_RIGHT_BIT; - else if ( cx < -1.0 ) mask |= CLIP_LEFT_BIT; - if ( cy > 1.0 ) mask |= CLIP_TOP_BIT; - else if ( cy < -1.0 ) mask |= CLIP_BOTTOM_BIT; - if (viewport_z_clip) { - if ( cz > 1.0 ) mask |= CLIP_FAR_BIT; - else if ( cz < -1.0 ) mask |= CLIP_NEAR_BIT; - } - clipMask[i] = mask; - tmpOrMask |= mask; - tmpAndMask &= mask; - } - - *orMask = tmpOrMask; - *andMask = tmpAndMask; - return clip_vec; -} - -static GLvector4f * ref_cliptest_points2( GLvector4f *clip_vec, - GLvector4f *proj_vec, - GLubyte clipMask[], - GLubyte *orMask, - GLubyte *andMask, - GLboolean viewport_z_clip ) -{ - const GLuint stride = clip_vec->stride; - const GLuint count = clip_vec->count; - const GLfloat *from = (GLfloat *)clip_vec->start; - - GLubyte tmpOrMask = *orMask; - GLubyte tmpAndMask = *andMask; - GLuint i; - - (void) viewport_z_clip; - - for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) { - const GLfloat cx = from[0], cy = from[1]; - GLubyte mask = 0; - if ( cx > 1.0 ) mask |= CLIP_RIGHT_BIT; - else if ( cx < -1.0 ) mask |= CLIP_LEFT_BIT; - if ( cy > 1.0 ) mask |= CLIP_TOP_BIT; - else if ( cy < -1.0 ) mask |= CLIP_BOTTOM_BIT; - clipMask[i] = mask; - tmpOrMask |= mask; - tmpAndMask &= mask; - } - - *orMask = tmpOrMask; - *andMask = tmpAndMask; - return clip_vec; -} - -static clip_func ref_cliptest[5] = { - 0, - 0, - ref_cliptest_points2, - ref_cliptest_points3, - ref_cliptest_points4 -}; - - -/* ============================================================= - * Cliptest tests - */ - -ALIGN16(static GLfloat, s[TEST_COUNT][4]); -ALIGN16(static GLfloat, d[TEST_COUNT][4]); -ALIGN16(static GLfloat, r[TEST_COUNT][4]); - - -/** - * Check if X, Y or Z component of the coordinate is close to W, in terms - * of the clip test. - */ -static GLboolean -xyz_close_to_w(const GLfloat c[4]) -{ - float k = 0.0001; - return (fabs(c[0] - c[3]) < k || - fabs(c[1] - c[3]) < k || - fabs(c[2] - c[3]) < k || - fabs(-c[0] - c[3]) < k || - fabs(-c[1] - c[3]) < k || - fabs(-c[2] - c[3]) < k); -} - - - -static int test_cliptest_function( clip_func func, int np, - int psize, long *cycles ) -{ - GLvector4f source[1], dest[1], ref[1]; - GLubyte dm[TEST_COUNT], dco, dca; - GLubyte rm[TEST_COUNT], rco, rca; - int i, j; -#ifdef RUN_DEBUG_BENCHMARK - int cycle_i; /* the counter for the benchmarks we run */ -#endif - GLboolean viewport_z_clip = GL_TRUE; - - (void) cycles; - - if ( psize > 4 ) { - _mesa_problem( NULL, "test_cliptest_function called with psize > 4\n" ); - return 0; - } - - for ( i = 0 ; i < TEST_COUNT ; i++) { - ASSIGN_4V( d[i], 0.0, 0.0, 0.0, 1.0 ); - ASSIGN_4V( s[i], 0.0, 0.0, 0.0, 1.0 ); - for ( j = 0 ; j < psize ; j++ ) - s[i][j] = rnd(); - } - - source->data = (GLfloat(*)[4])s; - source->start = (GLfloat *)s; - source->count = TEST_COUNT; - source->stride = sizeof(s[0]); - source->size = 4; - source->flags = 0; - - dest->data = (GLfloat(*)[4])d; - dest->start = (GLfloat *)d; - dest->count = TEST_COUNT; - dest->stride = sizeof(float[4]); - dest->size = 0; - dest->flags = 0; - - ref->data = (GLfloat(*)[4])r; - ref->start = (GLfloat *)r; - ref->count = TEST_COUNT; - ref->stride = sizeof(float[4]); - ref->size = 0; - ref->flags = 0; - - dco = rco = 0; - dca = rca = CLIP_FRUSTUM_BITS; - - ref_cliptest[psize]( source, ref, rm, &rco, &rca, viewport_z_clip ); - - if ( mesa_profile ) { - BEGIN_RACE( *cycles ); - func( source, dest, dm, &dco, &dca, viewport_z_clip ); - END_RACE( *cycles ); - } - else { - func( source, dest, dm, &dco, &dca, viewport_z_clip ); - } - - if ( dco != rco ) { - printf( "\n-----------------------------\n" ); - printf( "dco = 0x%02x rco = 0x%02x\n", dco, rco ); - return 0; - } - if ( dca != rca ) { - printf( "\n-----------------------------\n" ); - printf( "dca = 0x%02x rca = 0x%02x\n", dca, rca ); - return 0; - } - for ( i = 0 ; i < TEST_COUNT ; i++ ) { - if ( dm[i] != rm[i] ) { - GLfloat *c = source->start; - STRIDE_F(c, source->stride * i); - if (psize == 4 && xyz_close_to_w(c)) { - /* The coordinate is very close to the clip plane. The clipmask - * may vary depending on code path, but that's OK. - */ - continue; - } - printf( "\n-----------------------------\n" ); - printf( "mask[%d] = 0x%02x ref mask[%d] = 0x%02x\n", i, dm[i], i,rm[i] ); - printf(" coord = %f, %f, %f, %f\n", - c[0], c[1], c[2], c[3]); - return 0; - } - } - - /* Only verify output on projected points4 case. FIXME: Do we need - * to test other cases? - */ - if ( np || psize < 4 ) - return 1; - - for ( i = 0 ; i < TEST_COUNT ; i++ ) { - for ( j = 0 ; j < 4 ; j++ ) { - if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { - printf( "\n-----------------------------\n" ); - printf( "(i = %i, j = %i) dm = 0x%02x rm = 0x%02x\n", - i, j, dm[i], rm[i] ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", - d[i][0], r[i][0], r[i][0]-d[i][0], - MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", - d[i][1], r[i][1], r[i][1]-d[i][1], - MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", - d[i][2], r[i][2], r[i][2]-d[i][2], - MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", - d[i][3], r[i][3], r[i][3]-d[i][3], - MAX_PRECISION - significand_match( d[i][3], r[i][3] ) ); - return 0; - } - } - } - - return 1; -} - -void _math_test_all_cliptest_functions( char *description ) -{ - int np, psize; - long benchmark_tab[2][4]; - static int first_time = 1; - - if ( first_time ) { - first_time = 0; - mesa_profile = _mesa_getenv( "MESA_PROFILE" ); - } - -#ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) { - if ( !counter_overhead ) { - INIT_COUNTER(); - printf( "counter overhead: %ld cycles\n\n", counter_overhead ); - } - printf( "cliptest results after hooking in %s functions:\n", description ); - } -#endif - -#ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) { - printf( "\n\t" ); - for ( psize = 2 ; psize <= 4 ; psize++ ) { - printf( " p%d\t", psize ); - } - printf( "\n--------------------------------------------------------\n\t" ); - } -#endif - - for ( np = 0 ; np < 2 ; np++ ) { - for ( psize = 2 ; psize <= 4 ; psize++ ) { - clip_func func = clip_tab[np][psize]; - long *cycles = &(benchmark_tab[np][psize-1]); - - if ( test_cliptest_function( func, np, psize, cycles ) == 0 ) { - char buf[100]; - sprintf( buf, "%s[%d] failed test (%s)", - cnames[np], psize, description ); - _mesa_problem( NULL, "%s", buf ); - } -#ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) - printf( " %li\t", benchmark_tab[np][psize-1] ); -#endif - } -#ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) - printf( " | [%s]\n\t", cstrings[np] ); -#endif - } -#ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) - printf( "\n" ); -#endif -} - - -#endif /* DEBUG_MATH */ +/* + * Mesa 3-D graphics library + * Version: 6.1 + * + * 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. + * + * Authors: + * Gareth Hughes + */ + +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/imports.h" + +#include "m_matrix.h" +#include "m_xform.h" + +#include "m_debug.h" +#include "m_debug_util.h" + +#ifdef __UNIXOS2__ +/* The linker doesn't like empty files */ +static char dummy; +#endif + +#ifdef DEBUG_MATH /* This code only used for debugging */ + +static clip_func *clip_tab[2] = { + _mesa_clip_tab, + _mesa_clip_np_tab +}; +static char *cnames[2] = { + "_mesa_clip_tab", + "_mesa_clip_np_tab" +}; +#ifdef RUN_DEBUG_BENCHMARK +static char *cstrings[2] = { + "clip, perspective divide", + "clip, no divide" +}; +#endif + + +/* ============================================================= + * Reference cliptests + */ + +static GLvector4f *ref_cliptest_points4( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask, + GLboolean viewport_z_clip ) +{ + const GLuint stride = clip_vec->stride; + const GLuint count = clip_vec->count; + const GLfloat *from = (GLfloat *)clip_vec->start; + GLuint c = 0; + GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start; + GLubyte tmpAndMask = *andMask; + GLubyte tmpOrMask = *orMask; + GLuint i; + for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) { + const GLfloat cx = from[0]; + const GLfloat cy = from[1]; + const GLfloat cz = from[2]; + const GLfloat cw = from[3]; + GLubyte mask = 0; + if ( -cx + cw < 0 ) mask |= CLIP_RIGHT_BIT; + if ( cx + cw < 0 ) mask |= CLIP_LEFT_BIT; + if ( -cy + cw < 0 ) mask |= CLIP_TOP_BIT; + if ( cy + cw < 0 ) mask |= CLIP_BOTTOM_BIT; + if (viewport_z_clip) { + if ( -cz + cw < 0 ) mask |= CLIP_FAR_BIT; + if ( cz + cw < 0 ) mask |= CLIP_NEAR_BIT; + } + clipMask[i] = mask; + if ( mask ) { + c++; + tmpAndMask &= mask; + tmpOrMask |= mask; + vProj[i][0] = 0; + vProj[i][1] = 0; + vProj[i][2] = 0; + vProj[i][3] = 1; + } else { + GLfloat oow = 1.0F / cw; + vProj[i][0] = cx * oow; + vProj[i][1] = cy * oow; + vProj[i][2] = cz * oow; + vProj[i][3] = oow; + } + } + + *orMask = tmpOrMask; + *andMask = (GLubyte) (c < count ? 0 : tmpAndMask); + + proj_vec->flags |= VEC_SIZE_4; + proj_vec->size = 4; + proj_vec->count = clip_vec->count; + return proj_vec; +} + +/* Keep these here for now, even though we don't use them... + */ +static GLvector4f *ref_cliptest_points3( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask, + GLboolean viewport_z_clip ) +{ + const GLuint stride = clip_vec->stride; + const GLuint count = clip_vec->count; + const GLfloat *from = (GLfloat *)clip_vec->start; + + GLubyte tmpOrMask = *orMask; + GLubyte tmpAndMask = *andMask; + GLuint i; + for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) { + const GLfloat cx = from[0], cy = from[1], cz = from[2]; + GLubyte mask = 0; + if ( cx > 1.0 ) mask |= CLIP_RIGHT_BIT; + else if ( cx < -1.0 ) mask |= CLIP_LEFT_BIT; + if ( cy > 1.0 ) mask |= CLIP_TOP_BIT; + else if ( cy < -1.0 ) mask |= CLIP_BOTTOM_BIT; + if (viewport_z_clip) { + if ( cz > 1.0 ) mask |= CLIP_FAR_BIT; + else if ( cz < -1.0 ) mask |= CLIP_NEAR_BIT; + } + clipMask[i] = mask; + tmpOrMask |= mask; + tmpAndMask &= mask; + } + + *orMask = tmpOrMask; + *andMask = tmpAndMask; + return clip_vec; +} + +static GLvector4f * ref_cliptest_points2( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask, + GLboolean viewport_z_clip ) +{ + const GLuint stride = clip_vec->stride; + const GLuint count = clip_vec->count; + const GLfloat *from = (GLfloat *)clip_vec->start; + + GLubyte tmpOrMask = *orMask; + GLubyte tmpAndMask = *andMask; + GLuint i; + + (void) viewport_z_clip; + + for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) { + const GLfloat cx = from[0], cy = from[1]; + GLubyte mask = 0; + if ( cx > 1.0 ) mask |= CLIP_RIGHT_BIT; + else if ( cx < -1.0 ) mask |= CLIP_LEFT_BIT; + if ( cy > 1.0 ) mask |= CLIP_TOP_BIT; + else if ( cy < -1.0 ) mask |= CLIP_BOTTOM_BIT; + clipMask[i] = mask; + tmpOrMask |= mask; + tmpAndMask &= mask; + } + + *orMask = tmpOrMask; + *andMask = tmpAndMask; + return clip_vec; +} + +static clip_func ref_cliptest[5] = { + 0, + 0, + ref_cliptest_points2, + ref_cliptest_points3, + ref_cliptest_points4 +}; + + +/* ============================================================= + * Cliptest tests + */ + +ALIGN16(static GLfloat, s[TEST_COUNT][4]); +ALIGN16(static GLfloat, d[TEST_COUNT][4]); +ALIGN16(static GLfloat, r[TEST_COUNT][4]); + + +/** + * Check if X, Y or Z component of the coordinate is close to W, in terms + * of the clip test. + */ +static GLboolean +xyz_close_to_w(const GLfloat c[4]) +{ + float k = 0.0001; + return (fabs(c[0] - c[3]) < k || + fabs(c[1] - c[3]) < k || + fabs(c[2] - c[3]) < k || + fabs(-c[0] - c[3]) < k || + fabs(-c[1] - c[3]) < k || + fabs(-c[2] - c[3]) < k); +} + + + +static int test_cliptest_function( clip_func func, int np, + int psize, long *cycles ) +{ + GLvector4f source[1], dest[1], ref[1]; + GLubyte dm[TEST_COUNT], dco, dca; + GLubyte rm[TEST_COUNT], rco, rca; + int i, j; +#ifdef RUN_DEBUG_BENCHMARK + int cycle_i; /* the counter for the benchmarks we run */ +#endif + GLboolean viewport_z_clip = GL_TRUE; + + (void) cycles; + + if ( psize > 4 ) { + _mesa_problem( NULL, "test_cliptest_function called with psize > 4\n" ); + return 0; + } + + for ( i = 0 ; i < TEST_COUNT ; i++) { + ASSIGN_4V( d[i], 0.0, 0.0, 0.0, 1.0 ); + ASSIGN_4V( s[i], 0.0, 0.0, 0.0, 1.0 ); + for ( j = 0 ; j < psize ; j++ ) + s[i][j] = rnd(); + } + + source->data = (GLfloat(*)[4])s; + source->start = (GLfloat *)s; + source->count = TEST_COUNT; + source->stride = sizeof(s[0]); + source->size = 4; + source->flags = 0; + + dest->data = (GLfloat(*)[4])d; + dest->start = (GLfloat *)d; + dest->count = TEST_COUNT; + dest->stride = sizeof(float[4]); + dest->size = 0; + dest->flags = 0; + + ref->data = (GLfloat(*)[4])r; + ref->start = (GLfloat *)r; + ref->count = TEST_COUNT; + ref->stride = sizeof(float[4]); + ref->size = 0; + ref->flags = 0; + + dco = rco = 0; + dca = rca = CLIP_FRUSTUM_BITS; + + ref_cliptest[psize]( source, ref, rm, &rco, &rca, viewport_z_clip ); + + if ( mesa_profile ) { + BEGIN_RACE( *cycles ); + func( source, dest, dm, &dco, &dca, viewport_z_clip ); + END_RACE( *cycles ); + } + else { + func( source, dest, dm, &dco, &dca, viewport_z_clip ); + } + + if ( dco != rco ) { + printf( "\n-----------------------------\n" ); + printf( "dco = 0x%02x rco = 0x%02x\n", dco, rco ); + return 0; + } + if ( dca != rca ) { + printf( "\n-----------------------------\n" ); + printf( "dca = 0x%02x rca = 0x%02x\n", dca, rca ); + return 0; + } + for ( i = 0 ; i < TEST_COUNT ; i++ ) { + if ( dm[i] != rm[i] ) { + GLfloat *c = source->start; + STRIDE_F(c, source->stride * i); + if (psize == 4 && xyz_close_to_w(c)) { + /* The coordinate is very close to the clip plane. The clipmask + * may vary depending on code path, but that's OK. + */ + continue; + } + printf( "\n-----------------------------\n" ); + printf( "mask[%d] = 0x%02x ref mask[%d] = 0x%02x\n", i, dm[i], i,rm[i] ); + printf(" coord = %f, %f, %f, %f\n", + c[0], c[1], c[2], c[3]); + return 0; + } + } + + /* Only verify output on projected points4 case. FIXME: Do we need + * to test other cases? + */ + if ( np || psize < 4 ) + return 1; + + for ( i = 0 ; i < TEST_COUNT ; i++ ) { + for ( j = 0 ; j < 4 ; j++ ) { + if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { + printf( "\n-----------------------------\n" ); + printf( "(i = %i, j = %i) dm = 0x%02x rm = 0x%02x\n", + i, j, dm[i], rm[i] ); + printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][0], r[i][0], r[i][0]-d[i][0], + MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); + printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][1], r[i][1], r[i][1]-d[i][1], + MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); + printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][2], r[i][2], r[i][2]-d[i][2], + MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); + printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][3], r[i][3], r[i][3]-d[i][3], + MAX_PRECISION - significand_match( d[i][3], r[i][3] ) ); + return 0; + } + } + } + + return 1; +} + +void _math_test_all_cliptest_functions( char *description ) +{ + int np, psize; + long benchmark_tab[2][4]; + static int first_time = 1; + + if ( first_time ) { + first_time = 0; + mesa_profile = _mesa_getenv( "MESA_PROFILE" ); + } + +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) { + if ( !counter_overhead ) { + INIT_COUNTER(); + printf( "counter overhead: %ld cycles\n\n", counter_overhead ); + } + printf( "cliptest results after hooking in %s functions:\n", description ); + } +#endif + +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) { + printf( "\n\t" ); + for ( psize = 2 ; psize <= 4 ; psize++ ) { + printf( " p%d\t", psize ); + } + printf( "\n--------------------------------------------------------\n\t" ); + } +#endif + + for ( np = 0 ; np < 2 ; np++ ) { + for ( psize = 2 ; psize <= 4 ; psize++ ) { + clip_func func = clip_tab[np][psize]; + long *cycles = &(benchmark_tab[np][psize-1]); + + if ( test_cliptest_function( func, np, psize, cycles ) == 0 ) { + char buf[100]; + sprintf( buf, "%s[%d] failed test (%s)", + cnames[np], psize, description ); + _mesa_problem( NULL, "%s", buf ); + } +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) + printf( " %li\t", benchmark_tab[np][psize-1] ); +#endif + } +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) + printf( " | [%s]\n\t", cstrings[np] ); +#endif + } +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) + printf( "\n" ); +#endif +} + + +#endif /* DEBUG_MATH */ diff --git a/mesalib/src/mesa/math/m_debug_norm.c b/mesalib/src/mesa/math/m_debug_norm.c index eae37c225..02eb1f989 100644 --- a/mesalib/src/mesa/math/m_debug_norm.c +++ b/mesalib/src/mesa/math/m_debug_norm.c @@ -1,383 +1,383 @@ - -/* - * 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: - * Gareth Hughes - */ - -#include "main/glheader.h" -#include "main/context.h" -#include "main/macros.h" -#include "main/imports.h" - -#include "m_matrix.h" -#include "m_xform.h" - -#include "m_debug.h" -#include "m_debug_util.h" - - -#ifdef __UNIXOS2__ -/* The linker doesn't like empty files */ -static char dummy; -#endif - -#ifdef DEBUG_MATH /* This code only used for debugging */ - - -static int m_norm_identity[16] = { - ONE, NIL, NIL, NIL, - NIL, ONE, NIL, NIL, - NIL, NIL, ONE, NIL, - NIL, NIL, NIL, NIL -}; -static int m_norm_general[16] = { - VAR, VAR, VAR, NIL, - VAR, VAR, VAR, NIL, - VAR, VAR, VAR, NIL, - NIL, NIL, NIL, NIL -}; -static int m_norm_no_rot[16] = { - VAR, NIL, NIL, NIL, - NIL, VAR, NIL, NIL, - NIL, NIL, VAR, NIL, - NIL, NIL, NIL, NIL -}; -static int *norm_templates[8] = { - m_norm_no_rot, - m_norm_no_rot, - m_norm_no_rot, - m_norm_general, - m_norm_general, - m_norm_general, - m_norm_identity, - m_norm_identity -}; -static int norm_types[8] = { - NORM_TRANSFORM_NO_ROT, - NORM_TRANSFORM_NO_ROT | NORM_RESCALE, - NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE, - NORM_TRANSFORM, - NORM_TRANSFORM | NORM_RESCALE, - NORM_TRANSFORM | NORM_NORMALIZE, - NORM_RESCALE, - NORM_NORMALIZE -}; -static int norm_scale_types[8] = { /* rescale factor */ - NIL, /* NIL disables rescaling */ - VAR, - NIL, - NIL, - VAR, - NIL, - VAR, - NIL -}; -static int norm_normalize_types[8] = { /* normalizing ?? (no = 0) */ - 0, - 0, - 1, - 0, - 0, - 1, - 0, - 1 -}; -static char *norm_strings[8] = { - "NORM_TRANSFORM_NO_ROT", - "NORM_TRANSFORM_NO_ROT | NORM_RESCALE", - "NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE", - "NORM_TRANSFORM", - "NORM_TRANSFORM | NORM_RESCALE", - "NORM_TRANSFORM | NORM_NORMALIZE", - "NORM_RESCALE", - "NORM_NORMALIZE" -}; - - -/* ============================================================= - * Reference transformations - */ - -static void ref_norm_transform_rescale( const GLmatrix *mat, - GLfloat scale, - const GLvector4f *in, - const GLfloat *lengths, - GLvector4f *dest ) -{ - GLuint i; - const GLfloat *s = in->start; - const GLfloat *m = mat->inv; - GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start; - - (void) lengths; - - for ( i = 0 ; i < in->count ; i++ ) { - GLfloat t[3]; - - TRANSFORM_NORMAL( t, s, m ); - SCALE_SCALAR_3V( out[i], scale, t ); - - s = (GLfloat *)((char *)s + in->stride); - } -} - -static void ref_norm_transform_normalize( const GLmatrix *mat, - GLfloat scale, - const GLvector4f *in, - const GLfloat *lengths, - GLvector4f *dest ) -{ - GLuint i; - const GLfloat *s = in->start; - const GLfloat *m = mat->inv; - GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start; - - for ( i = 0 ; i < in->count ; i++ ) { - GLfloat t[3]; - - TRANSFORM_NORMAL( t, s, m ); - - if ( !lengths ) { - GLfloat len = LEN_SQUARED_3FV( t ); - if ( len > 1e-20 ) { - /* Hmmm, don't know how we could test the precalculated - * length case... - */ - scale = 1.0 / SQRTF( len ); - SCALE_SCALAR_3V( out[i], scale, t ); - } else { - out[i][0] = out[i][1] = out[i][2] = 0; - } - } else { - scale = lengths[i];; - SCALE_SCALAR_3V( out[i], scale, t ); - } - - s = (GLfloat *)((char *)s + in->stride); - } -} - - -/* ============================================================= - * Normal transformation tests - */ - -static void init_matrix( GLfloat *m ) -{ - m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; - m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; - m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; - m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; -} - - -static int test_norm_function( normal_func func, int mtype, long *cycles ) -{ - GLvector4f source[1], dest[1], dest2[1], ref[1], ref2[1]; - GLmatrix mat[1]; - GLfloat s[TEST_COUNT][5], d[TEST_COUNT][4], r[TEST_COUNT][4]; - GLfloat d2[TEST_COUNT][4], r2[TEST_COUNT][4], length[TEST_COUNT]; - GLfloat scale; - GLfloat *m; - int i, j; -#ifdef RUN_DEBUG_BENCHMARK - int cycle_i; /* the counter for the benchmarks we run */ -#endif - - (void) cycles; - - mat->m = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 ); - mat->inv = m = mat->m; - - init_matrix( m ); - - scale = 1.0F + rnd () * norm_scale_types[mtype]; - - for ( i = 0 ; i < 4 ; i++ ) { - for ( j = 0 ; j < 4 ; j++ ) { - switch ( norm_templates[mtype][i * 4 + j] ) { - case NIL: - m[j * 4 + i] = 0.0; - break; - case ONE: - m[j * 4 + i] = 1.0; - break; - case NEG: - m[j * 4 + i] = -1.0; - break; - case VAR: - break; - default: - exit(1); - } - } - } - - for ( i = 0 ; i < TEST_COUNT ; i++ ) { - ASSIGN_3V( d[i], 0.0, 0.0, 0.0 ); - ASSIGN_3V( s[i], 0.0, 0.0, 0.0 ); - ASSIGN_3V( d2[i], 0.0, 0.0, 0.0 ); - for ( j = 0 ; j < 3 ; j++ ) - s[i][j] = rnd(); - length[i] = 1 / SQRTF( LEN_SQUARED_3FV( s[i] ) ); - } - - source->data = (GLfloat(*)[4]) s; - source->start = (GLfloat *) s; - source->count = TEST_COUNT; - source->stride = sizeof(s[0]); - source->flags = 0; - - dest->data = d; - dest->start = (GLfloat *) d; - dest->count = TEST_COUNT; - dest->stride = sizeof(float[4]); - dest->flags = 0; - - dest2->data = d2; - dest2->start = (GLfloat *) d2; - dest2->count = TEST_COUNT; - dest2->stride = sizeof(float[4]); - dest2->flags = 0; - - ref->data = r; - ref->start = (GLfloat *) r; - ref->count = TEST_COUNT; - ref->stride = sizeof(float[4]); - ref->flags = 0; - - ref2->data = r2; - ref2->start = (GLfloat *) r2; - ref2->count = TEST_COUNT; - ref2->stride = sizeof(float[4]); - ref2->flags = 0; - - if ( norm_normalize_types[mtype] == 0 ) { - ref_norm_transform_rescale( mat, scale, source, NULL, ref ); - } else { - ref_norm_transform_normalize( mat, scale, source, NULL, ref ); - ref_norm_transform_normalize( mat, scale, source, length, ref2 ); - } - - if ( mesa_profile ) { - BEGIN_RACE( *cycles ); - func( mat, scale, source, NULL, dest ); - END_RACE( *cycles ); - func( mat, scale, source, length, dest2 ); - } else { - func( mat, scale, source, NULL, dest ); - func( mat, scale, source, length, dest2 ); - } - - for ( i = 0 ; i < TEST_COUNT ; i++ ) { - for ( j = 0 ; j < 3 ; j++ ) { - if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { - printf( "-----------------------------\n" ); - printf( "(i = %i, j = %i)\n", i, j ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", - d[i][0], r[i][0], r[i][0]/d[i][0], - MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", - d[i][1], r[i][1], r[i][1]/d[i][1], - MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", - d[i][2], r[i][2], r[i][2]/d[i][2], - MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); - return 0; - } - - if ( norm_normalize_types[mtype] != 0 ) { - if ( significand_match( d2[i][j], r2[i][j] ) < REQUIRED_PRECISION ) { - printf( "------------------- precalculated length case ------\n" ); - printf( "(i = %i, j = %i)\n", i, j ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", - d2[i][0], r2[i][0], r2[i][0]/d2[i][0], - MAX_PRECISION - significand_match( d2[i][0], r2[i][0] ) ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", - d2[i][1], r2[i][1], r2[i][1]/d2[i][1], - MAX_PRECISION - significand_match( d2[i][1], r2[i][1] ) ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", - d2[i][2], r2[i][2], r2[i][2]/d2[i][2], - MAX_PRECISION - significand_match( d2[i][2], r2[i][2] ) ); - return 0; - } - } - } - } - - _mesa_align_free( mat->m ); - return 1; -} - -void _math_test_all_normal_transform_functions( char *description ) -{ - int mtype; - long benchmark_tab[0xf]; - static int first_time = 1; - - if ( first_time ) { - first_time = 0; - mesa_profile = _mesa_getenv( "MESA_PROFILE" ); - } - -#ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) { - if ( !counter_overhead ) { - INIT_COUNTER(); - printf( "counter overhead: %ld cycles\n\n", counter_overhead ); - } - printf( "normal transform results after hooking in %s functions:\n", - description ); - printf( "\n-------------------------------------------------------\n" ); - } -#endif - - for ( mtype = 0 ; mtype < 8 ; mtype++ ) { - normal_func func = _mesa_normal_tab[norm_types[mtype]]; - long *cycles = &benchmark_tab[mtype]; - - if ( test_norm_function( func, mtype, cycles ) == 0 ) { - char buf[100]; - sprintf( buf, "_mesa_normal_tab[0][%s] failed test (%s)", - norm_strings[mtype], description ); - _mesa_problem( NULL, "%s", buf ); - } - -#ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) { - printf( " %li\t", benchmark_tab[mtype] ); - printf( " | [%s]\n", norm_strings[mtype] ); - } -#endif - } -#ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) { - printf( "\n" ); - } -#endif -} - - -#endif /* DEBUG_MATH */ + +/* + * 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: + * Gareth Hughes + */ + +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/imports.h" + +#include "m_matrix.h" +#include "m_xform.h" + +#include "m_debug.h" +#include "m_debug_util.h" + + +#ifdef __UNIXOS2__ +/* The linker doesn't like empty files */ +static char dummy; +#endif + +#ifdef DEBUG_MATH /* This code only used for debugging */ + + +static int m_norm_identity[16] = { + ONE, NIL, NIL, NIL, + NIL, ONE, NIL, NIL, + NIL, NIL, ONE, NIL, + NIL, NIL, NIL, NIL +}; +static int m_norm_general[16] = { + VAR, VAR, VAR, NIL, + VAR, VAR, VAR, NIL, + VAR, VAR, VAR, NIL, + NIL, NIL, NIL, NIL +}; +static int m_norm_no_rot[16] = { + VAR, NIL, NIL, NIL, + NIL, VAR, NIL, NIL, + NIL, NIL, VAR, NIL, + NIL, NIL, NIL, NIL +}; +static int *norm_templates[8] = { + m_norm_no_rot, + m_norm_no_rot, + m_norm_no_rot, + m_norm_general, + m_norm_general, + m_norm_general, + m_norm_identity, + m_norm_identity +}; +static int norm_types[8] = { + NORM_TRANSFORM_NO_ROT, + NORM_TRANSFORM_NO_ROT | NORM_RESCALE, + NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE, + NORM_TRANSFORM, + NORM_TRANSFORM | NORM_RESCALE, + NORM_TRANSFORM | NORM_NORMALIZE, + NORM_RESCALE, + NORM_NORMALIZE +}; +static int norm_scale_types[8] = { /* rescale factor */ + NIL, /* NIL disables rescaling */ + VAR, + NIL, + NIL, + VAR, + NIL, + VAR, + NIL +}; +static int norm_normalize_types[8] = { /* normalizing ?? (no = 0) */ + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1 +}; +static char *norm_strings[8] = { + "NORM_TRANSFORM_NO_ROT", + "NORM_TRANSFORM_NO_ROT | NORM_RESCALE", + "NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE", + "NORM_TRANSFORM", + "NORM_TRANSFORM | NORM_RESCALE", + "NORM_TRANSFORM | NORM_NORMALIZE", + "NORM_RESCALE", + "NORM_NORMALIZE" +}; + + +/* ============================================================= + * Reference transformations + */ + +static void ref_norm_transform_rescale( const GLmatrix *mat, + GLfloat scale, + const GLvector4f *in, + const GLfloat *lengths, + GLvector4f *dest ) +{ + GLuint i; + const GLfloat *s = in->start; + const GLfloat *m = mat->inv; + GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start; + + (void) lengths; + + for ( i = 0 ; i < in->count ; i++ ) { + GLfloat t[3]; + + TRANSFORM_NORMAL( t, s, m ); + SCALE_SCALAR_3V( out[i], scale, t ); + + s = (GLfloat *)((char *)s + in->stride); + } +} + +static void ref_norm_transform_normalize( const GLmatrix *mat, + GLfloat scale, + const GLvector4f *in, + const GLfloat *lengths, + GLvector4f *dest ) +{ + GLuint i; + const GLfloat *s = in->start; + const GLfloat *m = mat->inv; + GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start; + + for ( i = 0 ; i < in->count ; i++ ) { + GLfloat t[3]; + + TRANSFORM_NORMAL( t, s, m ); + + if ( !lengths ) { + GLfloat len = LEN_SQUARED_3FV( t ); + if ( len > 1e-20 ) { + /* Hmmm, don't know how we could test the precalculated + * length case... + */ + scale = 1.0 / SQRTF( len ); + SCALE_SCALAR_3V( out[i], scale, t ); + } else { + out[i][0] = out[i][1] = out[i][2] = 0; + } + } else { + scale = lengths[i];; + SCALE_SCALAR_3V( out[i], scale, t ); + } + + s = (GLfloat *)((char *)s + in->stride); + } +} + + +/* ============================================================= + * Normal transformation tests + */ + +static void init_matrix( GLfloat *m ) +{ + m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; + m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; + m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; + m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; +} + + +static int test_norm_function( normal_func func, int mtype, long *cycles ) +{ + GLvector4f source[1], dest[1], dest2[1], ref[1], ref2[1]; + GLmatrix mat[1]; + GLfloat s[TEST_COUNT][5], d[TEST_COUNT][4], r[TEST_COUNT][4]; + GLfloat d2[TEST_COUNT][4], r2[TEST_COUNT][4], length[TEST_COUNT]; + GLfloat scale; + GLfloat *m; + int i, j; +#ifdef RUN_DEBUG_BENCHMARK + int cycle_i; /* the counter for the benchmarks we run */ +#endif + + (void) cycles; + + mat->m = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 ); + mat->inv = m = mat->m; + + init_matrix( m ); + + scale = 1.0F + rnd () * norm_scale_types[mtype]; + + for ( i = 0 ; i < 4 ; i++ ) { + for ( j = 0 ; j < 4 ; j++ ) { + switch ( norm_templates[mtype][i * 4 + j] ) { + case NIL: + m[j * 4 + i] = 0.0; + break; + case ONE: + m[j * 4 + i] = 1.0; + break; + case NEG: + m[j * 4 + i] = -1.0; + break; + case VAR: + break; + default: + exit(1); + } + } + } + + for ( i = 0 ; i < TEST_COUNT ; i++ ) { + ASSIGN_3V( d[i], 0.0, 0.0, 0.0 ); + ASSIGN_3V( s[i], 0.0, 0.0, 0.0 ); + ASSIGN_3V( d2[i], 0.0, 0.0, 0.0 ); + for ( j = 0 ; j < 3 ; j++ ) + s[i][j] = rnd(); + length[i] = 1 / SQRTF( LEN_SQUARED_3FV( s[i] ) ); + } + + source->data = (GLfloat(*)[4]) s; + source->start = (GLfloat *) s; + source->count = TEST_COUNT; + source->stride = sizeof(s[0]); + source->flags = 0; + + dest->data = d; + dest->start = (GLfloat *) d; + dest->count = TEST_COUNT; + dest->stride = sizeof(float[4]); + dest->flags = 0; + + dest2->data = d2; + dest2->start = (GLfloat *) d2; + dest2->count = TEST_COUNT; + dest2->stride = sizeof(float[4]); + dest2->flags = 0; + + ref->data = r; + ref->start = (GLfloat *) r; + ref->count = TEST_COUNT; + ref->stride = sizeof(float[4]); + ref->flags = 0; + + ref2->data = r2; + ref2->start = (GLfloat *) r2; + ref2->count = TEST_COUNT; + ref2->stride = sizeof(float[4]); + ref2->flags = 0; + + if ( norm_normalize_types[mtype] == 0 ) { + ref_norm_transform_rescale( mat, scale, source, NULL, ref ); + } else { + ref_norm_transform_normalize( mat, scale, source, NULL, ref ); + ref_norm_transform_normalize( mat, scale, source, length, ref2 ); + } + + if ( mesa_profile ) { + BEGIN_RACE( *cycles ); + func( mat, scale, source, NULL, dest ); + END_RACE( *cycles ); + func( mat, scale, source, length, dest2 ); + } else { + func( mat, scale, source, NULL, dest ); + func( mat, scale, source, length, dest2 ); + } + + for ( i = 0 ; i < TEST_COUNT ; i++ ) { + for ( j = 0 ; j < 3 ; j++ ) { + if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { + printf( "-----------------------------\n" ); + printf( "(i = %i, j = %i)\n", i, j ); + printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + d[i][0], r[i][0], r[i][0]/d[i][0], + MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); + printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + d[i][1], r[i][1], r[i][1]/d[i][1], + MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); + printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + d[i][2], r[i][2], r[i][2]/d[i][2], + MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); + return 0; + } + + if ( norm_normalize_types[mtype] != 0 ) { + if ( significand_match( d2[i][j], r2[i][j] ) < REQUIRED_PRECISION ) { + printf( "------------------- precalculated length case ------\n" ); + printf( "(i = %i, j = %i)\n", i, j ); + printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + d2[i][0], r2[i][0], r2[i][0]/d2[i][0], + MAX_PRECISION - significand_match( d2[i][0], r2[i][0] ) ); + printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + d2[i][1], r2[i][1], r2[i][1]/d2[i][1], + MAX_PRECISION - significand_match( d2[i][1], r2[i][1] ) ); + printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + d2[i][2], r2[i][2], r2[i][2]/d2[i][2], + MAX_PRECISION - significand_match( d2[i][2], r2[i][2] ) ); + return 0; + } + } + } + } + + _mesa_align_free( mat->m ); + return 1; +} + +void _math_test_all_normal_transform_functions( char *description ) +{ + int mtype; + long benchmark_tab[0xf]; + static int first_time = 1; + + if ( first_time ) { + first_time = 0; + mesa_profile = _mesa_getenv( "MESA_PROFILE" ); + } + +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) { + if ( !counter_overhead ) { + INIT_COUNTER(); + printf( "counter overhead: %ld cycles\n\n", counter_overhead ); + } + printf( "normal transform results after hooking in %s functions:\n", + description ); + printf( "\n-------------------------------------------------------\n" ); + } +#endif + + for ( mtype = 0 ; mtype < 8 ; mtype++ ) { + normal_func func = _mesa_normal_tab[norm_types[mtype]]; + long *cycles = &benchmark_tab[mtype]; + + if ( test_norm_function( func, mtype, cycles ) == 0 ) { + char buf[100]; + sprintf( buf, "_mesa_normal_tab[0][%s] failed test (%s)", + norm_strings[mtype], description ); + _mesa_problem( NULL, "%s", buf ); + } + +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) { + printf( " %li\t", benchmark_tab[mtype] ); + printf( " | [%s]\n", norm_strings[mtype] ); + } +#endif + } +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) { + printf( "\n" ); + } +#endif +} + + +#endif /* DEBUG_MATH */ diff --git a/mesalib/src/mesa/math/m_debug_xform.c b/mesalib/src/mesa/math/m_debug_xform.c index 0de43195c..7d815664a 100644 --- a/mesalib/src/mesa/math/m_debug_xform.c +++ b/mesalib/src/mesa/math/m_debug_xform.c @@ -1,339 +1,339 @@ -/* - * 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. - */ - -/* - * Updated for P6 architecture by Gareth Hughes. - */ - -#include "main/glheader.h" -#include "main/context.h" -#include "main/macros.h" -#include "main/imports.h" - -#include "m_matrix.h" -#include "m_xform.h" - -#include "m_debug.h" -#include "m_debug_util.h" - -#ifdef __UNIXOS2__ -/* The linker doesn't like empty files */ -static char dummy; -#endif - -#ifdef DEBUG_MATH /* This code only used for debugging */ - - -/* Overhead of profiling counter in cycles. Automatically adjusted to - * your machine at run time - counter initialization should give very - * consistent results. - */ -long counter_overhead = 0; - -/* This is the value of the environment variable MESA_PROFILE, and is - * used to determine if we should benchmark the functions as well as - * verify their correctness. - */ -char *mesa_profile = NULL; - - -static int m_general[16] = { - VAR, VAR, VAR, VAR, - VAR, VAR, VAR, VAR, - VAR, VAR, VAR, VAR, - VAR, VAR, VAR, VAR -}; -static int m_identity[16] = { - ONE, NIL, NIL, NIL, - NIL, ONE, NIL, NIL, - NIL, NIL, ONE, NIL, - NIL, NIL, NIL, ONE -}; -static int m_2d[16] = { - VAR, VAR, NIL, VAR, - VAR, VAR, NIL, VAR, - NIL, NIL, ONE, NIL, - NIL, NIL, NIL, ONE -}; -static int m_2d_no_rot[16] = { - VAR, NIL, NIL, VAR, - NIL, VAR, NIL, VAR, - NIL, NIL, ONE, NIL, - NIL, NIL, NIL, ONE -}; -static int m_3d[16] = { - VAR, VAR, VAR, VAR, - VAR, VAR, VAR, VAR, - VAR, VAR, VAR, VAR, - NIL, NIL, NIL, ONE -}; -static int m_3d_no_rot[16] = { - VAR, NIL, NIL, VAR, - NIL, VAR, NIL, VAR, - NIL, NIL, VAR, VAR, - NIL, NIL, NIL, ONE -}; -static int m_perspective[16] = { - VAR, NIL, VAR, NIL, - NIL, VAR, VAR, NIL, - NIL, NIL, VAR, VAR, - NIL, NIL, NEG, NIL -}; -static int *templates[7] = { - m_general, - m_identity, - m_3d_no_rot, - m_perspective, - m_2d, - m_2d_no_rot, - m_3d -}; -static enum GLmatrixtype mtypes[7] = { - MATRIX_GENERAL, - MATRIX_IDENTITY, - MATRIX_3D_NO_ROT, - MATRIX_PERSPECTIVE, - MATRIX_2D, - MATRIX_2D_NO_ROT, - MATRIX_3D -}; -static char *mstrings[7] = { - "MATRIX_GENERAL", - "MATRIX_IDENTITY", - "MATRIX_3D_NO_ROT", - "MATRIX_PERSPECTIVE", - "MATRIX_2D", - "MATRIX_2D_NO_ROT", - "MATRIX_3D" -}; - - -/* ============================================================= - * Reference transformations - */ - -static void ref_transform( GLvector4f *dst, - const GLmatrix *mat, - const GLvector4f *src ) -{ - GLuint i; - GLfloat *s = (GLfloat *)src->start; - GLfloat (*d)[4] = (GLfloat (*)[4])dst->start; - const GLfloat *m = mat->m; - - for ( i = 0 ; i < src->count ; i++ ) { - TRANSFORM_POINT( d[i], m, s ); - s = (GLfloat *)((char *)s + src->stride); - } -} - - -/* ============================================================= - * Vertex transformation tests - */ - -static void init_matrix( GLfloat *m ) -{ - m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; - m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; - m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; - m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; -} - -ALIGN16(static GLfloat, s[TEST_COUNT][4]); -ALIGN16(static GLfloat, d[TEST_COUNT][4]); -ALIGN16(static GLfloat, r[TEST_COUNT][4]); - -static int test_transform_function( transform_func func, int psize, - int mtype, unsigned long *cycles ) -{ - GLvector4f source[1], dest[1], ref[1]; - GLmatrix mat[1]; - GLfloat *m; - int i, j; -#ifdef RUN_DEBUG_BENCHMARK - int cycle_i; /* the counter for the benchmarks we run */ -#endif - - (void) cycles; - - if ( psize > 4 ) { - _mesa_problem( NULL, "test_transform_function called with psize > 4\n" ); - return 0; - } - - mat->m = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 ); - mat->type = mtypes[mtype]; - - m = mat->m; - ASSERT( ((long)m & 15) == 0 ); - - init_matrix( m ); - - for ( i = 0 ; i < 4 ; i++ ) { - for ( j = 0 ; j < 4 ; j++ ) { - switch ( templates[mtype][i * 4 + j] ) { - case NIL: - m[j * 4 + i] = 0.0; - break; - case ONE: - m[j * 4 + i] = 1.0; - break; - case NEG: - m[j * 4 + i] = -1.0; - break; - case VAR: - break; - default: - ASSERT(0); - return 0; - } - } - } - - for ( i = 0 ; i < TEST_COUNT ; i++) { - ASSIGN_4V( d[i], 0.0, 0.0, 0.0, 1.0 ); - ASSIGN_4V( s[i], 0.0, 0.0, 0.0, 1.0 ); - for ( j = 0 ; j < psize ; j++ ) - s[i][j] = rnd(); - } - - source->data = (GLfloat(*)[4])s; - source->start = (GLfloat *)s; - source->count = TEST_COUNT; - source->stride = sizeof(s[0]); - source->size = 4; - source->flags = 0; - - dest->data = (GLfloat(*)[4])d; - dest->start = (GLfloat *)d; - dest->count = TEST_COUNT; - dest->stride = sizeof(float[4]); - dest->size = 0; - dest->flags = 0; - - ref->data = (GLfloat(*)[4])r; - ref->start = (GLfloat *)r; - ref->count = TEST_COUNT; - ref->stride = sizeof(float[4]); - ref->size = 0; - ref->flags = 0; - - ref_transform( ref, mat, source ); - - if ( mesa_profile ) { - BEGIN_RACE( *cycles ); - func( dest, mat->m, source ); - END_RACE( *cycles ); - } - else { - func( dest, mat->m, source ); - } - - for ( i = 0 ; i < TEST_COUNT ; i++ ) { - for ( j = 0 ; j < 4 ; j++ ) { - if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { - printf("-----------------------------\n" ); - printf("(i = %i, j = %i)\n", i, j ); - printf("%f \t %f \t [diff = %e - %i bit missed]\n", - d[i][0], r[i][0], r[i][0]-d[i][0], - MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); - printf("%f \t %f \t [diff = %e - %i bit missed]\n", - d[i][1], r[i][1], r[i][1]-d[i][1], - MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); - printf("%f \t %f \t [diff = %e - %i bit missed]\n", - d[i][2], r[i][2], r[i][2]-d[i][2], - MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); - printf("%f \t %f \t [diff = %e - %i bit missed]\n", - d[i][3], r[i][3], r[i][3]-d[i][3], - MAX_PRECISION - significand_match( d[i][3], r[i][3] ) ); - return 0; - } - } - } - - _mesa_align_free( mat->m ); - return 1; -} - -void _math_test_all_transform_functions( char *description ) -{ - int psize, mtype; - unsigned long benchmark_tab[4][7]; - static int first_time = 1; - - if ( first_time ) { - first_time = 0; - mesa_profile = _mesa_getenv( "MESA_PROFILE" ); - } - -#ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) { - if ( !counter_overhead ) { - INIT_COUNTER(); - printf("counter overhead: %lu cycles\n\n", counter_overhead ); - } - printf("transform results after hooking in %s functions:\n", description ); - } -#endif - -#ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) { - printf("\n" ); - for ( psize = 1 ; psize <= 4 ; psize++ ) { - printf(" p%d\t", psize ); - } - printf("\n--------------------------------------------------------\n" ); - } -#endif - - for ( mtype = 0 ; mtype < 7 ; mtype++ ) { - for ( psize = 1 ; psize <= 4 ; psize++ ) { - transform_func func = _mesa_transform_tab[psize][mtypes[mtype]]; - unsigned long *cycles = &(benchmark_tab[psize-1][mtype]); - - if ( test_transform_function( func, psize, mtype, cycles ) == 0 ) { - char buf[100]; - sprintf(buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)", - psize, mstrings[mtype], description ); - _mesa_problem( NULL, "%s", buf ); - } -#ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) - printf(" %li\t", benchmark_tab[psize-1][mtype] ); -#endif - } -#ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) - printf(" | [%s]\n", mstrings[mtype] ); -#endif - } -#ifdef RUN_DEBUG_BENCHMARK - if ( mesa_profile ) - printf( "\n" ); -#endif -} - - -#endif /* DEBUG_MATH */ +/* + * 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. + */ + +/* + * Updated for P6 architecture by Gareth Hughes. + */ + +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/imports.h" + +#include "m_matrix.h" +#include "m_xform.h" + +#include "m_debug.h" +#include "m_debug_util.h" + +#ifdef __UNIXOS2__ +/* The linker doesn't like empty files */ +static char dummy; +#endif + +#ifdef DEBUG_MATH /* This code only used for debugging */ + + +/* Overhead of profiling counter in cycles. Automatically adjusted to + * your machine at run time - counter initialization should give very + * consistent results. + */ +long counter_overhead = 0; + +/* This is the value of the environment variable MESA_PROFILE, and is + * used to determine if we should benchmark the functions as well as + * verify their correctness. + */ +char *mesa_profile = NULL; + + +static int m_general[16] = { + VAR, VAR, VAR, VAR, + VAR, VAR, VAR, VAR, + VAR, VAR, VAR, VAR, + VAR, VAR, VAR, VAR +}; +static int m_identity[16] = { + ONE, NIL, NIL, NIL, + NIL, ONE, NIL, NIL, + NIL, NIL, ONE, NIL, + NIL, NIL, NIL, ONE +}; +static int m_2d[16] = { + VAR, VAR, NIL, VAR, + VAR, VAR, NIL, VAR, + NIL, NIL, ONE, NIL, + NIL, NIL, NIL, ONE +}; +static int m_2d_no_rot[16] = { + VAR, NIL, NIL, VAR, + NIL, VAR, NIL, VAR, + NIL, NIL, ONE, NIL, + NIL, NIL, NIL, ONE +}; +static int m_3d[16] = { + VAR, VAR, VAR, VAR, + VAR, VAR, VAR, VAR, + VAR, VAR, VAR, VAR, + NIL, NIL, NIL, ONE +}; +static int m_3d_no_rot[16] = { + VAR, NIL, NIL, VAR, + NIL, VAR, NIL, VAR, + NIL, NIL, VAR, VAR, + NIL, NIL, NIL, ONE +}; +static int m_perspective[16] = { + VAR, NIL, VAR, NIL, + NIL, VAR, VAR, NIL, + NIL, NIL, VAR, VAR, + NIL, NIL, NEG, NIL +}; +static int *templates[7] = { + m_general, + m_identity, + m_3d_no_rot, + m_perspective, + m_2d, + m_2d_no_rot, + m_3d +}; +static enum GLmatrixtype mtypes[7] = { + MATRIX_GENERAL, + MATRIX_IDENTITY, + MATRIX_3D_NO_ROT, + MATRIX_PERSPECTIVE, + MATRIX_2D, + MATRIX_2D_NO_ROT, + MATRIX_3D +}; +static char *mstrings[7] = { + "MATRIX_GENERAL", + "MATRIX_IDENTITY", + "MATRIX_3D_NO_ROT", + "MATRIX_PERSPECTIVE", + "MATRIX_2D", + "MATRIX_2D_NO_ROT", + "MATRIX_3D" +}; + + +/* ============================================================= + * Reference transformations + */ + +static void ref_transform( GLvector4f *dst, + const GLmatrix *mat, + const GLvector4f *src ) +{ + GLuint i; + GLfloat *s = (GLfloat *)src->start; + GLfloat (*d)[4] = (GLfloat (*)[4])dst->start; + const GLfloat *m = mat->m; + + for ( i = 0 ; i < src->count ; i++ ) { + TRANSFORM_POINT( d[i], m, s ); + s = (GLfloat *)((char *)s + src->stride); + } +} + + +/* ============================================================= + * Vertex transformation tests + */ + +static void init_matrix( GLfloat *m ) +{ + m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; + m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; + m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; + m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; +} + +ALIGN16(static GLfloat, s[TEST_COUNT][4]); +ALIGN16(static GLfloat, d[TEST_COUNT][4]); +ALIGN16(static GLfloat, r[TEST_COUNT][4]); + +static int test_transform_function( transform_func func, int psize, + int mtype, unsigned long *cycles ) +{ + GLvector4f source[1], dest[1], ref[1]; + GLmatrix mat[1]; + GLfloat *m; + int i, j; +#ifdef RUN_DEBUG_BENCHMARK + int cycle_i; /* the counter for the benchmarks we run */ +#endif + + (void) cycles; + + if ( psize > 4 ) { + _mesa_problem( NULL, "test_transform_function called with psize > 4\n" ); + return 0; + } + + mat->m = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 ); + mat->type = mtypes[mtype]; + + m = mat->m; + ASSERT( ((long)m & 15) == 0 ); + + init_matrix( m ); + + for ( i = 0 ; i < 4 ; i++ ) { + for ( j = 0 ; j < 4 ; j++ ) { + switch ( templates[mtype][i * 4 + j] ) { + case NIL: + m[j * 4 + i] = 0.0; + break; + case ONE: + m[j * 4 + i] = 1.0; + break; + case NEG: + m[j * 4 + i] = -1.0; + break; + case VAR: + break; + default: + ASSERT(0); + return 0; + } + } + } + + for ( i = 0 ; i < TEST_COUNT ; i++) { + ASSIGN_4V( d[i], 0.0, 0.0, 0.0, 1.0 ); + ASSIGN_4V( s[i], 0.0, 0.0, 0.0, 1.0 ); + for ( j = 0 ; j < psize ; j++ ) + s[i][j] = rnd(); + } + + source->data = (GLfloat(*)[4])s; + source->start = (GLfloat *)s; + source->count = TEST_COUNT; + source->stride = sizeof(s[0]); + source->size = 4; + source->flags = 0; + + dest->data = (GLfloat(*)[4])d; + dest->start = (GLfloat *)d; + dest->count = TEST_COUNT; + dest->stride = sizeof(float[4]); + dest->size = 0; + dest->flags = 0; + + ref->data = (GLfloat(*)[4])r; + ref->start = (GLfloat *)r; + ref->count = TEST_COUNT; + ref->stride = sizeof(float[4]); + ref->size = 0; + ref->flags = 0; + + ref_transform( ref, mat, source ); + + if ( mesa_profile ) { + BEGIN_RACE( *cycles ); + func( dest, mat->m, source ); + END_RACE( *cycles ); + } + else { + func( dest, mat->m, source ); + } + + for ( i = 0 ; i < TEST_COUNT ; i++ ) { + for ( j = 0 ; j < 4 ; j++ ) { + if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { + printf("-----------------------------\n" ); + printf("(i = %i, j = %i)\n", i, j ); + printf("%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][0], r[i][0], r[i][0]-d[i][0], + MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); + printf("%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][1], r[i][1], r[i][1]-d[i][1], + MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); + printf("%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][2], r[i][2], r[i][2]-d[i][2], + MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); + printf("%f \t %f \t [diff = %e - %i bit missed]\n", + d[i][3], r[i][3], r[i][3]-d[i][3], + MAX_PRECISION - significand_match( d[i][3], r[i][3] ) ); + return 0; + } + } + } + + _mesa_align_free( mat->m ); + return 1; +} + +void _math_test_all_transform_functions( char *description ) +{ + int psize, mtype; + unsigned long benchmark_tab[4][7]; + static int first_time = 1; + + if ( first_time ) { + first_time = 0; + mesa_profile = _mesa_getenv( "MESA_PROFILE" ); + } + +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) { + if ( !counter_overhead ) { + INIT_COUNTER(); + printf("counter overhead: %lu cycles\n\n", counter_overhead ); + } + printf("transform results after hooking in %s functions:\n", description ); + } +#endif + +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) { + printf("\n" ); + for ( psize = 1 ; psize <= 4 ; psize++ ) { + printf(" p%d\t", psize ); + } + printf("\n--------------------------------------------------------\n" ); + } +#endif + + for ( mtype = 0 ; mtype < 7 ; mtype++ ) { + for ( psize = 1 ; psize <= 4 ; psize++ ) { + transform_func func = _mesa_transform_tab[psize][mtypes[mtype]]; + unsigned long *cycles = &(benchmark_tab[psize-1][mtype]); + + if ( test_transform_function( func, psize, mtype, cycles ) == 0 ) { + char buf[100]; + sprintf(buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)", + psize, mstrings[mtype], description ); + _mesa_problem( NULL, "%s", buf ); + } +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) + printf(" %li\t", benchmark_tab[psize-1][mtype] ); +#endif + } +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) + printf(" | [%s]\n", mstrings[mtype] ); +#endif + } +#ifdef RUN_DEBUG_BENCHMARK + if ( mesa_profile ) + printf( "\n" ); +#endif +} + + +#endif /* DEBUG_MATH */ diff --git a/mesalib/src/mesa/math/m_matrix.c b/mesalib/src/mesa/math/m_matrix.c index 83eb787c7..02aedbad8 100644 --- a/mesalib/src/mesa/math/m_matrix.c +++ b/mesalib/src/mesa/math/m_matrix.c @@ -1,1641 +1,1641 @@ -/* - * 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. - */ - - -/** - * \file m_matrix.c - * Matrix operations. - * - * \note - * -# 4x4 transformation matrices are stored in memory in column major order. - * -# Points/vertices are to be thought of as column vectors. - * -# Transformation of a point p by a matrix M is: p' = M * p - */ - - -#include "main/glheader.h" -#include "main/imports.h" -#include "main/macros.h" - -#include "m_matrix.h" - - -/** - * \defgroup MatFlags MAT_FLAG_XXX-flags - * - * Bitmasks to indicate different kinds of 4x4 matrices in GLmatrix::flags - * It would be nice to make all these flags private to m_matrix.c - */ -/*@{*/ -#define MAT_FLAG_IDENTITY 0 /**< is an identity matrix flag. - * (Not actually used - the identity - * matrix is identified by the absense - * of all other flags.) - */ -#define MAT_FLAG_GENERAL 0x1 /**< is a general matrix flag */ -#define MAT_FLAG_ROTATION 0x2 /**< is a rotation matrix flag */ -#define MAT_FLAG_TRANSLATION 0x4 /**< is a translation matrix flag */ -#define MAT_FLAG_UNIFORM_SCALE 0x8 /**< is an uniform scaling matrix flag */ -#define MAT_FLAG_GENERAL_SCALE 0x10 /**< is a general scaling matrix flag */ -#define MAT_FLAG_GENERAL_3D 0x20 /**< general 3D matrix flag */ -#define MAT_FLAG_PERSPECTIVE 0x40 /**< is a perspective proj matrix flag */ -#define MAT_FLAG_SINGULAR 0x80 /**< is a singular matrix flag */ -#define MAT_DIRTY_TYPE 0x100 /**< matrix type is dirty */ -#define MAT_DIRTY_FLAGS 0x200 /**< matrix flags are dirty */ -#define MAT_DIRTY_INVERSE 0x400 /**< matrix inverse is dirty */ - -/** angle preserving matrix flags mask */ -#define MAT_FLAGS_ANGLE_PRESERVING (MAT_FLAG_ROTATION | \ - MAT_FLAG_TRANSLATION | \ - MAT_FLAG_UNIFORM_SCALE) - -/** geometry related matrix flags mask */ -#define MAT_FLAGS_GEOMETRY (MAT_FLAG_GENERAL | \ - MAT_FLAG_ROTATION | \ - MAT_FLAG_TRANSLATION | \ - MAT_FLAG_UNIFORM_SCALE | \ - MAT_FLAG_GENERAL_SCALE | \ - MAT_FLAG_GENERAL_3D | \ - MAT_FLAG_PERSPECTIVE | \ - MAT_FLAG_SINGULAR) - -/** length preserving matrix flags mask */ -#define MAT_FLAGS_LENGTH_PRESERVING (MAT_FLAG_ROTATION | \ - MAT_FLAG_TRANSLATION) - - -/** 3D (non-perspective) matrix flags mask */ -#define MAT_FLAGS_3D (MAT_FLAG_ROTATION | \ - MAT_FLAG_TRANSLATION | \ - MAT_FLAG_UNIFORM_SCALE | \ - MAT_FLAG_GENERAL_SCALE | \ - MAT_FLAG_GENERAL_3D) - -/** dirty matrix flags mask */ -#define MAT_DIRTY (MAT_DIRTY_TYPE | \ - MAT_DIRTY_FLAGS | \ - MAT_DIRTY_INVERSE) - -/*@}*/ - - -/** - * Test geometry related matrix flags. - * - * \param mat a pointer to a GLmatrix structure. - * \param a flags mask. - * - * \returns non-zero if all geometry related matrix flags are contained within - * the mask, or zero otherwise. - */ -#define TEST_MAT_FLAGS(mat, a) \ - ((MAT_FLAGS_GEOMETRY & (~(a)) & ((mat)->flags) ) == 0) - - - -/** - * Names of the corresponding GLmatrixtype values. - */ -static const char *types[] = { - "MATRIX_GENERAL", - "MATRIX_IDENTITY", - "MATRIX_3D_NO_ROT", - "MATRIX_PERSPECTIVE", - "MATRIX_2D", - "MATRIX_2D_NO_ROT", - "MATRIX_3D" -}; - - -/** - * Identity matrix. - */ -static GLfloat Identity[16] = { - 1.0, 0.0, 0.0, 0.0, - 0.0, 1.0, 0.0, 0.0, - 0.0, 0.0, 1.0, 0.0, - 0.0, 0.0, 0.0, 1.0 -}; - - - -/**********************************************************************/ -/** \name Matrix multiplication */ -/*@{*/ - -#define A(row,col) a[(col<<2)+row] -#define B(row,col) b[(col<<2)+row] -#define P(row,col) product[(col<<2)+row] - -/** - * Perform a full 4x4 matrix multiplication. - * - * \param a matrix. - * \param b matrix. - * \param product will receive the product of \p a and \p b. - * - * \warning Is assumed that \p product != \p b. \p product == \p a is allowed. - * - * \note KW: 4*16 = 64 multiplications - * - * \author This \c matmul was contributed by Thomas Malik - */ -static void matmul4( GLfloat *product, const GLfloat *a, const GLfloat *b ) -{ - GLint i; - for (i = 0; i < 4; i++) { - const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3); - P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0); - P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1); - P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2); - P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3); - } -} - -/** - * Multiply two matrices known to occupy only the top three rows, such - * as typical model matrices, and orthogonal matrices. - * - * \param a matrix. - * \param b matrix. - * \param product will receive the product of \p a and \p b. - */ -static void matmul34( GLfloat *product, const GLfloat *a, const GLfloat *b ) -{ - GLint i; - for (i = 0; i < 3; i++) { - const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3); - P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0); - P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1); - P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2); - P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3; - } - P(3,0) = 0; - P(3,1) = 0; - P(3,2) = 0; - P(3,3) = 1; -} - -#undef A -#undef B -#undef P - -/** - * Multiply a matrix by an array of floats with known properties. - * - * \param mat pointer to a GLmatrix structure containing the left multiplication - * matrix, and that will receive the product result. - * \param m right multiplication matrix array. - * \param flags flags of the matrix \p m. - * - * Joins both flags and marks the type and inverse as dirty. Calls matmul34() - * if both matrices are 3D, or matmul4() otherwise. - */ -static void matrix_multf( GLmatrix *mat, const GLfloat *m, GLuint flags ) -{ - mat->flags |= (flags | MAT_DIRTY_TYPE | MAT_DIRTY_INVERSE); - - if (TEST_MAT_FLAGS(mat, MAT_FLAGS_3D)) - matmul34( mat->m, mat->m, m ); - else - matmul4( mat->m, mat->m, m ); -} - -/** - * Matrix multiplication. - * - * \param dest destination matrix. - * \param a left matrix. - * \param b right matrix. - * - * Joins both flags and marks the type and inverse as dirty. Calls matmul34() - * if both matrices are 3D, or matmul4() otherwise. - */ -void -_math_matrix_mul_matrix( GLmatrix *dest, const GLmatrix *a, const GLmatrix *b ) -{ - dest->flags = (a->flags | - b->flags | - MAT_DIRTY_TYPE | - MAT_DIRTY_INVERSE); - - if (TEST_MAT_FLAGS(dest, MAT_FLAGS_3D)) - matmul34( dest->m, a->m, b->m ); - else - matmul4( dest->m, a->m, b->m ); -} - -/** - * Matrix multiplication. - * - * \param dest left and destination matrix. - * \param m right matrix array. - * - * Marks the matrix flags with general flag, and type and inverse dirty flags. - * Calls matmul4() for the multiplication. - */ -void -_math_matrix_mul_floats( GLmatrix *dest, const GLfloat *m ) -{ - dest->flags |= (MAT_FLAG_GENERAL | - MAT_DIRTY_TYPE | - MAT_DIRTY_INVERSE | - MAT_DIRTY_FLAGS); - - matmul4( dest->m, dest->m, m ); -} - -/*@}*/ - - -/**********************************************************************/ -/** \name Matrix output */ -/*@{*/ - -/** - * Print a matrix array. - * - * \param m matrix array. - * - * Called by _math_matrix_print() to print a matrix or its inverse. - */ -static void print_matrix_floats( const GLfloat m[16] ) -{ - int i; - for (i=0;i<4;i++) { - _mesa_debug(NULL,"\t%f %f %f %f\n", m[i], m[4+i], m[8+i], m[12+i] ); - } -} - -/** - * Dumps the contents of a GLmatrix structure. - * - * \param m pointer to the GLmatrix structure. - */ -void -_math_matrix_print( const GLmatrix *m ) -{ - _mesa_debug(NULL, "Matrix type: %s, flags: %x\n", types[m->type], m->flags); - print_matrix_floats(m->m); - _mesa_debug(NULL, "Inverse: \n"); - if (m->inv) { - GLfloat prod[16]; - print_matrix_floats(m->inv); - matmul4(prod, m->m, m->inv); - _mesa_debug(NULL, "Mat * Inverse:\n"); - print_matrix_floats(prod); - } - else { - _mesa_debug(NULL, " - not available\n"); - } -} - -/*@}*/ - - -/** - * References an element of 4x4 matrix. - * - * \param m matrix array. - * \param c column of the desired element. - * \param r row of the desired element. - * - * \return value of the desired element. - * - * Calculate the linear storage index of the element and references it. - */ -#define MAT(m,r,c) (m)[(c)*4+(r)] - - -/**********************************************************************/ -/** \name Matrix inversion */ -/*@{*/ - -/** - * Swaps the values of two floating pointer variables. - * - * Used by invert_matrix_general() to swap the row pointers. - */ -#define SWAP_ROWS(a, b) { GLfloat *_tmp = a; (a)=(b); (b)=_tmp; } - -/** - * Compute inverse of 4x4 transformation matrix. - * - * \param mat pointer to a GLmatrix structure. The matrix inverse will be - * stored in the GLmatrix::inv attribute. - * - * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). - * - * \author - * Code contributed by Jacques Leroy jle@star.be - * - * Calculates the inverse matrix by performing the gaussian matrix reduction - * with partial pivoting followed by back/substitution with the loops manually - * unrolled. - */ -static GLboolean invert_matrix_general( GLmatrix *mat ) -{ - const GLfloat *m = mat->m; - GLfloat *out = mat->inv; - GLfloat wtmp[4][8]; - GLfloat m0, m1, m2, m3, s; - GLfloat *r0, *r1, *r2, *r3; - - r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3]; - - r0[0] = MAT(m,0,0), r0[1] = MAT(m,0,1), - r0[2] = MAT(m,0,2), r0[3] = MAT(m,0,3), - r0[4] = 1.0, r0[5] = r0[6] = r0[7] = 0.0, - - r1[0] = MAT(m,1,0), r1[1] = MAT(m,1,1), - r1[2] = MAT(m,1,2), r1[3] = MAT(m,1,3), - r1[5] = 1.0, r1[4] = r1[6] = r1[7] = 0.0, - - r2[0] = MAT(m,2,0), r2[1] = MAT(m,2,1), - r2[2] = MAT(m,2,2), r2[3] = MAT(m,2,3), - r2[6] = 1.0, r2[4] = r2[5] = r2[7] = 0.0, - - r3[0] = MAT(m,3,0), r3[1] = MAT(m,3,1), - r3[2] = MAT(m,3,2), r3[3] = MAT(m,3,3), - r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0; - - /* choose pivot - or die */ - if (FABSF(r3[0])>FABSF(r2[0])) SWAP_ROWS(r3, r2); - if (FABSF(r2[0])>FABSF(r1[0])) SWAP_ROWS(r2, r1); - if (FABSF(r1[0])>FABSF(r0[0])) SWAP_ROWS(r1, r0); - if (0.0 == r0[0]) return GL_FALSE; - - /* eliminate first variable */ - m1 = r1[0]/r0[0]; m2 = r2[0]/r0[0]; m3 = r3[0]/r0[0]; - s = r0[1]; r1[1] -= m1 * s; r2[1] -= m2 * s; r3[1] -= m3 * s; - s = r0[2]; r1[2] -= m1 * s; r2[2] -= m2 * s; r3[2] -= m3 * s; - s = r0[3]; r1[3] -= m1 * s; r2[3] -= m2 * s; r3[3] -= m3 * s; - s = r0[4]; - if (s != 0.0) { r1[4] -= m1 * s; r2[4] -= m2 * s; r3[4] -= m3 * s; } - s = r0[5]; - if (s != 0.0) { r1[5] -= m1 * s; r2[5] -= m2 * s; r3[5] -= m3 * s; } - s = r0[6]; - if (s != 0.0) { r1[6] -= m1 * s; r2[6] -= m2 * s; r3[6] -= m3 * s; } - s = r0[7]; - if (s != 0.0) { r1[7] -= m1 * s; r2[7] -= m2 * s; r3[7] -= m3 * s; } - - /* choose pivot - or die */ - if (FABSF(r3[1])>FABSF(r2[1])) SWAP_ROWS(r3, r2); - if (FABSF(r2[1])>FABSF(r1[1])) SWAP_ROWS(r2, r1); - if (0.0 == r1[1]) return GL_FALSE; - - /* eliminate second variable */ - m2 = r2[1]/r1[1]; m3 = r3[1]/r1[1]; - r2[2] -= m2 * r1[2]; r3[2] -= m3 * r1[2]; - r2[3] -= m2 * r1[3]; r3[3] -= m3 * r1[3]; - s = r1[4]; if (0.0 != s) { r2[4] -= m2 * s; r3[4] -= m3 * s; } - s = r1[5]; if (0.0 != s) { r2[5] -= m2 * s; r3[5] -= m3 * s; } - s = r1[6]; if (0.0 != s) { r2[6] -= m2 * s; r3[6] -= m3 * s; } - s = r1[7]; if (0.0 != s) { r2[7] -= m2 * s; r3[7] -= m3 * s; } - - /* choose pivot - or die */ - if (FABSF(r3[2])>FABSF(r2[2])) SWAP_ROWS(r3, r2); - if (0.0 == r2[2]) return GL_FALSE; - - /* eliminate third variable */ - m3 = r3[2]/r2[2]; - r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4], - r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6], - r3[7] -= m3 * r2[7]; - - /* last check */ - if (0.0 == r3[3]) return GL_FALSE; - - s = 1.0F/r3[3]; /* now back substitute row 3 */ - r3[4] *= s; r3[5] *= s; r3[6] *= s; r3[7] *= s; - - m2 = r2[3]; /* now back substitute row 2 */ - s = 1.0F/r2[2]; - r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2), - r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2); - m1 = r1[3]; - r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1, - r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1; - m0 = r0[3]; - r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0, - r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0; - - m1 = r1[2]; /* now back substitute row 1 */ - s = 1.0F/r1[1]; - r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1), - r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1); - m0 = r0[2]; - r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0, - r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0; - - m0 = r0[1]; /* now back substitute row 0 */ - s = 1.0F/r0[0]; - r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0), - r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0); - - MAT(out,0,0) = r0[4]; MAT(out,0,1) = r0[5], - MAT(out,0,2) = r0[6]; MAT(out,0,3) = r0[7], - MAT(out,1,0) = r1[4]; MAT(out,1,1) = r1[5], - MAT(out,1,2) = r1[6]; MAT(out,1,3) = r1[7], - MAT(out,2,0) = r2[4]; MAT(out,2,1) = r2[5], - MAT(out,2,2) = r2[6]; MAT(out,2,3) = r2[7], - MAT(out,3,0) = r3[4]; MAT(out,3,1) = r3[5], - MAT(out,3,2) = r3[6]; MAT(out,3,3) = r3[7]; - - return GL_TRUE; -} -#undef SWAP_ROWS - -/** - * Compute inverse of a general 3d transformation matrix. - * - * \param mat pointer to a GLmatrix structure. The matrix inverse will be - * stored in the GLmatrix::inv attribute. - * - * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). - * - * \author Adapted from graphics gems II. - * - * Calculates the inverse of the upper left by first calculating its - * determinant and multiplying it to the symmetric adjust matrix of each - * element. Finally deals with the translation part by transforming the - * original translation vector using by the calculated submatrix inverse. - */ -static GLboolean invert_matrix_3d_general( GLmatrix *mat ) -{ - const GLfloat *in = mat->m; - GLfloat *out = mat->inv; - GLfloat pos, neg, t; - GLfloat det; - - /* Calculate the determinant of upper left 3x3 submatrix and - * determine if the matrix is singular. - */ - pos = neg = 0.0; - t = MAT(in,0,0) * MAT(in,1,1) * MAT(in,2,2); - if (t >= 0.0) pos += t; else neg += t; - - t = MAT(in,1,0) * MAT(in,2,1) * MAT(in,0,2); - if (t >= 0.0) pos += t; else neg += t; - - t = MAT(in,2,0) * MAT(in,0,1) * MAT(in,1,2); - if (t >= 0.0) pos += t; else neg += t; - - t = -MAT(in,2,0) * MAT(in,1,1) * MAT(in,0,2); - if (t >= 0.0) pos += t; else neg += t; - - t = -MAT(in,1,0) * MAT(in,0,1) * MAT(in,2,2); - if (t >= 0.0) pos += t; else neg += t; - - t = -MAT(in,0,0) * MAT(in,2,1) * MAT(in,1,2); - if (t >= 0.0) pos += t; else neg += t; - - det = pos + neg; - - if (det*det < 1e-25) - return GL_FALSE; - - det = 1.0F / det; - MAT(out,0,0) = ( (MAT(in,1,1)*MAT(in,2,2) - MAT(in,2,1)*MAT(in,1,2) )*det); - MAT(out,0,1) = (- (MAT(in,0,1)*MAT(in,2,2) - MAT(in,2,1)*MAT(in,0,2) )*det); - MAT(out,0,2) = ( (MAT(in,0,1)*MAT(in,1,2) - MAT(in,1,1)*MAT(in,0,2) )*det); - MAT(out,1,0) = (- (MAT(in,1,0)*MAT(in,2,2) - MAT(in,2,0)*MAT(in,1,2) )*det); - MAT(out,1,1) = ( (MAT(in,0,0)*MAT(in,2,2) - MAT(in,2,0)*MAT(in,0,2) )*det); - MAT(out,1,2) = (- (MAT(in,0,0)*MAT(in,1,2) - MAT(in,1,0)*MAT(in,0,2) )*det); - MAT(out,2,0) = ( (MAT(in,1,0)*MAT(in,2,1) - MAT(in,2,0)*MAT(in,1,1) )*det); - MAT(out,2,1) = (- (MAT(in,0,0)*MAT(in,2,1) - MAT(in,2,0)*MAT(in,0,1) )*det); - MAT(out,2,2) = ( (MAT(in,0,0)*MAT(in,1,1) - MAT(in,1,0)*MAT(in,0,1) )*det); - - /* Do the translation part */ - MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0) + - MAT(in,1,3) * MAT(out,0,1) + - MAT(in,2,3) * MAT(out,0,2) ); - MAT(out,1,3) = - (MAT(in,0,3) * MAT(out,1,0) + - MAT(in,1,3) * MAT(out,1,1) + - MAT(in,2,3) * MAT(out,1,2) ); - MAT(out,2,3) = - (MAT(in,0,3) * MAT(out,2,0) + - MAT(in,1,3) * MAT(out,2,1) + - MAT(in,2,3) * MAT(out,2,2) ); - - return GL_TRUE; -} - -/** - * Compute inverse of a 3d transformation matrix. - * - * \param mat pointer to a GLmatrix structure. The matrix inverse will be - * stored in the GLmatrix::inv attribute. - * - * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). - * - * If the matrix is not an angle preserving matrix then calls - * invert_matrix_3d_general for the actual calculation. Otherwise calculates - * the inverse matrix analyzing and inverting each of the scaling, rotation and - * translation parts. - */ -static GLboolean invert_matrix_3d( GLmatrix *mat ) -{ - const GLfloat *in = mat->m; - GLfloat *out = mat->inv; - - if (!TEST_MAT_FLAGS(mat, MAT_FLAGS_ANGLE_PRESERVING)) { - return invert_matrix_3d_general( mat ); - } - - if (mat->flags & MAT_FLAG_UNIFORM_SCALE) { - GLfloat scale = (MAT(in,0,0) * MAT(in,0,0) + - MAT(in,0,1) * MAT(in,0,1) + - MAT(in,0,2) * MAT(in,0,2)); - - if (scale == 0.0) - return GL_FALSE; - - scale = 1.0F / scale; - - /* Transpose and scale the 3 by 3 upper-left submatrix. */ - MAT(out,0,0) = scale * MAT(in,0,0); - MAT(out,1,0) = scale * MAT(in,0,1); - MAT(out,2,0) = scale * MAT(in,0,2); - MAT(out,0,1) = scale * MAT(in,1,0); - MAT(out,1,1) = scale * MAT(in,1,1); - MAT(out,2,1) = scale * MAT(in,1,2); - MAT(out,0,2) = scale * MAT(in,2,0); - MAT(out,1,2) = scale * MAT(in,2,1); - MAT(out,2,2) = scale * MAT(in,2,2); - } - else if (mat->flags & MAT_FLAG_ROTATION) { - /* Transpose the 3 by 3 upper-left submatrix. */ - MAT(out,0,0) = MAT(in,0,0); - MAT(out,1,0) = MAT(in,0,1); - MAT(out,2,0) = MAT(in,0,2); - MAT(out,0,1) = MAT(in,1,0); - MAT(out,1,1) = MAT(in,1,1); - MAT(out,2,1) = MAT(in,1,2); - MAT(out,0,2) = MAT(in,2,0); - MAT(out,1,2) = MAT(in,2,1); - MAT(out,2,2) = MAT(in,2,2); - } - else { - /* pure translation */ - memcpy( out, Identity, sizeof(Identity) ); - MAT(out,0,3) = - MAT(in,0,3); - MAT(out,1,3) = - MAT(in,1,3); - MAT(out,2,3) = - MAT(in,2,3); - return GL_TRUE; - } - - if (mat->flags & MAT_FLAG_TRANSLATION) { - /* Do the translation part */ - MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0) + - MAT(in,1,3) * MAT(out,0,1) + - MAT(in,2,3) * MAT(out,0,2) ); - MAT(out,1,3) = - (MAT(in,0,3) * MAT(out,1,0) + - MAT(in,1,3) * MAT(out,1,1) + - MAT(in,2,3) * MAT(out,1,2) ); - MAT(out,2,3) = - (MAT(in,0,3) * MAT(out,2,0) + - MAT(in,1,3) * MAT(out,2,1) + - MAT(in,2,3) * MAT(out,2,2) ); - } - else { - MAT(out,0,3) = MAT(out,1,3) = MAT(out,2,3) = 0.0; - } - - return GL_TRUE; -} - -/** - * Compute inverse of an identity transformation matrix. - * - * \param mat pointer to a GLmatrix structure. The matrix inverse will be - * stored in the GLmatrix::inv attribute. - * - * \return always GL_TRUE. - * - * Simply copies Identity into GLmatrix::inv. - */ -static GLboolean invert_matrix_identity( GLmatrix *mat ) -{ - memcpy( mat->inv, Identity, sizeof(Identity) ); - return GL_TRUE; -} - -/** - * Compute inverse of a no-rotation 3d transformation matrix. - * - * \param mat pointer to a GLmatrix structure. The matrix inverse will be - * stored in the GLmatrix::inv attribute. - * - * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). - * - * Calculates the - */ -static GLboolean invert_matrix_3d_no_rot( GLmatrix *mat ) -{ - const GLfloat *in = mat->m; - GLfloat *out = mat->inv; - - if (MAT(in,0,0) == 0 || MAT(in,1,1) == 0 || MAT(in,2,2) == 0 ) - return GL_FALSE; - - memcpy( out, Identity, 16 * sizeof(GLfloat) ); - MAT(out,0,0) = 1.0F / MAT(in,0,0); - MAT(out,1,1) = 1.0F / MAT(in,1,1); - MAT(out,2,2) = 1.0F / MAT(in,2,2); - - if (mat->flags & MAT_FLAG_TRANSLATION) { - MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0)); - MAT(out,1,3) = - (MAT(in,1,3) * MAT(out,1,1)); - MAT(out,2,3) = - (MAT(in,2,3) * MAT(out,2,2)); - } - - return GL_TRUE; -} - -/** - * Compute inverse of a no-rotation 2d transformation matrix. - * - * \param mat pointer to a GLmatrix structure. The matrix inverse will be - * stored in the GLmatrix::inv attribute. - * - * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). - * - * Calculates the inverse matrix by applying the inverse scaling and - * translation to the identity matrix. - */ -static GLboolean invert_matrix_2d_no_rot( GLmatrix *mat ) -{ - const GLfloat *in = mat->m; - GLfloat *out = mat->inv; - - if (MAT(in,0,0) == 0 || MAT(in,1,1) == 0) - return GL_FALSE; - - memcpy( out, Identity, 16 * sizeof(GLfloat) ); - MAT(out,0,0) = 1.0F / MAT(in,0,0); - MAT(out,1,1) = 1.0F / MAT(in,1,1); - - if (mat->flags & MAT_FLAG_TRANSLATION) { - MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0)); - MAT(out,1,3) = - (MAT(in,1,3) * MAT(out,1,1)); - } - - return GL_TRUE; -} - -#if 0 -/* broken */ -static GLboolean invert_matrix_perspective( GLmatrix *mat ) -{ - const GLfloat *in = mat->m; - GLfloat *out = mat->inv; - - if (MAT(in,2,3) == 0) - return GL_FALSE; - - memcpy( out, Identity, 16 * sizeof(GLfloat) ); - - MAT(out,0,0) = 1.0F / MAT(in,0,0); - MAT(out,1,1) = 1.0F / MAT(in,1,1); - - MAT(out,0,3) = MAT(in,0,2); - MAT(out,1,3) = MAT(in,1,2); - - MAT(out,2,2) = 0; - MAT(out,2,3) = -1; - - MAT(out,3,2) = 1.0F / MAT(in,2,3); - MAT(out,3,3) = MAT(in,2,2) * MAT(out,3,2); - - return GL_TRUE; -} -#endif - -/** - * Matrix inversion function pointer type. - */ -typedef GLboolean (*inv_mat_func)( GLmatrix *mat ); - -/** - * Table of the matrix inversion functions according to the matrix type. - */ -static inv_mat_func inv_mat_tab[7] = { - invert_matrix_general, - invert_matrix_identity, - invert_matrix_3d_no_rot, -#if 0 - /* Don't use this function for now - it fails when the projection matrix - * is premultiplied by a translation (ala Chromium's tilesort SPU). - */ - invert_matrix_perspective, -#else - invert_matrix_general, -#endif - invert_matrix_3d, /* lazy! */ - invert_matrix_2d_no_rot, - invert_matrix_3d -}; - -/** - * Compute inverse of a transformation matrix. - * - * \param mat pointer to a GLmatrix structure. The matrix inverse will be - * stored in the GLmatrix::inv attribute. - * - * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). - * - * Calls the matrix inversion function in inv_mat_tab corresponding to the - * given matrix type. In case of failure, updates the MAT_FLAG_SINGULAR flag, - * and copies the identity matrix into GLmatrix::inv. - */ -static GLboolean matrix_invert( GLmatrix *mat ) -{ - if (inv_mat_tab[mat->type](mat)) { - mat->flags &= ~MAT_FLAG_SINGULAR; - return GL_TRUE; - } else { - mat->flags |= MAT_FLAG_SINGULAR; - memcpy( mat->inv, Identity, sizeof(Identity) ); - return GL_FALSE; - } -} - -/*@}*/ - - -/**********************************************************************/ -/** \name Matrix generation */ -/*@{*/ - -/** - * Generate a 4x4 transformation matrix from glRotate parameters, and - * post-multiply the input matrix by it. - * - * \author - * This function was contributed by Erich Boleyn (erich@uruk.org). - * Optimizations contributed by Rudolf Opalla (rudi@khm.de). - */ -void -_math_matrix_rotate( GLmatrix *mat, - GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) -{ - GLfloat xx, yy, zz, xy, yz, zx, xs, ys, zs, one_c, s, c; - GLfloat m[16]; - GLboolean optimized; - - s = (GLfloat) sin( angle * DEG2RAD ); - c = (GLfloat) cos( angle * DEG2RAD ); - - memcpy(m, Identity, sizeof(GLfloat)*16); - optimized = GL_FALSE; - -#define M(row,col) m[col*4+row] - - if (x == 0.0F) { - if (y == 0.0F) { - if (z != 0.0F) { - optimized = GL_TRUE; - /* rotate only around z-axis */ - M(0,0) = c; - M(1,1) = c; - if (z < 0.0F) { - M(0,1) = s; - M(1,0) = -s; - } - else { - M(0,1) = -s; - M(1,0) = s; - } - } - } - else if (z == 0.0F) { - optimized = GL_TRUE; - /* rotate only around y-axis */ - M(0,0) = c; - M(2,2) = c; - if (y < 0.0F) { - M(0,2) = -s; - M(2,0) = s; - } - else { - M(0,2) = s; - M(2,0) = -s; - } - } - } - else if (y == 0.0F) { - if (z == 0.0F) { - optimized = GL_TRUE; - /* rotate only around x-axis */ - M(1,1) = c; - M(2,2) = c; - if (x < 0.0F) { - M(1,2) = s; - M(2,1) = -s; - } - else { - M(1,2) = -s; - M(2,1) = s; - } - } - } - - if (!optimized) { - const GLfloat mag = SQRTF(x * x + y * y + z * z); - - if (mag <= 1.0e-4) { - /* no rotation, leave mat as-is */ - return; - } - - x /= mag; - y /= mag; - z /= mag; - - - /* - * Arbitrary axis rotation matrix. - * - * This is composed of 5 matrices, Rz, Ry, T, Ry', Rz', multiplied - * like so: Rz * Ry * T * Ry' * Rz'. T is the final rotation - * (which is about the X-axis), and the two composite transforms - * Ry' * Rz' and Rz * Ry are (respectively) the rotations necessary - * from the arbitrary axis to the X-axis then back. They are - * all elementary rotations. - * - * Rz' is a rotation about the Z-axis, to bring the axis vector - * into the x-z plane. Then Ry' is applied, rotating about the - * Y-axis to bring the axis vector parallel with the X-axis. The - * rotation about the X-axis is then performed. Ry and Rz are - * simply the respective inverse transforms to bring the arbitrary - * axis back to its original orientation. The first transforms - * Rz' and Ry' are considered inverses, since the data from the - * arbitrary axis gives you info on how to get to it, not how - * to get away from it, and an inverse must be applied. - * - * The basic calculation used is to recognize that the arbitrary - * axis vector (x, y, z), since it is of unit length, actually - * represents the sines and cosines of the angles to rotate the - * X-axis to the same orientation, with theta being the angle about - * Z and phi the angle about Y (in the order described above) - * as follows: - * - * cos ( theta ) = x / sqrt ( 1 - z^2 ) - * sin ( theta ) = y / sqrt ( 1 - z^2 ) - * - * cos ( phi ) = sqrt ( 1 - z^2 ) - * sin ( phi ) = z - * - * Note that cos ( phi ) can further be inserted to the above - * formulas: - * - * cos ( theta ) = x / cos ( phi ) - * sin ( theta ) = y / sin ( phi ) - * - * ...etc. Because of those relations and the standard trigonometric - * relations, it is pssible to reduce the transforms down to what - * is used below. It may be that any primary axis chosen will give the - * same results (modulo a sign convention) using thie method. - * - * Particularly nice is to notice that all divisions that might - * have caused trouble when parallel to certain planes or - * axis go away with care paid to reducing the expressions. - * After checking, it does perform correctly under all cases, since - * in all the cases of division where the denominator would have - * been zero, the numerator would have been zero as well, giving - * the expected result. - */ - - xx = x * x; - yy = y * y; - zz = z * z; - xy = x * y; - yz = y * z; - zx = z * x; - xs = x * s; - ys = y * s; - zs = z * s; - one_c = 1.0F - c; - - /* We already hold the identity-matrix so we can skip some statements */ - M(0,0) = (one_c * xx) + c; - M(0,1) = (one_c * xy) - zs; - M(0,2) = (one_c * zx) + ys; -/* M(0,3) = 0.0F; */ - - M(1,0) = (one_c * xy) + zs; - M(1,1) = (one_c * yy) + c; - M(1,2) = (one_c * yz) - xs; -/* M(1,3) = 0.0F; */ - - M(2,0) = (one_c * zx) - ys; - M(2,1) = (one_c * yz) + xs; - M(2,2) = (one_c * zz) + c; -/* M(2,3) = 0.0F; */ - -/* - M(3,0) = 0.0F; - M(3,1) = 0.0F; - M(3,2) = 0.0F; - M(3,3) = 1.0F; -*/ - } -#undef M - - matrix_multf( mat, m, MAT_FLAG_ROTATION ); -} - -/** - * Apply a perspective projection matrix. - * - * \param mat matrix to apply the projection. - * \param left left clipping plane coordinate. - * \param right right clipping plane coordinate. - * \param bottom bottom clipping plane coordinate. - * \param top top clipping plane coordinate. - * \param nearval distance to the near clipping plane. - * \param farval distance to the far clipping plane. - * - * Creates the projection matrix and multiplies it with \p mat, marking the - * MAT_FLAG_PERSPECTIVE flag. - */ -void -_math_matrix_frustum( GLmatrix *mat, - GLfloat left, GLfloat right, - GLfloat bottom, GLfloat top, - GLfloat nearval, GLfloat farval ) -{ - GLfloat x, y, a, b, c, d; - GLfloat m[16]; - - x = (2.0F*nearval) / (right-left); - y = (2.0F*nearval) / (top-bottom); - a = (right+left) / (right-left); - b = (top+bottom) / (top-bottom); - c = -(farval+nearval) / ( farval-nearval); - d = -(2.0F*farval*nearval) / (farval-nearval); /* error? */ - -#define M(row,col) m[col*4+row] - M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F; - M(1,0) = 0.0F; M(1,1) = y; M(1,2) = b; M(1,3) = 0.0F; - M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = c; M(2,3) = d; - M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = -1.0F; M(3,3) = 0.0F; -#undef M - - matrix_multf( mat, m, MAT_FLAG_PERSPECTIVE ); -} - -/** - * Apply an orthographic projection matrix. - * - * \param mat matrix to apply the projection. - * \param left left clipping plane coordinate. - * \param right right clipping plane coordinate. - * \param bottom bottom clipping plane coordinate. - * \param top top clipping plane coordinate. - * \param nearval distance to the near clipping plane. - * \param farval distance to the far clipping plane. - * - * Creates the projection matrix and multiplies it with \p mat, marking the - * MAT_FLAG_GENERAL_SCALE and MAT_FLAG_TRANSLATION flags. - */ -void -_math_matrix_ortho( GLmatrix *mat, - GLfloat left, GLfloat right, - GLfloat bottom, GLfloat top, - GLfloat nearval, GLfloat farval ) -{ - GLfloat m[16]; - -#define M(row,col) m[col*4+row] - M(0,0) = 2.0F / (right-left); - M(0,1) = 0.0F; - M(0,2) = 0.0F; - M(0,3) = -(right+left) / (right-left); - - M(1,0) = 0.0F; - M(1,1) = 2.0F / (top-bottom); - M(1,2) = 0.0F; - M(1,3) = -(top+bottom) / (top-bottom); - - M(2,0) = 0.0F; - M(2,1) = 0.0F; - M(2,2) = -2.0F / (farval-nearval); - M(2,3) = -(farval+nearval) / (farval-nearval); - - M(3,0) = 0.0F; - M(3,1) = 0.0F; - M(3,2) = 0.0F; - M(3,3) = 1.0F; -#undef M - - matrix_multf( mat, m, (MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION)); -} - -/** - * Multiply a matrix with a general scaling matrix. - * - * \param mat matrix. - * \param x x axis scale factor. - * \param y y axis scale factor. - * \param z z axis scale factor. - * - * Multiplies in-place the elements of \p mat by the scale factors. Checks if - * the scales factors are roughly the same, marking the MAT_FLAG_UNIFORM_SCALE - * flag, or MAT_FLAG_GENERAL_SCALE. Marks the MAT_DIRTY_TYPE and - * MAT_DIRTY_INVERSE dirty flags. - */ -void -_math_matrix_scale( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ) -{ - GLfloat *m = mat->m; - m[0] *= x; m[4] *= y; m[8] *= z; - m[1] *= x; m[5] *= y; m[9] *= z; - m[2] *= x; m[6] *= y; m[10] *= z; - m[3] *= x; m[7] *= y; m[11] *= z; - - if (FABSF(x - y) < 1e-8 && FABSF(x - z) < 1e-8) - mat->flags |= MAT_FLAG_UNIFORM_SCALE; - else - mat->flags |= MAT_FLAG_GENERAL_SCALE; - - mat->flags |= (MAT_DIRTY_TYPE | - MAT_DIRTY_INVERSE); -} - -/** - * Multiply a matrix with a translation matrix. - * - * \param mat matrix. - * \param x translation vector x coordinate. - * \param y translation vector y coordinate. - * \param z translation vector z coordinate. - * - * Adds the translation coordinates to the elements of \p mat in-place. Marks - * the MAT_FLAG_TRANSLATION flag, and the MAT_DIRTY_TYPE and MAT_DIRTY_INVERSE - * dirty flags. - */ -void -_math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ) -{ - GLfloat *m = mat->m; - m[12] = m[0] * x + m[4] * y + m[8] * z + m[12]; - m[13] = m[1] * x + m[5] * y + m[9] * z + m[13]; - m[14] = m[2] * x + m[6] * y + m[10] * z + m[14]; - m[15] = m[3] * x + m[7] * y + m[11] * z + m[15]; - - mat->flags |= (MAT_FLAG_TRANSLATION | - MAT_DIRTY_TYPE | - MAT_DIRTY_INVERSE); -} - - -/** - * Set matrix to do viewport and depthrange mapping. - * Transforms Normalized Device Coords to window/Z values. - */ -void -_math_matrix_viewport(GLmatrix *m, GLint x, GLint y, GLint width, GLint height, - GLfloat zNear, GLfloat zFar, GLfloat depthMax) -{ - m->m[MAT_SX] = (GLfloat) width / 2.0F; - m->m[MAT_TX] = m->m[MAT_SX] + x; - m->m[MAT_SY] = (GLfloat) height / 2.0F; - m->m[MAT_TY] = m->m[MAT_SY] + y; - m->m[MAT_SZ] = depthMax * ((zFar - zNear) / 2.0F); - m->m[MAT_TZ] = depthMax * ((zFar - zNear) / 2.0F + zNear); - m->flags = MAT_FLAG_GENERAL_SCALE | MAT_FLAG_TRANSLATION; - m->type = MATRIX_3D_NO_ROT; -} - - -/** - * Set a matrix to the identity matrix. - * - * \param mat matrix. - * - * Copies ::Identity into \p GLmatrix::m, and into GLmatrix::inv if not NULL. - * Sets the matrix type to identity, and clear the dirty flags. - */ -void -_math_matrix_set_identity( GLmatrix *mat ) -{ - memcpy( mat->m, Identity, 16*sizeof(GLfloat) ); - - if (mat->inv) - memcpy( mat->inv, Identity, 16*sizeof(GLfloat) ); - - mat->type = MATRIX_IDENTITY; - mat->flags &= ~(MAT_DIRTY_FLAGS| - MAT_DIRTY_TYPE| - MAT_DIRTY_INVERSE); -} - -/*@}*/ - - -/**********************************************************************/ -/** \name Matrix analysis */ -/*@{*/ - -#define ZERO(x) (1<m; - GLuint mask = 0; - GLuint i; - - for (i = 0 ; i < 16 ; i++) { - if (m[i] == 0.0) mask |= (1<flags &= ~MAT_FLAGS_GEOMETRY; - - /* Check for translation - no-one really cares - */ - if ((mask & MASK_NO_TRX) != MASK_NO_TRX) - mat->flags |= MAT_FLAG_TRANSLATION; - - /* Do the real work - */ - if (mask == (GLuint) MASK_IDENTITY) { - mat->type = MATRIX_IDENTITY; - } - else if ((mask & MASK_2D_NO_ROT) == (GLuint) MASK_2D_NO_ROT) { - mat->type = MATRIX_2D_NO_ROT; - - if ((mask & MASK_NO_2D_SCALE) != MASK_NO_2D_SCALE) - mat->flags |= MAT_FLAG_GENERAL_SCALE; - } - else if ((mask & MASK_2D) == (GLuint) MASK_2D) { - GLfloat mm = DOT2(m, m); - GLfloat m4m4 = DOT2(m+4,m+4); - GLfloat mm4 = DOT2(m,m+4); - - mat->type = MATRIX_2D; - - /* Check for scale */ - if (SQ(mm-1) > SQ(1e-6) || - SQ(m4m4-1) > SQ(1e-6)) - mat->flags |= MAT_FLAG_GENERAL_SCALE; - - /* Check for rotation */ - if (SQ(mm4) > SQ(1e-6)) - mat->flags |= MAT_FLAG_GENERAL_3D; - else - mat->flags |= MAT_FLAG_ROTATION; - - } - else if ((mask & MASK_3D_NO_ROT) == (GLuint) MASK_3D_NO_ROT) { - mat->type = MATRIX_3D_NO_ROT; - - /* Check for scale */ - if (SQ(m[0]-m[5]) < SQ(1e-6) && - SQ(m[0]-m[10]) < SQ(1e-6)) { - if (SQ(m[0]-1.0) > SQ(1e-6)) { - mat->flags |= MAT_FLAG_UNIFORM_SCALE; - } - } - else { - mat->flags |= MAT_FLAG_GENERAL_SCALE; - } - } - else if ((mask & MASK_3D) == (GLuint) MASK_3D) { - GLfloat c1 = DOT3(m,m); - GLfloat c2 = DOT3(m+4,m+4); - GLfloat c3 = DOT3(m+8,m+8); - GLfloat d1 = DOT3(m, m+4); - GLfloat cp[3]; - - mat->type = MATRIX_3D; - - /* Check for scale */ - if (SQ(c1-c2) < SQ(1e-6) && SQ(c1-c3) < SQ(1e-6)) { - if (SQ(c1-1.0) > SQ(1e-6)) - mat->flags |= MAT_FLAG_UNIFORM_SCALE; - /* else no scale at all */ - } - else { - mat->flags |= MAT_FLAG_GENERAL_SCALE; - } - - /* Check for rotation */ - if (SQ(d1) < SQ(1e-6)) { - CROSS3( cp, m, m+4 ); - SUB_3V( cp, cp, (m+8) ); - if (LEN_SQUARED_3FV(cp) < SQ(1e-6)) - mat->flags |= MAT_FLAG_ROTATION; - else - mat->flags |= MAT_FLAG_GENERAL_3D; - } - else { - mat->flags |= MAT_FLAG_GENERAL_3D; /* shear, etc */ - } - } - else if ((mask & MASK_PERSPECTIVE) == MASK_PERSPECTIVE && m[11]==-1.0F) { - mat->type = MATRIX_PERSPECTIVE; - mat->flags |= MAT_FLAG_GENERAL; - } - else { - mat->type = MATRIX_GENERAL; - mat->flags |= MAT_FLAG_GENERAL; - } -} - -/** - * Analyze a matrix given that its flags are accurate. - * - * This is the more common operation, hopefully. - */ -static void analyse_from_flags( GLmatrix *mat ) -{ - const GLfloat *m = mat->m; - - if (TEST_MAT_FLAGS(mat, 0)) { - mat->type = MATRIX_IDENTITY; - } - else if (TEST_MAT_FLAGS(mat, (MAT_FLAG_TRANSLATION | - MAT_FLAG_UNIFORM_SCALE | - MAT_FLAG_GENERAL_SCALE))) { - if ( m[10]==1.0F && m[14]==0.0F ) { - mat->type = MATRIX_2D_NO_ROT; - } - else { - mat->type = MATRIX_3D_NO_ROT; - } - } - else if (TEST_MAT_FLAGS(mat, MAT_FLAGS_3D)) { - if ( m[ 8]==0.0F - && m[ 9]==0.0F - && m[2]==0.0F && m[6]==0.0F && m[10]==1.0F && m[14]==0.0F) { - mat->type = MATRIX_2D; - } - else { - mat->type = MATRIX_3D; - } - } - else if ( m[4]==0.0F && m[12]==0.0F - && m[1]==0.0F && m[13]==0.0F - && m[2]==0.0F && m[6]==0.0F - && m[3]==0.0F && m[7]==0.0F && m[11]==-1.0F && m[15]==0.0F) { - mat->type = MATRIX_PERSPECTIVE; - } - else { - mat->type = MATRIX_GENERAL; - } -} - -/** - * Analyze and update a matrix. - * - * \param mat matrix. - * - * If the matrix type is dirty then calls either analyse_from_scratch() or - * analyse_from_flags() to determine its type, according to whether the flags - * are dirty or not, respectively. If the matrix has an inverse and it's dirty - * then calls matrix_invert(). Finally clears the dirty flags. - */ -void -_math_matrix_analyse( GLmatrix *mat ) -{ - if (mat->flags & MAT_DIRTY_TYPE) { - if (mat->flags & MAT_DIRTY_FLAGS) - analyse_from_scratch( mat ); - else - analyse_from_flags( mat ); - } - - if (mat->inv && (mat->flags & MAT_DIRTY_INVERSE)) { - matrix_invert( mat ); - mat->flags &= ~MAT_DIRTY_INVERSE; - } - - mat->flags &= ~(MAT_DIRTY_FLAGS | MAT_DIRTY_TYPE); -} - -/*@}*/ - - -/** - * Test if the given matrix preserves vector lengths. - */ -GLboolean -_math_matrix_is_length_preserving( const GLmatrix *m ) -{ - return TEST_MAT_FLAGS( m, MAT_FLAGS_LENGTH_PRESERVING); -} - - -/** - * Test if the given matrix does any rotation. - * (or perhaps if the upper-left 3x3 is non-identity) - */ -GLboolean -_math_matrix_has_rotation( const GLmatrix *m ) -{ - if (m->flags & (MAT_FLAG_GENERAL | - MAT_FLAG_ROTATION | - MAT_FLAG_GENERAL_3D | - MAT_FLAG_PERSPECTIVE)) - return GL_TRUE; - else - return GL_FALSE; -} - - -GLboolean -_math_matrix_is_general_scale( const GLmatrix *m ) -{ - return (m->flags & MAT_FLAG_GENERAL_SCALE) ? GL_TRUE : GL_FALSE; -} - - -GLboolean -_math_matrix_is_dirty( const GLmatrix *m ) -{ - return (m->flags & MAT_DIRTY) ? GL_TRUE : GL_FALSE; -} - - -/**********************************************************************/ -/** \name Matrix setup */ -/*@{*/ - -/** - * Copy a matrix. - * - * \param to destination matrix. - * \param from source matrix. - * - * Copies all fields in GLmatrix, creating an inverse array if necessary. - */ -void -_math_matrix_copy( GLmatrix *to, const GLmatrix *from ) -{ - memcpy( to->m, from->m, sizeof(Identity) ); - to->flags = from->flags; - to->type = from->type; - - if (to->inv != 0) { - if (from->inv == 0) { - matrix_invert( to ); - } - else { - memcpy(to->inv, from->inv, sizeof(GLfloat)*16); - } - } -} - -/** - * Loads a matrix array into GLmatrix. - * - * \param m matrix array. - * \param mat matrix. - * - * Copies \p m into GLmatrix::m and marks the MAT_FLAG_GENERAL and MAT_DIRTY - * flags. - */ -void -_math_matrix_loadf( GLmatrix *mat, const GLfloat *m ) -{ - memcpy( mat->m, m, 16*sizeof(GLfloat) ); - mat->flags = (MAT_FLAG_GENERAL | MAT_DIRTY); -} - -/** - * Matrix constructor. - * - * \param m matrix. - * - * Initialize the GLmatrix fields. - */ -void -_math_matrix_ctr( GLmatrix *m ) -{ - m->m = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 ); - if (m->m) - memcpy( m->m, Identity, sizeof(Identity) ); - m->inv = NULL; - m->type = MATRIX_IDENTITY; - m->flags = 0; -} - -/** - * Matrix destructor. - * - * \param m matrix. - * - * Frees the data in a GLmatrix. - */ -void -_math_matrix_dtr( GLmatrix *m ) -{ - if (m->m) { - _mesa_align_free( m->m ); - m->m = NULL; - } - if (m->inv) { - _mesa_align_free( m->inv ); - m->inv = NULL; - } -} - -/** - * Allocate a matrix inverse. - * - * \param m matrix. - * - * Allocates the matrix inverse, GLmatrix::inv, and sets it to Identity. - */ -void -_math_matrix_alloc_inv( GLmatrix *m ) -{ - if (!m->inv) { - m->inv = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 ); - if (m->inv) - memcpy( m->inv, Identity, 16 * sizeof(GLfloat) ); - } -} - -/*@}*/ - - -/**********************************************************************/ -/** \name Matrix transpose */ -/*@{*/ - -/** - * Transpose a GLfloat matrix. - * - * \param to destination array. - * \param from source array. - */ -void -_math_transposef( GLfloat to[16], const GLfloat from[16] ) -{ - to[0] = from[0]; - to[1] = from[4]; - to[2] = from[8]; - to[3] = from[12]; - to[4] = from[1]; - to[5] = from[5]; - to[6] = from[9]; - to[7] = from[13]; - to[8] = from[2]; - to[9] = from[6]; - to[10] = from[10]; - to[11] = from[14]; - to[12] = from[3]; - to[13] = from[7]; - to[14] = from[11]; - to[15] = from[15]; -} - -/** - * Transpose a GLdouble matrix. - * - * \param to destination array. - * \param from source array. - */ -void -_math_transposed( GLdouble to[16], const GLdouble from[16] ) -{ - to[0] = from[0]; - to[1] = from[4]; - to[2] = from[8]; - to[3] = from[12]; - to[4] = from[1]; - to[5] = from[5]; - to[6] = from[9]; - to[7] = from[13]; - to[8] = from[2]; - to[9] = from[6]; - to[10] = from[10]; - to[11] = from[14]; - to[12] = from[3]; - to[13] = from[7]; - to[14] = from[11]; - to[15] = from[15]; -} - -/** - * Transpose a GLdouble matrix and convert to GLfloat. - * - * \param to destination array. - * \param from source array. - */ -void -_math_transposefd( GLfloat to[16], const GLdouble from[16] ) -{ - to[0] = (GLfloat) from[0]; - to[1] = (GLfloat) from[4]; - to[2] = (GLfloat) from[8]; - to[3] = (GLfloat) from[12]; - to[4] = (GLfloat) from[1]; - to[5] = (GLfloat) from[5]; - to[6] = (GLfloat) from[9]; - to[7] = (GLfloat) from[13]; - to[8] = (GLfloat) from[2]; - to[9] = (GLfloat) from[6]; - to[10] = (GLfloat) from[10]; - to[11] = (GLfloat) from[14]; - to[12] = (GLfloat) from[3]; - to[13] = (GLfloat) from[7]; - to[14] = (GLfloat) from[11]; - to[15] = (GLfloat) from[15]; -} - -/*@}*/ - - -/** - * Transform a 4-element row vector (1x4 matrix) by a 4x4 matrix. This - * function is used for transforming clipping plane equations and spotlight - * directions. - * Mathematically, u = v * m. - * Input: v - input vector - * m - transformation matrix - * Output: u - transformed vector - */ -void -_mesa_transform_vector( GLfloat u[4], const GLfloat v[4], const GLfloat m[16] ) -{ - const GLfloat v0 = v[0], v1 = v[1], v2 = v[2], v3 = v[3]; -#define M(row,col) m[row + col*4] - u[0] = v0 * M(0,0) + v1 * M(1,0) + v2 * M(2,0) + v3 * M(3,0); - u[1] = v0 * M(0,1) + v1 * M(1,1) + v2 * M(2,1) + v3 * M(3,1); - u[2] = v0 * M(0,2) + v1 * M(1,2) + v2 * M(2,2) + v3 * M(3,2); - u[3] = v0 * M(0,3) + v1 * M(1,3) + v2 * M(2,3) + v3 * M(3,3); -#undef M -} +/* + * 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. + */ + + +/** + * \file m_matrix.c + * Matrix operations. + * + * \note + * -# 4x4 transformation matrices are stored in memory in column major order. + * -# Points/vertices are to be thought of as column vectors. + * -# Transformation of a point p by a matrix M is: p' = M * p + */ + + +#include "main/glheader.h" +#include "main/imports.h" +#include "main/macros.h" + +#include "m_matrix.h" + + +/** + * \defgroup MatFlags MAT_FLAG_XXX-flags + * + * Bitmasks to indicate different kinds of 4x4 matrices in GLmatrix::flags + * It would be nice to make all these flags private to m_matrix.c + */ +/*@{*/ +#define MAT_FLAG_IDENTITY 0 /**< is an identity matrix flag. + * (Not actually used - the identity + * matrix is identified by the absense + * of all other flags.) + */ +#define MAT_FLAG_GENERAL 0x1 /**< is a general matrix flag */ +#define MAT_FLAG_ROTATION 0x2 /**< is a rotation matrix flag */ +#define MAT_FLAG_TRANSLATION 0x4 /**< is a translation matrix flag */ +#define MAT_FLAG_UNIFORM_SCALE 0x8 /**< is an uniform scaling matrix flag */ +#define MAT_FLAG_GENERAL_SCALE 0x10 /**< is a general scaling matrix flag */ +#define MAT_FLAG_GENERAL_3D 0x20 /**< general 3D matrix flag */ +#define MAT_FLAG_PERSPECTIVE 0x40 /**< is a perspective proj matrix flag */ +#define MAT_FLAG_SINGULAR 0x80 /**< is a singular matrix flag */ +#define MAT_DIRTY_TYPE 0x100 /**< matrix type is dirty */ +#define MAT_DIRTY_FLAGS 0x200 /**< matrix flags are dirty */ +#define MAT_DIRTY_INVERSE 0x400 /**< matrix inverse is dirty */ + +/** angle preserving matrix flags mask */ +#define MAT_FLAGS_ANGLE_PRESERVING (MAT_FLAG_ROTATION | \ + MAT_FLAG_TRANSLATION | \ + MAT_FLAG_UNIFORM_SCALE) + +/** geometry related matrix flags mask */ +#define MAT_FLAGS_GEOMETRY (MAT_FLAG_GENERAL | \ + MAT_FLAG_ROTATION | \ + MAT_FLAG_TRANSLATION | \ + MAT_FLAG_UNIFORM_SCALE | \ + MAT_FLAG_GENERAL_SCALE | \ + MAT_FLAG_GENERAL_3D | \ + MAT_FLAG_PERSPECTIVE | \ + MAT_FLAG_SINGULAR) + +/** length preserving matrix flags mask */ +#define MAT_FLAGS_LENGTH_PRESERVING (MAT_FLAG_ROTATION | \ + MAT_FLAG_TRANSLATION) + + +/** 3D (non-perspective) matrix flags mask */ +#define MAT_FLAGS_3D (MAT_FLAG_ROTATION | \ + MAT_FLAG_TRANSLATION | \ + MAT_FLAG_UNIFORM_SCALE | \ + MAT_FLAG_GENERAL_SCALE | \ + MAT_FLAG_GENERAL_3D) + +/** dirty matrix flags mask */ +#define MAT_DIRTY (MAT_DIRTY_TYPE | \ + MAT_DIRTY_FLAGS | \ + MAT_DIRTY_INVERSE) + +/*@}*/ + + +/** + * Test geometry related matrix flags. + * + * \param mat a pointer to a GLmatrix structure. + * \param a flags mask. + * + * \returns non-zero if all geometry related matrix flags are contained within + * the mask, or zero otherwise. + */ +#define TEST_MAT_FLAGS(mat, a) \ + ((MAT_FLAGS_GEOMETRY & (~(a)) & ((mat)->flags) ) == 0) + + + +/** + * Names of the corresponding GLmatrixtype values. + */ +static const char *types[] = { + "MATRIX_GENERAL", + "MATRIX_IDENTITY", + "MATRIX_3D_NO_ROT", + "MATRIX_PERSPECTIVE", + "MATRIX_2D", + "MATRIX_2D_NO_ROT", + "MATRIX_3D" +}; + + +/** + * Identity matrix. + */ +static GLfloat Identity[16] = { + 1.0, 0.0, 0.0, 0.0, + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 +}; + + + +/**********************************************************************/ +/** \name Matrix multiplication */ +/*@{*/ + +#define A(row,col) a[(col<<2)+row] +#define B(row,col) b[(col<<2)+row] +#define P(row,col) product[(col<<2)+row] + +/** + * Perform a full 4x4 matrix multiplication. + * + * \param a matrix. + * \param b matrix. + * \param product will receive the product of \p a and \p b. + * + * \warning Is assumed that \p product != \p b. \p product == \p a is allowed. + * + * \note KW: 4*16 = 64 multiplications + * + * \author This \c matmul was contributed by Thomas Malik + */ +static void matmul4( GLfloat *product, const GLfloat *a, const GLfloat *b ) +{ + GLint i; + for (i = 0; i < 4; i++) { + const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3); + P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0); + P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1); + P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2); + P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3); + } +} + +/** + * Multiply two matrices known to occupy only the top three rows, such + * as typical model matrices, and orthogonal matrices. + * + * \param a matrix. + * \param b matrix. + * \param product will receive the product of \p a and \p b. + */ +static void matmul34( GLfloat *product, const GLfloat *a, const GLfloat *b ) +{ + GLint i; + for (i = 0; i < 3; i++) { + const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3); + P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0); + P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1); + P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2); + P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3; + } + P(3,0) = 0; + P(3,1) = 0; + P(3,2) = 0; + P(3,3) = 1; +} + +#undef A +#undef B +#undef P + +/** + * Multiply a matrix by an array of floats with known properties. + * + * \param mat pointer to a GLmatrix structure containing the left multiplication + * matrix, and that will receive the product result. + * \param m right multiplication matrix array. + * \param flags flags of the matrix \p m. + * + * Joins both flags and marks the type and inverse as dirty. Calls matmul34() + * if both matrices are 3D, or matmul4() otherwise. + */ +static void matrix_multf( GLmatrix *mat, const GLfloat *m, GLuint flags ) +{ + mat->flags |= (flags | MAT_DIRTY_TYPE | MAT_DIRTY_INVERSE); + + if (TEST_MAT_FLAGS(mat, MAT_FLAGS_3D)) + matmul34( mat->m, mat->m, m ); + else + matmul4( mat->m, mat->m, m ); +} + +/** + * Matrix multiplication. + * + * \param dest destination matrix. + * \param a left matrix. + * \param b right matrix. + * + * Joins both flags and marks the type and inverse as dirty. Calls matmul34() + * if both matrices are 3D, or matmul4() otherwise. + */ +void +_math_matrix_mul_matrix( GLmatrix *dest, const GLmatrix *a, const GLmatrix *b ) +{ + dest->flags = (a->flags | + b->flags | + MAT_DIRTY_TYPE | + MAT_DIRTY_INVERSE); + + if (TEST_MAT_FLAGS(dest, MAT_FLAGS_3D)) + matmul34( dest->m, a->m, b->m ); + else + matmul4( dest->m, a->m, b->m ); +} + +/** + * Matrix multiplication. + * + * \param dest left and destination matrix. + * \param m right matrix array. + * + * Marks the matrix flags with general flag, and type and inverse dirty flags. + * Calls matmul4() for the multiplication. + */ +void +_math_matrix_mul_floats( GLmatrix *dest, const GLfloat *m ) +{ + dest->flags |= (MAT_FLAG_GENERAL | + MAT_DIRTY_TYPE | + MAT_DIRTY_INVERSE | + MAT_DIRTY_FLAGS); + + matmul4( dest->m, dest->m, m ); +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Matrix output */ +/*@{*/ + +/** + * Print a matrix array. + * + * \param m matrix array. + * + * Called by _math_matrix_print() to print a matrix or its inverse. + */ +static void print_matrix_floats( const GLfloat m[16] ) +{ + int i; + for (i=0;i<4;i++) { + _mesa_debug(NULL,"\t%f %f %f %f\n", m[i], m[4+i], m[8+i], m[12+i] ); + } +} + +/** + * Dumps the contents of a GLmatrix structure. + * + * \param m pointer to the GLmatrix structure. + */ +void +_math_matrix_print( const GLmatrix *m ) +{ + _mesa_debug(NULL, "Matrix type: %s, flags: %x\n", types[m->type], m->flags); + print_matrix_floats(m->m); + _mesa_debug(NULL, "Inverse: \n"); + if (m->inv) { + GLfloat prod[16]; + print_matrix_floats(m->inv); + matmul4(prod, m->m, m->inv); + _mesa_debug(NULL, "Mat * Inverse:\n"); + print_matrix_floats(prod); + } + else { + _mesa_debug(NULL, " - not available\n"); + } +} + +/*@}*/ + + +/** + * References an element of 4x4 matrix. + * + * \param m matrix array. + * \param c column of the desired element. + * \param r row of the desired element. + * + * \return value of the desired element. + * + * Calculate the linear storage index of the element and references it. + */ +#define MAT(m,r,c) (m)[(c)*4+(r)] + + +/**********************************************************************/ +/** \name Matrix inversion */ +/*@{*/ + +/** + * Swaps the values of two floating pointer variables. + * + * Used by invert_matrix_general() to swap the row pointers. + */ +#define SWAP_ROWS(a, b) { GLfloat *_tmp = a; (a)=(b); (b)=_tmp; } + +/** + * Compute inverse of 4x4 transformation matrix. + * + * \param mat pointer to a GLmatrix structure. The matrix inverse will be + * stored in the GLmatrix::inv attribute. + * + * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). + * + * \author + * Code contributed by Jacques Leroy jle@star.be + * + * Calculates the inverse matrix by performing the gaussian matrix reduction + * with partial pivoting followed by back/substitution with the loops manually + * unrolled. + */ +static GLboolean invert_matrix_general( GLmatrix *mat ) +{ + const GLfloat *m = mat->m; + GLfloat *out = mat->inv; + GLfloat wtmp[4][8]; + GLfloat m0, m1, m2, m3, s; + GLfloat *r0, *r1, *r2, *r3; + + r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3]; + + r0[0] = MAT(m,0,0), r0[1] = MAT(m,0,1), + r0[2] = MAT(m,0,2), r0[3] = MAT(m,0,3), + r0[4] = 1.0, r0[5] = r0[6] = r0[7] = 0.0, + + r1[0] = MAT(m,1,0), r1[1] = MAT(m,1,1), + r1[2] = MAT(m,1,2), r1[3] = MAT(m,1,3), + r1[5] = 1.0, r1[4] = r1[6] = r1[7] = 0.0, + + r2[0] = MAT(m,2,0), r2[1] = MAT(m,2,1), + r2[2] = MAT(m,2,2), r2[3] = MAT(m,2,3), + r2[6] = 1.0, r2[4] = r2[5] = r2[7] = 0.0, + + r3[0] = MAT(m,3,0), r3[1] = MAT(m,3,1), + r3[2] = MAT(m,3,2), r3[3] = MAT(m,3,3), + r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0; + + /* choose pivot - or die */ + if (FABSF(r3[0])>FABSF(r2[0])) SWAP_ROWS(r3, r2); + if (FABSF(r2[0])>FABSF(r1[0])) SWAP_ROWS(r2, r1); + if (FABSF(r1[0])>FABSF(r0[0])) SWAP_ROWS(r1, r0); + if (0.0 == r0[0]) return GL_FALSE; + + /* eliminate first variable */ + m1 = r1[0]/r0[0]; m2 = r2[0]/r0[0]; m3 = r3[0]/r0[0]; + s = r0[1]; r1[1] -= m1 * s; r2[1] -= m2 * s; r3[1] -= m3 * s; + s = r0[2]; r1[2] -= m1 * s; r2[2] -= m2 * s; r3[2] -= m3 * s; + s = r0[3]; r1[3] -= m1 * s; r2[3] -= m2 * s; r3[3] -= m3 * s; + s = r0[4]; + if (s != 0.0) { r1[4] -= m1 * s; r2[4] -= m2 * s; r3[4] -= m3 * s; } + s = r0[5]; + if (s != 0.0) { r1[5] -= m1 * s; r2[5] -= m2 * s; r3[5] -= m3 * s; } + s = r0[6]; + if (s != 0.0) { r1[6] -= m1 * s; r2[6] -= m2 * s; r3[6] -= m3 * s; } + s = r0[7]; + if (s != 0.0) { r1[7] -= m1 * s; r2[7] -= m2 * s; r3[7] -= m3 * s; } + + /* choose pivot - or die */ + if (FABSF(r3[1])>FABSF(r2[1])) SWAP_ROWS(r3, r2); + if (FABSF(r2[1])>FABSF(r1[1])) SWAP_ROWS(r2, r1); + if (0.0 == r1[1]) return GL_FALSE; + + /* eliminate second variable */ + m2 = r2[1]/r1[1]; m3 = r3[1]/r1[1]; + r2[2] -= m2 * r1[2]; r3[2] -= m3 * r1[2]; + r2[3] -= m2 * r1[3]; r3[3] -= m3 * r1[3]; + s = r1[4]; if (0.0 != s) { r2[4] -= m2 * s; r3[4] -= m3 * s; } + s = r1[5]; if (0.0 != s) { r2[5] -= m2 * s; r3[5] -= m3 * s; } + s = r1[6]; if (0.0 != s) { r2[6] -= m2 * s; r3[6] -= m3 * s; } + s = r1[7]; if (0.0 != s) { r2[7] -= m2 * s; r3[7] -= m3 * s; } + + /* choose pivot - or die */ + if (FABSF(r3[2])>FABSF(r2[2])) SWAP_ROWS(r3, r2); + if (0.0 == r2[2]) return GL_FALSE; + + /* eliminate third variable */ + m3 = r3[2]/r2[2]; + r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4], + r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6], + r3[7] -= m3 * r2[7]; + + /* last check */ + if (0.0 == r3[3]) return GL_FALSE; + + s = 1.0F/r3[3]; /* now back substitute row 3 */ + r3[4] *= s; r3[5] *= s; r3[6] *= s; r3[7] *= s; + + m2 = r2[3]; /* now back substitute row 2 */ + s = 1.0F/r2[2]; + r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2), + r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2); + m1 = r1[3]; + r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1, + r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1; + m0 = r0[3]; + r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0, + r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0; + + m1 = r1[2]; /* now back substitute row 1 */ + s = 1.0F/r1[1]; + r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1), + r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1); + m0 = r0[2]; + r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0, + r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0; + + m0 = r0[1]; /* now back substitute row 0 */ + s = 1.0F/r0[0]; + r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0), + r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0); + + MAT(out,0,0) = r0[4]; MAT(out,0,1) = r0[5], + MAT(out,0,2) = r0[6]; MAT(out,0,3) = r0[7], + MAT(out,1,0) = r1[4]; MAT(out,1,1) = r1[5], + MAT(out,1,2) = r1[6]; MAT(out,1,3) = r1[7], + MAT(out,2,0) = r2[4]; MAT(out,2,1) = r2[5], + MAT(out,2,2) = r2[6]; MAT(out,2,3) = r2[7], + MAT(out,3,0) = r3[4]; MAT(out,3,1) = r3[5], + MAT(out,3,2) = r3[6]; MAT(out,3,3) = r3[7]; + + return GL_TRUE; +} +#undef SWAP_ROWS + +/** + * Compute inverse of a general 3d transformation matrix. + * + * \param mat pointer to a GLmatrix structure. The matrix inverse will be + * stored in the GLmatrix::inv attribute. + * + * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). + * + * \author Adapted from graphics gems II. + * + * Calculates the inverse of the upper left by first calculating its + * determinant and multiplying it to the symmetric adjust matrix of each + * element. Finally deals with the translation part by transforming the + * original translation vector using by the calculated submatrix inverse. + */ +static GLboolean invert_matrix_3d_general( GLmatrix *mat ) +{ + const GLfloat *in = mat->m; + GLfloat *out = mat->inv; + GLfloat pos, neg, t; + GLfloat det; + + /* Calculate the determinant of upper left 3x3 submatrix and + * determine if the matrix is singular. + */ + pos = neg = 0.0; + t = MAT(in,0,0) * MAT(in,1,1) * MAT(in,2,2); + if (t >= 0.0) pos += t; else neg += t; + + t = MAT(in,1,0) * MAT(in,2,1) * MAT(in,0,2); + if (t >= 0.0) pos += t; else neg += t; + + t = MAT(in,2,0) * MAT(in,0,1) * MAT(in,1,2); + if (t >= 0.0) pos += t; else neg += t; + + t = -MAT(in,2,0) * MAT(in,1,1) * MAT(in,0,2); + if (t >= 0.0) pos += t; else neg += t; + + t = -MAT(in,1,0) * MAT(in,0,1) * MAT(in,2,2); + if (t >= 0.0) pos += t; else neg += t; + + t = -MAT(in,0,0) * MAT(in,2,1) * MAT(in,1,2); + if (t >= 0.0) pos += t; else neg += t; + + det = pos + neg; + + if (det*det < 1e-25) + return GL_FALSE; + + det = 1.0F / det; + MAT(out,0,0) = ( (MAT(in,1,1)*MAT(in,2,2) - MAT(in,2,1)*MAT(in,1,2) )*det); + MAT(out,0,1) = (- (MAT(in,0,1)*MAT(in,2,2) - MAT(in,2,1)*MAT(in,0,2) )*det); + MAT(out,0,2) = ( (MAT(in,0,1)*MAT(in,1,2) - MAT(in,1,1)*MAT(in,0,2) )*det); + MAT(out,1,0) = (- (MAT(in,1,0)*MAT(in,2,2) - MAT(in,2,0)*MAT(in,1,2) )*det); + MAT(out,1,1) = ( (MAT(in,0,0)*MAT(in,2,2) - MAT(in,2,0)*MAT(in,0,2) )*det); + MAT(out,1,2) = (- (MAT(in,0,0)*MAT(in,1,2) - MAT(in,1,0)*MAT(in,0,2) )*det); + MAT(out,2,0) = ( (MAT(in,1,0)*MAT(in,2,1) - MAT(in,2,0)*MAT(in,1,1) )*det); + MAT(out,2,1) = (- (MAT(in,0,0)*MAT(in,2,1) - MAT(in,2,0)*MAT(in,0,1) )*det); + MAT(out,2,2) = ( (MAT(in,0,0)*MAT(in,1,1) - MAT(in,1,0)*MAT(in,0,1) )*det); + + /* Do the translation part */ + MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0) + + MAT(in,1,3) * MAT(out,0,1) + + MAT(in,2,3) * MAT(out,0,2) ); + MAT(out,1,3) = - (MAT(in,0,3) * MAT(out,1,0) + + MAT(in,1,3) * MAT(out,1,1) + + MAT(in,2,3) * MAT(out,1,2) ); + MAT(out,2,3) = - (MAT(in,0,3) * MAT(out,2,0) + + MAT(in,1,3) * MAT(out,2,1) + + MAT(in,2,3) * MAT(out,2,2) ); + + return GL_TRUE; +} + +/** + * Compute inverse of a 3d transformation matrix. + * + * \param mat pointer to a GLmatrix structure. The matrix inverse will be + * stored in the GLmatrix::inv attribute. + * + * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). + * + * If the matrix is not an angle preserving matrix then calls + * invert_matrix_3d_general for the actual calculation. Otherwise calculates + * the inverse matrix analyzing and inverting each of the scaling, rotation and + * translation parts. + */ +static GLboolean invert_matrix_3d( GLmatrix *mat ) +{ + const GLfloat *in = mat->m; + GLfloat *out = mat->inv; + + if (!TEST_MAT_FLAGS(mat, MAT_FLAGS_ANGLE_PRESERVING)) { + return invert_matrix_3d_general( mat ); + } + + if (mat->flags & MAT_FLAG_UNIFORM_SCALE) { + GLfloat scale = (MAT(in,0,0) * MAT(in,0,0) + + MAT(in,0,1) * MAT(in,0,1) + + MAT(in,0,2) * MAT(in,0,2)); + + if (scale == 0.0) + return GL_FALSE; + + scale = 1.0F / scale; + + /* Transpose and scale the 3 by 3 upper-left submatrix. */ + MAT(out,0,0) = scale * MAT(in,0,0); + MAT(out,1,0) = scale * MAT(in,0,1); + MAT(out,2,0) = scale * MAT(in,0,2); + MAT(out,0,1) = scale * MAT(in,1,0); + MAT(out,1,1) = scale * MAT(in,1,1); + MAT(out,2,1) = scale * MAT(in,1,2); + MAT(out,0,2) = scale * MAT(in,2,0); + MAT(out,1,2) = scale * MAT(in,2,1); + MAT(out,2,2) = scale * MAT(in,2,2); + } + else if (mat->flags & MAT_FLAG_ROTATION) { + /* Transpose the 3 by 3 upper-left submatrix. */ + MAT(out,0,0) = MAT(in,0,0); + MAT(out,1,0) = MAT(in,0,1); + MAT(out,2,0) = MAT(in,0,2); + MAT(out,0,1) = MAT(in,1,0); + MAT(out,1,1) = MAT(in,1,1); + MAT(out,2,1) = MAT(in,1,2); + MAT(out,0,2) = MAT(in,2,0); + MAT(out,1,2) = MAT(in,2,1); + MAT(out,2,2) = MAT(in,2,2); + } + else { + /* pure translation */ + memcpy( out, Identity, sizeof(Identity) ); + MAT(out,0,3) = - MAT(in,0,3); + MAT(out,1,3) = - MAT(in,1,3); + MAT(out,2,3) = - MAT(in,2,3); + return GL_TRUE; + } + + if (mat->flags & MAT_FLAG_TRANSLATION) { + /* Do the translation part */ + MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0) + + MAT(in,1,3) * MAT(out,0,1) + + MAT(in,2,3) * MAT(out,0,2) ); + MAT(out,1,3) = - (MAT(in,0,3) * MAT(out,1,0) + + MAT(in,1,3) * MAT(out,1,1) + + MAT(in,2,3) * MAT(out,1,2) ); + MAT(out,2,3) = - (MAT(in,0,3) * MAT(out,2,0) + + MAT(in,1,3) * MAT(out,2,1) + + MAT(in,2,3) * MAT(out,2,2) ); + } + else { + MAT(out,0,3) = MAT(out,1,3) = MAT(out,2,3) = 0.0; + } + + return GL_TRUE; +} + +/** + * Compute inverse of an identity transformation matrix. + * + * \param mat pointer to a GLmatrix structure. The matrix inverse will be + * stored in the GLmatrix::inv attribute. + * + * \return always GL_TRUE. + * + * Simply copies Identity into GLmatrix::inv. + */ +static GLboolean invert_matrix_identity( GLmatrix *mat ) +{ + memcpy( mat->inv, Identity, sizeof(Identity) ); + return GL_TRUE; +} + +/** + * Compute inverse of a no-rotation 3d transformation matrix. + * + * \param mat pointer to a GLmatrix structure. The matrix inverse will be + * stored in the GLmatrix::inv attribute. + * + * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). + * + * Calculates the + */ +static GLboolean invert_matrix_3d_no_rot( GLmatrix *mat ) +{ + const GLfloat *in = mat->m; + GLfloat *out = mat->inv; + + if (MAT(in,0,0) == 0 || MAT(in,1,1) == 0 || MAT(in,2,2) == 0 ) + return GL_FALSE; + + memcpy( out, Identity, 16 * sizeof(GLfloat) ); + MAT(out,0,0) = 1.0F / MAT(in,0,0); + MAT(out,1,1) = 1.0F / MAT(in,1,1); + MAT(out,2,2) = 1.0F / MAT(in,2,2); + + if (mat->flags & MAT_FLAG_TRANSLATION) { + MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0)); + MAT(out,1,3) = - (MAT(in,1,3) * MAT(out,1,1)); + MAT(out,2,3) = - (MAT(in,2,3) * MAT(out,2,2)); + } + + return GL_TRUE; +} + +/** + * Compute inverse of a no-rotation 2d transformation matrix. + * + * \param mat pointer to a GLmatrix structure. The matrix inverse will be + * stored in the GLmatrix::inv attribute. + * + * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). + * + * Calculates the inverse matrix by applying the inverse scaling and + * translation to the identity matrix. + */ +static GLboolean invert_matrix_2d_no_rot( GLmatrix *mat ) +{ + const GLfloat *in = mat->m; + GLfloat *out = mat->inv; + + if (MAT(in,0,0) == 0 || MAT(in,1,1) == 0) + return GL_FALSE; + + memcpy( out, Identity, 16 * sizeof(GLfloat) ); + MAT(out,0,0) = 1.0F / MAT(in,0,0); + MAT(out,1,1) = 1.0F / MAT(in,1,1); + + if (mat->flags & MAT_FLAG_TRANSLATION) { + MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0)); + MAT(out,1,3) = - (MAT(in,1,3) * MAT(out,1,1)); + } + + return GL_TRUE; +} + +#if 0 +/* broken */ +static GLboolean invert_matrix_perspective( GLmatrix *mat ) +{ + const GLfloat *in = mat->m; + GLfloat *out = mat->inv; + + if (MAT(in,2,3) == 0) + return GL_FALSE; + + memcpy( out, Identity, 16 * sizeof(GLfloat) ); + + MAT(out,0,0) = 1.0F / MAT(in,0,0); + MAT(out,1,1) = 1.0F / MAT(in,1,1); + + MAT(out,0,3) = MAT(in,0,2); + MAT(out,1,3) = MAT(in,1,2); + + MAT(out,2,2) = 0; + MAT(out,2,3) = -1; + + MAT(out,3,2) = 1.0F / MAT(in,2,3); + MAT(out,3,3) = MAT(in,2,2) * MAT(out,3,2); + + return GL_TRUE; +} +#endif + +/** + * Matrix inversion function pointer type. + */ +typedef GLboolean (*inv_mat_func)( GLmatrix *mat ); + +/** + * Table of the matrix inversion functions according to the matrix type. + */ +static inv_mat_func inv_mat_tab[7] = { + invert_matrix_general, + invert_matrix_identity, + invert_matrix_3d_no_rot, +#if 0 + /* Don't use this function for now - it fails when the projection matrix + * is premultiplied by a translation (ala Chromium's tilesort SPU). + */ + invert_matrix_perspective, +#else + invert_matrix_general, +#endif + invert_matrix_3d, /* lazy! */ + invert_matrix_2d_no_rot, + invert_matrix_3d +}; + +/** + * Compute inverse of a transformation matrix. + * + * \param mat pointer to a GLmatrix structure. The matrix inverse will be + * stored in the GLmatrix::inv attribute. + * + * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). + * + * Calls the matrix inversion function in inv_mat_tab corresponding to the + * given matrix type. In case of failure, updates the MAT_FLAG_SINGULAR flag, + * and copies the identity matrix into GLmatrix::inv. + */ +static GLboolean matrix_invert( GLmatrix *mat ) +{ + if (inv_mat_tab[mat->type](mat)) { + mat->flags &= ~MAT_FLAG_SINGULAR; + return GL_TRUE; + } else { + mat->flags |= MAT_FLAG_SINGULAR; + memcpy( mat->inv, Identity, sizeof(Identity) ); + return GL_FALSE; + } +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Matrix generation */ +/*@{*/ + +/** + * Generate a 4x4 transformation matrix from glRotate parameters, and + * post-multiply the input matrix by it. + * + * \author + * This function was contributed by Erich Boleyn (erich@uruk.org). + * Optimizations contributed by Rudolf Opalla (rudi@khm.de). + */ +void +_math_matrix_rotate( GLmatrix *mat, + GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) +{ + GLfloat xx, yy, zz, xy, yz, zx, xs, ys, zs, one_c, s, c; + GLfloat m[16]; + GLboolean optimized; + + s = (GLfloat) sin( angle * DEG2RAD ); + c = (GLfloat) cos( angle * DEG2RAD ); + + memcpy(m, Identity, sizeof(GLfloat)*16); + optimized = GL_FALSE; + +#define M(row,col) m[col*4+row] + + if (x == 0.0F) { + if (y == 0.0F) { + if (z != 0.0F) { + optimized = GL_TRUE; + /* rotate only around z-axis */ + M(0,0) = c; + M(1,1) = c; + if (z < 0.0F) { + M(0,1) = s; + M(1,0) = -s; + } + else { + M(0,1) = -s; + M(1,0) = s; + } + } + } + else if (z == 0.0F) { + optimized = GL_TRUE; + /* rotate only around y-axis */ + M(0,0) = c; + M(2,2) = c; + if (y < 0.0F) { + M(0,2) = -s; + M(2,0) = s; + } + else { + M(0,2) = s; + M(2,0) = -s; + } + } + } + else if (y == 0.0F) { + if (z == 0.0F) { + optimized = GL_TRUE; + /* rotate only around x-axis */ + M(1,1) = c; + M(2,2) = c; + if (x < 0.0F) { + M(1,2) = s; + M(2,1) = -s; + } + else { + M(1,2) = -s; + M(2,1) = s; + } + } + } + + if (!optimized) { + const GLfloat mag = SQRTF(x * x + y * y + z * z); + + if (mag <= 1.0e-4) { + /* no rotation, leave mat as-is */ + return; + } + + x /= mag; + y /= mag; + z /= mag; + + + /* + * Arbitrary axis rotation matrix. + * + * This is composed of 5 matrices, Rz, Ry, T, Ry', Rz', multiplied + * like so: Rz * Ry * T * Ry' * Rz'. T is the final rotation + * (which is about the X-axis), and the two composite transforms + * Ry' * Rz' and Rz * Ry are (respectively) the rotations necessary + * from the arbitrary axis to the X-axis then back. They are + * all elementary rotations. + * + * Rz' is a rotation about the Z-axis, to bring the axis vector + * into the x-z plane. Then Ry' is applied, rotating about the + * Y-axis to bring the axis vector parallel with the X-axis. The + * rotation about the X-axis is then performed. Ry and Rz are + * simply the respective inverse transforms to bring the arbitrary + * axis back to its original orientation. The first transforms + * Rz' and Ry' are considered inverses, since the data from the + * arbitrary axis gives you info on how to get to it, not how + * to get away from it, and an inverse must be applied. + * + * The basic calculation used is to recognize that the arbitrary + * axis vector (x, y, z), since it is of unit length, actually + * represents the sines and cosines of the angles to rotate the + * X-axis to the same orientation, with theta being the angle about + * Z and phi the angle about Y (in the order described above) + * as follows: + * + * cos ( theta ) = x / sqrt ( 1 - z^2 ) + * sin ( theta ) = y / sqrt ( 1 - z^2 ) + * + * cos ( phi ) = sqrt ( 1 - z^2 ) + * sin ( phi ) = z + * + * Note that cos ( phi ) can further be inserted to the above + * formulas: + * + * cos ( theta ) = x / cos ( phi ) + * sin ( theta ) = y / sin ( phi ) + * + * ...etc. Because of those relations and the standard trigonometric + * relations, it is pssible to reduce the transforms down to what + * is used below. It may be that any primary axis chosen will give the + * same results (modulo a sign convention) using thie method. + * + * Particularly nice is to notice that all divisions that might + * have caused trouble when parallel to certain planes or + * axis go away with care paid to reducing the expressions. + * After checking, it does perform correctly under all cases, since + * in all the cases of division where the denominator would have + * been zero, the numerator would have been zero as well, giving + * the expected result. + */ + + xx = x * x; + yy = y * y; + zz = z * z; + xy = x * y; + yz = y * z; + zx = z * x; + xs = x * s; + ys = y * s; + zs = z * s; + one_c = 1.0F - c; + + /* We already hold the identity-matrix so we can skip some statements */ + M(0,0) = (one_c * xx) + c; + M(0,1) = (one_c * xy) - zs; + M(0,2) = (one_c * zx) + ys; +/* M(0,3) = 0.0F; */ + + M(1,0) = (one_c * xy) + zs; + M(1,1) = (one_c * yy) + c; + M(1,2) = (one_c * yz) - xs; +/* M(1,3) = 0.0F; */ + + M(2,0) = (one_c * zx) - ys; + M(2,1) = (one_c * yz) + xs; + M(2,2) = (one_c * zz) + c; +/* M(2,3) = 0.0F; */ + +/* + M(3,0) = 0.0F; + M(3,1) = 0.0F; + M(3,2) = 0.0F; + M(3,3) = 1.0F; +*/ + } +#undef M + + matrix_multf( mat, m, MAT_FLAG_ROTATION ); +} + +/** + * Apply a perspective projection matrix. + * + * \param mat matrix to apply the projection. + * \param left left clipping plane coordinate. + * \param right right clipping plane coordinate. + * \param bottom bottom clipping plane coordinate. + * \param top top clipping plane coordinate. + * \param nearval distance to the near clipping plane. + * \param farval distance to the far clipping plane. + * + * Creates the projection matrix and multiplies it with \p mat, marking the + * MAT_FLAG_PERSPECTIVE flag. + */ +void +_math_matrix_frustum( GLmatrix *mat, + GLfloat left, GLfloat right, + GLfloat bottom, GLfloat top, + GLfloat nearval, GLfloat farval ) +{ + GLfloat x, y, a, b, c, d; + GLfloat m[16]; + + x = (2.0F*nearval) / (right-left); + y = (2.0F*nearval) / (top-bottom); + a = (right+left) / (right-left); + b = (top+bottom) / (top-bottom); + c = -(farval+nearval) / ( farval-nearval); + d = -(2.0F*farval*nearval) / (farval-nearval); /* error? */ + +#define M(row,col) m[col*4+row] + M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F; + M(1,0) = 0.0F; M(1,1) = y; M(1,2) = b; M(1,3) = 0.0F; + M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = c; M(2,3) = d; + M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = -1.0F; M(3,3) = 0.0F; +#undef M + + matrix_multf( mat, m, MAT_FLAG_PERSPECTIVE ); +} + +/** + * Apply an orthographic projection matrix. + * + * \param mat matrix to apply the projection. + * \param left left clipping plane coordinate. + * \param right right clipping plane coordinate. + * \param bottom bottom clipping plane coordinate. + * \param top top clipping plane coordinate. + * \param nearval distance to the near clipping plane. + * \param farval distance to the far clipping plane. + * + * Creates the projection matrix and multiplies it with \p mat, marking the + * MAT_FLAG_GENERAL_SCALE and MAT_FLAG_TRANSLATION flags. + */ +void +_math_matrix_ortho( GLmatrix *mat, + GLfloat left, GLfloat right, + GLfloat bottom, GLfloat top, + GLfloat nearval, GLfloat farval ) +{ + GLfloat m[16]; + +#define M(row,col) m[col*4+row] + M(0,0) = 2.0F / (right-left); + M(0,1) = 0.0F; + M(0,2) = 0.0F; + M(0,3) = -(right+left) / (right-left); + + M(1,0) = 0.0F; + M(1,1) = 2.0F / (top-bottom); + M(1,2) = 0.0F; + M(1,3) = -(top+bottom) / (top-bottom); + + M(2,0) = 0.0F; + M(2,1) = 0.0F; + M(2,2) = -2.0F / (farval-nearval); + M(2,3) = -(farval+nearval) / (farval-nearval); + + M(3,0) = 0.0F; + M(3,1) = 0.0F; + M(3,2) = 0.0F; + M(3,3) = 1.0F; +#undef M + + matrix_multf( mat, m, (MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION)); +} + +/** + * Multiply a matrix with a general scaling matrix. + * + * \param mat matrix. + * \param x x axis scale factor. + * \param y y axis scale factor. + * \param z z axis scale factor. + * + * Multiplies in-place the elements of \p mat by the scale factors. Checks if + * the scales factors are roughly the same, marking the MAT_FLAG_UNIFORM_SCALE + * flag, or MAT_FLAG_GENERAL_SCALE. Marks the MAT_DIRTY_TYPE and + * MAT_DIRTY_INVERSE dirty flags. + */ +void +_math_matrix_scale( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ) +{ + GLfloat *m = mat->m; + m[0] *= x; m[4] *= y; m[8] *= z; + m[1] *= x; m[5] *= y; m[9] *= z; + m[2] *= x; m[6] *= y; m[10] *= z; + m[3] *= x; m[7] *= y; m[11] *= z; + + if (FABSF(x - y) < 1e-8 && FABSF(x - z) < 1e-8) + mat->flags |= MAT_FLAG_UNIFORM_SCALE; + else + mat->flags |= MAT_FLAG_GENERAL_SCALE; + + mat->flags |= (MAT_DIRTY_TYPE | + MAT_DIRTY_INVERSE); +} + +/** + * Multiply a matrix with a translation matrix. + * + * \param mat matrix. + * \param x translation vector x coordinate. + * \param y translation vector y coordinate. + * \param z translation vector z coordinate. + * + * Adds the translation coordinates to the elements of \p mat in-place. Marks + * the MAT_FLAG_TRANSLATION flag, and the MAT_DIRTY_TYPE and MAT_DIRTY_INVERSE + * dirty flags. + */ +void +_math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ) +{ + GLfloat *m = mat->m; + m[12] = m[0] * x + m[4] * y + m[8] * z + m[12]; + m[13] = m[1] * x + m[5] * y + m[9] * z + m[13]; + m[14] = m[2] * x + m[6] * y + m[10] * z + m[14]; + m[15] = m[3] * x + m[7] * y + m[11] * z + m[15]; + + mat->flags |= (MAT_FLAG_TRANSLATION | + MAT_DIRTY_TYPE | + MAT_DIRTY_INVERSE); +} + + +/** + * Set matrix to do viewport and depthrange mapping. + * Transforms Normalized Device Coords to window/Z values. + */ +void +_math_matrix_viewport(GLmatrix *m, GLint x, GLint y, GLint width, GLint height, + GLfloat zNear, GLfloat zFar, GLfloat depthMax) +{ + m->m[MAT_SX] = (GLfloat) width / 2.0F; + m->m[MAT_TX] = m->m[MAT_SX] + x; + m->m[MAT_SY] = (GLfloat) height / 2.0F; + m->m[MAT_TY] = m->m[MAT_SY] + y; + m->m[MAT_SZ] = depthMax * ((zFar - zNear) / 2.0F); + m->m[MAT_TZ] = depthMax * ((zFar - zNear) / 2.0F + zNear); + m->flags = MAT_FLAG_GENERAL_SCALE | MAT_FLAG_TRANSLATION; + m->type = MATRIX_3D_NO_ROT; +} + + +/** + * Set a matrix to the identity matrix. + * + * \param mat matrix. + * + * Copies ::Identity into \p GLmatrix::m, and into GLmatrix::inv if not NULL. + * Sets the matrix type to identity, and clear the dirty flags. + */ +void +_math_matrix_set_identity( GLmatrix *mat ) +{ + memcpy( mat->m, Identity, 16*sizeof(GLfloat) ); + + if (mat->inv) + memcpy( mat->inv, Identity, 16*sizeof(GLfloat) ); + + mat->type = MATRIX_IDENTITY; + mat->flags &= ~(MAT_DIRTY_FLAGS| + MAT_DIRTY_TYPE| + MAT_DIRTY_INVERSE); +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Matrix analysis */ +/*@{*/ + +#define ZERO(x) (1<m; + GLuint mask = 0; + GLuint i; + + for (i = 0 ; i < 16 ; i++) { + if (m[i] == 0.0) mask |= (1<flags &= ~MAT_FLAGS_GEOMETRY; + + /* Check for translation - no-one really cares + */ + if ((mask & MASK_NO_TRX) != MASK_NO_TRX) + mat->flags |= MAT_FLAG_TRANSLATION; + + /* Do the real work + */ + if (mask == (GLuint) MASK_IDENTITY) { + mat->type = MATRIX_IDENTITY; + } + else if ((mask & MASK_2D_NO_ROT) == (GLuint) MASK_2D_NO_ROT) { + mat->type = MATRIX_2D_NO_ROT; + + if ((mask & MASK_NO_2D_SCALE) != MASK_NO_2D_SCALE) + mat->flags |= MAT_FLAG_GENERAL_SCALE; + } + else if ((mask & MASK_2D) == (GLuint) MASK_2D) { + GLfloat mm = DOT2(m, m); + GLfloat m4m4 = DOT2(m+4,m+4); + GLfloat mm4 = DOT2(m,m+4); + + mat->type = MATRIX_2D; + + /* Check for scale */ + if (SQ(mm-1) > SQ(1e-6) || + SQ(m4m4-1) > SQ(1e-6)) + mat->flags |= MAT_FLAG_GENERAL_SCALE; + + /* Check for rotation */ + if (SQ(mm4) > SQ(1e-6)) + mat->flags |= MAT_FLAG_GENERAL_3D; + else + mat->flags |= MAT_FLAG_ROTATION; + + } + else if ((mask & MASK_3D_NO_ROT) == (GLuint) MASK_3D_NO_ROT) { + mat->type = MATRIX_3D_NO_ROT; + + /* Check for scale */ + if (SQ(m[0]-m[5]) < SQ(1e-6) && + SQ(m[0]-m[10]) < SQ(1e-6)) { + if (SQ(m[0]-1.0) > SQ(1e-6)) { + mat->flags |= MAT_FLAG_UNIFORM_SCALE; + } + } + else { + mat->flags |= MAT_FLAG_GENERAL_SCALE; + } + } + else if ((mask & MASK_3D) == (GLuint) MASK_3D) { + GLfloat c1 = DOT3(m,m); + GLfloat c2 = DOT3(m+4,m+4); + GLfloat c3 = DOT3(m+8,m+8); + GLfloat d1 = DOT3(m, m+4); + GLfloat cp[3]; + + mat->type = MATRIX_3D; + + /* Check for scale */ + if (SQ(c1-c2) < SQ(1e-6) && SQ(c1-c3) < SQ(1e-6)) { + if (SQ(c1-1.0) > SQ(1e-6)) + mat->flags |= MAT_FLAG_UNIFORM_SCALE; + /* else no scale at all */ + } + else { + mat->flags |= MAT_FLAG_GENERAL_SCALE; + } + + /* Check for rotation */ + if (SQ(d1) < SQ(1e-6)) { + CROSS3( cp, m, m+4 ); + SUB_3V( cp, cp, (m+8) ); + if (LEN_SQUARED_3FV(cp) < SQ(1e-6)) + mat->flags |= MAT_FLAG_ROTATION; + else + mat->flags |= MAT_FLAG_GENERAL_3D; + } + else { + mat->flags |= MAT_FLAG_GENERAL_3D; /* shear, etc */ + } + } + else if ((mask & MASK_PERSPECTIVE) == MASK_PERSPECTIVE && m[11]==-1.0F) { + mat->type = MATRIX_PERSPECTIVE; + mat->flags |= MAT_FLAG_GENERAL; + } + else { + mat->type = MATRIX_GENERAL; + mat->flags |= MAT_FLAG_GENERAL; + } +} + +/** + * Analyze a matrix given that its flags are accurate. + * + * This is the more common operation, hopefully. + */ +static void analyse_from_flags( GLmatrix *mat ) +{ + const GLfloat *m = mat->m; + + if (TEST_MAT_FLAGS(mat, 0)) { + mat->type = MATRIX_IDENTITY; + } + else if (TEST_MAT_FLAGS(mat, (MAT_FLAG_TRANSLATION | + MAT_FLAG_UNIFORM_SCALE | + MAT_FLAG_GENERAL_SCALE))) { + if ( m[10]==1.0F && m[14]==0.0F ) { + mat->type = MATRIX_2D_NO_ROT; + } + else { + mat->type = MATRIX_3D_NO_ROT; + } + } + else if (TEST_MAT_FLAGS(mat, MAT_FLAGS_3D)) { + if ( m[ 8]==0.0F + && m[ 9]==0.0F + && m[2]==0.0F && m[6]==0.0F && m[10]==1.0F && m[14]==0.0F) { + mat->type = MATRIX_2D; + } + else { + mat->type = MATRIX_3D; + } + } + else if ( m[4]==0.0F && m[12]==0.0F + && m[1]==0.0F && m[13]==0.0F + && m[2]==0.0F && m[6]==0.0F + && m[3]==0.0F && m[7]==0.0F && m[11]==-1.0F && m[15]==0.0F) { + mat->type = MATRIX_PERSPECTIVE; + } + else { + mat->type = MATRIX_GENERAL; + } +} + +/** + * Analyze and update a matrix. + * + * \param mat matrix. + * + * If the matrix type is dirty then calls either analyse_from_scratch() or + * analyse_from_flags() to determine its type, according to whether the flags + * are dirty or not, respectively. If the matrix has an inverse and it's dirty + * then calls matrix_invert(). Finally clears the dirty flags. + */ +void +_math_matrix_analyse( GLmatrix *mat ) +{ + if (mat->flags & MAT_DIRTY_TYPE) { + if (mat->flags & MAT_DIRTY_FLAGS) + analyse_from_scratch( mat ); + else + analyse_from_flags( mat ); + } + + if (mat->inv && (mat->flags & MAT_DIRTY_INVERSE)) { + matrix_invert( mat ); + mat->flags &= ~MAT_DIRTY_INVERSE; + } + + mat->flags &= ~(MAT_DIRTY_FLAGS | MAT_DIRTY_TYPE); +} + +/*@}*/ + + +/** + * Test if the given matrix preserves vector lengths. + */ +GLboolean +_math_matrix_is_length_preserving( const GLmatrix *m ) +{ + return TEST_MAT_FLAGS( m, MAT_FLAGS_LENGTH_PRESERVING); +} + + +/** + * Test if the given matrix does any rotation. + * (or perhaps if the upper-left 3x3 is non-identity) + */ +GLboolean +_math_matrix_has_rotation( const GLmatrix *m ) +{ + if (m->flags & (MAT_FLAG_GENERAL | + MAT_FLAG_ROTATION | + MAT_FLAG_GENERAL_3D | + MAT_FLAG_PERSPECTIVE)) + return GL_TRUE; + else + return GL_FALSE; +} + + +GLboolean +_math_matrix_is_general_scale( const GLmatrix *m ) +{ + return (m->flags & MAT_FLAG_GENERAL_SCALE) ? GL_TRUE : GL_FALSE; +} + + +GLboolean +_math_matrix_is_dirty( const GLmatrix *m ) +{ + return (m->flags & MAT_DIRTY) ? GL_TRUE : GL_FALSE; +} + + +/**********************************************************************/ +/** \name Matrix setup */ +/*@{*/ + +/** + * Copy a matrix. + * + * \param to destination matrix. + * \param from source matrix. + * + * Copies all fields in GLmatrix, creating an inverse array if necessary. + */ +void +_math_matrix_copy( GLmatrix *to, const GLmatrix *from ) +{ + memcpy( to->m, from->m, sizeof(Identity) ); + to->flags = from->flags; + to->type = from->type; + + if (to->inv != 0) { + if (from->inv == 0) { + matrix_invert( to ); + } + else { + memcpy(to->inv, from->inv, sizeof(GLfloat)*16); + } + } +} + +/** + * Loads a matrix array into GLmatrix. + * + * \param m matrix array. + * \param mat matrix. + * + * Copies \p m into GLmatrix::m and marks the MAT_FLAG_GENERAL and MAT_DIRTY + * flags. + */ +void +_math_matrix_loadf( GLmatrix *mat, const GLfloat *m ) +{ + memcpy( mat->m, m, 16*sizeof(GLfloat) ); + mat->flags = (MAT_FLAG_GENERAL | MAT_DIRTY); +} + +/** + * Matrix constructor. + * + * \param m matrix. + * + * Initialize the GLmatrix fields. + */ +void +_math_matrix_ctr( GLmatrix *m ) +{ + m->m = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 ); + if (m->m) + memcpy( m->m, Identity, sizeof(Identity) ); + m->inv = NULL; + m->type = MATRIX_IDENTITY; + m->flags = 0; +} + +/** + * Matrix destructor. + * + * \param m matrix. + * + * Frees the data in a GLmatrix. + */ +void +_math_matrix_dtr( GLmatrix *m ) +{ + if (m->m) { + _mesa_align_free( m->m ); + m->m = NULL; + } + if (m->inv) { + _mesa_align_free( m->inv ); + m->inv = NULL; + } +} + +/** + * Allocate a matrix inverse. + * + * \param m matrix. + * + * Allocates the matrix inverse, GLmatrix::inv, and sets it to Identity. + */ +void +_math_matrix_alloc_inv( GLmatrix *m ) +{ + if (!m->inv) { + m->inv = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 ); + if (m->inv) + memcpy( m->inv, Identity, 16 * sizeof(GLfloat) ); + } +} + +/*@}*/ + + +/**********************************************************************/ +/** \name Matrix transpose */ +/*@{*/ + +/** + * Transpose a GLfloat matrix. + * + * \param to destination array. + * \param from source array. + */ +void +_math_transposef( GLfloat to[16], const GLfloat from[16] ) +{ + to[0] = from[0]; + to[1] = from[4]; + to[2] = from[8]; + to[3] = from[12]; + to[4] = from[1]; + to[5] = from[5]; + to[6] = from[9]; + to[7] = from[13]; + to[8] = from[2]; + to[9] = from[6]; + to[10] = from[10]; + to[11] = from[14]; + to[12] = from[3]; + to[13] = from[7]; + to[14] = from[11]; + to[15] = from[15]; +} + +/** + * Transpose a GLdouble matrix. + * + * \param to destination array. + * \param from source array. + */ +void +_math_transposed( GLdouble to[16], const GLdouble from[16] ) +{ + to[0] = from[0]; + to[1] = from[4]; + to[2] = from[8]; + to[3] = from[12]; + to[4] = from[1]; + to[5] = from[5]; + to[6] = from[9]; + to[7] = from[13]; + to[8] = from[2]; + to[9] = from[6]; + to[10] = from[10]; + to[11] = from[14]; + to[12] = from[3]; + to[13] = from[7]; + to[14] = from[11]; + to[15] = from[15]; +} + +/** + * Transpose a GLdouble matrix and convert to GLfloat. + * + * \param to destination array. + * \param from source array. + */ +void +_math_transposefd( GLfloat to[16], const GLdouble from[16] ) +{ + to[0] = (GLfloat) from[0]; + to[1] = (GLfloat) from[4]; + to[2] = (GLfloat) from[8]; + to[3] = (GLfloat) from[12]; + to[4] = (GLfloat) from[1]; + to[5] = (GLfloat) from[5]; + to[6] = (GLfloat) from[9]; + to[7] = (GLfloat) from[13]; + to[8] = (GLfloat) from[2]; + to[9] = (GLfloat) from[6]; + to[10] = (GLfloat) from[10]; + to[11] = (GLfloat) from[14]; + to[12] = (GLfloat) from[3]; + to[13] = (GLfloat) from[7]; + to[14] = (GLfloat) from[11]; + to[15] = (GLfloat) from[15]; +} + +/*@}*/ + + +/** + * Transform a 4-element row vector (1x4 matrix) by a 4x4 matrix. This + * function is used for transforming clipping plane equations and spotlight + * directions. + * Mathematically, u = v * m. + * Input: v - input vector + * m - transformation matrix + * Output: u - transformed vector + */ +void +_mesa_transform_vector( GLfloat u[4], const GLfloat v[4], const GLfloat m[16] ) +{ + const GLfloat v0 = v[0], v1 = v[1], v2 = v[2], v3 = v[3]; +#define M(row,col) m[row + col*4] + u[0] = v0 * M(0,0) + v1 * M(1,0) + v2 * M(2,0) + v3 * M(3,0); + u[1] = v0 * M(0,1) + v1 * M(1,1) + v2 * M(2,1) + v3 * M(3,1); + u[2] = v0 * M(0,2) + v1 * M(1,2) + v2 * M(2,2) + v3 * M(3,2); + u[3] = v0 * M(0,3) + v1 * M(1,3) + v2 * M(2,3) + v3 * M(3,3); +#undef M +} diff --git a/mesalib/src/mesa/math/m_vector.c b/mesalib/src/mesa/math/m_vector.c index 7ca08f4c0..4bded31e0 100644 --- a/mesalib/src/mesa/math/m_vector.c +++ b/mesalib/src/mesa/math/m_vector.c @@ -1,184 +1,184 @@ -/* - * 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. - */ - -/* - * New (3.1) transformation code written by Keith Whitwell. - */ - - -#include "main/glheader.h" -#include "main/imports.h" -#include "main/macros.h" - -#include "m_vector.h" - - - -/** - * Given a vector [count][4] of floats, set all the [][elt] values - * to 0 (if elt = 0, 1, 2) or 1.0 (if elt = 3). - */ -void -_mesa_vector4f_clean_elem( GLvector4f *vec, GLuint count, GLuint elt ) -{ - static const GLubyte elem_bits[4] = { - VEC_DIRTY_0, - VEC_DIRTY_1, - VEC_DIRTY_2, - VEC_DIRTY_3 - }; - static const GLfloat clean[4] = { 0, 0, 0, 1 }; - const GLfloat v = clean[elt]; - GLfloat (*data)[4] = (GLfloat (*)[4])vec->start; - GLuint i; - - for (i = 0; i < count; i++) - data[i][elt] = v; - - vec->flags &= ~elem_bits[elt]; -} - - -static const GLubyte size_bits[5] = { - 0, - VEC_SIZE_1, - VEC_SIZE_2, - VEC_SIZE_3, - VEC_SIZE_4, -}; - - -/** - * Initialize GLvector objects. - * \param v the vector object to initialize. - * \param flags bitwise-OR of VEC_* flags - * \param storage pointer to storage for the vector's data - */ -void -_mesa_vector4f_init( GLvector4f *v, GLbitfield flags, GLfloat (*storage)[4] ) -{ - v->stride = 4 * sizeof(GLfloat); - v->size = 2; /* may change: 2-4 for vertices and 1-4 for texcoords */ - v->data = storage; - v->start = (GLfloat *) storage; - v->count = 0; - v->flags = size_bits[4] | flags; -} - - -/** - * Initialize GLvector objects and allocate storage. - * \param v the vector object - * \param flags bitwise-OR of VEC_* flags - * \param count number of elements to allocate in vector - * \param alignment desired memory alignment for the data (in bytes) - */ -void -_mesa_vector4f_alloc( GLvector4f *v, GLbitfield flags, GLuint count, - GLuint alignment ) -{ - v->stride = 4 * sizeof(GLfloat); - v->size = 2; - v->storage = _mesa_align_malloc( count * 4 * sizeof(GLfloat), alignment ); - v->storage_count = count; - v->start = (GLfloat *) v->storage; - v->data = (GLfloat (*)[4]) v->storage; - v->count = 0; - v->flags = size_bits[4] | flags | VEC_MALLOC; -} - - -/** - * Vector deallocation. Free whatever memory is pointed to by the - * vector's storage field if the VEC_MALLOC flag is set. - * DO NOT free the GLvector object itself, though. - */ -void -_mesa_vector4f_free( GLvector4f *v ) -{ - if (v->flags & VEC_MALLOC) { - _mesa_align_free( v->storage ); - v->data = NULL; - v->start = NULL; - v->storage = NULL; - v->flags &= ~VEC_MALLOC; - } -} - - -/** - * For debugging - */ -void -_mesa_vector4f_print( const GLvector4f *v, const GLubyte *cullmask, - GLboolean culling ) -{ - static const GLfloat c[4] = { 0, 0, 0, 1 }; - static const char *templates[5] = { - "%d:\t0, 0, 0, 1\n", - "%d:\t%f, 0, 0, 1\n", - "%d:\t%f, %f, 0, 1\n", - "%d:\t%f, %f, %f, 1\n", - "%d:\t%f, %f, %f, %f\n" - }; - - const char *t = templates[v->size]; - GLfloat *d = (GLfloat *)v->data; - GLuint j, i = 0, count; - - printf("data-start\n"); - for (; d != v->start; STRIDE_F(d, v->stride), i++) - printf(t, i, d[0], d[1], d[2], d[3]); - - printf("start-count(%u)\n", v->count); - count = i + v->count; - - if (culling) { - for (; i < count; STRIDE_F(d, v->stride), i++) - if (cullmask[i]) - printf(t, i, d[0], d[1], d[2], d[3]); - } - else { - for (; i < count; STRIDE_F(d, v->stride), i++) - printf(t, i, d[0], d[1], d[2], d[3]); - } - - for (j = v->size; j < 4; j++) { - if ((v->flags & (1<data; - i < count && d[j] == c[j]; - i++, STRIDE_F(d, v->stride)) { - /* no-op */ - } - - if (i == count) - printf(" --> ok\n"); - else - printf(" --> Failed at %u ******\n", i); - } - } -} +/* + * 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. + */ + +/* + * New (3.1) transformation code written by Keith Whitwell. + */ + + +#include "main/glheader.h" +#include "main/imports.h" +#include "main/macros.h" + +#include "m_vector.h" + + + +/** + * Given a vector [count][4] of floats, set all the [][elt] values + * to 0 (if elt = 0, 1, 2) or 1.0 (if elt = 3). + */ +void +_mesa_vector4f_clean_elem( GLvector4f *vec, GLuint count, GLuint elt ) +{ + static const GLubyte elem_bits[4] = { + VEC_DIRTY_0, + VEC_DIRTY_1, + VEC_DIRTY_2, + VEC_DIRTY_3 + }; + static const GLfloat clean[4] = { 0, 0, 0, 1 }; + const GLfloat v = clean[elt]; + GLfloat (*data)[4] = (GLfloat (*)[4])vec->start; + GLuint i; + + for (i = 0; i < count; i++) + data[i][elt] = v; + + vec->flags &= ~elem_bits[elt]; +} + + +static const GLubyte size_bits[5] = { + 0, + VEC_SIZE_1, + VEC_SIZE_2, + VEC_SIZE_3, + VEC_SIZE_4, +}; + + +/** + * Initialize GLvector objects. + * \param v the vector object to initialize. + * \param flags bitwise-OR of VEC_* flags + * \param storage pointer to storage for the vector's data + */ +void +_mesa_vector4f_init( GLvector4f *v, GLbitfield flags, GLfloat (*storage)[4] ) +{ + v->stride = 4 * sizeof(GLfloat); + v->size = 2; /* may change: 2-4 for vertices and 1-4 for texcoords */ + v->data = storage; + v->start = (GLfloat *) storage; + v->count = 0; + v->flags = size_bits[4] | flags; +} + + +/** + * Initialize GLvector objects and allocate storage. + * \param v the vector object + * \param flags bitwise-OR of VEC_* flags + * \param count number of elements to allocate in vector + * \param alignment desired memory alignment for the data (in bytes) + */ +void +_mesa_vector4f_alloc( GLvector4f *v, GLbitfield flags, GLuint count, + GLuint alignment ) +{ + v->stride = 4 * sizeof(GLfloat); + v->size = 2; + v->storage = _mesa_align_malloc( count * 4 * sizeof(GLfloat), alignment ); + v->storage_count = count; + v->start = (GLfloat *) v->storage; + v->data = (GLfloat (*)[4]) v->storage; + v->count = 0; + v->flags = size_bits[4] | flags | VEC_MALLOC; +} + + +/** + * Vector deallocation. Free whatever memory is pointed to by the + * vector's storage field if the VEC_MALLOC flag is set. + * DO NOT free the GLvector object itself, though. + */ +void +_mesa_vector4f_free( GLvector4f *v ) +{ + if (v->flags & VEC_MALLOC) { + _mesa_align_free( v->storage ); + v->data = NULL; + v->start = NULL; + v->storage = NULL; + v->flags &= ~VEC_MALLOC; + } +} + + +/** + * For debugging + */ +void +_mesa_vector4f_print( const GLvector4f *v, const GLubyte *cullmask, + GLboolean culling ) +{ + static const GLfloat c[4] = { 0, 0, 0, 1 }; + static const char *templates[5] = { + "%d:\t0, 0, 0, 1\n", + "%d:\t%f, 0, 0, 1\n", + "%d:\t%f, %f, 0, 1\n", + "%d:\t%f, %f, %f, 1\n", + "%d:\t%f, %f, %f, %f\n" + }; + + const char *t = templates[v->size]; + GLfloat *d = (GLfloat *)v->data; + GLuint j, i = 0, count; + + printf("data-start\n"); + for (; d != v->start; STRIDE_F(d, v->stride), i++) + printf(t, i, d[0], d[1], d[2], d[3]); + + printf("start-count(%u)\n", v->count); + count = i + v->count; + + if (culling) { + for (; i < count; STRIDE_F(d, v->stride), i++) + if (cullmask[i]) + printf(t, i, d[0], d[1], d[2], d[3]); + } + else { + for (; i < count; STRIDE_F(d, v->stride), i++) + printf(t, i, d[0], d[1], d[2], d[3]); + } + + for (j = v->size; j < 4; j++) { + if ((v->flags & (1<data; + i < count && d[j] == c[j]; + i++, STRIDE_F(d, v->stride)) { + /* no-op */ + } + + if (i == count) + printf(" --> ok\n"); + else + printf(" --> Failed at %u ******\n", i); + } + } +} diff --git a/mesalib/src/mesa/program/.gitignore b/mesalib/src/mesa/program/.gitignore new file mode 100644 index 000000000..4c20872e1 --- /dev/null +++ b/mesalib/src/mesa/program/.gitignore @@ -0,0 +1,4 @@ +program_parse.output +lex.yy.c +program_parse.tab.c +program_parse.tab.h diff --git a/mesalib/src/mesa/program/arbprogparse.h b/mesalib/src/mesa/program/arbprogparse.h index a9fe1e941..4c0c30072 100644 --- a/mesalib/src/mesa/program/arbprogparse.h +++ b/mesalib/src/mesa/program/arbprogparse.h @@ -1,45 +1,45 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * 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. - */ - - -#ifndef ARBPROGPARSE_H -#define ARBPROGPARSE_H - -#include "main/glheader.h" - -struct gl_context; -struct gl_fragment_program; -struct gl_vertex_program; - -extern void -_mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target, - const GLvoid *str, GLsizei len, - struct gl_vertex_program *program); - -extern void -_mesa_parse_arb_fragment_program(struct gl_context *ctx, GLenum target, - const GLvoid *str, GLsizei len, - struct gl_fragment_program *program); - -#endif +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * 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. + */ + + +#ifndef ARBPROGPARSE_H +#define ARBPROGPARSE_H + +#include "main/glheader.h" + +struct gl_context; +struct gl_fragment_program; +struct gl_vertex_program; + +extern void +_mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target, + const GLvoid *str, GLsizei len, + struct gl_vertex_program *program); + +extern void +_mesa_parse_arb_fragment_program(struct gl_context *ctx, GLenum target, + const GLvoid *str, GLsizei len, + struct gl_fragment_program *program); + +#endif diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index c021c6956..224540005 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -1407,6 +1407,11 @@ ir_to_mesa_visitor::visit(ir_expression *ir) emit(ir, OPCODE_SNE, result_dst, op[0], src_reg_for_float(0.0)); break; + case ir_unop_bitcast_f2i: // Ignore these 4, they can't happen here anyway + case ir_unop_bitcast_f2u: + case ir_unop_bitcast_i2f: + case ir_unop_bitcast_u2f: + break; case ir_unop_trunc: emit(ir, OPCODE_TRUNC, result_dst, op[0]); break; diff --git a/mesalib/src/mesa/program/nvfragparse.h b/mesalib/src/mesa/program/nvfragparse.h index a8ab8d6fe..088e7527d 100644 --- a/mesalib/src/mesa/program/nvfragparse.h +++ b/mesalib/src/mesa/program/nvfragparse.h @@ -1,47 +1,47 @@ - -/* - * 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. - * - * Authors: - * Brian Paul - */ - - -#ifndef NVFRAGPARSE_H -#define NVFRAGPARSE_H - -#include "main/glheader.h" - -struct gl_context; -struct gl_fragment_program; - -extern void -_mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum target, - const GLubyte *str, GLsizei len, - struct gl_fragment_program *program); - - -extern const char * -_mesa_nv_fragment_input_register_name(GLuint i); - -#endif + +/* + * 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. + * + * Authors: + * Brian Paul + */ + + +#ifndef NVFRAGPARSE_H +#define NVFRAGPARSE_H + +#include "main/glheader.h" + +struct gl_context; +struct gl_fragment_program; + +extern void +_mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum target, + const GLubyte *str, GLsizei len, + struct gl_fragment_program *program); + + +extern const char * +_mesa_nv_fragment_input_register_name(GLuint i); + +#endif diff --git a/mesalib/src/mesa/program/nvvertparse.h b/mesalib/src/mesa/program/nvvertparse.h index bee6dea3c..7318e1494 100644 --- a/mesalib/src/mesa/program/nvvertparse.h +++ b/mesalib/src/mesa/program/nvvertparse.h @@ -1,49 +1,49 @@ -/* - * 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: - * Brian Paul - */ - - -#ifndef NVVERTPARSE_H -#define NVVERTPARSE_H - -#include "main/glheader.h" - -struct gl_context; -struct gl_vertex_program; - -extern void -_mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum target, - const GLubyte *str, GLsizei len, - struct gl_vertex_program *program); - - -extern const char * -_mesa_nv_vertex_input_register_name(GLuint i); - -extern const char * -_mesa_nv_vertex_output_register_name(GLuint i); - -#endif +/* + * 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: + * Brian Paul + */ + + +#ifndef NVVERTPARSE_H +#define NVVERTPARSE_H + +#include "main/glheader.h" + +struct gl_context; +struct gl_vertex_program; + +extern void +_mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum target, + const GLubyte *str, GLsizei len, + struct gl_vertex_program *program); + + +extern const char * +_mesa_nv_vertex_input_register_name(GLuint i); + +extern const char * +_mesa_nv_vertex_output_register_name(GLuint i); + +#endif diff --git a/mesalib/src/mesa/program/prog_cache.c b/mesalib/src/mesa/program/prog_cache.c index 398cd5e6d..2ccedb5d7 100644 --- a/mesalib/src/mesa/program/prog_cache.c +++ b/mesalib/src/mesa/program/prog_cache.c @@ -1,251 +1,251 @@ -/************************************************************************** - * - * 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 "main/glheader.h" -#include "main/mtypes.h" -#include "main/imports.h" -#include "main/shaderobj.h" -#include "program/prog_cache.h" -#include "program/program.h" - - -struct cache_item -{ - GLuint hash; - void *key; - struct gl_program *program; - struct cache_item *next; -}; - -struct gl_program_cache -{ - struct cache_item **items; - struct cache_item *last; - GLuint size, n_items; -}; - - - -/** - * Compute hash index from state key. - */ -static GLuint -hash_key(const void *key, GLuint key_size) -{ - const GLuint *ikey = (const GLuint *) key; - GLuint hash = 0, i; - - assert(key_size >= 4); - - /* Make a slightly better attempt at a hash function: - */ - for (i = 0; i < key_size / sizeof(*ikey); i++) - { - hash += ikey[i]; - hash += (hash << 10); - hash ^= (hash >> 6); - } - - return hash; -} - - -/** - * Rebuild/expand the hash table to accomodate more entries - */ -static void -rehash(struct gl_program_cache *cache) -{ - struct cache_item **items; - struct cache_item *c, *next; - GLuint size, i; - - cache->last = NULL; - - size = cache->size * 3; - items = (struct cache_item**) malloc(size * sizeof(*items)); - memset(items, 0, size * sizeof(*items)); - - for (i = 0; i < cache->size; i++) - for (c = cache->items[i]; c; c = next) { - next = c->next; - c->next = items[c->hash % size]; - items[c->hash % size] = c; - } - - free(cache->items); - cache->items = items; - cache->size = size; -} - - -static void -clear_cache(struct gl_context *ctx, struct gl_program_cache *cache, - GLboolean shader) -{ - struct cache_item *c, *next; - GLuint i; - - cache->last = NULL; - - for (i = 0; i < cache->size; i++) { - for (c = cache->items[i]; c; c = next) { - next = c->next; - free(c->key); - if (shader) { - _mesa_reference_shader_program(ctx, - (struct gl_shader_program **)&c->program, - NULL); - } else { - _mesa_reference_program(ctx, &c->program, NULL); - } - free(c); - } - cache->items[i] = NULL; - } - - - cache->n_items = 0; -} - - - -struct gl_program_cache * -_mesa_new_program_cache(void) -{ - struct gl_program_cache *cache = CALLOC_STRUCT(gl_program_cache); - if (cache) { - cache->size = 17; - cache->items = (struct cache_item **) - calloc(1, cache->size * sizeof(struct cache_item)); - if (!cache->items) { - free(cache); - return NULL; - } - } - return cache; -} - - -void -_mesa_delete_program_cache(struct gl_context *ctx, struct gl_program_cache *cache) -{ - clear_cache(ctx, cache, GL_FALSE); - free(cache->items); - free(cache); -} - -void -_mesa_delete_shader_cache(struct gl_context *ctx, - struct gl_program_cache *cache) -{ - clear_cache(ctx, cache, GL_TRUE); - free(cache->items); - free(cache); -} - - -struct gl_program * -_mesa_search_program_cache(struct gl_program_cache *cache, - const void *key, GLuint keysize) -{ - if (cache->last && - memcmp(cache->last->key, key, keysize) == 0) { - return cache->last->program; - } - else { - const GLuint hash = hash_key(key, keysize); - struct cache_item *c; - - for (c = cache->items[hash % cache->size]; c; c = c->next) { - if (c->hash == hash && memcmp(c->key, key, keysize) == 0) { - cache->last = c; - return c->program; - } - } - - return NULL; - } -} - - -void -_mesa_program_cache_insert(struct gl_context *ctx, - struct gl_program_cache *cache, - const void *key, GLuint keysize, - struct gl_program *program) -{ - const GLuint hash = hash_key(key, keysize); - struct cache_item *c = CALLOC_STRUCT(cache_item); - - c->hash = hash; - - c->key = malloc(keysize); - memcpy(c->key, key, keysize); - - c->program = program; /* no refcount change */ - - if (cache->n_items > cache->size * 1.5) { - if (cache->size < 1000) - rehash(cache); - else - clear_cache(ctx, cache, GL_FALSE); - } - - cache->n_items++; - c->next = cache->items[hash % cache->size]; - cache->items[hash % cache->size] = c; -} - -void -_mesa_shader_cache_insert(struct gl_context *ctx, - struct gl_program_cache *cache, - const void *key, GLuint keysize, - struct gl_shader_program *program) -{ - const GLuint hash = hash_key(key, keysize); - struct cache_item *c = CALLOC_STRUCT(cache_item); - - c->hash = hash; - - c->key = malloc(keysize); - memcpy(c->key, key, keysize); - - c->program = (struct gl_program *)program; /* no refcount change */ - - if (cache->n_items > cache->size * 1.5) { - if (cache->size < 1000) - rehash(cache); - else - clear_cache(ctx, cache, GL_TRUE); - } - - cache->n_items++; - c->next = cache->items[hash % cache->size]; - cache->items[hash % cache->size] = c; -} +/************************************************************************** + * + * 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 "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/shaderobj.h" +#include "program/prog_cache.h" +#include "program/program.h" + + +struct cache_item +{ + GLuint hash; + void *key; + struct gl_program *program; + struct cache_item *next; +}; + +struct gl_program_cache +{ + struct cache_item **items; + struct cache_item *last; + GLuint size, n_items; +}; + + + +/** + * Compute hash index from state key. + */ +static GLuint +hash_key(const void *key, GLuint key_size) +{ + const GLuint *ikey = (const GLuint *) key; + GLuint hash = 0, i; + + assert(key_size >= 4); + + /* Make a slightly better attempt at a hash function: + */ + for (i = 0; i < key_size / sizeof(*ikey); i++) + { + hash += ikey[i]; + hash += (hash << 10); + hash ^= (hash >> 6); + } + + return hash; +} + + +/** + * Rebuild/expand the hash table to accomodate more entries + */ +static void +rehash(struct gl_program_cache *cache) +{ + struct cache_item **items; + struct cache_item *c, *next; + GLuint size, i; + + cache->last = NULL; + + size = cache->size * 3; + items = (struct cache_item**) malloc(size * sizeof(*items)); + memset(items, 0, size * sizeof(*items)); + + for (i = 0; i < cache->size; i++) + for (c = cache->items[i]; c; c = next) { + next = c->next; + c->next = items[c->hash % size]; + items[c->hash % size] = c; + } + + free(cache->items); + cache->items = items; + cache->size = size; +} + + +static void +clear_cache(struct gl_context *ctx, struct gl_program_cache *cache, + GLboolean shader) +{ + struct cache_item *c, *next; + GLuint i; + + cache->last = NULL; + + for (i = 0; i < cache->size; i++) { + for (c = cache->items[i]; c; c = next) { + next = c->next; + free(c->key); + if (shader) { + _mesa_reference_shader_program(ctx, + (struct gl_shader_program **)&c->program, + NULL); + } else { + _mesa_reference_program(ctx, &c->program, NULL); + } + free(c); + } + cache->items[i] = NULL; + } + + + cache->n_items = 0; +} + + + +struct gl_program_cache * +_mesa_new_program_cache(void) +{ + struct gl_program_cache *cache = CALLOC_STRUCT(gl_program_cache); + if (cache) { + cache->size = 17; + cache->items = (struct cache_item **) + calloc(1, cache->size * sizeof(struct cache_item)); + if (!cache->items) { + free(cache); + return NULL; + } + } + return cache; +} + + +void +_mesa_delete_program_cache(struct gl_context *ctx, struct gl_program_cache *cache) +{ + clear_cache(ctx, cache, GL_FALSE); + free(cache->items); + free(cache); +} + +void +_mesa_delete_shader_cache(struct gl_context *ctx, + struct gl_program_cache *cache) +{ + clear_cache(ctx, cache, GL_TRUE); + free(cache->items); + free(cache); +} + + +struct gl_program * +_mesa_search_program_cache(struct gl_program_cache *cache, + const void *key, GLuint keysize) +{ + if (cache->last && + memcmp(cache->last->key, key, keysize) == 0) { + return cache->last->program; + } + else { + const GLuint hash = hash_key(key, keysize); + struct cache_item *c; + + for (c = cache->items[hash % cache->size]; c; c = c->next) { + if (c->hash == hash && memcmp(c->key, key, keysize) == 0) { + cache->last = c; + return c->program; + } + } + + return NULL; + } +} + + +void +_mesa_program_cache_insert(struct gl_context *ctx, + struct gl_program_cache *cache, + const void *key, GLuint keysize, + struct gl_program *program) +{ + const GLuint hash = hash_key(key, keysize); + struct cache_item *c = CALLOC_STRUCT(cache_item); + + c->hash = hash; + + c->key = malloc(keysize); + memcpy(c->key, key, keysize); + + c->program = program; /* no refcount change */ + + if (cache->n_items > cache->size * 1.5) { + if (cache->size < 1000) + rehash(cache); + else + clear_cache(ctx, cache, GL_FALSE); + } + + cache->n_items++; + c->next = cache->items[hash % cache->size]; + cache->items[hash % cache->size] = c; +} + +void +_mesa_shader_cache_insert(struct gl_context *ctx, + struct gl_program_cache *cache, + const void *key, GLuint keysize, + struct gl_shader_program *program) +{ + const GLuint hash = hash_key(key, keysize); + struct cache_item *c = CALLOC_STRUCT(cache_item); + + c->hash = hash; + + c->key = malloc(keysize); + memcpy(c->key, key, keysize); + + c->program = (struct gl_program *)program; /* no refcount change */ + + if (cache->n_items > cache->size * 1.5) { + if (cache->size < 1000) + rehash(cache); + else + clear_cache(ctx, cache, GL_TRUE); + } + + cache->n_items++; + c->next = cache->items[hash % cache->size]; + cache->items[hash % cache->size] = c; +} diff --git a/mesalib/src/mesa/program/prog_cache.h b/mesalib/src/mesa/program/prog_cache.h index e7ec8d39a..5d46bfc5c 100644 --- a/mesalib/src/mesa/program/prog_cache.h +++ b/mesalib/src/mesa/program/prog_cache.h @@ -1,68 +1,68 @@ -/************************************************************************** - * - * 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 PROG_CACHE_H -#define PROG_CACHE_H - - -#include "main/glheader.h" - -struct gl_context; - -/** Opaque type */ -struct gl_program_cache; - - -extern struct gl_program_cache * -_mesa_new_program_cache(void); - -extern void -_mesa_delete_program_cache(struct gl_context *ctx, struct gl_program_cache *pc); - -extern void -_mesa_delete_shader_cache(struct gl_context *ctx, - struct gl_program_cache *cache); - -extern struct gl_program * -_mesa_search_program_cache(struct gl_program_cache *cache, - const void *key, GLuint keysize); - -extern void -_mesa_program_cache_insert(struct gl_context *ctx, - struct gl_program_cache *cache, - const void *key, GLuint keysize, - struct gl_program *program); - -void -_mesa_shader_cache_insert(struct gl_context *ctx, - struct gl_program_cache *cache, - const void *key, GLuint keysize, - struct gl_shader_program *program); - - -#endif /* PROG_CACHE_H */ +/************************************************************************** + * + * 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 PROG_CACHE_H +#define PROG_CACHE_H + + +#include "main/glheader.h" + +struct gl_context; + +/** Opaque type */ +struct gl_program_cache; + + +extern struct gl_program_cache * +_mesa_new_program_cache(void); + +extern void +_mesa_delete_program_cache(struct gl_context *ctx, struct gl_program_cache *pc); + +extern void +_mesa_delete_shader_cache(struct gl_context *ctx, + struct gl_program_cache *cache); + +extern struct gl_program * +_mesa_search_program_cache(struct gl_program_cache *cache, + const void *key, GLuint keysize); + +extern void +_mesa_program_cache_insert(struct gl_context *ctx, + struct gl_program_cache *cache, + const void *key, GLuint keysize, + struct gl_program *program); + +void +_mesa_shader_cache_insert(struct gl_context *ctx, + struct gl_program_cache *cache, + const void *key, GLuint keysize, + struct gl_shader_program *program); + + +#endif /* PROG_CACHE_H */ diff --git a/mesalib/src/mesa/program/sampler.h b/mesalib/src/mesa/program/sampler.h index c76d7077b..22467e990 100644 --- a/mesalib/src/mesa/program/sampler.h +++ b/mesalib/src/mesa/program/sampler.h @@ -1,29 +1,29 @@ -/* - * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. - * Copyright (C) 2008 VMware, Inc. All Rights Reserved. - * Copyright © 2010 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -int -_mesa_get_sampler_uniform_value(class ir_dereference *sampler, - struct gl_shader_program *shader_program, - const struct gl_program *prog); +/* + * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. + * Copyright (C) 2008 VMware, Inc. All Rights Reserved. + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +int +_mesa_get_sampler_uniform_value(class ir_dereference *sampler, + struct gl_shader_program *shader_program, + const struct gl_program *prog); diff --git a/mesalib/src/mesa/program/symbol_table.h b/mesalib/src/mesa/program/symbol_table.h index 1de29a8f0..f9d91649b 100644 --- a/mesalib/src/mesa/program/symbol_table.h +++ b/mesalib/src/mesa/program/symbol_table.h @@ -1,62 +1,62 @@ -/* - * Copyright © 2008 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -#ifndef MESA_SYMBOL_TABLE_H -#define MESA_SYMBOL_TABLE_H - -struct _mesa_symbol_table; -struct _mesa_symbol_table_iterator; - -extern void _mesa_symbol_table_push_scope(struct _mesa_symbol_table *table); - -extern void _mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table); - -extern int _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *symtab, - int name_space, const char *name, void *declaration); - -extern int _mesa_symbol_table_add_global_symbol( - struct _mesa_symbol_table *symtab, int name_space, const char *name, - void *declaration); - -extern int _mesa_symbol_table_symbol_scope(struct _mesa_symbol_table *table, - int name_space, const char *name); - -extern void *_mesa_symbol_table_find_symbol( - struct _mesa_symbol_table *symtab, int name_space, const char *name); - -extern struct _mesa_symbol_table *_mesa_symbol_table_ctor(void); - -extern void _mesa_symbol_table_dtor(struct _mesa_symbol_table *); - -extern struct _mesa_symbol_table_iterator *_mesa_symbol_table_iterator_ctor( - struct _mesa_symbol_table *table, int name_space, const char *name); - -extern void _mesa_symbol_table_iterator_dtor( - struct _mesa_symbol_table_iterator *); - -extern void *_mesa_symbol_table_iterator_get( - struct _mesa_symbol_table_iterator *iter); - -extern int _mesa_symbol_table_iterator_next( - struct _mesa_symbol_table_iterator *iter); - -#endif /* MESA_SYMBOL_TABLE_H */ +/* + * Copyright © 2008 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#ifndef MESA_SYMBOL_TABLE_H +#define MESA_SYMBOL_TABLE_H + +struct _mesa_symbol_table; +struct _mesa_symbol_table_iterator; + +extern void _mesa_symbol_table_push_scope(struct _mesa_symbol_table *table); + +extern void _mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table); + +extern int _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *symtab, + int name_space, const char *name, void *declaration); + +extern int _mesa_symbol_table_add_global_symbol( + struct _mesa_symbol_table *symtab, int name_space, const char *name, + void *declaration); + +extern int _mesa_symbol_table_symbol_scope(struct _mesa_symbol_table *table, + int name_space, const char *name); + +extern void *_mesa_symbol_table_find_symbol( + struct _mesa_symbol_table *symtab, int name_space, const char *name); + +extern struct _mesa_symbol_table *_mesa_symbol_table_ctor(void); + +extern void _mesa_symbol_table_dtor(struct _mesa_symbol_table *); + +extern struct _mesa_symbol_table_iterator *_mesa_symbol_table_iterator_ctor( + struct _mesa_symbol_table *table, int name_space, const char *name); + +extern void _mesa_symbol_table_iterator_dtor( + struct _mesa_symbol_table_iterator *); + +extern void *_mesa_symbol_table_iterator_get( + struct _mesa_symbol_table_iterator *iter); + +extern int _mesa_symbol_table_iterator_next( + struct _mesa_symbol_table_iterator *iter); + +#endif /* MESA_SYMBOL_TABLE_H */ diff --git a/mesalib/src/mesa/state_tracker/Makefile b/mesalib/src/mesa/state_tracker/Makefile index 4a38ca8f1..0ab1dc6e6 100644 --- a/mesalib/src/mesa/state_tracker/Makefile +++ b/mesalib/src/mesa/state_tracker/Makefile @@ -1,2 +1,2 @@ -default: +default: cd ../.. ; make \ No newline at end of file diff --git a/mesalib/src/mesa/state_tracker/st_atom.h b/mesalib/src/mesa/state_tracker/st_atom.h index b5f837f78..930a08444 100644 --- a/mesalib/src/mesa/state_tracker/st_atom.h +++ b/mesalib/src/mesa/state_tracker/st_atom.h @@ -1,73 +1,73 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - - /* - * Authors: - * Keith Whitwell - */ - - -#ifndef ST_ATOM_H -#define ST_ATOM_H - -#include "main/glheader.h" - -struct st_context; -struct st_tracked_state; - -void st_init_atoms( struct st_context *st ); -void st_destroy_atoms( struct st_context *st ); - - -void st_validate_state( struct st_context *st ); - - -extern const struct st_tracked_state st_update_framebuffer; -extern const struct st_tracked_state st_update_clip; -extern const struct st_tracked_state st_update_depth_stencil_alpha; -extern const struct st_tracked_state st_update_fp; -extern const struct st_tracked_state st_update_gp; -extern const struct st_tracked_state st_update_vp; -extern const struct st_tracked_state st_update_rasterizer; -extern const struct st_tracked_state st_update_polygon_stipple; -extern const struct st_tracked_state st_update_viewport; -extern const struct st_tracked_state st_update_scissor; -extern const struct st_tracked_state st_update_blend; -extern const struct st_tracked_state st_update_msaa; -extern const struct st_tracked_state st_update_sampler; -extern const struct st_tracked_state st_update_texture; -extern const struct st_tracked_state st_update_vertex_texture; -extern const struct st_tracked_state st_finalize_textures; -extern const struct st_tracked_state st_update_fs_constants; -extern const struct st_tracked_state st_update_gs_constants; -extern const struct st_tracked_state st_update_vs_constants; -extern const struct st_tracked_state st_update_pixel_transfer; - - -GLuint st_compare_func_to_pipe(GLenum func); - -#endif +/************************************************************************** + * + * 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. + * + **************************************************************************/ + + /* + * Authors: + * Keith Whitwell + */ + + +#ifndef ST_ATOM_H +#define ST_ATOM_H + +#include "main/glheader.h" + +struct st_context; +struct st_tracked_state; + +void st_init_atoms( struct st_context *st ); +void st_destroy_atoms( struct st_context *st ); + + +void st_validate_state( struct st_context *st ); + + +extern const struct st_tracked_state st_update_framebuffer; +extern const struct st_tracked_state st_update_clip; +extern const struct st_tracked_state st_update_depth_stencil_alpha; +extern const struct st_tracked_state st_update_fp; +extern const struct st_tracked_state st_update_gp; +extern const struct st_tracked_state st_update_vp; +extern const struct st_tracked_state st_update_rasterizer; +extern const struct st_tracked_state st_update_polygon_stipple; +extern const struct st_tracked_state st_update_viewport; +extern const struct st_tracked_state st_update_scissor; +extern const struct st_tracked_state st_update_blend; +extern const struct st_tracked_state st_update_msaa; +extern const struct st_tracked_state st_update_sampler; +extern const struct st_tracked_state st_update_texture; +extern const struct st_tracked_state st_update_vertex_texture; +extern const struct st_tracked_state st_finalize_textures; +extern const struct st_tracked_state st_update_fs_constants; +extern const struct st_tracked_state st_update_gs_constants; +extern const struct st_tracked_state st_update_vs_constants; +extern const struct st_tracked_state st_update_pixel_transfer; + + +GLuint st_compare_func_to_pipe(GLenum func); + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_atom_constbuf.h b/mesalib/src/mesa/state_tracker/st_atom_constbuf.h index d53654ee6..97b076629 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_constbuf.h +++ b/mesalib/src/mesa/state_tracker/st_atom_constbuf.h @@ -1,41 +1,41 @@ -/************************************************************************** - * - * Copyright 2007 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 ST_ATOM_CONSTBUF_H -#define ST_ATOM_CONSTBUF_H - -struct gl_program_parameter_list; -struct st_context; - - -void st_upload_constants( struct st_context *st, - struct gl_program_parameter_list *params, - unsigned id); - - -#endif /* ST_ATOM_CONSTBUF_H */ +/************************************************************************** + * + * Copyright 2007 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 ST_ATOM_CONSTBUF_H +#define ST_ATOM_CONSTBUF_H + +struct gl_program_parameter_list; +struct st_context; + + +void st_upload_constants( struct st_context *st, + struct gl_program_parameter_list *params, + unsigned id); + + +#endif /* ST_ATOM_CONSTBUF_H */ diff --git a/mesalib/src/mesa/state_tracker/st_atom_msaa.c b/mesalib/src/mesa/state_tracker/st_atom_msaa.c index 73f0ff160..ea9eb9a6d 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_msaa.c +++ b/mesalib/src/mesa/state_tracker/st_atom_msaa.c @@ -1,83 +1,83 @@ -/************************************************************************** - * - * Copyright 2010 VMware, 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 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 "st_context.h" -#include "pipe/p_context.h" -#include "st_atom.h" - -#include "cso_cache/cso_context.h" - - -/* Second state atom for user clip planes: - */ -static void update_sample_mask( struct st_context *st ) -{ - unsigned sample_mask = 0xffffffff; - unsigned sample_count = 1; - struct pipe_framebuffer_state *framebuffer = &st->state.framebuffer; - - /* dependency here on bound surface (or rather, sample count) is worrying */ - if (framebuffer->zsbuf) - sample_count = framebuffer->zsbuf->texture->nr_samples; - else if (framebuffer->cbufs[0]) - sample_count = framebuffer->cbufs[0]->texture->nr_samples; - - if (st->ctx->Multisample.Enabled && sample_count > 1) { - /* unlike in gallium/d3d10 the mask is only active if msaa is enabled */ - if (st->ctx->Multisample.SampleCoverage) { - unsigned nr_bits; - nr_bits = st->ctx->Multisample.SampleCoverageValue * (float)sample_count; - /* there's lot of ways how to do this. We just use first few bits, - since we have no knowledge of sample positions here. When - app-supplied mask though is used too might need to be smarter. - Also, there's a interface restriction here in theory it is - encouraged this mask not be the same at each pixel. */ - sample_mask = (1 << nr_bits) - 1; - if (st->ctx->Multisample.SampleCoverageInvert) - sample_mask = ~sample_mask; - } - /* TODO merge with app-supplied sample mask */ - } - - /* mask off unused bits or don't care? */ - - if (sample_mask != st->state.sample_mask) { - st->state.sample_mask = sample_mask; - cso_set_sample_mask(st->cso_context, sample_mask); - } -} - - -const struct st_tracked_state st_update_msaa = { - "st_update_msaa", /* name */ - { /* dirty */ - (_NEW_MULTISAMPLE | _NEW_BUFFERS), /* mesa */ - ST_NEW_FRAMEBUFFER, /* st */ - }, - update_sample_mask /* update */ -}; +/************************************************************************** + * + * Copyright 2010 VMware, 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 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 "st_context.h" +#include "pipe/p_context.h" +#include "st_atom.h" + +#include "cso_cache/cso_context.h" + + +/* Second state atom for user clip planes: + */ +static void update_sample_mask( struct st_context *st ) +{ + unsigned sample_mask = 0xffffffff; + unsigned sample_count = 1; + struct pipe_framebuffer_state *framebuffer = &st->state.framebuffer; + + /* dependency here on bound surface (or rather, sample count) is worrying */ + if (framebuffer->zsbuf) + sample_count = framebuffer->zsbuf->texture->nr_samples; + else if (framebuffer->cbufs[0]) + sample_count = framebuffer->cbufs[0]->texture->nr_samples; + + if (st->ctx->Multisample.Enabled && sample_count > 1) { + /* unlike in gallium/d3d10 the mask is only active if msaa is enabled */ + if (st->ctx->Multisample.SampleCoverage) { + unsigned nr_bits; + nr_bits = st->ctx->Multisample.SampleCoverageValue * (float)sample_count; + /* there's lot of ways how to do this. We just use first few bits, + since we have no knowledge of sample positions here. When + app-supplied mask though is used too might need to be smarter. + Also, there's a interface restriction here in theory it is + encouraged this mask not be the same at each pixel. */ + sample_mask = (1 << nr_bits) - 1; + if (st->ctx->Multisample.SampleCoverageInvert) + sample_mask = ~sample_mask; + } + /* TODO merge with app-supplied sample mask */ + } + + /* mask off unused bits or don't care? */ + + if (sample_mask != st->state.sample_mask) { + st->state.sample_mask = sample_mask; + cso_set_sample_mask(st->cso_context, sample_mask); + } +} + + +const struct st_tracked_state st_update_msaa = { + "st_update_msaa", /* name */ + { /* dirty */ + (_NEW_MULTISAMPLE | _NEW_BUFFERS), /* mesa */ + ST_NEW_FRAMEBUFFER, /* st */ + }, + update_sample_mask /* update */ +}; diff --git a/mesalib/src/mesa/state_tracker/st_atom_shader.h b/mesalib/src/mesa/state_tracker/st_atom_shader.h index fbb3a4137..56d4c68f4 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_shader.h +++ b/mesalib/src/mesa/state_tracker/st_atom_shader.h @@ -1,41 +1,41 @@ -/************************************************************************** - * - * Copyright 2007-2008 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 ST_ATOM_SHADER_H -#define ST_ATOM_SHADER_H - - -struct st_context; -struct translated_vertex_program; - -extern void -st_free_translated_vertex_programs(struct st_context *st, - struct translated_vertex_program *xvp); - - -#endif /* ST_ATOM_SHADER_H */ +/************************************************************************** + * + * Copyright 2007-2008 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 ST_ATOM_SHADER_H +#define ST_ATOM_SHADER_H + + +struct st_context; +struct translated_vertex_program; + +extern void +st_free_translated_vertex_programs(struct st_context *st, + struct translated_vertex_program *xvp); + + +#endif /* ST_ATOM_SHADER_H */ diff --git a/mesalib/src/mesa/state_tracker/st_atom_viewport.c b/mesalib/src/mesa/state_tracker/st_atom_viewport.c index df26fb4a6..133cc49ea 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_viewport.c +++ b/mesalib/src/mesa/state_tracker/st_atom_viewport.c @@ -1,94 +1,94 @@ -/************************************************************************** - * - * Copyright 2007 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 "main/context.h" -#include "st_context.h" -#include "st_atom.h" -#include "pipe/p_context.h" -#include "cso_cache/cso_context.h" - -/** - * Update the viewport transformation matrix. Depends on: - * - viewport pos/size - * - depthrange - * - window pos/size or FBO size - */ -static void -update_viewport( struct st_context *st ) -{ - struct gl_context *ctx = st->ctx; - GLfloat yScale, yBias; - - /* _NEW_BUFFERS - */ - if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { - /* Drawing to a window. The corresponding gallium surface uses - * Y=0=TOP but OpenGL is Y=0=BOTTOM. So we need to invert the viewport. - */ - yScale = -1; - yBias = (GLfloat)ctx->DrawBuffer->Height; - } - else { - /* Drawing to an FBO where Y=0=BOTTOM, like OpenGL - don't invert */ - yScale = 1.0; - yBias = 0.0; - } - - /* _NEW_VIEWPORT - */ - { - GLfloat x = (GLfloat)ctx->Viewport.X; - GLfloat y = (GLfloat)ctx->Viewport.Y; - GLfloat z = ctx->Viewport.Near; - GLfloat half_width = (GLfloat)ctx->Viewport.Width * 0.5f; - GLfloat half_height = (GLfloat)ctx->Viewport.Height * 0.5f; - GLfloat half_depth = (GLfloat)(ctx->Viewport.Far - ctx->Viewport.Near) * 0.5f; - - st->state.viewport.scale[0] = half_width; - st->state.viewport.scale[1] = half_height * yScale; - st->state.viewport.scale[2] = half_depth; - st->state.viewport.scale[3] = 1.0; - - st->state.viewport.translate[0] = half_width + x; - st->state.viewport.translate[1] = (half_height + y) * yScale + yBias; - st->state.viewport.translate[2] = half_depth + z; - st->state.viewport.translate[3] = 0.0; - - cso_set_viewport(st->cso_context, &st->state.viewport); - } -} - - -const struct st_tracked_state st_update_viewport = { - "st_update_viewport", /* name */ - { /* dirty */ - _NEW_BUFFERS | _NEW_VIEWPORT, /* mesa */ - 0, /* st */ - }, - update_viewport /* update */ -}; +/************************************************************************** + * + * Copyright 2007 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 "main/context.h" +#include "st_context.h" +#include "st_atom.h" +#include "pipe/p_context.h" +#include "cso_cache/cso_context.h" + +/** + * Update the viewport transformation matrix. Depends on: + * - viewport pos/size + * - depthrange + * - window pos/size or FBO size + */ +static void +update_viewport( struct st_context *st ) +{ + struct gl_context *ctx = st->ctx; + GLfloat yScale, yBias; + + /* _NEW_BUFFERS + */ + if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { + /* Drawing to a window. The corresponding gallium surface uses + * Y=0=TOP but OpenGL is Y=0=BOTTOM. So we need to invert the viewport. + */ + yScale = -1; + yBias = (GLfloat)ctx->DrawBuffer->Height; + } + else { + /* Drawing to an FBO where Y=0=BOTTOM, like OpenGL - don't invert */ + yScale = 1.0; + yBias = 0.0; + } + + /* _NEW_VIEWPORT + */ + { + GLfloat x = (GLfloat)ctx->Viewport.X; + GLfloat y = (GLfloat)ctx->Viewport.Y; + GLfloat z = ctx->Viewport.Near; + GLfloat half_width = (GLfloat)ctx->Viewport.Width * 0.5f; + GLfloat half_height = (GLfloat)ctx->Viewport.Height * 0.5f; + GLfloat half_depth = (GLfloat)(ctx->Viewport.Far - ctx->Viewport.Near) * 0.5f; + + st->state.viewport.scale[0] = half_width; + st->state.viewport.scale[1] = half_height * yScale; + st->state.viewport.scale[2] = half_depth; + st->state.viewport.scale[3] = 1.0; + + st->state.viewport.translate[0] = half_width + x; + st->state.viewport.translate[1] = (half_height + y) * yScale + yBias; + st->state.viewport.translate[2] = half_depth + z; + st->state.viewport.translate[3] = 0.0; + + cso_set_viewport(st->cso_context, &st->state.viewport); + } +} + + +const struct st_tracked_state st_update_viewport = { + "st_update_viewport", /* name */ + { /* dirty */ + _NEW_BUFFERS | _NEW_VIEWPORT, /* mesa */ + 0, /* st */ + }, + update_viewport /* update */ +}; diff --git a/mesalib/src/mesa/state_tracker/st_cache.h b/mesalib/src/mesa/state_tracker/st_cache.h index 52c1b378d..6d5de7b13 100644 --- a/mesalib/src/mesa/state_tracker/st_cache.h +++ b/mesalib/src/mesa/state_tracker/st_cache.h @@ -1,69 +1,69 @@ -/************************************************************************** - * - * Copyright 2007 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. - * - **************************************************************************/ - - /* - * Authors: - * Zack Rusin - */ - -#ifndef ST_CACHE_H -#define ST_CACHE_H - -struct pipe_blend_state; -struct pipe_depth_stencil_alpha_state; -struct pipe_rasterizer_state; -struct pipe_sampler_state; -struct pipe_shader_state; -struct st_context; - - -const struct cso_blend * -st_cached_blend_state(struct st_context *st, - const struct pipe_blend_state *blend); - -const struct cso_sampler * -st_cached_sampler_state(struct st_context *st, - const struct pipe_sampler_state *sampler); - -const struct cso_depth_stencil_alpha * -st_cached_depth_stencil_alpha_state(struct st_context *st, - const struct pipe_depth_stencil_alpha_state *depth_stencil); - -const struct cso_rasterizer * -st_cached_rasterizer_state(struct st_context *st, - const struct pipe_rasterizer_state *raster); - -const struct cso_fragment_shader * -st_cached_fs_state(struct st_context *st, - const struct pipe_shader_state *templ); - - -const struct cso_vertex_shader * -st_cached_vs_state(struct st_context *st, - const struct pipe_shader_state *templ); - -#endif +/************************************************************************** + * + * Copyright 2007 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. + * + **************************************************************************/ + + /* + * Authors: + * Zack Rusin + */ + +#ifndef ST_CACHE_H +#define ST_CACHE_H + +struct pipe_blend_state; +struct pipe_depth_stencil_alpha_state; +struct pipe_rasterizer_state; +struct pipe_sampler_state; +struct pipe_shader_state; +struct st_context; + + +const struct cso_blend * +st_cached_blend_state(struct st_context *st, + const struct pipe_blend_state *blend); + +const struct cso_sampler * +st_cached_sampler_state(struct st_context *st, + const struct pipe_sampler_state *sampler); + +const struct cso_depth_stencil_alpha * +st_cached_depth_stencil_alpha_state(struct st_context *st, + const struct pipe_depth_stencil_alpha_state *depth_stencil); + +const struct cso_rasterizer * +st_cached_rasterizer_state(struct st_context *st, + const struct pipe_rasterizer_state *raster); + +const struct cso_fragment_shader * +st_cached_fs_state(struct st_context *st, + const struct pipe_shader_state *templ); + + +const struct cso_vertex_shader * +st_cached_vs_state(struct st_context *st, + const struct pipe_shader_state *templ); + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.h b/mesalib/src/mesa/state_tracker/st_cb_bitmap.h index cc6d82391..ed1415803 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.h +++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.h @@ -1,96 +1,96 @@ -/************************************************************************** - * - * Copyright 2007 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 ST_CB_BITMAP_H -#define ST_CB_BITMAP_H - - -#include "main/compiler.h" -#include "main/mfeatures.h" - -struct dd_function_table; -struct st_context; -struct gl_fragment_program; -struct st_fragment_program; - -#if FEATURE_drawpix - -extern void -st_init_bitmap_functions(struct dd_function_table *functions); - -extern void -st_init_bitmap(struct st_context *st); - -extern void -st_destroy_bitmap(struct st_context *st); - -extern void -st_make_bitmap_fragment_program(struct st_context *st, - struct gl_fragment_program *fpIn, - struct gl_fragment_program **fpOut, - GLuint *bitmap_sampler); - -extern void -st_flush_bitmap_cache(struct st_context *st); - -/* Flush bitmap cache and release vertex buffer. Needed at end of - * frame to avoid synchronous rendering. - */ -extern void -st_flush_bitmap(struct st_context *st); - -#else - -static INLINE void -st_init_bitmap_functions(struct dd_function_table *functions) -{ -} - -static INLINE void -st_init_bitmap(struct st_context *st) -{ -} - -static INLINE void -st_destroy_bitmap(struct st_context *st) -{ -} - -static INLINE void -st_flush_bitmap_cache(struct st_context *st) -{ -} - -static INLINE void -st_flush_bitmap(struct st_context *st) -{ -} - -#endif /* FEATURE_drawpix */ - -#endif /* ST_CB_BITMAP_H */ +/************************************************************************** + * + * Copyright 2007 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 ST_CB_BITMAP_H +#define ST_CB_BITMAP_H + + +#include "main/compiler.h" +#include "main/mfeatures.h" + +struct dd_function_table; +struct st_context; +struct gl_fragment_program; +struct st_fragment_program; + +#if FEATURE_drawpix + +extern void +st_init_bitmap_functions(struct dd_function_table *functions); + +extern void +st_init_bitmap(struct st_context *st); + +extern void +st_destroy_bitmap(struct st_context *st); + +extern void +st_make_bitmap_fragment_program(struct st_context *st, + struct gl_fragment_program *fpIn, + struct gl_fragment_program **fpOut, + GLuint *bitmap_sampler); + +extern void +st_flush_bitmap_cache(struct st_context *st); + +/* Flush bitmap cache and release vertex buffer. Needed at end of + * frame to avoid synchronous rendering. + */ +extern void +st_flush_bitmap(struct st_context *st); + +#else + +static INLINE void +st_init_bitmap_functions(struct dd_function_table *functions) +{ +} + +static INLINE void +st_init_bitmap(struct st_context *st) +{ +} + +static INLINE void +st_destroy_bitmap(struct st_context *st) +{ +} + +static INLINE void +st_flush_bitmap_cache(struct st_context *st) +{ +} + +static INLINE void +st_flush_bitmap(struct st_context *st) +{ +} + +#endif /* FEATURE_drawpix */ + +#endif /* ST_CB_BITMAP_H */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.h b/mesalib/src/mesa/state_tracker/st_cb_blit.h index e378e6789..c6d9a3679 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_blit.h +++ b/mesalib/src/mesa/state_tracker/st_cb_blit.h @@ -1,59 +1,59 @@ -/************************************************************************** - * - * Copyright 2007 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 ST_CB_BLIT_H -#define ST_CB_BLIT_H - - -#include "main/compiler.h" -#include "main/mfeatures.h" - -struct dd_function_table; -struct st_context; - - -extern void -st_init_blit(struct st_context *st); - -extern void -st_destroy_blit(struct st_context *st); - -#if FEATURE_EXT_framebuffer_blit - -extern void -st_init_blit_functions(struct dd_function_table *functions); - -#else - -static INLINE void -st_init_blit_functions(struct dd_function_table *functions) -{ -} - -#endif /* FEATURE_EXT_framebuffer_blit */ - -#endif /* ST_CB_BLIT_H */ +/************************************************************************** + * + * Copyright 2007 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 ST_CB_BLIT_H +#define ST_CB_BLIT_H + + +#include "main/compiler.h" +#include "main/mfeatures.h" + +struct dd_function_table; +struct st_context; + + +extern void +st_init_blit(struct st_context *st); + +extern void +st_destroy_blit(struct st_context *st); + +#if FEATURE_EXT_framebuffer_blit + +extern void +st_init_blit_functions(struct dd_function_table *functions); + +#else + +static INLINE void +st_init_blit_functions(struct dd_function_table *functions) +{ +} + +#endif /* FEATURE_EXT_framebuffer_blit */ + +#endif /* ST_CB_BLIT_H */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.h b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.h index 16abaa856..1c991d208 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.h +++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.h @@ -1,68 +1,68 @@ -/************************************************************************** - * - * Copyright 2005 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 ST_CB_BUFFEROBJECTS_H -#define ST_CB_BUFFEROBJECTS_H - -#include "main/compiler.h" -#include "main/mtypes.h" - -struct dd_function_table; -struct pipe_resource; -struct st_context; - -/** - * State_tracker vertex/pixel buffer object, derived from Mesa's - * gl_buffer_object. - */ -struct st_buffer_object -{ - struct gl_buffer_object Base; - struct pipe_resource *buffer; /* GPU storage */ - struct pipe_transfer *transfer; /* In-progress map information */ -}; - - -/** cast wrapper */ -static INLINE struct st_buffer_object * -st_buffer_object(struct gl_buffer_object *obj) -{ - return (struct st_buffer_object *) obj; -} - - -extern void -st_bufferobj_validate_usage(struct st_context *st, - struct st_buffer_object *obj, - unsigned usage); - - -extern void -st_init_bufferobject_functions(struct dd_function_table *functions); - - -#endif +/************************************************************************** + * + * Copyright 2005 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 ST_CB_BUFFEROBJECTS_H +#define ST_CB_BUFFEROBJECTS_H + +#include "main/compiler.h" +#include "main/mtypes.h" + +struct dd_function_table; +struct pipe_resource; +struct st_context; + +/** + * State_tracker vertex/pixel buffer object, derived from Mesa's + * gl_buffer_object. + */ +struct st_buffer_object +{ + struct gl_buffer_object Base; + struct pipe_resource *buffer; /* GPU storage */ + struct pipe_transfer *transfer; /* In-progress map information */ +}; + + +/** cast wrapper */ +static INLINE struct st_buffer_object * +st_buffer_object(struct gl_buffer_object *obj) +{ + return (struct st_buffer_object *) obj; +} + + +extern void +st_bufferobj_validate_usage(struct st_context *st, + struct st_buffer_object *obj, + unsigned usage); + + +extern void +st_init_bufferobject_functions(struct dd_function_table *functions); + + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_cb_condrender.h b/mesalib/src/mesa/state_tracker/st_cb_condrender.h index 24eb09258..79d0db8d0 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_condrender.h +++ b/mesalib/src/mesa/state_tracker/st_cb_condrender.h @@ -1,37 +1,37 @@ -/************************************************************************** - * - * Copyright 2009 VMware, 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 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 ST_CB_CONDRENDER_H -#define ST_CB_CONDRENDER_H - - -struct dd_function_table; - -extern void st_init_cond_render_functions(struct dd_function_table *functions); - - -#endif +/************************************************************************** + * + * Copyright 2009 VMware, 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 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 ST_CB_CONDRENDER_H +#define ST_CB_CONDRENDER_H + + +struct dd_function_table; + +extern void st_init_cond_render_functions(struct dd_function_table *functions); + + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.h b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.h index 9c02263ea..44d7f5ed1 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.h +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.h @@ -1,70 +1,70 @@ -/************************************************************************** - * - * Copyright 2007 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 ST_CB_DRAWPIXELS_H -#define ST_CB_DRAWPIXELS_H - - -#include "main/compiler.h" -#include "main/mfeatures.h" - -struct dd_function_table; -struct st_context; - -#if FEATURE_drawpix - -extern void st_init_drawpixels_functions(struct dd_function_table *functions); - -extern void -st_destroy_drawpix(struct st_context *st); - -extern void -st_make_drawpix_fragment_program(struct st_context *st, - struct gl_fragment_program *fpIn, - struct gl_fragment_program **fpOut); - -extern struct gl_fragment_program * -st_make_drawpix_z_stencil_program(struct st_context *st, - GLboolean write_depth, - GLboolean write_stencil); - -#else - -static INLINE void -st_init_drawpixels_functions(struct dd_function_table *functions) -{ -} - -static INLINE void -st_destroy_drawpix(struct st_context *st) -{ -} - -#endif /* FEATURE_drawpix */ - -#endif /* ST_CB_DRAWPIXELS_H */ +/************************************************************************** + * + * Copyright 2007 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 ST_CB_DRAWPIXELS_H +#define ST_CB_DRAWPIXELS_H + + +#include "main/compiler.h" +#include "main/mfeatures.h" + +struct dd_function_table; +struct st_context; + +#if FEATURE_drawpix + +extern void st_init_drawpixels_functions(struct dd_function_table *functions); + +extern void +st_destroy_drawpix(struct st_context *st); + +extern void +st_make_drawpix_fragment_program(struct st_context *st, + struct gl_fragment_program *fpIn, + struct gl_fragment_program **fpOut); + +extern struct gl_fragment_program * +st_make_drawpix_z_stencil_program(struct st_context *st, + GLboolean write_depth, + GLboolean write_stencil); + +#else + +static INLINE void +st_init_drawpixels_functions(struct dd_function_table *functions) +{ +} + +static INLINE void +st_destroy_drawpix(struct st_context *st) +{ +} + +#endif /* FEATURE_drawpix */ + +#endif /* ST_CB_DRAWPIXELS_H */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawtex.h b/mesalib/src/mesa/state_tracker/st_cb_drawtex.h index 0937b48f8..455da04e6 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawtex.h +++ b/mesalib/src/mesa/state_tracker/st_cb_drawtex.h @@ -1,41 +1,41 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - **************************************************************************/ - - -#ifndef ST_CB_DRAWTEX_H -#define ST_CB_DRAWTEX_H - - -#include "main/compiler.h" -#include "main/mfeatures.h" - -struct dd_function_table; -struct st_context; - -#if FEATURE_OES_draw_texture - -extern void -st_init_drawtex_functions(struct dd_function_table *functions); - -extern void -st_destroy_drawtex(struct st_context *st); - -#else - -static INLINE void -st_init_drawtex_functions(struct dd_function_table *functions) -{ -} - -static INLINE void -st_destroy_drawtex(struct st_context *st) -{ -} - -#endif /* FEATURE_OES_draw_texture */ - -#endif /* ST_CB_DRAWTEX_H */ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + **************************************************************************/ + + +#ifndef ST_CB_DRAWTEX_H +#define ST_CB_DRAWTEX_H + + +#include "main/compiler.h" +#include "main/mfeatures.h" + +struct dd_function_table; +struct st_context; + +#if FEATURE_OES_draw_texture + +extern void +st_init_drawtex_functions(struct dd_function_table *functions); + +extern void +st_destroy_drawtex(struct st_context *st); + +#else + +static INLINE void +st_init_drawtex_functions(struct dd_function_table *functions) +{ +} + +static INLINE void +st_destroy_drawtex(struct st_context *st) +{ +} + +#endif /* FEATURE_OES_draw_texture */ + +#endif /* ST_CB_DRAWTEX_H */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_eglimage.h b/mesalib/src/mesa/state_tracker/st_cb_eglimage.h index b325b0608..48567ed9d 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_eglimage.h +++ b/mesalib/src/mesa/state_tracker/st_cb_eglimage.h @@ -1,51 +1,51 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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: - * Chia-I Wu - */ - -#ifndef ST_CB_EGLIMAGE_H -#define ST_CB_EGLIMAGE_H - -#include "main/compiler.h" -#include "main/mfeatures.h" - -struct dd_function_table; - -#if FEATURE_OES_EGL_image - -extern void -st_init_eglimage_functions(struct dd_function_table *functions); - -#else - -static INLINE void -st_init_eglimage_functions(struct dd_function_table *functions) -{ -} - -#endif - -#endif /* ST_CB_EGLIMAGE_H */ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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: + * Chia-I Wu + */ + +#ifndef ST_CB_EGLIMAGE_H +#define ST_CB_EGLIMAGE_H + +#include "main/compiler.h" +#include "main/mfeatures.h" + +struct dd_function_table; + +#if FEATURE_OES_EGL_image + +extern void +st_init_eglimage_functions(struct dd_function_table *functions); + +#else + +static INLINE void +st_init_eglimage_functions(struct dd_function_table *functions) +{ +} + +#endif + +#endif /* ST_CB_EGLIMAGE_H */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_feedback.c b/mesalib/src/mesa/state_tracker/st_cb_feedback.c index d390ba192..9b85a39be 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_feedback.c +++ b/mesalib/src/mesa/state_tracker/st_cb_feedback.c @@ -1,309 +1,309 @@ -/************************************************************************** - * - * Copyright 2007 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. - * - **************************************************************************/ - -/** - * GL_SELECT and GL_FEEDBACK render modes. - * Basically, we use a private instance of the 'draw' module for doing - * selection/feedback. It would be nice to use the transform_feedback - * hardware feature, but it's defined as happening pre-clip and we want - * post-clipped primitives. Also, there's concerns about the efficiency - * of using the hardware for this anyway. - * - * Authors: - * Brian Paul - */ - -#include "main/imports.h" -#include "main/context.h" -#include "main/feedback.h" -#include "main/mfeatures.h" - -#include "vbo/vbo.h" - -#include "st_context.h" -#include "st_draw.h" -#include "st_cb_feedback.h" - -#include "pipe/p_context.h" -#include "pipe/p_defines.h" - -#include "draw/draw_context.h" -#include "draw/draw_pipe.h" - - -#if FEATURE_feedback - -/** - * This is actually used for both feedback and selection. - */ -struct feedback_stage -{ - struct draw_stage stage; /**< Base class */ - struct gl_context *ctx; /**< Rendering context */ - GLboolean reset_stipple_counter; -}; - - -/********************************************************************** - * GL Feedback functions - **********************************************************************/ - -static INLINE struct feedback_stage * -feedback_stage( struct draw_stage *stage ) -{ - return (struct feedback_stage *)stage; -} - - -static void -feedback_vertex(struct gl_context *ctx, const struct draw_context *draw, - const struct vertex_header *v) -{ - const struct st_context *st = st_context(ctx); - GLfloat win[4]; - const GLfloat *color, *texcoord; - GLuint slot; - - /* Recall that Y=0=Top of window for Gallium wincoords */ - win[0] = v->data[0][0]; - win[1] = ctx->DrawBuffer->Height - v->data[0][1]; - win[2] = v->data[0][2]; - win[3] = 1.0F / v->data[0][3]; - - /* XXX - * When we compute vertex layout, save info about position of the - * color and texcoord attribs to use here. - */ - - slot = st->vertex_result_to_slot[VERT_RESULT_COL0]; - if (slot != ~0U) - color = v->data[slot]; - else - color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; - - slot = st->vertex_result_to_slot[VERT_RESULT_TEX0]; - if (slot != ~0U) - texcoord = v->data[slot]; - else - texcoord = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; - - _mesa_feedback_vertex(ctx, win, color, texcoord); -} - - -static void -feedback_tri( struct draw_stage *stage, struct prim_header *prim ) -{ - struct feedback_stage *fs = feedback_stage(stage); - struct draw_context *draw = stage->draw; - _mesa_feedback_token(fs->ctx, (GLfloat) GL_POLYGON_TOKEN); - _mesa_feedback_token(fs->ctx, (GLfloat) 3); /* three vertices */ - feedback_vertex(fs->ctx, draw, prim->v[0]); - feedback_vertex(fs->ctx, draw, prim->v[1]); - feedback_vertex(fs->ctx, draw, prim->v[2]); -} - - -static void -feedback_line( struct draw_stage *stage, struct prim_header *prim ) -{ - struct feedback_stage *fs = feedback_stage(stage); - struct draw_context *draw = stage->draw; - if (fs->reset_stipple_counter) { - _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_RESET_TOKEN); - fs->reset_stipple_counter = GL_FALSE; - } - else { - _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_TOKEN); - } - feedback_vertex(fs->ctx, draw, prim->v[0]); - feedback_vertex(fs->ctx, draw, prim->v[1]); -} - - -static void -feedback_point( struct draw_stage *stage, struct prim_header *prim ) -{ - struct feedback_stage *fs = feedback_stage(stage); - struct draw_context *draw = stage->draw; - _mesa_feedback_token(fs->ctx, (GLfloat) GL_POINT_TOKEN); - feedback_vertex(fs->ctx, draw, prim->v[0]); -} - - -static void -feedback_flush( struct draw_stage *stage, unsigned flags ) -{ - /* no-op */ -} - - -static void -feedback_reset_stipple_counter( struct draw_stage *stage ) -{ - struct feedback_stage *fs = feedback_stage(stage); - fs->reset_stipple_counter = GL_TRUE; -} - - -static void -feedback_destroy( struct draw_stage *stage ) -{ - /* no-op */ -} - -/** - * Create GL feedback drawing stage. - */ -static struct draw_stage * -draw_glfeedback_stage(struct gl_context *ctx, struct draw_context *draw) -{ - struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage); - - fs->stage.draw = draw; - fs->stage.next = NULL; - fs->stage.point = feedback_point; - fs->stage.line = feedback_line; - fs->stage.tri = feedback_tri; - fs->stage.flush = feedback_flush; - fs->stage.reset_stipple_counter = feedback_reset_stipple_counter; - fs->stage.destroy = feedback_destroy; - fs->ctx = ctx; - - return &fs->stage; -} - - - -/********************************************************************** - * GL Selection functions - **********************************************************************/ - -static void -select_tri( struct draw_stage *stage, struct prim_header *prim ) -{ - struct feedback_stage *fs = feedback_stage(stage); - _mesa_update_hitflag( fs->ctx, prim->v[0]->data[0][2] ); - _mesa_update_hitflag( fs->ctx, prim->v[1]->data[0][2] ); - _mesa_update_hitflag( fs->ctx, prim->v[2]->data[0][2] ); -} - -static void -select_line( struct draw_stage *stage, struct prim_header *prim ) -{ - struct feedback_stage *fs = feedback_stage(stage); - _mesa_update_hitflag( fs->ctx, prim->v[0]->data[0][2] ); - _mesa_update_hitflag( fs->ctx, prim->v[1]->data[0][2] ); -} - - -static void -select_point( struct draw_stage *stage, struct prim_header *prim ) -{ - struct feedback_stage *fs = feedback_stage(stage); - _mesa_update_hitflag( fs->ctx, prim->v[0]->data[0][2] ); -} - - -static void -select_flush( struct draw_stage *stage, unsigned flags ) -{ - /* no-op */ -} - - -static void -select_reset_stipple_counter( struct draw_stage *stage ) -{ - /* no-op */ -} - -static void -select_destroy( struct draw_stage *stage ) -{ - /* no-op */ -} - - -/** - * Create GL selection mode drawing stage. - */ -static struct draw_stage * -draw_glselect_stage(struct gl_context *ctx, struct draw_context *draw) -{ - struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage); - - fs->stage.draw = draw; - fs->stage.next = NULL; - fs->stage.point = select_point; - fs->stage.line = select_line; - fs->stage.tri = select_tri; - fs->stage.flush = select_flush; - fs->stage.reset_stipple_counter = select_reset_stipple_counter; - fs->stage.destroy = select_destroy; - fs->ctx = ctx; - - return &fs->stage; -} - - -static void -st_RenderMode(struct gl_context *ctx, GLenum newMode ) -{ - struct st_context *st = st_context(ctx); - struct draw_context *draw = st->draw; - - if (newMode == GL_RENDER) { - /* restore normal VBO draw function */ - vbo_set_draw_func(ctx, st_draw_vbo); - } - else if (newMode == GL_SELECT) { - if (!st->selection_stage) - st->selection_stage = draw_glselect_stage(ctx, draw); - draw_set_rasterize_stage(draw, st->selection_stage); - /* Plug in new vbo draw function */ - vbo_set_draw_func(ctx, st_feedback_draw_vbo); - } - else { - if (!st->feedback_stage) - st->feedback_stage = draw_glfeedback_stage(ctx, draw); - draw_set_rasterize_stage(draw, st->feedback_stage); - /* Plug in new vbo draw function */ - vbo_set_draw_func(ctx, st_feedback_draw_vbo); - /* need to generate/use a vertex program that emits pos/color/tex */ - st->dirty.st |= ST_NEW_VERTEX_PROGRAM; - } -} - - - -void st_init_feedback_functions(struct dd_function_table *functions) -{ - functions->RenderMode = st_RenderMode; -} - -#endif /* FEATURE_feedback */ +/************************************************************************** + * + * Copyright 2007 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. + * + **************************************************************************/ + +/** + * GL_SELECT and GL_FEEDBACK render modes. + * Basically, we use a private instance of the 'draw' module for doing + * selection/feedback. It would be nice to use the transform_feedback + * hardware feature, but it's defined as happening pre-clip and we want + * post-clipped primitives. Also, there's concerns about the efficiency + * of using the hardware for this anyway. + * + * Authors: + * Brian Paul + */ + +#include "main/imports.h" +#include "main/context.h" +#include "main/feedback.h" +#include "main/mfeatures.h" + +#include "vbo/vbo.h" + +#include "st_context.h" +#include "st_draw.h" +#include "st_cb_feedback.h" + +#include "pipe/p_context.h" +#include "pipe/p_defines.h" + +#include "draw/draw_context.h" +#include "draw/draw_pipe.h" + + +#if FEATURE_feedback + +/** + * This is actually used for both feedback and selection. + */ +struct feedback_stage +{ + struct draw_stage stage; /**< Base class */ + struct gl_context *ctx; /**< Rendering context */ + GLboolean reset_stipple_counter; +}; + + +/********************************************************************** + * GL Feedback functions + **********************************************************************/ + +static INLINE struct feedback_stage * +feedback_stage( struct draw_stage *stage ) +{ + return (struct feedback_stage *)stage; +} + + +static void +feedback_vertex(struct gl_context *ctx, const struct draw_context *draw, + const struct vertex_header *v) +{ + const struct st_context *st = st_context(ctx); + GLfloat win[4]; + const GLfloat *color, *texcoord; + GLuint slot; + + /* Recall that Y=0=Top of window for Gallium wincoords */ + win[0] = v->data[0][0]; + win[1] = ctx->DrawBuffer->Height - v->data[0][1]; + win[2] = v->data[0][2]; + win[3] = 1.0F / v->data[0][3]; + + /* XXX + * When we compute vertex layout, save info about position of the + * color and texcoord attribs to use here. + */ + + slot = st->vertex_result_to_slot[VERT_RESULT_COL0]; + if (slot != ~0U) + color = v->data[slot]; + else + color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; + + slot = st->vertex_result_to_slot[VERT_RESULT_TEX0]; + if (slot != ~0U) + texcoord = v->data[slot]; + else + texcoord = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; + + _mesa_feedback_vertex(ctx, win, color, texcoord); +} + + +static void +feedback_tri( struct draw_stage *stage, struct prim_header *prim ) +{ + struct feedback_stage *fs = feedback_stage(stage); + struct draw_context *draw = stage->draw; + _mesa_feedback_token(fs->ctx, (GLfloat) GL_POLYGON_TOKEN); + _mesa_feedback_token(fs->ctx, (GLfloat) 3); /* three vertices */ + feedback_vertex(fs->ctx, draw, prim->v[0]); + feedback_vertex(fs->ctx, draw, prim->v[1]); + feedback_vertex(fs->ctx, draw, prim->v[2]); +} + + +static void +feedback_line( struct draw_stage *stage, struct prim_header *prim ) +{ + struct feedback_stage *fs = feedback_stage(stage); + struct draw_context *draw = stage->draw; + if (fs->reset_stipple_counter) { + _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_RESET_TOKEN); + fs->reset_stipple_counter = GL_FALSE; + } + else { + _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_TOKEN); + } + feedback_vertex(fs->ctx, draw, prim->v[0]); + feedback_vertex(fs->ctx, draw, prim->v[1]); +} + + +static void +feedback_point( struct draw_stage *stage, struct prim_header *prim ) +{ + struct feedback_stage *fs = feedback_stage(stage); + struct draw_context *draw = stage->draw; + _mesa_feedback_token(fs->ctx, (GLfloat) GL_POINT_TOKEN); + feedback_vertex(fs->ctx, draw, prim->v[0]); +} + + +static void +feedback_flush( struct draw_stage *stage, unsigned flags ) +{ + /* no-op */ +} + + +static void +feedback_reset_stipple_counter( struct draw_stage *stage ) +{ + struct feedback_stage *fs = feedback_stage(stage); + fs->reset_stipple_counter = GL_TRUE; +} + + +static void +feedback_destroy( struct draw_stage *stage ) +{ + /* no-op */ +} + +/** + * Create GL feedback drawing stage. + */ +static struct draw_stage * +draw_glfeedback_stage(struct gl_context *ctx, struct draw_context *draw) +{ + struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage); + + fs->stage.draw = draw; + fs->stage.next = NULL; + fs->stage.point = feedback_point; + fs->stage.line = feedback_line; + fs->stage.tri = feedback_tri; + fs->stage.flush = feedback_flush; + fs->stage.reset_stipple_counter = feedback_reset_stipple_counter; + fs->stage.destroy = feedback_destroy; + fs->ctx = ctx; + + return &fs->stage; +} + + + +/********************************************************************** + * GL Selection functions + **********************************************************************/ + +static void +select_tri( struct draw_stage *stage, struct prim_header *prim ) +{ + struct feedback_stage *fs = feedback_stage(stage); + _mesa_update_hitflag( fs->ctx, prim->v[0]->data[0][2] ); + _mesa_update_hitflag( fs->ctx, prim->v[1]->data[0][2] ); + _mesa_update_hitflag( fs->ctx, prim->v[2]->data[0][2] ); +} + +static void +select_line( struct draw_stage *stage, struct prim_header *prim ) +{ + struct feedback_stage *fs = feedback_stage(stage); + _mesa_update_hitflag( fs->ctx, prim->v[0]->data[0][2] ); + _mesa_update_hitflag( fs->ctx, prim->v[1]->data[0][2] ); +} + + +static void +select_point( struct draw_stage *stage, struct prim_header *prim ) +{ + struct feedback_stage *fs = feedback_stage(stage); + _mesa_update_hitflag( fs->ctx, prim->v[0]->data[0][2] ); +} + + +static void +select_flush( struct draw_stage *stage, unsigned flags ) +{ + /* no-op */ +} + + +static void +select_reset_stipple_counter( struct draw_stage *stage ) +{ + /* no-op */ +} + +static void +select_destroy( struct draw_stage *stage ) +{ + /* no-op */ +} + + +/** + * Create GL selection mode drawing stage. + */ +static struct draw_stage * +draw_glselect_stage(struct gl_context *ctx, struct draw_context *draw) +{ + struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage); + + fs->stage.draw = draw; + fs->stage.next = NULL; + fs->stage.point = select_point; + fs->stage.line = select_line; + fs->stage.tri = select_tri; + fs->stage.flush = select_flush; + fs->stage.reset_stipple_counter = select_reset_stipple_counter; + fs->stage.destroy = select_destroy; + fs->ctx = ctx; + + return &fs->stage; +} + + +static void +st_RenderMode(struct gl_context *ctx, GLenum newMode ) +{ + struct st_context *st = st_context(ctx); + struct draw_context *draw = st->draw; + + if (newMode == GL_RENDER) { + /* restore normal VBO draw function */ + vbo_set_draw_func(ctx, st_draw_vbo); + } + else if (newMode == GL_SELECT) { + if (!st->selection_stage) + st->selection_stage = draw_glselect_stage(ctx, draw); + draw_set_rasterize_stage(draw, st->selection_stage); + /* Plug in new vbo draw function */ + vbo_set_draw_func(ctx, st_feedback_draw_vbo); + } + else { + if (!st->feedback_stage) + st->feedback_stage = draw_glfeedback_stage(ctx, draw); + draw_set_rasterize_stage(draw, st->feedback_stage); + /* Plug in new vbo draw function */ + vbo_set_draw_func(ctx, st_feedback_draw_vbo); + /* need to generate/use a vertex program that emits pos/color/tex */ + st->dirty.st |= ST_NEW_VERTEX_PROGRAM; + } +} + + + +void st_init_feedback_functions(struct dd_function_table *functions) +{ + functions->RenderMode = st_RenderMode; +} + +#endif /* FEATURE_feedback */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_feedback.h b/mesalib/src/mesa/state_tracker/st_cb_feedback.h index 3acb5b5b3..02e34e402 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_feedback.h +++ b/mesalib/src/mesa/state_tracker/st_cb_feedback.h @@ -1,52 +1,52 @@ -/************************************************************************** - * - * Copyright 2007 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 ST_CB_FEEDBACK_H -#define ST_CB_FEEDBACK_H - - -#include "main/compiler.h" -#include "main/mfeatures.h" - -struct dd_function_table; - -#if FEATURE_feedback - -extern void -st_init_feedback_functions(struct dd_function_table *functions); - -#else - -static INLINE void -st_init_feedback_functions(struct dd_function_table *functions) -{ -} - -#endif /* FEATURE_feedback */ - -#endif /* ST_CB_FEEDBACK_H */ +/************************************************************************** + * + * Copyright 2007 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 ST_CB_FEEDBACK_H +#define ST_CB_FEEDBACK_H + + +#include "main/compiler.h" +#include "main/mfeatures.h" + +struct dd_function_table; + +#if FEATURE_feedback + +extern void +st_init_feedback_functions(struct dd_function_table *functions); + +#else + +static INLINE void +st_init_feedback_functions(struct dd_function_table *functions) +{ +} + +#endif /* FEATURE_feedback */ + +#endif /* ST_CB_FEEDBACK_H */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_flush.h b/mesalib/src/mesa/state_tracker/st_cb_flush.h index 1fd0c56d7..598536ba0 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_flush.h +++ b/mesalib/src/mesa/state_tracker/st_cb_flush.h @@ -1,51 +1,51 @@ -/************************************************************************** - * - * Copyright 2007 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 ST_CB_FLUSH_H -#define ST_CB_FLUSH_H - - -#include "pipe/p_compiler.h" - -struct dd_function_table; -struct pipe_fence_handle; -struct st_context; - -extern void -st_init_flush_functions(struct dd_function_table *functions); - -extern void -st_flush(struct st_context *st, - struct pipe_fence_handle **fence); - -extern void -st_finish(struct st_context *st); - - -#endif /* ST_CB_FLUSH_H */ - +/************************************************************************** + * + * Copyright 2007 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 ST_CB_FLUSH_H +#define ST_CB_FLUSH_H + + +#include "pipe/p_compiler.h" + +struct dd_function_table; +struct pipe_fence_handle; +struct st_context; + +extern void +st_init_flush_functions(struct dd_function_table *functions); + +extern void +st_flush(struct st_context *st, + struct pipe_fence_handle **fence); + +extern void +st_finish(struct st_context *st); + + +#endif /* ST_CB_FLUSH_H */ + diff --git a/mesalib/src/mesa/state_tracker/st_cb_program.h b/mesalib/src/mesa/state_tracker/st_cb_program.h index 05d03e1e6..091a4439c 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_program.h +++ b/mesalib/src/mesa/state_tracker/st_cb_program.h @@ -1,38 +1,38 @@ -/************************************************************************** - * - * Copyright 2008 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 ST_CB_PROGRAM_H -#define ST_CB_PROGRAM_H - - -struct dd_function_table; - -extern void -st_init_program_functions(struct dd_function_table *functions); - - -#endif +/************************************************************************** + * + * Copyright 2008 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 ST_CB_PROGRAM_H +#define ST_CB_PROGRAM_H + + +struct dd_function_table; + +extern void +st_init_program_functions(struct dd_function_table *functions); + + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_cb_queryobj.h b/mesalib/src/mesa/state_tracker/st_cb_queryobj.h index 638dba9ec..03f0be837 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_queryobj.h +++ b/mesalib/src/mesa/state_tracker/st_cb_queryobj.h @@ -1,70 +1,70 @@ -/************************************************************************** - * - * Copyright 2007 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 ST_CB_QUERYOBJ_H -#define ST_CB_QUERYOBJ_H - - -#include "main/mfeatures.h" -#include "main/mtypes.h" - -/** - * Subclass of gl_query_object - */ -struct st_query_object -{ - struct gl_query_object base; - struct pipe_query *pq; - unsigned type; /**< PIPE_QUERY_x */ -}; - - -/** - * Cast wrapper - */ -static INLINE struct st_query_object * -st_query_object(struct gl_query_object *q) -{ - return (struct st_query_object *) q; -} - - -#if FEATURE_queryobj - -extern void -st_init_query_functions(struct dd_function_table *functions); - -#else - -static INLINE void -st_init_query_functions(struct dd_function_table *functions) -{ -} - -#endif /* FEATURE_queryobj */ - -#endif +/************************************************************************** + * + * Copyright 2007 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 ST_CB_QUERYOBJ_H +#define ST_CB_QUERYOBJ_H + + +#include "main/mfeatures.h" +#include "main/mtypes.h" + +/** + * Subclass of gl_query_object + */ +struct st_query_object +{ + struct gl_query_object base; + struct pipe_query *pq; + unsigned type; /**< PIPE_QUERY_x */ +}; + + +/** + * Cast wrapper + */ +static INLINE struct st_query_object * +st_query_object(struct gl_query_object *q) +{ + return (struct st_query_object *) q; +} + + +#if FEATURE_queryobj + +extern void +st_init_query_functions(struct dd_function_table *functions); + +#else + +static INLINE void +st_init_query_functions(struct dd_function_table *functions) +{ +} + +#endif /* FEATURE_queryobj */ + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_cb_rasterpos.h b/mesalib/src/mesa/state_tracker/st_cb_rasterpos.h index c8fe9d135..b61411bd2 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_rasterpos.h +++ b/mesalib/src/mesa/state_tracker/st_cb_rasterpos.h @@ -1,50 +1,50 @@ -/************************************************************************** - * - * Copyright 2007 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 ST_CB_RASTERPOS_H -#define ST_CB_RASTERPOS_H - - -#include "main/compiler.h" -#include "main/mfeatures.h" - -struct dd_function_table; - -#if FEATURE_rastpos - -extern void st_init_rasterpos_functions(struct dd_function_table *functions); - -#else - -static INLINE void -st_init_rasterpos_functions(struct dd_function_table *functions) -{ -} - -#endif /* FEATURE_rastpos */ - -#endif /* ST_CB_RASTERPOS_H */ +/************************************************************************** + * + * Copyright 2007 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 ST_CB_RASTERPOS_H +#define ST_CB_RASTERPOS_H + + +#include "main/compiler.h" +#include "main/mfeatures.h" + +struct dd_function_table; + +#if FEATURE_rastpos + +extern void st_init_rasterpos_functions(struct dd_function_table *functions); + +#else + +static INLINE void +st_init_rasterpos_functions(struct dd_function_table *functions) +{ +} + +#endif /* FEATURE_rastpos */ + +#endif /* ST_CB_RASTERPOS_H */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_strings.c b/mesalib/src/mesa/state_tracker/st_cb_strings.c index b382273ea..21323798f 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_strings.c +++ b/mesalib/src/mesa/state_tracker/st_cb_strings.c @@ -1,73 +1,73 @@ -/************************************************************************** - * - * Copyright 2007 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. - * - **************************************************************************/ - - /* - * Authors: - * Keith Whitwell - * Brian Paul - */ - -#include "main/glheader.h" -#include "main/macros.h" -#include "pipe/p_context.h" -#include "pipe/p_screen.h" -#include "util/u_string.h" -#include "st_context.h" -#include "st_cb_strings.h" - -#define ST_VERSION_STRING "0.4" - -static const GLubyte * -st_get_string(struct gl_context * ctx, GLenum name) -{ - struct st_context *st = st_context(ctx); - struct pipe_screen *screen = st->pipe->screen; - - switch (name) { - case GL_VENDOR: { - const char *vendor = screen->get_vendor( screen ); - util_snprintf(st->vendor, sizeof(st->vendor), "%s", vendor); - return (GLubyte *) st->vendor; - } - - case GL_RENDERER: - util_snprintf(st->renderer, sizeof(st->renderer), "Gallium %s on %s", - ST_VERSION_STRING, - screen->get_name( screen )); - - return (GLubyte *) st->renderer; - - default: - return NULL; - } -} - - -void st_init_string_functions(struct dd_function_table *functions) -{ - functions->GetString = st_get_string; -} +/************************************************************************** + * + * Copyright 2007 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. + * + **************************************************************************/ + + /* + * Authors: + * Keith Whitwell + * Brian Paul + */ + +#include "main/glheader.h" +#include "main/macros.h" +#include "pipe/p_context.h" +#include "pipe/p_screen.h" +#include "util/u_string.h" +#include "st_context.h" +#include "st_cb_strings.h" + +#define ST_VERSION_STRING "0.4" + +static const GLubyte * +st_get_string(struct gl_context * ctx, GLenum name) +{ + struct st_context *st = st_context(ctx); + struct pipe_screen *screen = st->pipe->screen; + + switch (name) { + case GL_VENDOR: { + const char *vendor = screen->get_vendor( screen ); + util_snprintf(st->vendor, sizeof(st->vendor), "%s", vendor); + return (GLubyte *) st->vendor; + } + + case GL_RENDERER: + util_snprintf(st->renderer, sizeof(st->renderer), "Gallium %s on %s", + ST_VERSION_STRING, + screen->get_name( screen )); + + return (GLubyte *) st->renderer; + + default: + return NULL; + } +} + + +void st_init_string_functions(struct dd_function_table *functions) +{ + functions->GetString = st_get_string; +} diff --git a/mesalib/src/mesa/state_tracker/st_cb_strings.h b/mesalib/src/mesa/state_tracker/st_cb_strings.h index 5b4fc2a72..92d5d2d9b 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_strings.h +++ b/mesalib/src/mesa/state_tracker/st_cb_strings.h @@ -1,40 +1,40 @@ -/************************************************************************** - * - * Copyright 2007 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 ST_CB_STRINGS_H -#define ST_CB_STRINGS_H - - -struct dd_function_table; - -extern void -st_init_string_functions(struct dd_function_table *functions); - - -#endif /* ST_CB_CLEAR_H */ - +/************************************************************************** + * + * Copyright 2007 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 ST_CB_STRINGS_H +#define ST_CB_STRINGS_H + + +struct dd_function_table; + +extern void +st_init_string_functions(struct dd_function_table *functions); + + +#endif /* ST_CB_CLEAR_H */ + diff --git a/mesalib/src/mesa/state_tracker/st_cb_syncobj.c b/mesalib/src/mesa/state_tracker/st_cb_syncobj.c index 7e243561a..d575a8497 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_syncobj.c +++ b/mesalib/src/mesa/state_tracker/st_cb_syncobj.c @@ -1,122 +1,122 @@ -/************************************************************************** - * - * Copyright 2011 Marek Olšák - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 AUTHORS 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: - * Marek Olšák - */ - -#include "main/glheader.h" -#include "main/macros.h" -#include "pipe/p_context.h" -#include "pipe/p_screen.h" -#include "st_context.h" -#include "st_cb_syncobj.h" - -struct st_sync_object { - struct gl_sync_object b; - - struct pipe_fence_handle *fence; -}; - - -static struct gl_sync_object * st_new_sync_object(struct gl_context *ctx, - GLenum type) -{ - if (type == GL_SYNC_FENCE) - return (struct gl_sync_object*)CALLOC_STRUCT(st_sync_object); - else - return NULL; -} - -static void st_delete_sync_object(struct gl_context *ctx, - struct gl_sync_object *obj) -{ - struct pipe_screen *screen = st_context(ctx)->pipe->screen; - struct st_sync_object *so = (struct st_sync_object*)obj; - - screen->fence_reference(screen, &so->fence, NULL); - FREE(so); -} - -static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj, - GLenum condition, GLbitfield flags) -{ - struct pipe_context *pipe = st_context(ctx)->pipe; - struct st_sync_object *so = (struct st_sync_object*)obj; - - assert(condition == GL_SYNC_GPU_COMMANDS_COMPLETE && flags == 0); - assert(so->fence == NULL); - - pipe->flush(pipe, &so->fence); -} - -static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj) -{ - struct pipe_screen *screen = st_context(ctx)->pipe->screen; - struct st_sync_object *so = (struct st_sync_object*)obj; - - if (so->fence && screen->fence_signalled(screen, so->fence)) { - screen->fence_reference(screen, &so->fence, NULL); - so->b.StatusFlag = GL_TRUE; - } -} - -static void st_client_wait_sync(struct gl_context *ctx, - struct gl_sync_object *obj, - GLbitfield flags, GLuint64 timeout) -{ - struct pipe_screen *screen = st_context(ctx)->pipe->screen; - struct st_sync_object *so = (struct st_sync_object*)obj; - - /* We don't care about GL_SYNC_FLUSH_COMMANDS_BIT, because flush is - * already called when creating a fence. */ - - if (so->fence && - screen->fence_finish(screen, so->fence, timeout)) { - screen->fence_reference(screen, &so->fence, NULL); - so->b.StatusFlag = GL_TRUE; - } -} - -static void st_server_wait_sync(struct gl_context *ctx, - struct gl_sync_object *obj, - GLbitfield flags, GLuint64 timeout) -{ - /* NO-OP. - * Neither Gallium nor DRM interfaces support blocking on the GPU. */ -} - -void st_init_syncobj_functions(struct dd_function_table *functions) -{ - functions->NewSyncObject = st_new_sync_object; - functions->FenceSync = st_fence_sync; - functions->DeleteSyncObject = st_delete_sync_object; - functions->CheckSync = st_check_sync; - functions->ClientWaitSync = st_client_wait_sync; - functions->ServerWaitSync = st_server_wait_sync; -} +/************************************************************************** + * + * Copyright 2011 Marek Olšák + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and 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 AUTHORS 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: + * Marek Olšák + */ + +#include "main/glheader.h" +#include "main/macros.h" +#include "pipe/p_context.h" +#include "pipe/p_screen.h" +#include "st_context.h" +#include "st_cb_syncobj.h" + +struct st_sync_object { + struct gl_sync_object b; + + struct pipe_fence_handle *fence; +}; + + +static struct gl_sync_object * st_new_sync_object(struct gl_context *ctx, + GLenum type) +{ + if (type == GL_SYNC_FENCE) + return (struct gl_sync_object*)CALLOC_STRUCT(st_sync_object); + else + return NULL; +} + +static void st_delete_sync_object(struct gl_context *ctx, + struct gl_sync_object *obj) +{ + struct pipe_screen *screen = st_context(ctx)->pipe->screen; + struct st_sync_object *so = (struct st_sync_object*)obj; + + screen->fence_reference(screen, &so->fence, NULL); + FREE(so); +} + +static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj, + GLenum condition, GLbitfield flags) +{ + struct pipe_context *pipe = st_context(ctx)->pipe; + struct st_sync_object *so = (struct st_sync_object*)obj; + + assert(condition == GL_SYNC_GPU_COMMANDS_COMPLETE && flags == 0); + assert(so->fence == NULL); + + pipe->flush(pipe, &so->fence); +} + +static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj) +{ + struct pipe_screen *screen = st_context(ctx)->pipe->screen; + struct st_sync_object *so = (struct st_sync_object*)obj; + + if (so->fence && screen->fence_signalled(screen, so->fence)) { + screen->fence_reference(screen, &so->fence, NULL); + so->b.StatusFlag = GL_TRUE; + } +} + +static void st_client_wait_sync(struct gl_context *ctx, + struct gl_sync_object *obj, + GLbitfield flags, GLuint64 timeout) +{ + struct pipe_screen *screen = st_context(ctx)->pipe->screen; + struct st_sync_object *so = (struct st_sync_object*)obj; + + /* We don't care about GL_SYNC_FLUSH_COMMANDS_BIT, because flush is + * already called when creating a fence. */ + + if (so->fence && + screen->fence_finish(screen, so->fence, timeout)) { + screen->fence_reference(screen, &so->fence, NULL); + so->b.StatusFlag = GL_TRUE; + } +} + +static void st_server_wait_sync(struct gl_context *ctx, + struct gl_sync_object *obj, + GLbitfield flags, GLuint64 timeout) +{ + /* NO-OP. + * Neither Gallium nor DRM interfaces support blocking on the GPU. */ +} + +void st_init_syncobj_functions(struct dd_function_table *functions) +{ + functions->NewSyncObject = st_new_sync_object; + functions->FenceSync = st_fence_sync; + functions->DeleteSyncObject = st_delete_sync_object; + functions->CheckSync = st_check_sync; + functions->ClientWaitSync = st_client_wait_sync; + functions->ServerWaitSync = st_server_wait_sync; +} diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index b24f9a1ce..9d1b7f672 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -530,62 +530,31 @@ prep_teximage(struct gl_context *ctx, struct gl_texture_image *texImage, static void -st_TexImage3D(struct gl_context * ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint depth, - GLint border, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *unpack) +st_TexImage(struct gl_context * ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint depth, GLint border, + GLenum format, GLenum type, const void *pixels, + const struct gl_pixelstore_attrib *unpack) { prep_teximage(ctx, texImage, internalFormat, width, height, depth, border, format, type); - _mesa_store_teximage3d(ctx, texImage, internalFormat, width, height, depth, - border, format, type, pixels, unpack); -} - - -static void -st_TexImage2D(struct gl_context * ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *unpack) -{ - prep_teximage(ctx, texImage, internalFormat, width, height, 1, border, - format, type); - _mesa_store_teximage2d(ctx, texImage, internalFormat, width, height, - border, format, type, pixels, unpack); -} - - -static void -st_TexImage1D(struct gl_context * ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *unpack) -{ - prep_teximage(ctx, texImage, internalFormat, width, 1, 1, border, - format, type); - _mesa_store_teximage1d(ctx, texImage, internalFormat, width, - border, format, type, pixels, unpack); + _mesa_store_teximage(ctx, dims, texImage, internalFormat, width, height, depth, + border, format, type, pixels, unpack); } static void -st_CompressedTexImage2D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLsizei imageSize, const GLvoid *data) +st_CompressedTexImage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint internalFormat, + GLint width, GLint height, GLint border, GLint depth, + GLsizei imageSize, const GLvoid *data) { - prep_teximage(ctx, texImage, internalFormat, width, 1, 1, border, + prep_teximage(ctx, texImage, internalFormat, width, height, depth, border, GL_NONE, GL_NONE); - _mesa_store_compressed_teximage2d(ctx, texImage, internalFormat, width, - height, border, imageSize, data); + _mesa_store_compressed_teximage(ctx, dims, texImage, internalFormat, width, + height, depth, border, imageSize, data); } @@ -959,12 +928,11 @@ compatible_src_dst_formats(struct gl_context *ctx, * Note: srcY=0=Bottom of renderbuffer (GL convention) */ static void -st_copy_texsubimage(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint destX, GLint destY, GLint destZ, - struct gl_renderbuffer *rb, - GLint srcX, GLint srcY, - GLsizei width, GLsizei height) +st_CopyTexSubImage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint destX, GLint destY, GLint destZ, + struct gl_renderbuffer *rb, + GLint srcX, GLint srcY, GLsizei width, GLsizei height) { struct st_texture_image *stImage = st_texture_image(texImage); const GLenum texBaseFormat = texImage->_BaseFormat; @@ -1127,49 +1095,6 @@ fallback: } - -static void -st_CopyTexSubImage1D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, GLsizei width) -{ - const GLint yoffset = 0, zoffset = 0; - const GLsizei height = 1; - st_copy_texsubimage(ctx, texImage, - xoffset, yoffset, zoffset, /* destX,Y,Z */ - rb, x, y, width, height); /* src X, Y, size */ -} - - -static void -st_CopyTexSubImage2D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, GLsizei width, GLsizei height) -{ - const GLint zoffset = 0; - st_copy_texsubimage(ctx, texImage, - xoffset, yoffset, zoffset, /* destX,Y,Z */ - rb, x, y, width, height); /* src X, Y, size */ -} - - -static void -st_CopyTexSubImage3D(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - struct gl_renderbuffer *rb, - GLint x, GLint y, GLsizei width, GLsizei height) -{ - st_copy_texsubimage(ctx, texImage, - xoffset, yoffset, zoffset, /* destX,Y,Z */ - rb, x, y, width, height); /* src X, Y, size */ -} - - /** * Copy image data from stImage into the texture object 'stObj' at level * 'dstLevel'. @@ -1427,24 +1352,16 @@ void st_init_texture_functions(struct dd_function_table *functions) { functions->ChooseTextureFormat = st_ChooseTextureFormat; - functions->TexImage1D = st_TexImage1D; - functions->TexImage2D = st_TexImage2D; - functions->TexImage3D = st_TexImage3D; - functions->TexSubImage1D = _mesa_store_texsubimage1d; - functions->TexSubImage2D = _mesa_store_texsubimage2d; - functions->TexSubImage3D = _mesa_store_texsubimage3d; - functions->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d; - functions->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d; - functions->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d; - functions->CopyTexSubImage1D = st_CopyTexSubImage1D; - functions->CopyTexSubImage2D = st_CopyTexSubImage2D; - functions->CopyTexSubImage3D = st_CopyTexSubImage3D; + functions->TexImage = st_TexImage; + functions->TexSubImage = _mesa_store_texsubimage; + functions->CompressedTexSubImage = _mesa_store_compressed_texsubimage; + functions->CopyTexSubImage = st_CopyTexSubImage; functions->GenerateMipmap = st_generate_mipmap; functions->GetTexImage = st_GetTexImage; /* compressed texture functions */ - functions->CompressedTexImage2D = st_CompressedTexImage2D; + functions->CompressedTexImage = st_CompressedTexImage; functions->GetCompressedTexImage = _mesa_get_compressed_teximage; functions->NewTextureObject = st_NewTextureObject; diff --git a/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.c b/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.c index 36668d343..2f1a22b58 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.c @@ -1,60 +1,60 @@ -/************************************************************************** - * - * Copyright 2011 Marek Olšák - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 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. - * - **************************************************************************/ - - -/** - * glTextureBarrierNV function - * - * \author Marek Olšák - */ - - -#include "main/imports.h" -#include "main/context.h" - -#include "pipe/p_context.h" -#include "pipe/p_defines.h" -#include "st_context.h" -#include "st_cb_texturebarrier.h" - - -/** - * Called via ctx->Driver.TextureBarrier() - */ -static void -st_TextureBarrier(struct gl_context *ctx) -{ - struct pipe_context *pipe = st_context(ctx)->pipe; - - pipe->texture_barrier(pipe); -} - - -void st_init_texture_barrier_functions(struct dd_function_table *functions) -{ - functions->TextureBarrier = st_TextureBarrier; -} +/************************************************************************** + * + * Copyright 2011 Marek Olšák + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and 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 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. + * + **************************************************************************/ + + +/** + * glTextureBarrierNV function + * + * \author Marek Olšák + */ + + +#include "main/imports.h" +#include "main/context.h" + +#include "pipe/p_context.h" +#include "pipe/p_defines.h" +#include "st_context.h" +#include "st_cb_texturebarrier.h" + + +/** + * Called via ctx->Driver.TextureBarrier() + */ +static void +st_TextureBarrier(struct gl_context *ctx) +{ + struct pipe_context *pipe = st_context(ctx)->pipe; + + pipe->texture_barrier(pipe); +} + + +void st_init_texture_barrier_functions(struct dd_function_table *functions) +{ + functions->TextureBarrier = st_TextureBarrier; +} diff --git a/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.h b/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.h index dc94cc443..3b7d3776f 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.h +++ b/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.h @@ -1,37 +1,37 @@ -/************************************************************************** - * - * Copyright 2011 Marek Olšák - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and 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 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 ST_CB_TEXTUREBARRIER_H -#define ST_CB_TEXTUREBARRIER_H - - -struct dd_function_table; - -extern void st_init_texture_barrier_functions(struct dd_function_table *functions); - - -#endif +/************************************************************************** + * + * Copyright 2011 Marek Olšák + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and 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 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 ST_CB_TEXTUREBARRIER_H +#define ST_CB_TEXTUREBARRIER_H + + +struct dd_function_table; + +extern void st_init_texture_barrier_functions(struct dd_function_table *functions); + + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_cb_viewport.h b/mesalib/src/mesa/state_tracker/st_cb_viewport.h index 7307aba1b..bcfd7cb68 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_viewport.h +++ b/mesalib/src/mesa/state_tracker/st_cb_viewport.h @@ -1,36 +1,36 @@ -/************************************************************************** - * - * Copyright 2009 VMware, 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 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 ST_CB_VIEWPORT_H -#define ST_CB_VIEWPORT_H - -struct dd_function_table; - -extern void -st_init_viewport_functions(struct dd_function_table *functions); - -#endif /* ST_CB_VIEW_PORT_H */ +/************************************************************************** + * + * Copyright 2009 VMware, 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 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 ST_CB_VIEWPORT_H +#define ST_CB_VIEWPORT_H + +struct dd_function_table; + +extern void +st_init_viewport_functions(struct dd_function_table *functions); + +#endif /* ST_CB_VIEW_PORT_H */ diff --git a/mesalib/src/mesa/state_tracker/st_debug.h b/mesalib/src/mesa/state_tracker/st_debug.h index 07864845f..4a060d775 100644 --- a/mesalib/src/mesa/state_tracker/st_debug.h +++ b/mesalib/src/mesa/state_tracker/st_debug.h @@ -1,72 +1,72 @@ -/************************************************************************** - * - * Copyright 2007 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 ST_DEBUG_H -#define ST_DEBUG_H - -#include "pipe/p_compiler.h" -#include "util/u_debug.h" - -extern void -st_print_current(void); - - -#define DEBUG_MESA 0x1 -#define DEBUG_TGSI 0x2 -#define DEBUG_CONSTANTS 0x4 -#define DEBUG_PIPE 0x8 -#define DEBUG_TEX 0x10 -#define DEBUG_FALLBACK 0x20 -#define DEBUG_QUERY 0x40 -#define DEBUG_SCREEN 0x80 - -#ifdef DEBUG -extern int ST_DEBUG; -#define DBSTR(x) x -#else -#define ST_DEBUG 0 -#define DBSTR(x) "" -#endif - -void st_debug_init( void ); - -static INLINE void -ST_DBG( unsigned flag, const char *fmt, ... ) -{ - if (ST_DEBUG & flag) - { - va_list args; - - va_start( args, fmt ); - debug_vprintf( fmt, args ); - va_end( args ); - } -} - - -#endif /* ST_DEBUG_H */ +/************************************************************************** + * + * Copyright 2007 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 ST_DEBUG_H +#define ST_DEBUG_H + +#include "pipe/p_compiler.h" +#include "util/u_debug.h" + +extern void +st_print_current(void); + + +#define DEBUG_MESA 0x1 +#define DEBUG_TGSI 0x2 +#define DEBUG_CONSTANTS 0x4 +#define DEBUG_PIPE 0x8 +#define DEBUG_TEX 0x10 +#define DEBUG_FALLBACK 0x20 +#define DEBUG_QUERY 0x40 +#define DEBUG_SCREEN 0x80 + +#ifdef DEBUG +extern int ST_DEBUG; +#define DBSTR(x) x +#else +#define ST_DEBUG 0 +#define DBSTR(x) "" +#endif + +void st_debug_init( void ); + +static INLINE void +ST_DBG( unsigned flag, const char *fmt, ... ) +{ + if (ST_DEBUG & flag) + { + va_list args; + + va_start( args, fmt ); + debug_vprintf( fmt, args ); + va_end( args ); + } +} + + +#endif /* ST_DEBUG_H */ diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index 953155f36..a9071f58c 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -592,6 +592,10 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.S3_s3tc = GL_FALSE; } + if (ctx->Const.NativeIntegers) { + ctx->Extensions.ARB_shader_bit_encoding = GL_TRUE; + } + if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY, PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) { #if 0 /* XXX re-enable when GLSL compiler again supports geometry shaders */ diff --git a/mesalib/src/mesa/state_tracker/st_extensions.h b/mesalib/src/mesa/state_tracker/st_extensions.h index f29f9e1cf..aa9b2b2b9 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.h +++ b/mesalib/src/mesa/state_tracker/st_extensions.h @@ -1,40 +1,40 @@ -/************************************************************************** - * - * Copyright 2007 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 ST_EXTENSIONS_H -#define ST_EXTENSIONS_H - - -struct st_context; - -extern void st_init_limits(struct st_context *st); - -extern void st_init_extensions(struct st_context *st); - - -#endif /* ST_EXTENSIONS_H */ +/************************************************************************** + * + * Copyright 2007 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 ST_EXTENSIONS_H +#define ST_EXTENSIONS_H + + +struct st_context; + +extern void st_init_limits(struct st_context *st); + +extern void st_init_extensions(struct st_context *st); + + +#endif /* ST_EXTENSIONS_H */ diff --git a/mesalib/src/mesa/state_tracker/st_gen_mipmap.h b/mesalib/src/mesa/state_tracker/st_gen_mipmap.h index 8a361a1f6..815c6a516 100644 --- a/mesalib/src/mesa/state_tracker/st_gen_mipmap.h +++ b/mesalib/src/mesa/state_tracker/st_gen_mipmap.h @@ -1,52 +1,52 @@ -/************************************************************************** - * - * Copyright 2008 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 ST_GEN_MIPMAP_H -#define ST_GEN_MIPMAP_H - - -#include "main/glheader.h" - -struct gl_context; -struct gl_texture_object; -struct st_context; - -extern void -st_init_generate_mipmap(struct st_context *st); - - -extern void -st_destroy_generate_mipmap(struct st_context *st); - - -extern void -st_generate_mipmap(struct gl_context *ctx, GLenum target, - struct gl_texture_object *texObj); - - -#endif /* ST_GEN_MIPMAP_H */ +/************************************************************************** + * + * Copyright 2008 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 ST_GEN_MIPMAP_H +#define ST_GEN_MIPMAP_H + + +#include "main/glheader.h" + +struct gl_context; +struct gl_texture_object; +struct st_context; + +extern void +st_init_generate_mipmap(struct st_context *st); + + +extern void +st_destroy_generate_mipmap(struct st_context *st); + + +extern void +st_generate_mipmap(struct gl_context *ctx, GLenum target, + struct gl_texture_object *texObj); + + +#endif /* ST_GEN_MIPMAP_H */ diff --git a/mesalib/src/mesa/state_tracker/st_gl_api.h b/mesalib/src/mesa/state_tracker/st_gl_api.h index 59782d0d5..55ad778c9 100644 --- a/mesalib/src/mesa/state_tracker/st_gl_api.h +++ b/mesalib/src/mesa/state_tracker/st_gl_api.h @@ -1,7 +1,7 @@ - -#ifndef ST_GL_API_H -#define ST_GL_API_H - -struct st_api *st_gl_api_create(void); - -#endif + +#ifndef ST_GL_API_H +#define ST_GL_API_H + +struct st_api *st_gl_api_create(void); + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index e8d60f80d..347a22f19 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -1762,6 +1762,12 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir) else emit(ir, TGSI_OPCODE_TRUNC, result_dst, op[0]); break; + case ir_unop_bitcast_f2i: + case ir_unop_bitcast_f2u: + case ir_unop_bitcast_i2f: + case ir_unop_bitcast_u2f: + result_src = op[0]; + break; case ir_unop_f2b: emit(ir, TGSI_OPCODE_SNE, result_dst, op[0], st_src_reg_for_float(0.0)); break; diff --git a/mesalib/src/mesa/state_tracker/st_manager.h b/mesalib/src/mesa/state_tracker/st_manager.h index ffe394cc4..6a9497839 100644 --- a/mesalib/src/mesa/state_tracker/st_manager.h +++ b/mesalib/src/mesa/state_tracker/st_manager.h @@ -1,52 +1,52 @@ -/* - * Mesa 3-D graphics library - * Version: 7.9 - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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: - * Chia-I Wu - */ - -#ifndef ST_MANAGER_H -#define ST_MANAGER_H - -#include "main/mtypes.h" - -#include "pipe/p_compiler.h" - -struct st_context; - -struct pipe_surface * -st_manager_get_egl_image_surface(struct st_context *st, - void *eglimg, unsigned usage); - -void -st_manager_flush_frontbuffer(struct st_context *st); - -void -st_manager_validate_framebuffers(struct st_context *st); - -boolean -st_manager_add_color_renderbuffer(struct st_context *st, struct gl_framebuffer *fb, - gl_buffer_index idx); - -#endif /* ST_MANAGER_H */ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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: + * Chia-I Wu + */ + +#ifndef ST_MANAGER_H +#define ST_MANAGER_H + +#include "main/mtypes.h" + +#include "pipe/p_compiler.h" + +struct st_context; + +struct pipe_surface * +st_manager_get_egl_image_surface(struct st_context *st, + void *eglimg, unsigned usage); + +void +st_manager_flush_frontbuffer(struct st_context *st); + +void +st_manager_validate_framebuffers(struct st_context *st); + +boolean +st_manager_add_color_renderbuffer(struct st_context *st, struct gl_framebuffer *fb, + gl_buffer_index idx); + +#endif /* ST_MANAGER_H */ diff --git a/mesalib/src/mesa/swrast/NOTES b/mesalib/src/mesa/swrast/NOTES index d6f991ee8..ea373aa12 100644 --- a/mesalib/src/mesa/swrast/NOTES +++ b/mesalib/src/mesa/swrast/NOTES @@ -1,55 +1,55 @@ -INTRODUCTION - -Mesa's native software rasterizer. This module provides the fallback -paths for rasterization operations and states that aren't accelerated -in hardware drivers, and as the full rasterization engine in software -drivers. - -The swrast module 'stands alone', relying only on interfaces to core -mesa and it's own driver interface. It knows nothing about the tnl or -other modules, allowing it to be used for fallback paths in future tnl -schemes without modification. - -As well as providing triangle/line/point rasterization functionality, -the module provides implementations of the pixel operations -(ReadPixels, etc), and texture operations (CopyTexSubImage) which may -be plugged in to the core Mesa driver interface where accelerated -versions of these operations are unavailable. - - -STATE - -To create and destroy the module: - - GLboolean _swrast_CreateContext( struct gl_context *ctx ); - void _swrast_DestroyContext( struct gl_context *ctx ); - -This module tracks state changes internally and maintains derived -values based on the current state. For this to work, the driver -ensure the following funciton is called whenever the state changes and -the swsetup module is 'awake': - - void _swrast_InvalidateState( struct gl_context *ctx, GLuint new_state ); - -There is no explicit call to put the swrast module to sleep. - - -CUSTOMIZATION - - void (*choose_point)( struct gl_context * ); - void (*choose_line)( struct gl_context * ); - void (*choose_triangle)( struct gl_context * ); - -Drivers may add additional triangle/line/point functions to swrast by -overriding these functions. It is necessary for the driver to be very -careful that it doesn't return an inappropriate function, eg a -rasterization function in feedback mode. See the X11 driver for -examples. - -DRIVER INTERFACE - -The swrast device driver provides swrast primarily with span- and -pixel- level interfaces to a framebuffer, with a few additional hooks -for locking and setting the read buffer. - +INTRODUCTION + +Mesa's native software rasterizer. This module provides the fallback +paths for rasterization operations and states that aren't accelerated +in hardware drivers, and as the full rasterization engine in software +drivers. + +The swrast module 'stands alone', relying only on interfaces to core +mesa and it's own driver interface. It knows nothing about the tnl or +other modules, allowing it to be used for fallback paths in future tnl +schemes without modification. + +As well as providing triangle/line/point rasterization functionality, +the module provides implementations of the pixel operations +(ReadPixels, etc), and texture operations (CopyTexSubImage) which may +be plugged in to the core Mesa driver interface where accelerated +versions of these operations are unavailable. + + +STATE + +To create and destroy the module: + + GLboolean _swrast_CreateContext( struct gl_context *ctx ); + void _swrast_DestroyContext( struct gl_context *ctx ); + +This module tracks state changes internally and maintains derived +values based on the current state. For this to work, the driver +ensure the following funciton is called whenever the state changes and +the swsetup module is 'awake': + + void _swrast_InvalidateState( struct gl_context *ctx, GLuint new_state ); + +There is no explicit call to put the swrast module to sleep. + + +CUSTOMIZATION + + void (*choose_point)( struct gl_context * ); + void (*choose_line)( struct gl_context * ); + void (*choose_triangle)( struct gl_context * ); + +Drivers may add additional triangle/line/point functions to swrast by +overriding these functions. It is necessary for the driver to be very +careful that it doesn't return an inappropriate function, eg a +rasterization function in feedback mode. See the X11 driver for +examples. + +DRIVER INTERFACE + +The swrast device driver provides swrast primarily with span- and +pixel- level interfaces to a framebuffer, with a few additional hooks +for locking and setting the read buffer. + See the definition of struct swrast_device_driver in swrast.h. \ No newline at end of file diff --git a/mesalib/src/mesa/swrast/s_aaline.h b/mesalib/src/mesa/swrast/s_aaline.h index 993c12eab..74d5518e1 100644 --- a/mesalib/src/mesa/swrast/s_aaline.h +++ b/mesalib/src/mesa/swrast/s_aaline.h @@ -1,38 +1,38 @@ - -/* - * 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 S_AALINE_H -#define S_AALINE_H - - -struct gl_context; - - -extern void -_swrast_choose_aa_line_function(struct gl_context *ctx); - - -#endif + +/* + * 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 S_AALINE_H +#define S_AALINE_H + + +struct gl_context; + + +extern void +_swrast_choose_aa_line_function(struct gl_context *ctx); + + +#endif diff --git a/mesalib/src/mesa/swrast/s_aatriangle.h b/mesalib/src/mesa/swrast/s_aatriangle.h index dec637920..e40efb198 100644 --- a/mesalib/src/mesa/swrast/s_aatriangle.h +++ b/mesalib/src/mesa/swrast/s_aatriangle.h @@ -1,38 +1,38 @@ - -/* - * 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 S_AATRIANGLE_H -#define S_AATRIANGLE_H - - -struct gl_context; - - -extern void -_swrast_set_aa_triangle_function(struct gl_context *ctx); - - -#endif + +/* + * 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 S_AATRIANGLE_H +#define S_AATRIANGLE_H + + +struct gl_context; + + +extern void +_swrast_set_aa_triangle_function(struct gl_context *ctx); + + +#endif diff --git a/mesalib/src/mesa/swrast/s_alpha.c b/mesalib/src/mesa/swrast/s_alpha.c index 798b506e4..df2181ba9 100644 --- a/mesalib/src/mesa/swrast/s_alpha.c +++ b/mesalib/src/mesa/swrast/s_alpha.c @@ -1,160 +1,160 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 1999-2006 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. - */ - -/** - * \file swrast/s_alpha.c - * \brief Functions to apply alpha test. - */ - -#include "main/glheader.h" -#include "main/context.h" -#include "main/colormac.h" -#include "main/macros.h" - -#include "s_alpha.h" -#include "s_context.h" - - -#define ALPHA_TEST(ALPHA, LOOP_CODE) \ -do { \ - switch (ctx->Color.AlphaFunc) { \ - case GL_LESS: \ - for (i = 0; i < n; i++) { \ - mask[i] &= (ALPHA < ref); \ - LOOP_CODE; \ - } \ - break; \ - case GL_LEQUAL: \ - for (i = 0; i < n; i++) { \ - mask[i] &= (ALPHA <= ref); \ - LOOP_CODE; \ - } \ - break; \ - case GL_GEQUAL: \ - for (i = 0; i < n; i++) { \ - mask[i] &= (ALPHA >= ref); \ - LOOP_CODE; \ - } \ - break; \ - case GL_GREATER: \ - for (i = 0; i < n; i++) { \ - mask[i] &= (ALPHA > ref); \ - LOOP_CODE; \ - } \ - break; \ - case GL_NOTEQUAL: \ - for (i = 0; i < n; i++) { \ - mask[i] &= (ALPHA != ref); \ - LOOP_CODE; \ - } \ - break; \ - case GL_EQUAL: \ - for (i = 0; i < n; i++) { \ - mask[i] &= (ALPHA == ref); \ - LOOP_CODE; \ - } \ - break; \ - default: \ - _mesa_problem(ctx, "Invalid alpha test in _swrast_alpha_test" ); \ - return 0; \ - } \ -} while (0) - - - -/** - * Perform the alpha test for an array of pixels. - * For pixels that fail the test, mask[i] will be set to 0. - * \return 0 if all pixels in the span failed the alpha test, - * 1 if one or more pixels passed the alpha test. - */ -GLint -_swrast_alpha_test(const struct gl_context *ctx, SWspan *span) -{ - const GLuint n = span->end; - GLubyte *mask = span->array->mask; - GLuint i; - - if (ctx->Color.AlphaFunc == GL_ALWAYS) { - /* do nothing */ - return 1; - } - else if (ctx->Color.AlphaFunc == GL_NEVER) { - /* All pixels failed - caller should check for this return value and - * act accordingly. - */ - span->writeAll = GL_FALSE; - return 0; - } - - if (span->arrayMask & SPAN_RGBA) { - /* Use array's alpha values */ - if (span->array->ChanType == GL_UNSIGNED_BYTE) { - GLubyte (*rgba)[4] = span->array->rgba8; - GLubyte ref; - CLAMPED_FLOAT_TO_UBYTE(ref, ctx->Color.AlphaRef); - ALPHA_TEST(rgba[i][ACOMP], ;); - } - else if (span->array->ChanType == GL_UNSIGNED_SHORT) { - GLushort (*rgba)[4] = span->array->rgba16; - GLushort ref; - CLAMPED_FLOAT_TO_USHORT(ref, ctx->Color.AlphaRef); - ALPHA_TEST(rgba[i][ACOMP], ;); - } - else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; - const GLfloat ref = ctx->Color.AlphaRef; - ALPHA_TEST(rgba[i][ACOMP], ;); - } - } - else { - /* Interpolate alpha values */ - ASSERT(span->interpMask & SPAN_RGBA); - if (span->array->ChanType == GL_UNSIGNED_BYTE) { - const GLfixed alphaStep = span->alphaStep; - GLfixed alpha = span->alpha; - GLubyte ref; - CLAMPED_FLOAT_TO_UBYTE(ref, ctx->Color.AlphaRef); - ALPHA_TEST(FixedToInt(alpha), alpha += alphaStep); - } - else if (span->array->ChanType == GL_UNSIGNED_SHORT) { - const GLfixed alphaStep = span->alphaStep; - GLfixed alpha = span->alpha; - GLushort ref; - CLAMPED_FLOAT_TO_USHORT(ref, ctx->Color.AlphaRef); - ALPHA_TEST(FixedToInt(alpha), alpha += alphaStep); - } - else { - const GLfloat alphaStep = FixedToFloat(span->alphaStep); - GLfloat alpha = FixedToFloat(span->alpha); - const GLfloat ref = ctx->Color.AlphaRef; - ALPHA_TEST(alpha, alpha += alphaStep); - } - } - - span->writeAll = GL_FALSE; - - /* XXX examine mask[] values? */ - return 1; -} +/* + * Mesa 3-D graphics library + * Version: 6.5.2 + * + * Copyright (C) 1999-2006 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. + */ + +/** + * \file swrast/s_alpha.c + * \brief Functions to apply alpha test. + */ + +#include "main/glheader.h" +#include "main/context.h" +#include "main/colormac.h" +#include "main/macros.h" + +#include "s_alpha.h" +#include "s_context.h" + + +#define ALPHA_TEST(ALPHA, LOOP_CODE) \ +do { \ + switch (ctx->Color.AlphaFunc) { \ + case GL_LESS: \ + for (i = 0; i < n; i++) { \ + mask[i] &= (ALPHA < ref); \ + LOOP_CODE; \ + } \ + break; \ + case GL_LEQUAL: \ + for (i = 0; i < n; i++) { \ + mask[i] &= (ALPHA <= ref); \ + LOOP_CODE; \ + } \ + break; \ + case GL_GEQUAL: \ + for (i = 0; i < n; i++) { \ + mask[i] &= (ALPHA >= ref); \ + LOOP_CODE; \ + } \ + break; \ + case GL_GREATER: \ + for (i = 0; i < n; i++) { \ + mask[i] &= (ALPHA > ref); \ + LOOP_CODE; \ + } \ + break; \ + case GL_NOTEQUAL: \ + for (i = 0; i < n; i++) { \ + mask[i] &= (ALPHA != ref); \ + LOOP_CODE; \ + } \ + break; \ + case GL_EQUAL: \ + for (i = 0; i < n; i++) { \ + mask[i] &= (ALPHA == ref); \ + LOOP_CODE; \ + } \ + break; \ + default: \ + _mesa_problem(ctx, "Invalid alpha test in _swrast_alpha_test" ); \ + return 0; \ + } \ +} while (0) + + + +/** + * Perform the alpha test for an array of pixels. + * For pixels that fail the test, mask[i] will be set to 0. + * \return 0 if all pixels in the span failed the alpha test, + * 1 if one or more pixels passed the alpha test. + */ +GLint +_swrast_alpha_test(const struct gl_context *ctx, SWspan *span) +{ + const GLuint n = span->end; + GLubyte *mask = span->array->mask; + GLuint i; + + if (ctx->Color.AlphaFunc == GL_ALWAYS) { + /* do nothing */ + return 1; + } + else if (ctx->Color.AlphaFunc == GL_NEVER) { + /* All pixels failed - caller should check for this return value and + * act accordingly. + */ + span->writeAll = GL_FALSE; + return 0; + } + + if (span->arrayMask & SPAN_RGBA) { + /* Use array's alpha values */ + if (span->array->ChanType == GL_UNSIGNED_BYTE) { + GLubyte (*rgba)[4] = span->array->rgba8; + GLubyte ref; + CLAMPED_FLOAT_TO_UBYTE(ref, ctx->Color.AlphaRef); + ALPHA_TEST(rgba[i][ACOMP], ;); + } + else if (span->array->ChanType == GL_UNSIGNED_SHORT) { + GLushort (*rgba)[4] = span->array->rgba16; + GLushort ref; + CLAMPED_FLOAT_TO_USHORT(ref, ctx->Color.AlphaRef); + ALPHA_TEST(rgba[i][ACOMP], ;); + } + else { + GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + const GLfloat ref = ctx->Color.AlphaRef; + ALPHA_TEST(rgba[i][ACOMP], ;); + } + } + else { + /* Interpolate alpha values */ + ASSERT(span->interpMask & SPAN_RGBA); + if (span->array->ChanType == GL_UNSIGNED_BYTE) { + const GLfixed alphaStep = span->alphaStep; + GLfixed alpha = span->alpha; + GLubyte ref; + CLAMPED_FLOAT_TO_UBYTE(ref, ctx->Color.AlphaRef); + ALPHA_TEST(FixedToInt(alpha), alpha += alphaStep); + } + else if (span->array->ChanType == GL_UNSIGNED_SHORT) { + const GLfixed alphaStep = span->alphaStep; + GLfixed alpha = span->alpha; + GLushort ref; + CLAMPED_FLOAT_TO_USHORT(ref, ctx->Color.AlphaRef); + ALPHA_TEST(FixedToInt(alpha), alpha += alphaStep); + } + else { + const GLfloat alphaStep = FixedToFloat(span->alphaStep); + GLfloat alpha = FixedToFloat(span->alpha); + const GLfloat ref = ctx->Color.AlphaRef; + ALPHA_TEST(alpha, alpha += alphaStep); + } + } + + span->writeAll = GL_FALSE; + + /* XXX examine mask[] values? */ + return 1; +} diff --git a/mesalib/src/mesa/swrast/s_alpha.h b/mesalib/src/mesa/swrast/s_alpha.h index ac5cd8dab..fca209a44 100644 --- a/mesalib/src/mesa/swrast/s_alpha.h +++ b/mesalib/src/mesa/swrast/s_alpha.h @@ -1,39 +1,39 @@ -/* - * 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. - */ - - -#ifndef S_ALPHA_H -#define S_ALPHA_H - - -#include "main/glheader.h" -#include "s_span.h" - -struct gl_context; - -extern GLint -_swrast_alpha_test( const struct gl_context *ctx, SWspan *span ); - - -#endif +/* + * 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. + */ + + +#ifndef S_ALPHA_H +#define S_ALPHA_H + + +#include "main/glheader.h" +#include "s_span.h" + +struct gl_context; + +extern GLint +_swrast_alpha_test( const struct gl_context *ctx, SWspan *span ); + + +#endif diff --git a/mesalib/src/mesa/swrast/s_atifragshader.c b/mesalib/src/mesa/swrast/s_atifragshader.c index 6019eea5e..1eb026e00 100644 --- a/mesalib/src/mesa/swrast/s_atifragshader.c +++ b/mesalib/src/mesa/swrast/s_atifragshader.c @@ -1,604 +1,604 @@ -/* - * Copyright (C) 2004 David Airlie All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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 AIRLIE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "main/glheader.h" -#include "main/colormac.h" -#include "main/macros.h" -#include "main/atifragshader.h" -#include "swrast/s_atifragshader.h" -#include "swrast/s_context.h" - - -/** - * State for executing ATI fragment shader. - */ -struct atifs_machine -{ - GLfloat Registers[6][4]; /** six temporary registers */ - GLfloat PrevPassRegisters[6][4]; - GLfloat Inputs[2][4]; /** Primary, secondary input colors */ -}; - - - -/** - * Fetch a texel. - */ -static void -fetch_texel(struct gl_context * ctx, const GLfloat texcoord[4], GLfloat lambda, - GLuint unit, GLfloat color[4]) -{ - SWcontext *swrast = SWRAST_CONTEXT(ctx); - - /* XXX use a float-valued TextureSample routine here!!! */ - swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current, - 1, (const GLfloat(*)[4]) texcoord, - &lambda, (GLfloat (*)[4]) color); -} - -static void -apply_swizzle(GLfloat values[4], GLuint swizzle) -{ - GLfloat s, t, r, q; - - s = values[0]; - t = values[1]; - r = values[2]; - q = values[3]; - - switch (swizzle) { - case GL_SWIZZLE_STR_ATI: - values[0] = s; - values[1] = t; - values[2] = r; - break; - case GL_SWIZZLE_STQ_ATI: - values[0] = s; - values[1] = t; - values[2] = q; - break; - case GL_SWIZZLE_STR_DR_ATI: - values[0] = s / r; - values[1] = t / r; - values[2] = 1 / r; - break; - case GL_SWIZZLE_STQ_DQ_ATI: -/* make sure q is not 0 to avoid problems later with infinite values (texture lookup)? */ - if (q == 0.0F) - q = 0.000000001F; - values[0] = s / q; - values[1] = t / q; - values[2] = 1.0F / q; - break; - } - values[3] = 0.0; -} - -static void -apply_src_rep(GLint optype, GLuint rep, GLfloat * val) -{ - GLint i; - GLint start, end; - if (!rep) - return; - - start = optype ? 3 : 0; - end = 4; - - for (i = start; i < end; i++) { - switch (rep) { - case GL_RED: - val[i] = val[0]; - break; - case GL_GREEN: - val[i] = val[1]; - break; - case GL_BLUE: - val[i] = val[2]; - break; - case GL_ALPHA: - val[i] = val[3]; - break; - } - } -} - -static void -apply_src_mod(GLint optype, GLuint mod, GLfloat * val) -{ - GLint i; - GLint start, end; - - if (!mod) - return; - - start = optype ? 3 : 0; - end = 4; - - for (i = start; i < end; i++) { - if (mod & GL_COMP_BIT_ATI) - val[i] = 1 - val[i]; - - if (mod & GL_BIAS_BIT_ATI) - val[i] = val[i] - 0.5F; - - if (mod & GL_2X_BIT_ATI) - val[i] = 2 * val[i]; - - if (mod & GL_NEGATE_BIT_ATI) - val[i] = -val[i]; - } -} - -static void -apply_dst_mod(GLuint optype, GLuint mod, GLfloat * val) -{ - GLint i; - GLint has_sat = mod & GL_SATURATE_BIT_ATI; - GLint start, end; - - mod &= ~GL_SATURATE_BIT_ATI; - - start = optype ? 3 : 0; - end = optype ? 4 : 3; - - for (i = start; i < end; i++) { - switch (mod) { - case GL_2X_BIT_ATI: - val[i] = 2 * val[i]; - break; - case GL_4X_BIT_ATI: - val[i] = 4 * val[i]; - break; - case GL_8X_BIT_ATI: - val[i] = 8 * val[i]; - break; - case GL_HALF_BIT_ATI: - val[i] = val[i] * 0.5F; - break; - case GL_QUARTER_BIT_ATI: - val[i] = val[i] * 0.25F; - break; - case GL_EIGHTH_BIT_ATI: - val[i] = val[i] * 0.125F; - break; - } - - if (has_sat) { - if (val[i] < 0.0F) - val[i] = 0.0F; - else if (val[i] > 1.0F) - val[i] = 1.0F; - } - else { - if (val[i] < -8.0F) - val[i] = -8.0F; - else if (val[i] > 8.0F) - val[i] = 8.0F; - } - } -} - - -static void -write_dst_addr(GLuint optype, GLuint mod, GLuint mask, GLfloat * src, - GLfloat * dst) -{ - GLint i; - apply_dst_mod(optype, mod, src); - - if (optype == ATI_FRAGMENT_SHADER_COLOR_OP) { - if (mask) { - if (mask & GL_RED_BIT_ATI) - dst[0] = src[0]; - - if (mask & GL_GREEN_BIT_ATI) - dst[1] = src[1]; - - if (mask & GL_BLUE_BIT_ATI) - dst[2] = src[2]; - } - else { - for (i = 0; i < 3; i++) - dst[i] = src[i]; - } - } - else - dst[3] = src[3]; -} - -static void -finish_pass(struct atifs_machine *machine) -{ - GLint i; - - for (i = 0; i < 6; i++) { - COPY_4V(machine->PrevPassRegisters[i], machine->Registers[i]); - } -} - -struct ati_fs_opcode_st ati_fs_opcodes[] = { - {GL_ADD_ATI, 2}, - {GL_SUB_ATI, 2}, - {GL_MUL_ATI, 2}, - {GL_MAD_ATI, 3}, - {GL_LERP_ATI, 3}, - {GL_MOV_ATI, 1}, - {GL_CND_ATI, 3}, - {GL_CND0_ATI, 3}, - {GL_DOT2_ADD_ATI, 3}, - {GL_DOT3_ATI, 2}, - {GL_DOT4_ATI, 2} -}; - - - -static void -handle_pass_op(struct atifs_machine *machine, struct atifs_setupinst *texinst, - const SWspan *span, GLuint column, GLuint idx) -{ - GLuint swizzle = texinst->swizzle; - GLuint pass_tex = texinst->src; - - if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) { - pass_tex -= GL_TEXTURE0_ARB; - COPY_4V(machine->Registers[idx], - span->array->attribs[FRAG_ATTRIB_TEX0 + pass_tex][column]); - } - else if (pass_tex >= GL_REG_0_ATI && pass_tex <= GL_REG_5_ATI) { - pass_tex -= GL_REG_0_ATI; - COPY_4V(machine->Registers[idx], machine->PrevPassRegisters[pass_tex]); - } - apply_swizzle(machine->Registers[idx], swizzle); - -} - -static void -handle_sample_op(struct gl_context * ctx, struct atifs_machine *machine, - struct atifs_setupinst *texinst, const SWspan *span, - GLuint column, GLuint idx) -{ -/* sample from unit idx using texinst->src as coords */ - GLuint swizzle = texinst->swizzle; - GLuint coord_source = texinst->src; - GLfloat tex_coords[4] = { 0 }; - - if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) { - coord_source -= GL_TEXTURE0_ARB; - COPY_4V(tex_coords, - span->array->attribs[FRAG_ATTRIB_TEX0 + coord_source][column]); - } - else if (coord_source >= GL_REG_0_ATI && coord_source <= GL_REG_5_ATI) { - coord_source -= GL_REG_0_ATI; - COPY_4V(tex_coords, machine->PrevPassRegisters[coord_source]); - } - apply_swizzle(tex_coords, swizzle); - fetch_texel(ctx, tex_coords, 0.0F, idx, machine->Registers[idx]); -} - -#define SETUP_SRC_REG(optype, i, x) \ -do { \ - COPY_4V(src[optype][i], x); \ -} while (0) - - - -/** - * Execute the given fragment shader. - * NOTE: we do everything in single-precision floating point - * \param ctx - rendering context - * \param shader - the shader to execute - * \param machine - virtual machine state - * \param span - the SWspan we're operating on - * \param column - which pixel [i] we're operating on in the span - */ -static void -execute_shader(struct gl_context *ctx, const struct ati_fragment_shader *shader, - struct atifs_machine *machine, const SWspan *span, - GLuint column) -{ - GLuint pc; - struct atifs_instruction *inst; - struct atifs_setupinst *texinst; - GLint optype; - GLuint i; - GLint j, pass; - GLint dstreg; - GLfloat src[2][3][4]; - GLfloat zeros[4] = { 0.0, 0.0, 0.0, 0.0 }; - GLfloat ones[4] = { 1.0, 1.0, 1.0, 1.0 }; - GLfloat dst[2][4], *dstp; - - for (pass = 0; pass < shader->NumPasses; pass++) { - if (pass > 0) - finish_pass(machine); - for (j = 0; j < MAX_NUM_FRAGMENT_REGISTERS_ATI; j++) { - texinst = &shader->SetupInst[pass][j]; - if (texinst->Opcode == ATI_FRAGMENT_SHADER_PASS_OP) - handle_pass_op(machine, texinst, span, column, j); - else if (texinst->Opcode == ATI_FRAGMENT_SHADER_SAMPLE_OP) - handle_sample_op(ctx, machine, texinst, span, column, j); - } - - for (pc = 0; pc < shader->numArithInstr[pass]; pc++) { - inst = &shader->Instructions[pass][pc]; - - /* setup the source registers for color and alpha ops */ - for (optype = 0; optype < 2; optype++) { - for (i = 0; i < inst->ArgCount[optype]; i++) { - GLint index = inst->SrcReg[optype][i].Index; - - if (index >= GL_REG_0_ATI && index <= GL_REG_5_ATI) - SETUP_SRC_REG(optype, i, - machine->Registers[index - GL_REG_0_ATI]); - else if (index >= GL_CON_0_ATI && index <= GL_CON_7_ATI) { - if (shader->LocalConstDef & (1 << (index - GL_CON_0_ATI))) { - SETUP_SRC_REG(optype, i, - shader->Constants[index - GL_CON_0_ATI]); - } else { - SETUP_SRC_REG(optype, i, - ctx->ATIFragmentShader.GlobalConstants[index - GL_CON_0_ATI]); - } - } - else if (index == GL_ONE) - SETUP_SRC_REG(optype, i, ones); - else if (index == GL_ZERO) - SETUP_SRC_REG(optype, i, zeros); - else if (index == GL_PRIMARY_COLOR_EXT) - SETUP_SRC_REG(optype, i, - machine->Inputs[ATI_FS_INPUT_PRIMARY]); - else if (index == GL_SECONDARY_INTERPOLATOR_ATI) - SETUP_SRC_REG(optype, i, - machine->Inputs[ATI_FS_INPUT_SECONDARY]); - - apply_src_rep(optype, inst->SrcReg[optype][i].argRep, - src[optype][i]); - apply_src_mod(optype, inst->SrcReg[optype][i].argMod, - src[optype][i]); - } - } - - /* Execute the operations - color then alpha */ - for (optype = 0; optype < 2; optype++) { - if (inst->Opcode[optype]) { - switch (inst->Opcode[optype]) { - case GL_ADD_ATI: - if (!optype) - for (i = 0; i < 3; i++) { - dst[optype][i] = - src[optype][0][i] + src[optype][1][i]; - } - else - dst[optype][3] = src[optype][0][3] + src[optype][1][3]; - break; - case GL_SUB_ATI: - if (!optype) - for (i = 0; i < 3; i++) { - dst[optype][i] = - src[optype][0][i] - src[optype][1][i]; - } - else - dst[optype][3] = src[optype][0][3] - src[optype][1][3]; - break; - case GL_MUL_ATI: - if (!optype) - for (i = 0; i < 3; i++) { - dst[optype][i] = - src[optype][0][i] * src[optype][1][i]; - } - else - dst[optype][3] = src[optype][0][3] * src[optype][1][3]; - break; - case GL_MAD_ATI: - if (!optype) - for (i = 0; i < 3; i++) { - dst[optype][i] = - src[optype][0][i] * src[optype][1][i] + - src[optype][2][i]; - } - else - dst[optype][3] = - src[optype][0][3] * src[optype][1][3] + - src[optype][2][3]; - break; - case GL_LERP_ATI: - if (!optype) - for (i = 0; i < 3; i++) { - dst[optype][i] = - src[optype][0][i] * src[optype][1][i] + (1 - - src - [optype] - [0][i]) * - src[optype][2][i]; - } - else - dst[optype][3] = - src[optype][0][3] * src[optype][1][3] + (1 - - src[optype] - [0][3]) * - src[optype][2][3]; - break; - - case GL_MOV_ATI: - if (!optype) - for (i = 0; i < 3; i++) { - dst[optype][i] = src[optype][0][i]; - } - else - dst[optype][3] = src[optype][0][3]; - break; - case GL_CND_ATI: - if (!optype) { - for (i = 0; i < 3; i++) { - dst[optype][i] = - (src[optype][2][i] > - 0.5) ? src[optype][0][i] : src[optype][1][i]; - } - } - else { - dst[optype][3] = - (src[optype][2][3] > - 0.5) ? src[optype][0][3] : src[optype][1][3]; - } - break; - - case GL_CND0_ATI: - if (!optype) - for (i = 0; i < 3; i++) { - dst[optype][i] = - (src[optype][2][i] >= - 0) ? src[optype][0][i] : src[optype][1][i]; - } - else { - dst[optype][3] = - (src[optype][2][3] >= - 0) ? src[optype][0][3] : src[optype][1][3]; - } - break; - case GL_DOT2_ADD_ATI: - { - GLfloat result; - - /* DOT 2 always uses the source from the color op */ - /* could save recalculation of dot products for alpha inst */ - result = src[0][0][0] * src[0][1][0] + - src[0][0][1] * src[0][1][1] + src[0][2][2]; - if (!optype) { - for (i = 0; i < 3; i++) { - dst[optype][i] = result; - } - } - else - dst[optype][3] = result; - } - break; - case GL_DOT3_ATI: - { - GLfloat result; - - /* DOT 3 always uses the source from the color op */ - result = src[0][0][0] * src[0][1][0] + - src[0][0][1] * src[0][1][1] + - src[0][0][2] * src[0][1][2]; - - if (!optype) { - for (i = 0; i < 3; i++) { - dst[optype][i] = result; - } - } - else - dst[optype][3] = result; - } - break; - case GL_DOT4_ATI: - { - GLfloat result; - - /* DOT 4 always uses the source from the color op */ - result = src[0][0][0] * src[0][1][0] + - src[0][0][1] * src[0][1][1] + - src[0][0][2] * src[0][1][2] + - src[0][0][3] * src[0][1][3]; - if (!optype) { - for (i = 0; i < 3; i++) { - dst[optype][i] = result; - } - } - else - dst[optype][3] = result; - } - break; - - } - } - } - - /* write out the destination registers */ - for (optype = 0; optype < 2; optype++) { - if (inst->Opcode[optype]) { - dstreg = inst->DstReg[optype].Index; - dstp = machine->Registers[dstreg - GL_REG_0_ATI]; - - if ((optype == 0) || ((inst->Opcode[1] != GL_DOT2_ADD_ATI) && - (inst->Opcode[1] != GL_DOT3_ATI) && (inst->Opcode[1] != GL_DOT4_ATI))) - write_dst_addr(optype, inst->DstReg[optype].dstMod, - inst->DstReg[optype].dstMask, dst[optype], - dstp); - else - write_dst_addr(1, inst->DstReg[0].dstMod, 0, dst[1], dstp); - } - } - } - } -} - - -/** - * Init fragment shader virtual machine state. - */ -static void -init_machine(struct gl_context * ctx, struct atifs_machine *machine, - const struct ati_fragment_shader *shader, - const SWspan *span, GLuint col) -{ - GLfloat (*inputs)[4] = machine->Inputs; - GLint i, j; - - for (i = 0; i < 6; i++) { - for (j = 0; j < 4; j++) - machine->Registers[i][j] = 0.0; - } - - COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[FRAG_ATTRIB_COL0][col]); - COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[FRAG_ATTRIB_COL1][col]); -} - - - -/** - * Execute the current ATI shader program, operating on the given span. - */ -void -_swrast_exec_fragment_shader(struct gl_context * ctx, SWspan *span) -{ - const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current; - struct atifs_machine machine; - GLuint i; - - /* incoming colors should be floats */ - ASSERT(span->array->ChanType == GL_FLOAT); - - for (i = 0; i < span->end; i++) { - if (span->array->mask[i]) { - init_machine(ctx, &machine, shader, span, i); - - execute_shader(ctx, shader, &machine, span, i); - - /* store result color */ - { - const GLfloat *colOut = machine.Registers[0]; - /*fprintf(stderr,"outputs %f %f %f %f\n", - colOut[0], colOut[1], colOut[2], colOut[3]); */ - COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], colOut); - } - } - } -} +/* + * Copyright (C) 2004 David Airlie All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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 AIRLIE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "main/glheader.h" +#include "main/colormac.h" +#include "main/macros.h" +#include "main/atifragshader.h" +#include "swrast/s_atifragshader.h" +#include "swrast/s_context.h" + + +/** + * State for executing ATI fragment shader. + */ +struct atifs_machine +{ + GLfloat Registers[6][4]; /** six temporary registers */ + GLfloat PrevPassRegisters[6][4]; + GLfloat Inputs[2][4]; /** Primary, secondary input colors */ +}; + + + +/** + * Fetch a texel. + */ +static void +fetch_texel(struct gl_context * ctx, const GLfloat texcoord[4], GLfloat lambda, + GLuint unit, GLfloat color[4]) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + /* XXX use a float-valued TextureSample routine here!!! */ + swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current, + 1, (const GLfloat(*)[4]) texcoord, + &lambda, (GLfloat (*)[4]) color); +} + +static void +apply_swizzle(GLfloat values[4], GLuint swizzle) +{ + GLfloat s, t, r, q; + + s = values[0]; + t = values[1]; + r = values[2]; + q = values[3]; + + switch (swizzle) { + case GL_SWIZZLE_STR_ATI: + values[0] = s; + values[1] = t; + values[2] = r; + break; + case GL_SWIZZLE_STQ_ATI: + values[0] = s; + values[1] = t; + values[2] = q; + break; + case GL_SWIZZLE_STR_DR_ATI: + values[0] = s / r; + values[1] = t / r; + values[2] = 1 / r; + break; + case GL_SWIZZLE_STQ_DQ_ATI: +/* make sure q is not 0 to avoid problems later with infinite values (texture lookup)? */ + if (q == 0.0F) + q = 0.000000001F; + values[0] = s / q; + values[1] = t / q; + values[2] = 1.0F / q; + break; + } + values[3] = 0.0; +} + +static void +apply_src_rep(GLint optype, GLuint rep, GLfloat * val) +{ + GLint i; + GLint start, end; + if (!rep) + return; + + start = optype ? 3 : 0; + end = 4; + + for (i = start; i < end; i++) { + switch (rep) { + case GL_RED: + val[i] = val[0]; + break; + case GL_GREEN: + val[i] = val[1]; + break; + case GL_BLUE: + val[i] = val[2]; + break; + case GL_ALPHA: + val[i] = val[3]; + break; + } + } +} + +static void +apply_src_mod(GLint optype, GLuint mod, GLfloat * val) +{ + GLint i; + GLint start, end; + + if (!mod) + return; + + start = optype ? 3 : 0; + end = 4; + + for (i = start; i < end; i++) { + if (mod & GL_COMP_BIT_ATI) + val[i] = 1 - val[i]; + + if (mod & GL_BIAS_BIT_ATI) + val[i] = val[i] - 0.5F; + + if (mod & GL_2X_BIT_ATI) + val[i] = 2 * val[i]; + + if (mod & GL_NEGATE_BIT_ATI) + val[i] = -val[i]; + } +} + +static void +apply_dst_mod(GLuint optype, GLuint mod, GLfloat * val) +{ + GLint i; + GLint has_sat = mod & GL_SATURATE_BIT_ATI; + GLint start, end; + + mod &= ~GL_SATURATE_BIT_ATI; + + start = optype ? 3 : 0; + end = optype ? 4 : 3; + + for (i = start; i < end; i++) { + switch (mod) { + case GL_2X_BIT_ATI: + val[i] = 2 * val[i]; + break; + case GL_4X_BIT_ATI: + val[i] = 4 * val[i]; + break; + case GL_8X_BIT_ATI: + val[i] = 8 * val[i]; + break; + case GL_HALF_BIT_ATI: + val[i] = val[i] * 0.5F; + break; + case GL_QUARTER_BIT_ATI: + val[i] = val[i] * 0.25F; + break; + case GL_EIGHTH_BIT_ATI: + val[i] = val[i] * 0.125F; + break; + } + + if (has_sat) { + if (val[i] < 0.0F) + val[i] = 0.0F; + else if (val[i] > 1.0F) + val[i] = 1.0F; + } + else { + if (val[i] < -8.0F) + val[i] = -8.0F; + else if (val[i] > 8.0F) + val[i] = 8.0F; + } + } +} + + +static void +write_dst_addr(GLuint optype, GLuint mod, GLuint mask, GLfloat * src, + GLfloat * dst) +{ + GLint i; + apply_dst_mod(optype, mod, src); + + if (optype == ATI_FRAGMENT_SHADER_COLOR_OP) { + if (mask) { + if (mask & GL_RED_BIT_ATI) + dst[0] = src[0]; + + if (mask & GL_GREEN_BIT_ATI) + dst[1] = src[1]; + + if (mask & GL_BLUE_BIT_ATI) + dst[2] = src[2]; + } + else { + for (i = 0; i < 3; i++) + dst[i] = src[i]; + } + } + else + dst[3] = src[3]; +} + +static void +finish_pass(struct atifs_machine *machine) +{ + GLint i; + + for (i = 0; i < 6; i++) { + COPY_4V(machine->PrevPassRegisters[i], machine->Registers[i]); + } +} + +struct ati_fs_opcode_st ati_fs_opcodes[] = { + {GL_ADD_ATI, 2}, + {GL_SUB_ATI, 2}, + {GL_MUL_ATI, 2}, + {GL_MAD_ATI, 3}, + {GL_LERP_ATI, 3}, + {GL_MOV_ATI, 1}, + {GL_CND_ATI, 3}, + {GL_CND0_ATI, 3}, + {GL_DOT2_ADD_ATI, 3}, + {GL_DOT3_ATI, 2}, + {GL_DOT4_ATI, 2} +}; + + + +static void +handle_pass_op(struct atifs_machine *machine, struct atifs_setupinst *texinst, + const SWspan *span, GLuint column, GLuint idx) +{ + GLuint swizzle = texinst->swizzle; + GLuint pass_tex = texinst->src; + + if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) { + pass_tex -= GL_TEXTURE0_ARB; + COPY_4V(machine->Registers[idx], + span->array->attribs[FRAG_ATTRIB_TEX0 + pass_tex][column]); + } + else if (pass_tex >= GL_REG_0_ATI && pass_tex <= GL_REG_5_ATI) { + pass_tex -= GL_REG_0_ATI; + COPY_4V(machine->Registers[idx], machine->PrevPassRegisters[pass_tex]); + } + apply_swizzle(machine->Registers[idx], swizzle); + +} + +static void +handle_sample_op(struct gl_context * ctx, struct atifs_machine *machine, + struct atifs_setupinst *texinst, const SWspan *span, + GLuint column, GLuint idx) +{ +/* sample from unit idx using texinst->src as coords */ + GLuint swizzle = texinst->swizzle; + GLuint coord_source = texinst->src; + GLfloat tex_coords[4] = { 0 }; + + if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) { + coord_source -= GL_TEXTURE0_ARB; + COPY_4V(tex_coords, + span->array->attribs[FRAG_ATTRIB_TEX0 + coord_source][column]); + } + else if (coord_source >= GL_REG_0_ATI && coord_source <= GL_REG_5_ATI) { + coord_source -= GL_REG_0_ATI; + COPY_4V(tex_coords, machine->PrevPassRegisters[coord_source]); + } + apply_swizzle(tex_coords, swizzle); + fetch_texel(ctx, tex_coords, 0.0F, idx, machine->Registers[idx]); +} + +#define SETUP_SRC_REG(optype, i, x) \ +do { \ + COPY_4V(src[optype][i], x); \ +} while (0) + + + +/** + * Execute the given fragment shader. + * NOTE: we do everything in single-precision floating point + * \param ctx - rendering context + * \param shader - the shader to execute + * \param machine - virtual machine state + * \param span - the SWspan we're operating on + * \param column - which pixel [i] we're operating on in the span + */ +static void +execute_shader(struct gl_context *ctx, const struct ati_fragment_shader *shader, + struct atifs_machine *machine, const SWspan *span, + GLuint column) +{ + GLuint pc; + struct atifs_instruction *inst; + struct atifs_setupinst *texinst; + GLint optype; + GLuint i; + GLint j, pass; + GLint dstreg; + GLfloat src[2][3][4]; + GLfloat zeros[4] = { 0.0, 0.0, 0.0, 0.0 }; + GLfloat ones[4] = { 1.0, 1.0, 1.0, 1.0 }; + GLfloat dst[2][4], *dstp; + + for (pass = 0; pass < shader->NumPasses; pass++) { + if (pass > 0) + finish_pass(machine); + for (j = 0; j < MAX_NUM_FRAGMENT_REGISTERS_ATI; j++) { + texinst = &shader->SetupInst[pass][j]; + if (texinst->Opcode == ATI_FRAGMENT_SHADER_PASS_OP) + handle_pass_op(machine, texinst, span, column, j); + else if (texinst->Opcode == ATI_FRAGMENT_SHADER_SAMPLE_OP) + handle_sample_op(ctx, machine, texinst, span, column, j); + } + + for (pc = 0; pc < shader->numArithInstr[pass]; pc++) { + inst = &shader->Instructions[pass][pc]; + + /* setup the source registers for color and alpha ops */ + for (optype = 0; optype < 2; optype++) { + for (i = 0; i < inst->ArgCount[optype]; i++) { + GLint index = inst->SrcReg[optype][i].Index; + + if (index >= GL_REG_0_ATI && index <= GL_REG_5_ATI) + SETUP_SRC_REG(optype, i, + machine->Registers[index - GL_REG_0_ATI]); + else if (index >= GL_CON_0_ATI && index <= GL_CON_7_ATI) { + if (shader->LocalConstDef & (1 << (index - GL_CON_0_ATI))) { + SETUP_SRC_REG(optype, i, + shader->Constants[index - GL_CON_0_ATI]); + } else { + SETUP_SRC_REG(optype, i, + ctx->ATIFragmentShader.GlobalConstants[index - GL_CON_0_ATI]); + } + } + else if (index == GL_ONE) + SETUP_SRC_REG(optype, i, ones); + else if (index == GL_ZERO) + SETUP_SRC_REG(optype, i, zeros); + else if (index == GL_PRIMARY_COLOR_EXT) + SETUP_SRC_REG(optype, i, + machine->Inputs[ATI_FS_INPUT_PRIMARY]); + else if (index == GL_SECONDARY_INTERPOLATOR_ATI) + SETUP_SRC_REG(optype, i, + machine->Inputs[ATI_FS_INPUT_SECONDARY]); + + apply_src_rep(optype, inst->SrcReg[optype][i].argRep, + src[optype][i]); + apply_src_mod(optype, inst->SrcReg[optype][i].argMod, + src[optype][i]); + } + } + + /* Execute the operations - color then alpha */ + for (optype = 0; optype < 2; optype++) { + if (inst->Opcode[optype]) { + switch (inst->Opcode[optype]) { + case GL_ADD_ATI: + if (!optype) + for (i = 0; i < 3; i++) { + dst[optype][i] = + src[optype][0][i] + src[optype][1][i]; + } + else + dst[optype][3] = src[optype][0][3] + src[optype][1][3]; + break; + case GL_SUB_ATI: + if (!optype) + for (i = 0; i < 3; i++) { + dst[optype][i] = + src[optype][0][i] - src[optype][1][i]; + } + else + dst[optype][3] = src[optype][0][3] - src[optype][1][3]; + break; + case GL_MUL_ATI: + if (!optype) + for (i = 0; i < 3; i++) { + dst[optype][i] = + src[optype][0][i] * src[optype][1][i]; + } + else + dst[optype][3] = src[optype][0][3] * src[optype][1][3]; + break; + case GL_MAD_ATI: + if (!optype) + for (i = 0; i < 3; i++) { + dst[optype][i] = + src[optype][0][i] * src[optype][1][i] + + src[optype][2][i]; + } + else + dst[optype][3] = + src[optype][0][3] * src[optype][1][3] + + src[optype][2][3]; + break; + case GL_LERP_ATI: + if (!optype) + for (i = 0; i < 3; i++) { + dst[optype][i] = + src[optype][0][i] * src[optype][1][i] + (1 - + src + [optype] + [0][i]) * + src[optype][2][i]; + } + else + dst[optype][3] = + src[optype][0][3] * src[optype][1][3] + (1 - + src[optype] + [0][3]) * + src[optype][2][3]; + break; + + case GL_MOV_ATI: + if (!optype) + for (i = 0; i < 3; i++) { + dst[optype][i] = src[optype][0][i]; + } + else + dst[optype][3] = src[optype][0][3]; + break; + case GL_CND_ATI: + if (!optype) { + for (i = 0; i < 3; i++) { + dst[optype][i] = + (src[optype][2][i] > + 0.5) ? src[optype][0][i] : src[optype][1][i]; + } + } + else { + dst[optype][3] = + (src[optype][2][3] > + 0.5) ? src[optype][0][3] : src[optype][1][3]; + } + break; + + case GL_CND0_ATI: + if (!optype) + for (i = 0; i < 3; i++) { + dst[optype][i] = + (src[optype][2][i] >= + 0) ? src[optype][0][i] : src[optype][1][i]; + } + else { + dst[optype][3] = + (src[optype][2][3] >= + 0) ? src[optype][0][3] : src[optype][1][3]; + } + break; + case GL_DOT2_ADD_ATI: + { + GLfloat result; + + /* DOT 2 always uses the source from the color op */ + /* could save recalculation of dot products for alpha inst */ + result = src[0][0][0] * src[0][1][0] + + src[0][0][1] * src[0][1][1] + src[0][2][2]; + if (!optype) { + for (i = 0; i < 3; i++) { + dst[optype][i] = result; + } + } + else + dst[optype][3] = result; + } + break; + case GL_DOT3_ATI: + { + GLfloat result; + + /* DOT 3 always uses the source from the color op */ + result = src[0][0][0] * src[0][1][0] + + src[0][0][1] * src[0][1][1] + + src[0][0][2] * src[0][1][2]; + + if (!optype) { + for (i = 0; i < 3; i++) { + dst[optype][i] = result; + } + } + else + dst[optype][3] = result; + } + break; + case GL_DOT4_ATI: + { + GLfloat result; + + /* DOT 4 always uses the source from the color op */ + result = src[0][0][0] * src[0][1][0] + + src[0][0][1] * src[0][1][1] + + src[0][0][2] * src[0][1][2] + + src[0][0][3] * src[0][1][3]; + if (!optype) { + for (i = 0; i < 3; i++) { + dst[optype][i] = result; + } + } + else + dst[optype][3] = result; + } + break; + + } + } + } + + /* write out the destination registers */ + for (optype = 0; optype < 2; optype++) { + if (inst->Opcode[optype]) { + dstreg = inst->DstReg[optype].Index; + dstp = machine->Registers[dstreg - GL_REG_0_ATI]; + + if ((optype == 0) || ((inst->Opcode[1] != GL_DOT2_ADD_ATI) && + (inst->Opcode[1] != GL_DOT3_ATI) && (inst->Opcode[1] != GL_DOT4_ATI))) + write_dst_addr(optype, inst->DstReg[optype].dstMod, + inst->DstReg[optype].dstMask, dst[optype], + dstp); + else + write_dst_addr(1, inst->DstReg[0].dstMod, 0, dst[1], dstp); + } + } + } + } +} + + +/** + * Init fragment shader virtual machine state. + */ +static void +init_machine(struct gl_context * ctx, struct atifs_machine *machine, + const struct ati_fragment_shader *shader, + const SWspan *span, GLuint col) +{ + GLfloat (*inputs)[4] = machine->Inputs; + GLint i, j; + + for (i = 0; i < 6; i++) { + for (j = 0; j < 4; j++) + machine->Registers[i][j] = 0.0; + } + + COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[FRAG_ATTRIB_COL0][col]); + COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[FRAG_ATTRIB_COL1][col]); +} + + + +/** + * Execute the current ATI shader program, operating on the given span. + */ +void +_swrast_exec_fragment_shader(struct gl_context * ctx, SWspan *span) +{ + const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current; + struct atifs_machine machine; + GLuint i; + + /* incoming colors should be floats */ + ASSERT(span->array->ChanType == GL_FLOAT); + + for (i = 0; i < span->end; i++) { + if (span->array->mask[i]) { + init_machine(ctx, &machine, shader, span, i); + + execute_shader(ctx, shader, &machine, span, i); + + /* store result color */ + { + const GLfloat *colOut = machine.Registers[0]; + /*fprintf(stderr,"outputs %f %f %f %f\n", + colOut[0], colOut[1], colOut[2], colOut[3]); */ + COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], colOut); + } + } + } +} diff --git a/mesalib/src/mesa/swrast/s_atifragshader.h b/mesalib/src/mesa/swrast/s_atifragshader.h index 16ed86fd7..10aaaa592 100644 --- a/mesalib/src/mesa/swrast/s_atifragshader.h +++ b/mesalib/src/mesa/swrast/s_atifragshader.h @@ -1,38 +1,38 @@ -/* - * Mesa 3-D graphics library - * Version: 6.1 - * - * Copyright (C) 1999-2003 David Airlie All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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 AIRLIE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION 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 S_ATIFRAGSHADER_H -#define S_ATIFRAGSHADER_H - - -#include "s_span.h" - -struct gl_context; - -extern void -_swrast_exec_fragment_shader( struct gl_context *ctx, SWspan *span ); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 6.1 + * + * Copyright (C) 1999-2003 David Airlie All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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 AIRLIE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION 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 S_ATIFRAGSHADER_H +#define S_ATIFRAGSHADER_H + + +#include "s_span.h" + +struct gl_context; + +extern void +_swrast_exec_fragment_shader( struct gl_context *ctx, SWspan *span ); + + +#endif diff --git a/mesalib/src/mesa/swrast/s_blend.h b/mesalib/src/mesa/swrast/s_blend.h index 8ecff52cf..69cd89e7a 100644 --- a/mesalib/src/mesa/swrast/s_blend.h +++ b/mesalib/src/mesa/swrast/s_blend.h @@ -1,45 +1,45 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 1999-2006 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 S_BLEND_H -#define S_BLEND_H - - -#include "main/glheader.h" -#include "s_span.h" - -struct gl_context; -struct gl_renderbuffer; - - -extern void -_swrast_blend_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span); - - -extern void -_swrast_choose_blend_func(struct gl_context *ctx, GLenum chanType); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 6.5.2 + * + * Copyright (C) 1999-2006 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 S_BLEND_H +#define S_BLEND_H + + +#include "main/glheader.h" +#include "s_span.h" + +struct gl_context; +struct gl_renderbuffer; + + +extern void +_swrast_blend_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span); + + +extern void +_swrast_choose_blend_func(struct gl_context *ctx, GLenum chanType); + + +#endif diff --git a/mesalib/src/mesa/swrast/s_feedback.c b/mesalib/src/mesa/swrast/s_feedback.c index e548bf9c3..00f92d463 100644 --- a/mesalib/src/mesa/swrast/s_feedback.c +++ b/mesalib/src/mesa/swrast/s_feedback.c @@ -1,138 +1,138 @@ -/* - * Mesa 3-D graphics library - * Version: 7.0 - * - * Copyright (C) 1999-2007 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 "main/glheader.h" -#include "main/colormac.h" -#include "main/feedback.h" -#include "main/macros.h" - -#include "s_context.h" -#include "s_feedback.h" -#include "s_triangle.h" - - - -static void -feedback_vertex(struct gl_context * ctx, const SWvertex * v, const SWvertex * pv) -{ - GLfloat win[4]; - const GLfloat *vtc = v->attrib[FRAG_ATTRIB_TEX0]; - const GLfloat *color = v->attrib[FRAG_ATTRIB_COL0]; - - win[0] = v->attrib[FRAG_ATTRIB_WPOS][0]; - win[1] = v->attrib[FRAG_ATTRIB_WPOS][1]; - win[2] = v->attrib[FRAG_ATTRIB_WPOS][2] / ctx->DrawBuffer->_DepthMaxF; - win[3] = 1.0F / v->attrib[FRAG_ATTRIB_WPOS][3]; - - _mesa_feedback_vertex(ctx, win, color, vtc); -} - - -/* - * Put triangle in feedback buffer. - */ -void -_swrast_feedback_triangle(struct gl_context *ctx, const SWvertex *v0, - const SWvertex *v1, const SWvertex *v2) -{ - if (!_swrast_culltriangle(ctx, v0, v1, v2)) { - _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN); - _mesa_feedback_token(ctx, (GLfloat) 3); /* three vertices */ - - if (ctx->Light.ShadeModel == GL_SMOOTH) { - feedback_vertex(ctx, v0, v0); - feedback_vertex(ctx, v1, v1); - feedback_vertex(ctx, v2, v2); - } - else { - feedback_vertex(ctx, v0, v2); - feedback_vertex(ctx, v1, v2); - feedback_vertex(ctx, v2, v2); - } - } -} - - -void -_swrast_feedback_line(struct gl_context *ctx, const SWvertex *v0, - const SWvertex *v1) -{ - GLenum token = GL_LINE_TOKEN; - SWcontext *swrast = SWRAST_CONTEXT(ctx); - - if (swrast->StippleCounter == 0) - token = GL_LINE_RESET_TOKEN; - - _mesa_feedback_token(ctx, (GLfloat) (GLint) token); - - if (ctx->Light.ShadeModel == GL_SMOOTH) { - feedback_vertex(ctx, v0, v0); - feedback_vertex(ctx, v1, v1); - } - else { - feedback_vertex(ctx, v0, v1); - feedback_vertex(ctx, v1, v1); - } - - swrast->StippleCounter++; -} - - -void -_swrast_feedback_point(struct gl_context *ctx, const SWvertex *v) -{ - _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POINT_TOKEN); - feedback_vertex(ctx, v, v); -} - - -void -_swrast_select_triangle(struct gl_context *ctx, const SWvertex *v0, - const SWvertex *v1, const SWvertex *v2) -{ - if (!_swrast_culltriangle(ctx, v0, v1, v2)) { - const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; - - _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs ); - _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs ); - _mesa_update_hitflag( ctx, v2->attrib[FRAG_ATTRIB_WPOS][2] * zs ); - } -} - - -void -_swrast_select_line(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) -{ - const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; - _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs ); - _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs ); -} - - -void -_swrast_select_point(struct gl_context *ctx, const SWvertex *v) -{ - const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; - _mesa_update_hitflag( ctx, v->attrib[FRAG_ATTRIB_WPOS][2] * zs ); -} +/* + * Mesa 3-D graphics library + * Version: 7.0 + * + * Copyright (C) 1999-2007 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 "main/glheader.h" +#include "main/colormac.h" +#include "main/feedback.h" +#include "main/macros.h" + +#include "s_context.h" +#include "s_feedback.h" +#include "s_triangle.h" + + + +static void +feedback_vertex(struct gl_context * ctx, const SWvertex * v, const SWvertex * pv) +{ + GLfloat win[4]; + const GLfloat *vtc = v->attrib[FRAG_ATTRIB_TEX0]; + const GLfloat *color = v->attrib[FRAG_ATTRIB_COL0]; + + win[0] = v->attrib[FRAG_ATTRIB_WPOS][0]; + win[1] = v->attrib[FRAG_ATTRIB_WPOS][1]; + win[2] = v->attrib[FRAG_ATTRIB_WPOS][2] / ctx->DrawBuffer->_DepthMaxF; + win[3] = 1.0F / v->attrib[FRAG_ATTRIB_WPOS][3]; + + _mesa_feedback_vertex(ctx, win, color, vtc); +} + + +/* + * Put triangle in feedback buffer. + */ +void +_swrast_feedback_triangle(struct gl_context *ctx, const SWvertex *v0, + const SWvertex *v1, const SWvertex *v2) +{ + if (!_swrast_culltriangle(ctx, v0, v1, v2)) { + _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN); + _mesa_feedback_token(ctx, (GLfloat) 3); /* three vertices */ + + if (ctx->Light.ShadeModel == GL_SMOOTH) { + feedback_vertex(ctx, v0, v0); + feedback_vertex(ctx, v1, v1); + feedback_vertex(ctx, v2, v2); + } + else { + feedback_vertex(ctx, v0, v2); + feedback_vertex(ctx, v1, v2); + feedback_vertex(ctx, v2, v2); + } + } +} + + +void +_swrast_feedback_line(struct gl_context *ctx, const SWvertex *v0, + const SWvertex *v1) +{ + GLenum token = GL_LINE_TOKEN; + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + if (swrast->StippleCounter == 0) + token = GL_LINE_RESET_TOKEN; + + _mesa_feedback_token(ctx, (GLfloat) (GLint) token); + + if (ctx->Light.ShadeModel == GL_SMOOTH) { + feedback_vertex(ctx, v0, v0); + feedback_vertex(ctx, v1, v1); + } + else { + feedback_vertex(ctx, v0, v1); + feedback_vertex(ctx, v1, v1); + } + + swrast->StippleCounter++; +} + + +void +_swrast_feedback_point(struct gl_context *ctx, const SWvertex *v) +{ + _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POINT_TOKEN); + feedback_vertex(ctx, v, v); +} + + +void +_swrast_select_triangle(struct gl_context *ctx, const SWvertex *v0, + const SWvertex *v1, const SWvertex *v2) +{ + if (!_swrast_culltriangle(ctx, v0, v1, v2)) { + const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; + + _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs ); + _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs ); + _mesa_update_hitflag( ctx, v2->attrib[FRAG_ATTRIB_WPOS][2] * zs ); + } +} + + +void +_swrast_select_line(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) +{ + const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; + _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs ); + _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs ); +} + + +void +_swrast_select_point(struct gl_context *ctx, const SWvertex *v) +{ + const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; + _mesa_update_hitflag( ctx, v->attrib[FRAG_ATTRIB_WPOS][2] * zs ); +} diff --git a/mesalib/src/mesa/swrast/s_feedback.h b/mesalib/src/mesa/swrast/s_feedback.h index f0ca2c0e6..6bfd49735 100644 --- a/mesalib/src/mesa/swrast/s_feedback.h +++ b/mesalib/src/mesa/swrast/s_feedback.h @@ -1,50 +1,50 @@ - -/* - * 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 S_FEEDBACK_H -#define S_FEEDBACK_H - - -#include "swrast.h" - - -extern void _swrast_feedback_point( struct gl_context *ctx, const SWvertex *v ); - -extern void _swrast_feedback_line( struct gl_context *ctx, - const SWvertex *v1, const SWvertex *v2 ); - -extern void _swrast_feedback_triangle( struct gl_context *ctx, const SWvertex *v0, - const SWvertex *v1, const SWvertex *v2 ); - -extern void _swrast_select_point( struct gl_context *ctx, const SWvertex *v ); - -extern void _swrast_select_line( struct gl_context *ctx, - const SWvertex *v1, const SWvertex *v2 ); - -extern void _swrast_select_triangle( struct gl_context *ctx, const SWvertex *v0, - const SWvertex *v1, const SWvertex *v2 ); - -#endif + +/* + * 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 S_FEEDBACK_H +#define S_FEEDBACK_H + + +#include "swrast.h" + + +extern void _swrast_feedback_point( struct gl_context *ctx, const SWvertex *v ); + +extern void _swrast_feedback_line( struct gl_context *ctx, + const SWvertex *v1, const SWvertex *v2 ); + +extern void _swrast_feedback_triangle( struct gl_context *ctx, const SWvertex *v0, + const SWvertex *v1, const SWvertex *v2 ); + +extern void _swrast_select_point( struct gl_context *ctx, const SWvertex *v ); + +extern void _swrast_select_line( struct gl_context *ctx, + const SWvertex *v1, const SWvertex *v2 ); + +extern void _swrast_select_triangle( struct gl_context *ctx, const SWvertex *v0, + const SWvertex *v1, const SWvertex *v2 ); + +#endif diff --git a/mesalib/src/mesa/swrast/s_fog.h b/mesalib/src/mesa/swrast/s_fog.h index eed9b8bdd..9f93b7050 100644 --- a/mesalib/src/mesa/swrast/s_fog.h +++ b/mesalib/src/mesa/swrast/s_fog.h @@ -1,42 +1,42 @@ - -/* - * 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. - */ - - -#ifndef S_FOG_H -#define S_FOG_H - - -#include "main/glheader.h" -#include "s_span.h" - -struct gl_context; - -extern GLfloat -_swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z); - -extern void -_swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ); - -#endif + +/* + * 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. + */ + + +#ifndef S_FOG_H +#define S_FOG_H + + +#include "main/glheader.h" +#include "s_span.h" + +struct gl_context; + +extern GLfloat +_swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z); + +extern void +_swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ); + +#endif diff --git a/mesalib/src/mesa/swrast/s_lines.h b/mesalib/src/mesa/swrast/s_lines.h index 0f95eecab..a4c98a855 100644 --- a/mesalib/src/mesa/swrast/s_lines.h +++ b/mesalib/src/mesa/swrast/s_lines.h @@ -1,41 +1,41 @@ - -/* - * 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 S_LINES_H -#define S_LINES_H - -#include "swrast.h" - -void -_swrast_choose_line( struct gl_context *ctx ); - -void -_swrast_add_spec_terms_line( struct gl_context *ctx, - const SWvertex *v0, - const SWvertex *v1 ); - - -#endif + +/* + * 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 S_LINES_H +#define S_LINES_H + +#include "swrast.h" + +void +_swrast_choose_line( struct gl_context *ctx ); + +void +_swrast_add_spec_terms_line( struct gl_context *ctx, + const SWvertex *v0, + const SWvertex *v1 ); + + +#endif diff --git a/mesalib/src/mesa/swrast/s_logic.h b/mesalib/src/mesa/swrast/s_logic.h index 39713b990..0a3adfca5 100644 --- a/mesalib/src/mesa/swrast/s_logic.h +++ b/mesalib/src/mesa/swrast/s_logic.h @@ -1,40 +1,40 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 1999-2006 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 S_LOGIC_H -#define S_LOGIC_H - - -#include "s_span.h" - -struct gl_context; -struct gl_renderbuffer; - -extern void -_swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, - SWspan *span); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 6.5.2 + * + * Copyright (C) 1999-2006 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 S_LOGIC_H +#define S_LOGIC_H + + +#include "s_span.h" + +struct gl_context; +struct gl_renderbuffer; + +extern void +_swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, + SWspan *span); + + +#endif diff --git a/mesalib/src/mesa/swrast/s_masking.h b/mesalib/src/mesa/swrast/s_masking.h index 7ab02cc7a..5124509a0 100644 --- a/mesalib/src/mesa/swrast/s_masking.h +++ b/mesalib/src/mesa/swrast/s_masking.h @@ -1,41 +1,41 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 1999-2006 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 S_MASKING_H -#define S_MASKING_H - - -#include "main/glheader.h" -#include "s_span.h" - -struct gl_context; -struct gl_renderbuffer; - - -extern void -_swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, - SWspan *span, GLuint buf); - -#endif +/* + * Mesa 3-D graphics library + * Version: 6.5.2 + * + * Copyright (C) 1999-2006 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 S_MASKING_H +#define S_MASKING_H + + +#include "main/glheader.h" +#include "s_span.h" + +struct gl_context; +struct gl_renderbuffer; + + +extern void +_swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, + SWspan *span, GLuint buf); + +#endif diff --git a/mesalib/src/mesa/swrast/s_points.h b/mesalib/src/mesa/swrast/s_points.h index d99470bfe..0b6550e80 100644 --- a/mesalib/src/mesa/swrast/s_points.h +++ b/mesalib/src/mesa/swrast/s_points.h @@ -1,39 +1,39 @@ - -/* - * 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 S_POINTS_H -#define S_POINTS_H - -#include "swrast.h" - -extern void -_swrast_choose_point( struct gl_context *ctx ); - -extern void -_swrast_add_spec_terms_point( struct gl_context *ctx, - const SWvertex *v0 ); - -#endif + +/* + * 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 S_POINTS_H +#define S_POINTS_H + +#include "swrast.h" + +extern void +_swrast_choose_point( struct gl_context *ctx ); + +extern void +_swrast_add_spec_terms_point( struct gl_context *ctx, + const SWvertex *v0 ); + +#endif diff --git a/mesalib/src/mesa/swrast/s_texcombine.h b/mesalib/src/mesa/swrast/s_texcombine.h index 3897acd69..11049d86b 100644 --- a/mesalib/src/mesa/swrast/s_texcombine.h +++ b/mesalib/src/mesa/swrast/s_texcombine.h @@ -1,37 +1,37 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * 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. - */ - - -#ifndef S_TEXCOMBINE_H -#define S_TEXCOMBINE_H - - -#include "s_span.h" - -struct gl_context; - -extern void -_swrast_texture_span( struct gl_context *ctx, SWspan *span ); - -#endif +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * 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. + */ + + +#ifndef S_TEXCOMBINE_H +#define S_TEXCOMBINE_H + + +#include "s_span.h" + +struct gl_context; + +extern void +_swrast_texture_span( struct gl_context *ctx, SWspan *span ); + +#endif diff --git a/mesalib/src/mesa/swrast/s_triangle.h b/mesalib/src/mesa/swrast/s_triangle.h index bde5dd58b..46e23d420 100644 --- a/mesalib/src/mesa/swrast/s_triangle.h +++ b/mesalib/src/mesa/swrast/s_triangle.h @@ -1,50 +1,50 @@ - -/* - * 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. - */ - - -#ifndef S_TRIANGLES_H -#define S_TRIANGLES_H - - -#include "swrast.h" - - -extern GLboolean -_swrast_culltriangle( struct gl_context *ctx, - const SWvertex *v0, - const SWvertex *v1, - const SWvertex *v2); - -extern void -_swrast_choose_triangle( struct gl_context *ctx ); - -extern void -_swrast_add_spec_terms_triangle( struct gl_context *ctx, - const SWvertex *v0, - const SWvertex *v1, - const SWvertex *v2 ); - - -#endif + +/* + * 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. + */ + + +#ifndef S_TRIANGLES_H +#define S_TRIANGLES_H + + +#include "swrast.h" + + +extern GLboolean +_swrast_culltriangle( struct gl_context *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2); + +extern void +_swrast_choose_triangle( struct gl_context *ctx ); + +extern void +_swrast_add_spec_terms_triangle( struct gl_context *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2 ); + + +#endif diff --git a/mesalib/src/mesa/swrast_setup/NOTES b/mesalib/src/mesa/swrast_setup/NOTES index b5d2c503e..bdf57c39e 100644 --- a/mesalib/src/mesa/swrast_setup/NOTES +++ b/mesalib/src/mesa/swrast_setup/NOTES @@ -1,65 +1,65 @@ -INTRODUCTION - -A helper module which provides glue to bind the software rasterizer to -the software t&l module. The main task of this module is to build -swrast vertices from the t&l vertex_buffer structs, and to use them to -perform triangle setup functions not implemented in the software -rasterizer. - -The module implements a full set of functions to plug into the -t_vb_render.c driver interface (tnl->Driver.Render.*). - -There are strong advantages to decoupling the software rasterizer from -the t&l module, primarily allowing hardware drivers better control -over fallbacks, the removal of implicit knowledge about the software -rasterizer in the t&l module, allowing the two modules to evolve -independently and allowing either to be substituted with equivalent -functionality from another codebase. - -This module implements triangle/quad setup for offset, unfilled and -twoside-lit triangles. The software rasterizer doesn't handle these -primitives directly. - -Hardware rasterization drivers typically use this module in situations -where no hardware rasterization is possible, ie during total -fallbacks. - -STATE - -To create and destroy the module: - - GLboolean _swsetup_CreateContext( struct gl_context *ctx ); - void _swsetup_DestroyContext( struct gl_context *ctx ); - -The module is not active by default, and must be installed by calling -_swrast_Wakeup(). This function installs internal swrast_setup -functions into all the tnl->Driver.Render driver hooks, thus taking -over the task of rasterization entirely: - - void _swrast_Wakeup( struct gl_context *ctx ); - - -This module tracks state changes internally and maintains derived -values based on the current state. For this to work, the driver -ensure the following funciton is called whenever the state changes and -the swsetup module is 'awake': - - void _swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state ); - -There is no explicit call to put the swsetup module to sleep. Simply -install other function pointers into all the tnl->Driver.Render.* -hooks, and (optionally) cease calling _swsetup_InvalidateState(). - -DRIVER INTERFACE - -The module offers a minimal driver interface: - - void (*Start)( struct gl_context *ctx ); - void (*Finish)( struct gl_context *ctx ); - -These are called before and after the completion of all swrast drawing -activity. As swrast doesn't call callbacks during triangle, line or -point rasterization, these are necessary to provide locking hooks for -some drivers. They may otherwise be left null. - - +INTRODUCTION + +A helper module which provides glue to bind the software rasterizer to +the software t&l module. The main task of this module is to build +swrast vertices from the t&l vertex_buffer structs, and to use them to +perform triangle setup functions not implemented in the software +rasterizer. + +The module implements a full set of functions to plug into the +t_vb_render.c driver interface (tnl->Driver.Render.*). + +There are strong advantages to decoupling the software rasterizer from +the t&l module, primarily allowing hardware drivers better control +over fallbacks, the removal of implicit knowledge about the software +rasterizer in the t&l module, allowing the two modules to evolve +independently and allowing either to be substituted with equivalent +functionality from another codebase. + +This module implements triangle/quad setup for offset, unfilled and +twoside-lit triangles. The software rasterizer doesn't handle these +primitives directly. + +Hardware rasterization drivers typically use this module in situations +where no hardware rasterization is possible, ie during total +fallbacks. + +STATE + +To create and destroy the module: + + GLboolean _swsetup_CreateContext( struct gl_context *ctx ); + void _swsetup_DestroyContext( struct gl_context *ctx ); + +The module is not active by default, and must be installed by calling +_swrast_Wakeup(). This function installs internal swrast_setup +functions into all the tnl->Driver.Render driver hooks, thus taking +over the task of rasterization entirely: + + void _swrast_Wakeup( struct gl_context *ctx ); + + +This module tracks state changes internally and maintains derived +values based on the current state. For this to work, the driver +ensure the following funciton is called whenever the state changes and +the swsetup module is 'awake': + + void _swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state ); + +There is no explicit call to put the swsetup module to sleep. Simply +install other function pointers into all the tnl->Driver.Render.* +hooks, and (optionally) cease calling _swsetup_InvalidateState(). + +DRIVER INTERFACE + +The module offers a minimal driver interface: + + void (*Start)( struct gl_context *ctx ); + void (*Finish)( struct gl_context *ctx ); + +These are called before and after the completion of all swrast drawing +activity. As swrast doesn't call callbacks during triangle, line or +point rasterization, these are necessary to provide locking hooks for +some drivers. They may otherwise be left null. + + diff --git a/mesalib/src/mesa/swrast_setup/ss_triangle.c b/mesalib/src/mesa/swrast_setup/ss_triangle.c index 4fc9a0756..5d1c70e94 100644 --- a/mesalib/src/mesa/swrast_setup/ss_triangle.c +++ b/mesalib/src/mesa/swrast_setup/ss_triangle.c @@ -1,265 +1,265 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 1999-2007 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 - */ - -#include "main/glheader.h" -#include "main/colormac.h" -#include "main/macros.h" -#include "main/mtypes.h" - -#include "tnl/t_context.h" - -#include "ss_triangle.h" -#include "ss_context.h" - -#define SS_OFFSET_BIT 0x1 -#define SS_TWOSIDE_BIT 0x2 -#define SS_UNFILLED_BIT 0x4 -#define SS_MAX_TRIFUNC 0x8 - -static tnl_triangle_func tri_tab[SS_MAX_TRIFUNC]; -static tnl_quad_func quad_tab[SS_MAX_TRIFUNC]; - - -/* - * Render a triangle respecting edge flags. - */ -typedef void (* swsetup_edge_render_prim_tri)(struct gl_context *ctx, - const GLubyte *ef, - GLuint e0, - GLuint e1, - GLuint e2, - const SWvertex *v0, - const SWvertex *v1, - const SWvertex *v2); - -/* - * Render a triangle using lines and respecting edge flags. - */ -static void -_swsetup_edge_render_line_tri(struct gl_context *ctx, - const GLubyte *ef, - GLuint e0, - GLuint e1, - GLuint e2, - const SWvertex *v0, - const SWvertex *v1, - const SWvertex *v2) -{ - SScontext *swsetup = SWSETUP_CONTEXT(ctx); - - if (swsetup->render_prim == GL_POLYGON) { - if (ef[e2]) _swrast_Line( ctx, v2, v0 ); - if (ef[e0]) _swrast_Line( ctx, v0, v1 ); - if (ef[e1]) _swrast_Line( ctx, v1, v2 ); - } else { - if (ef[e0]) _swrast_Line( ctx, v0, v1 ); - if (ef[e1]) _swrast_Line( ctx, v1, v2 ); - if (ef[e2]) _swrast_Line( ctx, v2, v0 ); - } -} - -/* - * Render a triangle using points and respecting edge flags. - */ -static void -_swsetup_edge_render_point_tri(struct gl_context *ctx, - const GLubyte *ef, - GLuint e0, - GLuint e1, - GLuint e2, - const SWvertex *v0, - const SWvertex *v1, - const SWvertex *v2) -{ - if (ef[e0]) _swrast_Point( ctx, v0 ); - if (ef[e1]) _swrast_Point( ctx, v1 ); - if (ef[e2]) _swrast_Point( ctx, v2 ); - - _swrast_flush(ctx); -} - -/* - * Render a triangle respecting cull and shade model. - */ -static void _swsetup_render_tri(struct gl_context *ctx, - GLuint e0, - GLuint e1, - GLuint e2, - GLuint facing, - swsetup_edge_render_prim_tri render) -{ - SScontext *swsetup = SWSETUP_CONTEXT(ctx); - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - GLubyte *ef = VB->EdgeFlag; - SWvertex *verts = swsetup->verts; - SWvertex *v0 = &verts[e0]; - SWvertex *v1 = &verts[e1]; - SWvertex *v2 = &verts[e2]; - - /* cull testing */ - if (ctx->Polygon.CullFlag) { - if (facing == 1 && ctx->Polygon.CullFaceMode != GL_FRONT) - return; - if (facing == 0 && ctx->Polygon.CullFaceMode != GL_BACK) - return; - } - - _swrast_SetFacing(ctx, facing); - - if (ctx->Light.ShadeModel == GL_FLAT) { - GLchan c[2][4]; - GLfloat s[2][4]; - - /* save colors/indexes for v0, v1 vertices */ - COPY_CHAN4(c[0], v0->color); - COPY_CHAN4(c[1], v1->color); - COPY_4V(s[0], v0->attrib[FRAG_ATTRIB_COL1]); - COPY_4V(s[1], v1->attrib[FRAG_ATTRIB_COL1]); - - /* copy v2 color/indexes to v0, v1 indexes */ - COPY_CHAN4(v0->color, v2->color); - COPY_CHAN4(v1->color, v2->color); - COPY_4V(v0->attrib[FRAG_ATTRIB_COL1], v2->attrib[FRAG_ATTRIB_COL1]); - COPY_4V(v1->attrib[FRAG_ATTRIB_COL1], v2->attrib[FRAG_ATTRIB_COL1]); - - render(ctx, ef, e0, e1, e2, v0, v1, v2); - - COPY_CHAN4(v0->color, c[0]); - COPY_CHAN4(v1->color, c[1]); - COPY_4V(v0->attrib[FRAG_ATTRIB_COL1], s[0]); - COPY_4V(v1->attrib[FRAG_ATTRIB_COL1], s[1]); - } - else { - render(ctx, ef, e0, e1, e2, v0, v1, v2); - } -} - -#define SS_COLOR(a,b) UNCLAMPED_FLOAT_TO_RGBA_CHAN(a,b) -#define SS_SPEC(a,b) COPY_4V(a,b) -#define SS_IND(a,b) (a = b) - -#define IND (0) -#define TAG(x) x##_rgba -#include "ss_tritmp.h" - -#define IND (SS_OFFSET_BIT) -#define TAG(x) x##_offset_rgba -#include "ss_tritmp.h" - -#define IND (SS_TWOSIDE_BIT) -#define TAG(x) x##_twoside_rgba -#include "ss_tritmp.h" - -#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT) -#define TAG(x) x##_offset_twoside_rgba -#include "ss_tritmp.h" - -#define IND (SS_UNFILLED_BIT) -#define TAG(x) x##_unfilled_rgba -#include "ss_tritmp.h" - -#define IND (SS_OFFSET_BIT|SS_UNFILLED_BIT) -#define TAG(x) x##_offset_unfilled_rgba -#include "ss_tritmp.h" - -#define IND (SS_TWOSIDE_BIT|SS_UNFILLED_BIT) -#define TAG(x) x##_twoside_unfilled_rgba -#include "ss_tritmp.h" - -#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT) -#define TAG(x) x##_offset_twoside_unfilled_rgba -#include "ss_tritmp.h" - - -void _swsetup_trifuncs_init( struct gl_context *ctx ) -{ - (void) ctx; - - init_rgba(); - init_offset_rgba(); - init_twoside_rgba(); - init_offset_twoside_rgba(); - init_unfilled_rgba(); - init_offset_unfilled_rgba(); - init_twoside_unfilled_rgba(); - init_offset_twoside_unfilled_rgba(); -} - - -static void swsetup_points( struct gl_context *ctx, GLuint first, GLuint last ) -{ - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; - GLuint i; - - if (VB->Elts) { - for (i = first; i < last; i++) - if (VB->ClipMask[VB->Elts[i]] == 0) - _swrast_Point( ctx, &verts[VB->Elts[i]] ); - } - else { - for (i = first; i < last; i++) - if (VB->ClipMask[i] == 0) - _swrast_Point( ctx, &verts[i] ); - } -} - -static void swsetup_line( struct gl_context *ctx, GLuint v0, GLuint v1 ) -{ - SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; - _swrast_Line( ctx, &verts[v0], &verts[v1] ); -} - - - -void _swsetup_choose_trifuncs( struct gl_context *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLuint ind = 0; - - if (ctx->Polygon.OffsetPoint || - ctx->Polygon.OffsetLine || - ctx->Polygon.OffsetFill) - ind |= SS_OFFSET_BIT; - - if ((ctx->Light.Enabled && ctx->Light.Model.TwoSide) || - (ctx->VertexProgram._Current && ctx->VertexProgram.TwoSideEnabled)) - ind |= SS_TWOSIDE_BIT; - - /* We piggyback the two-sided stencil front/back determination on the - * unfilled triangle path. - */ - if (ctx->Polygon.FrontMode != GL_FILL || - ctx->Polygon.BackMode != GL_FILL || - (ctx->Stencil.Enabled && ctx->Stencil._TestTwoSide)) - ind |= SS_UNFILLED_BIT; - - tnl->Driver.Render.Triangle = tri_tab[ind]; - tnl->Driver.Render.Quad = quad_tab[ind]; - tnl->Driver.Render.Line = swsetup_line; - tnl->Driver.Render.Points = swsetup_points; -} +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 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 + */ + +#include "main/glheader.h" +#include "main/colormac.h" +#include "main/macros.h" +#include "main/mtypes.h" + +#include "tnl/t_context.h" + +#include "ss_triangle.h" +#include "ss_context.h" + +#define SS_OFFSET_BIT 0x1 +#define SS_TWOSIDE_BIT 0x2 +#define SS_UNFILLED_BIT 0x4 +#define SS_MAX_TRIFUNC 0x8 + +static tnl_triangle_func tri_tab[SS_MAX_TRIFUNC]; +static tnl_quad_func quad_tab[SS_MAX_TRIFUNC]; + + +/* + * Render a triangle respecting edge flags. + */ +typedef void (* swsetup_edge_render_prim_tri)(struct gl_context *ctx, + const GLubyte *ef, + GLuint e0, + GLuint e1, + GLuint e2, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2); + +/* + * Render a triangle using lines and respecting edge flags. + */ +static void +_swsetup_edge_render_line_tri(struct gl_context *ctx, + const GLubyte *ef, + GLuint e0, + GLuint e1, + GLuint e2, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2) +{ + SScontext *swsetup = SWSETUP_CONTEXT(ctx); + + if (swsetup->render_prim == GL_POLYGON) { + if (ef[e2]) _swrast_Line( ctx, v2, v0 ); + if (ef[e0]) _swrast_Line( ctx, v0, v1 ); + if (ef[e1]) _swrast_Line( ctx, v1, v2 ); + } else { + if (ef[e0]) _swrast_Line( ctx, v0, v1 ); + if (ef[e1]) _swrast_Line( ctx, v1, v2 ); + if (ef[e2]) _swrast_Line( ctx, v2, v0 ); + } +} + +/* + * Render a triangle using points and respecting edge flags. + */ +static void +_swsetup_edge_render_point_tri(struct gl_context *ctx, + const GLubyte *ef, + GLuint e0, + GLuint e1, + GLuint e2, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2) +{ + if (ef[e0]) _swrast_Point( ctx, v0 ); + if (ef[e1]) _swrast_Point( ctx, v1 ); + if (ef[e2]) _swrast_Point( ctx, v2 ); + + _swrast_flush(ctx); +} + +/* + * Render a triangle respecting cull and shade model. + */ +static void _swsetup_render_tri(struct gl_context *ctx, + GLuint e0, + GLuint e1, + GLuint e2, + GLuint facing, + swsetup_edge_render_prim_tri render) +{ + SScontext *swsetup = SWSETUP_CONTEXT(ctx); + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte *ef = VB->EdgeFlag; + SWvertex *verts = swsetup->verts; + SWvertex *v0 = &verts[e0]; + SWvertex *v1 = &verts[e1]; + SWvertex *v2 = &verts[e2]; + + /* cull testing */ + if (ctx->Polygon.CullFlag) { + if (facing == 1 && ctx->Polygon.CullFaceMode != GL_FRONT) + return; + if (facing == 0 && ctx->Polygon.CullFaceMode != GL_BACK) + return; + } + + _swrast_SetFacing(ctx, facing); + + if (ctx->Light.ShadeModel == GL_FLAT) { + GLchan c[2][4]; + GLfloat s[2][4]; + + /* save colors/indexes for v0, v1 vertices */ + COPY_CHAN4(c[0], v0->color); + COPY_CHAN4(c[1], v1->color); + COPY_4V(s[0], v0->attrib[FRAG_ATTRIB_COL1]); + COPY_4V(s[1], v1->attrib[FRAG_ATTRIB_COL1]); + + /* copy v2 color/indexes to v0, v1 indexes */ + COPY_CHAN4(v0->color, v2->color); + COPY_CHAN4(v1->color, v2->color); + COPY_4V(v0->attrib[FRAG_ATTRIB_COL1], v2->attrib[FRAG_ATTRIB_COL1]); + COPY_4V(v1->attrib[FRAG_ATTRIB_COL1], v2->attrib[FRAG_ATTRIB_COL1]); + + render(ctx, ef, e0, e1, e2, v0, v1, v2); + + COPY_CHAN4(v0->color, c[0]); + COPY_CHAN4(v1->color, c[1]); + COPY_4V(v0->attrib[FRAG_ATTRIB_COL1], s[0]); + COPY_4V(v1->attrib[FRAG_ATTRIB_COL1], s[1]); + } + else { + render(ctx, ef, e0, e1, e2, v0, v1, v2); + } +} + +#define SS_COLOR(a,b) UNCLAMPED_FLOAT_TO_RGBA_CHAN(a,b) +#define SS_SPEC(a,b) COPY_4V(a,b) +#define SS_IND(a,b) (a = b) + +#define IND (0) +#define TAG(x) x##_rgba +#include "ss_tritmp.h" + +#define IND (SS_OFFSET_BIT) +#define TAG(x) x##_offset_rgba +#include "ss_tritmp.h" + +#define IND (SS_TWOSIDE_BIT) +#define TAG(x) x##_twoside_rgba +#include "ss_tritmp.h" + +#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT) +#define TAG(x) x##_offset_twoside_rgba +#include "ss_tritmp.h" + +#define IND (SS_UNFILLED_BIT) +#define TAG(x) x##_unfilled_rgba +#include "ss_tritmp.h" + +#define IND (SS_OFFSET_BIT|SS_UNFILLED_BIT) +#define TAG(x) x##_offset_unfilled_rgba +#include "ss_tritmp.h" + +#define IND (SS_TWOSIDE_BIT|SS_UNFILLED_BIT) +#define TAG(x) x##_twoside_unfilled_rgba +#include "ss_tritmp.h" + +#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT) +#define TAG(x) x##_offset_twoside_unfilled_rgba +#include "ss_tritmp.h" + + +void _swsetup_trifuncs_init( struct gl_context *ctx ) +{ + (void) ctx; + + init_rgba(); + init_offset_rgba(); + init_twoside_rgba(); + init_offset_twoside_rgba(); + init_unfilled_rgba(); + init_offset_unfilled_rgba(); + init_twoside_unfilled_rgba(); + init_offset_twoside_unfilled_rgba(); +} + + +static void swsetup_points( struct gl_context *ctx, GLuint first, GLuint last ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; + GLuint i; + + if (VB->Elts) { + for (i = first; i < last; i++) + if (VB->ClipMask[VB->Elts[i]] == 0) + _swrast_Point( ctx, &verts[VB->Elts[i]] ); + } + else { + for (i = first; i < last; i++) + if (VB->ClipMask[i] == 0) + _swrast_Point( ctx, &verts[i] ); + } +} + +static void swsetup_line( struct gl_context *ctx, GLuint v0, GLuint v1 ) +{ + SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; + _swrast_Line( ctx, &verts[v0], &verts[v1] ); +} + + + +void _swsetup_choose_trifuncs( struct gl_context *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint ind = 0; + + if (ctx->Polygon.OffsetPoint || + ctx->Polygon.OffsetLine || + ctx->Polygon.OffsetFill) + ind |= SS_OFFSET_BIT; + + if ((ctx->Light.Enabled && ctx->Light.Model.TwoSide) || + (ctx->VertexProgram._Current && ctx->VertexProgram.TwoSideEnabled)) + ind |= SS_TWOSIDE_BIT; + + /* We piggyback the two-sided stencil front/back determination on the + * unfilled triangle path. + */ + if (ctx->Polygon.FrontMode != GL_FILL || + ctx->Polygon.BackMode != GL_FILL || + (ctx->Stencil.Enabled && ctx->Stencil._TestTwoSide)) + ind |= SS_UNFILLED_BIT; + + tnl->Driver.Render.Triangle = tri_tab[ind]; + tnl->Driver.Render.Quad = quad_tab[ind]; + tnl->Driver.Render.Line = swsetup_line; + tnl->Driver.Render.Points = swsetup_points; +} diff --git a/mesalib/src/mesa/swrast_setup/ss_triangle.h b/mesalib/src/mesa/swrast_setup/ss_triangle.h index e21a9749a..a027f4826 100644 --- a/mesalib/src/mesa/swrast_setup/ss_triangle.h +++ b/mesalib/src/mesa/swrast_setup/ss_triangle.h @@ -1,38 +1,38 @@ - -/* - * 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 - */ - -#ifndef SS_TRIANGLE_H -#define SS_TRIANGLE_H - -struct gl_context; - - -void _swsetup_trifuncs_init( struct gl_context *ctx ); -void _swsetup_choose_trifuncs( struct gl_context *ctx ); - -#endif + +/* + * 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 + */ + +#ifndef SS_TRIANGLE_H +#define SS_TRIANGLE_H + +struct gl_context; + + +void _swsetup_trifuncs_init( struct gl_context *ctx ); +void _swsetup_choose_trifuncs( struct gl_context *ctx ); + +#endif diff --git a/mesalib/src/mesa/swrast_setup/ss_tritmp.h b/mesalib/src/mesa/swrast_setup/ss_tritmp.h index 9b2b7cf6a..5844ad594 100644 --- a/mesalib/src/mesa/swrast_setup/ss_tritmp.h +++ b/mesalib/src/mesa/swrast_setup/ss_tritmp.h @@ -1,248 +1,248 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 1999-2007 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 - */ - - -/** - * This is where we handle assigning vertex colors based on front/back - * facing, compute polygon offset and handle glPolygonMode(). - */ -static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e2 ) -{ - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - SScontext *swsetup = SWSETUP_CONTEXT(ctx); - SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; - SWvertex *v[3]; - GLfloat z[3]; - GLfloat offset, oz0, oz1, oz2; - GLenum mode = GL_FILL; - GLuint facing = 0; - GLchan saved_color[3][4] = { { 0 } }; - GLfloat saved_col0[3][4] = { { 0 } }; - GLfloat saved_spec[3][4] = { { 0 } }; - - v[0] = &verts[e0]; - v[1] = &verts[e1]; - v[2] = &verts[e2]; - - if (IND & (SS_TWOSIDE_BIT | SS_OFFSET_BIT | SS_UNFILLED_BIT)) - { - GLfloat ex = v[0]->attrib[FRAG_ATTRIB_WPOS][0] - v[2]->attrib[FRAG_ATTRIB_WPOS][0]; - GLfloat ey = v[0]->attrib[FRAG_ATTRIB_WPOS][1] - v[2]->attrib[FRAG_ATTRIB_WPOS][1]; - GLfloat fx = v[1]->attrib[FRAG_ATTRIB_WPOS][0] - v[2]->attrib[FRAG_ATTRIB_WPOS][0]; - GLfloat fy = v[1]->attrib[FRAG_ATTRIB_WPOS][1] - v[2]->attrib[FRAG_ATTRIB_WPOS][1]; - GLfloat cc = ex*fy - ey*fx; - - if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT)) - { - facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; - - if (IND & SS_UNFILLED_BIT) - mode = facing ? ctx->Polygon.BackMode : ctx->Polygon.FrontMode; - - if (facing == 1) { - if (IND & SS_TWOSIDE_BIT) { - if (VB->BackfaceColorPtr) { - GLfloat (*vbcolor)[4] = VB->BackfaceColorPtr->data; - - if (swsetup->intColors) { - COPY_CHAN4(saved_color[0], v[0]->color); - COPY_CHAN4(saved_color[1], v[1]->color); - COPY_CHAN4(saved_color[2], v[2]->color); - } - else { - COPY_4V(saved_col0[0], v[0]->attrib[FRAG_ATTRIB_COL0]); - COPY_4V(saved_col0[1], v[1]->attrib[FRAG_ATTRIB_COL0]); - COPY_4V(saved_col0[2], v[2]->attrib[FRAG_ATTRIB_COL0]); - } - - if (VB->BackfaceColorPtr->stride) { - if (swsetup->intColors) { - SS_COLOR(v[0]->color, vbcolor[e0]); - SS_COLOR(v[1]->color, vbcolor[e1]); - SS_COLOR(v[2]->color, vbcolor[e2]); - } - else { - COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], vbcolor[e0]); - COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], vbcolor[e1]); - COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], vbcolor[e2]); - } - } - else { - /* flat shade */ - if (swsetup->intColors) { - SS_COLOR(v[0]->color, vbcolor[0]); - SS_COLOR(v[1]->color, vbcolor[0]); - SS_COLOR(v[2]->color, vbcolor[0]); - } - else { - COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]); - COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]); - COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]); - } - } - } - - if (VB->BackfaceSecondaryColorPtr) { - GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data; - - COPY_4V(saved_spec[0], v[0]->attrib[FRAG_ATTRIB_COL1]); - COPY_4V(saved_spec[1], v[1]->attrib[FRAG_ATTRIB_COL1]); - COPY_4V(saved_spec[2], v[2]->attrib[FRAG_ATTRIB_COL1]); - - if (VB->BackfaceSecondaryColorPtr->stride) { - SS_SPEC(v[0]->attrib[FRAG_ATTRIB_COL1], vbspec[e0]); - SS_SPEC(v[1]->attrib[FRAG_ATTRIB_COL1], vbspec[e1]); - SS_SPEC(v[2]->attrib[FRAG_ATTRIB_COL1], vbspec[e2]); - } - else { - SS_SPEC(v[0]->attrib[FRAG_ATTRIB_COL1], vbspec[0]); - SS_SPEC(v[1]->attrib[FRAG_ATTRIB_COL1], vbspec[0]); - SS_SPEC(v[2]->attrib[FRAG_ATTRIB_COL1], vbspec[0]); - } - } - } - } - } - - if (IND & SS_OFFSET_BIT) { - const GLfloat max = ctx->DrawBuffer->_DepthMaxF; - /* save original Z values (restored later) */ - z[0] = v[0]->attrib[FRAG_ATTRIB_WPOS][2]; - z[1] = v[1]->attrib[FRAG_ATTRIB_WPOS][2]; - z[2] = v[2]->attrib[FRAG_ATTRIB_WPOS][2]; - /* Note that Z values are already scaled to [0,65535] (for example) - * so no MRD value is used here. - */ - offset = ctx->Polygon.OffsetUnits; - if (cc * cc > 1e-16) { - const GLfloat ez = z[0] - z[2]; - const GLfloat fz = z[1] - z[2]; - const GLfloat oneOverArea = 1.0F / cc; - const GLfloat dzdx = FABSF((ey * fz - ez * fy) * oneOverArea); - const GLfloat dzdy = FABSF((ez * fx - ex * fz) * oneOverArea); - offset += MAX2(dzdx, dzdy) * ctx->Polygon.OffsetFactor; - } - /* new Z values */ - oz0 = CLAMP(v[0]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max); - oz1 = CLAMP(v[1]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max); - oz2 = CLAMP(v[2]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max); - } - } - - if (mode == GL_POINT) { - if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetPoint) { - v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0; - v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1; - v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2; - } - _swsetup_render_tri(ctx, e0, e1, e2, facing, _swsetup_edge_render_point_tri); - } else if (mode == GL_LINE) { - if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) { - v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0; - v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1; - v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2; - } - _swsetup_render_tri(ctx, e0, e1, e2, facing, _swsetup_edge_render_line_tri); - } else { - if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetFill) { - v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0; - v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1; - v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2; - } - _swrast_Triangle( ctx, v[0], v[1], v[2] ); - } - - /* - * Restore original vertex colors, etc. - */ - if (IND & SS_OFFSET_BIT) { - v[0]->attrib[FRAG_ATTRIB_WPOS][2] = z[0]; - v[1]->attrib[FRAG_ATTRIB_WPOS][2] = z[1]; - v[2]->attrib[FRAG_ATTRIB_WPOS][2] = z[2]; - } - - if (IND & SS_TWOSIDE_BIT) { - if (facing == 1) { - if (VB->BackfaceColorPtr) { - if (swsetup->intColors) { - COPY_CHAN4(v[0]->color, saved_color[0]); - COPY_CHAN4(v[1]->color, saved_color[1]); - COPY_CHAN4(v[2]->color, saved_color[2]); - } - else { - COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], saved_col0[0]); - COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], saved_col0[1]); - COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], saved_col0[2]); - } - } - - if (VB->BackfaceSecondaryColorPtr) { - COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL1], saved_spec[0]); - COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL1], saved_spec[1]); - COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL1], saved_spec[2]); - } - } - } -} - - - -/* Need to fixup edgeflags when decomposing to triangles: - */ -static void TAG(quadfunc)( struct gl_context *ctx, GLuint v0, - GLuint v1, GLuint v2, GLuint v3 ) -{ - if (IND & SS_UNFILLED_BIT) { - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - if (VB->EdgeFlag) { /* XXX this test shouldn't be needed (bug 12614) */ - GLubyte ef1 = VB->EdgeFlag[v1]; - GLubyte ef3 = VB->EdgeFlag[v3]; - VB->EdgeFlag[v1] = 0; - TAG(triangle)( ctx, v0, v1, v3 ); - VB->EdgeFlag[v1] = ef1; - VB->EdgeFlag[v3] = 0; - TAG(triangle)( ctx, v1, v2, v3 ); - VB->EdgeFlag[v3] = ef3; - } - } else { - TAG(triangle)( ctx, v0, v1, v3 ); - TAG(triangle)( ctx, v1, v2, v3 ); - } -} - - - - -static void TAG(init)( void ) -{ - tri_tab[IND] = TAG(triangle); - quad_tab[IND] = TAG(quadfunc); -} - - -#undef IND -#undef TAG +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 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 + */ + + +/** + * This is where we handle assigning vertex colors based on front/back + * facing, compute polygon offset and handle glPolygonMode(). + */ +static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e2 ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + SScontext *swsetup = SWSETUP_CONTEXT(ctx); + SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; + SWvertex *v[3]; + GLfloat z[3]; + GLfloat offset, oz0, oz1, oz2; + GLenum mode = GL_FILL; + GLuint facing = 0; + GLchan saved_color[3][4] = { { 0 } }; + GLfloat saved_col0[3][4] = { { 0 } }; + GLfloat saved_spec[3][4] = { { 0 } }; + + v[0] = &verts[e0]; + v[1] = &verts[e1]; + v[2] = &verts[e2]; + + if (IND & (SS_TWOSIDE_BIT | SS_OFFSET_BIT | SS_UNFILLED_BIT)) + { + GLfloat ex = v[0]->attrib[FRAG_ATTRIB_WPOS][0] - v[2]->attrib[FRAG_ATTRIB_WPOS][0]; + GLfloat ey = v[0]->attrib[FRAG_ATTRIB_WPOS][1] - v[2]->attrib[FRAG_ATTRIB_WPOS][1]; + GLfloat fx = v[1]->attrib[FRAG_ATTRIB_WPOS][0] - v[2]->attrib[FRAG_ATTRIB_WPOS][0]; + GLfloat fy = v[1]->attrib[FRAG_ATTRIB_WPOS][1] - v[2]->attrib[FRAG_ATTRIB_WPOS][1]; + GLfloat cc = ex*fy - ey*fx; + + if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT)) + { + facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; + + if (IND & SS_UNFILLED_BIT) + mode = facing ? ctx->Polygon.BackMode : ctx->Polygon.FrontMode; + + if (facing == 1) { + if (IND & SS_TWOSIDE_BIT) { + if (VB->BackfaceColorPtr) { + GLfloat (*vbcolor)[4] = VB->BackfaceColorPtr->data; + + if (swsetup->intColors) { + COPY_CHAN4(saved_color[0], v[0]->color); + COPY_CHAN4(saved_color[1], v[1]->color); + COPY_CHAN4(saved_color[2], v[2]->color); + } + else { + COPY_4V(saved_col0[0], v[0]->attrib[FRAG_ATTRIB_COL0]); + COPY_4V(saved_col0[1], v[1]->attrib[FRAG_ATTRIB_COL0]); + COPY_4V(saved_col0[2], v[2]->attrib[FRAG_ATTRIB_COL0]); + } + + if (VB->BackfaceColorPtr->stride) { + if (swsetup->intColors) { + SS_COLOR(v[0]->color, vbcolor[e0]); + SS_COLOR(v[1]->color, vbcolor[e1]); + SS_COLOR(v[2]->color, vbcolor[e2]); + } + else { + COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], vbcolor[e0]); + COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], vbcolor[e1]); + COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], vbcolor[e2]); + } + } + else { + /* flat shade */ + if (swsetup->intColors) { + SS_COLOR(v[0]->color, vbcolor[0]); + SS_COLOR(v[1]->color, vbcolor[0]); + SS_COLOR(v[2]->color, vbcolor[0]); + } + else { + COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]); + COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]); + COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]); + } + } + } + + if (VB->BackfaceSecondaryColorPtr) { + GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data; + + COPY_4V(saved_spec[0], v[0]->attrib[FRAG_ATTRIB_COL1]); + COPY_4V(saved_spec[1], v[1]->attrib[FRAG_ATTRIB_COL1]); + COPY_4V(saved_spec[2], v[2]->attrib[FRAG_ATTRIB_COL1]); + + if (VB->BackfaceSecondaryColorPtr->stride) { + SS_SPEC(v[0]->attrib[FRAG_ATTRIB_COL1], vbspec[e0]); + SS_SPEC(v[1]->attrib[FRAG_ATTRIB_COL1], vbspec[e1]); + SS_SPEC(v[2]->attrib[FRAG_ATTRIB_COL1], vbspec[e2]); + } + else { + SS_SPEC(v[0]->attrib[FRAG_ATTRIB_COL1], vbspec[0]); + SS_SPEC(v[1]->attrib[FRAG_ATTRIB_COL1], vbspec[0]); + SS_SPEC(v[2]->attrib[FRAG_ATTRIB_COL1], vbspec[0]); + } + } + } + } + } + + if (IND & SS_OFFSET_BIT) { + const GLfloat max = ctx->DrawBuffer->_DepthMaxF; + /* save original Z values (restored later) */ + z[0] = v[0]->attrib[FRAG_ATTRIB_WPOS][2]; + z[1] = v[1]->attrib[FRAG_ATTRIB_WPOS][2]; + z[2] = v[2]->attrib[FRAG_ATTRIB_WPOS][2]; + /* Note that Z values are already scaled to [0,65535] (for example) + * so no MRD value is used here. + */ + offset = ctx->Polygon.OffsetUnits; + if (cc * cc > 1e-16) { + const GLfloat ez = z[0] - z[2]; + const GLfloat fz = z[1] - z[2]; + const GLfloat oneOverArea = 1.0F / cc; + const GLfloat dzdx = FABSF((ey * fz - ez * fy) * oneOverArea); + const GLfloat dzdy = FABSF((ez * fx - ex * fz) * oneOverArea); + offset += MAX2(dzdx, dzdy) * ctx->Polygon.OffsetFactor; + } + /* new Z values */ + oz0 = CLAMP(v[0]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max); + oz1 = CLAMP(v[1]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max); + oz2 = CLAMP(v[2]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max); + } + } + + if (mode == GL_POINT) { + if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetPoint) { + v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0; + v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1; + v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2; + } + _swsetup_render_tri(ctx, e0, e1, e2, facing, _swsetup_edge_render_point_tri); + } else if (mode == GL_LINE) { + if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) { + v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0; + v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1; + v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2; + } + _swsetup_render_tri(ctx, e0, e1, e2, facing, _swsetup_edge_render_line_tri); + } else { + if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetFill) { + v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0; + v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1; + v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2; + } + _swrast_Triangle( ctx, v[0], v[1], v[2] ); + } + + /* + * Restore original vertex colors, etc. + */ + if (IND & SS_OFFSET_BIT) { + v[0]->attrib[FRAG_ATTRIB_WPOS][2] = z[0]; + v[1]->attrib[FRAG_ATTRIB_WPOS][2] = z[1]; + v[2]->attrib[FRAG_ATTRIB_WPOS][2] = z[2]; + } + + if (IND & SS_TWOSIDE_BIT) { + if (facing == 1) { + if (VB->BackfaceColorPtr) { + if (swsetup->intColors) { + COPY_CHAN4(v[0]->color, saved_color[0]); + COPY_CHAN4(v[1]->color, saved_color[1]); + COPY_CHAN4(v[2]->color, saved_color[2]); + } + else { + COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], saved_col0[0]); + COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], saved_col0[1]); + COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], saved_col0[2]); + } + } + + if (VB->BackfaceSecondaryColorPtr) { + COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL1], saved_spec[0]); + COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL1], saved_spec[1]); + COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL1], saved_spec[2]); + } + } + } +} + + + +/* Need to fixup edgeflags when decomposing to triangles: + */ +static void TAG(quadfunc)( struct gl_context *ctx, GLuint v0, + GLuint v1, GLuint v2, GLuint v3 ) +{ + if (IND & SS_UNFILLED_BIT) { + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + if (VB->EdgeFlag) { /* XXX this test shouldn't be needed (bug 12614) */ + GLubyte ef1 = VB->EdgeFlag[v1]; + GLubyte ef3 = VB->EdgeFlag[v3]; + VB->EdgeFlag[v1] = 0; + TAG(triangle)( ctx, v0, v1, v3 ); + VB->EdgeFlag[v1] = ef1; + VB->EdgeFlag[v3] = 0; + TAG(triangle)( ctx, v1, v2, v3 ); + VB->EdgeFlag[v3] = ef3; + } + } else { + TAG(triangle)( ctx, v0, v1, v3 ); + TAG(triangle)( ctx, v1, v2, v3 ); + } +} + + + + +static void TAG(init)( void ) +{ + tri_tab[IND] = TAG(triangle); + quad_tab[IND] = TAG(quadfunc); +} + + +#undef IND +#undef TAG diff --git a/mesalib/src/mesa/swrast_setup/ss_vb.h b/mesalib/src/mesa/swrast_setup/ss_vb.h index 35d5da6f7..05e665b5c 100644 --- a/mesalib/src/mesa/swrast_setup/ss_vb.h +++ b/mesalib/src/mesa/swrast_setup/ss_vb.h @@ -1,37 +1,37 @@ - -/* - * 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 - */ - -#ifndef SS_VB_H -#define SS_VB_H - -struct gl_context; - -void _swsetup_vb_init( struct gl_context *ctx ); -void _swsetup_choose_rastersetup_func( struct gl_context *ctx ); - -#endif + +/* + * 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 + */ + +#ifndef SS_VB_H +#define SS_VB_H + +struct gl_context; + +void _swsetup_vb_init( struct gl_context *ctx ); +void _swsetup_choose_rastersetup_func( struct gl_context *ctx ); + +#endif diff --git a/mesalib/src/mesa/swrast_setup/swrast_setup.h b/mesalib/src/mesa/swrast_setup/swrast_setup.h index 6d82ef58f..1d87ec108 100644 --- a/mesalib/src/mesa/swrast_setup/swrast_setup.h +++ b/mesalib/src/mesa/swrast_setup/swrast_setup.h @@ -1,61 +1,61 @@ - -/* - * 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 - */ - -/* Public interface to the swrast_setup module. This module provides - * an implementation of the driver interface to t_vb_render.c, and uses - * the software rasterizer (swrast) to perform actual rasterization. - * - * The internals of the implementation are private, but can be hooked - * into tnl at any time (except between RenderStart/RenderEnd) by - * calling _swsetup_Wakeup(). - */ - -#ifndef SWRAST_SETUP_H -#define SWRAST_SETUP_H - -#include "swrast/swrast.h" - -extern GLboolean -_swsetup_CreateContext( struct gl_context *ctx ); - -extern void -_swsetup_DestroyContext( struct gl_context *ctx ); - -extern void -_swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state ); - -extern void -_swsetup_Wakeup( struct gl_context *ctx ); - -/* Helper function to translate a hardware vertex (as understood by - * the tnl/t_vertex.c code) to a swrast vertex. - */ -extern void -_swsetup_Translate( struct gl_context *ctx, const void *vertex, SWvertex *dest ); - -#endif + +/* + * 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 + */ + +/* Public interface to the swrast_setup module. This module provides + * an implementation of the driver interface to t_vb_render.c, and uses + * the software rasterizer (swrast) to perform actual rasterization. + * + * The internals of the implementation are private, but can be hooked + * into tnl at any time (except between RenderStart/RenderEnd) by + * calling _swsetup_Wakeup(). + */ + +#ifndef SWRAST_SETUP_H +#define SWRAST_SETUP_H + +#include "swrast/swrast.h" + +extern GLboolean +_swsetup_CreateContext( struct gl_context *ctx ); + +extern void +_swsetup_DestroyContext( struct gl_context *ctx ); + +extern void +_swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state ); + +extern void +_swsetup_Wakeup( struct gl_context *ctx ); + +/* Helper function to translate a hardware vertex (as understood by + * the tnl/t_vertex.c code) to a swrast vertex. + */ +extern void +_swsetup_Translate( struct gl_context *ctx, const void *vertex, SWvertex *dest ); + +#endif diff --git a/mesalib/src/mesa/tnl/t_pipeline.h b/mesalib/src/mesa/tnl/t_pipeline.h index 579207889..0eb03395c 100644 --- a/mesalib/src/mesa/tnl/t_pipeline.h +++ b/mesalib/src/mesa/tnl/t_pipeline.h @@ -1,73 +1,73 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 1999-2007 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 - */ - - - -#ifndef _T_PIPELINE_H_ -#define _T_PIPELINE_H_ - -#include "main/mtypes.h" -#include "t_context.h" - -extern void _tnl_run_pipeline( struct gl_context *ctx ); - -extern void _tnl_destroy_pipeline( struct gl_context *ctx ); - -extern void _tnl_install_pipeline( struct gl_context *ctx, - const struct tnl_pipeline_stage **stages ); - - -/* These are implemented in the t_vb_*.c files: - */ -extern const struct tnl_pipeline_stage _tnl_vertex_transform_stage; -extern const struct tnl_pipeline_stage _tnl_normal_transform_stage; -extern const struct tnl_pipeline_stage _tnl_lighting_stage; -extern const struct tnl_pipeline_stage _tnl_fog_coordinate_stage; -extern const struct tnl_pipeline_stage _tnl_texgen_stage; -extern const struct tnl_pipeline_stage _tnl_texture_transform_stage; -extern const struct tnl_pipeline_stage _tnl_point_attenuation_stage; -extern const struct tnl_pipeline_stage _tnl_vertex_program_stage; -extern const struct tnl_pipeline_stage _tnl_render_stage; - -/* Shorthand to plug in the default pipeline: - */ -extern const struct tnl_pipeline_stage *_tnl_default_pipeline[]; -extern const struct tnl_pipeline_stage *_tnl_vp_pipeline[]; - - -/* Convenience routines provided by t_vb_render.c: - */ -extern tnl_render_func _tnl_render_tab_elts[]; -extern tnl_render_func _tnl_render_tab_verts[]; - -extern void _tnl_RenderClippedPolygon( struct gl_context *ctx, - const GLuint *elts, GLuint n ); - -extern void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ); - - -#endif +/* + * Mesa 3-D graphics library + * Version: 6.5.3 + * + * Copyright (C) 1999-2007 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 + */ + + + +#ifndef _T_PIPELINE_H_ +#define _T_PIPELINE_H_ + +#include "main/mtypes.h" +#include "t_context.h" + +extern void _tnl_run_pipeline( struct gl_context *ctx ); + +extern void _tnl_destroy_pipeline( struct gl_context *ctx ); + +extern void _tnl_install_pipeline( struct gl_context *ctx, + const struct tnl_pipeline_stage **stages ); + + +/* These are implemented in the t_vb_*.c files: + */ +extern const struct tnl_pipeline_stage _tnl_vertex_transform_stage; +extern const struct tnl_pipeline_stage _tnl_normal_transform_stage; +extern const struct tnl_pipeline_stage _tnl_lighting_stage; +extern const struct tnl_pipeline_stage _tnl_fog_coordinate_stage; +extern const struct tnl_pipeline_stage _tnl_texgen_stage; +extern const struct tnl_pipeline_stage _tnl_texture_transform_stage; +extern const struct tnl_pipeline_stage _tnl_point_attenuation_stage; +extern const struct tnl_pipeline_stage _tnl_vertex_program_stage; +extern const struct tnl_pipeline_stage _tnl_render_stage; + +/* Shorthand to plug in the default pipeline: + */ +extern const struct tnl_pipeline_stage *_tnl_default_pipeline[]; +extern const struct tnl_pipeline_stage *_tnl_vp_pipeline[]; + + +/* Convenience routines provided by t_vb_render.c: + */ +extern tnl_render_func _tnl_render_tab_elts[]; +extern tnl_render_func _tnl_render_tab_verts[]; + +extern void _tnl_RenderClippedPolygon( struct gl_context *ctx, + const GLuint *elts, GLuint n ); + +extern void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ); + + +#endif diff --git a/mesalib/src/mesa/tnl/t_vb_fog.c b/mesalib/src/mesa/tnl/t_vb_fog.c index 3e5c99735..cbd8dfc96 100644 --- a/mesalib/src/mesa/tnl/t_vb_fog.c +++ b/mesalib/src/mesa/tnl/t_vb_fog.c @@ -1,276 +1,276 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2006 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 - */ - - -#include "main/glheader.h" -#include "main/colormac.h" -#include "main/macros.h" -#include "main/imports.h" -#include "main/mtypes.h" - -#include "math/m_xform.h" - -#include "t_context.h" -#include "t_pipeline.h" - - -struct fog_stage_data { - GLvector4f fogcoord; /* has actual storage allocated */ -}; - -#define FOG_STAGE_DATA(stage) ((struct fog_stage_data *)stage->privatePtr) - -#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]; -static GLfloat inited = 0; - -#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(). - */ -static void -init_static_data( void ) -{ - GLfloat f = 0.0F; - GLint i = 0; - for ( ; i < FOG_EXP_TABLE_SIZE ; i++, f += FOG_INCR) { - exp_table[i] = EXPF(-f); - } - inited = 1; -} - - -/** - * 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 that fogcoords may be negative, if eye z is source absolute - * value must be taken earlier. - * Fog blend factors are in the range [0,1]. - */ -static void -compute_fog_blend_factors(struct gl_context *ctx, GLvector4f *out, const GLvector4f *in) -{ - GLfloat end = ctx->Fog.End; - GLfloat *v = in->start; - GLuint stride = in->stride; - GLuint n = in->count; - GLfloat (*data)[4] = out->data; - GLfloat d; - GLuint i; - - out->count = in->count; - - 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); - for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) { - const GLfloat z = *v; - GLfloat f = (end - z) * d; - data[i][0] = CLAMP(f, 0.0F, 1.0F); - } - break; - case GL_EXP: - d = ctx->Fog.Density; - for ( i = 0 ; i < n ; i++, STRIDE_F(v,stride)) { - const GLfloat z = *v; - NEG_EXP( data[i][0], d * z ); - } - break; - case GL_EXP2: - d = ctx->Fog.Density*ctx->Fog.Density; - for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) { - const GLfloat z = *v; - NEG_EXP( data[i][0], d * z * z ); - } - break; - default: - _mesa_problem(ctx, "Bad fog mode in make_fog_coord"); - return; - } -} - - -static GLboolean -run_fog_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - struct fog_stage_data *store = FOG_STAGE_DATA(stage); - GLvector4f *input; - - - if (!ctx->Fog.Enabled) - return GL_TRUE; - - if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT && !ctx->VertexProgram._Current) { - GLuint i; - GLfloat *coord; - /* Fog is computed from vertex or fragment Z values */ - /* source = VB->AttribPtr[_TNL_ATTRIB_POS] or VB->EyePtr coords */ - /* dest = VB->AttribPtr[_TNL_ATTRIB_FOG] = fog stage private storage */ - VB->AttribPtr[_TNL_ATTRIB_FOG] = &store->fogcoord; - - if (!ctx->_NeedEyeCoords) { - /* compute fog coords from object coords */ - const GLfloat *m = ctx->ModelviewMatrixStack.Top->m; - GLfloat plane[4]; - - /* Use this to store calculated eye z values: - */ - input = &store->fogcoord; - - plane[0] = m[2]; - plane[1] = m[6]; - plane[2] = m[10]; - plane[3] = m[14]; - /* Full eye coords weren't required, just calculate the - * eye Z values. - */ - _mesa_dotprod_tab[VB->AttribPtr[_TNL_ATTRIB_POS]->size] - ( (GLfloat *) input->data, - 4 * sizeof(GLfloat), - VB->AttribPtr[_TNL_ATTRIB_POS], plane ); - - input->count = VB->AttribPtr[_TNL_ATTRIB_POS]->count; - - /* make sure coords are really positive - NOTE should avoid going through array twice */ - coord = input->start; - for (i = 0; i < input->count; i++) { - *coord = FABSF(*coord); - STRIDE_F(coord, input->stride); - } - } - else { - /* fog coordinates = eye Z coordinates - need to copy for ABS */ - input = &store->fogcoord; - - if (VB->EyePtr->size < 2) - _mesa_vector4f_clean_elem( VB->EyePtr, VB->Count, 2 ); - - input->stride = 4 * sizeof(GLfloat); - input->count = VB->EyePtr->count; - coord = VB->EyePtr->start; - for (i = 0 ; i < VB->EyePtr->count; i++) { - input->data[i][0] = FABSF(coord[2]); - STRIDE_F(coord, VB->EyePtr->stride); - } - } - } - else { - /* use glFogCoord() coordinates */ - input = VB->AttribPtr[_TNL_ATTRIB_FOG]; /* source data */ - - /* input->count may be one if glFogCoord was only called once - * before glBegin. But we need to compute fog for all vertices. - */ - input->count = VB->AttribPtr[_TNL_ATTRIB_POS]->count; - - VB->AttribPtr[_TNL_ATTRIB_FOG] = &store->fogcoord; /* dest data */ - } - - if (tnl->_DoVertexFog) { - /* compute blend factors from fog coordinates */ - compute_fog_blend_factors( ctx, VB->AttribPtr[_TNL_ATTRIB_FOG], input ); - } - else { - /* results = incoming fog coords (compute fog per-fragment later) */ - VB->AttribPtr[_TNL_ATTRIB_FOG] = input; - } - - return GL_TRUE; -} - - - -/* Called the first time stage->run() is invoked. - */ -static GLboolean -alloc_fog_data(struct gl_context *ctx, struct tnl_pipeline_stage *stage) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct fog_stage_data *store; - stage->privatePtr = MALLOC(sizeof(*store)); - store = FOG_STAGE_DATA(stage); - if (!store) - return GL_FALSE; - - _mesa_vector4f_alloc( &store->fogcoord, 0, tnl->vb.Size, 32 ); - - if (!inited) - init_static_data(); - - return GL_TRUE; -} - - -static void -free_fog_data(struct tnl_pipeline_stage *stage) -{ - struct fog_stage_data *store = FOG_STAGE_DATA(stage); - if (store) { - _mesa_vector4f_free( &store->fogcoord ); - FREE( store ); - stage->privatePtr = NULL; - } -} - - -const struct tnl_pipeline_stage _tnl_fog_coordinate_stage = -{ - "build fog coordinates", /* name */ - NULL, /* private_data */ - alloc_fog_data, /* dtr */ - free_fog_data, /* dtr */ - NULL, /* check */ - run_fog_stage /* run -- initially set to init. */ -}; +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2006 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 + */ + + +#include "main/glheader.h" +#include "main/colormac.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + + +struct fog_stage_data { + GLvector4f fogcoord; /* has actual storage allocated */ +}; + +#define FOG_STAGE_DATA(stage) ((struct fog_stage_data *)stage->privatePtr) + +#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]; +static GLfloat inited = 0; + +#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(). + */ +static void +init_static_data( void ) +{ + GLfloat f = 0.0F; + GLint i = 0; + for ( ; i < FOG_EXP_TABLE_SIZE ; i++, f += FOG_INCR) { + exp_table[i] = EXPF(-f); + } + inited = 1; +} + + +/** + * 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 that fogcoords may be negative, if eye z is source absolute + * value must be taken earlier. + * Fog blend factors are in the range [0,1]. + */ +static void +compute_fog_blend_factors(struct gl_context *ctx, GLvector4f *out, const GLvector4f *in) +{ + GLfloat end = ctx->Fog.End; + GLfloat *v = in->start; + GLuint stride = in->stride; + GLuint n = in->count; + GLfloat (*data)[4] = out->data; + GLfloat d; + GLuint i; + + out->count = in->count; + + 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); + for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) { + const GLfloat z = *v; + GLfloat f = (end - z) * d; + data[i][0] = CLAMP(f, 0.0F, 1.0F); + } + break; + case GL_EXP: + d = ctx->Fog.Density; + for ( i = 0 ; i < n ; i++, STRIDE_F(v,stride)) { + const GLfloat z = *v; + NEG_EXP( data[i][0], d * z ); + } + break; + case GL_EXP2: + d = ctx->Fog.Density*ctx->Fog.Density; + for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) { + const GLfloat z = *v; + NEG_EXP( data[i][0], d * z * z ); + } + break; + default: + _mesa_problem(ctx, "Bad fog mode in make_fog_coord"); + return; + } +} + + +static GLboolean +run_fog_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + struct fog_stage_data *store = FOG_STAGE_DATA(stage); + GLvector4f *input; + + + if (!ctx->Fog.Enabled) + return GL_TRUE; + + if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT && !ctx->VertexProgram._Current) { + GLuint i; + GLfloat *coord; + /* Fog is computed from vertex or fragment Z values */ + /* source = VB->AttribPtr[_TNL_ATTRIB_POS] or VB->EyePtr coords */ + /* dest = VB->AttribPtr[_TNL_ATTRIB_FOG] = fog stage private storage */ + VB->AttribPtr[_TNL_ATTRIB_FOG] = &store->fogcoord; + + if (!ctx->_NeedEyeCoords) { + /* compute fog coords from object coords */ + const GLfloat *m = ctx->ModelviewMatrixStack.Top->m; + GLfloat plane[4]; + + /* Use this to store calculated eye z values: + */ + input = &store->fogcoord; + + plane[0] = m[2]; + plane[1] = m[6]; + plane[2] = m[10]; + plane[3] = m[14]; + /* Full eye coords weren't required, just calculate the + * eye Z values. + */ + _mesa_dotprod_tab[VB->AttribPtr[_TNL_ATTRIB_POS]->size] + ( (GLfloat *) input->data, + 4 * sizeof(GLfloat), + VB->AttribPtr[_TNL_ATTRIB_POS], plane ); + + input->count = VB->AttribPtr[_TNL_ATTRIB_POS]->count; + + /* make sure coords are really positive + NOTE should avoid going through array twice */ + coord = input->start; + for (i = 0; i < input->count; i++) { + *coord = FABSF(*coord); + STRIDE_F(coord, input->stride); + } + } + else { + /* fog coordinates = eye Z coordinates - need to copy for ABS */ + input = &store->fogcoord; + + if (VB->EyePtr->size < 2) + _mesa_vector4f_clean_elem( VB->EyePtr, VB->Count, 2 ); + + input->stride = 4 * sizeof(GLfloat); + input->count = VB->EyePtr->count; + coord = VB->EyePtr->start; + for (i = 0 ; i < VB->EyePtr->count; i++) { + input->data[i][0] = FABSF(coord[2]); + STRIDE_F(coord, VB->EyePtr->stride); + } + } + } + else { + /* use glFogCoord() coordinates */ + input = VB->AttribPtr[_TNL_ATTRIB_FOG]; /* source data */ + + /* input->count may be one if glFogCoord was only called once + * before glBegin. But we need to compute fog for all vertices. + */ + input->count = VB->AttribPtr[_TNL_ATTRIB_POS]->count; + + VB->AttribPtr[_TNL_ATTRIB_FOG] = &store->fogcoord; /* dest data */ + } + + if (tnl->_DoVertexFog) { + /* compute blend factors from fog coordinates */ + compute_fog_blend_factors( ctx, VB->AttribPtr[_TNL_ATTRIB_FOG], input ); + } + else { + /* results = incoming fog coords (compute fog per-fragment later) */ + VB->AttribPtr[_TNL_ATTRIB_FOG] = input; + } + + return GL_TRUE; +} + + + +/* Called the first time stage->run() is invoked. + */ +static GLboolean +alloc_fog_data(struct gl_context *ctx, struct tnl_pipeline_stage *stage) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct fog_stage_data *store; + stage->privatePtr = MALLOC(sizeof(*store)); + store = FOG_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + _mesa_vector4f_alloc( &store->fogcoord, 0, tnl->vb.Size, 32 ); + + if (!inited) + init_static_data(); + + return GL_TRUE; +} + + +static void +free_fog_data(struct tnl_pipeline_stage *stage) +{ + struct fog_stage_data *store = FOG_STAGE_DATA(stage); + if (store) { + _mesa_vector4f_free( &store->fogcoord ); + FREE( store ); + stage->privatePtr = NULL; + } +} + + +const struct tnl_pipeline_stage _tnl_fog_coordinate_stage = +{ + "build fog coordinates", /* name */ + NULL, /* private_data */ + alloc_fog_data, /* dtr */ + free_fog_data, /* dtr */ + NULL, /* check */ + run_fog_stage /* run -- initially set to init. */ +}; diff --git a/mesalib/src/mesa/tnl/t_vb_normals.c b/mesalib/src/mesa/tnl/t_vb_normals.c index 94e8d0ab5..c19b48e51 100644 --- a/mesalib/src/mesa/tnl/t_vb_normals.c +++ b/mesalib/src/mesa/tnl/t_vb_normals.c @@ -1,187 +1,187 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2006 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 - */ - - -#include "main/glheader.h" -#include "main/colormac.h" -#include "main/macros.h" -#include "main/imports.h" -#include "main/mtypes.h" - -#include "math/m_xform.h" - -#include "t_context.h" -#include "t_pipeline.h" - - -struct normal_stage_data { - normal_func NormalTransform; - GLvector4f normal; -}; - -#define NORMAL_STAGE_DATA(stage) ((struct normal_stage_data *)stage->privatePtr) - - -static GLboolean -run_normal_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) -{ - struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - const GLfloat *lengths; - - if (!store->NormalTransform) - return GL_TRUE; - - /* We can only use the display list's saved normal lengths if we've - * got a transformation matrix with uniform scaling. - */ - if (_math_matrix_is_general_scale(ctx->ModelviewMatrixStack.Top)) - lengths = NULL; - else - lengths = VB->NormalLengthPtr; - - store->NormalTransform( ctx->ModelviewMatrixStack.Top, - ctx->_ModelViewInvScale, - VB->AttribPtr[_TNL_ATTRIB_NORMAL], /* input normals */ - lengths, - &store->normal ); /* resulting normals */ - - if (VB->AttribPtr[_TNL_ATTRIB_NORMAL]->count > 1) { - store->normal.stride = 4 * sizeof(GLfloat); - } - else { - store->normal.stride = 0; - } - - VB->AttribPtr[_TNL_ATTRIB_NORMAL] = &store->normal; - - VB->NormalLengthPtr = NULL; /* no longer valid */ - return GL_TRUE; -} - - -/** - * Examine current GL state and set the store->NormalTransform pointer - * to point to the appropriate normal transformation routine. - */ -static void -validate_normal_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) -{ - struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); - - if (ctx->VertexProgram._Current || - (!ctx->Light.Enabled && - !(ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS))) { - store->NormalTransform = NULL; - return; - } - - if (ctx->_NeedEyeCoords) { - /* Eye coordinates are needed, for whatever reasons. - * Do lighting in eye coordinates, as the GL spec says. - */ - GLuint transform = NORM_TRANSFORM_NO_ROT; - - if (_math_matrix_has_rotation(ctx->ModelviewMatrixStack.Top)) { - /* need to do full (3x3) matrix transform */ - transform = NORM_TRANSFORM; - } - - if (ctx->Transform.Normalize) { - store->NormalTransform = _mesa_normal_tab[transform | NORM_NORMALIZE]; - } - else if (ctx->Transform.RescaleNormals && - ctx->_ModelViewInvScale != 1.0) { - store->NormalTransform = _mesa_normal_tab[transform | NORM_RESCALE]; - } - else { - store->NormalTransform = _mesa_normal_tab[transform]; - } - } - else { - /* We don't need eye coordinates. - * Do lighting in object coordinates. Thus, we don't need to fully - * transform normal vectors (just leave them in object coordinates) - * but we still need to do normalization/rescaling if enabled. - */ - if (ctx->Transform.Normalize) { - store->NormalTransform = _mesa_normal_tab[NORM_NORMALIZE]; - } - else if (!ctx->Transform.RescaleNormals && - ctx->_ModelViewInvScale != 1.0) { - store->NormalTransform = _mesa_normal_tab[NORM_RESCALE]; - } - else { - store->NormalTransform = NULL; - } - } -} - - -/** - * Allocate stage's private data (storage for transformed normals). - */ -static GLboolean -alloc_normal_data(struct gl_context *ctx, struct tnl_pipeline_stage *stage) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct normal_stage_data *store; - - stage->privatePtr = malloc(sizeof(*store)); - store = NORMAL_STAGE_DATA(stage); - if (!store) - return GL_FALSE; - - _mesa_vector4f_alloc( &store->normal, 0, tnl->vb.Size, 32 ); - return GL_TRUE; -} - - -/** - * Free stage's private data. - */ -static void -free_normal_data(struct tnl_pipeline_stage *stage) -{ - struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); - if (store) { - _mesa_vector4f_free( &store->normal ); - free( store ); - stage->privatePtr = NULL; - } -} - - -const struct tnl_pipeline_stage _tnl_normal_transform_stage = -{ - "normal transform", /* name */ - NULL, /* privatePtr */ - alloc_normal_data, /* create */ - free_normal_data, /* destroy */ - validate_normal_stage, /* validate */ - run_normal_stage /* run */ -}; +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2006 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 + */ + + +#include "main/glheader.h" +#include "main/colormac.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + + +struct normal_stage_data { + normal_func NormalTransform; + GLvector4f normal; +}; + +#define NORMAL_STAGE_DATA(stage) ((struct normal_stage_data *)stage->privatePtr) + + +static GLboolean +run_normal_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) +{ + struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + const GLfloat *lengths; + + if (!store->NormalTransform) + return GL_TRUE; + + /* We can only use the display list's saved normal lengths if we've + * got a transformation matrix with uniform scaling. + */ + if (_math_matrix_is_general_scale(ctx->ModelviewMatrixStack.Top)) + lengths = NULL; + else + lengths = VB->NormalLengthPtr; + + store->NormalTransform( ctx->ModelviewMatrixStack.Top, + ctx->_ModelViewInvScale, + VB->AttribPtr[_TNL_ATTRIB_NORMAL], /* input normals */ + lengths, + &store->normal ); /* resulting normals */ + + if (VB->AttribPtr[_TNL_ATTRIB_NORMAL]->count > 1) { + store->normal.stride = 4 * sizeof(GLfloat); + } + else { + store->normal.stride = 0; + } + + VB->AttribPtr[_TNL_ATTRIB_NORMAL] = &store->normal; + + VB->NormalLengthPtr = NULL; /* no longer valid */ + return GL_TRUE; +} + + +/** + * Examine current GL state and set the store->NormalTransform pointer + * to point to the appropriate normal transformation routine. + */ +static void +validate_normal_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) +{ + struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); + + if (ctx->VertexProgram._Current || + (!ctx->Light.Enabled && + !(ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS))) { + store->NormalTransform = NULL; + return; + } + + if (ctx->_NeedEyeCoords) { + /* Eye coordinates are needed, for whatever reasons. + * Do lighting in eye coordinates, as the GL spec says. + */ + GLuint transform = NORM_TRANSFORM_NO_ROT; + + if (_math_matrix_has_rotation(ctx->ModelviewMatrixStack.Top)) { + /* need to do full (3x3) matrix transform */ + transform = NORM_TRANSFORM; + } + + if (ctx->Transform.Normalize) { + store->NormalTransform = _mesa_normal_tab[transform | NORM_NORMALIZE]; + } + else if (ctx->Transform.RescaleNormals && + ctx->_ModelViewInvScale != 1.0) { + store->NormalTransform = _mesa_normal_tab[transform | NORM_RESCALE]; + } + else { + store->NormalTransform = _mesa_normal_tab[transform]; + } + } + else { + /* We don't need eye coordinates. + * Do lighting in object coordinates. Thus, we don't need to fully + * transform normal vectors (just leave them in object coordinates) + * but we still need to do normalization/rescaling if enabled. + */ + if (ctx->Transform.Normalize) { + store->NormalTransform = _mesa_normal_tab[NORM_NORMALIZE]; + } + else if (!ctx->Transform.RescaleNormals && + ctx->_ModelViewInvScale != 1.0) { + store->NormalTransform = _mesa_normal_tab[NORM_RESCALE]; + } + else { + store->NormalTransform = NULL; + } + } +} + + +/** + * Allocate stage's private data (storage for transformed normals). + */ +static GLboolean +alloc_normal_data(struct gl_context *ctx, struct tnl_pipeline_stage *stage) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct normal_stage_data *store; + + stage->privatePtr = malloc(sizeof(*store)); + store = NORMAL_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + _mesa_vector4f_alloc( &store->normal, 0, tnl->vb.Size, 32 ); + return GL_TRUE; +} + + +/** + * Free stage's private data. + */ +static void +free_normal_data(struct tnl_pipeline_stage *stage) +{ + struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); + if (store) { + _mesa_vector4f_free( &store->normal ); + free( store ); + stage->privatePtr = NULL; + } +} + + +const struct tnl_pipeline_stage _tnl_normal_transform_stage = +{ + "normal transform", /* name */ + NULL, /* privatePtr */ + alloc_normal_data, /* create */ + free_normal_data, /* destroy */ + validate_normal_stage, /* validate */ + run_normal_stage /* run */ +}; diff --git a/mesalib/src/mesa/tnl/t_vb_points.c b/mesalib/src/mesa/tnl/t_vb_points.c index 1bf961a6d..9edbbc708 100644 --- a/mesalib/src/mesa/tnl/t_vb_points.c +++ b/mesalib/src/mesa/tnl/t_vb_points.c @@ -1,114 +1,114 @@ -/* - * Mesa 3-D graphics library - * Version: 7.0 - * - * Copyright (C) 1999-2007 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: - * Brian Paul - */ - -#include "main/glheader.h" -#include "main/mtypes.h" -#include "main/dd.h" -#include "main/imports.h" -#include "t_context.h" -#include "t_pipeline.h" - - -struct point_stage_data { - GLvector4f PointSize; -}; - -#define POINT_STAGE_DATA(stage) ((struct point_stage_data *)stage->privatePtr) - - -/** - * Compute point size for each vertex from the vertex eye-space Z - * coordinate and the point size attenuation factors. - * Only done when point size attenuation is enabled and vertex program is - * disabled. - */ -static GLboolean -run_point_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) -{ - if (ctx->Point._Attenuated && !ctx->VertexProgram._Current) { - struct point_stage_data *store = POINT_STAGE_DATA(stage); - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - const GLfloat *eyeCoord = (GLfloat *) VB->EyePtr->data + 2; - const GLint eyeCoordStride = VB->EyePtr->stride / sizeof(GLfloat); - const GLfloat p0 = ctx->Point.Params[0]; - const GLfloat p1 = ctx->Point.Params[1]; - const GLfloat p2 = ctx->Point.Params[2]; - const GLfloat pointSize = ctx->Point.Size; - GLfloat (*size)[4] = store->PointSize.data; - GLuint i; - - for (i = 0; i < VB->Count; i++) { - const GLfloat dist = FABSF(*eyeCoord); - const GLfloat q = p0 + dist * (p1 + dist * p2); - const GLfloat atten = (q != 0.0F) ? SQRTF(1.0F / q) : 1.0F; - size[i][0] = pointSize * atten; /* clamping done in rasterization */ - eyeCoord += eyeCoordStride; - } - - VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->PointSize; - } - - return GL_TRUE; -} - - -static GLboolean -alloc_point_data(struct gl_context *ctx, struct tnl_pipeline_stage *stage) -{ - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - struct point_stage_data *store; - stage->privatePtr = malloc(sizeof(*store)); - store = POINT_STAGE_DATA(stage); - if (!store) - return GL_FALSE; - - _mesa_vector4f_alloc( &store->PointSize, 0, VB->Size, 32 ); - return GL_TRUE; -} - - -static void -free_point_data(struct tnl_pipeline_stage *stage) -{ - struct point_stage_data *store = POINT_STAGE_DATA(stage); - if (store) { - _mesa_vector4f_free( &store->PointSize ); - free( store ); - stage->privatePtr = NULL; - } -} - - -const struct tnl_pipeline_stage _tnl_point_attenuation_stage = -{ - "point size attenuation", /* name */ - NULL, /* stage private data */ - alloc_point_data, /* alloc data */ - free_point_data, /* destructor */ - NULL, - run_point_stage /* run */ -}; +/* + * Mesa 3-D graphics library + * Version: 7.0 + * + * Copyright (C) 1999-2007 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: + * Brian Paul + */ + +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/dd.h" +#include "main/imports.h" +#include "t_context.h" +#include "t_pipeline.h" + + +struct point_stage_data { + GLvector4f PointSize; +}; + +#define POINT_STAGE_DATA(stage) ((struct point_stage_data *)stage->privatePtr) + + +/** + * Compute point size for each vertex from the vertex eye-space Z + * coordinate and the point size attenuation factors. + * Only done when point size attenuation is enabled and vertex program is + * disabled. + */ +static GLboolean +run_point_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) +{ + if (ctx->Point._Attenuated && !ctx->VertexProgram._Current) { + struct point_stage_data *store = POINT_STAGE_DATA(stage); + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + const GLfloat *eyeCoord = (GLfloat *) VB->EyePtr->data + 2; + const GLint eyeCoordStride = VB->EyePtr->stride / sizeof(GLfloat); + const GLfloat p0 = ctx->Point.Params[0]; + const GLfloat p1 = ctx->Point.Params[1]; + const GLfloat p2 = ctx->Point.Params[2]; + const GLfloat pointSize = ctx->Point.Size; + GLfloat (*size)[4] = store->PointSize.data; + GLuint i; + + for (i = 0; i < VB->Count; i++) { + const GLfloat dist = FABSF(*eyeCoord); + const GLfloat q = p0 + dist * (p1 + dist * p2); + const GLfloat atten = (q != 0.0F) ? SQRTF(1.0F / q) : 1.0F; + size[i][0] = pointSize * atten; /* clamping done in rasterization */ + eyeCoord += eyeCoordStride; + } + + VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->PointSize; + } + + return GL_TRUE; +} + + +static GLboolean +alloc_point_data(struct gl_context *ctx, struct tnl_pipeline_stage *stage) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct point_stage_data *store; + stage->privatePtr = malloc(sizeof(*store)); + store = POINT_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + _mesa_vector4f_alloc( &store->PointSize, 0, VB->Size, 32 ); + return GL_TRUE; +} + + +static void +free_point_data(struct tnl_pipeline_stage *stage) +{ + struct point_stage_data *store = POINT_STAGE_DATA(stage); + if (store) { + _mesa_vector4f_free( &store->PointSize ); + free( store ); + stage->privatePtr = NULL; + } +} + + +const struct tnl_pipeline_stage _tnl_point_attenuation_stage = +{ + "point size attenuation", /* name */ + NULL, /* stage private data */ + alloc_point_data, /* alloc data */ + free_point_data, /* destructor */ + NULL, + run_point_stage /* run */ +}; diff --git a/mesalib/src/mesa/tnl/t_vb_render.c b/mesalib/src/mesa/tnl/t_vb_render.c index 64dabca98..cb3192132 100644 --- a/mesalib/src/mesa/tnl/t_vb_render.c +++ b/mesalib/src/mesa/tnl/t_vb_render.c @@ -1,348 +1,348 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * 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. - * - * Authors: - * Keith Whitwell - */ - - -/* - * Render whole vertex buffers, including projection of vertices from - * clip space and clipping of primitives. - * - * This file makes calls to project vertices and to the point, line - * and triangle rasterizers via the function pointers: - * - * context->Driver.Render.* - * - */ - - -#include "main/glheader.h" -#include "main/context.h" -#include "main/enums.h" -#include "main/macros.h" -#include "main/imports.h" -#include "main/mtypes.h" -#include "math/m_xform.h" - -#include "t_pipeline.h" - - - -/**********************************************************************/ -/* Clip single primitives */ -/**********************************************************************/ - - -#define W(i) coord[i][3] -#define Z(i) coord[i][2] -#define Y(i) coord[i][1] -#define X(i) coord[i][0] -#define SIZE 4 -#define TAG(x) x##_4 -#include "t_vb_cliptmp.h" - - - -/**********************************************************************/ -/* Clip and render whole begin/end objects */ -/**********************************************************************/ - -#define NEED_EDGEFLAG_SETUP (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) -#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] -#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val - - -/* This does NOT include the CLIP_USER_BIT! */ -#define CLIPMASK (CLIP_FRUSTUM_BITS | CLIP_CULL_BIT) - - -/* Vertices, with the possibility of clipping. - */ -#define RENDER_POINTS( start, count ) \ - tnl->Driver.Render.Points( ctx, start, count ) - -#define RENDER_LINE( v1, v2 ) \ -do { \ - GLubyte c1 = mask[v1], c2 = mask[v2]; \ - GLubyte ormask = c1|c2; \ - if (!ormask) \ - LineFunc( ctx, v1, v2 ); \ - else if (!(c1 & c2 & CLIPMASK)) \ - clip_line_4( ctx, v1, v2, ormask ); \ -} while (0) - -#define RENDER_TRI( v1, v2, v3 ) \ -do { \ - GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \ - GLubyte ormask = c1|c2|c3; \ - if (!ormask) \ - TriangleFunc( ctx, v1, v2, v3 ); \ - else if (!(c1 & c2 & c3 & CLIPMASK)) \ - clip_tri_4( ctx, v1, v2, v3, ormask ); \ -} while (0) - -#define RENDER_QUAD( v1, v2, v3, v4 ) \ -do { \ - GLubyte c1 = mask[v1], c2 = mask[v2]; \ - GLubyte c3 = mask[v3], c4 = mask[v4]; \ - GLubyte ormask = c1|c2|c3|c4; \ - if (!ormask) \ - QuadFunc( ctx, v1, v2, v3, v4 ); \ - else if (!(c1 & c2 & c3 & c4 & CLIPMASK)) \ - clip_quad_4( ctx, v1, v2, v3, v4, ormask ); \ -} while (0) - - -#define LOCAL_VARS \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - const GLuint * const elt = VB->Elts; \ - const GLubyte *mask = VB->ClipMask; \ - const GLuint sz = VB->ClipPtr->size; \ - const tnl_line_func LineFunc = tnl->Driver.Render.Line; \ - const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ - const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \ - const GLboolean stipple = ctx->Line.StippleFlag; \ - (void) (LineFunc && TriangleFunc && QuadFunc); \ - (void) elt; (void) mask; (void) sz; (void) stipple; - -#define TAG(x) clip_##x##_verts -#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) -#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) -#define PRESERVE_VB_DEFS -#include "t_vb_rendertmp.h" - - - -/* Elts, with the possibility of clipping. - */ -#undef ELT -#undef TAG -#define ELT(x) elt[x] -#define TAG(x) clip_##x##_elts -#include "t_vb_rendertmp.h" - -/* TODO: do this for all primitives, verts and elts: - */ -static void clip_elt_triangles( struct gl_context *ctx, - GLuint start, - GLuint count, - GLuint flags ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - tnl_render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES]; - struct vertex_buffer *VB = &tnl->vb; - const GLuint * const elt = VB->Elts; - GLubyte *mask = VB->ClipMask; - GLuint last = count-2; - GLuint j; - (void) flags; - - tnl->Driver.Render.PrimitiveNotify( ctx, GL_TRIANGLES ); - - for (j=start; j < last; j+=3 ) { - GLubyte c1 = mask[elt[j]]; - GLubyte c2 = mask[elt[j+1]]; - GLubyte c3 = mask[elt[j+2]]; - GLubyte ormask = c1|c2|c3; - if (ormask) { - if (start < j) - render_tris( ctx, start, j, 0 ); - if (!(c1&c2&c3&CLIPMASK)) - clip_tri_4( ctx, elt[j], elt[j+1], elt[j+2], ormask ); - start = j+3; - } - } - - if (start < j) - render_tris( ctx, start, j, 0 ); -} - -/**********************************************************************/ -/* Render whole begin/end objects */ -/**********************************************************************/ - -#define NEED_EDGEFLAG_SETUP (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) -#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] -#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val - - -/* Vertices, no clipping. - */ -#define RENDER_POINTS( start, count ) \ - tnl->Driver.Render.Points( ctx, start, count ) - -#define RENDER_LINE( v1, v2 ) \ - LineFunc( ctx, v1, v2 ) - -#define RENDER_TRI( v1, v2, v3 ) \ - TriangleFunc( ctx, v1, v2, v3 ) - -#define RENDER_QUAD( v1, v2, v3, v4 ) \ - QuadFunc( ctx, v1, v2, v3, v4 ) - -#define TAG(x) _tnl_##x##_verts - -#define LOCAL_VARS \ - TNLcontext *tnl = TNL_CONTEXT(ctx); \ - struct vertex_buffer *VB = &tnl->vb; \ - const GLuint * const elt = VB->Elts; \ - const tnl_line_func LineFunc = tnl->Driver.Render.Line; \ - const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ - const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \ - const GLboolean stipple = ctx->Line.StippleFlag; \ - (void) (LineFunc && TriangleFunc && QuadFunc); \ - (void) elt; (void) stipple - -#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) -#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) -#define RENDER_TAB_QUALIFIER -#define PRESERVE_VB_DEFS -#include "t_vb_rendertmp.h" - - -/* Elts, no clipping. - */ -#undef ELT -#define TAG(x) _tnl_##x##_elts -#define ELT(x) elt[x] -#include "t_vb_rendertmp.h" - - -/**********************************************************************/ -/* Helper functions for drivers */ -/**********************************************************************/ - -void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - GLuint *tmp = VB->Elts; - - VB->Elts = (GLuint *)elts; - tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END ); - VB->Elts = tmp; -} - -void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - tnl->Driver.Render.Line( ctx, ii, jj ); -} - - - -/**********************************************************************/ -/* Clip and render whole vertex buffers */ -/**********************************************************************/ - - -static GLboolean run_render( struct gl_context *ctx, - struct tnl_pipeline_stage *stage ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - tnl_render_func *tab; - GLint pass = 0; - - /* Allow the drivers to lock before projected verts are built so - * that window coordinates are guarenteed not to change before - * rendering. - */ - ASSERT(tnl->Driver.Render.Start); - - tnl->Driver.Render.Start( ctx ); - - ASSERT(tnl->Driver.Render.BuildVertices); - ASSERT(tnl->Driver.Render.PrimitiveNotify); - ASSERT(tnl->Driver.Render.Points); - ASSERT(tnl->Driver.Render.Line); - ASSERT(tnl->Driver.Render.Triangle); - ASSERT(tnl->Driver.Render.Quad); - ASSERT(tnl->Driver.Render.ResetLineStipple); - ASSERT(tnl->Driver.Render.Interp); - ASSERT(tnl->Driver.Render.CopyPV); - ASSERT(tnl->Driver.Render.ClippedLine); - ASSERT(tnl->Driver.Render.ClippedPolygon); - ASSERT(tnl->Driver.Render.Finish); - - tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, ~0 ); - - if (VB->ClipOrMask) { - tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts; - clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles; - } - else { - tab = (VB->Elts ? - tnl->Driver.Render.PrimTabElts : - tnl->Driver.Render.PrimTabVerts); - } - - do - { - GLuint i; - - for (i = 0 ; i < VB->PrimitiveCount ; i++) - { - GLuint prim = _tnl_translate_prim(&VB->Primitive[i]); - GLuint start = VB->Primitive[i].start; - GLuint length = VB->Primitive[i].count; - - assert((prim & PRIM_MODE_MASK) <= GL_POLYGON); - - if (MESA_VERBOSE & VERBOSE_PRIMS) - _mesa_debug(NULL, "MESA 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 ); - } - } while (tnl->Driver.Render.Multipass && - tnl->Driver.Render.Multipass( ctx, ++pass )); - - tnl->Driver.Render.Finish( ctx ); - - return GL_FALSE; /* finished the pipe */ -} - - -/**********************************************************************/ -/* Render pipeline stage */ -/**********************************************************************/ - - - - - -const struct tnl_pipeline_stage _tnl_render_stage = -{ - "render", /* name */ - NULL, /* private data */ - NULL, /* creator */ - NULL, /* destructor */ - NULL, /* validate */ - run_render /* run */ -}; +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * 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. + * + * Authors: + * Keith Whitwell + */ + + +/* + * Render whole vertex buffers, including projection of vertices from + * clip space and clipping of primitives. + * + * This file makes calls to project vertices and to the point, line + * and triangle rasterizers via the function pointers: + * + * context->Driver.Render.* + * + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "math/m_xform.h" + +#include "t_pipeline.h" + + + +/**********************************************************************/ +/* Clip single primitives */ +/**********************************************************************/ + + +#define W(i) coord[i][3] +#define Z(i) coord[i][2] +#define Y(i) coord[i][1] +#define X(i) coord[i][0] +#define SIZE 4 +#define TAG(x) x##_4 +#include "t_vb_cliptmp.h" + + + +/**********************************************************************/ +/* Clip and render whole begin/end objects */ +/**********************************************************************/ + +#define NEED_EDGEFLAG_SETUP (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) +#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] +#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val + + +/* This does NOT include the CLIP_USER_BIT! */ +#define CLIPMASK (CLIP_FRUSTUM_BITS | CLIP_CULL_BIT) + + +/* Vertices, with the possibility of clipping. + */ +#define RENDER_POINTS( start, count ) \ + tnl->Driver.Render.Points( ctx, start, count ) + +#define RENDER_LINE( v1, v2 ) \ +do { \ + GLubyte c1 = mask[v1], c2 = mask[v2]; \ + GLubyte ormask = c1|c2; \ + if (!ormask) \ + LineFunc( ctx, v1, v2 ); \ + else if (!(c1 & c2 & CLIPMASK)) \ + clip_line_4( ctx, v1, v2, ormask ); \ +} while (0) + +#define RENDER_TRI( v1, v2, v3 ) \ +do { \ + GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \ + GLubyte ormask = c1|c2|c3; \ + if (!ormask) \ + TriangleFunc( ctx, v1, v2, v3 ); \ + else if (!(c1 & c2 & c3 & CLIPMASK)) \ + clip_tri_4( ctx, v1, v2, v3, ormask ); \ +} while (0) + +#define RENDER_QUAD( v1, v2, v3, v4 ) \ +do { \ + GLubyte c1 = mask[v1], c2 = mask[v2]; \ + GLubyte c3 = mask[v3], c4 = mask[v4]; \ + GLubyte ormask = c1|c2|c3|c4; \ + if (!ormask) \ + QuadFunc( ctx, v1, v2, v3, v4 ); \ + else if (!(c1 & c2 & c3 & c4 & CLIPMASK)) \ + clip_quad_4( ctx, v1, v2, v3, v4, ormask ); \ +} while (0) + + +#define LOCAL_VARS \ + TNLcontext *tnl = TNL_CONTEXT(ctx); \ + struct vertex_buffer *VB = &tnl->vb; \ + const GLuint * const elt = VB->Elts; \ + const GLubyte *mask = VB->ClipMask; \ + const GLuint sz = VB->ClipPtr->size; \ + const tnl_line_func LineFunc = tnl->Driver.Render.Line; \ + const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ + const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \ + const GLboolean stipple = ctx->Line.StippleFlag; \ + (void) (LineFunc && TriangleFunc && QuadFunc); \ + (void) elt; (void) mask; (void) sz; (void) stipple; + +#define TAG(x) clip_##x##_verts +#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) +#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) +#define PRESERVE_VB_DEFS +#include "t_vb_rendertmp.h" + + + +/* Elts, with the possibility of clipping. + */ +#undef ELT +#undef TAG +#define ELT(x) elt[x] +#define TAG(x) clip_##x##_elts +#include "t_vb_rendertmp.h" + +/* TODO: do this for all primitives, verts and elts: + */ +static void clip_elt_triangles( struct gl_context *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + tnl_render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES]; + struct vertex_buffer *VB = &tnl->vb; + const GLuint * const elt = VB->Elts; + GLubyte *mask = VB->ClipMask; + GLuint last = count-2; + GLuint j; + (void) flags; + + tnl->Driver.Render.PrimitiveNotify( ctx, GL_TRIANGLES ); + + for (j=start; j < last; j+=3 ) { + GLubyte c1 = mask[elt[j]]; + GLubyte c2 = mask[elt[j+1]]; + GLubyte c3 = mask[elt[j+2]]; + GLubyte ormask = c1|c2|c3; + if (ormask) { + if (start < j) + render_tris( ctx, start, j, 0 ); + if (!(c1&c2&c3&CLIPMASK)) + clip_tri_4( ctx, elt[j], elt[j+1], elt[j+2], ormask ); + start = j+3; + } + } + + if (start < j) + render_tris( ctx, start, j, 0 ); +} + +/**********************************************************************/ +/* Render whole begin/end objects */ +/**********************************************************************/ + +#define NEED_EDGEFLAG_SETUP (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) +#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] +#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val + + +/* Vertices, no clipping. + */ +#define RENDER_POINTS( start, count ) \ + tnl->Driver.Render.Points( ctx, start, count ) + +#define RENDER_LINE( v1, v2 ) \ + LineFunc( ctx, v1, v2 ) + +#define RENDER_TRI( v1, v2, v3 ) \ + TriangleFunc( ctx, v1, v2, v3 ) + +#define RENDER_QUAD( v1, v2, v3, v4 ) \ + QuadFunc( ctx, v1, v2, v3, v4 ) + +#define TAG(x) _tnl_##x##_verts + +#define LOCAL_VARS \ + TNLcontext *tnl = TNL_CONTEXT(ctx); \ + struct vertex_buffer *VB = &tnl->vb; \ + const GLuint * const elt = VB->Elts; \ + const tnl_line_func LineFunc = tnl->Driver.Render.Line; \ + const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ + const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \ + const GLboolean stipple = ctx->Line.StippleFlag; \ + (void) (LineFunc && TriangleFunc && QuadFunc); \ + (void) elt; (void) stipple + +#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) +#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) +#define RENDER_TAB_QUALIFIER +#define PRESERVE_VB_DEFS +#include "t_vb_rendertmp.h" + + +/* Elts, no clipping. + */ +#undef ELT +#define TAG(x) _tnl_##x##_elts +#define ELT(x) elt[x] +#include "t_vb_rendertmp.h" + + +/**********************************************************************/ +/* Helper functions for drivers */ +/**********************************************************************/ + +void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + GLuint *tmp = VB->Elts; + + VB->Elts = (GLuint *)elts; + tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END ); + VB->Elts = tmp; +} + +void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + tnl->Driver.Render.Line( ctx, ii, jj ); +} + + + +/**********************************************************************/ +/* Clip and render whole vertex buffers */ +/**********************************************************************/ + + +static GLboolean run_render( struct gl_context *ctx, + struct tnl_pipeline_stage *stage ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + tnl_render_func *tab; + GLint pass = 0; + + /* Allow the drivers to lock before projected verts are built so + * that window coordinates are guarenteed not to change before + * rendering. + */ + ASSERT(tnl->Driver.Render.Start); + + tnl->Driver.Render.Start( ctx ); + + ASSERT(tnl->Driver.Render.BuildVertices); + ASSERT(tnl->Driver.Render.PrimitiveNotify); + ASSERT(tnl->Driver.Render.Points); + ASSERT(tnl->Driver.Render.Line); + ASSERT(tnl->Driver.Render.Triangle); + ASSERT(tnl->Driver.Render.Quad); + ASSERT(tnl->Driver.Render.ResetLineStipple); + ASSERT(tnl->Driver.Render.Interp); + ASSERT(tnl->Driver.Render.CopyPV); + ASSERT(tnl->Driver.Render.ClippedLine); + ASSERT(tnl->Driver.Render.ClippedPolygon); + ASSERT(tnl->Driver.Render.Finish); + + tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, ~0 ); + + if (VB->ClipOrMask) { + tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts; + clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles; + } + else { + tab = (VB->Elts ? + tnl->Driver.Render.PrimTabElts : + tnl->Driver.Render.PrimTabVerts); + } + + do + { + GLuint i; + + for (i = 0 ; i < VB->PrimitiveCount ; i++) + { + GLuint prim = _tnl_translate_prim(&VB->Primitive[i]); + GLuint start = VB->Primitive[i].start; + GLuint length = VB->Primitive[i].count; + + assert((prim & PRIM_MODE_MASK) <= GL_POLYGON); + + if (MESA_VERBOSE & VERBOSE_PRIMS) + _mesa_debug(NULL, "MESA 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 ); + } + } while (tnl->Driver.Render.Multipass && + tnl->Driver.Render.Multipass( ctx, ++pass )); + + tnl->Driver.Render.Finish( ctx ); + + return GL_FALSE; /* finished the pipe */ +} + + +/**********************************************************************/ +/* Render pipeline stage */ +/**********************************************************************/ + + + + + +const struct tnl_pipeline_stage _tnl_render_stage = +{ + "render", /* name */ + NULL, /* private data */ + NULL, /* creator */ + NULL, /* destructor */ + NULL, /* validate */ + run_render /* run */ +}; diff --git a/mesalib/src/mesa/tnl/t_vb_rendertmp.h b/mesalib/src/mesa/tnl/t_vb_rendertmp.h index 92dbf219d..4ed485a7b 100644 --- a/mesalib/src/mesa/tnl/t_vb_rendertmp.h +++ b/mesalib/src/mesa/tnl/t_vb_rendertmp.h @@ -1,486 +1,486 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * 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. - * - * Authors: - * Keith Whitwell - */ - - -#ifndef POSTFIX -#define POSTFIX -#endif - -#ifndef INIT -#define INIT(x) -#endif - -#ifndef NEED_EDGEFLAG_SETUP -#define NEED_EDGEFLAG_SETUP 0 -#define EDGEFLAG_GET(a) 0 -#define EDGEFLAG_SET(a,b) (void)b -#endif - -#ifndef RESET_STIPPLE -#define RESET_STIPPLE -#endif - -#ifndef TEST_PRIM_END -#define TEST_PRIM_END(prim) (flags & PRIM_END) -#define TEST_PRIM_BEGIN(prim) (flags & PRIM_BEGIN) -#endif - -#ifndef ELT -#define ELT(x) x -#endif - -#ifndef RENDER_TAB_QUALIFIER -#define RENDER_TAB_QUALIFIER static -#endif - -static void TAG(render_points)( struct gl_context *ctx, - GLuint start, - GLuint count, - GLuint flags ) -{ - LOCAL_VARS; - (void) flags; - - INIT(GL_POINTS); - RENDER_POINTS( start, count ); - POSTFIX; -} - -static void TAG(render_lines)( struct gl_context *ctx, - GLuint start, - GLuint count, - GLuint flags ) -{ - GLuint j; - LOCAL_VARS; - (void) flags; - - INIT(GL_LINES); - for (j=start+1; jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) - RENDER_LINE( ELT(j-1), ELT(j) ); - else - RENDER_LINE( ELT(j), ELT(j-1) ); - } - POSTFIX; -} - - -static void TAG(render_line_strip)( struct gl_context *ctx, - GLuint start, - GLuint count, - GLuint flags ) -{ - GLuint j; - LOCAL_VARS; - (void) flags; - - INIT(GL_LINE_STRIP); - - if (TEST_PRIM_BEGIN(flags)) { - RESET_STIPPLE; - } - - for (j=start+1; jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) - RENDER_LINE( ELT(j-1), ELT(j) ); - else - RENDER_LINE( ELT(j), ELT(j-1) ); - } - POSTFIX; -} - - -static void TAG(render_line_loop)( struct gl_context *ctx, - GLuint start, - GLuint count, - GLuint flags ) -{ - GLuint i; - LOCAL_VARS; - - (void) flags; - - INIT(GL_LINE_LOOP); - - if (start+1 < count) { - if (TEST_PRIM_BEGIN(flags)) { - RESET_STIPPLE; - if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) - RENDER_LINE( ELT(start), ELT(start+1) ); - else - RENDER_LINE( ELT(start+1), ELT(start) ); - } - - for ( i = start+2 ; i < count ; i++) { - if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) - RENDER_LINE( ELT(i-1), ELT(i) ); - else - RENDER_LINE( ELT(i), ELT(i-1) ); - } - - if ( TEST_PRIM_END(flags)) { - if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) - RENDER_LINE( ELT(count-1), ELT(start) ); - else - RENDER_LINE( ELT(start), ELT(count-1) ); - } - } - - POSTFIX; -} - - -static void TAG(render_triangles)( struct gl_context *ctx, - GLuint start, - GLuint count, - GLuint flags ) -{ - GLuint j; - LOCAL_VARS; - (void) flags; - - INIT(GL_TRIANGLES); - if (NEED_EDGEFLAG_SETUP) { - for (j=start+2; jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) - RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) ); - else - RENDER_TRI( ELT(j-1), ELT(j), ELT(j-2) ); - } - } else { - for (j=start+2; jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) - RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) ); - else - RENDER_TRI( ELT(j-1), ELT(j), ELT(j-2) ); - } - } - POSTFIX; -} - - - -static void TAG(render_tri_strip)( struct gl_context *ctx, - GLuint start, - GLuint count, - GLuint flags ) -{ - GLuint j; - GLuint parity = 0; - LOCAL_VARS; - - INIT(GL_TRIANGLE_STRIP); - if (NEED_EDGEFLAG_SETUP) { - for (j=start+2;jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) { - ej2 = ELT(j-2+parity); - ej1 = ELT(j-1-parity); - ej = ELT(j); - } - else { - ej2 = ELT(j-1+parity); - ej1 = ELT(j-parity); - ej = ELT(j-2); - } - ef2 = EDGEFLAG_GET( ej2 ); - ef1 = EDGEFLAG_GET( ej1 ); - ef = EDGEFLAG_GET( ej ); - if (TEST_PRIM_BEGIN(flags)) { - RESET_STIPPLE; - } - EDGEFLAG_SET( ej2, GL_TRUE ); - EDGEFLAG_SET( ej1, GL_TRUE ); - EDGEFLAG_SET( ej, GL_TRUE ); - RENDER_TRI( ej2, ej1, ej ); - EDGEFLAG_SET( ej2, ef2 ); - EDGEFLAG_SET( ej1, ef1 ); - EDGEFLAG_SET( ej, ef ); - } - } else { - for (j=start+2; jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) - RENDER_TRI( ELT(j-2+parity), ELT(j-1-parity), ELT(j) ); - else - RENDER_TRI( ELT(j-1+parity), ELT(j-parity), ELT(j-2) ); - } - } - POSTFIX; -} - - -static void TAG(render_tri_fan)( struct gl_context *ctx, - GLuint start, - GLuint count, - GLuint flags ) -{ - GLuint j; - LOCAL_VARS; - (void) flags; - - INIT(GL_TRIANGLE_FAN); - if (NEED_EDGEFLAG_SETUP) { - for (j=start+2;jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) - RENDER_TRI( ejs, ej1, ej); - else - RENDER_TRI( ej, ejs, ej1); - EDGEFLAG_SET( ejs, efs ); - EDGEFLAG_SET( ej1, ef1 ); - EDGEFLAG_SET( ej, ef ); - } - } else { - for (j=start+2;jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) - RENDER_TRI( ELT(start), ELT(j-1), ELT(j) ); - else - RENDER_TRI( ELT(j), ELT(start), ELT(j-1) ); - } - } - - POSTFIX; -} - - -static void TAG(render_poly)( struct gl_context *ctx, - GLuint start, - GLuint count, - GLuint flags ) -{ - GLuint j = start+2; - LOCAL_VARS; - (void) flags; - - INIT(GL_POLYGON); - if (NEED_EDGEFLAG_SETUP) { - GLboolean efstart = EDGEFLAG_GET( ELT(start) ); - GLboolean efcount = EDGEFLAG_GET( ELT(count-1) ); - - /* If the primitive does not begin here, the first edge - * is non-boundary. - */ - if (!TEST_PRIM_BEGIN(flags)) - EDGEFLAG_SET( ELT(start), GL_FALSE ); - else { - RESET_STIPPLE; - } - - /* If the primitive does not end here, the final edge is - * non-boundary. - */ - if (!TEST_PRIM_END(flags)) - EDGEFLAG_SET( ELT(count-1), GL_FALSE ); - - /* Draw the first triangles (possibly zero) - */ - if (j+1Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT || - !ctx->Const.QuadsFollowProvokingVertexConvention) - RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) ); - else - RENDER_QUAD( ELT(j-2), ELT(j-1), ELT(j), ELT(j-3) ); - } - } else { - for (j=start+3; jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT || - !ctx->Const.QuadsFollowProvokingVertexConvention) - RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) ); - else - RENDER_QUAD( ELT(j-2), ELT(j-1), ELT(j), ELT(j-3) ); - } - } - POSTFIX; -} - -static void TAG(render_quad_strip)( struct gl_context *ctx, - GLuint start, - GLuint count, - GLuint flags ) -{ - GLuint j; - LOCAL_VARS; - (void) flags; - - INIT(GL_QUAD_STRIP); - if (NEED_EDGEFLAG_SETUP) { - for (j=start+3;jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT || - !ctx->Const.QuadsFollowProvokingVertexConvention) - RENDER_QUAD( ELT(j-1), ELT(j-3), ELT(j-2), ELT(j) ); - else - RENDER_QUAD( ELT(j-2), ELT(j), ELT(j-1), ELT(j-3) ); - EDGEFLAG_SET( ELT(j-3), ef3 ); - EDGEFLAG_SET( ELT(j-2), ef2 ); - EDGEFLAG_SET( ELT(j-1), ef1 ); - EDGEFLAG_SET( ELT(j), ef ); - } - } else { - for (j=start+3;jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT || - !ctx->Const.QuadsFollowProvokingVertexConvention) - RENDER_QUAD( ELT(j-1), ELT(j-3), ELT(j-2), ELT(j) ); - else - RENDER_QUAD( ELT(j-2), ELT(j), ELT(j-1), ELT(j-3) ); - } - } - POSTFIX; -} - -static void TAG(render_noop)( struct gl_context *ctx, - GLuint start, - GLuint count, - GLuint flags ) -{ - (void)(ctx && start && count && flags); -} - -RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(struct gl_context *, - GLuint, - GLuint, - GLuint) = -{ - TAG(render_points), - TAG(render_lines), - TAG(render_line_loop), - TAG(render_line_strip), - TAG(render_triangles), - TAG(render_tri_strip), - TAG(render_tri_fan), - TAG(render_quads), - TAG(render_quad_strip), - TAG(render_poly), - TAG(render_noop), -}; - - - -#ifndef PRESERVE_VB_DEFS -#undef RENDER_TRI -#undef RENDER_QUAD -#undef RENDER_LINE -#undef RENDER_POINTS -#undef LOCAL_VARS -#undef INIT -#undef POSTFIX -#undef RESET_STIPPLE -#undef DBG -#undef ELT -#undef RENDER_TAB_QUALIFIER -#endif - -#ifndef PRESERVE_TAG -#undef TAG -#endif - -#undef PRESERVE_VB_DEFS -#undef PRESERVE_TAG +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * 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. + * + * Authors: + * Keith Whitwell + */ + + +#ifndef POSTFIX +#define POSTFIX +#endif + +#ifndef INIT +#define INIT(x) +#endif + +#ifndef NEED_EDGEFLAG_SETUP +#define NEED_EDGEFLAG_SETUP 0 +#define EDGEFLAG_GET(a) 0 +#define EDGEFLAG_SET(a,b) (void)b +#endif + +#ifndef RESET_STIPPLE +#define RESET_STIPPLE +#endif + +#ifndef TEST_PRIM_END +#define TEST_PRIM_END(prim) (flags & PRIM_END) +#define TEST_PRIM_BEGIN(prim) (flags & PRIM_BEGIN) +#endif + +#ifndef ELT +#define ELT(x) x +#endif + +#ifndef RENDER_TAB_QUALIFIER +#define RENDER_TAB_QUALIFIER static +#endif + +static void TAG(render_points)( struct gl_context *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + (void) flags; + + INIT(GL_POINTS); + RENDER_POINTS( start, count ); + POSTFIX; +} + +static void TAG(render_lines)( struct gl_context *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + GLuint j; + LOCAL_VARS; + (void) flags; + + INIT(GL_LINES); + for (j=start+1; jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_LINE( ELT(j-1), ELT(j) ); + else + RENDER_LINE( ELT(j), ELT(j-1) ); + } + POSTFIX; +} + + +static void TAG(render_line_strip)( struct gl_context *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + GLuint j; + LOCAL_VARS; + (void) flags; + + INIT(GL_LINE_STRIP); + + if (TEST_PRIM_BEGIN(flags)) { + RESET_STIPPLE; + } + + for (j=start+1; jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_LINE( ELT(j-1), ELT(j) ); + else + RENDER_LINE( ELT(j), ELT(j-1) ); + } + POSTFIX; +} + + +static void TAG(render_line_loop)( struct gl_context *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + GLuint i; + LOCAL_VARS; + + (void) flags; + + INIT(GL_LINE_LOOP); + + if (start+1 < count) { + if (TEST_PRIM_BEGIN(flags)) { + RESET_STIPPLE; + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_LINE( ELT(start), ELT(start+1) ); + else + RENDER_LINE( ELT(start+1), ELT(start) ); + } + + for ( i = start+2 ; i < count ; i++) { + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_LINE( ELT(i-1), ELT(i) ); + else + RENDER_LINE( ELT(i), ELT(i-1) ); + } + + if ( TEST_PRIM_END(flags)) { + if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_LINE( ELT(count-1), ELT(start) ); + else + RENDER_LINE( ELT(start), ELT(count-1) ); + } + } + + POSTFIX; +} + + +static void TAG(render_triangles)( struct gl_context *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + GLuint j; + LOCAL_VARS; + (void) flags; + + INIT(GL_TRIANGLES); + if (NEED_EDGEFLAG_SETUP) { + for (j=start+2; jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) ); + else + RENDER_TRI( ELT(j-1), ELT(j), ELT(j-2) ); + } + } else { + for (j=start+2; jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) ); + else + RENDER_TRI( ELT(j-1), ELT(j), ELT(j-2) ); + } + } + POSTFIX; +} + + + +static void TAG(render_tri_strip)( struct gl_context *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + GLuint j; + GLuint parity = 0; + LOCAL_VARS; + + INIT(GL_TRIANGLE_STRIP); + if (NEED_EDGEFLAG_SETUP) { + for (j=start+2;jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) { + ej2 = ELT(j-2+parity); + ej1 = ELT(j-1-parity); + ej = ELT(j); + } + else { + ej2 = ELT(j-1+parity); + ej1 = ELT(j-parity); + ej = ELT(j-2); + } + ef2 = EDGEFLAG_GET( ej2 ); + ef1 = EDGEFLAG_GET( ej1 ); + ef = EDGEFLAG_GET( ej ); + if (TEST_PRIM_BEGIN(flags)) { + RESET_STIPPLE; + } + EDGEFLAG_SET( ej2, GL_TRUE ); + EDGEFLAG_SET( ej1, GL_TRUE ); + EDGEFLAG_SET( ej, GL_TRUE ); + RENDER_TRI( ej2, ej1, ej ); + EDGEFLAG_SET( ej2, ef2 ); + EDGEFLAG_SET( ej1, ef1 ); + EDGEFLAG_SET( ej, ef ); + } + } else { + for (j=start+2; jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_TRI( ELT(j-2+parity), ELT(j-1-parity), ELT(j) ); + else + RENDER_TRI( ELT(j-1+parity), ELT(j-parity), ELT(j-2) ); + } + } + POSTFIX; +} + + +static void TAG(render_tri_fan)( struct gl_context *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + GLuint j; + LOCAL_VARS; + (void) flags; + + INIT(GL_TRIANGLE_FAN); + if (NEED_EDGEFLAG_SETUP) { + for (j=start+2;jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_TRI( ejs, ej1, ej); + else + RENDER_TRI( ej, ejs, ej1); + EDGEFLAG_SET( ejs, efs ); + EDGEFLAG_SET( ej1, ef1 ); + EDGEFLAG_SET( ej, ef ); + } + } else { + for (j=start+2;jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT) + RENDER_TRI( ELT(start), ELT(j-1), ELT(j) ); + else + RENDER_TRI( ELT(j), ELT(start), ELT(j-1) ); + } + } + + POSTFIX; +} + + +static void TAG(render_poly)( struct gl_context *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + GLuint j = start+2; + LOCAL_VARS; + (void) flags; + + INIT(GL_POLYGON); + if (NEED_EDGEFLAG_SETUP) { + GLboolean efstart = EDGEFLAG_GET( ELT(start) ); + GLboolean efcount = EDGEFLAG_GET( ELT(count-1) ); + + /* If the primitive does not begin here, the first edge + * is non-boundary. + */ + if (!TEST_PRIM_BEGIN(flags)) + EDGEFLAG_SET( ELT(start), GL_FALSE ); + else { + RESET_STIPPLE; + } + + /* If the primitive does not end here, the final edge is + * non-boundary. + */ + if (!TEST_PRIM_END(flags)) + EDGEFLAG_SET( ELT(count-1), GL_FALSE ); + + /* Draw the first triangles (possibly zero) + */ + if (j+1Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT || + !ctx->Const.QuadsFollowProvokingVertexConvention) + RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) ); + else + RENDER_QUAD( ELT(j-2), ELT(j-1), ELT(j), ELT(j-3) ); + } + } else { + for (j=start+3; jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT || + !ctx->Const.QuadsFollowProvokingVertexConvention) + RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) ); + else + RENDER_QUAD( ELT(j-2), ELT(j-1), ELT(j), ELT(j-3) ); + } + } + POSTFIX; +} + +static void TAG(render_quad_strip)( struct gl_context *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + GLuint j; + LOCAL_VARS; + (void) flags; + + INIT(GL_QUAD_STRIP); + if (NEED_EDGEFLAG_SETUP) { + for (j=start+3;jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT || + !ctx->Const.QuadsFollowProvokingVertexConvention) + RENDER_QUAD( ELT(j-1), ELT(j-3), ELT(j-2), ELT(j) ); + else + RENDER_QUAD( ELT(j-2), ELT(j), ELT(j-1), ELT(j-3) ); + EDGEFLAG_SET( ELT(j-3), ef3 ); + EDGEFLAG_SET( ELT(j-2), ef2 ); + EDGEFLAG_SET( ELT(j-1), ef1 ); + EDGEFLAG_SET( ELT(j), ef ); + } + } else { + for (j=start+3;jLight.ProvokingVertex == GL_LAST_VERTEX_CONVENTION_EXT || + !ctx->Const.QuadsFollowProvokingVertexConvention) + RENDER_QUAD( ELT(j-1), ELT(j-3), ELT(j-2), ELT(j) ); + else + RENDER_QUAD( ELT(j-2), ELT(j), ELT(j-1), ELT(j-3) ); + } + } + POSTFIX; +} + +static void TAG(render_noop)( struct gl_context *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + (void)(ctx && start && count && flags); +} + +RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(struct gl_context *, + GLuint, + GLuint, + GLuint) = +{ + TAG(render_points), + TAG(render_lines), + TAG(render_line_loop), + TAG(render_line_strip), + TAG(render_triangles), + TAG(render_tri_strip), + TAG(render_tri_fan), + TAG(render_quads), + TAG(render_quad_strip), + TAG(render_poly), + TAG(render_noop), +}; + + + +#ifndef PRESERVE_VB_DEFS +#undef RENDER_TRI +#undef RENDER_QUAD +#undef RENDER_LINE +#undef RENDER_POINTS +#undef LOCAL_VARS +#undef INIT +#undef POSTFIX +#undef RESET_STIPPLE +#undef DBG +#undef ELT +#undef RENDER_TAB_QUALIFIER +#endif + +#ifndef PRESERVE_TAG +#undef TAG +#endif + +#undef PRESERVE_VB_DEFS +#undef PRESERVE_TAG diff --git a/mesalib/src/mesa/tnl/t_vb_texgen.c b/mesalib/src/mesa/tnl/t_vb_texgen.c index 228808461..61430c396 100644 --- a/mesalib/src/mesa/tnl/t_vb_texgen.c +++ b/mesalib/src/mesa/tnl/t_vb_texgen.c @@ -1,609 +1,609 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2006 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: - * Brian Paul - * Keith Whitwell - */ - -/* - * Regarding GL_NV_texgen_reflection: - * - * Portions of this software may use or implement intellectual - * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims - * any and all warranties with respect to such intellectual property, - * including any use thereof or modifications thereto. - */ - -#include "main/glheader.h" -#include "main/colormac.h" -#include "main/macros.h" -#include "main/imports.h" -#include "main/mtypes.h" - -#include "math/m_xform.h" - -#include "t_context.h" -#include "t_pipeline.h" - - -/*********************************************************************** - * Automatic texture coordinate generation (texgen) code. - */ - - -struct texgen_stage_data; - -typedef void (*texgen_func)( struct gl_context *ctx, - struct texgen_stage_data *store, - GLuint unit); - - -struct texgen_stage_data { - - /* Per-texunit derived state. - */ - GLuint TexgenSize[MAX_TEXTURE_COORD_UNITS]; - texgen_func TexgenFunc[MAX_TEXTURE_COORD_UNITS]; - - /* Temporary values used in texgen. - */ - GLfloat (*tmp_f)[3]; - GLfloat *tmp_m; - - /* Buffered outputs of the stage. - */ - GLvector4f texcoord[MAX_TEXTURE_COORD_UNITS]; -}; - - -#define TEXGEN_STAGE_DATA(stage) ((struct texgen_stage_data *)stage->privatePtr) - - - -static GLuint all_bits[5] = { - 0, - VEC_SIZE_1, - VEC_SIZE_2, - VEC_SIZE_3, - VEC_SIZE_4, -}; - -#define VEC_SIZE_FLAGS (VEC_SIZE_1|VEC_SIZE_2|VEC_SIZE_3|VEC_SIZE_4) - -#define TEXGEN_NEED_M (TEXGEN_SPHERE_MAP) -#define TEXGEN_NEED_F (TEXGEN_SPHERE_MAP | \ - TEXGEN_REFLECTION_MAP_NV) - - - -static void build_m3( GLfloat f[][3], GLfloat m[], - const GLvector4f *normal, - const GLvector4f *eye ) -{ - GLuint stride = eye->stride; - GLfloat *coord = (GLfloat *)eye->start; - GLuint count = eye->count; - const GLfloat *norm = normal->start; - GLuint i; - - for (i=0;istride)) { - GLfloat u[3], two_nu, fx, fy, fz; - COPY_3V( u, coord ); - NORMALIZE_3FV( u ); - two_nu = 2.0F * DOT3(norm,u); - fx = f[i][0] = u[0] - norm[0] * two_nu; - fy = f[i][1] = u[1] - norm[1] * two_nu; - fz = f[i][2] = u[2] - norm[2] * two_nu; - m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); - if (m[i] != 0.0F) { - m[i] = 0.5F * _mesa_inv_sqrtf(m[i]); - } - } -} - - - -static void build_m2( GLfloat f[][3], GLfloat m[], - const GLvector4f *normal, - const GLvector4f *eye ) -{ - GLuint stride = eye->stride; - GLfloat *coord = eye->start; - GLuint count = eye->count; - - GLfloat *norm = normal->start; - GLuint i; - - for (i=0;istride)) { - GLfloat u[3], two_nu, fx, fy, fz; - COPY_2V( u, coord ); - u[2] = 0; - NORMALIZE_3FV( u ); - two_nu = 2.0F * DOT3(norm,u); - fx = f[i][0] = u[0] - norm[0] * two_nu; - fy = f[i][1] = u[1] - norm[1] * two_nu; - fz = f[i][2] = u[2] - norm[2] * two_nu; - m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); - if (m[i] != 0.0F) { - m[i] = 0.5F * _mesa_inv_sqrtf(m[i]); - } - } -} - - - -typedef void (*build_m_func)( GLfloat f[][3], - GLfloat m[], - const GLvector4f *normal, - const GLvector4f *eye ); - - -static build_m_func build_m_tab[5] = { - NULL, - NULL, - build_m2, - build_m3, - build_m3 -}; - - -/* This is unusual in that we respect the stride of the output vector - * (f). This allows us to pass in either a texcoord vector4f, or a - * temporary vector3f. - */ -static void build_f3( GLfloat *f, - GLuint fstride, - const GLvector4f *normal, - const GLvector4f *eye ) -{ - GLuint stride = eye->stride; - GLfloat *coord = eye->start; - GLuint count = eye->count; - - GLfloat *norm = normal->start; - GLuint i; - - for (i=0;istride); - } -} - - -static void build_f2( GLfloat *f, - GLuint fstride, - const GLvector4f *normal, - const GLvector4f *eye ) -{ - GLuint stride = eye->stride; - GLfloat *coord = eye->start; - GLuint count = eye->count; - GLfloat *norm = normal->start; - GLuint i; - - for (i=0;istride); - } -} - -typedef void (*build_f_func)( GLfloat *f, - GLuint fstride, - const GLvector4f *normal_vec, - const GLvector4f *eye ); - - - -/* Just treat 4-vectors as 3-vectors. - */ -static build_f_func build_f_tab[5] = { - NULL, - NULL, - build_f2, - build_f3, - build_f3 -}; - - - -/* Special case texgen functions. - */ -static void texgen_reflection_map_nv( struct gl_context *ctx, - struct texgen_stage_data *store, - GLuint unit ) -{ - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit]; - GLvector4f *out = &store->texcoord[unit]; - - build_f_tab[VB->EyePtr->size]( out->start, - out->stride, - VB->AttribPtr[_TNL_ATTRIB_NORMAL], - VB->EyePtr ); - - out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3; - out->count = VB->Count; - out->size = MAX2(in->size, 3); - if (in->size == 4) - _mesa_copy_tab[0x8]( out, in ); -} - - - -static void texgen_normal_map_nv( struct gl_context *ctx, - struct texgen_stage_data *store, - GLuint unit ) -{ - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit]; - GLvector4f *out = &store->texcoord[unit]; - GLvector4f *normal = VB->AttribPtr[_TNL_ATTRIB_NORMAL]; - GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->start; - GLuint count = VB->Count; - GLuint i; - const GLfloat *norm = normal->start; - - for (i=0;istride)) { - texcoord[i][0] = norm[0]; - texcoord[i][1] = norm[1]; - texcoord[i][2] = norm[2]; - } - - - out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3; - out->count = count; - out->size = MAX2(in->size, 3); - if (in->size == 4) - _mesa_copy_tab[0x8]( out, in ); -} - - -static void texgen_sphere_map( struct gl_context *ctx, - struct texgen_stage_data *store, - GLuint unit ) -{ - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit]; - GLvector4f *out = &store->texcoord[unit]; - GLfloat (*texcoord)[4] = (GLfloat (*)[4]) out->start; - GLuint count = VB->Count; - GLuint i; - GLfloat (*f)[3] = store->tmp_f; - GLfloat *m = store->tmp_m; - - (build_m_tab[VB->EyePtr->size])( store->tmp_f, - store->tmp_m, - VB->AttribPtr[_TNL_ATTRIB_NORMAL], - VB->EyePtr ); - - out->size = MAX2(in->size,2); - - for (i=0;icount = count; - out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_2; - if (in->size > 2) - _mesa_copy_tab[all_bits[in->size] & ~0x3]( out, in ); -} - - - -static void texgen( struct gl_context *ctx, - struct texgen_stage_data *store, - GLuint unit ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit]; - GLvector4f *out = &store->texcoord[unit]; - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - const GLvector4f *obj = VB->AttribPtr[_TNL_ATTRIB_POS]; - const GLvector4f *eye = VB->EyePtr; - const GLvector4f *normal = VB->AttribPtr[_TNL_ATTRIB_NORMAL]; - const GLfloat *m = store->tmp_m; - const GLuint count = VB->Count; - GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data; - GLfloat (*f)[3] = store->tmp_f; - GLuint copy; - - if (texUnit->_GenFlags & TEXGEN_NEED_M) { - build_m_tab[eye->size]( store->tmp_f, store->tmp_m, normal, eye ); - } else if (texUnit->_GenFlags & TEXGEN_NEED_F) { - build_f_tab[eye->size]( (GLfloat *)store->tmp_f, 3, normal, eye ); - } - - - out->size = MAX2(in->size, store->TexgenSize[unit]); - out->flags |= (in->flags & VEC_SIZE_FLAGS) | texUnit->TexGenEnabled; - out->count = count; - - copy = (all_bits[in->size] & ~texUnit->TexGenEnabled); - if (copy) - _mesa_copy_tab[copy]( out, in ); - - if (texUnit->TexGenEnabled & S_BIT) { - GLuint i; - switch (texUnit->GenS.Mode) { - case GL_OBJECT_LINEAR: - _mesa_dotprod_tab[obj->size]( (GLfloat *)out->data, - sizeof(out->data[0]), obj, - texUnit->GenS.ObjectPlane ); - break; - case GL_EYE_LINEAR: - _mesa_dotprod_tab[eye->size]( (GLfloat *)out->data, - sizeof(out->data[0]), eye, - texUnit->GenS.EyePlane ); - break; - case GL_SPHERE_MAP: - for (i = 0; i < count; i++) - texcoord[i][0] = f[i][0] * m[i] + 0.5F; - break; - case GL_REFLECTION_MAP_NV: - for (i=0;istart; - for (i=0;istride)) { - texcoord[i][0] = norm[0]; - } - break; - } - default: - _mesa_problem(ctx, "Bad S texgen"); - } - } - - if (texUnit->TexGenEnabled & T_BIT) { - GLuint i; - switch (texUnit->GenT.Mode) { - case GL_OBJECT_LINEAR: - _mesa_dotprod_tab[obj->size]( &(out->data[0][1]), - sizeof(out->data[0]), obj, - texUnit->GenT.ObjectPlane ); - break; - case GL_EYE_LINEAR: - _mesa_dotprod_tab[eye->size]( &(out->data[0][1]), - sizeof(out->data[0]), eye, - texUnit->GenT.EyePlane ); - break; - case GL_SPHERE_MAP: - for (i = 0; i < count; i++) - texcoord[i][1] = f[i][1] * m[i] + 0.5F; - break; - case GL_REFLECTION_MAP_NV: - for (i=0;istart; - for (i=0;istride)) { - texcoord[i][1] = norm[1]; - } - break; - } - default: - _mesa_problem(ctx, "Bad T texgen"); - } - } - - if (texUnit->TexGenEnabled & R_BIT) { - GLuint i; - switch (texUnit->GenR.Mode) { - case GL_OBJECT_LINEAR: - _mesa_dotprod_tab[obj->size]( &(out->data[0][2]), - sizeof(out->data[0]), obj, - texUnit->GenR.ObjectPlane ); - break; - case GL_EYE_LINEAR: - _mesa_dotprod_tab[eye->size]( &(out->data[0][2]), - sizeof(out->data[0]), eye, - texUnit->GenR.EyePlane ); - break; - case GL_REFLECTION_MAP_NV: - for (i=0;istart; - for (i=0;istride)) { - texcoord[i][2] = norm[2]; - } - break; - } - default: - _mesa_problem(ctx, "Bad R texgen"); - } - } - - if (texUnit->TexGenEnabled & Q_BIT) { - switch (texUnit->GenQ.Mode) { - case GL_OBJECT_LINEAR: - _mesa_dotprod_tab[obj->size]( &(out->data[0][3]), - sizeof(out->data[0]), obj, - texUnit->GenQ.ObjectPlane ); - break; - case GL_EYE_LINEAR: - _mesa_dotprod_tab[eye->size]( &(out->data[0][3]), - sizeof(out->data[0]), eye, - texUnit->GenQ.EyePlane ); - break; - default: - _mesa_problem(ctx, "Bad Q texgen"); - } - } -} - - - - -static GLboolean run_texgen_stage( struct gl_context *ctx, - struct tnl_pipeline_stage *stage ) -{ - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); - GLuint i; - - if (!ctx->Texture._TexGenEnabled || ctx->VertexProgram._Current) - return GL_TRUE; - - for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; - - if (texUnit->TexGenEnabled) { - - store->TexgenFunc[i]( ctx, store, i ); - - VB->AttribPtr[VERT_ATTRIB_TEX0 + i] = &store->texcoord[i]; - } - } - - return GL_TRUE; -} - - -static void validate_texgen_stage( struct gl_context *ctx, - struct tnl_pipeline_stage *stage ) -{ - struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); - GLuint i; - - if (!ctx->Texture._TexGenEnabled || ctx->VertexProgram._Current) - return; - - for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; - - if (texUnit->TexGenEnabled) { - GLuint sz; - - if (texUnit->TexGenEnabled & Q_BIT) - sz = 4; - else if (texUnit->TexGenEnabled & R_BIT) - sz = 3; - else if (texUnit->TexGenEnabled & T_BIT) - sz = 2; - else - sz = 1; - - store->TexgenSize[i] = sz; - store->TexgenFunc[i] = texgen; /* general solution */ - - /* look for special texgen cases */ - if (texUnit->TexGenEnabled == (S_BIT|T_BIT|R_BIT)) { - if (texUnit->_GenFlags == TEXGEN_REFLECTION_MAP_NV) { - store->TexgenFunc[i] = texgen_reflection_map_nv; - } - else if (texUnit->_GenFlags == TEXGEN_NORMAL_MAP_NV) { - store->TexgenFunc[i] = texgen_normal_map_nv; - } - } - else if (texUnit->TexGenEnabled == (S_BIT|T_BIT) && - texUnit->_GenFlags == TEXGEN_SPHERE_MAP) { - store->TexgenFunc[i] = texgen_sphere_map; - } - } - } -} - - - - - -/* Called the first time stage->run() is invoked. - */ -static GLboolean alloc_texgen_data( struct gl_context *ctx, - struct tnl_pipeline_stage *stage ) -{ - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - struct texgen_stage_data *store; - GLuint i; - - stage->privatePtr = CALLOC(sizeof(*store)); - store = TEXGEN_STAGE_DATA(stage); - if (!store) - return GL_FALSE; - - for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) - _mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 ); - - store->tmp_f = (GLfloat (*)[3]) MALLOC(VB->Size * sizeof(GLfloat) * 3); - store->tmp_m = (GLfloat *) MALLOC(VB->Size * sizeof(GLfloat)); - - return GL_TRUE; -} - - -static void free_texgen_data( struct tnl_pipeline_stage *stage ) - -{ - struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); - GLuint i; - - if (store) { - for (i = 0 ; i < MAX_TEXTURE_COORD_UNITS ; i++) - if (store->texcoord[i].data) - _mesa_vector4f_free( &store->texcoord[i] ); - - - if (store->tmp_f) FREE( store->tmp_f ); - if (store->tmp_m) FREE( store->tmp_m ); - FREE( store ); - stage->privatePtr = NULL; - } -} - - - -const struct tnl_pipeline_stage _tnl_texgen_stage = -{ - "texgen", /* name */ - NULL, /* private data */ - alloc_texgen_data, /* destructor */ - free_texgen_data, /* destructor */ - validate_texgen_stage, /* check */ - run_texgen_stage /* run -- initially set to alloc data */ -}; +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2006 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: + * Brian Paul + * Keith Whitwell + */ + +/* + * Regarding GL_NV_texgen_reflection: + * + * Portions of this software may use or implement intellectual + * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims + * any and all warranties with respect to such intellectual property, + * including any use thereof or modifications thereto. + */ + +#include "main/glheader.h" +#include "main/colormac.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + + +/*********************************************************************** + * Automatic texture coordinate generation (texgen) code. + */ + + +struct texgen_stage_data; + +typedef void (*texgen_func)( struct gl_context *ctx, + struct texgen_stage_data *store, + GLuint unit); + + +struct texgen_stage_data { + + /* Per-texunit derived state. + */ + GLuint TexgenSize[MAX_TEXTURE_COORD_UNITS]; + texgen_func TexgenFunc[MAX_TEXTURE_COORD_UNITS]; + + /* Temporary values used in texgen. + */ + GLfloat (*tmp_f)[3]; + GLfloat *tmp_m; + + /* Buffered outputs of the stage. + */ + GLvector4f texcoord[MAX_TEXTURE_COORD_UNITS]; +}; + + +#define TEXGEN_STAGE_DATA(stage) ((struct texgen_stage_data *)stage->privatePtr) + + + +static GLuint all_bits[5] = { + 0, + VEC_SIZE_1, + VEC_SIZE_2, + VEC_SIZE_3, + VEC_SIZE_4, +}; + +#define VEC_SIZE_FLAGS (VEC_SIZE_1|VEC_SIZE_2|VEC_SIZE_3|VEC_SIZE_4) + +#define TEXGEN_NEED_M (TEXGEN_SPHERE_MAP) +#define TEXGEN_NEED_F (TEXGEN_SPHERE_MAP | \ + TEXGEN_REFLECTION_MAP_NV) + + + +static void build_m3( GLfloat f[][3], GLfloat m[], + const GLvector4f *normal, + const GLvector4f *eye ) +{ + GLuint stride = eye->stride; + GLfloat *coord = (GLfloat *)eye->start; + GLuint count = eye->count; + const GLfloat *norm = normal->start; + GLuint i; + + for (i=0;istride)) { + GLfloat u[3], two_nu, fx, fy, fz; + COPY_3V( u, coord ); + NORMALIZE_3FV( u ); + two_nu = 2.0F * DOT3(norm,u); + fx = f[i][0] = u[0] - norm[0] * two_nu; + fy = f[i][1] = u[1] - norm[1] * two_nu; + fz = f[i][2] = u[2] - norm[2] * two_nu; + m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); + if (m[i] != 0.0F) { + m[i] = 0.5F * _mesa_inv_sqrtf(m[i]); + } + } +} + + + +static void build_m2( GLfloat f[][3], GLfloat m[], + const GLvector4f *normal, + const GLvector4f *eye ) +{ + GLuint stride = eye->stride; + GLfloat *coord = eye->start; + GLuint count = eye->count; + + GLfloat *norm = normal->start; + GLuint i; + + for (i=0;istride)) { + GLfloat u[3], two_nu, fx, fy, fz; + COPY_2V( u, coord ); + u[2] = 0; + NORMALIZE_3FV( u ); + two_nu = 2.0F * DOT3(norm,u); + fx = f[i][0] = u[0] - norm[0] * two_nu; + fy = f[i][1] = u[1] - norm[1] * two_nu; + fz = f[i][2] = u[2] - norm[2] * two_nu; + m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); + if (m[i] != 0.0F) { + m[i] = 0.5F * _mesa_inv_sqrtf(m[i]); + } + } +} + + + +typedef void (*build_m_func)( GLfloat f[][3], + GLfloat m[], + const GLvector4f *normal, + const GLvector4f *eye ); + + +static build_m_func build_m_tab[5] = { + NULL, + NULL, + build_m2, + build_m3, + build_m3 +}; + + +/* This is unusual in that we respect the stride of the output vector + * (f). This allows us to pass in either a texcoord vector4f, or a + * temporary vector3f. + */ +static void build_f3( GLfloat *f, + GLuint fstride, + const GLvector4f *normal, + const GLvector4f *eye ) +{ + GLuint stride = eye->stride; + GLfloat *coord = eye->start; + GLuint count = eye->count; + + GLfloat *norm = normal->start; + GLuint i; + + for (i=0;istride); + } +} + + +static void build_f2( GLfloat *f, + GLuint fstride, + const GLvector4f *normal, + const GLvector4f *eye ) +{ + GLuint stride = eye->stride; + GLfloat *coord = eye->start; + GLuint count = eye->count; + GLfloat *norm = normal->start; + GLuint i; + + for (i=0;istride); + } +} + +typedef void (*build_f_func)( GLfloat *f, + GLuint fstride, + const GLvector4f *normal_vec, + const GLvector4f *eye ); + + + +/* Just treat 4-vectors as 3-vectors. + */ +static build_f_func build_f_tab[5] = { + NULL, + NULL, + build_f2, + build_f3, + build_f3 +}; + + + +/* Special case texgen functions. + */ +static void texgen_reflection_map_nv( struct gl_context *ctx, + struct texgen_stage_data *store, + GLuint unit ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit]; + GLvector4f *out = &store->texcoord[unit]; + + build_f_tab[VB->EyePtr->size]( out->start, + out->stride, + VB->AttribPtr[_TNL_ATTRIB_NORMAL], + VB->EyePtr ); + + out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3; + out->count = VB->Count; + out->size = MAX2(in->size, 3); + if (in->size == 4) + _mesa_copy_tab[0x8]( out, in ); +} + + + +static void texgen_normal_map_nv( struct gl_context *ctx, + struct texgen_stage_data *store, + GLuint unit ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit]; + GLvector4f *out = &store->texcoord[unit]; + GLvector4f *normal = VB->AttribPtr[_TNL_ATTRIB_NORMAL]; + GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->start; + GLuint count = VB->Count; + GLuint i; + const GLfloat *norm = normal->start; + + for (i=0;istride)) { + texcoord[i][0] = norm[0]; + texcoord[i][1] = norm[1]; + texcoord[i][2] = norm[2]; + } + + + out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3; + out->count = count; + out->size = MAX2(in->size, 3); + if (in->size == 4) + _mesa_copy_tab[0x8]( out, in ); +} + + +static void texgen_sphere_map( struct gl_context *ctx, + struct texgen_stage_data *store, + GLuint unit ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit]; + GLvector4f *out = &store->texcoord[unit]; + GLfloat (*texcoord)[4] = (GLfloat (*)[4]) out->start; + GLuint count = VB->Count; + GLuint i; + GLfloat (*f)[3] = store->tmp_f; + GLfloat *m = store->tmp_m; + + (build_m_tab[VB->EyePtr->size])( store->tmp_f, + store->tmp_m, + VB->AttribPtr[_TNL_ATTRIB_NORMAL], + VB->EyePtr ); + + out->size = MAX2(in->size,2); + + for (i=0;icount = count; + out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_2; + if (in->size > 2) + _mesa_copy_tab[all_bits[in->size] & ~0x3]( out, in ); +} + + + +static void texgen( struct gl_context *ctx, + struct texgen_stage_data *store, + GLuint unit ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit]; + GLvector4f *out = &store->texcoord[unit]; + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + const GLvector4f *obj = VB->AttribPtr[_TNL_ATTRIB_POS]; + const GLvector4f *eye = VB->EyePtr; + const GLvector4f *normal = VB->AttribPtr[_TNL_ATTRIB_NORMAL]; + const GLfloat *m = store->tmp_m; + const GLuint count = VB->Count; + GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data; + GLfloat (*f)[3] = store->tmp_f; + GLuint copy; + + if (texUnit->_GenFlags & TEXGEN_NEED_M) { + build_m_tab[eye->size]( store->tmp_f, store->tmp_m, normal, eye ); + } else if (texUnit->_GenFlags & TEXGEN_NEED_F) { + build_f_tab[eye->size]( (GLfloat *)store->tmp_f, 3, normal, eye ); + } + + + out->size = MAX2(in->size, store->TexgenSize[unit]); + out->flags |= (in->flags & VEC_SIZE_FLAGS) | texUnit->TexGenEnabled; + out->count = count; + + copy = (all_bits[in->size] & ~texUnit->TexGenEnabled); + if (copy) + _mesa_copy_tab[copy]( out, in ); + + if (texUnit->TexGenEnabled & S_BIT) { + GLuint i; + switch (texUnit->GenS.Mode) { + case GL_OBJECT_LINEAR: + _mesa_dotprod_tab[obj->size]( (GLfloat *)out->data, + sizeof(out->data[0]), obj, + texUnit->GenS.ObjectPlane ); + break; + case GL_EYE_LINEAR: + _mesa_dotprod_tab[eye->size]( (GLfloat *)out->data, + sizeof(out->data[0]), eye, + texUnit->GenS.EyePlane ); + break; + case GL_SPHERE_MAP: + for (i = 0; i < count; i++) + texcoord[i][0] = f[i][0] * m[i] + 0.5F; + break; + case GL_REFLECTION_MAP_NV: + for (i=0;istart; + for (i=0;istride)) { + texcoord[i][0] = norm[0]; + } + break; + } + default: + _mesa_problem(ctx, "Bad S texgen"); + } + } + + if (texUnit->TexGenEnabled & T_BIT) { + GLuint i; + switch (texUnit->GenT.Mode) { + case GL_OBJECT_LINEAR: + _mesa_dotprod_tab[obj->size]( &(out->data[0][1]), + sizeof(out->data[0]), obj, + texUnit->GenT.ObjectPlane ); + break; + case GL_EYE_LINEAR: + _mesa_dotprod_tab[eye->size]( &(out->data[0][1]), + sizeof(out->data[0]), eye, + texUnit->GenT.EyePlane ); + break; + case GL_SPHERE_MAP: + for (i = 0; i < count; i++) + texcoord[i][1] = f[i][1] * m[i] + 0.5F; + break; + case GL_REFLECTION_MAP_NV: + for (i=0;istart; + for (i=0;istride)) { + texcoord[i][1] = norm[1]; + } + break; + } + default: + _mesa_problem(ctx, "Bad T texgen"); + } + } + + if (texUnit->TexGenEnabled & R_BIT) { + GLuint i; + switch (texUnit->GenR.Mode) { + case GL_OBJECT_LINEAR: + _mesa_dotprod_tab[obj->size]( &(out->data[0][2]), + sizeof(out->data[0]), obj, + texUnit->GenR.ObjectPlane ); + break; + case GL_EYE_LINEAR: + _mesa_dotprod_tab[eye->size]( &(out->data[0][2]), + sizeof(out->data[0]), eye, + texUnit->GenR.EyePlane ); + break; + case GL_REFLECTION_MAP_NV: + for (i=0;istart; + for (i=0;istride)) { + texcoord[i][2] = norm[2]; + } + break; + } + default: + _mesa_problem(ctx, "Bad R texgen"); + } + } + + if (texUnit->TexGenEnabled & Q_BIT) { + switch (texUnit->GenQ.Mode) { + case GL_OBJECT_LINEAR: + _mesa_dotprod_tab[obj->size]( &(out->data[0][3]), + sizeof(out->data[0]), obj, + texUnit->GenQ.ObjectPlane ); + break; + case GL_EYE_LINEAR: + _mesa_dotprod_tab[eye->size]( &(out->data[0][3]), + sizeof(out->data[0]), eye, + texUnit->GenQ.EyePlane ); + break; + default: + _mesa_problem(ctx, "Bad Q texgen"); + } + } +} + + + + +static GLboolean run_texgen_stage( struct gl_context *ctx, + struct tnl_pipeline_stage *stage ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); + GLuint i; + + if (!ctx->Texture._TexGenEnabled || ctx->VertexProgram._Current) + return GL_TRUE; + + for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) { + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; + + if (texUnit->TexGenEnabled) { + + store->TexgenFunc[i]( ctx, store, i ); + + VB->AttribPtr[VERT_ATTRIB_TEX0 + i] = &store->texcoord[i]; + } + } + + return GL_TRUE; +} + + +static void validate_texgen_stage( struct gl_context *ctx, + struct tnl_pipeline_stage *stage ) +{ + struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); + GLuint i; + + if (!ctx->Texture._TexGenEnabled || ctx->VertexProgram._Current) + return; + + for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) { + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; + + if (texUnit->TexGenEnabled) { + GLuint sz; + + if (texUnit->TexGenEnabled & Q_BIT) + sz = 4; + else if (texUnit->TexGenEnabled & R_BIT) + sz = 3; + else if (texUnit->TexGenEnabled & T_BIT) + sz = 2; + else + sz = 1; + + store->TexgenSize[i] = sz; + store->TexgenFunc[i] = texgen; /* general solution */ + + /* look for special texgen cases */ + if (texUnit->TexGenEnabled == (S_BIT|T_BIT|R_BIT)) { + if (texUnit->_GenFlags == TEXGEN_REFLECTION_MAP_NV) { + store->TexgenFunc[i] = texgen_reflection_map_nv; + } + else if (texUnit->_GenFlags == TEXGEN_NORMAL_MAP_NV) { + store->TexgenFunc[i] = texgen_normal_map_nv; + } + } + else if (texUnit->TexGenEnabled == (S_BIT|T_BIT) && + texUnit->_GenFlags == TEXGEN_SPHERE_MAP) { + store->TexgenFunc[i] = texgen_sphere_map; + } + } + } +} + + + + + +/* Called the first time stage->run() is invoked. + */ +static GLboolean alloc_texgen_data( struct gl_context *ctx, + struct tnl_pipeline_stage *stage ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct texgen_stage_data *store; + GLuint i; + + stage->privatePtr = CALLOC(sizeof(*store)); + store = TEXGEN_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) + _mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 ); + + store->tmp_f = (GLfloat (*)[3]) MALLOC(VB->Size * sizeof(GLfloat) * 3); + store->tmp_m = (GLfloat *) MALLOC(VB->Size * sizeof(GLfloat)); + + return GL_TRUE; +} + + +static void free_texgen_data( struct tnl_pipeline_stage *stage ) + +{ + struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); + GLuint i; + + if (store) { + for (i = 0 ; i < MAX_TEXTURE_COORD_UNITS ; i++) + if (store->texcoord[i].data) + _mesa_vector4f_free( &store->texcoord[i] ); + + + if (store->tmp_f) FREE( store->tmp_f ); + if (store->tmp_m) FREE( store->tmp_m ); + FREE( store ); + stage->privatePtr = NULL; + } +} + + + +const struct tnl_pipeline_stage _tnl_texgen_stage = +{ + "texgen", /* name */ + NULL, /* private data */ + alloc_texgen_data, /* destructor */ + free_texgen_data, /* destructor */ + validate_texgen_stage, /* check */ + run_texgen_stage /* run -- initially set to alloc data */ +}; diff --git a/mesalib/src/mesa/tnl/t_vb_texmat.c b/mesalib/src/mesa/tnl/t_vb_texmat.c index 7b30946c8..38aa51fc4 100644 --- a/mesalib/src/mesa/tnl/t_vb_texmat.c +++ b/mesalib/src/mesa/tnl/t_vb_texmat.c @@ -1,128 +1,128 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2006 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 - */ - - -#include "main/glheader.h" -#include "main/colormac.h" -#include "main/macros.h" -#include "main/imports.h" -#include "main/mtypes.h" - -#include "math/m_xform.h" - -#include "t_context.h" -#include "t_pipeline.h" - -/* Is there any real benefit seperating texmat from texgen? It means - * we need two lots of intermediate storage. Any changes to - * _NEW_TEXTURE will invalidate both sets -- it's only on changes to - * *only* _NEW_TEXTURE_MATRIX that texgen survives but texmat doesn't. - * - * However, the seperation of this code from the complex texgen stuff - * is very appealing. - */ -struct texmat_stage_data { - GLvector4f texcoord[MAX_TEXTURE_COORD_UNITS]; -}; - -#define TEXMAT_STAGE_DATA(stage) ((struct texmat_stage_data *)stage->privatePtr) - - - -static GLboolean run_texmat_stage( struct gl_context *ctx, - struct tnl_pipeline_stage *stage ) -{ - struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - GLuint i; - - if (!ctx->Texture._TexMatEnabled || ctx->VertexProgram._Current) - return GL_TRUE; - - /* ENABLE_TEXMAT implies that the texture matrix is not the - * identity, so we don't have to check that here. - */ - for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) { - if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) { - (void) TransformRaw( &store->texcoord[i], - ctx->TextureMatrixStack[i].Top, - VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]); - - VB->AttribPtr[VERT_ATTRIB_TEX0+i] = &store->texcoord[i]; - } - } - - return GL_TRUE; -} - - -/* Called the first time stage->run() is invoked. - */ -static GLboolean alloc_texmat_data( struct gl_context *ctx, - struct tnl_pipeline_stage *stage ) -{ - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - struct texmat_stage_data *store; - GLuint i; - - stage->privatePtr = CALLOC(sizeof(*store)); - store = TEXMAT_STAGE_DATA(stage); - if (!store) - return GL_FALSE; - - for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) - _mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 ); - - return GL_TRUE; -} - - -static void free_texmat_data( struct tnl_pipeline_stage *stage ) -{ - struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); - GLuint i; - - if (store) { - for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) - if (store->texcoord[i].data) - _mesa_vector4f_free( &store->texcoord[i] ); - FREE( store ); - stage->privatePtr = NULL; - } -} - - - -const struct tnl_pipeline_stage _tnl_texture_transform_stage = -{ - "texture transform", /* name */ - NULL, /* private data */ - alloc_texmat_data, - free_texmat_data, /* destructor */ - NULL, - run_texmat_stage, -}; +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2006 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 + */ + + +#include "main/glheader.h" +#include "main/colormac.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + +/* Is there any real benefit seperating texmat from texgen? It means + * we need two lots of intermediate storage. Any changes to + * _NEW_TEXTURE will invalidate both sets -- it's only on changes to + * *only* _NEW_TEXTURE_MATRIX that texgen survives but texmat doesn't. + * + * However, the seperation of this code from the complex texgen stuff + * is very appealing. + */ +struct texmat_stage_data { + GLvector4f texcoord[MAX_TEXTURE_COORD_UNITS]; +}; + +#define TEXMAT_STAGE_DATA(stage) ((struct texmat_stage_data *)stage->privatePtr) + + + +static GLboolean run_texmat_stage( struct gl_context *ctx, + struct tnl_pipeline_stage *stage ) +{ + struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLuint i; + + if (!ctx->Texture._TexMatEnabled || ctx->VertexProgram._Current) + return GL_TRUE; + + /* ENABLE_TEXMAT implies that the texture matrix is not the + * identity, so we don't have to check that here. + */ + for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) { + if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) { + (void) TransformRaw( &store->texcoord[i], + ctx->TextureMatrixStack[i].Top, + VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]); + + VB->AttribPtr[VERT_ATTRIB_TEX0+i] = &store->texcoord[i]; + } + } + + return GL_TRUE; +} + + +/* Called the first time stage->run() is invoked. + */ +static GLboolean alloc_texmat_data( struct gl_context *ctx, + struct tnl_pipeline_stage *stage ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct texmat_stage_data *store; + GLuint i; + + stage->privatePtr = CALLOC(sizeof(*store)); + store = TEXMAT_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) + _mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 ); + + return GL_TRUE; +} + + +static void free_texmat_data( struct tnl_pipeline_stage *stage ) +{ + struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); + GLuint i; + + if (store) { + for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) + if (store->texcoord[i].data) + _mesa_vector4f_free( &store->texcoord[i] ); + FREE( store ); + stage->privatePtr = NULL; + } +} + + + +const struct tnl_pipeline_stage _tnl_texture_transform_stage = +{ + "texture transform", /* name */ + NULL, /* private data */ + alloc_texmat_data, + free_texmat_data, /* destructor */ + NULL, + run_texmat_stage, +}; diff --git a/mesalib/src/mesa/tnl/t_vb_vertex.c b/mesalib/src/mesa/tnl/t_vb_vertex.c index a77959410..26e8ae065 100644 --- a/mesalib/src/mesa/tnl/t_vb_vertex.c +++ b/mesalib/src/mesa/tnl/t_vb_vertex.c @@ -1,283 +1,283 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2006 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 - */ - - -#include "main/glheader.h" -#include "main/colormac.h" -#include "main/macros.h" -#include "main/imports.h" -#include "main/mtypes.h" - -#include "math/m_xform.h" - -#include "t_context.h" -#include "t_pipeline.h" - - - -struct vertex_stage_data { - GLvector4f eye; - GLvector4f clip; - GLvector4f proj; - GLubyte *clipmask; - GLubyte ormask; - GLubyte andmask; -}; - -#define VERTEX_STAGE_DATA(stage) ((struct vertex_stage_data *)stage->privatePtr) - - - - -/* This function implements cliptesting for user-defined clip planes. - * The clipping of primitives to these planes is implemented in - * t_render_clip.h. - */ -#define USER_CLIPTEST(NAME, SZ) \ -static void NAME( struct gl_context *ctx, \ - GLvector4f *clip, \ - GLubyte *clipmask, \ - GLubyte *clipormask, \ - GLubyte *clipandmask ) \ -{ \ - GLuint p; \ - \ - for (p = 0; p < ctx->Const.MaxClipPlanes; p++) \ - if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { \ - GLuint nr, i; \ - const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; \ - const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; \ - const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; \ - const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; \ - GLfloat *coord = (GLfloat *)clip->data; \ - GLuint stride = clip->stride; \ - GLuint count = clip->count; \ - \ - for (nr = 0, i = 0 ; i < count ; i++) { \ - GLfloat dp = coord[0] * a + coord[1] * b; \ - if (SZ > 2) dp += coord[2] * c; \ - if (SZ > 3) dp += coord[3] * d; else dp += d; \ - \ - if (dp < 0) { \ - nr++; \ - clipmask[i] |= CLIP_USER_BIT; \ - } \ - \ - STRIDE_F(coord, stride); \ - } \ - \ - if (nr > 0) { \ - *clipormask |= CLIP_USER_BIT; \ - if (nr == count) { \ - *clipandmask |= CLIP_USER_BIT; \ - return; \ - } \ - } \ - } \ -} - - -USER_CLIPTEST(userclip2, 2) -USER_CLIPTEST(userclip3, 3) -USER_CLIPTEST(userclip4, 4) - -static void (*(usercliptab[5]))( struct gl_context *, - GLvector4f *, GLubyte *, - GLubyte *, GLubyte * ) = -{ - NULL, - NULL, - userclip2, - userclip3, - userclip4 -}; - - -void -tnl_clip_prepare(struct gl_context *ctx) -{ - /* Neither the x86 nor sparc asm cliptest functions have been updated - * for ARB_depth_clamp, so force the C paths. - */ - if (ctx->Transform.DepthClamp) { - static GLboolean c_funcs_installed = GL_FALSE; - if (!c_funcs_installed) { - init_c_cliptest(); - c_funcs_installed = GL_TRUE; - } - } -} - - - -static GLboolean run_vertex_stage( struct gl_context *ctx, - struct tnl_pipeline_stage *stage ) -{ - struct vertex_stage_data *store = (struct vertex_stage_data *)stage->privatePtr; - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - - if (ctx->VertexProgram._Current) - return GL_TRUE; - - tnl_clip_prepare(ctx); - - if (ctx->_NeedEyeCoords) { - /* Separate modelview transformation: - * Use combined ModelProject to avoid some depth artifacts - */ - if (ctx->ModelviewMatrixStack.Top->type == MATRIX_IDENTITY) - VB->EyePtr = VB->AttribPtr[_TNL_ATTRIB_POS]; - else - VB->EyePtr = TransformRaw( &store->eye, - ctx->ModelviewMatrixStack.Top, - VB->AttribPtr[_TNL_ATTRIB_POS]); - } - - VB->ClipPtr = TransformRaw( &store->clip, - &ctx->_ModelProjectMatrix, - VB->AttribPtr[_TNL_ATTRIB_POS] ); - - /* Drivers expect this to be clean to element 4... - */ - switch (VB->ClipPtr->size) { - case 1: - /* impossible */ - case 2: - _mesa_vector4f_clean_elem( VB->ClipPtr, VB->Count, 2 ); - /* fall-through */ - case 3: - _mesa_vector4f_clean_elem( VB->ClipPtr, VB->Count, 3 ); - /* fall-through */ - case 4: - break; - } - - - /* Cliptest and perspective divide. Clip functions must clear - * the clipmask. - */ - store->ormask = 0; - store->andmask = CLIP_FRUSTUM_BITS; - - if (tnl->NeedNdcCoords) { - VB->NdcPtr = - _mesa_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, - &store->proj, - store->clipmask, - &store->ormask, - &store->andmask, - !ctx->Transform.DepthClamp ); - } - else { - VB->NdcPtr = NULL; - _mesa_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr, - NULL, - store->clipmask, - &store->ormask, - &store->andmask, - !ctx->Transform.DepthClamp ); - } - - if (store->andmask) - return GL_FALSE; - - - /* Test userclip planes. This contributes to VB->ClipMask, so - * is essentially required to be in this stage. - */ - if (ctx->Transform.ClipPlanesEnabled) { - usercliptab[VB->ClipPtr->size]( ctx, - VB->ClipPtr, - store->clipmask, - &store->ormask, - &store->andmask ); - - if (store->andmask) - return GL_FALSE; - } - - VB->ClipAndMask = store->andmask; - VB->ClipOrMask = store->ormask; - VB->ClipMask = store->clipmask; - - return GL_TRUE; -} - - -static GLboolean init_vertex_stage( struct gl_context *ctx, - struct tnl_pipeline_stage *stage ) -{ - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - struct vertex_stage_data *store; - GLuint size = VB->Size; - - stage->privatePtr = CALLOC(sizeof(*store)); - store = VERTEX_STAGE_DATA(stage); - if (!store) - return GL_FALSE; - - _mesa_vector4f_alloc( &store->eye, 0, size, 32 ); - _mesa_vector4f_alloc( &store->clip, 0, size, 32 ); - _mesa_vector4f_alloc( &store->proj, 0, size, 32 ); - - store->clipmask = (GLubyte *) _mesa_align_malloc(sizeof(GLubyte)*size, 32 ); - - if (!store->clipmask || - !store->eye.data || - !store->clip.data || - !store->proj.data) - return GL_FALSE; - - return GL_TRUE; -} - -static void dtr( struct tnl_pipeline_stage *stage ) -{ - struct vertex_stage_data *store = VERTEX_STAGE_DATA(stage); - - if (store) { - _mesa_vector4f_free( &store->eye ); - _mesa_vector4f_free( &store->clip ); - _mesa_vector4f_free( &store->proj ); - _mesa_align_free( store->clipmask ); - FREE(store); - stage->privatePtr = NULL; - stage->run = init_vertex_stage; - } -} - - -const struct tnl_pipeline_stage _tnl_vertex_transform_stage = -{ - "modelview/project/cliptest/divide", - NULL, /* private data */ - init_vertex_stage, - dtr, /* destructor */ - NULL, - run_vertex_stage /* run -- initially set to init */ -}; +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2006 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 + */ + + +#include "main/glheader.h" +#include "main/colormac.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + + + +struct vertex_stage_data { + GLvector4f eye; + GLvector4f clip; + GLvector4f proj; + GLubyte *clipmask; + GLubyte ormask; + GLubyte andmask; +}; + +#define VERTEX_STAGE_DATA(stage) ((struct vertex_stage_data *)stage->privatePtr) + + + + +/* This function implements cliptesting for user-defined clip planes. + * The clipping of primitives to these planes is implemented in + * t_render_clip.h. + */ +#define USER_CLIPTEST(NAME, SZ) \ +static void NAME( struct gl_context *ctx, \ + GLvector4f *clip, \ + GLubyte *clipmask, \ + GLubyte *clipormask, \ + GLubyte *clipandmask ) \ +{ \ + GLuint p; \ + \ + for (p = 0; p < ctx->Const.MaxClipPlanes; p++) \ + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { \ + GLuint nr, i; \ + const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; \ + const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; \ + const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; \ + const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; \ + GLfloat *coord = (GLfloat *)clip->data; \ + GLuint stride = clip->stride; \ + GLuint count = clip->count; \ + \ + for (nr = 0, i = 0 ; i < count ; i++) { \ + GLfloat dp = coord[0] * a + coord[1] * b; \ + if (SZ > 2) dp += coord[2] * c; \ + if (SZ > 3) dp += coord[3] * d; else dp += d; \ + \ + if (dp < 0) { \ + nr++; \ + clipmask[i] |= CLIP_USER_BIT; \ + } \ + \ + STRIDE_F(coord, stride); \ + } \ + \ + if (nr > 0) { \ + *clipormask |= CLIP_USER_BIT; \ + if (nr == count) { \ + *clipandmask |= CLIP_USER_BIT; \ + return; \ + } \ + } \ + } \ +} + + +USER_CLIPTEST(userclip2, 2) +USER_CLIPTEST(userclip3, 3) +USER_CLIPTEST(userclip4, 4) + +static void (*(usercliptab[5]))( struct gl_context *, + GLvector4f *, GLubyte *, + GLubyte *, GLubyte * ) = +{ + NULL, + NULL, + userclip2, + userclip3, + userclip4 +}; + + +void +tnl_clip_prepare(struct gl_context *ctx) +{ + /* Neither the x86 nor sparc asm cliptest functions have been updated + * for ARB_depth_clamp, so force the C paths. + */ + if (ctx->Transform.DepthClamp) { + static GLboolean c_funcs_installed = GL_FALSE; + if (!c_funcs_installed) { + init_c_cliptest(); + c_funcs_installed = GL_TRUE; + } + } +} + + + +static GLboolean run_vertex_stage( struct gl_context *ctx, + struct tnl_pipeline_stage *stage ) +{ + struct vertex_stage_data *store = (struct vertex_stage_data *)stage->privatePtr; + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + + if (ctx->VertexProgram._Current) + return GL_TRUE; + + tnl_clip_prepare(ctx); + + if (ctx->_NeedEyeCoords) { + /* Separate modelview transformation: + * Use combined ModelProject to avoid some depth artifacts + */ + if (ctx->ModelviewMatrixStack.Top->type == MATRIX_IDENTITY) + VB->EyePtr = VB->AttribPtr[_TNL_ATTRIB_POS]; + else + VB->EyePtr = TransformRaw( &store->eye, + ctx->ModelviewMatrixStack.Top, + VB->AttribPtr[_TNL_ATTRIB_POS]); + } + + VB->ClipPtr = TransformRaw( &store->clip, + &ctx->_ModelProjectMatrix, + VB->AttribPtr[_TNL_ATTRIB_POS] ); + + /* Drivers expect this to be clean to element 4... + */ + switch (VB->ClipPtr->size) { + case 1: + /* impossible */ + case 2: + _mesa_vector4f_clean_elem( VB->ClipPtr, VB->Count, 2 ); + /* fall-through */ + case 3: + _mesa_vector4f_clean_elem( VB->ClipPtr, VB->Count, 3 ); + /* fall-through */ + case 4: + break; + } + + + /* Cliptest and perspective divide. Clip functions must clear + * the clipmask. + */ + store->ormask = 0; + store->andmask = CLIP_FRUSTUM_BITS; + + if (tnl->NeedNdcCoords) { + VB->NdcPtr = + _mesa_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, + &store->proj, + store->clipmask, + &store->ormask, + &store->andmask, + !ctx->Transform.DepthClamp ); + } + else { + VB->NdcPtr = NULL; + _mesa_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr, + NULL, + store->clipmask, + &store->ormask, + &store->andmask, + !ctx->Transform.DepthClamp ); + } + + if (store->andmask) + return GL_FALSE; + + + /* Test userclip planes. This contributes to VB->ClipMask, so + * is essentially required to be in this stage. + */ + if (ctx->Transform.ClipPlanesEnabled) { + usercliptab[VB->ClipPtr->size]( ctx, + VB->ClipPtr, + store->clipmask, + &store->ormask, + &store->andmask ); + + if (store->andmask) + return GL_FALSE; + } + + VB->ClipAndMask = store->andmask; + VB->ClipOrMask = store->ormask; + VB->ClipMask = store->clipmask; + + return GL_TRUE; +} + + +static GLboolean init_vertex_stage( struct gl_context *ctx, + struct tnl_pipeline_stage *stage ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct vertex_stage_data *store; + GLuint size = VB->Size; + + stage->privatePtr = CALLOC(sizeof(*store)); + store = VERTEX_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + _mesa_vector4f_alloc( &store->eye, 0, size, 32 ); + _mesa_vector4f_alloc( &store->clip, 0, size, 32 ); + _mesa_vector4f_alloc( &store->proj, 0, size, 32 ); + + store->clipmask = (GLubyte *) _mesa_align_malloc(sizeof(GLubyte)*size, 32 ); + + if (!store->clipmask || + !store->eye.data || + !store->clip.data || + !store->proj.data) + return GL_FALSE; + + return GL_TRUE; +} + +static void dtr( struct tnl_pipeline_stage *stage ) +{ + struct vertex_stage_data *store = VERTEX_STAGE_DATA(stage); + + if (store) { + _mesa_vector4f_free( &store->eye ); + _mesa_vector4f_free( &store->clip ); + _mesa_vector4f_free( &store->proj ); + _mesa_align_free( store->clipmask ); + FREE(store); + stage->privatePtr = NULL; + stage->run = init_vertex_stage; + } +} + + +const struct tnl_pipeline_stage _tnl_vertex_transform_stage = +{ + "modelview/project/cliptest/divide", + NULL, /* private data */ + init_vertex_stage, + dtr, /* destructor */ + NULL, + run_vertex_stage /* run -- initially set to init */ +}; diff --git a/mesalib/src/mesa/tnl/t_vertex.h b/mesalib/src/mesa/tnl/t_vertex.h index bdbc88aff..83b0dbceb 100644 --- a/mesalib/src/mesa/tnl/t_vertex.h +++ b/mesalib/src/mesa/tnl/t_vertex.h @@ -1,184 +1,184 @@ -/* - * Copyright 2003 Tungsten 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 - * 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 - * 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 - */ - -#ifndef _TNL_VERTEX_H -#define _TNL_VERTEX_H - -#include "main/glheader.h" -#include "t_context.h" - -struct gl_context; -struct tnl_clipspace; - -/* New mechanism to specify hardware vertices so that tnl can build - * and manipulate them directly. - */ - - -/* It will probably be necessary to allow drivers to specify new - * emit-styles to cover all the wierd and wacky things out there. - */ -enum tnl_attr_format { - EMIT_1F, - EMIT_2F, - EMIT_3F, - EMIT_4F, - EMIT_2F_VIEWPORT, /* do viewport transform and emit */ - EMIT_3F_VIEWPORT, /* do viewport transform and emit */ - EMIT_4F_VIEWPORT, /* do viewport transform and emit */ - EMIT_3F_XYW, /* for projective texture */ - EMIT_1UB_1F, /* for fog coordinate */ - EMIT_3UB_3F_RGB, /* for specular color */ - EMIT_3UB_3F_BGR, /* for specular color */ - EMIT_4UB_4F_RGBA, /* for color */ - EMIT_4UB_4F_BGRA, /* for color */ - EMIT_4UB_4F_ARGB, /* for color */ - EMIT_4UB_4F_ABGR, /* for color */ - EMIT_4CHAN_4F_RGBA, /* for swrast color */ - EMIT_PAD, /* leave a hole of 'offset' bytes */ - EMIT_MAX -}; - -struct tnl_attr_map { - GLuint attrib; /* _TNL_ATTRIB_ enum */ - enum tnl_attr_format format; - GLuint offset; -}; - -struct tnl_format_info { - const char *name; - tnl_extract_func extract; - tnl_insert_func insert[4]; - const GLuint attrsize; -}; - -extern const struct tnl_format_info _tnl_format_info[EMIT_MAX]; - - -/* Interpolate between two vertices to produce a third: - */ -extern void _tnl_interp( struct gl_context *ctx, - GLfloat t, - GLuint edst, GLuint eout, GLuint ein, - GLboolean force_boundary ); - -/* Copy colors from one vertex to another: - */ -extern void _tnl_copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc ); - - -/* Extract a named attribute from a hardware vertex. Will have to - * reverse any viewport transformation, swizzling or other conversions - * which may have been applied: - */ -extern void _tnl_get_attr( struct gl_context *ctx, const void *vertex, GLenum attrib, - GLfloat *dest ); - -/* Complementary to the above. - */ -extern void _tnl_set_attr( struct gl_context *ctx, void *vout, GLenum attrib, - const GLfloat *src ); - - -extern void *_tnl_get_vertex( struct gl_context *ctx, GLuint nr ); - -extern GLuint _tnl_install_attrs( struct gl_context *ctx, - const struct tnl_attr_map *map, - GLuint nr, const GLfloat *vp, - GLuint unpacked_size ); - -extern void _tnl_free_vertices( struct gl_context *ctx ); - -extern void _tnl_init_vertices( struct gl_context *ctx, - GLuint vb_size, - GLuint max_vertex_size ); - -extern void *_tnl_emit_vertices_to_buffer( struct gl_context *ctx, - GLuint start, - GLuint end, - void *dest ); - -/* This function isn't optimal. Check out - * gallium/auxilary/translate for a more comprehensive implementation of - * the same functionality. - */ - -extern void *_tnl_emit_indexed_vertices_to_buffer( struct gl_context *ctx, - const GLuint *elts, - GLuint start, - GLuint end, - void *dest ); - - -extern void _tnl_build_vertices( struct gl_context *ctx, - GLuint start, - GLuint end, - GLuint newinputs ); - -extern void _tnl_invalidate_vertices( struct gl_context *ctx, GLuint newinputs ); - -extern void _tnl_invalidate_vertex_state( struct gl_context *ctx, GLuint new_state ); - -extern void _tnl_notify_pipeline_output_change( struct gl_context *ctx ); - - -#define GET_VERTEX_STATE(ctx) &(TNL_CONTEXT(ctx)->clipspace) - -/* Internal function: - */ -void _tnl_register_fastpath( struct tnl_clipspace *vtx, - GLboolean match_strides ); - - -/* t_vertex_generic.c -- Internal functions for t_vertex.c - */ -void _tnl_generic_copy_pv_extras( struct gl_context *ctx, - GLuint dst, GLuint src ); - -void _tnl_generic_interp_extras( struct gl_context *ctx, - GLfloat t, - GLuint dst, GLuint out, GLuint in, - GLboolean force_boundary ); - -void _tnl_generic_copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc ); - -void _tnl_generic_interp( struct gl_context *ctx, - GLfloat t, - GLuint edst, GLuint eout, GLuint ein, - GLboolean force_boundary ); - -void _tnl_generic_emit( struct gl_context *ctx, - GLuint count, - GLubyte *v ); - -void _tnl_generate_hardwired_emit( struct gl_context *ctx ); - -/* t_vertex_sse.c -- Internal functions for t_vertex.c - */ -void _tnl_generate_sse_emit( struct gl_context *ctx ); - -#endif +/* + * Copyright 2003 Tungsten 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 + * 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 + * 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 + */ + +#ifndef _TNL_VERTEX_H +#define _TNL_VERTEX_H + +#include "main/glheader.h" +#include "t_context.h" + +struct gl_context; +struct tnl_clipspace; + +/* New mechanism to specify hardware vertices so that tnl can build + * and manipulate them directly. + */ + + +/* It will probably be necessary to allow drivers to specify new + * emit-styles to cover all the wierd and wacky things out there. + */ +enum tnl_attr_format { + EMIT_1F, + EMIT_2F, + EMIT_3F, + EMIT_4F, + EMIT_2F_VIEWPORT, /* do viewport transform and emit */ + EMIT_3F_VIEWPORT, /* do viewport transform and emit */ + EMIT_4F_VIEWPORT, /* do viewport transform and emit */ + EMIT_3F_XYW, /* for projective texture */ + EMIT_1UB_1F, /* for fog coordinate */ + EMIT_3UB_3F_RGB, /* for specular color */ + EMIT_3UB_3F_BGR, /* for specular color */ + EMIT_4UB_4F_RGBA, /* for color */ + EMIT_4UB_4F_BGRA, /* for color */ + EMIT_4UB_4F_ARGB, /* for color */ + EMIT_4UB_4F_ABGR, /* for color */ + EMIT_4CHAN_4F_RGBA, /* for swrast color */ + EMIT_PAD, /* leave a hole of 'offset' bytes */ + EMIT_MAX +}; + +struct tnl_attr_map { + GLuint attrib; /* _TNL_ATTRIB_ enum */ + enum tnl_attr_format format; + GLuint offset; +}; + +struct tnl_format_info { + const char *name; + tnl_extract_func extract; + tnl_insert_func insert[4]; + const GLuint attrsize; +}; + +extern const struct tnl_format_info _tnl_format_info[EMIT_MAX]; + + +/* Interpolate between two vertices to produce a third: + */ +extern void _tnl_interp( struct gl_context *ctx, + GLfloat t, + GLuint edst, GLuint eout, GLuint ein, + GLboolean force_boundary ); + +/* Copy colors from one vertex to another: + */ +extern void _tnl_copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc ); + + +/* Extract a named attribute from a hardware vertex. Will have to + * reverse any viewport transformation, swizzling or other conversions + * which may have been applied: + */ +extern void _tnl_get_attr( struct gl_context *ctx, const void *vertex, GLenum attrib, + GLfloat *dest ); + +/* Complementary to the above. + */ +extern void _tnl_set_attr( struct gl_context *ctx, void *vout, GLenum attrib, + const GLfloat *src ); + + +extern void *_tnl_get_vertex( struct gl_context *ctx, GLuint nr ); + +extern GLuint _tnl_install_attrs( struct gl_context *ctx, + const struct tnl_attr_map *map, + GLuint nr, const GLfloat *vp, + GLuint unpacked_size ); + +extern void _tnl_free_vertices( struct gl_context *ctx ); + +extern void _tnl_init_vertices( struct gl_context *ctx, + GLuint vb_size, + GLuint max_vertex_size ); + +extern void *_tnl_emit_vertices_to_buffer( struct gl_context *ctx, + GLuint start, + GLuint end, + void *dest ); + +/* This function isn't optimal. Check out + * gallium/auxilary/translate for a more comprehensive implementation of + * the same functionality. + */ + +extern void *_tnl_emit_indexed_vertices_to_buffer( struct gl_context *ctx, + const GLuint *elts, + GLuint start, + GLuint end, + void *dest ); + + +extern void _tnl_build_vertices( struct gl_context *ctx, + GLuint start, + GLuint end, + GLuint newinputs ); + +extern void _tnl_invalidate_vertices( struct gl_context *ctx, GLuint newinputs ); + +extern void _tnl_invalidate_vertex_state( struct gl_context *ctx, GLuint new_state ); + +extern void _tnl_notify_pipeline_output_change( struct gl_context *ctx ); + + +#define GET_VERTEX_STATE(ctx) &(TNL_CONTEXT(ctx)->clipspace) + +/* Internal function: + */ +void _tnl_register_fastpath( struct tnl_clipspace *vtx, + GLboolean match_strides ); + + +/* t_vertex_generic.c -- Internal functions for t_vertex.c + */ +void _tnl_generic_copy_pv_extras( struct gl_context *ctx, + GLuint dst, GLuint src ); + +void _tnl_generic_interp_extras( struct gl_context *ctx, + GLfloat t, + GLuint dst, GLuint out, GLuint in, + GLboolean force_boundary ); + +void _tnl_generic_copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc ); + +void _tnl_generic_interp( struct gl_context *ctx, + GLfloat t, + GLuint edst, GLuint eout, GLuint ein, + GLboolean force_boundary ); + +void _tnl_generic_emit( struct gl_context *ctx, + GLuint count, + GLubyte *v ); + +void _tnl_generate_hardwired_emit( struct gl_context *ctx ); + +/* t_vertex_sse.c -- Internal functions for t_vertex.c + */ +void _tnl_generate_sse_emit( struct gl_context *ctx ); + +#endif diff --git a/mesalib/src/mesa/tnl/t_vp_build.c b/mesalib/src/mesa/tnl/t_vp_build.c index 913cba676..70492a435 100644 --- a/mesalib/src/mesa/tnl/t_vp_build.c +++ b/mesalib/src/mesa/tnl/t_vp_build.c @@ -1,60 +1,60 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 2007 Tungsten Graphics All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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 - * TUNGSTEN GRAPHICS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN - * AN ACTION 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_vp_build.c - * Create a vertex program to execute the current fixed function T&L pipeline. - * \author Keith Whitwell - */ - - -#include "main/glheader.h" -#include "main/ffvertex_prog.h" -#include "main/mtypes.h" -#include "t_vp_build.h" - - -/** - * XXX This should go away someday, but still referenced by some drivers... - */ -void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx ) -{ - const struct gl_vertex_program *prev = ctx->VertexProgram._Current; - - if (!ctx->VertexProgram._Current || - ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) { - ctx->VertexProgram._Current - = ctx->VertexProgram._TnlProgram - = _mesa_get_fixed_func_vertex_program(ctx); - } - - /* Tell the driver about the change. Could define a new target for - * this? - */ - if (ctx->VertexProgram._Current != prev && ctx->Driver.BindProgram) { - ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB, - (struct gl_program *) ctx->VertexProgram._Current); - } -} +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 2007 Tungsten Graphics All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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 + * TUNGSTEN GRAPHICS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN + * AN ACTION 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_vp_build.c + * Create a vertex program to execute the current fixed function T&L pipeline. + * \author Keith Whitwell + */ + + +#include "main/glheader.h" +#include "main/ffvertex_prog.h" +#include "main/mtypes.h" +#include "t_vp_build.h" + + +/** + * XXX This should go away someday, but still referenced by some drivers... + */ +void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx ) +{ + const struct gl_vertex_program *prev = ctx->VertexProgram._Current; + + if (!ctx->VertexProgram._Current || + ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) { + ctx->VertexProgram._Current + = ctx->VertexProgram._TnlProgram + = _mesa_get_fixed_func_vertex_program(ctx); + } + + /* Tell the driver about the change. Could define a new target for + * this? + */ + if (ctx->VertexProgram._Current != prev && ctx->Driver.BindProgram) { + ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB, + (struct gl_program *) ctx->VertexProgram._Current); + } +} diff --git a/mesalib/src/mesa/tnl/t_vp_build.h b/mesalib/src/mesa/tnl/t_vp_build.h index 6cba2ce5a..e9f6de5a9 100644 --- a/mesalib/src/mesa/tnl/t_vp_build.h +++ b/mesalib/src/mesa/tnl/t_vp_build.h @@ -1,42 +1,42 @@ -/* - * Mesa 3-D graphics library - * Version: 6.3 - * - * Copyright (C) 2005 Tungsten Graphics All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to 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 - * TUNGSTEN GRAPHICS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN - * AN ACTION 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 T_VP_BUILD_H -#define T_VP_BUILD_H - -struct gl_context; - -#define TNL_FIXED_FUNCTION_STATE_FLAGS (_NEW_PROGRAM | \ - _NEW_LIGHT | \ - _NEW_TEXTURE | \ - _NEW_TEXTURE_MATRIX | \ - _NEW_TRANSFORM | \ - _NEW_FOG | \ - _NEW_POINT) - -extern void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx ); - -#endif +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 2005 Tungsten Graphics All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to 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 + * TUNGSTEN GRAPHICS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN + * AN ACTION 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 T_VP_BUILD_H +#define T_VP_BUILD_H + +struct gl_context; + +#define TNL_FIXED_FUNCTION_STATE_FLAGS (_NEW_PROGRAM | \ + _NEW_LIGHT | \ + _NEW_TEXTURE | \ + _NEW_TEXTURE_MATRIX | \ + _NEW_TRANSFORM | \ + _NEW_FOG | \ + _NEW_POINT) + +extern void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx ); + +#endif diff --git a/mesalib/src/mesa/vbo/vbo_exec_eval.c b/mesalib/src/mesa/vbo/vbo_exec_eval.c index 0aff01b25..1e8c3c45b 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_eval.c +++ b/mesalib/src/mesa/vbo/vbo_exec_eval.c @@ -1,263 +1,263 @@ -/* - * 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. - * - * Authors: - * Keith Whitwell - */ - -#include "main/glheader.h" -#include "main/context.h" -#include "main/macros.h" -#include "math/m_eval.h" -#include "main/dispatch.h" -#include "vbo_exec.h" - - -static void clear_active_eval1( struct vbo_exec_context *exec, GLuint attr ) -{ - assert(attr < Elements(exec->eval.map1)); - exec->eval.map1[attr].map = NULL; -} - -static void clear_active_eval2( struct vbo_exec_context *exec, GLuint attr ) -{ - assert(attr < Elements(exec->eval.map2)); - exec->eval.map2[attr].map = NULL; -} - -static void set_active_eval1( struct vbo_exec_context *exec, GLuint attr, GLuint dim, - struct gl_1d_map *map ) -{ - assert(attr < Elements(exec->eval.map1)); - if (!exec->eval.map1[attr].map) { - exec->eval.map1[attr].map = map; - exec->eval.map1[attr].sz = dim; - } -} - -static void set_active_eval2( struct vbo_exec_context *exec, GLuint attr, GLuint dim, - struct gl_2d_map *map ) -{ - assert(attr < Elements(exec->eval.map2)); - if (!exec->eval.map2[attr].map) { - exec->eval.map2[attr].map = map; - exec->eval.map2[attr].sz = dim; - } -} - -void vbo_exec_eval_update( struct vbo_exec_context *exec ) -{ - struct gl_context *ctx = exec->ctx; - GLuint attr; - - /* Vertex program maps have priority over conventional attribs */ - - for (attr = 0; attr < VBO_ATTRIB_FIRST_MATERIAL; attr++) { - clear_active_eval1( exec, attr ); - clear_active_eval2( exec, attr ); - } - - if (ctx->Eval.Map1Color4) - set_active_eval1( exec, VBO_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map1Color4 ); - - if (ctx->Eval.Map2Color4) - set_active_eval2( exec, VBO_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map2Color4 ); - - if (ctx->Eval.Map1TextureCoord4) - set_active_eval1( exec, VBO_ATTRIB_TEX0, 4, &ctx->EvalMap.Map1Texture4 ); - else if (ctx->Eval.Map1TextureCoord3) - set_active_eval1( exec, VBO_ATTRIB_TEX0, 3, &ctx->EvalMap.Map1Texture3 ); - else if (ctx->Eval.Map1TextureCoord2) - set_active_eval1( exec, VBO_ATTRIB_TEX0, 2, &ctx->EvalMap.Map1Texture2 ); - else if (ctx->Eval.Map1TextureCoord1) - set_active_eval1( exec, VBO_ATTRIB_TEX0, 1, &ctx->EvalMap.Map1Texture1 ); - - if (ctx->Eval.Map2TextureCoord4) - set_active_eval2( exec, VBO_ATTRIB_TEX0, 4, &ctx->EvalMap.Map2Texture4 ); - else if (ctx->Eval.Map2TextureCoord3) - set_active_eval2( exec, VBO_ATTRIB_TEX0, 3, &ctx->EvalMap.Map2Texture3 ); - else if (ctx->Eval.Map2TextureCoord2) - set_active_eval2( exec, VBO_ATTRIB_TEX0, 2, &ctx->EvalMap.Map2Texture2 ); - else if (ctx->Eval.Map2TextureCoord1) - set_active_eval2( exec, VBO_ATTRIB_TEX0, 1, &ctx->EvalMap.Map2Texture1 ); - - if (ctx->Eval.Map1Normal) - set_active_eval1( exec, VBO_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map1Normal ); - - if (ctx->Eval.Map2Normal) - set_active_eval2( exec, VBO_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map2Normal ); - - if (ctx->Eval.Map1Vertex4) - set_active_eval1( exec, VBO_ATTRIB_POS, 4, &ctx->EvalMap.Map1Vertex4 ); - else if (ctx->Eval.Map1Vertex3) - set_active_eval1( exec, VBO_ATTRIB_POS, 3, &ctx->EvalMap.Map1Vertex3 ); - - if (ctx->Eval.Map2Vertex4) - set_active_eval2( exec, VBO_ATTRIB_POS, 4, &ctx->EvalMap.Map2Vertex4 ); - else if (ctx->Eval.Map2Vertex3) - set_active_eval2( exec, VBO_ATTRIB_POS, 3, &ctx->EvalMap.Map2Vertex3 ); - - /* _NEW_PROGRAM */ - if (ctx->VertexProgram._Enabled) { - /* These are the 16 evaluators which GL_NV_vertex_program defines. - * They alias and override the conventional vertex attributs. - */ - for (attr = 0; attr < 16; attr++) { - /* _NEW_EVAL */ - assert(attr < Elements(ctx->Eval.Map1Attrib)); - if (ctx->Eval.Map1Attrib[attr]) - set_active_eval1( exec, attr, 4, &ctx->EvalMap.Map1Attrib[attr] ); - - assert(attr < Elements(ctx->Eval.Map2Attrib)); - if (ctx->Eval.Map2Attrib[attr]) - set_active_eval2( exec, attr, 4, &ctx->EvalMap.Map2Attrib[attr] ); - } - } - - exec->eval.recalculate_maps = 0; -} - - - -void vbo_exec_do_EvalCoord1f(struct vbo_exec_context *exec, GLfloat u) -{ - GLuint attr; - - for (attr = 1; attr <= VBO_ATTRIB_TEX7; attr++) { - struct gl_1d_map *map = exec->eval.map1[attr].map; - if (map) { - GLfloat uu = (u - map->u1) * map->du; - GLfloat data[4]; - - ASSIGN_4V(data, 0, 0, 0, 1); - - _math_horner_bezier_curve(map->Points, data, uu, - exec->eval.map1[attr].sz, - map->Order); - - COPY_SZ_4V( exec->vtx.attrptr[attr], - exec->vtx.attrsz[attr], - data ); - } - } - - /** Vertex -- EvalCoord1f is a noop if this map not enabled: - **/ - if (exec->eval.map1[0].map) { - struct gl_1d_map *map = exec->eval.map1[0].map; - GLfloat uu = (u - map->u1) * map->du; - GLfloat vertex[4]; - - ASSIGN_4V(vertex, 0, 0, 0, 1); - - _math_horner_bezier_curve(map->Points, vertex, uu, - exec->eval.map1[0].sz, - map->Order); - - if (exec->eval.map1[0].sz == 4) - CALL_Vertex4fv(GET_DISPATCH(), ( vertex )); - else - CALL_Vertex3fv(GET_DISPATCH(), ( vertex )); - } -} - - - -void vbo_exec_do_EvalCoord2f( struct vbo_exec_context *exec, - GLfloat u, GLfloat v ) -{ - GLuint attr; - - for (attr = 1; attr <= VBO_ATTRIB_TEX7; attr++) { - struct gl_2d_map *map = exec->eval.map2[attr].map; - if (map) { - GLfloat uu = (u - map->u1) * map->du; - GLfloat vv = (v - map->v1) * map->dv; - GLfloat data[4]; - - ASSIGN_4V(data, 0, 0, 0, 1); - - _math_horner_bezier_surf(map->Points, - data, - uu, vv, - exec->eval.map2[attr].sz, - map->Uorder, map->Vorder); - - COPY_SZ_4V( exec->vtx.attrptr[attr], - exec->vtx.attrsz[attr], - data ); - } - } - - /** Vertex -- EvalCoord2f is a noop if this map not enabled: - **/ - if (exec->eval.map2[0].map) { - struct gl_2d_map *map = exec->eval.map2[0].map; - GLfloat uu = (u - map->u1) * map->du; - GLfloat vv = (v - map->v1) * map->dv; - GLfloat vertex[4]; - - ASSIGN_4V(vertex, 0, 0, 0, 1); - - if (exec->ctx->Eval.AutoNormal) { - GLfloat normal[4]; - GLfloat du[4], dv[4]; - - _math_de_casteljau_surf(map->Points, vertex, du, dv, uu, vv, - exec->eval.map2[0].sz, - map->Uorder, map->Vorder); - - if (exec->eval.map2[0].sz == 4) { - du[0] = du[0]*vertex[3] - du[3]*vertex[0]; - du[1] = du[1]*vertex[3] - du[3]*vertex[1]; - du[2] = du[2]*vertex[3] - du[3]*vertex[2]; - - dv[0] = dv[0]*vertex[3] - dv[3]*vertex[0]; - dv[1] = dv[1]*vertex[3] - dv[3]*vertex[1]; - dv[2] = dv[2]*vertex[3] - dv[3]*vertex[2]; - } - - - CROSS3(normal, du, dv); - NORMALIZE_3FV(normal); - normal[3] = 1.0; - - COPY_SZ_4V( exec->vtx.attrptr[VBO_ATTRIB_NORMAL], - exec->vtx.attrsz[VBO_ATTRIB_NORMAL], - normal ); - - } - else { - _math_horner_bezier_surf(map->Points, vertex, uu, vv, - exec->eval.map2[0].sz, - map->Uorder, map->Vorder); - } - - if (exec->vtx.attrsz[0] == 4) - CALL_Vertex4fv(GET_DISPATCH(), ( vertex )); - else - CALL_Vertex3fv(GET_DISPATCH(), ( vertex )); - } -} - - +/* + * 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. + * + * Authors: + * Keith Whitwell + */ + +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "math/m_eval.h" +#include "main/dispatch.h" +#include "vbo_exec.h" + + +static void clear_active_eval1( struct vbo_exec_context *exec, GLuint attr ) +{ + assert(attr < Elements(exec->eval.map1)); + exec->eval.map1[attr].map = NULL; +} + +static void clear_active_eval2( struct vbo_exec_context *exec, GLuint attr ) +{ + assert(attr < Elements(exec->eval.map2)); + exec->eval.map2[attr].map = NULL; +} + +static void set_active_eval1( struct vbo_exec_context *exec, GLuint attr, GLuint dim, + struct gl_1d_map *map ) +{ + assert(attr < Elements(exec->eval.map1)); + if (!exec->eval.map1[attr].map) { + exec->eval.map1[attr].map = map; + exec->eval.map1[attr].sz = dim; + } +} + +static void set_active_eval2( struct vbo_exec_context *exec, GLuint attr, GLuint dim, + struct gl_2d_map *map ) +{ + assert(attr < Elements(exec->eval.map2)); + if (!exec->eval.map2[attr].map) { + exec->eval.map2[attr].map = map; + exec->eval.map2[attr].sz = dim; + } +} + +void vbo_exec_eval_update( struct vbo_exec_context *exec ) +{ + struct gl_context *ctx = exec->ctx; + GLuint attr; + + /* Vertex program maps have priority over conventional attribs */ + + for (attr = 0; attr < VBO_ATTRIB_FIRST_MATERIAL; attr++) { + clear_active_eval1( exec, attr ); + clear_active_eval2( exec, attr ); + } + + if (ctx->Eval.Map1Color4) + set_active_eval1( exec, VBO_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map1Color4 ); + + if (ctx->Eval.Map2Color4) + set_active_eval2( exec, VBO_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map2Color4 ); + + if (ctx->Eval.Map1TextureCoord4) + set_active_eval1( exec, VBO_ATTRIB_TEX0, 4, &ctx->EvalMap.Map1Texture4 ); + else if (ctx->Eval.Map1TextureCoord3) + set_active_eval1( exec, VBO_ATTRIB_TEX0, 3, &ctx->EvalMap.Map1Texture3 ); + else if (ctx->Eval.Map1TextureCoord2) + set_active_eval1( exec, VBO_ATTRIB_TEX0, 2, &ctx->EvalMap.Map1Texture2 ); + else if (ctx->Eval.Map1TextureCoord1) + set_active_eval1( exec, VBO_ATTRIB_TEX0, 1, &ctx->EvalMap.Map1Texture1 ); + + if (ctx->Eval.Map2TextureCoord4) + set_active_eval2( exec, VBO_ATTRIB_TEX0, 4, &ctx->EvalMap.Map2Texture4 ); + else if (ctx->Eval.Map2TextureCoord3) + set_active_eval2( exec, VBO_ATTRIB_TEX0, 3, &ctx->EvalMap.Map2Texture3 ); + else if (ctx->Eval.Map2TextureCoord2) + set_active_eval2( exec, VBO_ATTRIB_TEX0, 2, &ctx->EvalMap.Map2Texture2 ); + else if (ctx->Eval.Map2TextureCoord1) + set_active_eval2( exec, VBO_ATTRIB_TEX0, 1, &ctx->EvalMap.Map2Texture1 ); + + if (ctx->Eval.Map1Normal) + set_active_eval1( exec, VBO_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map1Normal ); + + if (ctx->Eval.Map2Normal) + set_active_eval2( exec, VBO_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map2Normal ); + + if (ctx->Eval.Map1Vertex4) + set_active_eval1( exec, VBO_ATTRIB_POS, 4, &ctx->EvalMap.Map1Vertex4 ); + else if (ctx->Eval.Map1Vertex3) + set_active_eval1( exec, VBO_ATTRIB_POS, 3, &ctx->EvalMap.Map1Vertex3 ); + + if (ctx->Eval.Map2Vertex4) + set_active_eval2( exec, VBO_ATTRIB_POS, 4, &ctx->EvalMap.Map2Vertex4 ); + else if (ctx->Eval.Map2Vertex3) + set_active_eval2( exec, VBO_ATTRIB_POS, 3, &ctx->EvalMap.Map2Vertex3 ); + + /* _NEW_PROGRAM */ + if (ctx->VertexProgram._Enabled) { + /* These are the 16 evaluators which GL_NV_vertex_program defines. + * They alias and override the conventional vertex attributs. + */ + for (attr = 0; attr < 16; attr++) { + /* _NEW_EVAL */ + assert(attr < Elements(ctx->Eval.Map1Attrib)); + if (ctx->Eval.Map1Attrib[attr]) + set_active_eval1( exec, attr, 4, &ctx->EvalMap.Map1Attrib[attr] ); + + assert(attr < Elements(ctx->Eval.Map2Attrib)); + if (ctx->Eval.Map2Attrib[attr]) + set_active_eval2( exec, attr, 4, &ctx->EvalMap.Map2Attrib[attr] ); + } + } + + exec->eval.recalculate_maps = 0; +} + + + +void vbo_exec_do_EvalCoord1f(struct vbo_exec_context *exec, GLfloat u) +{ + GLuint attr; + + for (attr = 1; attr <= VBO_ATTRIB_TEX7; attr++) { + struct gl_1d_map *map = exec->eval.map1[attr].map; + if (map) { + GLfloat uu = (u - map->u1) * map->du; + GLfloat data[4]; + + ASSIGN_4V(data, 0, 0, 0, 1); + + _math_horner_bezier_curve(map->Points, data, uu, + exec->eval.map1[attr].sz, + map->Order); + + COPY_SZ_4V( exec->vtx.attrptr[attr], + exec->vtx.attrsz[attr], + data ); + } + } + + /** Vertex -- EvalCoord1f is a noop if this map not enabled: + **/ + if (exec->eval.map1[0].map) { + struct gl_1d_map *map = exec->eval.map1[0].map; + GLfloat uu = (u - map->u1) * map->du; + GLfloat vertex[4]; + + ASSIGN_4V(vertex, 0, 0, 0, 1); + + _math_horner_bezier_curve(map->Points, vertex, uu, + exec->eval.map1[0].sz, + map->Order); + + if (exec->eval.map1[0].sz == 4) + CALL_Vertex4fv(GET_DISPATCH(), ( vertex )); + else + CALL_Vertex3fv(GET_DISPATCH(), ( vertex )); + } +} + + + +void vbo_exec_do_EvalCoord2f( struct vbo_exec_context *exec, + GLfloat u, GLfloat v ) +{ + GLuint attr; + + for (attr = 1; attr <= VBO_ATTRIB_TEX7; attr++) { + struct gl_2d_map *map = exec->eval.map2[attr].map; + if (map) { + GLfloat uu = (u - map->u1) * map->du; + GLfloat vv = (v - map->v1) * map->dv; + GLfloat data[4]; + + ASSIGN_4V(data, 0, 0, 0, 1); + + _math_horner_bezier_surf(map->Points, + data, + uu, vv, + exec->eval.map2[attr].sz, + map->Uorder, map->Vorder); + + COPY_SZ_4V( exec->vtx.attrptr[attr], + exec->vtx.attrsz[attr], + data ); + } + } + + /** Vertex -- EvalCoord2f is a noop if this map not enabled: + **/ + if (exec->eval.map2[0].map) { + struct gl_2d_map *map = exec->eval.map2[0].map; + GLfloat uu = (u - map->u1) * map->du; + GLfloat vv = (v - map->v1) * map->dv; + GLfloat vertex[4]; + + ASSIGN_4V(vertex, 0, 0, 0, 1); + + if (exec->ctx->Eval.AutoNormal) { + GLfloat normal[4]; + GLfloat du[4], dv[4]; + + _math_de_casteljau_surf(map->Points, vertex, du, dv, uu, vv, + exec->eval.map2[0].sz, + map->Uorder, map->Vorder); + + if (exec->eval.map2[0].sz == 4) { + du[0] = du[0]*vertex[3] - du[3]*vertex[0]; + du[1] = du[1]*vertex[3] - du[3]*vertex[1]; + du[2] = du[2]*vertex[3] - du[3]*vertex[2]; + + dv[0] = dv[0]*vertex[3] - dv[3]*vertex[0]; + dv[1] = dv[1]*vertex[3] - dv[3]*vertex[1]; + dv[2] = dv[2]*vertex[3] - dv[3]*vertex[2]; + } + + + CROSS3(normal, du, dv); + NORMALIZE_3FV(normal); + normal[3] = 1.0; + + COPY_SZ_4V( exec->vtx.attrptr[VBO_ATTRIB_NORMAL], + exec->vtx.attrsz[VBO_ATTRIB_NORMAL], + normal ); + + } + else { + _math_horner_bezier_surf(map->Points, vertex, uu, vv, + exec->eval.map2[0].sz, + map->Uorder, map->Vorder); + } + + if (exec->vtx.attrsz[0] == 4) + CALL_Vertex4fv(GET_DISPATCH(), ( vertex )); + else + CALL_Vertex3fv(GET_DISPATCH(), ( vertex )); + } +} + + diff --git a/mesalib/src/mesa/vbo/vbo_save_loopback.c b/mesalib/src/mesa/vbo/vbo_save_loopback.c index 6a8860c78..51e598e7e 100644 --- a/mesalib/src/mesa/vbo/vbo_save_loopback.c +++ b/mesalib/src/mesa/vbo/vbo_save_loopback.c @@ -1,196 +1,196 @@ -/************************************************************************** - * - * Copyright 2005 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 "main/context.h" -#include "main/glheader.h" -#include "main/enums.h" -#include "main/imports.h" -#include "main/mfeatures.h" -#include "main/mtypes.h" -#include "main/dispatch.h" -#include "glapi/glapi.h" - -#include "vbo_context.h" - - -#if FEATURE_dlist - - -typedef void (*attr_func)( struct gl_context *ctx, GLint target, const GLfloat * ); - - -/* This file makes heavy use of the aliasing of NV vertex attributes - * with the legacy attributes, and also with ARB and Material - * attributes as currently implemented. - */ -static void VertexAttrib1fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) -{ - CALL_VertexAttrib1fvNV(ctx->Exec, (target, v)); -} - -static void VertexAttrib2fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) -{ - CALL_VertexAttrib2fvNV(ctx->Exec, (target, v)); -} - -static void VertexAttrib3fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) -{ - CALL_VertexAttrib3fvNV(ctx->Exec, (target, v)); -} - -static void VertexAttrib4fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) -{ - CALL_VertexAttrib4fvNV(ctx->Exec, (target, v)); -} - -static attr_func vert_attrfunc[4] = { - VertexAttrib1fvNV, - VertexAttrib2fvNV, - VertexAttrib3fvNV, - VertexAttrib4fvNV -}; - -struct loopback_attr { - GLint target; - GLint sz; - attr_func func; -}; - -/* Don't emit ends and begins on wrapped primitives. Don't replay - * wrapped vertices. If we get here, it's probably because the - * precalculated wrapping is wrong. - */ -static void loopback_prim( struct gl_context *ctx, - const GLfloat *buffer, - const struct _mesa_prim *prim, - GLuint wrap_count, - GLuint vertex_size, - const struct loopback_attr *la, GLuint nr ) -{ - GLint start = prim->start; - GLint end = start + prim->count; - const GLfloat *data; - GLint j; - GLuint k; - - if (0) - printf("loopback prim %s(%s,%s) verts %d..%d\n", - _mesa_lookup_prim_by_nr(prim->mode), - prim->begin ? "begin" : "..", - prim->end ? "end" : "..", - start, - end); - - if (prim->begin) { - CALL_Begin(GET_DISPATCH(), ( prim->mode )); - } - else { - assert(start == 0); - start += wrap_count; - } - - data = buffer + start * vertex_size; - - for (j = start ; j < end ; j++) { - const GLfloat *tmp = data + la[0].sz; - - for (k = 1 ; k < nr ; k++) { - la[k].func( ctx, la[k].target, tmp ); - tmp += la[k].sz; - } - - /* Fire the vertex - */ - la[0].func( ctx, VBO_ATTRIB_POS, data ); - data = tmp; - } - - if (prim->end) { - CALL_End(GET_DISPATCH(), ()); - } -} - -/* Primitives generated by DrawArrays/DrawElements/Rectf may be - * caught here. If there is no primitive in progress, execute them - * normally, otherwise need to track and discard the generated - * primitives. - */ -static void loopback_weak_prim( struct gl_context *ctx, - const struct _mesa_prim *prim ) -{ - /* Use the prim_weak flag to ensure that if this primitive - * wraps, we don't mistake future vertex_lists for part of the - * surrounding primitive. - * - * While this flag is set, we are simply disposing of data - * generated by an operation now known to be a noop. - */ - if (prim->begin) - ctx->Driver.CurrentExecPrimitive |= VBO_SAVE_PRIM_WEAK; - if (prim->end) - ctx->Driver.CurrentExecPrimitive &= ~VBO_SAVE_PRIM_WEAK; -} - - -void vbo_loopback_vertex_list( struct gl_context *ctx, - const GLfloat *buffer, - const GLubyte *attrsz, - const struct _mesa_prim *prim, - GLuint prim_count, - GLuint wrap_count, - GLuint vertex_size) -{ - struct loopback_attr la[VBO_ATTRIB_MAX]; - GLuint i, nr = 0; - - /* All Legacy, NV, ARB and Material attributes are routed through - * the NV attributes entrypoints: - */ - for (i = 0 ; i < VBO_ATTRIB_MAX ; i++) { - if (attrsz[i]) { - la[nr].target = i; - la[nr].sz = attrsz[i]; - la[nr].func = vert_attrfunc[attrsz[i]-1]; - nr++; - } - } - - for (i = 0 ; i < prim_count ; i++) { - if ((prim[i].mode & VBO_SAVE_PRIM_WEAK) && - (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END)) - { - loopback_weak_prim( ctx, &prim[i] ); - } - else - { - loopback_prim( ctx, buffer, &prim[i], wrap_count, vertex_size, la, nr ); - } - } -} - - -#endif /* FEATURE_dlist */ +/************************************************************************** + * + * Copyright 2005 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 "main/context.h" +#include "main/glheader.h" +#include "main/enums.h" +#include "main/imports.h" +#include "main/mfeatures.h" +#include "main/mtypes.h" +#include "main/dispatch.h" +#include "glapi/glapi.h" + +#include "vbo_context.h" + + +#if FEATURE_dlist + + +typedef void (*attr_func)( struct gl_context *ctx, GLint target, const GLfloat * ); + + +/* This file makes heavy use of the aliasing of NV vertex attributes + * with the legacy attributes, and also with ARB and Material + * attributes as currently implemented. + */ +static void VertexAttrib1fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) +{ + CALL_VertexAttrib1fvNV(ctx->Exec, (target, v)); +} + +static void VertexAttrib2fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) +{ + CALL_VertexAttrib2fvNV(ctx->Exec, (target, v)); +} + +static void VertexAttrib3fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) +{ + CALL_VertexAttrib3fvNV(ctx->Exec, (target, v)); +} + +static void VertexAttrib4fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) +{ + CALL_VertexAttrib4fvNV(ctx->Exec, (target, v)); +} + +static attr_func vert_attrfunc[4] = { + VertexAttrib1fvNV, + VertexAttrib2fvNV, + VertexAttrib3fvNV, + VertexAttrib4fvNV +}; + +struct loopback_attr { + GLint target; + GLint sz; + attr_func func; +}; + +/* Don't emit ends and begins on wrapped primitives. Don't replay + * wrapped vertices. If we get here, it's probably because the + * precalculated wrapping is wrong. + */ +static void loopback_prim( struct gl_context *ctx, + const GLfloat *buffer, + const struct _mesa_prim *prim, + GLuint wrap_count, + GLuint vertex_size, + const struct loopback_attr *la, GLuint nr ) +{ + GLint start = prim->start; + GLint end = start + prim->count; + const GLfloat *data; + GLint j; + GLuint k; + + if (0) + printf("loopback prim %s(%s,%s) verts %d..%d\n", + _mesa_lookup_prim_by_nr(prim->mode), + prim->begin ? "begin" : "..", + prim->end ? "end" : "..", + start, + end); + + if (prim->begin) { + CALL_Begin(GET_DISPATCH(), ( prim->mode )); + } + else { + assert(start == 0); + start += wrap_count; + } + + data = buffer + start * vertex_size; + + for (j = start ; j < end ; j++) { + const GLfloat *tmp = data + la[0].sz; + + for (k = 1 ; k < nr ; k++) { + la[k].func( ctx, la[k].target, tmp ); + tmp += la[k].sz; + } + + /* Fire the vertex + */ + la[0].func( ctx, VBO_ATTRIB_POS, data ); + data = tmp; + } + + if (prim->end) { + CALL_End(GET_DISPATCH(), ()); + } +} + +/* Primitives generated by DrawArrays/DrawElements/Rectf may be + * caught here. If there is no primitive in progress, execute them + * normally, otherwise need to track and discard the generated + * primitives. + */ +static void loopback_weak_prim( struct gl_context *ctx, + const struct _mesa_prim *prim ) +{ + /* Use the prim_weak flag to ensure that if this primitive + * wraps, we don't mistake future vertex_lists for part of the + * surrounding primitive. + * + * While this flag is set, we are simply disposing of data + * generated by an operation now known to be a noop. + */ + if (prim->begin) + ctx->Driver.CurrentExecPrimitive |= VBO_SAVE_PRIM_WEAK; + if (prim->end) + ctx->Driver.CurrentExecPrimitive &= ~VBO_SAVE_PRIM_WEAK; +} + + +void vbo_loopback_vertex_list( struct gl_context *ctx, + const GLfloat *buffer, + const GLubyte *attrsz, + const struct _mesa_prim *prim, + GLuint prim_count, + GLuint wrap_count, + GLuint vertex_size) +{ + struct loopback_attr la[VBO_ATTRIB_MAX]; + GLuint i, nr = 0; + + /* All Legacy, NV, ARB and Material attributes are routed through + * the NV attributes entrypoints: + */ + for (i = 0 ; i < VBO_ATTRIB_MAX ; i++) { + if (attrsz[i]) { + la[nr].target = i; + la[nr].sz = attrsz[i]; + la[nr].func = vert_attrfunc[attrsz[i]-1]; + nr++; + } + } + + for (i = 0 ; i < prim_count ; i++) { + if ((prim[i].mode & VBO_SAVE_PRIM_WEAK) && + (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END)) + { + loopback_weak_prim( ctx, &prim[i] ); + } + else + { + loopback_prim( ctx, buffer, &prim[i], wrap_count, vertex_size, la, nr ); + } + } +} + + +#endif /* FEATURE_dlist */ diff --git a/mesalib/src/mesa/vbo/vbo_split.h b/mesalib/src/mesa/vbo/vbo_split.h index 14cf9e49c..b7f0a9c57 100644 --- a/mesalib/src/mesa/vbo/vbo_split.h +++ b/mesalib/src/mesa/vbo/vbo_split.h @@ -1,72 +1,72 @@ -/* - * mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2006 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. - */ - -/** - * \file vbo_context.h - * \brief VBO builder module datatypes and definitions. - * \author Keith Whitwell - */ - - -/** - * \mainpage The VBO splitter - * - * This is the private data used internally to the vbo_split_prims() - * helper function. Nobody outside the vbo_split* files needs to - * include or know about this structure. - */ - - -#ifndef _VBO_SPLIT_H -#define _VBO_SPLIT_H - -#include "vbo.h" - - -/* True if a primitive can be split without copying of vertices, false - * otherwise. - */ -GLboolean split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr); - -void vbo_split_inplace( struct gl_context *ctx, - const struct gl_client_array *arrays[], - const struct _mesa_prim *prim, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - GLuint min_index, - GLuint max_index, - vbo_draw_func draw, - const struct split_limits *limits ); - -/* Requires ib != NULL: - */ -void vbo_split_copy( struct gl_context *ctx, - const struct gl_client_array *arrays[], - const struct _mesa_prim *prim, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - vbo_draw_func draw, - const struct split_limits *limits ); - -#endif +/* + * mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2006 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. + */ + +/** + * \file vbo_context.h + * \brief VBO builder module datatypes and definitions. + * \author Keith Whitwell + */ + + +/** + * \mainpage The VBO splitter + * + * This is the private data used internally to the vbo_split_prims() + * helper function. Nobody outside the vbo_split* files needs to + * include or know about this structure. + */ + + +#ifndef _VBO_SPLIT_H +#define _VBO_SPLIT_H + +#include "vbo.h" + + +/* True if a primitive can be split without copying of vertices, false + * otherwise. + */ +GLboolean split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr); + +void vbo_split_inplace( struct gl_context *ctx, + const struct gl_client_array *arrays[], + const struct _mesa_prim *prim, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLuint min_index, + GLuint max_index, + vbo_draw_func draw, + const struct split_limits *limits ); + +/* Requires ib != NULL: + */ +void vbo_split_copy( struct gl_context *ctx, + const struct gl_client_array *arrays[], + const struct _mesa_prim *prim, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + vbo_draw_func draw, + const struct split_limits *limits ); + +#endif diff --git a/mesalib/src/mesa/x86/3dnow.c b/mesalib/src/mesa/x86/3dnow.c index 549157c50..de2fb1e2a 100644 --- a/mesalib/src/mesa/x86/3dnow.c +++ b/mesalib/src/mesa/x86/3dnow.c @@ -1,91 +1,91 @@ - -/* - * 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. - */ - -/* - * 3DNow! optimizations contributed by - * Holger Waechtler - */ - -#include "main/glheader.h" -#include "main/context.h" -#include "math/m_xform.h" -#include "tnl/t_context.h" - -#include "3dnow.h" -#include "x86_xform.h" - -#ifdef DEBUG_MATH -#include "math/m_debug.h" -#endif - - -#ifdef USE_3DNOW_ASM -DECLARE_XFORM_GROUP( 3dnow, 2 ) -DECLARE_XFORM_GROUP( 3dnow, 3 ) -DECLARE_XFORM_GROUP( 3dnow, 4 ) - -DECLARE_NORM_GROUP( 3dnow ) - - -extern void _ASMAPI -_mesa_v16_3dnow_general_xform( GLfloat *first_vert, - const GLfloat *m, - const GLfloat *src, - GLuint src_stride, - GLuint count ); - -extern void _ASMAPI -_mesa_3dnow_project_vertices( GLfloat *first, - GLfloat *last, - const GLfloat *m, - GLuint stride ); - -extern void _ASMAPI -_mesa_3dnow_project_clipped_vertices( GLfloat *first, - GLfloat *last, - const GLfloat *m, - GLuint stride, - const GLubyte *clipmask ); -#endif - - -void _mesa_init_3dnow_transform_asm( void ) -{ -#ifdef USE_3DNOW_ASM - ASSIGN_XFORM_GROUP( 3dnow, 2 ); - ASSIGN_XFORM_GROUP( 3dnow, 3 ); - ASSIGN_XFORM_GROUP( 3dnow, 4 ); - - /* There's a bug somewhere in the 3dnow_normal.S file that causes - * bad shading. Disable for now. - ASSIGN_NORM_GROUP( 3dnow ); - */ - -#ifdef DEBUG_MATH - _math_test_all_transform_functions( "3DNow!" ); - _math_test_all_normal_transform_functions( "3DNow!" ); -#endif -#endif -} + +/* + * 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. + */ + +/* + * 3DNow! optimizations contributed by + * Holger Waechtler + */ + +#include "main/glheader.h" +#include "main/context.h" +#include "math/m_xform.h" +#include "tnl/t_context.h" + +#include "3dnow.h" +#include "x86_xform.h" + +#ifdef DEBUG_MATH +#include "math/m_debug.h" +#endif + + +#ifdef USE_3DNOW_ASM +DECLARE_XFORM_GROUP( 3dnow, 2 ) +DECLARE_XFORM_GROUP( 3dnow, 3 ) +DECLARE_XFORM_GROUP( 3dnow, 4 ) + +DECLARE_NORM_GROUP( 3dnow ) + + +extern void _ASMAPI +_mesa_v16_3dnow_general_xform( GLfloat *first_vert, + const GLfloat *m, + const GLfloat *src, + GLuint src_stride, + GLuint count ); + +extern void _ASMAPI +_mesa_3dnow_project_vertices( GLfloat *first, + GLfloat *last, + const GLfloat *m, + GLuint stride ); + +extern void _ASMAPI +_mesa_3dnow_project_clipped_vertices( GLfloat *first, + GLfloat *last, + const GLfloat *m, + GLuint stride, + const GLubyte *clipmask ); +#endif + + +void _mesa_init_3dnow_transform_asm( void ) +{ +#ifdef USE_3DNOW_ASM + ASSIGN_XFORM_GROUP( 3dnow, 2 ); + ASSIGN_XFORM_GROUP( 3dnow, 3 ); + ASSIGN_XFORM_GROUP( 3dnow, 4 ); + + /* There's a bug somewhere in the 3dnow_normal.S file that causes + * bad shading. Disable for now. + ASSIGN_NORM_GROUP( 3dnow ); + */ + +#ifdef DEBUG_MATH + _math_test_all_transform_functions( "3DNow!" ); + _math_test_all_normal_transform_functions( "3DNow!" ); +#endif +#endif +} diff --git a/mesalib/src/mesa/x86/3dnow.h b/mesalib/src/mesa/x86/3dnow.h index 067f8f721..1c1fedcd4 100644 --- a/mesalib/src/mesa/x86/3dnow.h +++ b/mesalib/src/mesa/x86/3dnow.h @@ -1,36 +1,36 @@ - -/* - * 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. - */ - -/* - * 3DNow! optimizations contributed by - * Holger Waechtler - */ - -#ifndef __3DNOW_H__ -#define __3DNOW_H__ - -void _mesa_init_3dnow_transform_asm( void ); - -#endif + +/* + * 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. + */ + +/* + * 3DNow! optimizations contributed by + * Holger Waechtler + */ + +#ifndef __3DNOW_H__ +#define __3DNOW_H__ + +void _mesa_init_3dnow_transform_asm( void ); + +#endif diff --git a/mesalib/src/mesa/x86/3dnow_normal.S b/mesalib/src/mesa/x86/3dnow_normal.S index bfa316588..7f5f6b357 100644 --- a/mesalib/src/mesa/x86/3dnow_normal.S +++ b/mesalib/src/mesa/x86/3dnow_normal.S @@ -1,852 +1,852 @@ - -/* - * 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. - */ - -/* - * 3Dnow assembly code by Holger Waechtler - */ - -#ifdef USE_3DNOW_ASM - -#include "assyntax.h" -#include "matypes.h" -#include "norm_args.h" - - SEG_TEXT - -#define M(i) REGOFF(i * 4, ECX) -#define STRIDE REGOFF(12, ESI) - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_transform_normalize_normals) -HIDDEN(_mesa_3dnow_transform_normalize_normals) -GLNAME(_mesa_3dnow_transform_normalize_normals): - -#define FRAME_OFFSET 12 - - PUSH_L ( EDI ) - PUSH_L ( ESI ) - PUSH_L ( EBP ) - - MOV_L ( ARG_LENGTHS, EDI ) - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_DEST, EAX ) - MOV_L ( REGOFF(V4F_COUNT, ESI), EBP ) /* dest->count = in->count */ - MOV_L ( EBP, REGOFF(V4F_COUNT, EAX) ) - MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ - MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ - MOV_L ( ARG_MAT, ECX ) - MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ - - CMP_L ( CONST(0), EBP ) /* count > 0 ?? */ - JE ( LLBL (G3TN_end) ) - - MOV_L ( REGOFF (V4F_COUNT, ESI), EBP ) - FEMMS - - PUSH_L ( EBP ) - PUSH_L ( EAX ) - PUSH_L ( EDX ) /* save counter & pointer for */ - /* the normalize pass */ -#undef FRAME_OFFSET -#define FRAME_OFFSET 24 - - MOVQ ( M(0), MM3 ) /* m1 | m0 */ - MOVQ ( M(4), MM4 ) /* m5 | m4 */ - - MOVD ( M(2), MM5 ) /* | m2 */ - PUNPCKLDQ ( M(6), MM5 ) /* m6 | m2 */ - - MOVQ ( M(8), MM6 ) /* m9 | m8 */ - MOVQ ( M(10), MM7 ) /* | m10 */ - - CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ - JNE ( LLBL (G3TN_scale_end ) ) - - MOVD ( ARG_SCALE, MM0 ) /* | scale */ - PUNPCKLDQ ( MM0, MM0 ) /* scale | scale */ - - PFMUL ( MM0, MM3 ) /* scale * m1 | scale * m0 */ - PFMUL ( MM0, MM4 ) /* scale * m5 | scale * m4 */ - PFMUL ( MM0, MM5 ) /* scale * m6 | scale * m2 */ - PFMUL ( MM0, MM6 ) /* scale * m9 | scale * m8 */ - PFMUL ( MM0, MM7 ) /* | scale * m10 */ - -ALIGNTEXT32 -LLBL (G3TN_scale_end): -LLBL (G3TN_transform): - MOVQ ( REGIND (EDX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF (8, EDX), MM2 ) /* | x2 */ - - MOVQ ( MM0, MM1 ) /* x1 | x0 */ - PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ - - PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - PREFETCHW ( REGIND(EAX) ) - - PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ - PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ - - PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */ - PFADD ( MM2, MM0 ) /* x0*m4+x1*m5+x2*m6| x0*m0+...+x2**/ - - MOVQ ( REGIND (EDX), MM1 ) /* x1 | x0 */ - MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ - - PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ - MOVD ( REGOFF (8, EDX), MM2 ) /* | x2 */ - - PFMUL ( MM7, MM2 ) /* | x2*m10 */ - PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ - - PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m*/ - ADD_L ( STRIDE, EDX ) /* next normal */ - - PREFETCH ( REGIND(EDX) ) - - MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - JNZ ( LLBL (G3TN_transform) ) - - - POP_L ( EDX ) /* end of transform --- */ - POP_L ( EAX ) /* now normalizing ... */ - POP_L ( EBP ) - - CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ - JE ( LLBL (G3TN_norm ) ) /* calculate lengths */ - - -ALIGNTEXT32 -LLBL (G3TN_norm_w_lengths): - - PREFETCHW ( REGOFF(12,EAX) ) - - MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ - - MOVD ( REGIND (EDI), MM3 ) /* | length (x) */ - PFMUL ( MM3, MM1 ) /* | x2 (normalize*/ - - PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ - PFMUL ( MM3, MM0 ) /* x1 (normalized) | x0 (normalize*/ - - ADD_L ( STRIDE, EDX ) /* next normal */ - ADD_L ( CONST(4), EDI ) /* next length */ - - PREFETCH ( REGIND(EDI) ) - - MOVQ ( MM0, REGIND(EAX) ) /* write new x0, x1 */ - MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */ - - ADD_L ( CONST(16), EAX ) /* next r */ - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - - JNZ ( LLBL (G3TN_norm_w_lengths) ) - JMP ( LLBL (G3TN_exit_3dnow) ) - -ALIGNTEXT32 -LLBL (G3TN_norm): - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND (EAX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ - - MOVQ ( MM0, MM3 ) /* x1 | x0 */ - MOVQ ( MM1, MM4 ) /* | x2 */ - - PFMUL ( MM0, MM3 ) /* x1*x1 | x0*x0 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - PFMUL ( MM1, MM4 ) /* | x2*x2 */ - PFADD ( MM4, MM3 ) /* | x0*x0+x2*x2 */ - - PFACC ( MM3, MM3 ) /* **not used** | x0*x0+x1*x1+x2**/ - PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */ - - MOVQ ( MM5, MM4 ) - PUNPCKLDQ ( MM3, MM3 ) - - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - PFMUL ( MM5, MM5 ) - - PFRSQIT1 ( MM3, MM5 ) - PFRCPIT2 ( MM4, MM5 ) - - PFMUL ( MM5, MM0 ) /* x1 (normalized) | x0 (normalize*/ - - MOVQ ( MM0, REGOFF(-16, EAX) ) /* write new x0, x1 */ - PFMUL ( MM5, MM1 ) /* | x2 (normalize*/ - - MOVD ( MM1, REGOFF(-8, EAX) ) /* write new x2 */ - JNZ ( LLBL (G3TN_norm) ) - -LLBL (G3TN_exit_3dnow): - FEMMS - -LLBL (G3TN_end): - POP_L ( EBP ) - POP_L ( ESI ) - POP_L ( EDI ) - RET - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_transform_normalize_normals_no_rot) -HIDDEN(_mesa_3dnow_transform_normalize_normals_no_rot) -GLNAME(_mesa_3dnow_transform_normalize_normals_no_rot): - -#undef FRAME_OFFSET -#define FRAME_OFFSET 12 - - PUSH_L ( EDI ) - PUSH_L ( ESI ) - PUSH_L ( EBP ) - - MOV_L ( ARG_LENGTHS, EDI ) - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_DEST, EAX ) - MOV_L ( REGOFF(V4F_COUNT, ESI), EBP ) /* dest->count = in->count */ - MOV_L ( EBP, REGOFF(V4F_COUNT, EAX) ) - MOV_L ( ARG_MAT, ECX ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ - MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ - MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ - - CMP_L ( CONST(0), EBP ) /* count > 0 ?? */ - JE ( LLBL (G3TNNR_end) ) - - FEMMS - - MOVD ( M(0), MM0 ) /* | m0 */ - PUNPCKLDQ ( M(5), MM0 ) /* m5 | m0 */ - - MOVD ( M(10), MM2 ) /* | m10 */ - PUNPCKLDQ ( MM2, MM2 ) /* m10 | m10 */ - - CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ - JNE ( LLBL (G3TNNR_scale_end ) ) - - MOVD ( ARG_SCALE, MM7 ) /* | scale */ - PUNPCKLDQ ( MM7, MM7 ) /* scale | scale */ - - PFMUL ( MM7, MM0 ) /* scale * m5 | scale * m0 */ - PFMUL ( MM7, MM2 ) /* scale * m10 | scale * m10 */ - -ALIGNTEXT32 -LLBL (G3TNNR_scale_end): - CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ - JE ( LLBL (G3TNNR_norm) ) /* need to calculate lengths */ - - MOVD ( REGIND(EDI), MM3 ) /* | length (x) */ - - -ALIGNTEXT32 -LLBL (G3TNNR_norm_w_lengths): /* use precalculated lengths */ - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND(EDX), MM6 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EDX), MM7 ) /* | x2 */ - - PFMUL ( MM0, MM6 ) /* x1*m5 | x0*m0 */ - ADD_L ( STRIDE, EDX ) /* next normal */ - - PREFETCH ( REGIND(EDX) ) - - PFMUL ( MM2, MM7 ) /* | x2*m10 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - PFMUL ( MM3, MM7 ) /* | x2 (normalized) */ - PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ - - ADD_L ( CONST(4), EDI ) /* next length */ - PFMUL ( MM3, MM6 ) /* x1 (normalized) | x0 (normalized) */ - - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - MOVQ ( MM6, REGOFF(-16, EAX) ) /* write r0, r1 */ - - MOVD ( MM7, REGOFF(-8, EAX) ) /* write r2 */ - MOVD ( REGIND(EDI), MM3 ) /* | length (x) */ - - JNZ ( LLBL (G3TNNR_norm_w_lengths) ) - JMP ( LLBL (G3TNNR_exit_3dnow) ) - -ALIGNTEXT32 -LLBL (G3TNNR_norm): /* need to calculate lengths */ - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND(EDX), MM6 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EDX), MM7 ) /* | x2 */ - - PFMUL ( MM0, MM6 ) /* x1*m5 | x0*m0 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - PFMUL ( MM2, MM7 ) /* | x2*m10 */ - MOVQ ( MM6, MM3 ) /* x1 (transformed)| x0 (transformed) */ - - MOVQ ( MM7, MM4 ) /* | x2 (transformed) */ - PFMUL ( MM6, MM3 ) /* x1*x1 | x0*x0 */ - - - PFMUL ( MM7, MM4 ) /* | x2*x2 */ - PFACC ( MM3, MM3 ) /* **not used** | x0*x0+x1*x1 */ - - PFADD ( MM4, MM3 ) /* | x0*x0+x1*x1+x2*x2*/ - ADD_L ( STRIDE, EDX ) /* next normal */ - - PREFETCH ( REGIND(EDX) ) - - PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */ - MOVQ ( MM5, MM4 ) - - PUNPCKLDQ ( MM3, MM3 ) - PFMUL ( MM5, MM5 ) - - PFRSQIT1 ( MM3, MM5 ) - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - - PFRCPIT2 ( MM4, MM5 ) - PFMUL ( MM5, MM6 ) /* x1 (normalized) | x0 (normalized) */ - - MOVQ ( MM6, REGOFF(-16, EAX) ) /* write r0, r1 */ - PFMUL ( MM5, MM7 ) /* | x2 (normalized) */ - - MOVD ( MM7, REGOFF(-8, EAX) ) /* write r2 */ - JNZ ( LLBL (G3TNNR_norm) ) - - -LLBL (G3TNNR_exit_3dnow): - FEMMS - -LLBL (G3TNNR_end): - POP_L ( EBP ) - POP_L ( ESI ) - POP_L ( EDI ) - RET - - - - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_transform_rescale_normals_no_rot) -HIDDEN(_mesa_3dnow_transform_rescale_normals_no_rot) -GLNAME(_mesa_3dnow_transform_rescale_normals_no_rot): - -#undef FRAME_OFFSET -#define FRAME_OFFSET 12 - - PUSH_L ( EDI ) - PUSH_L ( ESI ) - PUSH_L ( EBP ) - - MOV_L ( ARG_IN, EAX ) - MOV_L ( ARG_DEST, EDX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EBP ) /* dest->count = in->count */ - MOV_L ( EBP, REGOFF(V4F_COUNT, EDX) ) - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_MAT, ECX ) - MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ - MOV_L ( REGOFF(V4F_START, EDX), EAX ) /* dest->start */ - MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ - - CMP_L ( CONST(0), EBP ) - JE ( LLBL (G3TRNR_end) ) - - FEMMS - - MOVD ( ARG_SCALE, MM6 ) /* | scale */ - PUNPCKLDQ ( MM6, MM6 ) /* scale | scale */ - - MOVD ( REGIND(ECX), MM0 ) /* | m0 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m5 | m0 */ - - PFMUL ( MM6, MM0 ) /* scale*m5 | scale*m0 */ - MOVD ( REGOFF(40, ECX), MM2 ) /* | m10 */ - - PFMUL ( MM6, MM2 ) /* | scale*m10 */ - -ALIGNTEXT32 -LLBL (G3TRNR_rescale): - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND(EDX), MM4 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EDX), MM5 ) /* | x2 */ - - PFMUL ( MM0, MM4 ) /* x1*m5 | x0*m0 */ - ADD_L ( STRIDE, EDX ) /* next normal */ - - PREFETCH ( REGIND(EDX) ) - - PFMUL ( MM2, MM5 ) /* | x2*m10 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - MOVQ ( MM4, REGOFF(-16, EAX) ) /* write r0, r1 */ - - MOVD ( MM5, REGOFF(-8, EAX) ) /* write r2 */ - JNZ ( LLBL (G3TRNR_rescale) ) /* cnt > 0 ? -> process next normal */ - - FEMMS - -LLBL (G3TRNR_end): - POP_L ( EBP ) - POP_L ( ESI ) - POP_L ( EDI ) - RET - - - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_transform_rescale_normals) -HIDDEN(_mesa_3dnow_transform_rescale_normals) -GLNAME(_mesa_3dnow_transform_rescale_normals): - -#undef FRAME_OFFSET -#define FRAME_OFFSET 8 - - PUSH_L ( EDI ) - PUSH_L ( ESI ) - - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_DEST, EAX ) - MOV_L ( ARG_MAT, ECX ) - MOV_L ( REGOFF(V4F_COUNT, ESI), EDI ) /* dest->count = in->count */ - MOV_L ( EDI, REGOFF(V4F_COUNT, EAX) ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ - MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ - MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ - - CMP_L ( CONST(0), EDI ) - JE ( LLBL (G3TR_end) ) - - FEMMS - - MOVQ ( REGIND(ECX), MM3 ) /* m1 | m0 */ - - MOVQ ( REGOFF(16,ECX), MM4 ) /* m5 | m4 */ - MOVD ( ARG_SCALE, MM0 ) /* scale */ - - MOVD ( REGOFF(8,ECX), MM5 ) /* | m2 */ - PUNPCKLDQ ( MM0, MM0 ) /* scale | scale */ - - PUNPCKLDQ ( REGOFF(24, ECX), MM5 ) - PFMUL ( MM0, MM3 ) /* scale*m1 | scale*m0 */ - - MOVQ ( REGOFF(32, ECX), MM6 ) /* m9 | m8*/ - PFMUL ( MM0, MM4 ) /* scale*m5 | scale*m4 */ - - MOVD ( REGOFF(40, ECX), MM7 ) /* | m10 */ - PFMUL ( MM0, MM5 ) /* scale*m6 | scale*m2 */ - - PFMUL ( MM0, MM6 ) /* scale*m9 | scale*m8 */ - - PFMUL ( MM0, MM7 ) /* | scale*m10 */ - -ALIGNTEXT32 -LLBL (G3TR_rescale): - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ - - MOVQ ( MM0, MM1 ) /* x1 | x0 */ - PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ - - PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ - PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ - - MOVQ ( REGIND(EDX), MM1 ) /* x1 | x0 */ - - PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */ - PFADD ( MM2, MM0 ) /* x0*m4...+x2*m6| x0*m0+x1*m1+x2*m2 */ - - MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ - ADD_L ( STRIDE, EDX ) /* next normal */ - - PREFETCH ( REGIND(EDX) ) - - MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ - PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ - - PFMUL ( MM7, MM2 ) /* | x2*m10 */ - PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ - - PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */ - MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ - - SUB_L ( CONST(1), EDI ) /* decrement normal counter */ - JNZ ( LLBL (G3TR_rescale) ) - - FEMMS - -LLBL (G3TR_end): - POP_L ( ESI ) - POP_L ( EDI ) - RET - - - - - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_transform_normals_no_rot) -HIDDEN(_mesa_3dnow_transform_normals_no_rot) -GLNAME(_mesa_3dnow_transform_normals_no_rot): - -#undef FRAME_OFFSET -#define FRAME_OFFSET 8 - - PUSH_L ( EDI ) - PUSH_L ( ESI ) - - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_DEST, EAX ) - MOV_L ( ARG_MAT, ECX ) - MOV_L ( REGOFF(V4F_COUNT, ESI), EDI ) /* dest->count = in->count */ - MOV_L ( EDI, REGOFF(V4F_COUNT, EAX) ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ - MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ - MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ - - CMP_L ( CONST(0), EDI ) - JE ( LLBL (G3TNR_end) ) - - FEMMS - - MOVD ( REGIND(ECX), MM0 ) /* | m0 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m5 | m0 */ - - MOVD ( REGOFF(40, ECX), MM2 ) /* | m10 */ - PUNPCKLDQ ( MM2, MM2 ) /* m10 | m10 */ - -ALIGNTEXT32 -LLBL (G3TNR_transform): - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND(EDX), MM4 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EDX), MM5 ) /* | x2 */ - - PFMUL ( MM0, MM4 ) /* x1*m5 | x0*m0 */ - ADD_L ( STRIDE, EDX) /* next normal */ - - PREFETCH ( REGIND(EDX) ) - - PFMUL ( MM2, MM5 ) /* | x2*m10 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - SUB_L ( CONST(1), EDI ) /* decrement normal counter */ - MOVQ ( MM4, REGOFF(-16, EAX) ) /* write r0, r1 */ - - MOVD ( MM5, REGOFF(-8, EAX) ) /* write r2 */ - JNZ ( LLBL (G3TNR_transform) ) - - FEMMS - -LLBL (G3TNR_end): - POP_L ( ESI ) - POP_L ( EDI ) - RET - - - - - - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_transform_normals) -HIDDEN(_mesa_3dnow_transform_normals) -GLNAME(_mesa_3dnow_transform_normals): - -#undef FRAME_OFFSET -#define FRAME_OFFSET 8 - - PUSH_L ( EDI ) - PUSH_L ( ESI ) - - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_DEST, EAX ) - MOV_L ( ARG_MAT, ECX ) - MOV_L ( REGOFF(V4F_COUNT, ESI), EDI ) /* dest->count = in->count */ - MOV_L ( EDI, REGOFF(V4F_COUNT, EAX) ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ - MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ - MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ - - CMP_L ( CONST(0), EDI ) /* count > 0 ?? */ - JE ( LLBL (G3T_end) ) - - FEMMS - - MOVQ ( REGIND(ECX), MM3 ) /* m1 | m0 */ - MOVQ ( REGOFF(16, ECX), MM4 ) /* m5 | m4 */ - - MOVD ( REGOFF(8, ECX), MM5 ) /* | m2 */ - PUNPCKLDQ ( REGOFF(24, ECX), MM5 ) /* m6 | m2 */ - - MOVQ ( REGOFF(32, ECX), MM6 ) /* m9 | m8 */ - MOVD ( REGOFF(40, ECX), MM7 ) /* | m10 */ - -ALIGNTEXT32 -LLBL (G3T_transform): - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ - - MOVQ ( MM0, MM1 ) /* x1 | x0 */ - PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ - - PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ - PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ - - PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */ - PFADD ( MM2, MM0 ) /* x0*m4...+x2*m6| x0*m0+x1*m1+x2*m2 */ - - MOVQ ( REGIND(EDX), MM1 ) /* x1 | x0 */ - MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ - - PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ - MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ - - PFMUL ( MM7, MM2 ) /* | x2*m10 */ - ADD_L ( STRIDE, EDX ) /* next normal */ - - PREFETCH ( REGIND(EDX) ) - - PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ - PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */ - - MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ - SUB_L ( CONST(1), EDI ) /* decrement normal counter */ - - JNZ ( LLBL (G3T_transform) ) - - FEMMS - -LLBL (G3T_end): - POP_L ( ESI ) - POP_L ( EDI ) - RET - - - - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_normalize_normals) -HIDDEN(_mesa_3dnow_normalize_normals) -GLNAME(_mesa_3dnow_normalize_normals): - -#undef FRAME_OFFSET -#define FRAME_OFFSET 12 - - PUSH_L ( EDI ) - PUSH_L ( ESI ) - PUSH_L ( EBP ) - - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_DEST, EAX ) - MOV_L ( REGOFF(V4F_COUNT, ESI), EBP ) /* dest->count = in->count */ - MOV_L ( EBP, REGOFF(V4F_COUNT, EAX) ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ - MOV_L ( REGOFF(V4F_START, ESI), ECX ) /* in->start */ - MOV_L ( ARG_LENGTHS, EDX ) - - CMP_L ( CONST(0), EBP ) /* count > 0 ?? */ - JE ( LLBL (G3N_end) ) - - FEMMS - - CMP_L ( CONST(0), EDX ) /* lengths == 0 ? */ - JE ( LLBL (G3N_norm2) ) /* calculate lengths */ - -ALIGNTEXT32 -LLBL (G3N_norm1): /* use precalculated lengths */ - - PREFETCH ( REGIND(EAX) ) - - MOVQ ( REGIND(ECX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, ECX), MM1 ) /* | x2 */ - - MOVD ( REGIND(EDX), MM3 ) /* | length (x) */ - PFMUL ( MM3, MM1 ) /* | x2 (normalized) */ - - PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ - ADD_L ( STRIDE, ECX ) /* next normal */ - - PREFETCH ( REGIND(ECX) ) - - PFMUL ( MM3, MM0 ) /* x1 (normalized) | x0 (normalized) */ - MOVQ ( MM0, REGIND(EAX) ) /* write new x0, x1 */ - - MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - ADD_L ( CONST(4), EDX ) /* next length */ - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - - JNZ ( LLBL (G3N_norm1) ) - - JMP ( LLBL (G3N_end1) ) - -ALIGNTEXT32 -LLBL (G3N_norm2): /* need to calculate lengths */ - - PREFETCHW ( REGIND(EAX) ) - - PREFETCH ( REGIND(ECX) ) - - MOVQ ( REGIND(ECX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, ECX), MM1 ) /* | x2 */ - - MOVQ ( MM0, MM3 ) /* x1 | x0 */ - ADD_L ( STRIDE, ECX ) /* next normal */ - - PFMUL ( MM0, MM3 ) /* x1*x1 | x0*x0 */ - MOVQ ( MM1, MM4 ) /* | x2 */ - - ADD_L ( CONST(16), EAX ) /* next r */ - PFMUL ( MM1, MM4 ) /* | x2*x2 */ - - PFADD ( MM4, MM3 ) /* | x0*x0+x2*x2 */ - PFACC ( MM3, MM3 ) /* x0*x0+...+x2*x2 | x0*x0+x1*x1+x2*x2*/ - - PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */ - MOVQ ( MM5, MM4 ) - - PUNPCKLDQ ( MM3, MM3 ) - PFMUL ( MM5, MM5 ) - - PFRSQIT1 ( MM3, MM5 ) - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - - PFRCPIT2 ( MM4, MM5 ) - - PFMUL ( MM5, MM0 ) /* x1 (normalized) | x0 (normalized) */ - MOVQ ( MM0, REGOFF(-16, EAX) ) /* write new x0, x1 */ - - PFMUL ( MM5, MM1 ) /* | x2 (normalized) */ - MOVD ( MM1, REGOFF(-8, EAX) ) /* write new x2 */ - - JNZ ( LLBL (G3N_norm2) ) - -LLBL (G3N_end1): - FEMMS - -LLBL (G3N_end): - POP_L ( EBP ) - POP_L ( ESI ) - POP_L ( EDI ) - RET - - - - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_rescale_normals) -HIDDEN(_mesa_3dnow_rescale_normals) -GLNAME(_mesa_3dnow_rescale_normals): - -#undef FRAME_OFFSET -#define FRAME_OFFSET 8 - PUSH_L ( EDI ) - PUSH_L ( ESI ) - - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_DEST, EAX ) - MOV_L ( REGOFF(V4F_COUNT, ESI), EDX ) /* dest->count = in->count */ - MOV_L ( EDX, REGOFF(V4F_COUNT, EAX) ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ - MOV_L ( REGOFF(V4F_START, ESI), ECX ) /* in->start */ - - CMP_L ( CONST(0), EDX ) - JE ( LLBL (G3R_end) ) - - FEMMS - - MOVD ( ARG_SCALE, MM0 ) /* scale */ - PUNPCKLDQ ( MM0, MM0 ) - -ALIGNTEXT32 -LLBL (G3R_rescale): - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND(ECX), MM1 ) /* x1 | x0 */ - MOVD ( REGOFF(8, ECX), MM2 ) /* | x2 */ - - PFMUL ( MM0, MM1 ) /* x1*scale | x0*scale */ - ADD_L ( STRIDE, ECX ) /* next normal */ - - PREFETCH ( REGIND(ECX) ) - - PFMUL ( MM0, MM2 ) /* | x2*scale */ - ADD_L ( CONST(16), EAX ) /* next r */ - - MOVQ ( MM1, REGOFF(-16, EAX) ) /* write r0, r1 */ - MOVD ( MM2, REGOFF(-8, EAX) ) /* write r2 */ - - SUB_L ( CONST(1), EDX ) /* decrement normal counter */ - JNZ ( LLBL (G3R_rescale) ) - - FEMMS - -LLBL (G3R_end): - POP_L ( ESI ) - POP_L ( EDI ) - RET - -#endif - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif + +/* + * 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. + */ + +/* + * 3Dnow assembly code by Holger Waechtler + */ + +#ifdef USE_3DNOW_ASM + +#include "assyntax.h" +#include "matypes.h" +#include "norm_args.h" + + SEG_TEXT + +#define M(i) REGOFF(i * 4, ECX) +#define STRIDE REGOFF(12, ESI) + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_transform_normalize_normals) +HIDDEN(_mesa_3dnow_transform_normalize_normals) +GLNAME(_mesa_3dnow_transform_normalize_normals): + +#define FRAME_OFFSET 12 + + PUSH_L ( EDI ) + PUSH_L ( ESI ) + PUSH_L ( EBP ) + + MOV_L ( ARG_LENGTHS, EDI ) + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_DEST, EAX ) + MOV_L ( REGOFF(V4F_COUNT, ESI), EBP ) /* dest->count = in->count */ + MOV_L ( EBP, REGOFF(V4F_COUNT, EAX) ) + MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ + MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ + MOV_L ( ARG_MAT, ECX ) + MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ + + CMP_L ( CONST(0), EBP ) /* count > 0 ?? */ + JE ( LLBL (G3TN_end) ) + + MOV_L ( REGOFF (V4F_COUNT, ESI), EBP ) + FEMMS + + PUSH_L ( EBP ) + PUSH_L ( EAX ) + PUSH_L ( EDX ) /* save counter & pointer for */ + /* the normalize pass */ +#undef FRAME_OFFSET +#define FRAME_OFFSET 24 + + MOVQ ( M(0), MM3 ) /* m1 | m0 */ + MOVQ ( M(4), MM4 ) /* m5 | m4 */ + + MOVD ( M(2), MM5 ) /* | m2 */ + PUNPCKLDQ ( M(6), MM5 ) /* m6 | m2 */ + + MOVQ ( M(8), MM6 ) /* m9 | m8 */ + MOVQ ( M(10), MM7 ) /* | m10 */ + + CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ + JNE ( LLBL (G3TN_scale_end ) ) + + MOVD ( ARG_SCALE, MM0 ) /* | scale */ + PUNPCKLDQ ( MM0, MM0 ) /* scale | scale */ + + PFMUL ( MM0, MM3 ) /* scale * m1 | scale * m0 */ + PFMUL ( MM0, MM4 ) /* scale * m5 | scale * m4 */ + PFMUL ( MM0, MM5 ) /* scale * m6 | scale * m2 */ + PFMUL ( MM0, MM6 ) /* scale * m9 | scale * m8 */ + PFMUL ( MM0, MM7 ) /* | scale * m10 */ + +ALIGNTEXT32 +LLBL (G3TN_scale_end): +LLBL (G3TN_transform): + MOVQ ( REGIND (EDX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF (8, EDX), MM2 ) /* | x2 */ + + MOVQ ( MM0, MM1 ) /* x1 | x0 */ + PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ + + PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + PREFETCHW ( REGIND(EAX) ) + + PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ + PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ + + PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */ + PFADD ( MM2, MM0 ) /* x0*m4+x1*m5+x2*m6| x0*m0+...+x2**/ + + MOVQ ( REGIND (EDX), MM1 ) /* x1 | x0 */ + MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ + + PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ + MOVD ( REGOFF (8, EDX), MM2 ) /* | x2 */ + + PFMUL ( MM7, MM2 ) /* | x2*m10 */ + PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ + + PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m*/ + ADD_L ( STRIDE, EDX ) /* next normal */ + + PREFETCH ( REGIND(EDX) ) + + MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ + SUB_L ( CONST(1), EBP ) /* decrement normal counter */ + JNZ ( LLBL (G3TN_transform) ) + + + POP_L ( EDX ) /* end of transform --- */ + POP_L ( EAX ) /* now normalizing ... */ + POP_L ( EBP ) + + CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ + JE ( LLBL (G3TN_norm ) ) /* calculate lengths */ + + +ALIGNTEXT32 +LLBL (G3TN_norm_w_lengths): + + PREFETCHW ( REGOFF(12,EAX) ) + + MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ + + MOVD ( REGIND (EDI), MM3 ) /* | length (x) */ + PFMUL ( MM3, MM1 ) /* | x2 (normalize*/ + + PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ + PFMUL ( MM3, MM0 ) /* x1 (normalized) | x0 (normalize*/ + + ADD_L ( STRIDE, EDX ) /* next normal */ + ADD_L ( CONST(4), EDI ) /* next length */ + + PREFETCH ( REGIND(EDI) ) + + MOVQ ( MM0, REGIND(EAX) ) /* write new x0, x1 */ + MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */ + + ADD_L ( CONST(16), EAX ) /* next r */ + SUB_L ( CONST(1), EBP ) /* decrement normal counter */ + + JNZ ( LLBL (G3TN_norm_w_lengths) ) + JMP ( LLBL (G3TN_exit_3dnow) ) + +ALIGNTEXT32 +LLBL (G3TN_norm): + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND (EAX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ + + MOVQ ( MM0, MM3 ) /* x1 | x0 */ + MOVQ ( MM1, MM4 ) /* | x2 */ + + PFMUL ( MM0, MM3 ) /* x1*x1 | x0*x0 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + PFMUL ( MM1, MM4 ) /* | x2*x2 */ + PFADD ( MM4, MM3 ) /* | x0*x0+x2*x2 */ + + PFACC ( MM3, MM3 ) /* **not used** | x0*x0+x1*x1+x2**/ + PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */ + + MOVQ ( MM5, MM4 ) + PUNPCKLDQ ( MM3, MM3 ) + + SUB_L ( CONST(1), EBP ) /* decrement normal counter */ + PFMUL ( MM5, MM5 ) + + PFRSQIT1 ( MM3, MM5 ) + PFRCPIT2 ( MM4, MM5 ) + + PFMUL ( MM5, MM0 ) /* x1 (normalized) | x0 (normalize*/ + + MOVQ ( MM0, REGOFF(-16, EAX) ) /* write new x0, x1 */ + PFMUL ( MM5, MM1 ) /* | x2 (normalize*/ + + MOVD ( MM1, REGOFF(-8, EAX) ) /* write new x2 */ + JNZ ( LLBL (G3TN_norm) ) + +LLBL (G3TN_exit_3dnow): + FEMMS + +LLBL (G3TN_end): + POP_L ( EBP ) + POP_L ( ESI ) + POP_L ( EDI ) + RET + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_transform_normalize_normals_no_rot) +HIDDEN(_mesa_3dnow_transform_normalize_normals_no_rot) +GLNAME(_mesa_3dnow_transform_normalize_normals_no_rot): + +#undef FRAME_OFFSET +#define FRAME_OFFSET 12 + + PUSH_L ( EDI ) + PUSH_L ( ESI ) + PUSH_L ( EBP ) + + MOV_L ( ARG_LENGTHS, EDI ) + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_DEST, EAX ) + MOV_L ( REGOFF(V4F_COUNT, ESI), EBP ) /* dest->count = in->count */ + MOV_L ( EBP, REGOFF(V4F_COUNT, EAX) ) + MOV_L ( ARG_MAT, ECX ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ + MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ + MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ + + CMP_L ( CONST(0), EBP ) /* count > 0 ?? */ + JE ( LLBL (G3TNNR_end) ) + + FEMMS + + MOVD ( M(0), MM0 ) /* | m0 */ + PUNPCKLDQ ( M(5), MM0 ) /* m5 | m0 */ + + MOVD ( M(10), MM2 ) /* | m10 */ + PUNPCKLDQ ( MM2, MM2 ) /* m10 | m10 */ + + CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ + JNE ( LLBL (G3TNNR_scale_end ) ) + + MOVD ( ARG_SCALE, MM7 ) /* | scale */ + PUNPCKLDQ ( MM7, MM7 ) /* scale | scale */ + + PFMUL ( MM7, MM0 ) /* scale * m5 | scale * m0 */ + PFMUL ( MM7, MM2 ) /* scale * m10 | scale * m10 */ + +ALIGNTEXT32 +LLBL (G3TNNR_scale_end): + CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ + JE ( LLBL (G3TNNR_norm) ) /* need to calculate lengths */ + + MOVD ( REGIND(EDI), MM3 ) /* | length (x) */ + + +ALIGNTEXT32 +LLBL (G3TNNR_norm_w_lengths): /* use precalculated lengths */ + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND(EDX), MM6 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EDX), MM7 ) /* | x2 */ + + PFMUL ( MM0, MM6 ) /* x1*m5 | x0*m0 */ + ADD_L ( STRIDE, EDX ) /* next normal */ + + PREFETCH ( REGIND(EDX) ) + + PFMUL ( MM2, MM7 ) /* | x2*m10 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + PFMUL ( MM3, MM7 ) /* | x2 (normalized) */ + PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ + + ADD_L ( CONST(4), EDI ) /* next length */ + PFMUL ( MM3, MM6 ) /* x1 (normalized) | x0 (normalized) */ + + SUB_L ( CONST(1), EBP ) /* decrement normal counter */ + MOVQ ( MM6, REGOFF(-16, EAX) ) /* write r0, r1 */ + + MOVD ( MM7, REGOFF(-8, EAX) ) /* write r2 */ + MOVD ( REGIND(EDI), MM3 ) /* | length (x) */ + + JNZ ( LLBL (G3TNNR_norm_w_lengths) ) + JMP ( LLBL (G3TNNR_exit_3dnow) ) + +ALIGNTEXT32 +LLBL (G3TNNR_norm): /* need to calculate lengths */ + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND(EDX), MM6 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EDX), MM7 ) /* | x2 */ + + PFMUL ( MM0, MM6 ) /* x1*m5 | x0*m0 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + PFMUL ( MM2, MM7 ) /* | x2*m10 */ + MOVQ ( MM6, MM3 ) /* x1 (transformed)| x0 (transformed) */ + + MOVQ ( MM7, MM4 ) /* | x2 (transformed) */ + PFMUL ( MM6, MM3 ) /* x1*x1 | x0*x0 */ + + + PFMUL ( MM7, MM4 ) /* | x2*x2 */ + PFACC ( MM3, MM3 ) /* **not used** | x0*x0+x1*x1 */ + + PFADD ( MM4, MM3 ) /* | x0*x0+x1*x1+x2*x2*/ + ADD_L ( STRIDE, EDX ) /* next normal */ + + PREFETCH ( REGIND(EDX) ) + + PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */ + MOVQ ( MM5, MM4 ) + + PUNPCKLDQ ( MM3, MM3 ) + PFMUL ( MM5, MM5 ) + + PFRSQIT1 ( MM3, MM5 ) + SUB_L ( CONST(1), EBP ) /* decrement normal counter */ + + PFRCPIT2 ( MM4, MM5 ) + PFMUL ( MM5, MM6 ) /* x1 (normalized) | x0 (normalized) */ + + MOVQ ( MM6, REGOFF(-16, EAX) ) /* write r0, r1 */ + PFMUL ( MM5, MM7 ) /* | x2 (normalized) */ + + MOVD ( MM7, REGOFF(-8, EAX) ) /* write r2 */ + JNZ ( LLBL (G3TNNR_norm) ) + + +LLBL (G3TNNR_exit_3dnow): + FEMMS + +LLBL (G3TNNR_end): + POP_L ( EBP ) + POP_L ( ESI ) + POP_L ( EDI ) + RET + + + + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_transform_rescale_normals_no_rot) +HIDDEN(_mesa_3dnow_transform_rescale_normals_no_rot) +GLNAME(_mesa_3dnow_transform_rescale_normals_no_rot): + +#undef FRAME_OFFSET +#define FRAME_OFFSET 12 + + PUSH_L ( EDI ) + PUSH_L ( ESI ) + PUSH_L ( EBP ) + + MOV_L ( ARG_IN, EAX ) + MOV_L ( ARG_DEST, EDX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EBP ) /* dest->count = in->count */ + MOV_L ( EBP, REGOFF(V4F_COUNT, EDX) ) + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_MAT, ECX ) + MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ + MOV_L ( REGOFF(V4F_START, EDX), EAX ) /* dest->start */ + MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ + + CMP_L ( CONST(0), EBP ) + JE ( LLBL (G3TRNR_end) ) + + FEMMS + + MOVD ( ARG_SCALE, MM6 ) /* | scale */ + PUNPCKLDQ ( MM6, MM6 ) /* scale | scale */ + + MOVD ( REGIND(ECX), MM0 ) /* | m0 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m5 | m0 */ + + PFMUL ( MM6, MM0 ) /* scale*m5 | scale*m0 */ + MOVD ( REGOFF(40, ECX), MM2 ) /* | m10 */ + + PFMUL ( MM6, MM2 ) /* | scale*m10 */ + +ALIGNTEXT32 +LLBL (G3TRNR_rescale): + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND(EDX), MM4 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EDX), MM5 ) /* | x2 */ + + PFMUL ( MM0, MM4 ) /* x1*m5 | x0*m0 */ + ADD_L ( STRIDE, EDX ) /* next normal */ + + PREFETCH ( REGIND(EDX) ) + + PFMUL ( MM2, MM5 ) /* | x2*m10 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + SUB_L ( CONST(1), EBP ) /* decrement normal counter */ + MOVQ ( MM4, REGOFF(-16, EAX) ) /* write r0, r1 */ + + MOVD ( MM5, REGOFF(-8, EAX) ) /* write r2 */ + JNZ ( LLBL (G3TRNR_rescale) ) /* cnt > 0 ? -> process next normal */ + + FEMMS + +LLBL (G3TRNR_end): + POP_L ( EBP ) + POP_L ( ESI ) + POP_L ( EDI ) + RET + + + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_transform_rescale_normals) +HIDDEN(_mesa_3dnow_transform_rescale_normals) +GLNAME(_mesa_3dnow_transform_rescale_normals): + +#undef FRAME_OFFSET +#define FRAME_OFFSET 8 + + PUSH_L ( EDI ) + PUSH_L ( ESI ) + + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_DEST, EAX ) + MOV_L ( ARG_MAT, ECX ) + MOV_L ( REGOFF(V4F_COUNT, ESI), EDI ) /* dest->count = in->count */ + MOV_L ( EDI, REGOFF(V4F_COUNT, EAX) ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ + MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ + MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ + + CMP_L ( CONST(0), EDI ) + JE ( LLBL (G3TR_end) ) + + FEMMS + + MOVQ ( REGIND(ECX), MM3 ) /* m1 | m0 */ + + MOVQ ( REGOFF(16,ECX), MM4 ) /* m5 | m4 */ + MOVD ( ARG_SCALE, MM0 ) /* scale */ + + MOVD ( REGOFF(8,ECX), MM5 ) /* | m2 */ + PUNPCKLDQ ( MM0, MM0 ) /* scale | scale */ + + PUNPCKLDQ ( REGOFF(24, ECX), MM5 ) + PFMUL ( MM0, MM3 ) /* scale*m1 | scale*m0 */ + + MOVQ ( REGOFF(32, ECX), MM6 ) /* m9 | m8*/ + PFMUL ( MM0, MM4 ) /* scale*m5 | scale*m4 */ + + MOVD ( REGOFF(40, ECX), MM7 ) /* | m10 */ + PFMUL ( MM0, MM5 ) /* scale*m6 | scale*m2 */ + + PFMUL ( MM0, MM6 ) /* scale*m9 | scale*m8 */ + + PFMUL ( MM0, MM7 ) /* | scale*m10 */ + +ALIGNTEXT32 +LLBL (G3TR_rescale): + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ + + MOVQ ( MM0, MM1 ) /* x1 | x0 */ + PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ + + PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ + PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ + + MOVQ ( REGIND(EDX), MM1 ) /* x1 | x0 */ + + PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */ + PFADD ( MM2, MM0 ) /* x0*m4...+x2*m6| x0*m0+x1*m1+x2*m2 */ + + MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ + ADD_L ( STRIDE, EDX ) /* next normal */ + + PREFETCH ( REGIND(EDX) ) + + MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ + PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ + + PFMUL ( MM7, MM2 ) /* | x2*m10 */ + PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ + + PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */ + MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ + + SUB_L ( CONST(1), EDI ) /* decrement normal counter */ + JNZ ( LLBL (G3TR_rescale) ) + + FEMMS + +LLBL (G3TR_end): + POP_L ( ESI ) + POP_L ( EDI ) + RET + + + + + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_transform_normals_no_rot) +HIDDEN(_mesa_3dnow_transform_normals_no_rot) +GLNAME(_mesa_3dnow_transform_normals_no_rot): + +#undef FRAME_OFFSET +#define FRAME_OFFSET 8 + + PUSH_L ( EDI ) + PUSH_L ( ESI ) + + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_DEST, EAX ) + MOV_L ( ARG_MAT, ECX ) + MOV_L ( REGOFF(V4F_COUNT, ESI), EDI ) /* dest->count = in->count */ + MOV_L ( EDI, REGOFF(V4F_COUNT, EAX) ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ + MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ + MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ + + CMP_L ( CONST(0), EDI ) + JE ( LLBL (G3TNR_end) ) + + FEMMS + + MOVD ( REGIND(ECX), MM0 ) /* | m0 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m5 | m0 */ + + MOVD ( REGOFF(40, ECX), MM2 ) /* | m10 */ + PUNPCKLDQ ( MM2, MM2 ) /* m10 | m10 */ + +ALIGNTEXT32 +LLBL (G3TNR_transform): + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND(EDX), MM4 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EDX), MM5 ) /* | x2 */ + + PFMUL ( MM0, MM4 ) /* x1*m5 | x0*m0 */ + ADD_L ( STRIDE, EDX) /* next normal */ + + PREFETCH ( REGIND(EDX) ) + + PFMUL ( MM2, MM5 ) /* | x2*m10 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + SUB_L ( CONST(1), EDI ) /* decrement normal counter */ + MOVQ ( MM4, REGOFF(-16, EAX) ) /* write r0, r1 */ + + MOVD ( MM5, REGOFF(-8, EAX) ) /* write r2 */ + JNZ ( LLBL (G3TNR_transform) ) + + FEMMS + +LLBL (G3TNR_end): + POP_L ( ESI ) + POP_L ( EDI ) + RET + + + + + + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_transform_normals) +HIDDEN(_mesa_3dnow_transform_normals) +GLNAME(_mesa_3dnow_transform_normals): + +#undef FRAME_OFFSET +#define FRAME_OFFSET 8 + + PUSH_L ( EDI ) + PUSH_L ( ESI ) + + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_DEST, EAX ) + MOV_L ( ARG_MAT, ECX ) + MOV_L ( REGOFF(V4F_COUNT, ESI), EDI ) /* dest->count = in->count */ + MOV_L ( EDI, REGOFF(V4F_COUNT, EAX) ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ + MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ + MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ + + CMP_L ( CONST(0), EDI ) /* count > 0 ?? */ + JE ( LLBL (G3T_end) ) + + FEMMS + + MOVQ ( REGIND(ECX), MM3 ) /* m1 | m0 */ + MOVQ ( REGOFF(16, ECX), MM4 ) /* m5 | m4 */ + + MOVD ( REGOFF(8, ECX), MM5 ) /* | m2 */ + PUNPCKLDQ ( REGOFF(24, ECX), MM5 ) /* m6 | m2 */ + + MOVQ ( REGOFF(32, ECX), MM6 ) /* m9 | m8 */ + MOVD ( REGOFF(40, ECX), MM7 ) /* | m10 */ + +ALIGNTEXT32 +LLBL (G3T_transform): + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ + + MOVQ ( MM0, MM1 ) /* x1 | x0 */ + PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ + + PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ + PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ + + PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */ + PFADD ( MM2, MM0 ) /* x0*m4...+x2*m6| x0*m0+x1*m1+x2*m2 */ + + MOVQ ( REGIND(EDX), MM1 ) /* x1 | x0 */ + MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ + + PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ + MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ + + PFMUL ( MM7, MM2 ) /* | x2*m10 */ + ADD_L ( STRIDE, EDX ) /* next normal */ + + PREFETCH ( REGIND(EDX) ) + + PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ + PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */ + + MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ + SUB_L ( CONST(1), EDI ) /* decrement normal counter */ + + JNZ ( LLBL (G3T_transform) ) + + FEMMS + +LLBL (G3T_end): + POP_L ( ESI ) + POP_L ( EDI ) + RET + + + + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_normalize_normals) +HIDDEN(_mesa_3dnow_normalize_normals) +GLNAME(_mesa_3dnow_normalize_normals): + +#undef FRAME_OFFSET +#define FRAME_OFFSET 12 + + PUSH_L ( EDI ) + PUSH_L ( ESI ) + PUSH_L ( EBP ) + + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_DEST, EAX ) + MOV_L ( REGOFF(V4F_COUNT, ESI), EBP ) /* dest->count = in->count */ + MOV_L ( EBP, REGOFF(V4F_COUNT, EAX) ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ + MOV_L ( REGOFF(V4F_START, ESI), ECX ) /* in->start */ + MOV_L ( ARG_LENGTHS, EDX ) + + CMP_L ( CONST(0), EBP ) /* count > 0 ?? */ + JE ( LLBL (G3N_end) ) + + FEMMS + + CMP_L ( CONST(0), EDX ) /* lengths == 0 ? */ + JE ( LLBL (G3N_norm2) ) /* calculate lengths */ + +ALIGNTEXT32 +LLBL (G3N_norm1): /* use precalculated lengths */ + + PREFETCH ( REGIND(EAX) ) + + MOVQ ( REGIND(ECX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, ECX), MM1 ) /* | x2 */ + + MOVD ( REGIND(EDX), MM3 ) /* | length (x) */ + PFMUL ( MM3, MM1 ) /* | x2 (normalized) */ + + PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ + ADD_L ( STRIDE, ECX ) /* next normal */ + + PREFETCH ( REGIND(ECX) ) + + PFMUL ( MM3, MM0 ) /* x1 (normalized) | x0 (normalized) */ + MOVQ ( MM0, REGIND(EAX) ) /* write new x0, x1 */ + + MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */ + ADD_L ( CONST(16), EAX ) /* next r */ + + ADD_L ( CONST(4), EDX ) /* next length */ + SUB_L ( CONST(1), EBP ) /* decrement normal counter */ + + JNZ ( LLBL (G3N_norm1) ) + + JMP ( LLBL (G3N_end1) ) + +ALIGNTEXT32 +LLBL (G3N_norm2): /* need to calculate lengths */ + + PREFETCHW ( REGIND(EAX) ) + + PREFETCH ( REGIND(ECX) ) + + MOVQ ( REGIND(ECX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, ECX), MM1 ) /* | x2 */ + + MOVQ ( MM0, MM3 ) /* x1 | x0 */ + ADD_L ( STRIDE, ECX ) /* next normal */ + + PFMUL ( MM0, MM3 ) /* x1*x1 | x0*x0 */ + MOVQ ( MM1, MM4 ) /* | x2 */ + + ADD_L ( CONST(16), EAX ) /* next r */ + PFMUL ( MM1, MM4 ) /* | x2*x2 */ + + PFADD ( MM4, MM3 ) /* | x0*x0+x2*x2 */ + PFACC ( MM3, MM3 ) /* x0*x0+...+x2*x2 | x0*x0+x1*x1+x2*x2*/ + + PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */ + MOVQ ( MM5, MM4 ) + + PUNPCKLDQ ( MM3, MM3 ) + PFMUL ( MM5, MM5 ) + + PFRSQIT1 ( MM3, MM5 ) + SUB_L ( CONST(1), EBP ) /* decrement normal counter */ + + PFRCPIT2 ( MM4, MM5 ) + + PFMUL ( MM5, MM0 ) /* x1 (normalized) | x0 (normalized) */ + MOVQ ( MM0, REGOFF(-16, EAX) ) /* write new x0, x1 */ + + PFMUL ( MM5, MM1 ) /* | x2 (normalized) */ + MOVD ( MM1, REGOFF(-8, EAX) ) /* write new x2 */ + + JNZ ( LLBL (G3N_norm2) ) + +LLBL (G3N_end1): + FEMMS + +LLBL (G3N_end): + POP_L ( EBP ) + POP_L ( ESI ) + POP_L ( EDI ) + RET + + + + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_3dnow_rescale_normals) +HIDDEN(_mesa_3dnow_rescale_normals) +GLNAME(_mesa_3dnow_rescale_normals): + +#undef FRAME_OFFSET +#define FRAME_OFFSET 8 + PUSH_L ( EDI ) + PUSH_L ( ESI ) + + MOV_L ( ARG_IN, ESI ) + MOV_L ( ARG_DEST, EAX ) + MOV_L ( REGOFF(V4F_COUNT, ESI), EDX ) /* dest->count = in->count */ + MOV_L ( EDX, REGOFF(V4F_COUNT, EAX) ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ + MOV_L ( REGOFF(V4F_START, ESI), ECX ) /* in->start */ + + CMP_L ( CONST(0), EDX ) + JE ( LLBL (G3R_end) ) + + FEMMS + + MOVD ( ARG_SCALE, MM0 ) /* scale */ + PUNPCKLDQ ( MM0, MM0 ) + +ALIGNTEXT32 +LLBL (G3R_rescale): + + PREFETCHW ( REGIND(EAX) ) + + MOVQ ( REGIND(ECX), MM1 ) /* x1 | x0 */ + MOVD ( REGOFF(8, ECX), MM2 ) /* | x2 */ + + PFMUL ( MM0, MM1 ) /* x1*scale | x0*scale */ + ADD_L ( STRIDE, ECX ) /* next normal */ + + PREFETCH ( REGIND(ECX) ) + + PFMUL ( MM0, MM2 ) /* | x2*scale */ + ADD_L ( CONST(16), EAX ) /* next r */ + + MOVQ ( MM1, REGOFF(-16, EAX) ) /* write r0, r1 */ + MOVD ( MM2, REGOFF(-8, EAX) ) /* write r2 */ + + SUB_L ( CONST(1), EDX ) /* decrement normal counter */ + JNZ ( LLBL (G3R_rescale) ) + + FEMMS + +LLBL (G3R_end): + POP_L ( ESI ) + POP_L ( EDI ) + RET + +#endif + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/3dnow_xform1.S b/mesalib/src/mesa/x86/3dnow_xform1.S index 9719ba2c1..a73301a8d 100644 --- a/mesalib/src/mesa/x86/3dnow_xform1.S +++ b/mesalib/src/mesa/x86/3dnow_xform1.S @@ -1,437 +1,437 @@ - -/* - * 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. - */ - -#ifdef USE_3DNOW_ASM -#include "assyntax.h" -#include "matypes.h" -#include "xform_args.h" - - SEG_TEXT - -#define FRAME_OFFSET 4 - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points1_general ) -HIDDEN(_mesa_3dnow_transform_points1_general) -GLNAME( _mesa_3dnow_transform_points1_general ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(4, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TPGR_3 ) ) - - MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ - MOVQ ( REGOFF(8, ECX), MM1 ) /* m03 | m02 */ - - MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ - MOVQ ( REGOFF(56, ECX), MM3 ) /* m33 | m32 */ - -ALIGNTEXT16 -LLBL( G3TPGR_2 ): - - MOVD ( REGIND(EAX), MM4 ) /* | x0 */ - PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ - - MOVQ ( MM4, MM5 ) /* x0 | x0 */ - PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ - - PFMUL ( MM1, MM5 ) /* x0*m03 | x0*m02 */ - PFADD ( MM2, MM4 ) /* x0*m01+m31 | x0*m00+m30 */ - - PFADD ( MM3, MM5 ) /* x0*m03+m33 | x0*m02+m32 */ - MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ - - MOVQ ( MM5, REGOFF(8, EDX) ) /* write r3, r2 */ - ADD_L ( EDI, EAX ) /* next vertex */ - - ADD_L ( CONST(16), EDX ) /* next r */ - DEC_L ( ESI ) /* decrement vertex counter */ - - JNZ ( LLBL( G3TPGR_2 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TPGR_3 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points1_identity ) -HIDDEN(_mesa_3dnow_transform_points1_identity) -GLNAME( _mesa_3dnow_transform_points1_identity ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(1), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_1), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(4, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TPIR_4) ) - -ALIGNTEXT16 -LLBL( G3TPIR_3 ): - - MOVD ( REGIND(EAX), MM0 ) /* | x0 */ - ADD_L ( EDI, EAX ) /* next vertex */ - - MOVD ( MM0, REGIND(EDX) ) /* | r0 */ - ADD_L ( CONST(16), EDX ) /* next r */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TPIR_3 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TPIR_4 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points1_3d_no_rot ) -HIDDEN(_mesa_3dnow_transform_points1_3d_no_rot) -GLNAME( _mesa_3dnow_transform_points1_3d_no_rot ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(4, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP3NRR_3 ) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ - - MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ - -ALIGNTEXT16 -LLBL( G3TP3NRR_2 ): - - MOVD ( REGIND(EAX), MM4 ) /* | x0 */ - PFMUL ( MM0, MM4 ) /* | x0*m00 */ - - PFADD ( MM2, MM4 ) /* m31 | x0*m00+m30 */ - MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ - - MOVD ( MM3, REGOFF(8, EDX) ) /* write r2 */ - ADD_L ( EDI, EAX ) /* next vertex */ - - ADD_L ( CONST(16), EDX ) /* next r */ - DEC_L ( ESI ) /* decrement vertex counter */ - - JNZ ( LLBL( G3TP3NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP3NRR_3 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points1_perspective ) -HIDDEN(_mesa_3dnow_transform_points1_perspective) -GLNAME( _mesa_3dnow_transform_points1_perspective ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(4, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TPPR_3 ) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ - -ALIGNTEXT16 -LLBL( G3TPPR_2 ): - - MOVD ( REGIND(EAX), MM4 ) /* 0 | x0 */ - PFMUL ( MM0, MM4 ) /* 0 | x0*m00 */ - - MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ - MOVQ ( MM3, REGOFF(8, EDX) ) /* write r2 (=m32), r3 (=0) */ - - ADD_L ( EDI, EAX ) /* next vertex */ - ADD_L ( CONST(16), EDX ) /* next r */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TPPR_2 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TPPR_3 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points1_2d ) -HIDDEN(_mesa_3dnow_transform_points1_2d) -GLNAME( _mesa_3dnow_transform_points1_2d ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(4, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP2R_3 ) ) - - MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ - MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ - -ALIGNTEXT16 -LLBL( G3TP2R_2 ): - - MOVD ( REGIND(EAX), MM4 ) /* | x0 */ - PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ - - PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ - PFADD ( MM2, MM4 ) /* x0*m01+m31 | x0*m00+m30 */ - - MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ - ADD_L ( EDI, EAX ) /* next vertex */ - - ADD_L ( CONST(16), EDX ) /* next r */ - DEC_L ( ESI ) /* decrement vertex counter */ - - JNZ ( LLBL( G3TP2R_2 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP2R_3 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points1_2d_no_rot ) -HIDDEN(_mesa_3dnow_transform_points1_2d_no_rot) -GLNAME( _mesa_3dnow_transform_points1_2d_no_rot ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(4, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP2NRR_3 ) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ - -ALIGNTEXT16 -LLBL( G3TP2NRR_2 ): - - MOVD ( REGIND(EAX), MM4 ) /* | x0 */ - ADD_L ( EDI, EAX ) /* next vertex */ - - PFMUL ( MM0, MM4 ) /* | x0*m00 */ - PFADD ( MM2, MM4 ) /* m31 | x0*m00+m30 */ - - MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ - ADD_L ( CONST(16), EDX ) /* next r */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TP2NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP2NRR_3 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points1_3d ) -HIDDEN(_mesa_3dnow_transform_points1_3d) -GLNAME( _mesa_3dnow_transform_points1_3d ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(4, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP3R_3 ) ) - - MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ - MOVD ( REGOFF(8, ECX), MM1 ) /* | m02 */ - - MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ - MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ - -ALIGNTEXT16 -LLBL( G3TP3R_2 ): - - MOVD ( REGIND(EAX), MM4 ) /* | x0 */ - PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ - - MOVQ ( MM4, MM5 ) /* | x0 */ - PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ - - PFMUL ( MM1, MM5 ) /* | x0*m02 */ - PFADD ( MM2, MM4 ) /* x0*m01+m31 | x0*m00+m30 */ - - PFADD ( MM3, MM5 ) /* | x0*m02+m32 */ - MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ - - MOVD ( MM5, REGOFF(8, EDX) ) /* write r2 */ - ADD_L ( EDI, EAX ) /* next vertex */ - - ADD_L ( CONST(16), EDX ) /* next r */ - DEC_L ( ESI ) /* decrement vertex counter */ - - JNZ ( LLBL( G3TP3R_2 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP3R_3 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - -#endif - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif + +/* + * 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. + */ + +#ifdef USE_3DNOW_ASM +#include "assyntax.h" +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FRAME_OFFSET 4 + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points1_general ) +HIDDEN(_mesa_3dnow_transform_points1_general) +GLNAME( _mesa_3dnow_transform_points1_general ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(4, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPGR_3 ) ) + + MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ + MOVQ ( REGOFF(8, ECX), MM1 ) /* m03 | m02 */ + + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + MOVQ ( REGOFF(56, ECX), MM3 ) /* m33 | m32 */ + +ALIGNTEXT16 +LLBL( G3TPGR_2 ): + + MOVD ( REGIND(EAX), MM4 ) /* | x0 */ + PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ + + MOVQ ( MM4, MM5 ) /* x0 | x0 */ + PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ + + PFMUL ( MM1, MM5 ) /* x0*m03 | x0*m02 */ + PFADD ( MM2, MM4 ) /* x0*m01+m31 | x0*m00+m30 */ + + PFADD ( MM3, MM5 ) /* x0*m03+m33 | x0*m02+m32 */ + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + + MOVQ ( MM5, REGOFF(8, EDX) ) /* write r3, r2 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TPGR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPGR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points1_identity ) +HIDDEN(_mesa_3dnow_transform_points1_identity) +GLNAME( _mesa_3dnow_transform_points1_identity ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(1), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_1), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(4, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPIR_4) ) + +ALIGNTEXT16 +LLBL( G3TPIR_3 ): + + MOVD ( REGIND(EAX), MM0 ) /* | x0 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + MOVD ( MM0, REGIND(EDX) ) /* | r0 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPIR_3 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPIR_4 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points1_3d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points1_3d_no_rot) +GLNAME( _mesa_3dnow_transform_points1_3d_no_rot ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(4, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3NRR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + + MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ + +ALIGNTEXT16 +LLBL( G3TP3NRR_2 ): + + MOVD ( REGIND(EAX), MM4 ) /* | x0 */ + PFMUL ( MM0, MM4 ) /* | x0*m00 */ + + PFADD ( MM2, MM4 ) /* m31 | x0*m00+m30 */ + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + + MOVD ( MM3, REGOFF(8, EDX) ) /* write r2 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TP3NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3NRR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points1_perspective ) +HIDDEN(_mesa_3dnow_transform_points1_perspective) +GLNAME( _mesa_3dnow_transform_points1_perspective ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(4, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPPR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ + +ALIGNTEXT16 +LLBL( G3TPPR_2 ): + + MOVD ( REGIND(EAX), MM4 ) /* 0 | x0 */ + PFMUL ( MM0, MM4 ) /* 0 | x0*m00 */ + + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + MOVQ ( MM3, REGOFF(8, EDX) ) /* write r2 (=m32), r3 (=0) */ + + ADD_L ( EDI, EAX ) /* next vertex */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPPR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPPR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points1_2d ) +HIDDEN(_mesa_3dnow_transform_points1_2d) +GLNAME( _mesa_3dnow_transform_points1_2d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(4, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2R_3 ) ) + + MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP2R_2 ): + + MOVD ( REGIND(EAX), MM4 ) /* | x0 */ + PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ + + PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ + PFADD ( MM2, MM4 ) /* x0*m01+m31 | x0*m00+m30 */ + + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TP2R_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2R_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points1_2d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points1_2d_no_rot) +GLNAME( _mesa_3dnow_transform_points1_2d_no_rot ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(4, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2NRR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP2NRR_2 ): + + MOVD ( REGIND(EAX), MM4 ) /* | x0 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + PFMUL ( MM0, MM4 ) /* | x0*m00 */ + PFADD ( MM2, MM4 ) /* m31 | x0*m00+m30 */ + + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP2NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2NRR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points1_3d ) +HIDDEN(_mesa_3dnow_transform_points1_3d) +GLNAME( _mesa_3dnow_transform_points1_3d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(4, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3R_3 ) ) + + MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ + MOVD ( REGOFF(8, ECX), MM1 ) /* | m02 */ + + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ + +ALIGNTEXT16 +LLBL( G3TP3R_2 ): + + MOVD ( REGIND(EAX), MM4 ) /* | x0 */ + PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ + + MOVQ ( MM4, MM5 ) /* | x0 */ + PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ + + PFMUL ( MM1, MM5 ) /* | x0*m02 */ + PFADD ( MM2, MM4 ) /* x0*m01+m31 | x0*m00+m30 */ + + PFADD ( MM3, MM5 ) /* | x0*m02+m32 */ + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + + MOVD ( MM5, REGOFF(8, EDX) ) /* write r2 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TP3R_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3R_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + +#endif + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/3dnow_xform2.S b/mesalib/src/mesa/x86/3dnow_xform2.S index 8c706074a..2988fb7bf 100644 --- a/mesalib/src/mesa/x86/3dnow_xform2.S +++ b/mesalib/src/mesa/x86/3dnow_xform2.S @@ -1,477 +1,477 @@ - -/* - * 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. - */ - -#ifdef USE_3DNOW_ASM -#include "assyntax.h" -#include "matypes.h" -#include "xform_args.h" - - SEG_TEXT - -#define FRAME_OFFSET 4 - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points2_general ) -HIDDEN(_mesa_3dnow_transform_points2_general) -GLNAME( _mesa_3dnow_transform_points2_general ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TPGR_3 ) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ - - MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ - - MOVD ( REGOFF(8, ECX), MM2 ) /* | m02 */ - PUNPCKLDQ ( REGOFF(24, ECX), MM2 ) /* m12 | m02 */ - - MOVD ( REGOFF(12, ECX), MM3 ) /* | m03 */ - PUNPCKLDQ ( REGOFF(28, ECX), MM3 ) /* m13 | m03 */ - - MOVQ ( REGOFF(48, ECX), MM4 ) /* m31 | m30 */ - MOVQ ( REGOFF(56, ECX), MM5 ) /* m33 | m32 */ - -ALIGNTEXT16 -LLBL( G3TPGR_2 ): - - MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ - MOVQ ( MM6, MM7 ) /* x1 | x0 */ - - PFMUL ( MM0, MM6 ) /* x1*m10 | x0*m00 */ - PFMUL ( MM1, MM7 ) /* x1*m11 | x0*m01 */ - - PFACC ( MM7, MM6 ) /* x0*m01+x1*m11 | x0*x00+x1*m10 */ - PFADD ( MM4, MM6 ) /* x0*...*m11+m31 | x0*...*m10+m30 */ - - MOVQ ( MM6, REGIND(EDX) ) /* write r1, r0 */ - MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ - - MOVQ ( MM6, MM7 ) /* x1 | x0 */ - PFMUL ( MM2, MM6 ) /* x1*m12 | x0*m02 */ - - PFMUL ( MM3, MM7 ) /* x1*m13 | x0*m03 */ - ADD_L ( EDI, EAX ) /* next vertex */ - - PFACC ( MM7, MM6 ) /* x0*m03+x1*m13 | x0*x02+x1*m12 */ - PFADD ( MM5, MM6 ) /* x0*...*m13+m33 | x0*...*m12+m32 */ - - MOVQ ( MM6, REGOFF(8, EDX) ) /* write r3, r2 */ - ADD_L ( CONST(16), EDX ) /* next r */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TPGR_2 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TPGR_3 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points2_perspective ) -HIDDEN(_mesa_3dnow_transform_points2_perspective) -GLNAME( _mesa_3dnow_transform_points2_perspective ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TPPR_3 ) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ - - MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ - -ALIGNTEXT16 -LLBL( G3TPPR_2 ): - - MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ - PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ - - MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ - MOVQ ( MM3, REGOFF(8, EDX) ) /* write r2 (=m32), r3 (=0) */ - - ADD_L ( EDI, EAX ) /* next vertex */ - ADD_L ( CONST(16), EDX ) /* next r */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TPPR_2 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TPPR_3 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points2_3d ) -HIDDEN(_mesa_3dnow_transform_points2_3d) -GLNAME( _mesa_3dnow_transform_points2_3d ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_3 ), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP3R_3 ) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ - - MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ - - MOVD ( REGOFF(8, ECX), MM2 ) /* | m02 */ - PUNPCKLDQ ( REGOFF(24, ECX), MM2 ) /* m12 | m02 */ - - MOVQ ( REGOFF(48, ECX), MM4 ) /* m31 | m30 */ - MOVD ( REGOFF(56, ECX), MM5 ) /* | m32 */ - -ALIGNTEXT16 -LLBL( G3TP3R_2 ): - - MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ - MOVQ ( MM6, MM7 ) /* x1 | x0 */ - - PFMUL ( MM0, MM6 ) /* x1*m10 | x0*m00 */ - PFMUL ( MM1, MM7 ) /* x1*m11 | x0*m01 */ - - PFACC ( MM7, MM6 ) /* x0*m01+x1*m11 | x0*x00+x1*m10 */ - PFADD ( MM4, MM6 ) /* x0*...*m11+m31 | x0*...*m10+m30 */ - - MOVQ ( MM6, REGIND(EDX) ) /* write r1, r0 */ - MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ - - MOVQ ( MM6, MM7 ) /* x1 | x0 */ - PFMUL ( MM2, MM6 ) /* x1*m12 | x0*m02 */ - - PFACC ( MM7, MM6 ) /* ***trash*** | x0*x02+x1*m12 */ - PFADD ( MM5, MM6 ) /* ***trash*** | x0*...*m12+m32 */ - - MOVD ( MM6, REGOFF(8, EDX) ) /* write r2 */ - ADD_L ( EDI, EAX ) /* next vertex */ - - ADD_L ( CONST(16), EDX ) /* next r */ - DEC_L ( ESI ) /* decrement vertex counter */ - - JNZ ( LLBL( G3TP3R_2 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP3R_3 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points2_3d_no_rot ) -HIDDEN(_mesa_3dnow_transform_points2_3d_no_rot) -GLNAME( _mesa_3dnow_transform_points2_3d_no_rot ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_3 ), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP3NRR_3 ) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ - - MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ - MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ - -ALIGNTEXT16 -LLBL( G3TP3NRR_2 ): - - MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ - PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ - - PFADD ( MM2, MM4 ) /* x1*m11+m31 | x0*m00+m30 */ - MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ - - MOVD ( MM3, REGOFF(8, EDX) ) /* write r2 */ - ADD_L ( EDI, EAX ) /* next vertex */ - - ADD_L ( CONST(16), EDX ) /* next r */ - DEC_L ( ESI ) /* decrement vertex counter */ - - JNZ ( LLBL( G3TP3NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP3NRR_3 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points2_2d ) -HIDDEN(_mesa_3dnow_transform_points2_2d) -GLNAME( _mesa_3dnow_transform_points2_2d ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP2R_3 ) ) - - MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ - MOVQ ( REGOFF(16, ECX), MM1 ) /* m11 | m10 */ - - MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ - -ALIGNTEXT16 -LLBL( G3TP2R_2 ): - - MOVD ( REGIND(EAX), MM4 ) /* | x0 */ - MOVD ( REGOFF(4, EAX), MM5 ) /* | x1 */ - - PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ - ADD_L ( EDI, EAX ) /* next vertex */ - - PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ - PUNPCKLDQ ( MM5, MM5 ) /* x1 | x1 */ - - PFMUL ( MM1, MM5 ) /* x1*m11 | x1*m10 */ - PFADD ( MM2, MM4 ) /* x...x1*m11+31 | x0*..*m10+m30 */ - - PFADD ( MM5, MM4 ) /* x0*m01+x1*m11 | x0*m00+x1*m10 */ - MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ - - ADD_L ( CONST(16), EDX ) /* next r */ - DEC_L ( ESI ) /* decrement vertex counter */ - - JNZ ( LLBL( G3TP2R_2 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP2R_3 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points2_2d_no_rot ) -HIDDEN(_mesa_3dnow_transform_points2_2d_no_rot) -GLNAME( _mesa_3dnow_transform_points2_2d_no_rot ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP2NRR_3 ) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ - - MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ - -ALIGNTEXT16 -LLBL( G3TP2NRR_2 ): - - MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ - ADD_L ( EDI, EAX ) /* next vertex */ - - PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ - PFADD ( MM2, MM4 ) /* m31 | x0*m00+m30 */ - - MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ - ADD_L ( CONST(16), EDX ) /* next r */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TP2NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP2NRR_3 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points2_identity ) -HIDDEN(_mesa_3dnow_transform_points2_identity) -GLNAME( _mesa_3dnow_transform_points2_identity ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TPIR_3 ) ) - -ALIGNTEXT16 -LLBL( G3TPIR_3 ): - - MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ - ADD_L ( EDI, EAX ) /* next vertex */ - - MOVQ ( MM0, REGIND(EDX) ) /* r1 | r0 */ - ADD_L ( CONST(16), EDX ) /* next r */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TPIR_3 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TPIR_4 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET -#endif - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif + +/* + * 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. + */ + +#ifdef USE_3DNOW_ASM +#include "assyntax.h" +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FRAME_OFFSET 4 + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points2_general ) +HIDDEN(_mesa_3dnow_transform_points2_general) +GLNAME( _mesa_3dnow_transform_points2_general ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPGR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ + + MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ + + MOVD ( REGOFF(8, ECX), MM2 ) /* | m02 */ + PUNPCKLDQ ( REGOFF(24, ECX), MM2 ) /* m12 | m02 */ + + MOVD ( REGOFF(12, ECX), MM3 ) /* | m03 */ + PUNPCKLDQ ( REGOFF(28, ECX), MM3 ) /* m13 | m03 */ + + MOVQ ( REGOFF(48, ECX), MM4 ) /* m31 | m30 */ + MOVQ ( REGOFF(56, ECX), MM5 ) /* m33 | m32 */ + +ALIGNTEXT16 +LLBL( G3TPGR_2 ): + + MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ + MOVQ ( MM6, MM7 ) /* x1 | x0 */ + + PFMUL ( MM0, MM6 ) /* x1*m10 | x0*m00 */ + PFMUL ( MM1, MM7 ) /* x1*m11 | x0*m01 */ + + PFACC ( MM7, MM6 ) /* x0*m01+x1*m11 | x0*x00+x1*m10 */ + PFADD ( MM4, MM6 ) /* x0*...*m11+m31 | x0*...*m10+m30 */ + + MOVQ ( MM6, REGIND(EDX) ) /* write r1, r0 */ + MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ + + MOVQ ( MM6, MM7 ) /* x1 | x0 */ + PFMUL ( MM2, MM6 ) /* x1*m12 | x0*m02 */ + + PFMUL ( MM3, MM7 ) /* x1*m13 | x0*m03 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + PFACC ( MM7, MM6 ) /* x0*m03+x1*m13 | x0*x02+x1*m12 */ + PFADD ( MM5, MM6 ) /* x0*...*m13+m33 | x0*...*m12+m32 */ + + MOVQ ( MM6, REGOFF(8, EDX) ) /* write r3, r2 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPGR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPGR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points2_perspective ) +HIDDEN(_mesa_3dnow_transform_points2_perspective) +GLNAME( _mesa_3dnow_transform_points2_perspective ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPPR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ + +ALIGNTEXT16 +LLBL( G3TPPR_2 ): + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + MOVQ ( MM3, REGOFF(8, EDX) ) /* write r2 (=m32), r3 (=0) */ + + ADD_L ( EDI, EAX ) /* next vertex */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPPR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPPR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points2_3d ) +HIDDEN(_mesa_3dnow_transform_points2_3d) +GLNAME( _mesa_3dnow_transform_points2_3d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3 ), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3R_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ + + MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ + + MOVD ( REGOFF(8, ECX), MM2 ) /* | m02 */ + PUNPCKLDQ ( REGOFF(24, ECX), MM2 ) /* m12 | m02 */ + + MOVQ ( REGOFF(48, ECX), MM4 ) /* m31 | m30 */ + MOVD ( REGOFF(56, ECX), MM5 ) /* | m32 */ + +ALIGNTEXT16 +LLBL( G3TP3R_2 ): + + MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ + MOVQ ( MM6, MM7 ) /* x1 | x0 */ + + PFMUL ( MM0, MM6 ) /* x1*m10 | x0*m00 */ + PFMUL ( MM1, MM7 ) /* x1*m11 | x0*m01 */ + + PFACC ( MM7, MM6 ) /* x0*m01+x1*m11 | x0*x00+x1*m10 */ + PFADD ( MM4, MM6 ) /* x0*...*m11+m31 | x0*...*m10+m30 */ + + MOVQ ( MM6, REGIND(EDX) ) /* write r1, r0 */ + MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ + + MOVQ ( MM6, MM7 ) /* x1 | x0 */ + PFMUL ( MM2, MM6 ) /* x1*m12 | x0*m02 */ + + PFACC ( MM7, MM6 ) /* ***trash*** | x0*x02+x1*m12 */ + PFADD ( MM5, MM6 ) /* ***trash*** | x0*...*m12+m32 */ + + MOVD ( MM6, REGOFF(8, EDX) ) /* write r2 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TP3R_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3R_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points2_3d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points2_3d_no_rot) +GLNAME( _mesa_3dnow_transform_points2_3d_no_rot ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3 ), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3NRR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ + +ALIGNTEXT16 +LLBL( G3TP3NRR_2 ): + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + + PFADD ( MM2, MM4 ) /* x1*m11+m31 | x0*m00+m30 */ + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + + MOVD ( MM3, REGOFF(8, EDX) ) /* write r2 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TP3NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3NRR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points2_2d ) +HIDDEN(_mesa_3dnow_transform_points2_2d) +GLNAME( _mesa_3dnow_transform_points2_2d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2R_3 ) ) + + MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ + MOVQ ( REGOFF(16, ECX), MM1 ) /* m11 | m10 */ + + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP2R_2 ): + + MOVD ( REGIND(EAX), MM4 ) /* | x0 */ + MOVD ( REGOFF(4, EAX), MM5 ) /* | x1 */ + + PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ + PUNPCKLDQ ( MM5, MM5 ) /* x1 | x1 */ + + PFMUL ( MM1, MM5 ) /* x1*m11 | x1*m10 */ + PFADD ( MM2, MM4 ) /* x...x1*m11+31 | x0*..*m10+m30 */ + + PFADD ( MM5, MM4 ) /* x0*m01+x1*m11 | x0*m00+x1*m10 */ + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TP2R_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2R_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points2_2d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points2_2d_no_rot) +GLNAME( _mesa_3dnow_transform_points2_2d_no_rot ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2NRR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP2NRR_2 ): + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + PFADD ( MM2, MM4 ) /* m31 | x0*m00+m30 */ + + MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP2NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2NRR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points2_identity ) +HIDDEN(_mesa_3dnow_transform_points2_identity) +GLNAME( _mesa_3dnow_transform_points2_identity ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPIR_3 ) ) + +ALIGNTEXT16 +LLBL( G3TPIR_3 ): + + MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ + ADD_L ( EDI, EAX ) /* next vertex */ + + MOVQ ( MM0, REGIND(EDX) ) /* r1 | r0 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPIR_3 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPIR_4 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET +#endif + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/3dnow_xform3.S b/mesalib/src/mesa/x86/3dnow_xform3.S index d119fe821..a356aaee7 100644 --- a/mesalib/src/mesa/x86/3dnow_xform3.S +++ b/mesalib/src/mesa/x86/3dnow_xform3.S @@ -1,561 +1,561 @@ - -/* - * 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. - */ - -#ifdef USE_3DNOW_ASM -#include "assyntax.h" -#include "matypes.h" -#include "xform_args.h" - - SEG_TEXT - -#define FRAME_OFFSET 4 - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points3_general ) -HIDDEN(_mesa_3dnow_transform_points3_general) -GLNAME( _mesa_3dnow_transform_points3_general ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TPGR_2 ) ) - - PREFETCHW ( REGIND(EDX) ) - -ALIGNTEXT16 -LLBL( G3TPGR_1 ): - - PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ - - MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EAX), MM2 ) /* | x2 */ - - ADD_L ( EDI, EAX ) /* next vertex */ - PREFETCH ( REGIND(EAX) ) - - MOVQ ( MM0, MM1 ) /* x1 | x0 */ - PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ - - PUNPCKLDQ ( MM0, MM0 ) /* x0 | x0 */ - MOVQ ( MM2, MM5 ) /* x2 | x2 */ - - PUNPCKHDQ ( MM1, MM1 ) /* x1 | x1 */ - PFMUL ( REGOFF(32, ECX), MM2 ) /* x2*m9 | x2*m8 */ - - MOVQ ( MM0, MM3 ) /* x0 | x0 */ - PFMUL ( REGOFF(40, ECX), MM5 ) /* x2*m11 | x2*m10 */ - - MOVQ ( MM1, MM4 ) /* x1 | x1 */ - PFMUL ( REGIND(ECX), MM0 ) /* x0*m1 | x0*m0 */ - - PFADD ( REGOFF(48, ECX), MM2 ) /* x2*m9+m13 | x2*m8+m12 */ - PFMUL ( REGOFF(16, ECX), MM1 ) /* x1*m5 | x1*m4 */ - - PFADD ( REGOFF(56, ECX), MM5 ) /* x2*m11+m15 | x2*m10+m14 */ - PFADD ( MM0, MM1 ) /* x0*m1+x1*m5 | x0*m0+x1*m4 */ - - PFMUL ( REGOFF(8, ECX), MM3 ) /* x0*m3 | x0*m2 */ - PFADD ( MM1, MM2 ) /* r1 | r0 */ - - PFMUL ( REGOFF(24, ECX), MM4 ) /* x1*m7 | x1*m6 */ - ADD_L ( CONST(16), EDX ) /* next output vertex */ - - PFADD ( MM3, MM4 ) /* x0*m3+x1*m7 | x0*m2+x1*m6 */ - MOVQ ( MM2, REGOFF(-16, EDX) ) /* write r0, r1 */ - - PFADD ( MM4, MM5 ) /* r3 | r2 */ - MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TPGR_1 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TPGR_2 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points3_perspective ) -HIDDEN(_mesa_3dnow_transform_points3_perspective) -GLNAME( _mesa_3dnow_transform_points3_perspective ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TPPR_2 ) ) - - PREFETCH ( REGIND(EAX) ) - PREFETCHW ( REGIND(EDX) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ - - MOVQ ( REGOFF(32, ECX), MM1 ) /* m21 | m20 */ - MOVD ( REGOFF(40, ECX), MM2 ) /* | m22 */ - - MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ - -ALIGNTEXT16 -LLBL( G3TPPR_1 ): - - PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ - - MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ - MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ - - ADD_L ( EDI, EAX ) /* next vertex */ - PREFETCH ( REGIND(EAX) ) - - PXOR ( MM7, MM7 ) /* 0 | 0 */ - MOVQ ( MM5, MM6 ) /* | x2 */ - - PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ - PFSUB ( MM5, MM7 ) /* | -x2 */ - - PFMUL ( MM2, MM6 ) /* | x2*m22 */ - PUNPCKLDQ ( MM5, MM5 ) /* x2 | x2 */ - - ADD_L ( CONST(16), EDX ) /* next r */ - PFMUL ( MM1, MM5 ) /* x2*m21 | x2*m20 */ - - PFADD ( MM3, MM6 ) /* | x2*m22+m32 */ - PFADD ( MM4, MM5 ) /* x1*m11+x2*m21 | x0*m00+x2*m20 */ - - MOVQ ( MM5, REGOFF(-16, EDX) ) /* write r0, r1 */ - MOVD ( MM6, REGOFF(-8, EDX) ) /* write r2 */ - - MOVD ( MM7, REGOFF(-4, EDX) ) /* write r3 */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TPPR_1 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TPPR_2 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points3_3d ) -HIDDEN(_mesa_3dnow_transform_points3_3d) -GLNAME( _mesa_3dnow_transform_points3_3d ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP3R_2 ) ) - - PREFETCH ( REGIND(EAX) ) - PREFETCH ( REGIND(EDX) ) - - MOVD ( REGOFF(8, ECX), MM7 ) /* | m2 */ - PUNPCKLDQ ( REGOFF(24, ECX), MM7 ) /* m6 | m2 */ - - -ALIGNTEXT16 -LLBL( G3TP3R_1 ): - - PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ - - MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ - - ADD_L ( EDI, EAX ) /* next vertex */ - PREFETCH ( REGIND(EAX) ) - - MOVQ ( MM0, MM2 ) /* x1 | x0 */ - ADD_L ( CONST(16), EDX ) /* next r */ - - PUNPCKLDQ ( MM2, MM2 ) /* x0 | x0 */ - MOVQ ( MM0, MM3 ) /* x1 | x0 */ - - PFMUL ( REGIND(ECX), MM2 ) /* x0*m1 | x0*m0 */ - PUNPCKHDQ ( MM3, MM3 ) /* x1 | x1 */ - - MOVQ ( MM1, MM4 ) /* | x2 */ - PFMUL ( REGOFF(16, ECX), MM3 ) /* x1*m5 | x1*m4 */ - - PUNPCKLDQ ( MM4, MM4 ) /* x2 | x2 */ - PFADD ( MM2, MM3 ) /* x0*m1+x1*m5 | x0*m0+x1*m4 */ - - PFMUL ( REGOFF(32, ECX), MM4 ) /* x2*m9 | x2*m8 */ - PFADD ( REGOFF(48, ECX), MM3 ) /* x0*m1+...+m11 | x0*m0+x1*m4+m12 */ - - PFMUL ( MM7, MM0 ) /* x1*m6 | x0*m2 */ - PFADD ( MM4, MM3 ) /* r1 | r0 */ - - PFMUL ( REGOFF(40, ECX), MM1 ) /* | x2*m10 */ - PUNPCKLDQ ( REGOFF(56, ECX), MM1 ) /* m14 | x2*m10 */ - - PFACC ( MM0, MM1 ) - - MOVQ ( MM3, REGOFF(-16, EDX) ) /* write r0, r1 */ - PFACC ( MM1, MM1 ) /* | r2 */ - - MOVD ( MM1, REGOFF(-8, EDX) ) /* write r2 */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TP3R_1 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP3R_2 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points3_3d_no_rot ) -HIDDEN(_mesa_3dnow_transform_points3_3d_no_rot) -GLNAME( _mesa_3dnow_transform_points3_3d_no_rot ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP3NRR_2 ) ) - - PREFETCH ( REGIND(EAX) ) - PREFETCHW ( REGIND(EDX) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ - - MOVD ( REGOFF(40, ECX), MM2 ) /* | m22 */ - PUNPCKLDQ ( MM2, MM2 ) /* m22 | m22 */ - - MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ - MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ - - PUNPCKLDQ ( MM3, MM3 ) /* m32 | m32 */ - - -ALIGNTEXT16 -LLBL( G3TP3NRR_1 ): - - PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ - - MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ - - ADD_L ( EDI, EAX ) /* next vertex */ - PREFETCHW ( REGIND(EAX) ) - - PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ - - PFADD ( MM1, MM4 ) /* x1*m11+m31 | x0*m00+m30 */ - PFMUL ( MM2, MM5 ) /* | x2*m22 */ - - PFADD ( MM3, MM5 ) /* | x2*m22+m32 */ - MOVQ ( MM4, REGIND(EDX) ) /* write r0, r1 */ - - ADD_L ( CONST(16), EDX ) /* next r */ - DEC_L ( ESI ) /* decrement vertex counter */ - - MOVD ( MM5, REGOFF(-8, EDX) ) /* write r2 */ - JNZ ( LLBL( G3TP3NRR_1 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP3NRR_2 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points3_2d ) -HIDDEN(_mesa_3dnow_transform_points3_2d) -GLNAME( _mesa_3dnow_transform_points3_2d ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP2R_3) ) - - PREFETCH ( REGIND(EAX) ) - PREFETCHW ( REGIND(EDX) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ - - MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ - - MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ - -ALIGNTEXT16 -LLBL( G3TP2R_2 ): - - PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ - - MOVQ ( REGIND(EAX), MM3 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ - - ADD_L ( EDI, EAX ) /* next vertex */ - PREFETCH ( REGIND(EAX) ) - - MOVQ ( MM3, MM4 ) /* x1 | x0 */ - PFMUL ( MM0, MM3 ) /* x1*m10 | x0*m00 */ - - ADD_L ( CONST(16), EDX ) /* next r */ - PFMUL ( MM1, MM4 ) /* x1*m11 | x0*m01 */ - - PFACC ( MM4, MM3 ) /* x0*m00+x1*m10 | x0*m01+x1*m11 */ - MOVD ( MM5, REGOFF(-8, EDX) ) /* write r2 (=x2) */ - - PFADD ( MM2, MM3 ) /* x0*...*m10+m30 | x0*...*m11+m31 */ - MOVQ ( MM3, REGOFF(-16, EDX) ) /* write r0, r1 */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TP2R_2 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP2R_3 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points3_2d_no_rot ) -HIDDEN(_mesa_3dnow_transform_points3_2d_no_rot) -GLNAME( _mesa_3dnow_transform_points3_2d_no_rot ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP2NRR_2 ) ) - - PREFETCH ( REGIND(EAX) ) - PREFETCHW ( REGIND(EDX) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ - - MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ - - -ALIGNTEXT16 -LLBL( G3TP2NRR_1 ): - - PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ - - MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ - - ADD_L ( EDI, EAX ) /* next vertex */ - PREFETCH ( REGIND(EAX) ) - - PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ - ADD_L ( CONST(16), EDX ) /* next r */ - - PFADD ( MM1, MM4 ) /* x1*m11+m31 | x0*m00+m30 */ - - MOVQ ( MM4, REGOFF(-16, EDX) ) /* write r0, r1 */ - MOVD ( MM5, REGOFF(-8, EDX) ) /* write r2 (=x2) */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TP2NRR_1 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP2NRR_2 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points3_identity ) -HIDDEN(_mesa_3dnow_transform_points3_identity) -GLNAME( _mesa_3dnow_transform_points3_identity ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TPIR_2 ) ) - - PREFETCHW ( REGIND(EDX) ) - -ALIGNTEXT16 -LLBL( G3TPIR_1 ): - - PREFETCHW ( REGOFF(32, EDX) ) - - MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ - - ADD_L ( EDI, EAX ) /* next vertex */ - ADD_L ( CONST(16), EDX ) /* next r */ - - DEC_L ( ESI ) /* decrement vertex counter */ - MOVQ ( MM0, REGOFF(-16, EDX) ) /* r1 | r0 */ - - MOVD ( MM1, REGOFF(-8, EDX) ) /* | r2 */ - JNZ ( LLBL( G3TPIR_1 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TPIR_2 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET -#endif - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif + +/* + * 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. + */ + +#ifdef USE_3DNOW_ASM +#include "assyntax.h" +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FRAME_OFFSET 4 + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points3_general ) +HIDDEN(_mesa_3dnow_transform_points3_general) +GLNAME( _mesa_3dnow_transform_points3_general ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPGR_2 ) ) + + PREFETCHW ( REGIND(EDX) ) + +ALIGNTEXT16 +LLBL( G3TPGR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM2 ) /* | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + MOVQ ( MM0, MM1 ) /* x1 | x0 */ + PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ + + PUNPCKLDQ ( MM0, MM0 ) /* x0 | x0 */ + MOVQ ( MM2, MM5 ) /* x2 | x2 */ + + PUNPCKHDQ ( MM1, MM1 ) /* x1 | x1 */ + PFMUL ( REGOFF(32, ECX), MM2 ) /* x2*m9 | x2*m8 */ + + MOVQ ( MM0, MM3 ) /* x0 | x0 */ + PFMUL ( REGOFF(40, ECX), MM5 ) /* x2*m11 | x2*m10 */ + + MOVQ ( MM1, MM4 ) /* x1 | x1 */ + PFMUL ( REGIND(ECX), MM0 ) /* x0*m1 | x0*m0 */ + + PFADD ( REGOFF(48, ECX), MM2 ) /* x2*m9+m13 | x2*m8+m12 */ + PFMUL ( REGOFF(16, ECX), MM1 ) /* x1*m5 | x1*m4 */ + + PFADD ( REGOFF(56, ECX), MM5 ) /* x2*m11+m15 | x2*m10+m14 */ + PFADD ( MM0, MM1 ) /* x0*m1+x1*m5 | x0*m0+x1*m4 */ + + PFMUL ( REGOFF(8, ECX), MM3 ) /* x0*m3 | x0*m2 */ + PFADD ( MM1, MM2 ) /* r1 | r0 */ + + PFMUL ( REGOFF(24, ECX), MM4 ) /* x1*m7 | x1*m6 */ + ADD_L ( CONST(16), EDX ) /* next output vertex */ + + PFADD ( MM3, MM4 ) /* x0*m3+x1*m7 | x0*m2+x1*m6 */ + MOVQ ( MM2, REGOFF(-16, EDX) ) /* write r0, r1 */ + + PFADD ( MM4, MM5 ) /* r3 | r2 */ + MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPGR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPGR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points3_perspective ) +HIDDEN(_mesa_3dnow_transform_points3_perspective) +GLNAME( _mesa_3dnow_transform_points3_perspective ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPPR_2 ) ) + + PREFETCH ( REGIND(EAX) ) + PREFETCHW ( REGIND(EDX) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVQ ( REGOFF(32, ECX), MM1 ) /* m21 | m20 */ + MOVD ( REGOFF(40, ECX), MM2 ) /* | m22 */ + + MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ + +ALIGNTEXT16 +LLBL( G3TPPR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + PXOR ( MM7, MM7 ) /* 0 | 0 */ + MOVQ ( MM5, MM6 ) /* | x2 */ + + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + PFSUB ( MM5, MM7 ) /* | -x2 */ + + PFMUL ( MM2, MM6 ) /* | x2*m22 */ + PUNPCKLDQ ( MM5, MM5 ) /* x2 | x2 */ + + ADD_L ( CONST(16), EDX ) /* next r */ + PFMUL ( MM1, MM5 ) /* x2*m21 | x2*m20 */ + + PFADD ( MM3, MM6 ) /* | x2*m22+m32 */ + PFADD ( MM4, MM5 ) /* x1*m11+x2*m21 | x0*m00+x2*m20 */ + + MOVQ ( MM5, REGOFF(-16, EDX) ) /* write r0, r1 */ + MOVD ( MM6, REGOFF(-8, EDX) ) /* write r2 */ + + MOVD ( MM7, REGOFF(-4, EDX) ) /* write r3 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPPR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPPR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points3_3d ) +HIDDEN(_mesa_3dnow_transform_points3_3d) +GLNAME( _mesa_3dnow_transform_points3_3d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3R_2 ) ) + + PREFETCH ( REGIND(EAX) ) + PREFETCH ( REGIND(EDX) ) + + MOVD ( REGOFF(8, ECX), MM7 ) /* | m2 */ + PUNPCKLDQ ( REGOFF(24, ECX), MM7 ) /* m6 | m2 */ + + +ALIGNTEXT16 +LLBL( G3TP3R_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + MOVQ ( MM0, MM2 ) /* x1 | x0 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + PUNPCKLDQ ( MM2, MM2 ) /* x0 | x0 */ + MOVQ ( MM0, MM3 ) /* x1 | x0 */ + + PFMUL ( REGIND(ECX), MM2 ) /* x0*m1 | x0*m0 */ + PUNPCKHDQ ( MM3, MM3 ) /* x1 | x1 */ + + MOVQ ( MM1, MM4 ) /* | x2 */ + PFMUL ( REGOFF(16, ECX), MM3 ) /* x1*m5 | x1*m4 */ + + PUNPCKLDQ ( MM4, MM4 ) /* x2 | x2 */ + PFADD ( MM2, MM3 ) /* x0*m1+x1*m5 | x0*m0+x1*m4 */ + + PFMUL ( REGOFF(32, ECX), MM4 ) /* x2*m9 | x2*m8 */ + PFADD ( REGOFF(48, ECX), MM3 ) /* x0*m1+...+m11 | x0*m0+x1*m4+m12 */ + + PFMUL ( MM7, MM0 ) /* x1*m6 | x0*m2 */ + PFADD ( MM4, MM3 ) /* r1 | r0 */ + + PFMUL ( REGOFF(40, ECX), MM1 ) /* | x2*m10 */ + PUNPCKLDQ ( REGOFF(56, ECX), MM1 ) /* m14 | x2*m10 */ + + PFACC ( MM0, MM1 ) + + MOVQ ( MM3, REGOFF(-16, EDX) ) /* write r0, r1 */ + PFACC ( MM1, MM1 ) /* | r2 */ + + MOVD ( MM1, REGOFF(-8, EDX) ) /* write r2 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP3R_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3R_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points3_3d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points3_3d_no_rot) +GLNAME( _mesa_3dnow_transform_points3_3d_no_rot ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3NRR_2 ) ) + + PREFETCH ( REGIND(EAX) ) + PREFETCHW ( REGIND(EDX) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVD ( REGOFF(40, ECX), MM2 ) /* | m22 */ + PUNPCKLDQ ( MM2, MM2 ) /* m22 | m22 */ + + MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ + MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ + + PUNPCKLDQ ( MM3, MM3 ) /* m32 | m32 */ + + +ALIGNTEXT16 +LLBL( G3TP3NRR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCHW ( REGIND(EAX) ) + + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + + PFADD ( MM1, MM4 ) /* x1*m11+m31 | x0*m00+m30 */ + PFMUL ( MM2, MM5 ) /* | x2*m22 */ + + PFADD ( MM3, MM5 ) /* | x2*m22+m32 */ + MOVQ ( MM4, REGIND(EDX) ) /* write r0, r1 */ + + ADD_L ( CONST(16), EDX ) /* next r */ + DEC_L ( ESI ) /* decrement vertex counter */ + + MOVD ( MM5, REGOFF(-8, EDX) ) /* write r2 */ + JNZ ( LLBL( G3TP3NRR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3NRR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points3_2d ) +HIDDEN(_mesa_3dnow_transform_points3_2d) +GLNAME( _mesa_3dnow_transform_points3_2d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2R_3) ) + + PREFETCH ( REGIND(EAX) ) + PREFETCHW ( REGIND(EDX) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ + + MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ + + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP2R_2 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM3 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + MOVQ ( MM3, MM4 ) /* x1 | x0 */ + PFMUL ( MM0, MM3 ) /* x1*m10 | x0*m00 */ + + ADD_L ( CONST(16), EDX ) /* next r */ + PFMUL ( MM1, MM4 ) /* x1*m11 | x0*m01 */ + + PFACC ( MM4, MM3 ) /* x0*m00+x1*m10 | x0*m01+x1*m11 */ + MOVD ( MM5, REGOFF(-8, EDX) ) /* write r2 (=x2) */ + + PFADD ( MM2, MM3 ) /* x0*...*m10+m30 | x0*...*m11+m31 */ + MOVQ ( MM3, REGOFF(-16, EDX) ) /* write r0, r1 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP2R_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2R_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points3_2d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points3_2d_no_rot) +GLNAME( _mesa_3dnow_transform_points3_2d_no_rot ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2NRR_2 ) ) + + PREFETCH ( REGIND(EAX) ) + PREFETCHW ( REGIND(EDX) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ + + +ALIGNTEXT16 +LLBL( G3TP2NRR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + PFADD ( MM1, MM4 ) /* x1*m11+m31 | x0*m00+m30 */ + + MOVQ ( MM4, REGOFF(-16, EDX) ) /* write r0, r1 */ + MOVD ( MM5, REGOFF(-8, EDX) ) /* write r2 (=x2) */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP2NRR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2NRR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points3_identity ) +HIDDEN(_mesa_3dnow_transform_points3_identity) +GLNAME( _mesa_3dnow_transform_points3_identity ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPIR_2 ) ) + + PREFETCHW ( REGIND(EDX) ) + +ALIGNTEXT16 +LLBL( G3TPIR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) + + MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + ADD_L ( CONST(16), EDX ) /* next r */ + + DEC_L ( ESI ) /* decrement vertex counter */ + MOVQ ( MM0, REGOFF(-16, EDX) ) /* r1 | r0 */ + + MOVD ( MM1, REGOFF(-8, EDX) ) /* | r2 */ + JNZ ( LLBL( G3TPIR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPIR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET +#endif + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/3dnow_xform4.S b/mesalib/src/mesa/x86/3dnow_xform4.S index 3a9b97160..b2b7c64f2 100644 --- a/mesalib/src/mesa/x86/3dnow_xform4.S +++ b/mesalib/src/mesa/x86/3dnow_xform4.S @@ -1,570 +1,570 @@ - -/* - * 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. - */ - -#ifdef USE_3DNOW_ASM -#include "assyntax.h" -#include "matypes.h" -#include "xform_args.h" - - SEG_TEXT - -#define FRAME_OFFSET 4 - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points4_general ) -HIDDEN(_mesa_3dnow_transform_points4_general) -GLNAME( _mesa_3dnow_transform_points4_general ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TPGR_2 ) ) - - PREFETCHW ( REGIND(EDX) ) - -ALIGNTEXT16 -LLBL( G3TPGR_1 ): - - PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ - - MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ - MOVQ ( REGOFF(8, EAX), MM4 ) /* x3 | x2 */ - - ADD_L ( EDI, EAX ) /* next vertex */ - PREFETCH ( REGIND(EAX) ) - - MOVQ ( MM0, MM2 ) /* x1 | x0 */ - MOVQ ( MM4, MM6 ) /* x3 | x2 */ - - PUNPCKLDQ ( MM0, MM0 ) /* x0 | x0 */ - PUNPCKHDQ ( MM2, MM2 ) /* x1 | x1 */ - - MOVQ ( MM0, MM1 ) /* x0 | x0 */ - ADD_L ( CONST(16), EDX ) /* next r */ - - PFMUL ( REGIND(ECX), MM0 ) /* x0*m1 | x0*m0 */ - MOVQ ( MM2, MM3 ) /* x1 | x1 */ - - PFMUL ( REGOFF(8, ECX), MM1 ) /* x0*m3 | x0*m2 */ - PUNPCKLDQ ( MM4, MM4 ) /* x2 | x2 */ - - PFMUL ( REGOFF(16, ECX), MM2 ) /* x1*m5 | x1*m4 */ - MOVQ ( MM4, MM5 ) /* x2 | x2 */ - - PFMUL ( REGOFF(24, ECX), MM3 ) /* x1*m7 | x1*m6 */ - PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ - - PFMUL ( REGOFF(32, ECX), MM4 ) /* x2*m9 | x2*m8 */ - MOVQ ( MM6, MM7 ) /* x3 | x3 */ - - PFMUL ( REGOFF(40, ECX), MM5 ) /* x2*m11 | x2*m10 */ - PFADD ( MM0, MM2 ) - - PFMUL ( REGOFF(48, ECX), MM6 ) /* x3*m13 | x3*m12 */ - PFADD ( MM1, MM3 ) - - PFMUL ( REGOFF(56, ECX), MM7 ) /* x3*m15 | x3*m14 */ - PFADD ( MM4, MM6 ) - - PFADD ( MM5, MM7 ) - PFADD ( MM2, MM6 ) - - PFADD ( MM3, MM7 ) - MOVQ ( MM6, REGOFF(-16, EDX) ) - - MOVQ ( MM7, REGOFF(-8, EDX) ) - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TPGR_1 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TPGR_2 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points4_perspective ) -HIDDEN(_mesa_3dnow_transform_points4_perspective) -GLNAME( _mesa_3dnow_transform_points4_perspective ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TPPR_2 ) ) - - PREFETCH ( REGIND(EAX) ) - PREFETCHW ( REGIND(EDX) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ - - MOVD ( REGOFF(40, ECX), MM1 ) /* | m22 */ - PUNPCKLDQ ( REGOFF(56, ECX), MM1 ) /* m32 | m22 */ - - MOVQ ( REGOFF(32, ECX), MM2 ) /* m21 | m20 */ - PXOR ( MM7, MM7 ) /* 0 | 0 */ - -ALIGNTEXT16 -LLBL( G3TPPR_1 ): - - PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ - - MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ - MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ - MOVD ( REGOFF(8, EAX), MM3 ) /* | x2 */ - - ADD_L ( EDI, EAX ) /* next vertex */ - PREFETCH ( REGOFF(32, EAX) ) /* hopefully stride is zero */ - - MOVQ ( MM5, MM6 ) /* x3 | x2 */ - PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ - - PUNPCKLDQ ( MM5, MM5 ) /* x2 | x2 */ - ADD_L ( CONST(16), EDX ) /* next r */ - - PFMUL ( MM2, MM5 ) /* x2*m21 | x2*m20 */ - PFSUBR ( MM7, MM3 ) /* | -x2 */ - - PFMUL ( MM1, MM6 ) /* x3*m32 | x2*m22 */ - PFADD ( MM4, MM5 ) /* x1*m11+x2*m21 | x0*m00+x2*m20 */ - - PFACC ( MM3, MM6 ) /* -x2 | x2*m22+x3*m32 */ - MOVQ ( MM5, REGOFF(-16, EDX) ) /* write r0, r1 */ - - MOVQ ( MM6, REGOFF(-8, EDX) ) /* write r2, r3 */ - DEC_L ( ESI ) /* decrement vertex counter */ - - JNZ ( LLBL( G3TPPR_1 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TPPR_2 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points4_3d ) -HIDDEN(_mesa_3dnow_transform_points4_3d) -GLNAME( _mesa_3dnow_transform_points4_3d ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP3R_2 ) ) - - MOVD ( REGOFF(8, ECX), MM6 ) /* | m2 */ - PUNPCKLDQ ( REGOFF(24, ECX), MM6 ) /* m6 | m2 */ - - MOVD ( REGOFF(40, ECX), MM7 ) /* | m10 */ - PUNPCKLDQ ( REGOFF(56, ECX), MM7 ) /* m14 | m10 */ - -ALIGNTEXT16 -LLBL( G3TP3R_1 ): - - PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ - PREFETCH ( REGOFF(32, EAX) ) /* hopefully array is tightly packed */ - - MOVQ ( REGIND(EAX), MM2 ) /* x1 | x0 */ - MOVQ ( REGOFF(8, EAX), MM3 ) /* x3 | x2 */ - - MOVQ ( MM2, MM0 ) /* x1 | x0 */ - MOVQ ( MM3, MM4 ) /* x3 | x2 */ - - MOVQ ( MM0, MM1 ) /* x1 | x0 */ - MOVQ ( MM4, MM5 ) /* x3 | x2 */ - - PUNPCKLDQ ( MM0, MM0 ) /* x0 | x0 */ - PUNPCKHDQ ( MM1, MM1 ) /* x1 | x1 */ - - PFMUL ( REGIND(ECX), MM0 ) /* x0*m1 | x0*m0 */ - PUNPCKLDQ ( MM3, MM3 ) /* x2 | x2 */ - - PFMUL ( REGOFF(16, ECX), MM1 ) /* x1*m5 | x1*m4 */ - PUNPCKHDQ ( MM4, MM4 ) /* x3 | x3 */ - - PFMUL ( MM6, MM2 ) /* x1*m6 | x0*m2 */ - PFADD ( MM0, MM1 ) /* x0*m1+x1*m5 | x0*m0+x1*m4 */ - - PFMUL ( REGOFF(32, ECX), MM3 ) /* x2*m9 | x2*m8 */ - ADD_L ( CONST(16), EDX ) /* next r */ - - PFMUL ( REGOFF(48, ECX), MM4 ) /* x3*m13 | x3*m12 */ - PFADD ( MM1, MM3 ) /* x0*m1+..+x2*m9 | x0*m0+...+x2*m8 */ - - PFMUL ( MM7, MM5 ) /* x3*m14 | x2*m10 */ - PFADD ( MM3, MM4 ) /* r1 | r0 */ - - PFACC ( MM2, MM5 ) /* x0*m2+x1*m6 | x2*m10+x3*m14 */ - MOVD ( REGOFF(12, EAX), MM0 ) /* | x3 */ - - ADD_L ( EDI, EAX ) /* next vertex */ - PFACC ( MM0, MM5 ) /* r3 | r2 */ - - MOVQ ( MM4, REGOFF(-16, EDX) ) /* write r0, r1 */ - MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TP3R_1 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP3R_2 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points4_3d_no_rot ) -HIDDEN(_mesa_3dnow_transform_points4_3d_no_rot) -GLNAME( _mesa_3dnow_transform_points4_3d_no_rot ): - - PUSH_L ( ESI ) - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP3NRR_2 ) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ - - MOVD ( REGOFF(40, ECX), MM2 ) /* | m22 */ - PUNPCKLDQ ( REGOFF(56, ECX), MM2 ) /* m32 | m22 */ - - MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ - -ALIGNTEXT16 -LLBL( G3TP3NRR_1 ): - - PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ - - MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ - MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ - MOVD ( REGOFF(12, EAX), MM7 ) /* | x3 */ - - ADD_L ( EDI, EAX ) /* next vertex */ - PREFETCH ( REGOFF(32, EAX) ) /* hopefully stride is zero */ - - MOVQ ( MM5, MM6 ) /* x3 | x2 */ - PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ - - PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ - PFMUL ( MM2, MM5 ) /* x3*m32 | x2*m22 */ - - PFMUL ( MM1, MM6 ) /* x3*m31 | x3*m30 */ - PFACC ( MM7, MM5 ) /* x3 | x2*m22+x3*m32 */ - - PFADD ( MM6, MM4 ) /* x1*m11+x3*m31 | x0*m00+x3*m30 */ - ADD_L ( CONST(16), EDX ) /* next r */ - - MOVQ ( MM4, REGOFF(-16, EDX) ) /* write r0, r1 */ - MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TP3NRR_1 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP3NRR_2 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points4_2d ) -HIDDEN(_mesa_3dnow_transform_points4_2d) -GLNAME( _mesa_3dnow_transform_points4_2d ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP2R_2 ) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ - - MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ - - MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ - -ALIGNTEXT16 -LLBL( G3TP2R_1 ): - - PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ - - MOVQ ( REGIND(EAX), MM3 ) /* x1 | x0 */ - MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ - - ADD_L ( EDI, EAX ) /* next vertex */ - PREFETCH ( REGIND(EAX) ) - - MOVQ ( MM3, MM4 ) /* x1 | x0 */ - MOVQ ( MM5, MM6 ) /* x3 | x2 */ - - PFMUL ( MM1, MM4 ) /* x1*m11 | x0*m01 */ - PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ - - PFMUL ( MM0, MM3 ) /* x1*m10 | x0*m00 */ - ADD_L ( CONST(16), EDX ) /* next r */ - - PFACC ( MM4, MM3 ) /* x0*m01+x1*m11 | x0*m00+x1*m10 */ - PFMUL ( MM2, MM6 ) /* x3*m31 | x3*m30 */ - - PFADD ( MM6, MM3 ) /* r1 | r0 */ - MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ - - MOVQ ( MM3, REGOFF(-16, EDX) ) /* write r0, r1 */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TP2R_1 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP2R_2 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points4_2d_no_rot ) -HIDDEN(_mesa_3dnow_transform_points4_2d_no_rot) -GLNAME( _mesa_3dnow_transform_points4_2d_no_rot ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TP2NRR_3 ) ) - - MOVD ( REGIND(ECX), MM0 ) /* | m00 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ - - MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ - -ALIGNTEXT16 -LLBL( G3TP2NRR_2 ): - - PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ - - MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ - MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ - - ADD_L ( EDI, EAX ) /* next vertex */ - PREFETCH ( REGIND(EAX) ) - - PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ - MOVQ ( MM5, MM6 ) /* x3 | x2 */ - - ADD_L ( CONST(16), EDX ) /* next r */ - PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ - - PFMUL ( MM1, MM6 ) /* x3*m31 | x3*m30 */ - PFADD ( MM4, MM6 ) /* x1*m11+x3*m31 | x0*m00+x3*m30 */ - - MOVQ ( MM6, REGOFF(-16, EDX) ) /* write r0, r1 */ - MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ - - DEC_L ( ESI ) /* decrement vertex counter */ - - JNZ ( LLBL( G3TP2NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TP2NRR_3 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_3dnow_transform_points4_identity ) -HIDDEN(_mesa_3dnow_transform_points4_identity) -GLNAME( _mesa_3dnow_transform_points4_identity ): - - PUSH_L ( ESI ) - - MOV_L ( ARG_DEST, ECX ) - MOV_L ( ARG_MATRIX, ESI ) - MOV_L ( ARG_SOURCE, EAX ) - MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) - OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) - MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) - - PUSH_L ( EDI ) - - MOV_L ( REGOFF(V4F_START, ECX), EDX ) - MOV_L ( ESI, ECX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) - MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) - - TEST_L ( ESI, ESI ) - JZ ( LLBL( G3TPIR_2 ) ) - -ALIGNTEXT16 -LLBL( G3TPIR_1 ): - - PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ - - MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ - MOVQ ( REGOFF(8, EAX), MM1 ) /* x3 | x2 */ - - ADD_L ( EDI, EAX ) /* next vertex */ - PREFETCH ( REGIND(EAX) ) - - ADD_L ( CONST(16), EDX ) /* next r */ - MOVQ ( MM0, REGOFF(-16, EDX) ) /* r1 | r0 */ - - MOVQ ( MM1, REGOFF(-8, EDX) ) /* r3 | r2 */ - - DEC_L ( ESI ) /* decrement vertex counter */ - JNZ ( LLBL( G3TPIR_1 ) ) /* cnt > 0 ? -> process next vertex */ - -LLBL( G3TPIR_2 ): - - FEMMS - POP_L ( EDI ) - POP_L ( ESI ) - RET -#endif - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif + +/* + * 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. + */ + +#ifdef USE_3DNOW_ASM +#include "assyntax.h" +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FRAME_OFFSET 4 + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points4_general ) +HIDDEN(_mesa_3dnow_transform_points4_general) +GLNAME( _mesa_3dnow_transform_points4_general ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPGR_2 ) ) + + PREFETCHW ( REGIND(EDX) ) + +ALIGNTEXT16 +LLBL( G3TPGR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ + MOVQ ( REGOFF(8, EAX), MM4 ) /* x3 | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + MOVQ ( MM0, MM2 ) /* x1 | x0 */ + MOVQ ( MM4, MM6 ) /* x3 | x2 */ + + PUNPCKLDQ ( MM0, MM0 ) /* x0 | x0 */ + PUNPCKHDQ ( MM2, MM2 ) /* x1 | x1 */ + + MOVQ ( MM0, MM1 ) /* x0 | x0 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + PFMUL ( REGIND(ECX), MM0 ) /* x0*m1 | x0*m0 */ + MOVQ ( MM2, MM3 ) /* x1 | x1 */ + + PFMUL ( REGOFF(8, ECX), MM1 ) /* x0*m3 | x0*m2 */ + PUNPCKLDQ ( MM4, MM4 ) /* x2 | x2 */ + + PFMUL ( REGOFF(16, ECX), MM2 ) /* x1*m5 | x1*m4 */ + MOVQ ( MM4, MM5 ) /* x2 | x2 */ + + PFMUL ( REGOFF(24, ECX), MM3 ) /* x1*m7 | x1*m6 */ + PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ + + PFMUL ( REGOFF(32, ECX), MM4 ) /* x2*m9 | x2*m8 */ + MOVQ ( MM6, MM7 ) /* x3 | x3 */ + + PFMUL ( REGOFF(40, ECX), MM5 ) /* x2*m11 | x2*m10 */ + PFADD ( MM0, MM2 ) + + PFMUL ( REGOFF(48, ECX), MM6 ) /* x3*m13 | x3*m12 */ + PFADD ( MM1, MM3 ) + + PFMUL ( REGOFF(56, ECX), MM7 ) /* x3*m15 | x3*m14 */ + PFADD ( MM4, MM6 ) + + PFADD ( MM5, MM7 ) + PFADD ( MM2, MM6 ) + + PFADD ( MM3, MM7 ) + MOVQ ( MM6, REGOFF(-16, EDX) ) + + MOVQ ( MM7, REGOFF(-8, EDX) ) + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPGR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPGR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points4_perspective ) +HIDDEN(_mesa_3dnow_transform_points4_perspective) +GLNAME( _mesa_3dnow_transform_points4_perspective ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPPR_2 ) ) + + PREFETCH ( REGIND(EAX) ) + PREFETCHW ( REGIND(EDX) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVD ( REGOFF(40, ECX), MM1 ) /* | m22 */ + PUNPCKLDQ ( REGOFF(56, ECX), MM1 ) /* m32 | m22 */ + + MOVQ ( REGOFF(32, ECX), MM2 ) /* m21 | m20 */ + PXOR ( MM7, MM7 ) /* 0 | 0 */ + +ALIGNTEXT16 +LLBL( G3TPPR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ + MOVD ( REGOFF(8, EAX), MM3 ) /* | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGOFF(32, EAX) ) /* hopefully stride is zero */ + + MOVQ ( MM5, MM6 ) /* x3 | x2 */ + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + + PUNPCKLDQ ( MM5, MM5 ) /* x2 | x2 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + PFMUL ( MM2, MM5 ) /* x2*m21 | x2*m20 */ + PFSUBR ( MM7, MM3 ) /* | -x2 */ + + PFMUL ( MM1, MM6 ) /* x3*m32 | x2*m22 */ + PFADD ( MM4, MM5 ) /* x1*m11+x2*m21 | x0*m00+x2*m20 */ + + PFACC ( MM3, MM6 ) /* -x2 | x2*m22+x3*m32 */ + MOVQ ( MM5, REGOFF(-16, EDX) ) /* write r0, r1 */ + + MOVQ ( MM6, REGOFF(-8, EDX) ) /* write r2, r3 */ + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TPPR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPPR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points4_3d ) +HIDDEN(_mesa_3dnow_transform_points4_3d) +GLNAME( _mesa_3dnow_transform_points4_3d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3R_2 ) ) + + MOVD ( REGOFF(8, ECX), MM6 ) /* | m2 */ + PUNPCKLDQ ( REGOFF(24, ECX), MM6 ) /* m6 | m2 */ + + MOVD ( REGOFF(40, ECX), MM7 ) /* | m10 */ + PUNPCKLDQ ( REGOFF(56, ECX), MM7 ) /* m14 | m10 */ + +ALIGNTEXT16 +LLBL( G3TP3R_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + PREFETCH ( REGOFF(32, EAX) ) /* hopefully array is tightly packed */ + + MOVQ ( REGIND(EAX), MM2 ) /* x1 | x0 */ + MOVQ ( REGOFF(8, EAX), MM3 ) /* x3 | x2 */ + + MOVQ ( MM2, MM0 ) /* x1 | x0 */ + MOVQ ( MM3, MM4 ) /* x3 | x2 */ + + MOVQ ( MM0, MM1 ) /* x1 | x0 */ + MOVQ ( MM4, MM5 ) /* x3 | x2 */ + + PUNPCKLDQ ( MM0, MM0 ) /* x0 | x0 */ + PUNPCKHDQ ( MM1, MM1 ) /* x1 | x1 */ + + PFMUL ( REGIND(ECX), MM0 ) /* x0*m1 | x0*m0 */ + PUNPCKLDQ ( MM3, MM3 ) /* x2 | x2 */ + + PFMUL ( REGOFF(16, ECX), MM1 ) /* x1*m5 | x1*m4 */ + PUNPCKHDQ ( MM4, MM4 ) /* x3 | x3 */ + + PFMUL ( MM6, MM2 ) /* x1*m6 | x0*m2 */ + PFADD ( MM0, MM1 ) /* x0*m1+x1*m5 | x0*m0+x1*m4 */ + + PFMUL ( REGOFF(32, ECX), MM3 ) /* x2*m9 | x2*m8 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + PFMUL ( REGOFF(48, ECX), MM4 ) /* x3*m13 | x3*m12 */ + PFADD ( MM1, MM3 ) /* x0*m1+..+x2*m9 | x0*m0+...+x2*m8 */ + + PFMUL ( MM7, MM5 ) /* x3*m14 | x2*m10 */ + PFADD ( MM3, MM4 ) /* r1 | r0 */ + + PFACC ( MM2, MM5 ) /* x0*m2+x1*m6 | x2*m10+x3*m14 */ + MOVD ( REGOFF(12, EAX), MM0 ) /* | x3 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PFACC ( MM0, MM5 ) /* r3 | r2 */ + + MOVQ ( MM4, REGOFF(-16, EDX) ) /* write r0, r1 */ + MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP3R_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3R_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points4_3d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points4_3d_no_rot) +GLNAME( _mesa_3dnow_transform_points4_3d_no_rot ): + + PUSH_L ( ESI ) + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP3NRR_2 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVD ( REGOFF(40, ECX), MM2 ) /* | m22 */ + PUNPCKLDQ ( REGOFF(56, ECX), MM2 ) /* m32 | m22 */ + + MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP3NRR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ + MOVD ( REGOFF(12, EAX), MM7 ) /* | x3 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGOFF(32, EAX) ) /* hopefully stride is zero */ + + MOVQ ( MM5, MM6 ) /* x3 | x2 */ + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + + PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ + PFMUL ( MM2, MM5 ) /* x3*m32 | x2*m22 */ + + PFMUL ( MM1, MM6 ) /* x3*m31 | x3*m30 */ + PFACC ( MM7, MM5 ) /* x3 | x2*m22+x3*m32 */ + + PFADD ( MM6, MM4 ) /* x1*m11+x3*m31 | x0*m00+x3*m30 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + MOVQ ( MM4, REGOFF(-16, EDX) ) /* write r0, r1 */ + MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP3NRR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP3NRR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points4_2d ) +HIDDEN(_mesa_3dnow_transform_points4_2d) +GLNAME( _mesa_3dnow_transform_points4_2d ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2R_2 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ + + MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ + + MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP2R_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM3 ) /* x1 | x0 */ + MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + MOVQ ( MM3, MM4 ) /* x1 | x0 */ + MOVQ ( MM5, MM6 ) /* x3 | x2 */ + + PFMUL ( MM1, MM4 ) /* x1*m11 | x0*m01 */ + PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ + + PFMUL ( MM0, MM3 ) /* x1*m10 | x0*m00 */ + ADD_L ( CONST(16), EDX ) /* next r */ + + PFACC ( MM4, MM3 ) /* x0*m01+x1*m11 | x0*m00+x1*m10 */ + PFMUL ( MM2, MM6 ) /* x3*m31 | x3*m30 */ + + PFADD ( MM6, MM3 ) /* r1 | r0 */ + MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ + + MOVQ ( MM3, REGOFF(-16, EDX) ) /* write r0, r1 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TP2R_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2R_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points4_2d_no_rot ) +HIDDEN(_mesa_3dnow_transform_points4_2d_no_rot) +GLNAME( _mesa_3dnow_transform_points4_2d_no_rot ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TP2NRR_3 ) ) + + MOVD ( REGIND(ECX), MM0 ) /* | m00 */ + PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ + + MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ + +ALIGNTEXT16 +LLBL( G3TP2NRR_2 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ + MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ + MOVQ ( MM5, MM6 ) /* x3 | x2 */ + + ADD_L ( CONST(16), EDX ) /* next r */ + PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ + + PFMUL ( MM1, MM6 ) /* x3*m31 | x3*m30 */ + PFADD ( MM4, MM6 ) /* x1*m11+x3*m31 | x0*m00+x3*m30 */ + + MOVQ ( MM6, REGOFF(-16, EDX) ) /* write r0, r1 */ + MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + + JNZ ( LLBL( G3TP2NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TP2NRR_3 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_3dnow_transform_points4_identity ) +HIDDEN(_mesa_3dnow_transform_points4_identity) +GLNAME( _mesa_3dnow_transform_points4_identity ): + + PUSH_L ( ESI ) + + MOV_L ( ARG_DEST, ECX ) + MOV_L ( ARG_MATRIX, ESI ) + MOV_L ( ARG_SOURCE, EAX ) + MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) + OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) + MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) + MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) + + PUSH_L ( EDI ) + + MOV_L ( REGOFF(V4F_START, ECX), EDX ) + MOV_L ( ESI, ECX ) + MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) + MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) + MOV_L ( REGOFF(V4F_START, EAX), EAX ) + + TEST_L ( ESI, ESI ) + JZ ( LLBL( G3TPIR_2 ) ) + +ALIGNTEXT16 +LLBL( G3TPIR_1 ): + + PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ + + MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ + MOVQ ( REGOFF(8, EAX), MM1 ) /* x3 | x2 */ + + ADD_L ( EDI, EAX ) /* next vertex */ + PREFETCH ( REGIND(EAX) ) + + ADD_L ( CONST(16), EDX ) /* next r */ + MOVQ ( MM0, REGOFF(-16, EDX) ) /* r1 | r0 */ + + MOVQ ( MM1, REGOFF(-8, EDX) ) /* r3 | r2 */ + + DEC_L ( ESI ) /* decrement vertex counter */ + JNZ ( LLBL( G3TPIR_1 ) ) /* cnt > 0 ? -> process next vertex */ + +LLBL( G3TPIR_2 ): + + FEMMS + POP_L ( EDI ) + POP_L ( ESI ) + RET +#endif + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/Makefile b/mesalib/src/mesa/x86/Makefile index 8cbe26015..9716dc27f 100644 --- a/mesalib/src/mesa/x86/Makefile +++ b/mesalib/src/mesa/x86/Makefile @@ -1,46 +1,46 @@ -# src/mesa/x86/Makefile - -TOP = ../../.. -include $(TOP)/configs/current - - -INCLUDE_DIRS = \ - -I$(TOP)/include/GL \ - -I$(TOP)/include \ - -I$(TOP)/src/mapi \ - -I.. \ - -I../main \ - -I../math \ - -I../tnl - - -default: gen_matypes matypes.h - -clean: - -rm -f matypes.h gen_matypes - - -gen_matypes: gen_matypes.c - $(HOST_CC) $(ARCH_FLAGS) $(INCLUDE_DIRS) $(HOST_CFLAGS) gen_matypes.c -o gen_matypes - -# need some special rules here, unfortunately -matypes.h: ../main/mtypes.h ../tnl/t_context.h gen_matypes - ./gen_matypes > matypes.h - -common_x86_asm.o: matypes.h -3dnow_normal.o: matypes.h -3dnow_xform1.o: matypes.h -3dnow_xform2.o: matypes.h -3dnow_xform3.o: matypes.h -3dnow_xform4.o: matypes.h -mmx_blend.o: matypes.h -sse_normal.o: matypes.h -sse_xform1.o: matypes.h -sse_xform2.o: matypes.h -sse_xform3.o: matypes.h -sse_xform4.o: matypes.h -x86_cliptest.o: matypes.h -x86_xform2.o: matypes.h -x86_xform3.o: matypes.h -x86_xform4.o: matypes.h - +# src/mesa/x86/Makefile + +TOP = ../../.. +include $(TOP)/configs/current + + +INCLUDE_DIRS = \ + -I$(TOP)/include/GL \ + -I$(TOP)/include \ + -I$(TOP)/src/mapi \ + -I.. \ + -I../main \ + -I../math \ + -I../tnl + + +default: gen_matypes matypes.h + +clean: + -rm -f matypes.h gen_matypes + + +gen_matypes: gen_matypes.c + $(HOST_CC) $(ARCH_FLAGS) $(INCLUDE_DIRS) $(HOST_CFLAGS) gen_matypes.c -o gen_matypes + +# need some special rules here, unfortunately +matypes.h: ../main/mtypes.h ../tnl/t_context.h gen_matypes + ./gen_matypes > matypes.h + +common_x86_asm.o: matypes.h +3dnow_normal.o: matypes.h +3dnow_xform1.o: matypes.h +3dnow_xform2.o: matypes.h +3dnow_xform3.o: matypes.h +3dnow_xform4.o: matypes.h +mmx_blend.o: matypes.h +sse_normal.o: matypes.h +sse_xform1.o: matypes.h +sse_xform2.o: matypes.h +sse_xform3.o: matypes.h +sse_xform4.o: matypes.h +x86_cliptest.o: matypes.h +x86_xform2.o: matypes.h +x86_xform3.o: matypes.h +x86_xform4.o: matypes.h + diff --git a/mesalib/src/mesa/x86/assyntax.h b/mesalib/src/mesa/x86/assyntax.h index 1e3ea66e2..4a41812f6 100644 --- a/mesalib/src/mesa/x86/assyntax.h +++ b/mesalib/src/mesa/x86/assyntax.h @@ -1,1747 +1,1747 @@ - -#ifndef __ASSYNTAX_H__ -#define __ASSYNTAX_H__ - -/* - * Copyright 1992 Vrije Universiteit, The Netherlands - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, 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 Vrije Universiteit not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. The Vrije Universiteit makes no - * representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * The Vrije Universiteit DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, - * IN NO EVENT SHALL The Vrije Universiteit 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. - */ - -/* - * assyntax.h - * - * Select the syntax appropriate to the 386 assembler being used - * To add support for more assemblers add more columns to the CHOICE - * macro. Note that register names must also have uppercase names - * to avoid macro recursion. e.g., #define ah %ah recurses! - * - * NB 1. Some of the macros for certain assemblers imply that the code is to - * run in protected mode!! Caveat emptor. - * - * NB 2. 486 specific instructions are not included. This is to discourage - * their accidental use in code that is intended to run on 386 and 486 - * systems. - * - * Supported assemblers: - * - * (a) AT&T SysVr4 as(1): define ATT_ASSEMBLER - * (b) GNU Assembler gas: define GNU_ASSEMBLER (default) - * (c) Amsterdam Compiler kit: define ACK_ASSEMBLER - * (d) The Netwide Assembler: define NASM_ASSEMBLER - * (e) Microsoft Assembler: define MASM_ASSEMBLER (UNTESTED!) - * - * The following naming conventions have been used to identify the various - * data types: - * _SR = segment register version - * Integer: - * _Q = quadword = 64 bits - * _L = long = 32 bits - * _W = short = 16 bits - * _B = byte = 8 bits - * Floating-point: - * _X = m80real = 80 bits - * _D = double = 64 bits - * _S = single = 32 bits - * - * Author: Gregory J. Sharp, Sept 1992 - * Vrije Universiteit, Amsterdam, The Netherlands - * - * [support for Intel syntax added by Josh Vanderhoof, 1999] - */ - -#if !(defined(NASM_ASSEMBLER) || defined(MASM_ASSEMBLER)) - -/* Default to ATT_ASSEMBLER when SVR4 or SYSV are defined */ -#if (defined(SVR4) || defined(SYSV)) && !defined(GNU_ASSEMBLER) -#define ATT_ASSEMBLER -#endif - -#if !defined(ATT_ASSEMBLER) && !defined(GNU_ASSEMBLER) && !defined(ACK_ASSEMBLER) -#define GNU_ASSEMBLER -#endif - -#if (defined(__STDC__) && !defined(UNIXCPP)) || (defined (sun) && defined (i386) && defined (SVR4) && defined (__STDC__) && !defined (__GNUC__)) -#define CONCAT(x, y) x ## y -#define CONCAT3(x, y, z) x ## y ## z -#else -#define CONCAT(x, y) x/**/y -#define CONCAT3(x, y, z) x/**/y/**/z -#endif - -#ifdef ACK_ASSEMBLER - -/* Assume we write code for 32-bit protected mode! */ - -/* Redefine register names for GAS & AT&T assemblers */ -#define AL al -#define AH ah -#define AX ax -#define EAX ax -#define BL bl -#define BH bh -#define BX bx -#define EBX bx -#define CL cl -#define CH ch -#define CX cx -#define ECX cx -#define DL dl -#define DH dh -#define DX dx -#define EDX dx -#define BP bp -#define EBP bp -#define SI si -#define ESI si -#define DI di -#define EDI di -#define SP sp -#define ESP sp -#define CS cs -#define SS ss -#define DS ds -#define ES es -#define FS fs -#define GS gs -/* Control Registers */ -#define CR0 cr0 -#define CR1 cr1 -#define CR2 cr2 -#define CR3 cr3 -/* Debug Registers */ -#define DR0 dr0 -#define DR1 dr1 -#define DR2 dr2 -#define DR3 dr3 -#define DR4 dr4 -#define DR5 dr5 -#define DR6 dr6 -#define DR7 dr7 -/* Floating-point Stack */ -#define ST st - -#define AS_BEGIN .sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text - - -#define _WTOG o16 /* word toggle for _W instructions */ -#define _LTOG /* long toggle for _L instructions */ -#define ADDR_TOGGLE a16 -#define OPSZ_TOGGLE o16 -#define USE16 .use16 -#define USE32 .use32 - -#define CHOICE(a,b,c) c - -#else /* AT&T or GAS */ - -/* Redefine register names for GAS & AT&T assemblers */ -#define AL %al -#define AH %ah -#define AX %ax -#define EAX %eax -#define BL %bl -#define BH %bh -#define BX %bx -#define EBX %ebx -#define CL %cl -#define CH %ch -#define CX %cx -#define ECX %ecx -#define DL %dl -#define DH %dh -#define DX %dx -#define EDX %edx -#define BP %bp -#define EBP %ebp -#define SI %si -#define ESI %esi -#define DI %di -#define EDI %edi -#define SP %sp -#define ESP %esp -#define CS %cs -#define SS %ss -#define DS %ds -#define ES %es -#define FS %fs -#define GS %gs -/* Control Registers */ -#define CR0 %cr0 -#define CR1 %cr1 -#define CR2 %cr2 -#define CR3 %cr3 -/* Debug Registers */ -#define DR0 %db0 -#define DR1 %db1 -#define DR2 %db2 -#define DR3 %db3 -#define DR4 %db4 -#define DR5 %db5 -#define DR6 %db6 -#define DR7 %db7 -/* Floating-point Stack */ -#define _STX0 %st(0) -#define _STX1 %st(1) -#define _STX2 %st(2) -#define _STX3 %st(3) -#define _STX4 %st(4) -#define _STX5 %st(5) -#define _STX6 %st(6) -#define _STX7 %st(7) -#define ST(x) CONCAT(_STX,x) -#ifdef GNU_ASSEMBLER -#define ST0 %st(0) -#else -#define ST0 %st -#endif -/* MMX Registers */ -#define MM0 %mm0 -#define MM1 %mm1 -#define MM2 %mm2 -#define MM3 %mm3 -#define MM4 %mm4 -#define MM5 %mm5 -#define MM6 %mm6 -#define MM7 %mm7 -/* SSE Registers */ -#define XMM0 %xmm0 -#define XMM1 %xmm1 -#define XMM2 %xmm2 -#define XMM3 %xmm3 -#define XMM4 %xmm4 -#define XMM5 %xmm5 -#define XMM6 %xmm6 -#define XMM7 %xmm7 - -#define AS_BEGIN -#define USE16 -#define USE32 - -#ifdef GNU_ASSEMBLER - -#define ADDR_TOGGLE aword -#define OPSZ_TOGGLE word - -#define CHOICE(a,b,c) b - -#else -/* - * AT&T ASSEMBLER SYNTAX - * ********************* - */ -#define CHOICE(a,b,c) a - -#define ADDR_TOGGLE addr16 -#define OPSZ_TOGGLE data16 - -#endif /* GNU_ASSEMBLER */ -#endif /* ACK_ASSEMBLER */ - - -#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) || defined(__GNUC__) && !defined(__DJGPP__) && !defined(__MINGW32__) -#define GLNAME(a) a -#else -#define GLNAME(a) CONCAT(_,a) -#endif - - - /****************************************/ - /* */ - /* Select the various choices */ - /* */ - /****************************************/ - - -/* Redefine assembler directives */ -/*********************************/ -#define GLOBL CHOICE(.globl, .globl, .extern) -#define GLOBAL GLOBL -#define EXTERN GLOBL -#ifndef __AOUT__ -#define ALIGNTEXT32 CHOICE(.align 32, .balign 32, .align 32) -#define ALIGNTEXT16 CHOICE(.align 16, .balign 16, .align 16) -#define ALIGNTEXT8 CHOICE(.align 8, .balign 8, .align 8) -#define ALIGNTEXT4 CHOICE(.align 4, .balign 4, .align 4) -#define ALIGNTEXT2 CHOICE(.align 2, .balign 2, .align 2) -/* ALIGNTEXT4ifNOP is the same as ALIGNTEXT4, but only if the space is - * guaranteed to be filled with NOPs. Otherwise it does nothing. - */ -#define ALIGNTEXT32ifNOP CHOICE(.align 32, .balign ARG2(32,0x90), /*can't do it*/) -#define ALIGNTEXT16ifNOP CHOICE(.align 16, .balign ARG2(16,0x90), /*can't do it*/) -#define ALIGNTEXT8ifNOP CHOICE(.align 8, .balign ARG2(8,0x90), /*can't do it*/) -#define ALIGNTEXT4ifNOP CHOICE(.align 4, .balign ARG2(4,0x90), /*can't do it*/) -#define ALIGNDATA32 CHOICE(.align 32, .balign ARG2(32,0x0), .align 32) -#define ALIGNDATA16 CHOICE(.align 16, .balign ARG2(16,0x0), .align 16) -#define ALIGNDATA8 CHOICE(.align 8, .balign ARG2(8,0x0), .align 8) -#define ALIGNDATA4 CHOICE(.align 4, .balign ARG2(4,0x0), .align 4) -#define ALIGNDATA2 CHOICE(.align 2, .balign ARG2(2,0x0), .align 2) -#else -/* 'as -aout' on FreeBSD doesn't have .balign */ -#define ALIGNTEXT32 CHOICE(.align 32, .align ARG2(5,0x90), .align 32) -#define ALIGNTEXT16 CHOICE(.align 16, .align ARG2(4,0x90), .align 16) -#define ALIGNTEXT8 CHOICE(.align 8, .align ARG2(3,0x90), .align 8) -#define ALIGNTEXT4 CHOICE(.align 4, .align ARG2(2,0x90), .align 4) -#define ALIGNTEXT2 CHOICE(.align 2, .align ARG2(1,0x90), .align 2) -/* ALIGNTEXT4ifNOP is the same as ALIGNTEXT4, but only if the space is - * guaranteed to be filled with NOPs. Otherwise it does nothing. - */ -#define ALIGNTEXT32ifNOP CHOICE(.align 32, .align ARG2(5,0x90), /*can't do it*/) -#define ALIGNTEXT16ifNOP CHOICE(.align 16, .align ARG2(4,0x90), /*can't do it*/) -#define ALIGNTEXT8ifNOP CHOICE(.align 8, .align ARG2(3,0x90), /*can't do it*/) -#define ALIGNTEXT4ifNOP CHOICE(.align 4, .align ARG2(2,0x90), /*can't do it*/) -#define ALIGNDATA32 CHOICE(.align 32, .align ARG2(5,0x0), .align 32) -#define ALIGNDATA16 CHOICE(.align 16, .align ARG2(4,0x0), .align 16) -#define ALIGNDATA8 CHOICE(.align 8, .align ARG2(3,0x0), .align 8) -#define ALIGNDATA4 CHOICE(.align 4, .align ARG2(2,0x0), .align 4) -#define ALIGNDATA2 CHOICE(.align 2, .align ARG2(1,0x0), .align 2) -#endif /* __AOUT__ */ -#define FILE(s) CHOICE(.file s, .file s, .file s) -#define STRING(s) CHOICE(.string s, .asciz s, .asciz s) -#define D_LONG CHOICE(.long, .long, .data4) -#define D_WORD CHOICE(.value, .short, .data2) -#define D_BYTE CHOICE(.byte, .byte, .data1) -#define SPACE CHOICE(.comm, .space, .space) -#define COMM CHOICE(.comm, .comm, .comm) -#define SEG_DATA CHOICE(.data, .data, .sect .data) -#define SEG_TEXT CHOICE(.text, .text, .sect .text) -#define SEG_BSS CHOICE(.bss, .bss, .sect .bss) - -#ifdef GNU_ASSEMBLER -#define D_SPACE(n) . = . + n -#else -#define D_SPACE(n) .space n -#endif - -/* Addressing Modes */ -/* Immediate Mode */ -#define ADDR(a) CHOICE(CONCAT($,a), $a, a) -#define CONST(a) CHOICE(CONCAT($,a), $a, a) - -/* Indirect Mode */ -#define CONTENT(a) CHOICE(a, a, (a)) /* take contents of variable */ -#define REGIND(a) CHOICE((a), (a), (a)) /* Register a indirect */ -/* Register b indirect plus displacement a */ -#define REGOFF(a, b) CHOICE(a(b), a(b), a(b)) -/* Reg indirect Base + Index + Displacement - this is mainly for 16-bit mode - * which has no scaling - */ -#define REGBID(b,i,d) CHOICE(d(b,i), d(b,i), d(b)(i)) -/* Reg indirect Base + (Index * Scale) */ -#define REGBIS(b,i,s) CHOICE((b,i,s), (b,i,s), (b)(i*s)) -/* Reg indirect Base + (Index * Scale) + Displacement */ -#define REGBISD(b,i,s,d) CHOICE(d(b,i,s), d(b,i,s), d(b)(i*s)) -/* Displaced Scaled Index: */ -#define REGDIS(d,i,s) CHOICE(d(,i,s), d(,i,s), d(i * s)) -/* Indexed Base: */ -#define REGBI(b,i) CHOICE((b,i), (b,i), (b)(i)) -/* Displaced Base: */ -#define REGDB(d,b) CHOICE(d(b), d(b), d(b)) -/* Variable indirect: */ -#define VARINDIRECT(var) CHOICE(*var, *var, (var)) -/* Use register contents as jump/call target: */ -#define CODEPTR(reg) CHOICE(*reg, *reg, reg) - -/* For expressions requiring bracketing - * eg. (CRT0_PM | CRT_EM) - */ - -#define EXPR(a) CHOICE([a], (a), [a]) -#define ENOT(a) CHOICE(0!a, ~a, ~a) -#define EMUL(a,b) CHOICE(a\*b, a*b, a*b) -#define EDIV(a,b) CHOICE(a\/b, a/b, a/b) - -/* - * We have to beat the problem of commas within arguments to choice. - * eg. choice (add a,b, add b,a) will get argument mismatch. Luckily ANSI - * and other known cpp definitions evaluate arguments before substitution - * so the following works. - */ -#define ARG2(a, b) a,b -#define ARG3(a,b,c) a,b,c - -/* Redefine assembler commands */ -#define AAA CHOICE(aaa, aaa, aaa) -#define AAD CHOICE(aad, aad, aad) -#define AAM CHOICE(aam, aam, aam) -#define AAS CHOICE(aas, aas, aas) -#define ADC_L(a, b) CHOICE(adcl ARG2(a,b), adcl ARG2(a,b), _LTOG adc ARG2(b,a)) -#define ADC_W(a, b) CHOICE(adcw ARG2(a,b), adcw ARG2(a,b), _WTOG adc ARG2(b,a)) -#define ADC_B(a, b) CHOICE(adcb ARG2(a,b), adcb ARG2(a,b), adcb ARG2(b,a)) -#define ADD_L(a, b) CHOICE(addl ARG2(a,b), addl ARG2(a,b), _LTOG add ARG2(b,a)) -#define ADD_W(a, b) CHOICE(addw ARG2(a,b), addw ARG2(a,b), _WTOG add ARG2(b,a)) -#define ADD_B(a, b) CHOICE(addb ARG2(a,b), addb ARG2(a,b), addb ARG2(b,a)) -#define AND_L(a, b) CHOICE(andl ARG2(a,b), andl ARG2(a,b), _LTOG and ARG2(b,a)) -#define AND_W(a, b) CHOICE(andw ARG2(a,b), andw ARG2(a,b), _WTOG and ARG2(b,a)) -#define AND_B(a, b) CHOICE(andb ARG2(a,b), andb ARG2(a,b), andb ARG2(b,a)) -#define ARPL(a,b) CHOICE(arpl ARG2(a,b), arpl ARG2(a,b), arpl ARG2(b,a)) -#define BOUND_L(a, b) CHOICE(boundl ARG2(a,b), boundl ARG2(b,a), _LTOG bound ARG2(b,a)) -#define BOUND_W(a, b) CHOICE(boundw ARG2(a,b), boundw ARG2(b,a), _WTOG bound ARG2(b,a)) -#define BSF_L(a, b) CHOICE(bsfl ARG2(a,b), bsfl ARG2(a,b), _LTOG bsf ARG2(b,a)) -#define BSF_W(a, b) CHOICE(bsfw ARG2(a,b), bsfw ARG2(a,b), _WTOG bsf ARG2(b,a)) -#define BSR_L(a, b) CHOICE(bsrl ARG2(a,b), bsrl ARG2(a,b), _LTOG bsr ARG2(b,a)) -#define BSR_W(a, b) CHOICE(bsrw ARG2(a,b), bsrw ARG2(a,b), _WTOG bsr ARG2(b,a)) -#define BT_L(a, b) CHOICE(btl ARG2(a,b), btl ARG2(a,b), _LTOG bt ARG2(b,a)) -#define BT_W(a, b) CHOICE(btw ARG2(a,b), btw ARG2(a,b), _WTOG bt ARG2(b,a)) -#define BTC_L(a, b) CHOICE(btcl ARG2(a,b), btcl ARG2(a,b), _LTOG btc ARG2(b,a)) -#define BTC_W(a, b) CHOICE(btcw ARG2(a,b), btcw ARG2(a,b), _WTOG btc ARG2(b,a)) -#define BTR_L(a, b) CHOICE(btrl ARG2(a,b), btrl ARG2(a,b), _LTOG btr ARG2(b,a)) -#define BTR_W(a, b) CHOICE(btrw ARG2(a,b), btrw ARG2(a,b), _WTOG btr ARG2(b,a)) -#define BTS_L(a, b) CHOICE(btsl ARG2(a,b), btsl ARG2(a,b), _LTOG bts ARG2(b,a)) -#define BTS_W(a, b) CHOICE(btsw ARG2(a,b), btsw ARG2(a,b), _WTOG bts ARG2(b,a)) -#define CALL(a) CHOICE(call a, call a, call a) -#define CALLF(s,a) CHOICE(lcall ARG2(s,a), lcall ARG2(s,a), callf s:a) -#define CBW CHOICE(cbtw, cbw, cbw) -#define CWDE CHOICE(cwtd, cwde, cwde) -#define CLC CHOICE(clc, clc, clc) -#define CLD CHOICE(cld, cld, cld) -#define CLI CHOICE(cli, cli, cli) -#define CLTS CHOICE(clts, clts, clts) -#define CMC CHOICE(cmc, cmc, cmc) -#define CMP_L(a, b) CHOICE(cmpl ARG2(a,b), cmpl ARG2(a,b), _LTOG cmp ARG2(b,a)) -#define CMP_W(a, b) CHOICE(cmpw ARG2(a,b), cmpw ARG2(a,b), _WTOG cmp ARG2(b,a)) -#define CMP_B(a, b) CHOICE(cmpb ARG2(a,b), cmpb ARG2(a,b), cmpb ARG2(b,a)) -#define CMPS_L CHOICE(cmpsl, cmpsl, _LTOG cmps) -#define CMPS_W CHOICE(cmpsw, cmpsw, _WTOG cmps) -#define CMPS_B CHOICE(cmpsb, cmpsb, cmpsb) -#define CWD CHOICE(cwtl, cwd, cwd) -#define CDQ CHOICE(cltd, cdq, cdq) -#define DAA CHOICE(daa, daa, daa) -#define DAS CHOICE(das, das, das) -#define DEC_L(a) CHOICE(decl a, decl a, _LTOG dec a) -#define DEC_W(a) CHOICE(decw a, decw a, _WTOG dec a) -#define DEC_B(a) CHOICE(decb a, decb a, decb a) -#define DIV_L(a) CHOICE(divl a, divl a, div a) -#define DIV_W(a) CHOICE(divw a, divw a, div a) -#define DIV_B(a) CHOICE(divb a, divb a, divb a) -#define ENTER(a,b) CHOICE(enter ARG2(a,b), enter ARG2(a,b), enter ARG2(b,a)) -#define HLT CHOICE(hlt, hlt, hlt) -#define IDIV_L(a) CHOICE(idivl a, idivl a, _LTOG idiv a) -#define IDIV_W(a) CHOICE(idivw a, idivw a, _WTOG idiv a) -#define IDIV_B(a) CHOICE(idivb a, idivb a, idivb a) -/* More forms than this for imul!! */ -#define IMUL_L(a, b) CHOICE(imull ARG2(a,b), imull ARG2(a,b), _LTOG imul ARG2(b,a)) -#define IMUL_W(a, b) CHOICE(imulw ARG2(a,b), imulw ARG2(a,b), _WTOG imul ARG2(b,a)) -#define IMUL_B(a) CHOICE(imulb a, imulb a, imulb a) -#define IN_L CHOICE(inl (DX), inl ARG2(DX,EAX), _LTOG in DX) -#define IN_W CHOICE(inw (DX), inw ARG2(DX,AX), _WTOG in DX) -#define IN_B CHOICE(inb (DX), inb ARG2(DX,AL), inb DX) -/* Please AS code writer: use the following ONLY, if you refer to ports<256 - * directly, but not in IN1_W(DX), for instance, even if IN1_ looks nicer - */ -#if defined (sun) -#define IN1_L(a) CHOICE(inl (a), inl ARG2(a,EAX), _LTOG in a) -#define IN1_W(a) CHOICE(inw (a), inw ARG2(a,AX), _WTOG in a) -#define IN1_B(a) CHOICE(inb (a), inb ARG2(a,AL), inb a) -#else -#define IN1_L(a) CHOICE(inl a, inl ARG2(a,EAX), _LTOG in a) -#define IN1_W(a) CHOICE(inw a, inw ARG2(a,AX), _WTOG in a) -#define IN1_B(a) CHOICE(inb a, inb ARG2(a,AL), inb a) -#endif -#define INC_L(a) CHOICE(incl a, incl a, _LTOG inc a) -#define INC_W(a) CHOICE(incw a, incw a, _WTOG inc a) -#define INC_B(a) CHOICE(incb a, incb a, incb a) -#define INS_L CHOICE(insl, insl, _LTOG ins) -#define INS_W CHOICE(insw, insw, _WTOG ins) -#define INS_B CHOICE(insb, insb, insb) -#define INT(a) CHOICE(int a, int a, int a) -#define INT3 CHOICE(int CONST(3), int3, int CONST(3)) -#define INTO CHOICE(into, into, into) -#define IRET CHOICE(iret, iret, iret) -#define IRETD CHOICE(iret, iret, iretd) -#define JA(a) CHOICE(ja a, ja a, ja a) -#define JAE(a) CHOICE(jae a, jae a, jae a) -#define JB(a) CHOICE(jb a, jb a, jb a) -#define JBE(a) CHOICE(jbe a, jbe a, jbe a) -#define JC(a) CHOICE(jc a, jc a, jc a) -#define JE(a) CHOICE(je a, je a, je a) -#define JG(a) CHOICE(jg a, jg a, jg a) -#define JGE(a) CHOICE(jge a, jge a, jge a) -#define JL(a) CHOICE(jl a, jl a, jl a) -#define JLE(a) CHOICE(jle a, jle a, jle a) -#define JNA(a) CHOICE(jna a, jna a, jna a) -#define JNAE(a) CHOICE(jnae a, jnae a, jnae a) -#define JNB(a) CHOICE(jnb a, jnb a, jnb a) -#define JNBE(a) CHOICE(jnbe a, jnbe a, jnbe a) -#define JNC(a) CHOICE(jnc a, jnc a, jnc a) -#define JNE(a) CHOICE(jne a, jne a, jne a) -#define JNG(a) CHOICE(jng a, jng a, jng a) -#define JNGE(a) CHOICE(jnge a, jnge a, jnge a) -#define JNL(a) CHOICE(jnl a, jnl a, jnl a) -#define JNLE(a) CHOICE(jnle a, jnle a, jnle a) -#define JNO(a) CHOICE(jno a, jno a, jno a) -#define JNP(a) CHOICE(jnp a, jnp a, jnp a) -#define JNS(a) CHOICE(jns a, jns a, jns a) -#define JNZ(a) CHOICE(jnz a, jnz a, jnz a) -#define JO(a) CHOICE(jo a, jo a, jo a) -#define JP(a) CHOICE(jp a, jp a, jp a) -#define JPE(a) CHOICE(jpe a, jpe a, jpe a) -#define JPO(a) CHOICE(jpo a, jpo a, jpo a) -#define JS(a) CHOICE(js a, js a, js a) -#define JZ(a) CHOICE(jz a, jz a, jz a) -#define JMP(a) CHOICE(jmp a, jmp a, jmp a) -#define JMPF(s,a) CHOICE(ljmp ARG2(s,a), ljmp ARG2(s,a), jmpf s:a) -#define LAHF CHOICE(lahf, lahf, lahf) -#if !defined(_REAL_MODE) && !defined(_V86_MODE) -#define LAR(a, b) CHOICE(lar ARG2(a, b), lar ARG2(a, b), lar ARG2(b, a)) -#endif -#define LEA_L(a, b) CHOICE(leal ARG2(a,b), leal ARG2(a,b), _LTOG lea ARG2(b,a)) -#define LEA_W(a, b) CHOICE(leaw ARG2(a,b), leaw ARG2(a,b), _WTOG lea ARG2(b,a)) -#define LEAVE CHOICE(leave, leave, leave) -#define LGDT(a) CHOICE(lgdt a, lgdt a, lgdt a) -#define LIDT(a) CHOICE(lidt a, lidt a, lidt a) -#define LDS(a, b) CHOICE(ldsl ARG2(a,b), lds ARG2(a,b), lds ARG2(b,a)) -#define LES(a, b) CHOICE(lesl ARG2(a,b), les ARG2(a,b), les ARG2(b,a)) -#define LFS(a, b) CHOICE(lfsl ARG2(a,b), lfs ARG2(a,b), lfs ARG2(b,a)) -#define LGS(a, b) CHOICE(lgsl ARG2(a,b), lgs ARG2(a,b), lgs ARG2(b,a)) -#define LSS(a, b) CHOICE(lssl ARG2(a,b), lss ARG2(a,b), lss ARG2(b,a)) -#define LLDT(a) CHOICE(lldt a, lldt a, lldt a) -#define LMSW(a) CHOICE(lmsw a, lmsw a, lmsw a) -#define LOCK CHOICE(lock, lock, lock) -#define LODS_L CHOICE(lodsl, lodsl, _LTOG lods) -#define LODS_W CHOICE(lodsw, lodsw, _WTOG lods) -#define LODS_B CHOICE(lodsb, lodsb, lodsb) -#define LOOP(a) CHOICE(loop a, loop a, loop a) -#define LOOPE(a) CHOICE(loope a, loope a, loope a) -#define LOOPZ(a) CHOICE(loopz a, loopz a, loopz a) -#define LOOPNE(a) CHOICE(loopne a, loopne a, loopne a) -#define LOOPNZ(a) CHOICE(loopnz a, loopnz a, loopnz a) -#if !defined(_REAL_MODE) && !defined(_V86_MODE) -#define LSL(a, b) CHOICE(lsl ARG2(a,b), lsl ARG2(a,b), lsl ARG2(b,a)) -#endif -#define LTR(a) CHOICE(ltr a, ltr a, ltr a) -#define MOV_SR(a, b) CHOICE(movw ARG2(a,b), mov ARG2(a,b), mov ARG2(b,a)) -#define MOV_L(a, b) CHOICE(movl ARG2(a,b), movl ARG2(a,b), _LTOG mov ARG2(b,a)) -#define MOV_W(a, b) CHOICE(movw ARG2(a,b), movw ARG2(a,b), _WTOG mov ARG2(b,a)) -#define MOV_B(a, b) CHOICE(movb ARG2(a,b), movb ARG2(a,b), movb ARG2(b,a)) -#define MOVS_L CHOICE(movsl, movsl, _LTOG movs) -#define MOVS_W CHOICE(movsw, movsw, _WTOG movs) -#define MOVS_B CHOICE(movsb, movsb, movsb) -#define MOVSX_BL(a, b) CHOICE(movsbl ARG2(a,b), movsbl ARG2(a,b), movsx ARG2(b,a)) -#define MOVSX_BW(a, b) CHOICE(movsbw ARG2(a,b), movsbw ARG2(a,b), movsx ARG2(b,a)) -#define MOVSX_WL(a, b) CHOICE(movswl ARG2(a,b), movswl ARG2(a,b), movsx ARG2(b,a)) -#define MOVZX_BL(a, b) CHOICE(movzbl ARG2(a,b), movzbl ARG2(a,b), movzx ARG2(b,a)) -#define MOVZX_BW(a, b) CHOICE(movzbw ARG2(a,b), movzbw ARG2(a,b), movzx ARG2(b,a)) -#define MOVZX_WL(a, b) CHOICE(movzwl ARG2(a,b), movzwl ARG2(a,b), movzx ARG2(b,a)) -#define MUL_L(a) CHOICE(mull a, mull a, _LTOG mul a) -#define MUL_W(a) CHOICE(mulw a, mulw a, _WTOG mul a) -#define MUL_B(a) CHOICE(mulb a, mulb a, mulb a) -#define NEG_L(a) CHOICE(negl a, negl a, _LTOG neg a) -#define NEG_W(a) CHOICE(negw a, negw a, _WTOG neg a) -#define NEG_B(a) CHOICE(negb a, negb a, negb a) -#define NOP CHOICE(nop, nop, nop) -#define NOT_L(a) CHOICE(notl a, notl a, _LTOG not a) -#define NOT_W(a) CHOICE(notw a, notw a, _WTOG not a) -#define NOT_B(a) CHOICE(notb a, notb a, notb a) -#define OR_L(a,b) CHOICE(orl ARG2(a,b), orl ARG2(a,b), _LTOG or ARG2(b,a)) -#define OR_W(a,b) CHOICE(orw ARG2(a,b), orw ARG2(a,b), _WTOG or ARG2(b,a)) -#define OR_B(a,b) CHOICE(orb ARG2(a,b), orb ARG2(a,b), orb ARG2(b,a)) -#define OUT_L CHOICE(outl (DX), outl ARG2(EAX,DX), _LTOG out DX) -#define OUT_W CHOICE(outw (DX), outw ARG2(AX,DX), _WTOG out DX) -#define OUT_B CHOICE(outb (DX), outb ARG2(AL,DX), outb DX) -/* Please AS code writer: use the following ONLY, if you refer to ports<256 - * directly, but not in OUT1_W(DX), for instance, even if OUT1_ looks nicer - */ -#define OUT1_L(a) CHOICE(outl (a), outl ARG2(EAX,a), _LTOG out a) -#define OUT1_W(a) CHOICE(outw (a), outw ARG2(AX,a), _WTOG out a) -#define OUT1_B(a) CHOICE(outb (a), outb ARG2(AL,a), outb a) -#define OUTS_L CHOICE(outsl, outsl, _LTOG outs) -#define OUTS_W CHOICE(outsw, outsw, _WTOG outs) -#define OUTS_B CHOICE(outsb, outsb, outsb) -#define POP_SR(a) CHOICE(pop a, pop a, pop a) -#define POP_L(a) CHOICE(popl a, popl a, _LTOG pop a) -#define POP_W(a) CHOICE(popw a, popw a, _WTOG pop a) -#define POPA_L CHOICE(popal, popal, _LTOG popa) -#define POPA_W CHOICE(popaw, popaw, _WTOG popa) -#define POPF_L CHOICE(popfl, popfl, _LTOG popf) -#define POPF_W CHOICE(popfw, popfw, _WTOG popf) -#define PUSH_SR(a) CHOICE(push a, push a, push a) -#define PUSH_L(a) CHOICE(pushl a, pushl a, _LTOG push a) -#define PUSH_W(a) CHOICE(pushw a, pushw a, _WTOG push a) -#define PUSH_B(a) CHOICE(push a, pushb a, push a) -#define PUSHA_L CHOICE(pushal, pushal, _LTOG pusha) -#define PUSHA_W CHOICE(pushaw, pushaw, _WTOG pusha) -#define PUSHF_L CHOICE(pushfl, pushfl, _LTOG pushf) -#define PUSHF_W CHOICE(pushfw, pushfw, _WTOG pushf) -#define RCL_L(a, b) CHOICE(rcll ARG2(a,b), rcll ARG2(a,b), _LTOG rcl ARG2(b,a)) -#define RCL_W(a, b) CHOICE(rclw ARG2(a,b), rclw ARG2(a,b), _WTOG rcl ARG2(b,a)) -#define RCL_B(a, b) CHOICE(rclb ARG2(a,b), rclb ARG2(a,b), rclb ARG2(b,a)) -#define RCR_L(a, b) CHOICE(rcrl ARG2(a,b), rcrl ARG2(a,b), _LTOG rcr ARG2(b,a)) -#define RCR_W(a, b) CHOICE(rcrw ARG2(a,b), rcrw ARG2(a,b), _WTOG rcr ARG2(b,a)) -#define RCR_B(a, b) CHOICE(rcrb ARG2(a,b), rcrb ARG2(a,b), rcrb ARG2(b,a)) -#define ROL_L(a, b) CHOICE(roll ARG2(a,b), roll ARG2(a,b), _LTOG rol ARG2(b,a)) -#define ROL_W(a, b) CHOICE(rolw ARG2(a,b), rolw ARG2(a,b), _WTOG rol ARG2(b,a)) -#define ROL_B(a, b) CHOICE(rolb ARG2(a,b), rolb ARG2(a,b), rolb ARG2(b,a)) -#define ROR_L(a, b) CHOICE(rorl ARG2(a,b), rorl ARG2(a,b), _LTOG ror ARG2(b,a)) -#define ROR_W(a, b) CHOICE(rorw ARG2(a,b), rorw ARG2(a,b), _WTOG ror ARG2(b,a)) -#define ROR_B(a, b) CHOICE(rorb ARG2(a,b), rorb ARG2(a,b), rorb ARG2(b,a)) -#define REP CHOICE(rep ;, rep ;, repe) -#define REPE CHOICE(repz ;, repe ;, repe) -#define REPNE CHOICE(repnz ;, repne ;, repne) -#define REPNZ REPNE -#define REPZ REPE -#define RET CHOICE(ret, ret, ret) -#define SAHF CHOICE(sahf, sahf, sahf) -#define SAL_L(a, b) CHOICE(sall ARG2(a,b), sall ARG2(a,b), _LTOG sal ARG2(b,a)) -#define SAL_W(a, b) CHOICE(salw ARG2(a,b), salw ARG2(a,b), _WTOG sal ARG2(b,a)) -#define SAL_B(a, b) CHOICE(salb ARG2(a,b), salb ARG2(a,b), salb ARG2(b,a)) -#define SAR_L(a, b) CHOICE(sarl ARG2(a,b), sarl ARG2(a,b), _LTOG sar ARG2(b,a)) -#define SAR_W(a, b) CHOICE(sarw ARG2(a,b), sarw ARG2(a,b), _WTOG sar ARG2(b,a)) -#define SAR_B(a, b) CHOICE(sarb ARG2(a,b), sarb ARG2(a,b), sarb ARG2(b,a)) -#define SBB_L(a, b) CHOICE(sbbl ARG2(a,b), sbbl ARG2(a,b), _LTOG sbb ARG2(b,a)) -#define SBB_W(a, b) CHOICE(sbbw ARG2(a,b), sbbw ARG2(a,b), _WTOG sbb ARG2(b,a)) -#define SBB_B(a, b) CHOICE(sbbb ARG2(a,b), sbbb ARG2(a,b), sbbb ARG2(b,a)) -#define SCAS_L CHOICE(scasl, scasl, _LTOG scas) -#define SCAS_W CHOICE(scasw, scasw, _WTOG scas) -#define SCAS_B CHOICE(scasb, scasb, scasb) -#define SETA(a) CHOICE(seta a, seta a, seta a) -#define SETAE(a) CHOICE(setae a, setae a, setae a) -#define SETB(a) CHOICE(setb a, setb a, setb a) -#define SETBE(a) CHOICE(setbe a, setbe a, setbe a) -#define SETC(a) CHOICE(setc a, setb a, setb a) -#define SETE(a) CHOICE(sete a, sete a, sete a) -#define SETG(a) CHOICE(setg a, setg a, setg a) -#define SETGE(a) CHOICE(setge a, setge a, setge a) -#define SETL(a) CHOICE(setl a, setl a, setl a) -#define SETLE(a) CHOICE(setle a, setle a, setle a) -#define SETNA(a) CHOICE(setna a, setna a, setna a) -#define SETNAE(a) CHOICE(setnae a, setnae a, setnae a) -#define SETNB(a) CHOICE(setnb a, setnb a, setnb a) -#define SETNBE(a) CHOICE(setnbe a, setnbe a, setnbe a) -#define SETNC(a) CHOICE(setnc a, setnb a, setnb a) -#define SETNE(a) CHOICE(setne a, setne a, setne a) -#define SETNG(a) CHOICE(setng a, setng a, setng a) -#define SETNGE(a) CHOICE(setnge a, setnge a, setnge a) -#define SETNL(a) CHOICE(setnl a, setnl a, setnl a) -#define SETNLE(a) CHOICE(setnle a, setnle a, setnle a) -#define SETNO(a) CHOICE(setno a, setno a, setno a) -#define SETNP(a) CHOICE(setnp a, setnp a, setnp a) -#define SETNS(a) CHOICE(setns a, setns a, setna a) -#define SETNZ(a) CHOICE(setnz a, setnz a, setnz a) -#define SETO(a) CHOICE(seto a, seto a, seto a) -#define SETP(a) CHOICE(setp a, setp a, setp a) -#define SETPE(a) CHOICE(setpe a, setpe a, setpe a) -#define SETPO(a) CHOICE(setpo a, setpo a, setpo a) -#define SETS(a) CHOICE(sets a, sets a, seta a) -#define SETZ(a) CHOICE(setz a, setz a, setz a) -#define SGDT(a) CHOICE(sgdt a, sgdt a, sgdt a) -#define SIDT(a) CHOICE(sidt a, sidt a, sidt a) -#define SHL_L(a, b) CHOICE(shll ARG2(a,b), shll ARG2(a,b), _LTOG shl ARG2(b,a)) -#define SHL_W(a, b) CHOICE(shlw ARG2(a,b), shlw ARG2(a,b), _WTOG shl ARG2(b,a)) -#define SHL_B(a, b) CHOICE(shlb ARG2(a,b), shlb ARG2(a,b), shlb ARG2(b,a)) -#define SHLD_L(a,b,c) CHOICE(shldl ARG3(a,b,c), shldl ARG3(a,b,c), _LTOG shld ARG3(c,b,a)) -#define SHLD2_L(a,b) CHOICE(shldl ARG2(a,b), shldl ARG3(CL,a,b), _LTOG shld ARG3(b,a,CL)) -#define SHLD_W(a,b,c) CHOICE(shldw ARG3(a,b,c), shldw ARG3(a,b,c), _WTOG shld ARG3(c,b,a)) -#define SHLD2_W(a,b) CHOICE(shldw ARG2(a,b), shldw ARG3(CL,a,b), _WTOG shld ARG3(b,a,CL)) -#define SHR_L(a, b) CHOICE(shrl ARG2(a,b), shrl ARG2(a,b), _LTOG shr ARG2(b,a)) -#define SHR_W(a, b) CHOICE(shrw ARG2(a,b), shrw ARG2(a,b), _WTOG shr ARG2(b,a)) -#define SHR_B(a, b) CHOICE(shrb ARG2(a,b), shrb ARG2(a,b), shrb ARG2(b,a)) -#define SHRD_L(a,b,c) CHOICE(shrdl ARG3(a,b,c), shrdl ARG3(a,b,c), _LTOG shrd ARG3(c,b,a)) -#define SHRD2_L(a,b) CHOICE(shrdl ARG2(a,b), shrdl ARG3(CL,a,b), _LTOG shrd ARG3(b,a,CL)) -#define SHRD_W(a,b,c) CHOICE(shrdw ARG3(a,b,c), shrdw ARG3(a,b,c), _WTOG shrd ARG3(c,b,a)) -#define SHRD2_W(a,b) CHOICE(shrdw ARG2(a,b), shrdw ARG3(CL,a,b), _WTOG shrd ARG3(b,a,CL)) -#define SLDT(a) CHOICE(sldt a, sldt a, sldt a) -#define SMSW(a) CHOICE(smsw a, smsw a, smsw a) -#define STC CHOICE(stc, stc, stc) -#define STD CHOICE(std, std, std) -#define STI CHOICE(sti, sti, sti) -#define STOS_L CHOICE(stosl, stosl, _LTOG stos) -#define STOS_W CHOICE(stosw, stosw, _WTOG stos) -#define STOS_B CHOICE(stosb, stosb, stosb) -#define STR(a) CHOICE(str a, str a, str a) -#define SUB_L(a, b) CHOICE(subl ARG2(a,b), subl ARG2(a,b), _LTOG sub ARG2(b,a)) -#define SUB_W(a, b) CHOICE(subw ARG2(a,b), subw ARG2(a,b), _WTOG sub ARG2(b,a)) -#define SUB_B(a, b) CHOICE(subb ARG2(a,b), subb ARG2(a,b), subb ARG2(b,a)) -#define TEST_L(a, b) CHOICE(testl ARG2(a,b), testl ARG2(a,b), _LTOG test ARG2(b,a)) -#define TEST_W(a, b) CHOICE(testw ARG2(a,b), testw ARG2(a,b), _WTOG test ARG2(b,a)) -#define TEST_B(a, b) CHOICE(testb ARG2(a,b), testb ARG2(a,b), testb ARG2(b,a)) -#define VERR(a) CHOICE(verr a, verr a, verr a) -#define VERW(a) CHOICE(verw a, verw a, verw a) -#define WAIT CHOICE(wait, wait, wait) -#define XCHG_L(a, b) CHOICE(xchgl ARG2(a,b), xchgl ARG2(a,b), _LTOG xchg ARG2(b,a)) -#define XCHG_W(a, b) CHOICE(xchgw ARG2(a,b), xchgw ARG2(a,b), _WTOG xchg ARG2(b,a)) -#define XCHG_B(a, b) CHOICE(xchgb ARG2(a,b), xchgb ARG2(a,b), xchgb ARG2(b,a)) -#define XLAT CHOICE(xlat, xlat, xlat) -#define XOR_L(a, b) CHOICE(xorl ARG2(a,b), xorl ARG2(a,b), _LTOG xor ARG2(b,a)) -#define XOR_W(a, b) CHOICE(xorw ARG2(a,b), xorw ARG2(a,b), _WTOG xor ARG2(b,a)) -#define XOR_B(a, b) CHOICE(xorb ARG2(a,b), xorb ARG2(a,b), xorb ARG2(b,a)) - - -/* Floating Point Instructions */ -#define F2XM1 CHOICE(f2xm1, f2xm1, f2xm1) -#define FABS CHOICE(fabs, fabs, fabs) -#define FADD_D(a) CHOICE(faddl a, faddl a, faddd a) -#define FADD_S(a) CHOICE(fadds a, fadds a, fadds a) -#define FADD2(a, b) CHOICE(fadd ARG2(a,b), fadd ARG2(a,b), fadd ARG2(b,a)) -#define FADDP(a, b) CHOICE(faddp ARG2(a,b), faddp ARG2(a,b), faddp ARG2(b,a)) -#define FIADD_L(a) CHOICE(fiaddl a, fiaddl a, fiaddl a) -#define FIADD_W(a) CHOICE(fiadd a, fiadds a, fiadds a) -#define FBLD(a) CHOICE(fbld a, fbld a, fbld a) -#define FBSTP(a) CHOICE(fbstp a, fbstp a, fbstp a) -#define FCHS CHOICE(fchs, fchs, fchs) -#define FCLEX CHOICE(fclex, wait; fnclex, wait; fclex) -#define FNCLEX CHOICE(fnclex, fnclex, fclex) -#define FCOM(a) CHOICE(fcom a, fcom a, fcom a) -#define FCOM_D(a) CHOICE(fcoml a, fcoml a, fcomd a) -#define FCOM_S(a) CHOICE(fcoms a, fcoms a, fcoms a) -#define FCOMP(a) CHOICE(fcomp a, fcomp a, fcomp a) -#define FCOMP_D(a) CHOICE(fcompl a, fcompl a, fcompd a) -#define FCOMP_S(a) CHOICE(fcomps a, fcomps a, fcomps a) -#define FCOMPP CHOICE(fcompp, fcompp, fcompp) -#define FCOS CHOICE(fcos, fcos, fcos) -#define FDECSTP CHOICE(fdecstp, fdecstp, fdecstp) -#define FDIV_D(a) CHOICE(fdivl a, fdivl a, fdivd a) -#define FDIV_S(a) CHOICE(fdivs a, fdivs a, fdivs a) -#define FDIV2(a, b) CHOICE(fdiv ARG2(a,b), fdiv ARG2(a,b), fdiv ARG2(b,a)) -#define FDIVP(a, b) CHOICE(fdivp ARG2(a,b), fdivp ARG2(a,b), fdivp ARG2(b,a)) -#define FIDIV_L(a) CHOICE(fidivl a, fidivl a, fidivl a) -#define FIDIV_W(a) CHOICE(fidiv a, fidivs a, fidivs a) -#define FDIVR_D(a) CHOICE(fdivrl a, fdivrl a, fdivrd a) -#define FDIVR_S(a) CHOICE(fdivrs a, fdivrs a, fdivrs a) -#define FDIVR2(a, b) CHOICE(fdivr ARG2(a,b), fdivr ARG2(a,b), fdivr ARG2(b,a)) -#define FDIVRP(a, b) CHOICE(fdivrp ARG2(a,b), fdivrp ARG2(a,b), fdivrp ARG2(b,a)) -#define FIDIVR_L(a) CHOICE(fidivrl a, fidivrl a, fidivrl a) -#define FIDIVR_W(a) CHOICE(fidivr a, fidivrs a, fidivrs a) -#define FFREE(a) CHOICE(ffree a, ffree a, ffree a) -#define FICOM_L(a) CHOICE(ficoml a, ficoml a, ficoml a) -#define FICOM_W(a) CHOICE(ficom a, ficoms a, ficoms a) -#define FICOMP_L(a) CHOICE(ficompl a, ficompl a, ficompl a) -#define FICOMP_W(a) CHOICE(ficomp a, ficomps a, ficomps a) -#define FILD_Q(a) CHOICE(fildll a, fildq a, fildq a) -#define FILD_L(a) CHOICE(fildl a, fildl a, fildl a) -#define FILD_W(a) CHOICE(fild a, filds a, filds a) -#define FINCSTP CHOICE(fincstp, fincstp, fincstp) -#define FINIT CHOICE(finit, wait; fninit, wait; finit) -#define FNINIT CHOICE(fninit, fninit, finit) -#define FIST_L(a) CHOICE(fistl a, fistl a, fistl a) -#define FIST_W(a) CHOICE(fist a, fists a, fists a) -#define FISTP_Q(a) CHOICE(fistpll a, fistpq a, fistpq a) -#define FISTP_L(a) CHOICE(fistpl a, fistpl a, fistpl a) -#define FISTP_W(a) CHOICE(fistp a, fistps a, fistps a) -#define FLD_X(a) CHOICE(fldt a, fldt a, fldx a) /* 80 bit data type! */ -#define FLD_D(a) CHOICE(fldl a, fldl a, fldd a) -#define FLD_S(a) CHOICE(flds a, flds a, flds a) -#define FLD1 CHOICE(fld1, fld1, fld1) -#define FLDL2T CHOICE(fldl2t, fldl2t, fldl2t) -#define FLDL2E CHOICE(fldl2e, fldl2e, fldl2e) -#define FLDPI CHOICE(fldpi, fldpi, fldpi) -#define FLDLG2 CHOICE(fldlg2, fldlg2, fldlg2) -#define FLDLN2 CHOICE(fldln2, fldln2, fldln2) -#define FLDZ CHOICE(fldz, fldz, fldz) -#define FLDCW(a) CHOICE(fldcw a, fldcw a, fldcw a) -#define FLDENV(a) CHOICE(fldenv a, fldenv a, fldenv a) -#define FMUL_S(a) CHOICE(fmuls a, fmuls a, fmuls a) -#define FMUL_D(a) CHOICE(fmull a, fmull a, fmuld a) -#define FMUL2(a, b) CHOICE(fmul ARG2(a,b), fmul ARG2(a,b), fmul ARG2(b,a)) -#define FMULP(a, b) CHOICE(fmulp ARG2(a,b), fmulp ARG2(a,b), fmulp ARG2(b,a)) -#define FIMUL_L(a) CHOICE(fimull a, fimull a, fimull a) -#define FIMUL_W(a) CHOICE(fimul a, fimuls a, fimuls a) -#define FNOP CHOICE(fnop, fnop, fnop) -#define FPATAN CHOICE(fpatan, fpatan, fpatan) -#define FPREM CHOICE(fprem, fprem, fprem) -#define FPREM1 CHOICE(fprem1, fprem1, fprem1) -#define FPTAN CHOICE(fptan, fptan, fptan) -#define FRNDINT CHOICE(frndint, frndint, frndint) -#define FRSTOR(a) CHOICE(frstor a, frstor a, frstor a) -#define FSAVE(a) CHOICE(fsave a, wait; fnsave a, wait; fsave a) -#define FNSAVE(a) CHOICE(fnsave a, fnsave a, fsave a) -#define FSCALE CHOICE(fscale, fscale, fscale) -#define FSIN CHOICE(fsin, fsin, fsin) -#define FSINCOS CHOICE(fsincos, fsincos, fsincos) -#define FSQRT CHOICE(fsqrt, fsqrt, fsqrt) -#define FST_D(a) CHOICE(fstl a, fstl a, fstd a) -#define FST_S(a) CHOICE(fsts a, fsts a, fsts a) -#define FSTP_X(a) CHOICE(fstpt a, fstpt a, fstpx a) -#define FSTP_D(a) CHOICE(fstpl a, fstpl a, fstpd a) -#define FSTP_S(a) CHOICE(fstps a, fstps a, fstps a) -#define FSTP(a) CHOICE(fstp a, fstp a, fstp a) -#define FSTCW(a) CHOICE(fstcw a, wait; fnstcw a, wait; fstcw a) -#define FNSTCW(a) CHOICE(fnstcw a, fnstcw a, fstcw a) -#define FSTENV(a) CHOICE(fstenv a, wait; fnstenv a, fstenv a) -#define FNSTENV(a) CHOICE(fnstenv a, fnstenv a, fstenv a) -#define FSTSW(a) CHOICE(fstsw a, wait; fnstsw a, wait; fstsw a) -#define FNSTSW(a) CHOICE(fnstsw a, fnstsw a, fstsw a) -#define FSUB_S(a) CHOICE(fsubs a, fsubs a, fsubs a) -#define FSUB_D(a) CHOICE(fsubl a, fsubl a, fsubd a) -#define FSUB2(a, b) CHOICE(fsub ARG2(a,b), fsub ARG2(a,b), fsub ARG2(b,a)) -#define FSUBP(a, b) CHOICE(fsubp ARG2(a,b), fsubp ARG2(a,b), fsubp ARG2(b,a)) -#define FISUB_L(a) CHOICE(fisubl a, fisubl a, fisubl a) -#define FISUB_W(a) CHOICE(fisub a, fisubs a, fisubs a) -#define FSUBR_S(a) CHOICE(fsubrs a, fsubrs a, fsubrs a) -#define FSUBR_D(a) CHOICE(fsubrl a, fsubrl a, fsubrd a) -#define FSUBR2(a, b) CHOICE(fsubr ARG2(a,b), fsubr ARG2(a,b), fsubr ARG2(b,a)) -#define FSUBRP(a, b) CHOICE(fsubrp ARG2(a,b), fsubrp ARG2(a,b), fsubrp ARG2(b,a)) -#define FISUBR_L(a) CHOICE(fisubrl a, fisubrl a, fisubrl a) -#define FISUBR_W(a) CHOICE(fisubr a, fisubrs a, fisubrs a) -#define FTST CHOICE(ftst, ftst, ftst) -#define FUCOM(a) CHOICE(fucom a, fucom a, fucom a) -#define FUCOMP(a) CHOICE(fucomp a, fucomp a, fucomp a) -#define FUCOMPP CHOICE(fucompp, fucompp, fucompp) -#define FWAIT CHOICE(wait, wait, wait) -#define FXAM CHOICE(fxam, fxam, fxam) -#define FXCH(a) CHOICE(fxch a, fxch a, fxch a) -#define FXTRACT CHOICE(fxtract, fxtract, fxtract) -#define FYL2X CHOICE(fyl2x, fyl2x, fyl2x) -#define FYL2XP1 CHOICE(fyl2xp1, fyl2xp1, fyl2xp1) - -/* New instructions */ -#define CPUID CHOICE(D_BYTE ARG2(15, 162), cpuid, D_BYTE ARG2(15, 162)) -#define RDTSC CHOICE(D_BYTE ARG2(15, 49), rdtsc, D_BYTE ARG2(15, 49)) - -#else /* NASM_ASSEMBLER || MASM_ASSEMBLER is defined */ - - /****************************************/ - /* */ - /* Intel style assemblers. */ - /* (NASM and MASM) */ - /* */ - /****************************************/ - -#define P_EAX EAX -#define L_EAX EAX -#define W_AX AX -#define B_AH AH -#define B_AL AL - -#define P_EBX EBX -#define L_EBX EBX -#define W_BX BX -#define B_BH BH -#define B_BL BL - -#define P_ECX ECX -#define L_ECX ECX -#define W_CX CX -#define B_CH CH -#define B_CL CL - -#define P_EDX EDX -#define L_EDX EDX -#define W_DX DX -#define B_DH DH -#define B_DL DL - -#define P_EBP EBP -#define L_EBP EBP -#define W_BP BP - -#define P_ESI ESI -#define L_ESI ESI -#define W_SI SI - -#define P_EDI EDI -#define L_EDI EDI -#define W_DI DI - -#define P_ESP ESP -#define L_ESP ESP -#define W_SP SP - -#define W_CS CS -#define W_SS SS -#define W_DS DS -#define W_ES ES -#define W_FS FS -#define W_GS GS - -#define X_ST ST -#define D_ST ST -#define L_ST ST - -#define P_MM0 mm0 -#define P_MM1 mm1 -#define P_MM2 mm2 -#define P_MM3 mm3 -#define P_MM4 mm4 -#define P_MM5 mm5 -#define P_MM6 mm6 -#define P_MM7 mm7 - -#define P_XMM0 xmm0 -#define P_XMM1 xmm1 -#define P_XMM2 xmm2 -#define P_XMM3 xmm3 -#define P_XMM4 xmm4 -#define P_XMM5 xmm5 -#define P_XMM6 xmm6 -#define P_XMM7 xmm7 - -#define CONCAT(x, y) x ## y -#define CONCAT3(x, y, z) x ## y ## z - -#if defined(NASM_ASSEMBLER) - -#define ST(n) st ## n -#define ST0 st0 - -#define TBYTE_PTR tword -#define QWORD_PTR qword -#define DWORD_PTR dword -#define WORD_PTR word -#define BYTE_PTR byte - -#define OFFSET - -#define GLOBL GLOBAL -#define ALIGNTEXT32 ALIGN 32 -#define ALIGNTEXT16 ALIGN 16 -#define ALIGNTEXT8 ALIGN 8 -#define ALIGNTEXT4 ALIGN 4 -#define ALIGNTEXT2 ALIGN 2 -#define ALIGNTEXT32ifNOP ALIGN 32 -#define ALIGNTEXT16ifNOP ALIGN 16 -#define ALIGNTEXT8ifNOP ALIGN 8 -#define ALIGNTEXT4ifNOP ALIGN 4 -#define ALIGNDATA32 ALIGN 32 -#define ALIGNDATA16 ALIGN 16 -#define ALIGNDATA8 ALIGN 8 -#define ALIGNDATA4 ALIGN 4 -#define ALIGNDATA2 ALIGN 2 -#define FILE(s) -#define STRING(s) db s -#define D_LONG dd -#define D_WORD dw -#define D_BYTE db -/* #define SPACE */ -/* #define COMM */ -#if defined(__WATCOMC__) -SECTION _TEXT public align=16 class=CODE use32 flat -SECTION _DATA public align=16 class=DATA use32 flat -#define SEG_TEXT SECTION _TEXT -#define SEG_DATA SECTION _DATA -#define SEG_BSS SECTION .bss -#else -#define SEG_DATA SECTION .data -#define SEG_TEXT SECTION .text -#define SEG_BSS SECTION .bss -#endif - -#define D_SPACE(n) db n REP 0 - -#define AS_BEGIN - -/* Jcc's should be handled better than this... */ -#define NEAR near - -#else /* MASM */ - -#define TBYTE_PTR tbyte ptr -#define QWORD_PTR qword ptr -#define DWORD_PTR dword ptr -#define WORD_PTR word ptr -#define BYTE_PTR byte ptr - -#define OFFSET offset - -#define GLOBL GLOBAL -#define ALIGNTEXT32 ALIGN 32 -#define ALIGNTEXT16 ALIGN 16 -#define ALIGNTEXT8 ALIGN 8 -#define ALIGNTEXT4 ALIGN 4 -#define ALIGNTEXT2 ALIGN 2 -#define ALIGNTEXT32ifNOP ALIGN 32 -#define ALIGNTEXT16ifNOP ALIGN 16 -#define ALIGNTEXT8ifNOP ALIGN 8 -#define ALIGNTEXT4ifNOP ALIGN 4 -#define ALIGNDATA32 ALIGN 32 -#define ALIGNDATA16 ALIGN 16 -#define ALIGNDATA8 ALIGN 8 -#define ALIGNDATA4 ALIGN 4 -#define ALIGNDATA2 ALIGN 2 -#define FILE(s) -#define STRING(s) db s -#define D_LONG dd -#define D_WORD dw -#define D_BYTE db -/* #define SPACE */ -/* #define COMM */ -#define SEG_DATA .DATA -#define SEG_TEXT .CODE -#define SEG_BSS .DATA - -#define D_SPACE(n) db n REP 0 - -#define AS_BEGIN - -#define NEAR - -#endif - -#if defined(Lynx) || (defined(SYSV) || defined(SVR4)) \ - || (defined(__linux__) || defined(__OS2ELF__)) && defined(__ELF__) \ - || (defined(__FreeBSD__) && __FreeBSD__ >= 3) \ - || (defined(__NetBSD__) && defined(__ELF__)) -#define GLNAME(a) a -#else -#define GLNAME(a) CONCAT(_, a) -#endif - -/* - * Addressing Modes - */ - -/* Immediate Mode */ -#define P_ADDR(a) OFFSET a -#define X_ADDR(a) OFFSET a -#define D_ADDR(a) OFFSET a -#define L_ADDR(a) OFFSET a -#define W_ADDR(a) OFFSET a -#define B_ADDR(a) OFFSET a - -#define P_CONST(a) a -#define X_CONST(a) a -#define D_CONST(a) a -#define L_CONST(a) a -#define W_CONST(a) a -#define B_CONST(a) a - -/* Indirect Mode */ -#ifdef NASM_ASSEMBLER -#define P_CONTENT(a) [a] -#define X_CONTENT(a) TBYTE_PTR [a] -#define D_CONTENT(a) QWORD_PTR [a] -#define L_CONTENT(a) DWORD_PTR [a] -#define W_CONTENT(a) WORD_PTR [a] -#define B_CONTENT(a) BYTE_PTR [a] -#else -#define P_CONTENT(a) a -#define X_CONTENT(a) TBYTE_PTR a -#define D_CONTENT(a) QWORD_PTR a -#define L_CONTENT(a) DWORD_PTR a -#define W_CONTENT(a) WORD_PTR a -#define B_CONTENT(a) BYTE_PTR a -#endif - -/* Register a indirect */ -#define P_REGIND(a) [a] -#define X_REGIND(a) TBYTE_PTR [a] -#define D_REGIND(a) QWORD_PTR [a] -#define L_REGIND(a) DWORD_PTR [a] -#define W_REGIND(a) WORD_PTR [a] -#define B_REGIND(a) BYTE_PTR [a] - -/* Register b indirect plus displacement a */ -#define P_REGOFF(a, b) [b + a] -#define X_REGOFF(a, b) TBYTE_PTR [b + a] -#define D_REGOFF(a, b) QWORD_PTR [b + a] -#define L_REGOFF(a, b) DWORD_PTR [b + a] -#define W_REGOFF(a, b) WORD_PTR [b + a] -#define B_REGOFF(a, b) BYTE_PTR [b + a] - -/* Reg indirect Base + Index + Displacement - this is mainly for 16-bit mode - * which has no scaling - */ -#define P_REGBID(b, i, d) [b + i + d] -#define X_REGBID(b, i, d) TBYTE_PTR [b + i + d] -#define D_REGBID(b, i, d) QWORD_PTR [b + i + d] -#define L_REGBID(b, i, d) DWORD_PTR [b + i + d] -#define W_REGBID(b, i, d) WORD_PTR [b + i + d] -#define B_REGBID(b, i, d) BYTE_PTR [b + i + d] - -/* Reg indirect Base + (Index * Scale) */ -#define P_REGBIS(b, i, s) [b + i * s] -#define X_REGBIS(b, i, s) TBYTE_PTR [b + i * s] -#define D_REGBIS(b, i, s) QWORD_PTR [b + i * s] -#define L_REGBIS(b, i, s) DWORD_PTR [b + i * s] -#define W_REGBIS(b, i, s) WORD_PTR [b + i * s] -#define B_REGBIS(b, i, s) BYTE_PTR [b + i * s] - -/* Reg indirect Base + (Index * Scale) + Displacement */ -#define P_REGBISD(b, i, s, d) [b + i * s + d] -#define X_REGBISD(b, i, s, d) TBYTE_PTR [b + i * s + d] -#define D_REGBISD(b, i, s, d) QWORD_PTR [b + i * s + d] -#define L_REGBISD(b, i, s, d) DWORD_PTR [b + i * s + d] -#define W_REGBISD(b, i, s, d) WORD_PTR [b + i * s + d] -#define B_REGBISD(b, i, s, d) BYTE_PTR [b + i * s + d] - -/* Displaced Scaled Index: */ -#define P_REGDIS(d, i, s) [i * s + d] -#define X_REGDIS(d, i, s) TBYTE_PTR [i * s + d] -#define D_REGDIS(d, i, s) QWORD_PTR [i * s + d] -#define L_REGDIS(d, i, s) DWORD_PTR [i * s + d] -#define W_REGDIS(d, i, s) WORD_PTR [i * s + d] -#define B_REGDIS(d, i, s) BYTE_PTR [i * s + d] - -/* Indexed Base: */ -#define P_REGBI(b, i) [b + i] -#define X_REGBI(b, i) TBYTE_PTR [b + i] -#define D_REGBI(b, i) QWORD_PTR [b + i] -#define L_REGBI(b, i) DWORD_PTR [b + i] -#define W_REGBI(b, i) WORD_PTR [b + i] -#define B_REGBI(b, i) BYTE_PTR [b + i] - -/* Displaced Base: */ -#define P_REGDB(d, b) [b + d] -#define X_REGDB(d, b) TBYTE_PTR [b + d] -#define D_REGDB(d, b) QWORD_PTR [b + d] -#define L_REGDB(d, b) DWORD_PTR [b + d] -#define W_REGDB(d, b) WORD_PTR [b + d] -#define B_REGDB(d, b) BYTE_PTR [b + d] - -/* Variable indirect: */ -#define VARINDIRECT(var) [var] - -/* Use register contents as jump/call target: */ -#define CODEPTR(reg) P_(reg) - -/* - * Redefine assembler commands - */ - -#define P_(a) P_ ## a -#define X_(a) X_ ## a -#define D_(a) D_ ## a -#define SR_(a) W_ ## a -#define S_(a) L_ ## a -#define L_(a) L_ ## a -#define W_(a) W_ ## a -#define B_(a) B_ ## a - -#define AAA aaa -#define AAD aad -#define AAM aam -#define AAS aas -#define ADC_L(a, b) adc L_(b), L_(a) -#define ADC_W(a, b) adc W_(b), W_(a) -#define ADC_B(a, b) adc B_(b), B_(a) -#define ADD_L(a, b) add L_(b), L_(a) -#define ADD_W(a, b) add W_(b), W_(a) -#define ADD_B(a, b) add B_(b), B_(a) -#define AND_L(a, b) and L_(b), L_(a) -#define AND_W(a, b) and W_(b), W_(a) -#define AND_B(a, b) and B_(b), B_(a) -#define ARPL(a,b) arpl W_(b), a -#define BOUND_L(a, b) bound L_(b), L_(a) -#define BOUND_W(a, b) bound W_(b), W_(a) -#define BSF_L(a, b) bsf L_(b), L_(a) -#define BSF_W(a, b) bsf W_(b), W_(a) -#define BSR_L(a, b) bsr L_(b), L_(a) -#define BSR_W(a, b) bsr W_(b), W_(a) -#define BT_L(a, b) bt L_(b), L_(a) -#define BT_W(a, b) bt W_(b), W_(a) -#define BTC_L(a, b) btc L_(b), L_(a) -#define BTC_W(a, b) btc W_(b), W_(a) -#define BTR_L(a, b) btr L_(b), L_(a) -#define BTR_W(a, b) btr W_(b), W_(a) -#define BTS_L(a, b) bts L_(b), L_(a) -#define BTS_W(a, b) bts W_(b), W_(a) -#define CALL(a) call a -#define CALLF(s,a) call far s:a -#define CBW cbw -#define CWDE cwde -#define CLC clc -#define CLD cld -#define CLI cli -#define CLTS clts -#define CMC cmc -#define CMP_L(a, b) cmp L_(b), L_(a) -#define CMP_W(a, b) cmp W_(b), W_(a) -#define CMP_B(a, b) cmp B_(b), B_(a) -#define CMPS_L cmpsd -#define CMPS_W cmpsw -#define CMPS_B cmpsb -#define CPUID cpuid -#define CWD cwd -#define CDQ cdq -#define DAA daa -#define DAS das -#define DEC_L(a) dec L_(a) -#define DEC_W(a) dec W_(a) -#define DEC_B(a) dec B_(a) -#define DIV_L(a) div L_(a) -#define DIV_W(a) div W_(a) -#define DIV_B(a) div B_(a) -#define ENTER(a,b) enter b, a -#define HLT hlt -#define IDIV_L(a) idiv L_(a) -#define IDIV_W(a) idiv W_(a) -#define IDIV_B(a) idiv B_(a) -#define IMUL_L(a, b) imul L_(b), L_(a) -#define IMUL_W(a, b) imul W_(b), W_(a) -#define IMUL_B(a) imul B_(a) -#define IN_L in EAX, DX -#define IN_W in AX, DX -#define IN_B in AL, DX -#define IN1_L(a) in1 L_(a) -#define IN1_W(a) in1 W_(a) -#define IN1_B(a) in1 B_(a) -#define INC_L(a) inc L_(a) -#define INC_W(a) inc W_(a) -#define INC_B(a) inc B_(a) -#define INS_L ins -#define INS_W ins -#define INS_B ins -#define INT(a) int B_(a) -#define INT3 int3 -#define INTO into -#define IRET iret -#define IRETD iretd -#define JA(a) ja NEAR a -#define JAE(a) jae NEAR a -#define JB(a) jb NEAR a -#define JBE(a) jbe NEAR a -#define JC(a) jc NEAR a -#define JE(a) je NEAR a -#define JG(a) jg NEAR a -#define JGE(a) jge NEAR a -#define JL(a) jl NEAR a -#define JLE(a) jle NEAR a -#define JNA(a) jna NEAR a -#define JNAE(a) jnae NEAR a -#define JNB(a) jnb NEAR a -#define JNBE(a) jnbe NEAR a -#define JNC(a) jnc NEAR a -#define JNE(a) jne NEAR a -#define JNG(a) jng NEAR a -#define JNGE(a) jnge NEAR a -#define JNL(a) jnl NEAR a -#define JNLE(a) jnle NEAR a -#define JNO(a) jno NEAR a -#define JNP(a) jnp NEAR a -#define JNS(a) jns NEAR a -#define JNZ(a) jnz NEAR a -#define JO(a) jo NEAR a -#define JP(a) jp NEAR a -#define JPE(a) jpe NEAR a -#define JPO(a) jpo NEAR a -#define JS(a) js NEAR a -#define JZ(a) jz NEAR a -#define JMP(a) jmp a -#define JMPF(s,a) jmp far s:a -#define LAHF lahf -#define LAR(a, b) lar b, a -#define LEA_L(a, b) lea P_(b), P_(a) -#define LEA_W(a, b) lea P_(b), P_(a) -#define LEAVE leave -#define LGDT(a) lgdt a -#define LIDT(a) lidt a -#define LDS(a, b) lds b, P_(a) -#define LES(a, b) les b, P_(a) -#define LFS(a, b) lfs b, P_(a) -#define LGS(a, b) lgs b, P_(a) -#define LSS(a, b) lss b, P_(a) -#define LLDT(a) lldt a -#define LMSW(a) lmsw a -#define LOCK lock -#define LODS_L lodsd -#define LODS_W lodsw -#define LODS_B lodsb -#define LOOP(a) loop a -#define LOOPE(a) loope a -#define LOOPZ(a) loopz a -#define LOOPNE(a) loopne a -#define LOOPNZ(a) loopnz a -#define LSL(a, b) lsl b, a -#define LTR(a) ltr a -#define MOV_SR(a, b) mov SR_(b), SR_(a) -#define MOV_L(a, b) mov L_(b), L_(a) -#define MOV_W(a, b) mov W_(b), W_(a) -#define MOV_B(a, b) mov B_(b), B_(a) -#define MOVS_L movsd -#define MOVS_W movsw -#define MOVS_B movsb -#define MOVSX_BL(a, b) movsx B_(b), B_(a) -#define MOVSX_BW(a, b) movsx B_(b), B_(a) -#define MOVSX_WL(a, b) movsx W_(b), W_(a) -#define MOVZX_BL(a, b) movzx B_(b), B_(a) -#define MOVZX_BW(a, b) movzx B_(b), B_(a) -#define MOVZX_WL(a, b) movzx W_(b), W_(a) -#define MUL_L(a) mul L_(a) -#define MUL_W(a) mul W_(a) -#define MUL_B(a) mul B_(a) -#define NEG_L(a) neg L_(a) -#define NEG_W(a) neg W_(a) -#define NEG_B(a) neg B_(a) -#define NOP nop -#define NOT_L(a) not L_(a) -#define NOT_W(a) not W_(a) -#define NOT_B(a) not B_(a) -#define OR_L(a,b) or L_(b), L_(a) -#define OR_W(a,b) or W_(b), W_(a) -#define OR_B(a,b) or B_(b), B_(a) -#define OUT_L out DX, EAX -#define OUT_W out DX, AX -#define OUT_B out DX, AL -#define OUT1_L(a) out1 L_(a) -#define OUT1_W(a) out1 W_(a) -#define OUT1_B(a) out1 B_(a) -#define OUTS_L outsd -#define OUTS_W outsw -#define OUTS_B outsb -#define POP_SR(a) pop SR_(a) -#define POP_L(a) pop L_(a) -#define POP_W(a) pop W_(a) -#define POPA_L popad -#define POPA_W popa -#define POPF_L popfd -#define POPF_W popf -#define PUSH_SR(a) push SR_(a) -#define PUSH_L(a) push L_(a) -#define PUSH_W(a) push W_(a) -#define PUSH_B(a) push B_(a) -#define PUSHA_L pushad -#define PUSHA_W pusha -#define PUSHF_L pushfd -#define PUSHF_W pushf -#define RCL_L(a, b) rcl L_(b), L_(a) -#define RCL_W(a, b) rcl W_(b), W_(a) -#define RCL_B(a, b) rcl B_(b), B_(a) -#define RCR_L(a, b) rcr L_(b), L_(a) -#define RCR_W(a, b) rcr W_(b), W_(a) -#define RCR_B(a, b) rcr B_(b), B_(a) -#define RDTSC rdtsc -#define ROL_L(a, b) rol L_(b), L_(a) -#define ROL_W(a, b) rol W_(b), W_(a) -#define ROL_B(a, b) rol B_(b), B_(a) -#define ROR_L(a, b) ror L_(b), L_(a) -#define ROR_W(a, b) ror W_(b), W_(a) -#define ROR_B(a, b) ror B_(b), B_(a) -#define REP rep -#define REPE repe -#define REPNE repne -#define REPNZ REPNE -#define REPZ REPE -#define RET ret -#define SAHF sahf -#define SAL_L(a, b) sal L_(b), B_(a) -#define SAL_W(a, b) sal W_(b), B_(a) -#define SAL_B(a, b) sal B_(b), B_(a) -#define SAR_L(a, b) sar L_(b), B_(a) -#define SAR_W(a, b) sar W_(b), B_(a) -#define SAR_B(a, b) sar B_(b), B_(a) -#define SBB_L(a, b) sbb L_(b), L_(a) -#define SBB_W(a, b) sbb W_(b), W_(a) -#define SBB_B(a, b) sbb B_(b), B_(a) -#define SCAS_L scas -#define SCAS_W scas -#define SCAS_B scas -#define SETA(a) seta a -#define SETAE(a) setae a -#define SETB(a) setb a -#define SETBE(a) setbe a -#define SETC(a) setc a -#define SETE(a) sete a -#define SETG(a) setg a -#define SETGE(a) setge a -#define SETL(a) setl a -#define SETLE(a) setle a -#define SETNA(a) setna a -#define SETNAE(a) setnae a -#define SETNB(a) setnb a -#define SETNBE(a) setnbe a -#define SETNC(a) setnc a -#define SETNE(a) setne a -#define SETNG(a) setng a -#define SETNGE(a) setnge a -#define SETNL(a) setnl a -#define SETNLE(a) setnle a -#define SETNO(a) setno a -#define SETNP(a) setnp a -#define SETNS(a) setns a -#define SETNZ(a) setnz a -#define SETO(a) seto a -#define SETP(a) setp a -#define SETPE(a) setpe a -#define SETPO(a) setpo a -#define SETS(a) sets a -#define SETZ(a) setz a -#define SGDT(a) sgdt a -#define SIDT(a) sidt a -#define SHL_L(a, b) shl L_(b), B_(a) -#define SHL_W(a, b) shl W_(b), B_(a) -#define SHL_B(a, b) shl B_(b), B_(a) -#define SHLD_L(a,b,c) shld -#define SHLD2_L(a,b) shld L_(b), L_(a) -#define SHLD_W(a,b,c) shld -#define SHLD2_W(a,b) shld W_(b), W_(a) -#define SHR_L(a, b) shr L_(b), B_(a) -#define SHR_W(a, b) shr W_(b), B_(a) -#define SHR_B(a, b) shr B_(b), B_(a) -#define SHRD_L(a,b,c) shrd -#define SHRD2_L(a,b) shrd L_(b), L_(a) -#define SHRD_W(a,b,c) shrd -#define SHRD2_W(a,b) shrd W_(b), W_(a) -#define SLDT(a) sldt a -#define SMSW(a) smsw a -#define STC stc -#define STD std -#define STI sti -#define STOS_L stosd -#define STOS_W stosw -#define STOS_B stosb -#define STR(a) str a -#define SUB_L(a, b) sub L_(b), L_(a) -#define SUB_W(a, b) sub W_(b), W_(a) -#define SUB_B(a, b) sub B_(b), B_(a) -#define TEST_L(a, b) test L_(b), L_(a) -#define TEST_W(a, b) test W_(b), W_(a) -#define TEST_B(a, b) test B_(b), B_(a) -#define VERR(a) verr a -#define VERW(a) verw a -#define WAIT wait -#define XCHG_L(a, b) xchg L_(b), L_(a) -#define XCHG_W(a, b) xchg W_(b), W_(a) -#define XCHG_B(a, b) xchg B_(b), B_(a) -#define XLAT xlat -#define XOR_L(a, b) xor L_(b), L_(a) -#define XOR_W(a, b) xor W_(b), W_(a) -#define XOR_B(a, b) xor B_(b), B_(a) - - -/* Floating Point Instructions */ -#define F2XM1 f2xm1 -#define FABS fabs -#define FADD_D(a) fadd D_(a) -#define FADD_S(a) fadd S_(a) -#define FADD2(a, b) fadd b, a -#define FADDP(a, b) faddp b, a -#define FIADD_L(a) fiadd L_(a) -#define FIADD_W(a) fiadd W_(a) -#define FBLD(a) fbld a -#define FBSTP(a) fbstp a -#define FCHS fchs -#define FCLEX fclex -#define FNCLEX fnclex -#define FCOM(a) fcom a -#define FCOM_D(a) fcom D_(a) -#define FCOM_S(a) fcom S_(a) -#define FCOMP(a) fcomp a -#define FCOMP_D(a) fcomp D_(a) -#define FCOMP_S(a) fcomp S_(a) -#define FCOMPP fcompp -#define FCOS fcos -#define FDECSTP fdecstp -#define FDIV_D(a) fdiv D_(a) -#define FDIV_S(a) fdiv S_(a) -#define FDIV2(a, b) fdiv b, a -#define FDIVP(a, b) fdivp b, a -#define FIDIV_L(a) fidiv L_(a) -#define FIDIV_W(a) fidiv W_(a) -#define FDIVR_D(a) fdivr D_(a) -#define FDIVR_S(a) fdivr S_(a) -#define FDIVR2(a, b) fdivr b, a -#define FDIVRP(a, b) fdivrp b, a -#define FIDIVR_L(a) fidivr L_(a) -#define FIDIVR_W(a) fidivr W_(a) -#define FFREE(a) ffree a -#define FICOM_L(a) ficom L_(a) -#define FICOM_W(a) ficom W_(a) -#define FICOMP_L(a) ficomp L_(a) -#define FICOMP_W(a) ficomp W_(a) -#define FILD_Q(a) fild D_(a) -#define FILD_L(a) fild L_(a) -#define FILD_W(a) fild W_(a) -#define FINCSTP fincstp -#define FINIT finit -#define FNINIT fninit -#define FIST_L(a) fist L_(a) -#define FIST_W(a) fist W_(a) -#define FISTP_Q(a) fistp D_(a) -#define FISTP_L(a) fistp L_(a) -#define FISTP_W(a) fistp W_(a) -#define FLD_X(a) fld X_(a) -#define FLD_D(a) fld D_(a) -#define FLD_S(a) fld S_(a) -#define FLD1 fld1 -#define FLDL2T fldl2t -#define FLDL2E fldl2e -#define FLDPI fldpi -#define FLDLG2 fldlg2 -#define FLDLN2 fldln2 -#define FLDZ fldz -#define FLDCW(a) fldcw a -#define FLDENV(a) fldenv a -#define FMUL_S(a) fmul S_(a) -#define FMUL_D(a) fmul D_(a) -#define FMUL2(a, b) fmul b, a -#define FMULP(a, b) fmulp b, a -#define FIMUL_L(a) fimul L_(a) -#define FIMUL_W(a) fimul W_(a) -#define FNOP fnop -#define FPATAN fpatan -#define FPREM fprem -#define FPREM1 fprem1 -#define FPTAN fptan -#define FRNDINT frndint -#define FRSTOR(a) frstor a -#define FSAVE(a) fsave a -#define FNSAVE(a) fnsave a -#define FSCALE fscale -#define FSIN fsin -#define FSINCOS fsincos -#define FSQRT fsqrt -#define FST_D(a) fst D_(a) -#define FST_S(a) fst S_(a) -#define FSTP_X(a) fstp X_(a) -#define FSTP_D(a) fstp D_(a) -#define FSTP_S(a) fstp S_(a) -#define FSTP(a) fstp a -#define FSTCW(a) fstcw a -#define FNSTCW(a) fnstcw a -#define FSTENV(a) fstenv a -#define FNSTENV(a) fnstenv a -#define FSTSW(a) fstsw a -#define FNSTSW(a) fnstsw a -#define FSUB_S(a) fsub S_(a) -#define FSUB_D(a) fsub D_(a) -#define FSUB2(a, b) fsub b, a -#define FSUBP(a, b) fsubp b, a -#define FISUB_L(a) fisub L_(a) -#define FISUB_W(a) fisub W_(a) -#define FSUBR_S(a) fsubr S_(a) -#define FSUBR_D(a) fsubr D_(a) -#define FSUBR2(a, b) fsubr b, a -#define FSUBRP(a, b) fsubrp b, a -#define FISUBR_L(a) fisubr L_(a) -#define FISUBR_W(a) fisubr W_(a) -#define FTST ftst -#define FUCOM(a) fucom a -#define FUCOMP(a) fucomp a -#define FUCOMPP fucompp -#define FWAIT fwait -#define FXAM fxam -#define FXCH(a) fxch a -#define FXTRACT fxtract -#define FYL2X fyl2x -#define FYL2XP1 fyl2xp1 - -#endif /* NASM_ASSEMBLER, MASM_ASSEMBLER */ - - /****************************************/ - /* */ - /* Extensions to x86 insn set - */ - /* MMX, 3DNow! */ - /* */ - /****************************************/ - -#if defined(NASM_ASSEMBLER) || defined(MASM_ASSEMBLER) -#define P_ARG1(a) P_ ## a -#define P_ARG2(a, b) P_ ## b, P_ ## a -#define P_ARG3(a, b, c) P_ ## c, P_ ## b, P_ ## a -#else -#define P_ARG1(a) a -#define P_ARG2(a, b) a, b -#define P_ARG3(a, b, c) a, b, c -#endif - -/* MMX */ -#define MOVD(a, b) movd P_ARG2(a, b) -#define MOVQ(a, b) movq P_ARG2(a, b) - -#define PADDB(a, b) paddb P_ARG2(a, b) -#define PADDW(a, b) paddw P_ARG2(a, b) -#define PADDD(a, b) paddd P_ARG2(a, b) - -#define PADDSB(a, b) paddsb P_ARG2(a, b) -#define PADDSW(a, b) paddsw P_ARG2(a, b) - -#define PADDUSB(a, b) paddusb P_ARG2(a, b) -#define PADDUSW(a, b) paddusw P_ARG2(a, b) - -#define PSUBB(a, b) psubb P_ARG2(a, b) -#define PSUBW(a, b) psubw P_ARG2(a, b) -#define PSUBD(a, b) psubd P_ARG2(a, b) - -#define PSUBSB(a, b) psubsb P_ARG2(a, b) -#define PSUBSW(a, b) psubsw P_ARG2(a, b) - -#define PSUBUSB(a, b) psubusb P_ARG2(a, b) -#define PSUBUSW(a, b) psubusw P_ARG2(a, b) - -#define PCMPEQB(a, b) pcmpeqb P_ARG2(a, b) -#define PCMPEQW(a, b) pcmpeqw P_ARG2(a, b) -#define PCMPEQD(a, b) pcmpeqd P_ARG2(a, b) - -#define PCMPGTB(a, b) pcmpgtb P_ARG2(a, b) -#define PCMPGTW(a, b) pcmpgtw P_ARG2(a, b) -#define PCMPGTD(a, b) pcmpgtd P_ARG2(a, b) - -#define PMULHW(a, b) pmulhw P_ARG2(a, b) -#define PMULLW(a, b) pmullw P_ARG2(a, b) - -#define PMADDWD(a, b) pmaddwd P_ARG2(a, b) - -#define PAND(a, b) pand P_ARG2(a, b) - -#define PANDN(a, b) pandn P_ARG2(a, b) - -#define POR(a, b) por P_ARG2(a, b) - -#define PXOR(a, b) pxor P_ARG2(a, b) - -#define PSRAW(a, b) psraw P_ARG2(a, b) -#define PSRAD(a, b) psrad P_ARG2(a, b) - -#define PSRLW(a, b) psrlw P_ARG2(a, b) -#define PSRLD(a, b) psrld P_ARG2(a, b) -#define PSRLQ(a, b) psrlq P_ARG2(a, b) - -#define PSLLW(a, b) psllw P_ARG2(a, b) -#define PSLLD(a, b) pslld P_ARG2(a, b) -#define PSLLQ(a, b) psllq P_ARG2(a, b) - -#define PACKSSWB(a, b) packsswb P_ARG2(a, b) -#define PACKSSDW(a, b) packssdw P_ARG2(a, b) -#define PACKUSWB(a, b) packuswb P_ARG2(a, b) - -#define PUNPCKHBW(a, b) punpckhbw P_ARG2(a, b) -#define PUNPCKHWD(a, b) punpckhwd P_ARG2(a, b) -#define PUNPCKHDQ(a, b) punpckhdq P_ARG2(a, b) -#define PUNPCKLBW(a, b) punpcklbw P_ARG2(a, b) -#define PUNPCKLWD(a, b) punpcklwd P_ARG2(a, b) -#define PUNPCKLDQ(a, b) punpckldq P_ARG2(a, b) - -#define EMMS emms - -/* AMD 3DNow! */ -#define PAVGUSB(a, b) pavgusb P_ARG2(a, b) -#define PFADD(a, b) pfadd P_ARG2(a, b) -#define PFSUB(a, b) pfsub P_ARG2(a, b) -#define PFSUBR(a, b) pfsubr P_ARG2(a, b) -#define PFACC(a, b) pfacc P_ARG2(a, b) -#define PFCMPGE(a, b) pfcmpge P_ARG2(a, b) -#define PFCMPGT(a, b) pfcmpgt P_ARG2(a, b) -#define PFCMPEQ(a, b) pfcmpeq P_ARG2(a, b) -#define PFMIN(a, b) pfmin P_ARG2(a, b) -#define PFMAX(a, b) pfmax P_ARG2(a, b) -#define PI2FD(a, b) pi2fd P_ARG2(a, b) -#define PF2ID(a, b) pf2id P_ARG2(a, b) -#define PFRCP(a, b) pfrcp P_ARG2(a, b) -#define PFRSQRT(a, b) pfrsqrt P_ARG2(a, b) -#define PFMUL(a, b) pfmul P_ARG2(a, b) -#define PFRCPIT1(a, b) pfrcpit1 P_ARG2(a, b) -#define PFRSQIT1(a, b) pfrsqit1 P_ARG2(a, b) -#define PFRCPIT2(a, b) pfrcpit2 P_ARG2(a, b) -#define PMULHRW(a, b) pmulhrw P_ARG2(a, b) - -#define FEMMS femms -#define PREFETCH(a) prefetch P_ARG1(a) -#define PREFETCHW(a) prefetchw P_ARG1(a) - -/* Intel SSE */ -#define ADDPS(a, b) addps P_ARG2(a, b) -#define ADDSS(a, b) addss P_ARG2(a, b) -#define ANDNPS(a, b) andnps P_ARG2(a, b) -#define ANDPS(a, b) andps P_ARG2(a, b) -/* NASM only knows the pseudo ops for these. -#define CMPPS(a, b, c) cmpps P_ARG3(a, b, c) -#define CMPSS(a, b, c) cmpss P_ARG3(a, b, c) -*/ -#define CMPEQPS(a, b) cmpeqps P_ARG2(a, b) -#define CMPLTPS(a, b) cmpltps P_ARG2(a, b) -#define CMPLEPS(a, b) cmpleps P_ARG2(a, b) -#define CMPUNORDPS(a, b) cmpunordps P_ARG2(a, b) -#define CMPNEQPS(a, b) cmpneqps P_ARG2(a, b) -#define CMPNLTPS(a, b) cmpnltps P_ARG2(a, b) -#define CMPNLEPS(a, b) cmpnleps P_ARG2(a, b) -#define CMPORDPS(a, b) cmpordps P_ARG2(a, b) -#define CMPEQSS(a, b) cmpeqss P_ARG2(a, b) -#define CMPLTSS(a, b) cmpltss P_ARG2(a, b) -#define CMPLESS(a, b) cmpless P_ARG2(a, b) -#define CMPUNORDSS(a, b) cmpunordss P_ARG2(a, b) -#define CMPNEQSS(a, b) cmpneqss P_ARG2(a, b) -#define CMPNLTSS(a, b) cmpnltss P_ARG2(a, b) -#define CMPNLESS(a, b) cmpnless P_ARG2(a, b) -#define CMPORDSS(a, b) cmpordss P_ARG2(a, b) -#define COMISS(a, b) comiss P_ARG2(a, b) -#define CVTPI2PS(a, b) cvtpi2ps P_ARG2(a, b) -#define CVTPS2PI(a, b) cvtps2pi P_ARG2(a, b) -#define CVTSI2SS(a, b) cvtsi2ss P_ARG2(a, b) -#define CVTSS2SI(a, b) cvtss2si P_ARG2(a, b) -#define CVTTPS2PI(a, b) cvttps2pi P_ARG2(a, b) -#define CVTTSS2SI(a, b) cvttss2si P_ARG2(a, b) -#define DIVPS(a, b) divps P_ARG2(a, b) -#define DIVSS(a, b) divss P_ARG2(a, b) -#define FXRSTOR(a) fxrstor P_ARG1(a) -#define FXSAVE(a) fxsave P_ARG1(a) -#define LDMXCSR(a) ldmxcsr P_ARG1(a) -#define MAXPS(a, b) maxps P_ARG2(a, b) -#define MAXSS(a, b) maxss P_ARG2(a, b) -#define MINPS(a, b) minps P_ARG2(a, b) -#define MINSS(a, b) minss P_ARG2(a, b) -#define MOVAPS(a, b) movaps P_ARG2(a, b) -#define MOVHLPS(a, b) movhlps P_ARG2(a, b) -#define MOVHPS(a, b) movhps P_ARG2(a, b) -#define MOVLHPS(a, b) movlhps P_ARG2(a, b) -#define MOVLPS(a, b) movlps P_ARG2(a, b) -#define MOVMSKPS(a, b) movmskps P_ARG2(a, b) -#define MOVNTPS(a, b) movntps P_ARG2(a, b) -#define MOVNTQ(a, b) movntq P_ARG2(a, b) -#define MOVSS(a, b) movss P_ARG2(a, b) -#define MOVUPS(a, b) movups P_ARG2(a, b) -#define MULPS(a, b) mulps P_ARG2(a, b) -#define MULSS(a, b) mulss P_ARG2(a, b) -#define ORPS(a, b) orps P_ARG2(a, b) -#define RCPPS(a, b) rcpps P_ARG2(a, b) -#define RCPSS(a, b) rcpss P_ARG2(a, b) -#define RSQRTPS(a, b) rsqrtps P_ARG2(a, b) -#define RSQRTSS(a, b) rsqrtss P_ARG2(a, b) -#define SHUFPS(a, b, c) shufps P_ARG3(a, b, c) -#define SQRTPS(a, b) sqrtps P_ARG2(a, b) -#define SQRTSS(a, b) sqrtss P_ARG2(a, b) -#define STMXCSR(a) stmxcsr P_ARG1(a) -#define SUBPS(a, b) subps P_ARG2(a, b) -#define UCOMISS(a, b) ucomiss P_ARG2(a, b) -#define UNPCKHPS(a, b) unpckhps P_ARG2(a, b) -#define UNPCKLPS(a, b) unpcklps P_ARG2(a, b) -#define XORPS(a, b) xorps P_ARG2(a, b) - -#define PREFETCHNTA(a) prefetchnta P_ARG1(a) -#define PREFETCHT0(a) prefetcht0 P_ARG1(a) -#define PREFETCHT1(a) prefetcht1 P_ARG1(a) -#define PREFETCHT2(a) prefetcht2 P_ARG1(a) -#define SFENCE sfence - -/* Added by BrianP for FreeBSD (per David Dawes) */ -#if !defined(NASM_ASSEMBLER) && !defined(MASM_ASSEMBLER) && !defined(__bsdi__) -#define LLBL(a) CONCAT(.L,a) -#define LLBL2(a,b) CONCAT3(.L,a,b) -#else -#define LLBL(a) a -#define LLBL2(a,b) CONCAT(a,b) -#endif - -/* Segment overrides */ -#define SEGCS D_BYTE 46 -#define SEGDS D_BYTE 62 -#define SEGES D_BYTE 38 -#define SEGFS D_BYTE 100 -#define SEGGS D_BYTE 101 - -/* Temporary labels: valid until next non-local label */ -#ifdef NASM_ASSEMBLER -#define TLBL(a) CONCAT(.,a) -#else -#define TLBL(a) CONCAT(a,$) -#endif - -/* Hidden symbol visibility support. - * If we build with gcc's -fvisibility=hidden flag, we'll need to change - * the symbol visibility mode to 'default'. - */ -#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__) -# define HIDDEN(x) .hidden x -#elif defined(__GNUC__) && !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__) -# pragma GCC visibility push(default) -# define HIDDEN(x) .hidden x -#else -# define HIDDEN(x) -#endif - -#endif /* __ASSYNTAX_H__ */ + +#ifndef __ASSYNTAX_H__ +#define __ASSYNTAX_H__ + +/* + * Copyright 1992 Vrije Universiteit, The Netherlands + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, 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 Vrije Universiteit not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The Vrije Universiteit makes no + * representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * The Vrije Universiteit DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, + * IN NO EVENT SHALL The Vrije Universiteit 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. + */ + +/* + * assyntax.h + * + * Select the syntax appropriate to the 386 assembler being used + * To add support for more assemblers add more columns to the CHOICE + * macro. Note that register names must also have uppercase names + * to avoid macro recursion. e.g., #define ah %ah recurses! + * + * NB 1. Some of the macros for certain assemblers imply that the code is to + * run in protected mode!! Caveat emptor. + * + * NB 2. 486 specific instructions are not included. This is to discourage + * their accidental use in code that is intended to run on 386 and 486 + * systems. + * + * Supported assemblers: + * + * (a) AT&T SysVr4 as(1): define ATT_ASSEMBLER + * (b) GNU Assembler gas: define GNU_ASSEMBLER (default) + * (c) Amsterdam Compiler kit: define ACK_ASSEMBLER + * (d) The Netwide Assembler: define NASM_ASSEMBLER + * (e) Microsoft Assembler: define MASM_ASSEMBLER (UNTESTED!) + * + * The following naming conventions have been used to identify the various + * data types: + * _SR = segment register version + * Integer: + * _Q = quadword = 64 bits + * _L = long = 32 bits + * _W = short = 16 bits + * _B = byte = 8 bits + * Floating-point: + * _X = m80real = 80 bits + * _D = double = 64 bits + * _S = single = 32 bits + * + * Author: Gregory J. Sharp, Sept 1992 + * Vrije Universiteit, Amsterdam, The Netherlands + * + * [support for Intel syntax added by Josh Vanderhoof, 1999] + */ + +#if !(defined(NASM_ASSEMBLER) || defined(MASM_ASSEMBLER)) + +/* Default to ATT_ASSEMBLER when SVR4 or SYSV are defined */ +#if (defined(SVR4) || defined(SYSV)) && !defined(GNU_ASSEMBLER) +#define ATT_ASSEMBLER +#endif + +#if !defined(ATT_ASSEMBLER) && !defined(GNU_ASSEMBLER) && !defined(ACK_ASSEMBLER) +#define GNU_ASSEMBLER +#endif + +#if (defined(__STDC__) && !defined(UNIXCPP)) || (defined (sun) && defined (i386) && defined (SVR4) && defined (__STDC__) && !defined (__GNUC__)) +#define CONCAT(x, y) x ## y +#define CONCAT3(x, y, z) x ## y ## z +#else +#define CONCAT(x, y) x/**/y +#define CONCAT3(x, y, z) x/**/y/**/z +#endif + +#ifdef ACK_ASSEMBLER + +/* Assume we write code for 32-bit protected mode! */ + +/* Redefine register names for GAS & AT&T assemblers */ +#define AL al +#define AH ah +#define AX ax +#define EAX ax +#define BL bl +#define BH bh +#define BX bx +#define EBX bx +#define CL cl +#define CH ch +#define CX cx +#define ECX cx +#define DL dl +#define DH dh +#define DX dx +#define EDX dx +#define BP bp +#define EBP bp +#define SI si +#define ESI si +#define DI di +#define EDI di +#define SP sp +#define ESP sp +#define CS cs +#define SS ss +#define DS ds +#define ES es +#define FS fs +#define GS gs +/* Control Registers */ +#define CR0 cr0 +#define CR1 cr1 +#define CR2 cr2 +#define CR3 cr3 +/* Debug Registers */ +#define DR0 dr0 +#define DR1 dr1 +#define DR2 dr2 +#define DR3 dr3 +#define DR4 dr4 +#define DR5 dr5 +#define DR6 dr6 +#define DR7 dr7 +/* Floating-point Stack */ +#define ST st + +#define AS_BEGIN .sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text + + +#define _WTOG o16 /* word toggle for _W instructions */ +#define _LTOG /* long toggle for _L instructions */ +#define ADDR_TOGGLE a16 +#define OPSZ_TOGGLE o16 +#define USE16 .use16 +#define USE32 .use32 + +#define CHOICE(a,b,c) c + +#else /* AT&T or GAS */ + +/* Redefine register names for GAS & AT&T assemblers */ +#define AL %al +#define AH %ah +#define AX %ax +#define EAX %eax +#define BL %bl +#define BH %bh +#define BX %bx +#define EBX %ebx +#define CL %cl +#define CH %ch +#define CX %cx +#define ECX %ecx +#define DL %dl +#define DH %dh +#define DX %dx +#define EDX %edx +#define BP %bp +#define EBP %ebp +#define SI %si +#define ESI %esi +#define DI %di +#define EDI %edi +#define SP %sp +#define ESP %esp +#define CS %cs +#define SS %ss +#define DS %ds +#define ES %es +#define FS %fs +#define GS %gs +/* Control Registers */ +#define CR0 %cr0 +#define CR1 %cr1 +#define CR2 %cr2 +#define CR3 %cr3 +/* Debug Registers */ +#define DR0 %db0 +#define DR1 %db1 +#define DR2 %db2 +#define DR3 %db3 +#define DR4 %db4 +#define DR5 %db5 +#define DR6 %db6 +#define DR7 %db7 +/* Floating-point Stack */ +#define _STX0 %st(0) +#define _STX1 %st(1) +#define _STX2 %st(2) +#define _STX3 %st(3) +#define _STX4 %st(4) +#define _STX5 %st(5) +#define _STX6 %st(6) +#define _STX7 %st(7) +#define ST(x) CONCAT(_STX,x) +#ifdef GNU_ASSEMBLER +#define ST0 %st(0) +#else +#define ST0 %st +#endif +/* MMX Registers */ +#define MM0 %mm0 +#define MM1 %mm1 +#define MM2 %mm2 +#define MM3 %mm3 +#define MM4 %mm4 +#define MM5 %mm5 +#define MM6 %mm6 +#define MM7 %mm7 +/* SSE Registers */ +#define XMM0 %xmm0 +#define XMM1 %xmm1 +#define XMM2 %xmm2 +#define XMM3 %xmm3 +#define XMM4 %xmm4 +#define XMM5 %xmm5 +#define XMM6 %xmm6 +#define XMM7 %xmm7 + +#define AS_BEGIN +#define USE16 +#define USE32 + +#ifdef GNU_ASSEMBLER + +#define ADDR_TOGGLE aword +#define OPSZ_TOGGLE word + +#define CHOICE(a,b,c) b + +#else +/* + * AT&T ASSEMBLER SYNTAX + * ********************* + */ +#define CHOICE(a,b,c) a + +#define ADDR_TOGGLE addr16 +#define OPSZ_TOGGLE data16 + +#endif /* GNU_ASSEMBLER */ +#endif /* ACK_ASSEMBLER */ + + +#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) || defined(__GNUC__) && !defined(__DJGPP__) && !defined(__MINGW32__) +#define GLNAME(a) a +#else +#define GLNAME(a) CONCAT(_,a) +#endif + + + /****************************************/ + /* */ + /* Select the various choices */ + /* */ + /****************************************/ + + +/* Redefine assembler directives */ +/*********************************/ +#define GLOBL CHOICE(.globl, .globl, .extern) +#define GLOBAL GLOBL +#define EXTERN GLOBL +#ifndef __AOUT__ +#define ALIGNTEXT32 CHOICE(.align 32, .balign 32, .align 32) +#define ALIGNTEXT16 CHOICE(.align 16, .balign 16, .align 16) +#define ALIGNTEXT8 CHOICE(.align 8, .balign 8, .align 8) +#define ALIGNTEXT4 CHOICE(.align 4, .balign 4, .align 4) +#define ALIGNTEXT2 CHOICE(.align 2, .balign 2, .align 2) +/* ALIGNTEXT4ifNOP is the same as ALIGNTEXT4, but only if the space is + * guaranteed to be filled with NOPs. Otherwise it does nothing. + */ +#define ALIGNTEXT32ifNOP CHOICE(.align 32, .balign ARG2(32,0x90), /*can't do it*/) +#define ALIGNTEXT16ifNOP CHOICE(.align 16, .balign ARG2(16,0x90), /*can't do it*/) +#define ALIGNTEXT8ifNOP CHOICE(.align 8, .balign ARG2(8,0x90), /*can't do it*/) +#define ALIGNTEXT4ifNOP CHOICE(.align 4, .balign ARG2(4,0x90), /*can't do it*/) +#define ALIGNDATA32 CHOICE(.align 32, .balign ARG2(32,0x0), .align 32) +#define ALIGNDATA16 CHOICE(.align 16, .balign ARG2(16,0x0), .align 16) +#define ALIGNDATA8 CHOICE(.align 8, .balign ARG2(8,0x0), .align 8) +#define ALIGNDATA4 CHOICE(.align 4, .balign ARG2(4,0x0), .align 4) +#define ALIGNDATA2 CHOICE(.align 2, .balign ARG2(2,0x0), .align 2) +#else +/* 'as -aout' on FreeBSD doesn't have .balign */ +#define ALIGNTEXT32 CHOICE(.align 32, .align ARG2(5,0x90), .align 32) +#define ALIGNTEXT16 CHOICE(.align 16, .align ARG2(4,0x90), .align 16) +#define ALIGNTEXT8 CHOICE(.align 8, .align ARG2(3,0x90), .align 8) +#define ALIGNTEXT4 CHOICE(.align 4, .align ARG2(2,0x90), .align 4) +#define ALIGNTEXT2 CHOICE(.align 2, .align ARG2(1,0x90), .align 2) +/* ALIGNTEXT4ifNOP is the same as ALIGNTEXT4, but only if the space is + * guaranteed to be filled with NOPs. Otherwise it does nothing. + */ +#define ALIGNTEXT32ifNOP CHOICE(.align 32, .align ARG2(5,0x90), /*can't do it*/) +#define ALIGNTEXT16ifNOP CHOICE(.align 16, .align ARG2(4,0x90), /*can't do it*/) +#define ALIGNTEXT8ifNOP CHOICE(.align 8, .align ARG2(3,0x90), /*can't do it*/) +#define ALIGNTEXT4ifNOP CHOICE(.align 4, .align ARG2(2,0x90), /*can't do it*/) +#define ALIGNDATA32 CHOICE(.align 32, .align ARG2(5,0x0), .align 32) +#define ALIGNDATA16 CHOICE(.align 16, .align ARG2(4,0x0), .align 16) +#define ALIGNDATA8 CHOICE(.align 8, .align ARG2(3,0x0), .align 8) +#define ALIGNDATA4 CHOICE(.align 4, .align ARG2(2,0x0), .align 4) +#define ALIGNDATA2 CHOICE(.align 2, .align ARG2(1,0x0), .align 2) +#endif /* __AOUT__ */ +#define FILE(s) CHOICE(.file s, .file s, .file s) +#define STRING(s) CHOICE(.string s, .asciz s, .asciz s) +#define D_LONG CHOICE(.long, .long, .data4) +#define D_WORD CHOICE(.value, .short, .data2) +#define D_BYTE CHOICE(.byte, .byte, .data1) +#define SPACE CHOICE(.comm, .space, .space) +#define COMM CHOICE(.comm, .comm, .comm) +#define SEG_DATA CHOICE(.data, .data, .sect .data) +#define SEG_TEXT CHOICE(.text, .text, .sect .text) +#define SEG_BSS CHOICE(.bss, .bss, .sect .bss) + +#ifdef GNU_ASSEMBLER +#define D_SPACE(n) . = . + n +#else +#define D_SPACE(n) .space n +#endif + +/* Addressing Modes */ +/* Immediate Mode */ +#define ADDR(a) CHOICE(CONCAT($,a), $a, a) +#define CONST(a) CHOICE(CONCAT($,a), $a, a) + +/* Indirect Mode */ +#define CONTENT(a) CHOICE(a, a, (a)) /* take contents of variable */ +#define REGIND(a) CHOICE((a), (a), (a)) /* Register a indirect */ +/* Register b indirect plus displacement a */ +#define REGOFF(a, b) CHOICE(a(b), a(b), a(b)) +/* Reg indirect Base + Index + Displacement - this is mainly for 16-bit mode + * which has no scaling + */ +#define REGBID(b,i,d) CHOICE(d(b,i), d(b,i), d(b)(i)) +/* Reg indirect Base + (Index * Scale) */ +#define REGBIS(b,i,s) CHOICE((b,i,s), (b,i,s), (b)(i*s)) +/* Reg indirect Base + (Index * Scale) + Displacement */ +#define REGBISD(b,i,s,d) CHOICE(d(b,i,s), d(b,i,s), d(b)(i*s)) +/* Displaced Scaled Index: */ +#define REGDIS(d,i,s) CHOICE(d(,i,s), d(,i,s), d(i * s)) +/* Indexed Base: */ +#define REGBI(b,i) CHOICE((b,i), (b,i), (b)(i)) +/* Displaced Base: */ +#define REGDB(d,b) CHOICE(d(b), d(b), d(b)) +/* Variable indirect: */ +#define VARINDIRECT(var) CHOICE(*var, *var, (var)) +/* Use register contents as jump/call target: */ +#define CODEPTR(reg) CHOICE(*reg, *reg, reg) + +/* For expressions requiring bracketing + * eg. (CRT0_PM | CRT_EM) + */ + +#define EXPR(a) CHOICE([a], (a), [a]) +#define ENOT(a) CHOICE(0!a, ~a, ~a) +#define EMUL(a,b) CHOICE(a\*b, a*b, a*b) +#define EDIV(a,b) CHOICE(a\/b, a/b, a/b) + +/* + * We have to beat the problem of commas within arguments to choice. + * eg. choice (add a,b, add b,a) will get argument mismatch. Luckily ANSI + * and other known cpp definitions evaluate arguments before substitution + * so the following works. + */ +#define ARG2(a, b) a,b +#define ARG3(a,b,c) a,b,c + +/* Redefine assembler commands */ +#define AAA CHOICE(aaa, aaa, aaa) +#define AAD CHOICE(aad, aad, aad) +#define AAM CHOICE(aam, aam, aam) +#define AAS CHOICE(aas, aas, aas) +#define ADC_L(a, b) CHOICE(adcl ARG2(a,b), adcl ARG2(a,b), _LTOG adc ARG2(b,a)) +#define ADC_W(a, b) CHOICE(adcw ARG2(a,b), adcw ARG2(a,b), _WTOG adc ARG2(b,a)) +#define ADC_B(a, b) CHOICE(adcb ARG2(a,b), adcb ARG2(a,b), adcb ARG2(b,a)) +#define ADD_L(a, b) CHOICE(addl ARG2(a,b), addl ARG2(a,b), _LTOG add ARG2(b,a)) +#define ADD_W(a, b) CHOICE(addw ARG2(a,b), addw ARG2(a,b), _WTOG add ARG2(b,a)) +#define ADD_B(a, b) CHOICE(addb ARG2(a,b), addb ARG2(a,b), addb ARG2(b,a)) +#define AND_L(a, b) CHOICE(andl ARG2(a,b), andl ARG2(a,b), _LTOG and ARG2(b,a)) +#define AND_W(a, b) CHOICE(andw ARG2(a,b), andw ARG2(a,b), _WTOG and ARG2(b,a)) +#define AND_B(a, b) CHOICE(andb ARG2(a,b), andb ARG2(a,b), andb ARG2(b,a)) +#define ARPL(a,b) CHOICE(arpl ARG2(a,b), arpl ARG2(a,b), arpl ARG2(b,a)) +#define BOUND_L(a, b) CHOICE(boundl ARG2(a,b), boundl ARG2(b,a), _LTOG bound ARG2(b,a)) +#define BOUND_W(a, b) CHOICE(boundw ARG2(a,b), boundw ARG2(b,a), _WTOG bound ARG2(b,a)) +#define BSF_L(a, b) CHOICE(bsfl ARG2(a,b), bsfl ARG2(a,b), _LTOG bsf ARG2(b,a)) +#define BSF_W(a, b) CHOICE(bsfw ARG2(a,b), bsfw ARG2(a,b), _WTOG bsf ARG2(b,a)) +#define BSR_L(a, b) CHOICE(bsrl ARG2(a,b), bsrl ARG2(a,b), _LTOG bsr ARG2(b,a)) +#define BSR_W(a, b) CHOICE(bsrw ARG2(a,b), bsrw ARG2(a,b), _WTOG bsr ARG2(b,a)) +#define BT_L(a, b) CHOICE(btl ARG2(a,b), btl ARG2(a,b), _LTOG bt ARG2(b,a)) +#define BT_W(a, b) CHOICE(btw ARG2(a,b), btw ARG2(a,b), _WTOG bt ARG2(b,a)) +#define BTC_L(a, b) CHOICE(btcl ARG2(a,b), btcl ARG2(a,b), _LTOG btc ARG2(b,a)) +#define BTC_W(a, b) CHOICE(btcw ARG2(a,b), btcw ARG2(a,b), _WTOG btc ARG2(b,a)) +#define BTR_L(a, b) CHOICE(btrl ARG2(a,b), btrl ARG2(a,b), _LTOG btr ARG2(b,a)) +#define BTR_W(a, b) CHOICE(btrw ARG2(a,b), btrw ARG2(a,b), _WTOG btr ARG2(b,a)) +#define BTS_L(a, b) CHOICE(btsl ARG2(a,b), btsl ARG2(a,b), _LTOG bts ARG2(b,a)) +#define BTS_W(a, b) CHOICE(btsw ARG2(a,b), btsw ARG2(a,b), _WTOG bts ARG2(b,a)) +#define CALL(a) CHOICE(call a, call a, call a) +#define CALLF(s,a) CHOICE(lcall ARG2(s,a), lcall ARG2(s,a), callf s:a) +#define CBW CHOICE(cbtw, cbw, cbw) +#define CWDE CHOICE(cwtd, cwde, cwde) +#define CLC CHOICE(clc, clc, clc) +#define CLD CHOICE(cld, cld, cld) +#define CLI CHOICE(cli, cli, cli) +#define CLTS CHOICE(clts, clts, clts) +#define CMC CHOICE(cmc, cmc, cmc) +#define CMP_L(a, b) CHOICE(cmpl ARG2(a,b), cmpl ARG2(a,b), _LTOG cmp ARG2(b,a)) +#define CMP_W(a, b) CHOICE(cmpw ARG2(a,b), cmpw ARG2(a,b), _WTOG cmp ARG2(b,a)) +#define CMP_B(a, b) CHOICE(cmpb ARG2(a,b), cmpb ARG2(a,b), cmpb ARG2(b,a)) +#define CMPS_L CHOICE(cmpsl, cmpsl, _LTOG cmps) +#define CMPS_W CHOICE(cmpsw, cmpsw, _WTOG cmps) +#define CMPS_B CHOICE(cmpsb, cmpsb, cmpsb) +#define CWD CHOICE(cwtl, cwd, cwd) +#define CDQ CHOICE(cltd, cdq, cdq) +#define DAA CHOICE(daa, daa, daa) +#define DAS CHOICE(das, das, das) +#define DEC_L(a) CHOICE(decl a, decl a, _LTOG dec a) +#define DEC_W(a) CHOICE(decw a, decw a, _WTOG dec a) +#define DEC_B(a) CHOICE(decb a, decb a, decb a) +#define DIV_L(a) CHOICE(divl a, divl a, div a) +#define DIV_W(a) CHOICE(divw a, divw a, div a) +#define DIV_B(a) CHOICE(divb a, divb a, divb a) +#define ENTER(a,b) CHOICE(enter ARG2(a,b), enter ARG2(a,b), enter ARG2(b,a)) +#define HLT CHOICE(hlt, hlt, hlt) +#define IDIV_L(a) CHOICE(idivl a, idivl a, _LTOG idiv a) +#define IDIV_W(a) CHOICE(idivw a, idivw a, _WTOG idiv a) +#define IDIV_B(a) CHOICE(idivb a, idivb a, idivb a) +/* More forms than this for imul!! */ +#define IMUL_L(a, b) CHOICE(imull ARG2(a,b), imull ARG2(a,b), _LTOG imul ARG2(b,a)) +#define IMUL_W(a, b) CHOICE(imulw ARG2(a,b), imulw ARG2(a,b), _WTOG imul ARG2(b,a)) +#define IMUL_B(a) CHOICE(imulb a, imulb a, imulb a) +#define IN_L CHOICE(inl (DX), inl ARG2(DX,EAX), _LTOG in DX) +#define IN_W CHOICE(inw (DX), inw ARG2(DX,AX), _WTOG in DX) +#define IN_B CHOICE(inb (DX), inb ARG2(DX,AL), inb DX) +/* Please AS code writer: use the following ONLY, if you refer to ports<256 + * directly, but not in IN1_W(DX), for instance, even if IN1_ looks nicer + */ +#if defined (sun) +#define IN1_L(a) CHOICE(inl (a), inl ARG2(a,EAX), _LTOG in a) +#define IN1_W(a) CHOICE(inw (a), inw ARG2(a,AX), _WTOG in a) +#define IN1_B(a) CHOICE(inb (a), inb ARG2(a,AL), inb a) +#else +#define IN1_L(a) CHOICE(inl a, inl ARG2(a,EAX), _LTOG in a) +#define IN1_W(a) CHOICE(inw a, inw ARG2(a,AX), _WTOG in a) +#define IN1_B(a) CHOICE(inb a, inb ARG2(a,AL), inb a) +#endif +#define INC_L(a) CHOICE(incl a, incl a, _LTOG inc a) +#define INC_W(a) CHOICE(incw a, incw a, _WTOG inc a) +#define INC_B(a) CHOICE(incb a, incb a, incb a) +#define INS_L CHOICE(insl, insl, _LTOG ins) +#define INS_W CHOICE(insw, insw, _WTOG ins) +#define INS_B CHOICE(insb, insb, insb) +#define INT(a) CHOICE(int a, int a, int a) +#define INT3 CHOICE(int CONST(3), int3, int CONST(3)) +#define INTO CHOICE(into, into, into) +#define IRET CHOICE(iret, iret, iret) +#define IRETD CHOICE(iret, iret, iretd) +#define JA(a) CHOICE(ja a, ja a, ja a) +#define JAE(a) CHOICE(jae a, jae a, jae a) +#define JB(a) CHOICE(jb a, jb a, jb a) +#define JBE(a) CHOICE(jbe a, jbe a, jbe a) +#define JC(a) CHOICE(jc a, jc a, jc a) +#define JE(a) CHOICE(je a, je a, je a) +#define JG(a) CHOICE(jg a, jg a, jg a) +#define JGE(a) CHOICE(jge a, jge a, jge a) +#define JL(a) CHOICE(jl a, jl a, jl a) +#define JLE(a) CHOICE(jle a, jle a, jle a) +#define JNA(a) CHOICE(jna a, jna a, jna a) +#define JNAE(a) CHOICE(jnae a, jnae a, jnae a) +#define JNB(a) CHOICE(jnb a, jnb a, jnb a) +#define JNBE(a) CHOICE(jnbe a, jnbe a, jnbe a) +#define JNC(a) CHOICE(jnc a, jnc a, jnc a) +#define JNE(a) CHOICE(jne a, jne a, jne a) +#define JNG(a) CHOICE(jng a, jng a, jng a) +#define JNGE(a) CHOICE(jnge a, jnge a, jnge a) +#define JNL(a) CHOICE(jnl a, jnl a, jnl a) +#define JNLE(a) CHOICE(jnle a, jnle a, jnle a) +#define JNO(a) CHOICE(jno a, jno a, jno a) +#define JNP(a) CHOICE(jnp a, jnp a, jnp a) +#define JNS(a) CHOICE(jns a, jns a, jns a) +#define JNZ(a) CHOICE(jnz a, jnz a, jnz a) +#define JO(a) CHOICE(jo a, jo a, jo a) +#define JP(a) CHOICE(jp a, jp a, jp a) +#define JPE(a) CHOICE(jpe a, jpe a, jpe a) +#define JPO(a) CHOICE(jpo a, jpo a, jpo a) +#define JS(a) CHOICE(js a, js a, js a) +#define JZ(a) CHOICE(jz a, jz a, jz a) +#define JMP(a) CHOICE(jmp a, jmp a, jmp a) +#define JMPF(s,a) CHOICE(ljmp ARG2(s,a), ljmp ARG2(s,a), jmpf s:a) +#define LAHF CHOICE(lahf, lahf, lahf) +#if !defined(_REAL_MODE) && !defined(_V86_MODE) +#define LAR(a, b) CHOICE(lar ARG2(a, b), lar ARG2(a, b), lar ARG2(b, a)) +#endif +#define LEA_L(a, b) CHOICE(leal ARG2(a,b), leal ARG2(a,b), _LTOG lea ARG2(b,a)) +#define LEA_W(a, b) CHOICE(leaw ARG2(a,b), leaw ARG2(a,b), _WTOG lea ARG2(b,a)) +#define LEAVE CHOICE(leave, leave, leave) +#define LGDT(a) CHOICE(lgdt a, lgdt a, lgdt a) +#define LIDT(a) CHOICE(lidt a, lidt a, lidt a) +#define LDS(a, b) CHOICE(ldsl ARG2(a,b), lds ARG2(a,b), lds ARG2(b,a)) +#define LES(a, b) CHOICE(lesl ARG2(a,b), les ARG2(a,b), les ARG2(b,a)) +#define LFS(a, b) CHOICE(lfsl ARG2(a,b), lfs ARG2(a,b), lfs ARG2(b,a)) +#define LGS(a, b) CHOICE(lgsl ARG2(a,b), lgs ARG2(a,b), lgs ARG2(b,a)) +#define LSS(a, b) CHOICE(lssl ARG2(a,b), lss ARG2(a,b), lss ARG2(b,a)) +#define LLDT(a) CHOICE(lldt a, lldt a, lldt a) +#define LMSW(a) CHOICE(lmsw a, lmsw a, lmsw a) +#define LOCK CHOICE(lock, lock, lock) +#define LODS_L CHOICE(lodsl, lodsl, _LTOG lods) +#define LODS_W CHOICE(lodsw, lodsw, _WTOG lods) +#define LODS_B CHOICE(lodsb, lodsb, lodsb) +#define LOOP(a) CHOICE(loop a, loop a, loop a) +#define LOOPE(a) CHOICE(loope a, loope a, loope a) +#define LOOPZ(a) CHOICE(loopz a, loopz a, loopz a) +#define LOOPNE(a) CHOICE(loopne a, loopne a, loopne a) +#define LOOPNZ(a) CHOICE(loopnz a, loopnz a, loopnz a) +#if !defined(_REAL_MODE) && !defined(_V86_MODE) +#define LSL(a, b) CHOICE(lsl ARG2(a,b), lsl ARG2(a,b), lsl ARG2(b,a)) +#endif +#define LTR(a) CHOICE(ltr a, ltr a, ltr a) +#define MOV_SR(a, b) CHOICE(movw ARG2(a,b), mov ARG2(a,b), mov ARG2(b,a)) +#define MOV_L(a, b) CHOICE(movl ARG2(a,b), movl ARG2(a,b), _LTOG mov ARG2(b,a)) +#define MOV_W(a, b) CHOICE(movw ARG2(a,b), movw ARG2(a,b), _WTOG mov ARG2(b,a)) +#define MOV_B(a, b) CHOICE(movb ARG2(a,b), movb ARG2(a,b), movb ARG2(b,a)) +#define MOVS_L CHOICE(movsl, movsl, _LTOG movs) +#define MOVS_W CHOICE(movsw, movsw, _WTOG movs) +#define MOVS_B CHOICE(movsb, movsb, movsb) +#define MOVSX_BL(a, b) CHOICE(movsbl ARG2(a,b), movsbl ARG2(a,b), movsx ARG2(b,a)) +#define MOVSX_BW(a, b) CHOICE(movsbw ARG2(a,b), movsbw ARG2(a,b), movsx ARG2(b,a)) +#define MOVSX_WL(a, b) CHOICE(movswl ARG2(a,b), movswl ARG2(a,b), movsx ARG2(b,a)) +#define MOVZX_BL(a, b) CHOICE(movzbl ARG2(a,b), movzbl ARG2(a,b), movzx ARG2(b,a)) +#define MOVZX_BW(a, b) CHOICE(movzbw ARG2(a,b), movzbw ARG2(a,b), movzx ARG2(b,a)) +#define MOVZX_WL(a, b) CHOICE(movzwl ARG2(a,b), movzwl ARG2(a,b), movzx ARG2(b,a)) +#define MUL_L(a) CHOICE(mull a, mull a, _LTOG mul a) +#define MUL_W(a) CHOICE(mulw a, mulw a, _WTOG mul a) +#define MUL_B(a) CHOICE(mulb a, mulb a, mulb a) +#define NEG_L(a) CHOICE(negl a, negl a, _LTOG neg a) +#define NEG_W(a) CHOICE(negw a, negw a, _WTOG neg a) +#define NEG_B(a) CHOICE(negb a, negb a, negb a) +#define NOP CHOICE(nop, nop, nop) +#define NOT_L(a) CHOICE(notl a, notl a, _LTOG not a) +#define NOT_W(a) CHOICE(notw a, notw a, _WTOG not a) +#define NOT_B(a) CHOICE(notb a, notb a, notb a) +#define OR_L(a,b) CHOICE(orl ARG2(a,b), orl ARG2(a,b), _LTOG or ARG2(b,a)) +#define OR_W(a,b) CHOICE(orw ARG2(a,b), orw ARG2(a,b), _WTOG or ARG2(b,a)) +#define OR_B(a,b) CHOICE(orb ARG2(a,b), orb ARG2(a,b), orb ARG2(b,a)) +#define OUT_L CHOICE(outl (DX), outl ARG2(EAX,DX), _LTOG out DX) +#define OUT_W CHOICE(outw (DX), outw ARG2(AX,DX), _WTOG out DX) +#define OUT_B CHOICE(outb (DX), outb ARG2(AL,DX), outb DX) +/* Please AS code writer: use the following ONLY, if you refer to ports<256 + * directly, but not in OUT1_W(DX), for instance, even if OUT1_ looks nicer + */ +#define OUT1_L(a) CHOICE(outl (a), outl ARG2(EAX,a), _LTOG out a) +#define OUT1_W(a) CHOICE(outw (a), outw ARG2(AX,a), _WTOG out a) +#define OUT1_B(a) CHOICE(outb (a), outb ARG2(AL,a), outb a) +#define OUTS_L CHOICE(outsl, outsl, _LTOG outs) +#define OUTS_W CHOICE(outsw, outsw, _WTOG outs) +#define OUTS_B CHOICE(outsb, outsb, outsb) +#define POP_SR(a) CHOICE(pop a, pop a, pop a) +#define POP_L(a) CHOICE(popl a, popl a, _LTOG pop a) +#define POP_W(a) CHOICE(popw a, popw a, _WTOG pop a) +#define POPA_L CHOICE(popal, popal, _LTOG popa) +#define POPA_W CHOICE(popaw, popaw, _WTOG popa) +#define POPF_L CHOICE(popfl, popfl, _LTOG popf) +#define POPF_W CHOICE(popfw, popfw, _WTOG popf) +#define PUSH_SR(a) CHOICE(push a, push a, push a) +#define PUSH_L(a) CHOICE(pushl a, pushl a, _LTOG push a) +#define PUSH_W(a) CHOICE(pushw a, pushw a, _WTOG push a) +#define PUSH_B(a) CHOICE(push a, pushb a, push a) +#define PUSHA_L CHOICE(pushal, pushal, _LTOG pusha) +#define PUSHA_W CHOICE(pushaw, pushaw, _WTOG pusha) +#define PUSHF_L CHOICE(pushfl, pushfl, _LTOG pushf) +#define PUSHF_W CHOICE(pushfw, pushfw, _WTOG pushf) +#define RCL_L(a, b) CHOICE(rcll ARG2(a,b), rcll ARG2(a,b), _LTOG rcl ARG2(b,a)) +#define RCL_W(a, b) CHOICE(rclw ARG2(a,b), rclw ARG2(a,b), _WTOG rcl ARG2(b,a)) +#define RCL_B(a, b) CHOICE(rclb ARG2(a,b), rclb ARG2(a,b), rclb ARG2(b,a)) +#define RCR_L(a, b) CHOICE(rcrl ARG2(a,b), rcrl ARG2(a,b), _LTOG rcr ARG2(b,a)) +#define RCR_W(a, b) CHOICE(rcrw ARG2(a,b), rcrw ARG2(a,b), _WTOG rcr ARG2(b,a)) +#define RCR_B(a, b) CHOICE(rcrb ARG2(a,b), rcrb ARG2(a,b), rcrb ARG2(b,a)) +#define ROL_L(a, b) CHOICE(roll ARG2(a,b), roll ARG2(a,b), _LTOG rol ARG2(b,a)) +#define ROL_W(a, b) CHOICE(rolw ARG2(a,b), rolw ARG2(a,b), _WTOG rol ARG2(b,a)) +#define ROL_B(a, b) CHOICE(rolb ARG2(a,b), rolb ARG2(a,b), rolb ARG2(b,a)) +#define ROR_L(a, b) CHOICE(rorl ARG2(a,b), rorl ARG2(a,b), _LTOG ror ARG2(b,a)) +#define ROR_W(a, b) CHOICE(rorw ARG2(a,b), rorw ARG2(a,b), _WTOG ror ARG2(b,a)) +#define ROR_B(a, b) CHOICE(rorb ARG2(a,b), rorb ARG2(a,b), rorb ARG2(b,a)) +#define REP CHOICE(rep ;, rep ;, repe) +#define REPE CHOICE(repz ;, repe ;, repe) +#define REPNE CHOICE(repnz ;, repne ;, repne) +#define REPNZ REPNE +#define REPZ REPE +#define RET CHOICE(ret, ret, ret) +#define SAHF CHOICE(sahf, sahf, sahf) +#define SAL_L(a, b) CHOICE(sall ARG2(a,b), sall ARG2(a,b), _LTOG sal ARG2(b,a)) +#define SAL_W(a, b) CHOICE(salw ARG2(a,b), salw ARG2(a,b), _WTOG sal ARG2(b,a)) +#define SAL_B(a, b) CHOICE(salb ARG2(a,b), salb ARG2(a,b), salb ARG2(b,a)) +#define SAR_L(a, b) CHOICE(sarl ARG2(a,b), sarl ARG2(a,b), _LTOG sar ARG2(b,a)) +#define SAR_W(a, b) CHOICE(sarw ARG2(a,b), sarw ARG2(a,b), _WTOG sar ARG2(b,a)) +#define SAR_B(a, b) CHOICE(sarb ARG2(a,b), sarb ARG2(a,b), sarb ARG2(b,a)) +#define SBB_L(a, b) CHOICE(sbbl ARG2(a,b), sbbl ARG2(a,b), _LTOG sbb ARG2(b,a)) +#define SBB_W(a, b) CHOICE(sbbw ARG2(a,b), sbbw ARG2(a,b), _WTOG sbb ARG2(b,a)) +#define SBB_B(a, b) CHOICE(sbbb ARG2(a,b), sbbb ARG2(a,b), sbbb ARG2(b,a)) +#define SCAS_L CHOICE(scasl, scasl, _LTOG scas) +#define SCAS_W CHOICE(scasw, scasw, _WTOG scas) +#define SCAS_B CHOICE(scasb, scasb, scasb) +#define SETA(a) CHOICE(seta a, seta a, seta a) +#define SETAE(a) CHOICE(setae a, setae a, setae a) +#define SETB(a) CHOICE(setb a, setb a, setb a) +#define SETBE(a) CHOICE(setbe a, setbe a, setbe a) +#define SETC(a) CHOICE(setc a, setb a, setb a) +#define SETE(a) CHOICE(sete a, sete a, sete a) +#define SETG(a) CHOICE(setg a, setg a, setg a) +#define SETGE(a) CHOICE(setge a, setge a, setge a) +#define SETL(a) CHOICE(setl a, setl a, setl a) +#define SETLE(a) CHOICE(setle a, setle a, setle a) +#define SETNA(a) CHOICE(setna a, setna a, setna a) +#define SETNAE(a) CHOICE(setnae a, setnae a, setnae a) +#define SETNB(a) CHOICE(setnb a, setnb a, setnb a) +#define SETNBE(a) CHOICE(setnbe a, setnbe a, setnbe a) +#define SETNC(a) CHOICE(setnc a, setnb a, setnb a) +#define SETNE(a) CHOICE(setne a, setne a, setne a) +#define SETNG(a) CHOICE(setng a, setng a, setng a) +#define SETNGE(a) CHOICE(setnge a, setnge a, setnge a) +#define SETNL(a) CHOICE(setnl a, setnl a, setnl a) +#define SETNLE(a) CHOICE(setnle a, setnle a, setnle a) +#define SETNO(a) CHOICE(setno a, setno a, setno a) +#define SETNP(a) CHOICE(setnp a, setnp a, setnp a) +#define SETNS(a) CHOICE(setns a, setns a, setna a) +#define SETNZ(a) CHOICE(setnz a, setnz a, setnz a) +#define SETO(a) CHOICE(seto a, seto a, seto a) +#define SETP(a) CHOICE(setp a, setp a, setp a) +#define SETPE(a) CHOICE(setpe a, setpe a, setpe a) +#define SETPO(a) CHOICE(setpo a, setpo a, setpo a) +#define SETS(a) CHOICE(sets a, sets a, seta a) +#define SETZ(a) CHOICE(setz a, setz a, setz a) +#define SGDT(a) CHOICE(sgdt a, sgdt a, sgdt a) +#define SIDT(a) CHOICE(sidt a, sidt a, sidt a) +#define SHL_L(a, b) CHOICE(shll ARG2(a,b), shll ARG2(a,b), _LTOG shl ARG2(b,a)) +#define SHL_W(a, b) CHOICE(shlw ARG2(a,b), shlw ARG2(a,b), _WTOG shl ARG2(b,a)) +#define SHL_B(a, b) CHOICE(shlb ARG2(a,b), shlb ARG2(a,b), shlb ARG2(b,a)) +#define SHLD_L(a,b,c) CHOICE(shldl ARG3(a,b,c), shldl ARG3(a,b,c), _LTOG shld ARG3(c,b,a)) +#define SHLD2_L(a,b) CHOICE(shldl ARG2(a,b), shldl ARG3(CL,a,b), _LTOG shld ARG3(b,a,CL)) +#define SHLD_W(a,b,c) CHOICE(shldw ARG3(a,b,c), shldw ARG3(a,b,c), _WTOG shld ARG3(c,b,a)) +#define SHLD2_W(a,b) CHOICE(shldw ARG2(a,b), shldw ARG3(CL,a,b), _WTOG shld ARG3(b,a,CL)) +#define SHR_L(a, b) CHOICE(shrl ARG2(a,b), shrl ARG2(a,b), _LTOG shr ARG2(b,a)) +#define SHR_W(a, b) CHOICE(shrw ARG2(a,b), shrw ARG2(a,b), _WTOG shr ARG2(b,a)) +#define SHR_B(a, b) CHOICE(shrb ARG2(a,b), shrb ARG2(a,b), shrb ARG2(b,a)) +#define SHRD_L(a,b,c) CHOICE(shrdl ARG3(a,b,c), shrdl ARG3(a,b,c), _LTOG shrd ARG3(c,b,a)) +#define SHRD2_L(a,b) CHOICE(shrdl ARG2(a,b), shrdl ARG3(CL,a,b), _LTOG shrd ARG3(b,a,CL)) +#define SHRD_W(a,b,c) CHOICE(shrdw ARG3(a,b,c), shrdw ARG3(a,b,c), _WTOG shrd ARG3(c,b,a)) +#define SHRD2_W(a,b) CHOICE(shrdw ARG2(a,b), shrdw ARG3(CL,a,b), _WTOG shrd ARG3(b,a,CL)) +#define SLDT(a) CHOICE(sldt a, sldt a, sldt a) +#define SMSW(a) CHOICE(smsw a, smsw a, smsw a) +#define STC CHOICE(stc, stc, stc) +#define STD CHOICE(std, std, std) +#define STI CHOICE(sti, sti, sti) +#define STOS_L CHOICE(stosl, stosl, _LTOG stos) +#define STOS_W CHOICE(stosw, stosw, _WTOG stos) +#define STOS_B CHOICE(stosb, stosb, stosb) +#define STR(a) CHOICE(str a, str a, str a) +#define SUB_L(a, b) CHOICE(subl ARG2(a,b), subl ARG2(a,b), _LTOG sub ARG2(b,a)) +#define SUB_W(a, b) CHOICE(subw ARG2(a,b), subw ARG2(a,b), _WTOG sub ARG2(b,a)) +#define SUB_B(a, b) CHOICE(subb ARG2(a,b), subb ARG2(a,b), subb ARG2(b,a)) +#define TEST_L(a, b) CHOICE(testl ARG2(a,b), testl ARG2(a,b), _LTOG test ARG2(b,a)) +#define TEST_W(a, b) CHOICE(testw ARG2(a,b), testw ARG2(a,b), _WTOG test ARG2(b,a)) +#define TEST_B(a, b) CHOICE(testb ARG2(a,b), testb ARG2(a,b), testb ARG2(b,a)) +#define VERR(a) CHOICE(verr a, verr a, verr a) +#define VERW(a) CHOICE(verw a, verw a, verw a) +#define WAIT CHOICE(wait, wait, wait) +#define XCHG_L(a, b) CHOICE(xchgl ARG2(a,b), xchgl ARG2(a,b), _LTOG xchg ARG2(b,a)) +#define XCHG_W(a, b) CHOICE(xchgw ARG2(a,b), xchgw ARG2(a,b), _WTOG xchg ARG2(b,a)) +#define XCHG_B(a, b) CHOICE(xchgb ARG2(a,b), xchgb ARG2(a,b), xchgb ARG2(b,a)) +#define XLAT CHOICE(xlat, xlat, xlat) +#define XOR_L(a, b) CHOICE(xorl ARG2(a,b), xorl ARG2(a,b), _LTOG xor ARG2(b,a)) +#define XOR_W(a, b) CHOICE(xorw ARG2(a,b), xorw ARG2(a,b), _WTOG xor ARG2(b,a)) +#define XOR_B(a, b) CHOICE(xorb ARG2(a,b), xorb ARG2(a,b), xorb ARG2(b,a)) + + +/* Floating Point Instructions */ +#define F2XM1 CHOICE(f2xm1, f2xm1, f2xm1) +#define FABS CHOICE(fabs, fabs, fabs) +#define FADD_D(a) CHOICE(faddl a, faddl a, faddd a) +#define FADD_S(a) CHOICE(fadds a, fadds a, fadds a) +#define FADD2(a, b) CHOICE(fadd ARG2(a,b), fadd ARG2(a,b), fadd ARG2(b,a)) +#define FADDP(a, b) CHOICE(faddp ARG2(a,b), faddp ARG2(a,b), faddp ARG2(b,a)) +#define FIADD_L(a) CHOICE(fiaddl a, fiaddl a, fiaddl a) +#define FIADD_W(a) CHOICE(fiadd a, fiadds a, fiadds a) +#define FBLD(a) CHOICE(fbld a, fbld a, fbld a) +#define FBSTP(a) CHOICE(fbstp a, fbstp a, fbstp a) +#define FCHS CHOICE(fchs, fchs, fchs) +#define FCLEX CHOICE(fclex, wait; fnclex, wait; fclex) +#define FNCLEX CHOICE(fnclex, fnclex, fclex) +#define FCOM(a) CHOICE(fcom a, fcom a, fcom a) +#define FCOM_D(a) CHOICE(fcoml a, fcoml a, fcomd a) +#define FCOM_S(a) CHOICE(fcoms a, fcoms a, fcoms a) +#define FCOMP(a) CHOICE(fcomp a, fcomp a, fcomp a) +#define FCOMP_D(a) CHOICE(fcompl a, fcompl a, fcompd a) +#define FCOMP_S(a) CHOICE(fcomps a, fcomps a, fcomps a) +#define FCOMPP CHOICE(fcompp, fcompp, fcompp) +#define FCOS CHOICE(fcos, fcos, fcos) +#define FDECSTP CHOICE(fdecstp, fdecstp, fdecstp) +#define FDIV_D(a) CHOICE(fdivl a, fdivl a, fdivd a) +#define FDIV_S(a) CHOICE(fdivs a, fdivs a, fdivs a) +#define FDIV2(a, b) CHOICE(fdiv ARG2(a,b), fdiv ARG2(a,b), fdiv ARG2(b,a)) +#define FDIVP(a, b) CHOICE(fdivp ARG2(a,b), fdivp ARG2(a,b), fdivp ARG2(b,a)) +#define FIDIV_L(a) CHOICE(fidivl a, fidivl a, fidivl a) +#define FIDIV_W(a) CHOICE(fidiv a, fidivs a, fidivs a) +#define FDIVR_D(a) CHOICE(fdivrl a, fdivrl a, fdivrd a) +#define FDIVR_S(a) CHOICE(fdivrs a, fdivrs a, fdivrs a) +#define FDIVR2(a, b) CHOICE(fdivr ARG2(a,b), fdivr ARG2(a,b), fdivr ARG2(b,a)) +#define FDIVRP(a, b) CHOICE(fdivrp ARG2(a,b), fdivrp ARG2(a,b), fdivrp ARG2(b,a)) +#define FIDIVR_L(a) CHOICE(fidivrl a, fidivrl a, fidivrl a) +#define FIDIVR_W(a) CHOICE(fidivr a, fidivrs a, fidivrs a) +#define FFREE(a) CHOICE(ffree a, ffree a, ffree a) +#define FICOM_L(a) CHOICE(ficoml a, ficoml a, ficoml a) +#define FICOM_W(a) CHOICE(ficom a, ficoms a, ficoms a) +#define FICOMP_L(a) CHOICE(ficompl a, ficompl a, ficompl a) +#define FICOMP_W(a) CHOICE(ficomp a, ficomps a, ficomps a) +#define FILD_Q(a) CHOICE(fildll a, fildq a, fildq a) +#define FILD_L(a) CHOICE(fildl a, fildl a, fildl a) +#define FILD_W(a) CHOICE(fild a, filds a, filds a) +#define FINCSTP CHOICE(fincstp, fincstp, fincstp) +#define FINIT CHOICE(finit, wait; fninit, wait; finit) +#define FNINIT CHOICE(fninit, fninit, finit) +#define FIST_L(a) CHOICE(fistl a, fistl a, fistl a) +#define FIST_W(a) CHOICE(fist a, fists a, fists a) +#define FISTP_Q(a) CHOICE(fistpll a, fistpq a, fistpq a) +#define FISTP_L(a) CHOICE(fistpl a, fistpl a, fistpl a) +#define FISTP_W(a) CHOICE(fistp a, fistps a, fistps a) +#define FLD_X(a) CHOICE(fldt a, fldt a, fldx a) /* 80 bit data type! */ +#define FLD_D(a) CHOICE(fldl a, fldl a, fldd a) +#define FLD_S(a) CHOICE(flds a, flds a, flds a) +#define FLD1 CHOICE(fld1, fld1, fld1) +#define FLDL2T CHOICE(fldl2t, fldl2t, fldl2t) +#define FLDL2E CHOICE(fldl2e, fldl2e, fldl2e) +#define FLDPI CHOICE(fldpi, fldpi, fldpi) +#define FLDLG2 CHOICE(fldlg2, fldlg2, fldlg2) +#define FLDLN2 CHOICE(fldln2, fldln2, fldln2) +#define FLDZ CHOICE(fldz, fldz, fldz) +#define FLDCW(a) CHOICE(fldcw a, fldcw a, fldcw a) +#define FLDENV(a) CHOICE(fldenv a, fldenv a, fldenv a) +#define FMUL_S(a) CHOICE(fmuls a, fmuls a, fmuls a) +#define FMUL_D(a) CHOICE(fmull a, fmull a, fmuld a) +#define FMUL2(a, b) CHOICE(fmul ARG2(a,b), fmul ARG2(a,b), fmul ARG2(b,a)) +#define FMULP(a, b) CHOICE(fmulp ARG2(a,b), fmulp ARG2(a,b), fmulp ARG2(b,a)) +#define FIMUL_L(a) CHOICE(fimull a, fimull a, fimull a) +#define FIMUL_W(a) CHOICE(fimul a, fimuls a, fimuls a) +#define FNOP CHOICE(fnop, fnop, fnop) +#define FPATAN CHOICE(fpatan, fpatan, fpatan) +#define FPREM CHOICE(fprem, fprem, fprem) +#define FPREM1 CHOICE(fprem1, fprem1, fprem1) +#define FPTAN CHOICE(fptan, fptan, fptan) +#define FRNDINT CHOICE(frndint, frndint, frndint) +#define FRSTOR(a) CHOICE(frstor a, frstor a, frstor a) +#define FSAVE(a) CHOICE(fsave a, wait; fnsave a, wait; fsave a) +#define FNSAVE(a) CHOICE(fnsave a, fnsave a, fsave a) +#define FSCALE CHOICE(fscale, fscale, fscale) +#define FSIN CHOICE(fsin, fsin, fsin) +#define FSINCOS CHOICE(fsincos, fsincos, fsincos) +#define FSQRT CHOICE(fsqrt, fsqrt, fsqrt) +#define FST_D(a) CHOICE(fstl a, fstl a, fstd a) +#define FST_S(a) CHOICE(fsts a, fsts a, fsts a) +#define FSTP_X(a) CHOICE(fstpt a, fstpt a, fstpx a) +#define FSTP_D(a) CHOICE(fstpl a, fstpl a, fstpd a) +#define FSTP_S(a) CHOICE(fstps a, fstps a, fstps a) +#define FSTP(a) CHOICE(fstp a, fstp a, fstp a) +#define FSTCW(a) CHOICE(fstcw a, wait; fnstcw a, wait; fstcw a) +#define FNSTCW(a) CHOICE(fnstcw a, fnstcw a, fstcw a) +#define FSTENV(a) CHOICE(fstenv a, wait; fnstenv a, fstenv a) +#define FNSTENV(a) CHOICE(fnstenv a, fnstenv a, fstenv a) +#define FSTSW(a) CHOICE(fstsw a, wait; fnstsw a, wait; fstsw a) +#define FNSTSW(a) CHOICE(fnstsw a, fnstsw a, fstsw a) +#define FSUB_S(a) CHOICE(fsubs a, fsubs a, fsubs a) +#define FSUB_D(a) CHOICE(fsubl a, fsubl a, fsubd a) +#define FSUB2(a, b) CHOICE(fsub ARG2(a,b), fsub ARG2(a,b), fsub ARG2(b,a)) +#define FSUBP(a, b) CHOICE(fsubp ARG2(a,b), fsubp ARG2(a,b), fsubp ARG2(b,a)) +#define FISUB_L(a) CHOICE(fisubl a, fisubl a, fisubl a) +#define FISUB_W(a) CHOICE(fisub a, fisubs a, fisubs a) +#define FSUBR_S(a) CHOICE(fsubrs a, fsubrs a, fsubrs a) +#define FSUBR_D(a) CHOICE(fsubrl a, fsubrl a, fsubrd a) +#define FSUBR2(a, b) CHOICE(fsubr ARG2(a,b), fsubr ARG2(a,b), fsubr ARG2(b,a)) +#define FSUBRP(a, b) CHOICE(fsubrp ARG2(a,b), fsubrp ARG2(a,b), fsubrp ARG2(b,a)) +#define FISUBR_L(a) CHOICE(fisubrl a, fisubrl a, fisubrl a) +#define FISUBR_W(a) CHOICE(fisubr a, fisubrs a, fisubrs a) +#define FTST CHOICE(ftst, ftst, ftst) +#define FUCOM(a) CHOICE(fucom a, fucom a, fucom a) +#define FUCOMP(a) CHOICE(fucomp a, fucomp a, fucomp a) +#define FUCOMPP CHOICE(fucompp, fucompp, fucompp) +#define FWAIT CHOICE(wait, wait, wait) +#define FXAM CHOICE(fxam, fxam, fxam) +#define FXCH(a) CHOICE(fxch a, fxch a, fxch a) +#define FXTRACT CHOICE(fxtract, fxtract, fxtract) +#define FYL2X CHOICE(fyl2x, fyl2x, fyl2x) +#define FYL2XP1 CHOICE(fyl2xp1, fyl2xp1, fyl2xp1) + +/* New instructions */ +#define CPUID CHOICE(D_BYTE ARG2(15, 162), cpuid, D_BYTE ARG2(15, 162)) +#define RDTSC CHOICE(D_BYTE ARG2(15, 49), rdtsc, D_BYTE ARG2(15, 49)) + +#else /* NASM_ASSEMBLER || MASM_ASSEMBLER is defined */ + + /****************************************/ + /* */ + /* Intel style assemblers. */ + /* (NASM and MASM) */ + /* */ + /****************************************/ + +#define P_EAX EAX +#define L_EAX EAX +#define W_AX AX +#define B_AH AH +#define B_AL AL + +#define P_EBX EBX +#define L_EBX EBX +#define W_BX BX +#define B_BH BH +#define B_BL BL + +#define P_ECX ECX +#define L_ECX ECX +#define W_CX CX +#define B_CH CH +#define B_CL CL + +#define P_EDX EDX +#define L_EDX EDX +#define W_DX DX +#define B_DH DH +#define B_DL DL + +#define P_EBP EBP +#define L_EBP EBP +#define W_BP BP + +#define P_ESI ESI +#define L_ESI ESI +#define W_SI SI + +#define P_EDI EDI +#define L_EDI EDI +#define W_DI DI + +#define P_ESP ESP +#define L_ESP ESP +#define W_SP SP + +#define W_CS CS +#define W_SS SS +#define W_DS DS +#define W_ES ES +#define W_FS FS +#define W_GS GS + +#define X_ST ST +#define D_ST ST +#define L_ST ST + +#define P_MM0 mm0 +#define P_MM1 mm1 +#define P_MM2 mm2 +#define P_MM3 mm3 +#define P_MM4 mm4 +#define P_MM5 mm5 +#define P_MM6 mm6 +#define P_MM7 mm7 + +#define P_XMM0 xmm0 +#define P_XMM1 xmm1 +#define P_XMM2 xmm2 +#define P_XMM3 xmm3 +#define P_XMM4 xmm4 +#define P_XMM5 xmm5 +#define P_XMM6 xmm6 +#define P_XMM7 xmm7 + +#define CONCAT(x, y) x ## y +#define CONCAT3(x, y, z) x ## y ## z + +#if defined(NASM_ASSEMBLER) + +#define ST(n) st ## n +#define ST0 st0 + +#define TBYTE_PTR tword +#define QWORD_PTR qword +#define DWORD_PTR dword +#define WORD_PTR word +#define BYTE_PTR byte + +#define OFFSET + +#define GLOBL GLOBAL +#define ALIGNTEXT32 ALIGN 32 +#define ALIGNTEXT16 ALIGN 16 +#define ALIGNTEXT8 ALIGN 8 +#define ALIGNTEXT4 ALIGN 4 +#define ALIGNTEXT2 ALIGN 2 +#define ALIGNTEXT32ifNOP ALIGN 32 +#define ALIGNTEXT16ifNOP ALIGN 16 +#define ALIGNTEXT8ifNOP ALIGN 8 +#define ALIGNTEXT4ifNOP ALIGN 4 +#define ALIGNDATA32 ALIGN 32 +#define ALIGNDATA16 ALIGN 16 +#define ALIGNDATA8 ALIGN 8 +#define ALIGNDATA4 ALIGN 4 +#define ALIGNDATA2 ALIGN 2 +#define FILE(s) +#define STRING(s) db s +#define D_LONG dd +#define D_WORD dw +#define D_BYTE db +/* #define SPACE */ +/* #define COMM */ +#if defined(__WATCOMC__) +SECTION _TEXT public align=16 class=CODE use32 flat +SECTION _DATA public align=16 class=DATA use32 flat +#define SEG_TEXT SECTION _TEXT +#define SEG_DATA SECTION _DATA +#define SEG_BSS SECTION .bss +#else +#define SEG_DATA SECTION .data +#define SEG_TEXT SECTION .text +#define SEG_BSS SECTION .bss +#endif + +#define D_SPACE(n) db n REP 0 + +#define AS_BEGIN + +/* Jcc's should be handled better than this... */ +#define NEAR near + +#else /* MASM */ + +#define TBYTE_PTR tbyte ptr +#define QWORD_PTR qword ptr +#define DWORD_PTR dword ptr +#define WORD_PTR word ptr +#define BYTE_PTR byte ptr + +#define OFFSET offset + +#define GLOBL GLOBAL +#define ALIGNTEXT32 ALIGN 32 +#define ALIGNTEXT16 ALIGN 16 +#define ALIGNTEXT8 ALIGN 8 +#define ALIGNTEXT4 ALIGN 4 +#define ALIGNTEXT2 ALIGN 2 +#define ALIGNTEXT32ifNOP ALIGN 32 +#define ALIGNTEXT16ifNOP ALIGN 16 +#define ALIGNTEXT8ifNOP ALIGN 8 +#define ALIGNTEXT4ifNOP ALIGN 4 +#define ALIGNDATA32 ALIGN 32 +#define ALIGNDATA16 ALIGN 16 +#define ALIGNDATA8 ALIGN 8 +#define ALIGNDATA4 ALIGN 4 +#define ALIGNDATA2 ALIGN 2 +#define FILE(s) +#define STRING(s) db s +#define D_LONG dd +#define D_WORD dw +#define D_BYTE db +/* #define SPACE */ +/* #define COMM */ +#define SEG_DATA .DATA +#define SEG_TEXT .CODE +#define SEG_BSS .DATA + +#define D_SPACE(n) db n REP 0 + +#define AS_BEGIN + +#define NEAR + +#endif + +#if defined(Lynx) || (defined(SYSV) || defined(SVR4)) \ + || (defined(__linux__) || defined(__OS2ELF__)) && defined(__ELF__) \ + || (defined(__FreeBSD__) && __FreeBSD__ >= 3) \ + || (defined(__NetBSD__) && defined(__ELF__)) +#define GLNAME(a) a +#else +#define GLNAME(a) CONCAT(_, a) +#endif + +/* + * Addressing Modes + */ + +/* Immediate Mode */ +#define P_ADDR(a) OFFSET a +#define X_ADDR(a) OFFSET a +#define D_ADDR(a) OFFSET a +#define L_ADDR(a) OFFSET a +#define W_ADDR(a) OFFSET a +#define B_ADDR(a) OFFSET a + +#define P_CONST(a) a +#define X_CONST(a) a +#define D_CONST(a) a +#define L_CONST(a) a +#define W_CONST(a) a +#define B_CONST(a) a + +/* Indirect Mode */ +#ifdef NASM_ASSEMBLER +#define P_CONTENT(a) [a] +#define X_CONTENT(a) TBYTE_PTR [a] +#define D_CONTENT(a) QWORD_PTR [a] +#define L_CONTENT(a) DWORD_PTR [a] +#define W_CONTENT(a) WORD_PTR [a] +#define B_CONTENT(a) BYTE_PTR [a] +#else +#define P_CONTENT(a) a +#define X_CONTENT(a) TBYTE_PTR a +#define D_CONTENT(a) QWORD_PTR a +#define L_CONTENT(a) DWORD_PTR a +#define W_CONTENT(a) WORD_PTR a +#define B_CONTENT(a) BYTE_PTR a +#endif + +/* Register a indirect */ +#define P_REGIND(a) [a] +#define X_REGIND(a) TBYTE_PTR [a] +#define D_REGIND(a) QWORD_PTR [a] +#define L_REGIND(a) DWORD_PTR [a] +#define W_REGIND(a) WORD_PTR [a] +#define B_REGIND(a) BYTE_PTR [a] + +/* Register b indirect plus displacement a */ +#define P_REGOFF(a, b) [b + a] +#define X_REGOFF(a, b) TBYTE_PTR [b + a] +#define D_REGOFF(a, b) QWORD_PTR [b + a] +#define L_REGOFF(a, b) DWORD_PTR [b + a] +#define W_REGOFF(a, b) WORD_PTR [b + a] +#define B_REGOFF(a, b) BYTE_PTR [b + a] + +/* Reg indirect Base + Index + Displacement - this is mainly for 16-bit mode + * which has no scaling + */ +#define P_REGBID(b, i, d) [b + i + d] +#define X_REGBID(b, i, d) TBYTE_PTR [b + i + d] +#define D_REGBID(b, i, d) QWORD_PTR [b + i + d] +#define L_REGBID(b, i, d) DWORD_PTR [b + i + d] +#define W_REGBID(b, i, d) WORD_PTR [b + i + d] +#define B_REGBID(b, i, d) BYTE_PTR [b + i + d] + +/* Reg indirect Base + (Index * Scale) */ +#define P_REGBIS(b, i, s) [b + i * s] +#define X_REGBIS(b, i, s) TBYTE_PTR [b + i * s] +#define D_REGBIS(b, i, s) QWORD_PTR [b + i * s] +#define L_REGBIS(b, i, s) DWORD_PTR [b + i * s] +#define W_REGBIS(b, i, s) WORD_PTR [b + i * s] +#define B_REGBIS(b, i, s) BYTE_PTR [b + i * s] + +/* Reg indirect Base + (Index * Scale) + Displacement */ +#define P_REGBISD(b, i, s, d) [b + i * s + d] +#define X_REGBISD(b, i, s, d) TBYTE_PTR [b + i * s + d] +#define D_REGBISD(b, i, s, d) QWORD_PTR [b + i * s + d] +#define L_REGBISD(b, i, s, d) DWORD_PTR [b + i * s + d] +#define W_REGBISD(b, i, s, d) WORD_PTR [b + i * s + d] +#define B_REGBISD(b, i, s, d) BYTE_PTR [b + i * s + d] + +/* Displaced Scaled Index: */ +#define P_REGDIS(d, i, s) [i * s + d] +#define X_REGDIS(d, i, s) TBYTE_PTR [i * s + d] +#define D_REGDIS(d, i, s) QWORD_PTR [i * s + d] +#define L_REGDIS(d, i, s) DWORD_PTR [i * s + d] +#define W_REGDIS(d, i, s) WORD_PTR [i * s + d] +#define B_REGDIS(d, i, s) BYTE_PTR [i * s + d] + +/* Indexed Base: */ +#define P_REGBI(b, i) [b + i] +#define X_REGBI(b, i) TBYTE_PTR [b + i] +#define D_REGBI(b, i) QWORD_PTR [b + i] +#define L_REGBI(b, i) DWORD_PTR [b + i] +#define W_REGBI(b, i) WORD_PTR [b + i] +#define B_REGBI(b, i) BYTE_PTR [b + i] + +/* Displaced Base: */ +#define P_REGDB(d, b) [b + d] +#define X_REGDB(d, b) TBYTE_PTR [b + d] +#define D_REGDB(d, b) QWORD_PTR [b + d] +#define L_REGDB(d, b) DWORD_PTR [b + d] +#define W_REGDB(d, b) WORD_PTR [b + d] +#define B_REGDB(d, b) BYTE_PTR [b + d] + +/* Variable indirect: */ +#define VARINDIRECT(var) [var] + +/* Use register contents as jump/call target: */ +#define CODEPTR(reg) P_(reg) + +/* + * Redefine assembler commands + */ + +#define P_(a) P_ ## a +#define X_(a) X_ ## a +#define D_(a) D_ ## a +#define SR_(a) W_ ## a +#define S_(a) L_ ## a +#define L_(a) L_ ## a +#define W_(a) W_ ## a +#define B_(a) B_ ## a + +#define AAA aaa +#define AAD aad +#define AAM aam +#define AAS aas +#define ADC_L(a, b) adc L_(b), L_(a) +#define ADC_W(a, b) adc W_(b), W_(a) +#define ADC_B(a, b) adc B_(b), B_(a) +#define ADD_L(a, b) add L_(b), L_(a) +#define ADD_W(a, b) add W_(b), W_(a) +#define ADD_B(a, b) add B_(b), B_(a) +#define AND_L(a, b) and L_(b), L_(a) +#define AND_W(a, b) and W_(b), W_(a) +#define AND_B(a, b) and B_(b), B_(a) +#define ARPL(a,b) arpl W_(b), a +#define BOUND_L(a, b) bound L_(b), L_(a) +#define BOUND_W(a, b) bound W_(b), W_(a) +#define BSF_L(a, b) bsf L_(b), L_(a) +#define BSF_W(a, b) bsf W_(b), W_(a) +#define BSR_L(a, b) bsr L_(b), L_(a) +#define BSR_W(a, b) bsr W_(b), W_(a) +#define BT_L(a, b) bt L_(b), L_(a) +#define BT_W(a, b) bt W_(b), W_(a) +#define BTC_L(a, b) btc L_(b), L_(a) +#define BTC_W(a, b) btc W_(b), W_(a) +#define BTR_L(a, b) btr L_(b), L_(a) +#define BTR_W(a, b) btr W_(b), W_(a) +#define BTS_L(a, b) bts L_(b), L_(a) +#define BTS_W(a, b) bts W_(b), W_(a) +#define CALL(a) call a +#define CALLF(s,a) call far s:a +#define CBW cbw +#define CWDE cwde +#define CLC clc +#define CLD cld +#define CLI cli +#define CLTS clts +#define CMC cmc +#define CMP_L(a, b) cmp L_(b), L_(a) +#define CMP_W(a, b) cmp W_(b), W_(a) +#define CMP_B(a, b) cmp B_(b), B_(a) +#define CMPS_L cmpsd +#define CMPS_W cmpsw +#define CMPS_B cmpsb +#define CPUID cpuid +#define CWD cwd +#define CDQ cdq +#define DAA daa +#define DAS das +#define DEC_L(a) dec L_(a) +#define DEC_W(a) dec W_(a) +#define DEC_B(a) dec B_(a) +#define DIV_L(a) div L_(a) +#define DIV_W(a) div W_(a) +#define DIV_B(a) div B_(a) +#define ENTER(a,b) enter b, a +#define HLT hlt +#define IDIV_L(a) idiv L_(a) +#define IDIV_W(a) idiv W_(a) +#define IDIV_B(a) idiv B_(a) +#define IMUL_L(a, b) imul L_(b), L_(a) +#define IMUL_W(a, b) imul W_(b), W_(a) +#define IMUL_B(a) imul B_(a) +#define IN_L in EAX, DX +#define IN_W in AX, DX +#define IN_B in AL, DX +#define IN1_L(a) in1 L_(a) +#define IN1_W(a) in1 W_(a) +#define IN1_B(a) in1 B_(a) +#define INC_L(a) inc L_(a) +#define INC_W(a) inc W_(a) +#define INC_B(a) inc B_(a) +#define INS_L ins +#define INS_W ins +#define INS_B ins +#define INT(a) int B_(a) +#define INT3 int3 +#define INTO into +#define IRET iret +#define IRETD iretd +#define JA(a) ja NEAR a +#define JAE(a) jae NEAR a +#define JB(a) jb NEAR a +#define JBE(a) jbe NEAR a +#define JC(a) jc NEAR a +#define JE(a) je NEAR a +#define JG(a) jg NEAR a +#define JGE(a) jge NEAR a +#define JL(a) jl NEAR a +#define JLE(a) jle NEAR a +#define JNA(a) jna NEAR a +#define JNAE(a) jnae NEAR a +#define JNB(a) jnb NEAR a +#define JNBE(a) jnbe NEAR a +#define JNC(a) jnc NEAR a +#define JNE(a) jne NEAR a +#define JNG(a) jng NEAR a +#define JNGE(a) jnge NEAR a +#define JNL(a) jnl NEAR a +#define JNLE(a) jnle NEAR a +#define JNO(a) jno NEAR a +#define JNP(a) jnp NEAR a +#define JNS(a) jns NEAR a +#define JNZ(a) jnz NEAR a +#define JO(a) jo NEAR a +#define JP(a) jp NEAR a +#define JPE(a) jpe NEAR a +#define JPO(a) jpo NEAR a +#define JS(a) js NEAR a +#define JZ(a) jz NEAR a +#define JMP(a) jmp a +#define JMPF(s,a) jmp far s:a +#define LAHF lahf +#define LAR(a, b) lar b, a +#define LEA_L(a, b) lea P_(b), P_(a) +#define LEA_W(a, b) lea P_(b), P_(a) +#define LEAVE leave +#define LGDT(a) lgdt a +#define LIDT(a) lidt a +#define LDS(a, b) lds b, P_(a) +#define LES(a, b) les b, P_(a) +#define LFS(a, b) lfs b, P_(a) +#define LGS(a, b) lgs b, P_(a) +#define LSS(a, b) lss b, P_(a) +#define LLDT(a) lldt a +#define LMSW(a) lmsw a +#define LOCK lock +#define LODS_L lodsd +#define LODS_W lodsw +#define LODS_B lodsb +#define LOOP(a) loop a +#define LOOPE(a) loope a +#define LOOPZ(a) loopz a +#define LOOPNE(a) loopne a +#define LOOPNZ(a) loopnz a +#define LSL(a, b) lsl b, a +#define LTR(a) ltr a +#define MOV_SR(a, b) mov SR_(b), SR_(a) +#define MOV_L(a, b) mov L_(b), L_(a) +#define MOV_W(a, b) mov W_(b), W_(a) +#define MOV_B(a, b) mov B_(b), B_(a) +#define MOVS_L movsd +#define MOVS_W movsw +#define MOVS_B movsb +#define MOVSX_BL(a, b) movsx B_(b), B_(a) +#define MOVSX_BW(a, b) movsx B_(b), B_(a) +#define MOVSX_WL(a, b) movsx W_(b), W_(a) +#define MOVZX_BL(a, b) movzx B_(b), B_(a) +#define MOVZX_BW(a, b) movzx B_(b), B_(a) +#define MOVZX_WL(a, b) movzx W_(b), W_(a) +#define MUL_L(a) mul L_(a) +#define MUL_W(a) mul W_(a) +#define MUL_B(a) mul B_(a) +#define NEG_L(a) neg L_(a) +#define NEG_W(a) neg W_(a) +#define NEG_B(a) neg B_(a) +#define NOP nop +#define NOT_L(a) not L_(a) +#define NOT_W(a) not W_(a) +#define NOT_B(a) not B_(a) +#define OR_L(a,b) or L_(b), L_(a) +#define OR_W(a,b) or W_(b), W_(a) +#define OR_B(a,b) or B_(b), B_(a) +#define OUT_L out DX, EAX +#define OUT_W out DX, AX +#define OUT_B out DX, AL +#define OUT1_L(a) out1 L_(a) +#define OUT1_W(a) out1 W_(a) +#define OUT1_B(a) out1 B_(a) +#define OUTS_L outsd +#define OUTS_W outsw +#define OUTS_B outsb +#define POP_SR(a) pop SR_(a) +#define POP_L(a) pop L_(a) +#define POP_W(a) pop W_(a) +#define POPA_L popad +#define POPA_W popa +#define POPF_L popfd +#define POPF_W popf +#define PUSH_SR(a) push SR_(a) +#define PUSH_L(a) push L_(a) +#define PUSH_W(a) push W_(a) +#define PUSH_B(a) push B_(a) +#define PUSHA_L pushad +#define PUSHA_W pusha +#define PUSHF_L pushfd +#define PUSHF_W pushf +#define RCL_L(a, b) rcl L_(b), L_(a) +#define RCL_W(a, b) rcl W_(b), W_(a) +#define RCL_B(a, b) rcl B_(b), B_(a) +#define RCR_L(a, b) rcr L_(b), L_(a) +#define RCR_W(a, b) rcr W_(b), W_(a) +#define RCR_B(a, b) rcr B_(b), B_(a) +#define RDTSC rdtsc +#define ROL_L(a, b) rol L_(b), L_(a) +#define ROL_W(a, b) rol W_(b), W_(a) +#define ROL_B(a, b) rol B_(b), B_(a) +#define ROR_L(a, b) ror L_(b), L_(a) +#define ROR_W(a, b) ror W_(b), W_(a) +#define ROR_B(a, b) ror B_(b), B_(a) +#define REP rep +#define REPE repe +#define REPNE repne +#define REPNZ REPNE +#define REPZ REPE +#define RET ret +#define SAHF sahf +#define SAL_L(a, b) sal L_(b), B_(a) +#define SAL_W(a, b) sal W_(b), B_(a) +#define SAL_B(a, b) sal B_(b), B_(a) +#define SAR_L(a, b) sar L_(b), B_(a) +#define SAR_W(a, b) sar W_(b), B_(a) +#define SAR_B(a, b) sar B_(b), B_(a) +#define SBB_L(a, b) sbb L_(b), L_(a) +#define SBB_W(a, b) sbb W_(b), W_(a) +#define SBB_B(a, b) sbb B_(b), B_(a) +#define SCAS_L scas +#define SCAS_W scas +#define SCAS_B scas +#define SETA(a) seta a +#define SETAE(a) setae a +#define SETB(a) setb a +#define SETBE(a) setbe a +#define SETC(a) setc a +#define SETE(a) sete a +#define SETG(a) setg a +#define SETGE(a) setge a +#define SETL(a) setl a +#define SETLE(a) setle a +#define SETNA(a) setna a +#define SETNAE(a) setnae a +#define SETNB(a) setnb a +#define SETNBE(a) setnbe a +#define SETNC(a) setnc a +#define SETNE(a) setne a +#define SETNG(a) setng a +#define SETNGE(a) setnge a +#define SETNL(a) setnl a +#define SETNLE(a) setnle a +#define SETNO(a) setno a +#define SETNP(a) setnp a +#define SETNS(a) setns a +#define SETNZ(a) setnz a +#define SETO(a) seto a +#define SETP(a) setp a +#define SETPE(a) setpe a +#define SETPO(a) setpo a +#define SETS(a) sets a +#define SETZ(a) setz a +#define SGDT(a) sgdt a +#define SIDT(a) sidt a +#define SHL_L(a, b) shl L_(b), B_(a) +#define SHL_W(a, b) shl W_(b), B_(a) +#define SHL_B(a, b) shl B_(b), B_(a) +#define SHLD_L(a,b,c) shld +#define SHLD2_L(a,b) shld L_(b), L_(a) +#define SHLD_W(a,b,c) shld +#define SHLD2_W(a,b) shld W_(b), W_(a) +#define SHR_L(a, b) shr L_(b), B_(a) +#define SHR_W(a, b) shr W_(b), B_(a) +#define SHR_B(a, b) shr B_(b), B_(a) +#define SHRD_L(a,b,c) shrd +#define SHRD2_L(a,b) shrd L_(b), L_(a) +#define SHRD_W(a,b,c) shrd +#define SHRD2_W(a,b) shrd W_(b), W_(a) +#define SLDT(a) sldt a +#define SMSW(a) smsw a +#define STC stc +#define STD std +#define STI sti +#define STOS_L stosd +#define STOS_W stosw +#define STOS_B stosb +#define STR(a) str a +#define SUB_L(a, b) sub L_(b), L_(a) +#define SUB_W(a, b) sub W_(b), W_(a) +#define SUB_B(a, b) sub B_(b), B_(a) +#define TEST_L(a, b) test L_(b), L_(a) +#define TEST_W(a, b) test W_(b), W_(a) +#define TEST_B(a, b) test B_(b), B_(a) +#define VERR(a) verr a +#define VERW(a) verw a +#define WAIT wait +#define XCHG_L(a, b) xchg L_(b), L_(a) +#define XCHG_W(a, b) xchg W_(b), W_(a) +#define XCHG_B(a, b) xchg B_(b), B_(a) +#define XLAT xlat +#define XOR_L(a, b) xor L_(b), L_(a) +#define XOR_W(a, b) xor W_(b), W_(a) +#define XOR_B(a, b) xor B_(b), B_(a) + + +/* Floating Point Instructions */ +#define F2XM1 f2xm1 +#define FABS fabs +#define FADD_D(a) fadd D_(a) +#define FADD_S(a) fadd S_(a) +#define FADD2(a, b) fadd b, a +#define FADDP(a, b) faddp b, a +#define FIADD_L(a) fiadd L_(a) +#define FIADD_W(a) fiadd W_(a) +#define FBLD(a) fbld a +#define FBSTP(a) fbstp a +#define FCHS fchs +#define FCLEX fclex +#define FNCLEX fnclex +#define FCOM(a) fcom a +#define FCOM_D(a) fcom D_(a) +#define FCOM_S(a) fcom S_(a) +#define FCOMP(a) fcomp a +#define FCOMP_D(a) fcomp D_(a) +#define FCOMP_S(a) fcomp S_(a) +#define FCOMPP fcompp +#define FCOS fcos +#define FDECSTP fdecstp +#define FDIV_D(a) fdiv D_(a) +#define FDIV_S(a) fdiv S_(a) +#define FDIV2(a, b) fdiv b, a +#define FDIVP(a, b) fdivp b, a +#define FIDIV_L(a) fidiv L_(a) +#define FIDIV_W(a) fidiv W_(a) +#define FDIVR_D(a) fdivr D_(a) +#define FDIVR_S(a) fdivr S_(a) +#define FDIVR2(a, b) fdivr b, a +#define FDIVRP(a, b) fdivrp b, a +#define FIDIVR_L(a) fidivr L_(a) +#define FIDIVR_W(a) fidivr W_(a) +#define FFREE(a) ffree a +#define FICOM_L(a) ficom L_(a) +#define FICOM_W(a) ficom W_(a) +#define FICOMP_L(a) ficomp L_(a) +#define FICOMP_W(a) ficomp W_(a) +#define FILD_Q(a) fild D_(a) +#define FILD_L(a) fild L_(a) +#define FILD_W(a) fild W_(a) +#define FINCSTP fincstp +#define FINIT finit +#define FNINIT fninit +#define FIST_L(a) fist L_(a) +#define FIST_W(a) fist W_(a) +#define FISTP_Q(a) fistp D_(a) +#define FISTP_L(a) fistp L_(a) +#define FISTP_W(a) fistp W_(a) +#define FLD_X(a) fld X_(a) +#define FLD_D(a) fld D_(a) +#define FLD_S(a) fld S_(a) +#define FLD1 fld1 +#define FLDL2T fldl2t +#define FLDL2E fldl2e +#define FLDPI fldpi +#define FLDLG2 fldlg2 +#define FLDLN2 fldln2 +#define FLDZ fldz +#define FLDCW(a) fldcw a +#define FLDENV(a) fldenv a +#define FMUL_S(a) fmul S_(a) +#define FMUL_D(a) fmul D_(a) +#define FMUL2(a, b) fmul b, a +#define FMULP(a, b) fmulp b, a +#define FIMUL_L(a) fimul L_(a) +#define FIMUL_W(a) fimul W_(a) +#define FNOP fnop +#define FPATAN fpatan +#define FPREM fprem +#define FPREM1 fprem1 +#define FPTAN fptan +#define FRNDINT frndint +#define FRSTOR(a) frstor a +#define FSAVE(a) fsave a +#define FNSAVE(a) fnsave a +#define FSCALE fscale +#define FSIN fsin +#define FSINCOS fsincos +#define FSQRT fsqrt +#define FST_D(a) fst D_(a) +#define FST_S(a) fst S_(a) +#define FSTP_X(a) fstp X_(a) +#define FSTP_D(a) fstp D_(a) +#define FSTP_S(a) fstp S_(a) +#define FSTP(a) fstp a +#define FSTCW(a) fstcw a +#define FNSTCW(a) fnstcw a +#define FSTENV(a) fstenv a +#define FNSTENV(a) fnstenv a +#define FSTSW(a) fstsw a +#define FNSTSW(a) fnstsw a +#define FSUB_S(a) fsub S_(a) +#define FSUB_D(a) fsub D_(a) +#define FSUB2(a, b) fsub b, a +#define FSUBP(a, b) fsubp b, a +#define FISUB_L(a) fisub L_(a) +#define FISUB_W(a) fisub W_(a) +#define FSUBR_S(a) fsubr S_(a) +#define FSUBR_D(a) fsubr D_(a) +#define FSUBR2(a, b) fsubr b, a +#define FSUBRP(a, b) fsubrp b, a +#define FISUBR_L(a) fisubr L_(a) +#define FISUBR_W(a) fisubr W_(a) +#define FTST ftst +#define FUCOM(a) fucom a +#define FUCOMP(a) fucomp a +#define FUCOMPP fucompp +#define FWAIT fwait +#define FXAM fxam +#define FXCH(a) fxch a +#define FXTRACT fxtract +#define FYL2X fyl2x +#define FYL2XP1 fyl2xp1 + +#endif /* NASM_ASSEMBLER, MASM_ASSEMBLER */ + + /****************************************/ + /* */ + /* Extensions to x86 insn set - */ + /* MMX, 3DNow! */ + /* */ + /****************************************/ + +#if defined(NASM_ASSEMBLER) || defined(MASM_ASSEMBLER) +#define P_ARG1(a) P_ ## a +#define P_ARG2(a, b) P_ ## b, P_ ## a +#define P_ARG3(a, b, c) P_ ## c, P_ ## b, P_ ## a +#else +#define P_ARG1(a) a +#define P_ARG2(a, b) a, b +#define P_ARG3(a, b, c) a, b, c +#endif + +/* MMX */ +#define MOVD(a, b) movd P_ARG2(a, b) +#define MOVQ(a, b) movq P_ARG2(a, b) + +#define PADDB(a, b) paddb P_ARG2(a, b) +#define PADDW(a, b) paddw P_ARG2(a, b) +#define PADDD(a, b) paddd P_ARG2(a, b) + +#define PADDSB(a, b) paddsb P_ARG2(a, b) +#define PADDSW(a, b) paddsw P_ARG2(a, b) + +#define PADDUSB(a, b) paddusb P_ARG2(a, b) +#define PADDUSW(a, b) paddusw P_ARG2(a, b) + +#define PSUBB(a, b) psubb P_ARG2(a, b) +#define PSUBW(a, b) psubw P_ARG2(a, b) +#define PSUBD(a, b) psubd P_ARG2(a, b) + +#define PSUBSB(a, b) psubsb P_ARG2(a, b) +#define PSUBSW(a, b) psubsw P_ARG2(a, b) + +#define PSUBUSB(a, b) psubusb P_ARG2(a, b) +#define PSUBUSW(a, b) psubusw P_ARG2(a, b) + +#define PCMPEQB(a, b) pcmpeqb P_ARG2(a, b) +#define PCMPEQW(a, b) pcmpeqw P_ARG2(a, b) +#define PCMPEQD(a, b) pcmpeqd P_ARG2(a, b) + +#define PCMPGTB(a, b) pcmpgtb P_ARG2(a, b) +#define PCMPGTW(a, b) pcmpgtw P_ARG2(a, b) +#define PCMPGTD(a, b) pcmpgtd P_ARG2(a, b) + +#define PMULHW(a, b) pmulhw P_ARG2(a, b) +#define PMULLW(a, b) pmullw P_ARG2(a, b) + +#define PMADDWD(a, b) pmaddwd P_ARG2(a, b) + +#define PAND(a, b) pand P_ARG2(a, b) + +#define PANDN(a, b) pandn P_ARG2(a, b) + +#define POR(a, b) por P_ARG2(a, b) + +#define PXOR(a, b) pxor P_ARG2(a, b) + +#define PSRAW(a, b) psraw P_ARG2(a, b) +#define PSRAD(a, b) psrad P_ARG2(a, b) + +#define PSRLW(a, b) psrlw P_ARG2(a, b) +#define PSRLD(a, b) psrld P_ARG2(a, b) +#define PSRLQ(a, b) psrlq P_ARG2(a, b) + +#define PSLLW(a, b) psllw P_ARG2(a, b) +#define PSLLD(a, b) pslld P_ARG2(a, b) +#define PSLLQ(a, b) psllq P_ARG2(a, b) + +#define PACKSSWB(a, b) packsswb P_ARG2(a, b) +#define PACKSSDW(a, b) packssdw P_ARG2(a, b) +#define PACKUSWB(a, b) packuswb P_ARG2(a, b) + +#define PUNPCKHBW(a, b) punpckhbw P_ARG2(a, b) +#define PUNPCKHWD(a, b) punpckhwd P_ARG2(a, b) +#define PUNPCKHDQ(a, b) punpckhdq P_ARG2(a, b) +#define PUNPCKLBW(a, b) punpcklbw P_ARG2(a, b) +#define PUNPCKLWD(a, b) punpcklwd P_ARG2(a, b) +#define PUNPCKLDQ(a, b) punpckldq P_ARG2(a, b) + +#define EMMS emms + +/* AMD 3DNow! */ +#define PAVGUSB(a, b) pavgusb P_ARG2(a, b) +#define PFADD(a, b) pfadd P_ARG2(a, b) +#define PFSUB(a, b) pfsub P_ARG2(a, b) +#define PFSUBR(a, b) pfsubr P_ARG2(a, b) +#define PFACC(a, b) pfacc P_ARG2(a, b) +#define PFCMPGE(a, b) pfcmpge P_ARG2(a, b) +#define PFCMPGT(a, b) pfcmpgt P_ARG2(a, b) +#define PFCMPEQ(a, b) pfcmpeq P_ARG2(a, b) +#define PFMIN(a, b) pfmin P_ARG2(a, b) +#define PFMAX(a, b) pfmax P_ARG2(a, b) +#define PI2FD(a, b) pi2fd P_ARG2(a, b) +#define PF2ID(a, b) pf2id P_ARG2(a, b) +#define PFRCP(a, b) pfrcp P_ARG2(a, b) +#define PFRSQRT(a, b) pfrsqrt P_ARG2(a, b) +#define PFMUL(a, b) pfmul P_ARG2(a, b) +#define PFRCPIT1(a, b) pfrcpit1 P_ARG2(a, b) +#define PFRSQIT1(a, b) pfrsqit1 P_ARG2(a, b) +#define PFRCPIT2(a, b) pfrcpit2 P_ARG2(a, b) +#define PMULHRW(a, b) pmulhrw P_ARG2(a, b) + +#define FEMMS femms +#define PREFETCH(a) prefetch P_ARG1(a) +#define PREFETCHW(a) prefetchw P_ARG1(a) + +/* Intel SSE */ +#define ADDPS(a, b) addps P_ARG2(a, b) +#define ADDSS(a, b) addss P_ARG2(a, b) +#define ANDNPS(a, b) andnps P_ARG2(a, b) +#define ANDPS(a, b) andps P_ARG2(a, b) +/* NASM only knows the pseudo ops for these. +#define CMPPS(a, b, c) cmpps P_ARG3(a, b, c) +#define CMPSS(a, b, c) cmpss P_ARG3(a, b, c) +*/ +#define CMPEQPS(a, b) cmpeqps P_ARG2(a, b) +#define CMPLTPS(a, b) cmpltps P_ARG2(a, b) +#define CMPLEPS(a, b) cmpleps P_ARG2(a, b) +#define CMPUNORDPS(a, b) cmpunordps P_ARG2(a, b) +#define CMPNEQPS(a, b) cmpneqps P_ARG2(a, b) +#define CMPNLTPS(a, b) cmpnltps P_ARG2(a, b) +#define CMPNLEPS(a, b) cmpnleps P_ARG2(a, b) +#define CMPORDPS(a, b) cmpordps P_ARG2(a, b) +#define CMPEQSS(a, b) cmpeqss P_ARG2(a, b) +#define CMPLTSS(a, b) cmpltss P_ARG2(a, b) +#define CMPLESS(a, b) cmpless P_ARG2(a, b) +#define CMPUNORDSS(a, b) cmpunordss P_ARG2(a, b) +#define CMPNEQSS(a, b) cmpneqss P_ARG2(a, b) +#define CMPNLTSS(a, b) cmpnltss P_ARG2(a, b) +#define CMPNLESS(a, b) cmpnless P_ARG2(a, b) +#define CMPORDSS(a, b) cmpordss P_ARG2(a, b) +#define COMISS(a, b) comiss P_ARG2(a, b) +#define CVTPI2PS(a, b) cvtpi2ps P_ARG2(a, b) +#define CVTPS2PI(a, b) cvtps2pi P_ARG2(a, b) +#define CVTSI2SS(a, b) cvtsi2ss P_ARG2(a, b) +#define CVTSS2SI(a, b) cvtss2si P_ARG2(a, b) +#define CVTTPS2PI(a, b) cvttps2pi P_ARG2(a, b) +#define CVTTSS2SI(a, b) cvttss2si P_ARG2(a, b) +#define DIVPS(a, b) divps P_ARG2(a, b) +#define DIVSS(a, b) divss P_ARG2(a, b) +#define FXRSTOR(a) fxrstor P_ARG1(a) +#define FXSAVE(a) fxsave P_ARG1(a) +#define LDMXCSR(a) ldmxcsr P_ARG1(a) +#define MAXPS(a, b) maxps P_ARG2(a, b) +#define MAXSS(a, b) maxss P_ARG2(a, b) +#define MINPS(a, b) minps P_ARG2(a, b) +#define MINSS(a, b) minss P_ARG2(a, b) +#define MOVAPS(a, b) movaps P_ARG2(a, b) +#define MOVHLPS(a, b) movhlps P_ARG2(a, b) +#define MOVHPS(a, b) movhps P_ARG2(a, b) +#define MOVLHPS(a, b) movlhps P_ARG2(a, b) +#define MOVLPS(a, b) movlps P_ARG2(a, b) +#define MOVMSKPS(a, b) movmskps P_ARG2(a, b) +#define MOVNTPS(a, b) movntps P_ARG2(a, b) +#define MOVNTQ(a, b) movntq P_ARG2(a, b) +#define MOVSS(a, b) movss P_ARG2(a, b) +#define MOVUPS(a, b) movups P_ARG2(a, b) +#define MULPS(a, b) mulps P_ARG2(a, b) +#define MULSS(a, b) mulss P_ARG2(a, b) +#define ORPS(a, b) orps P_ARG2(a, b) +#define RCPPS(a, b) rcpps P_ARG2(a, b) +#define RCPSS(a, b) rcpss P_ARG2(a, b) +#define RSQRTPS(a, b) rsqrtps P_ARG2(a, b) +#define RSQRTSS(a, b) rsqrtss P_ARG2(a, b) +#define SHUFPS(a, b, c) shufps P_ARG3(a, b, c) +#define SQRTPS(a, b) sqrtps P_ARG2(a, b) +#define SQRTSS(a, b) sqrtss P_ARG2(a, b) +#define STMXCSR(a) stmxcsr P_ARG1(a) +#define SUBPS(a, b) subps P_ARG2(a, b) +#define UCOMISS(a, b) ucomiss P_ARG2(a, b) +#define UNPCKHPS(a, b) unpckhps P_ARG2(a, b) +#define UNPCKLPS(a, b) unpcklps P_ARG2(a, b) +#define XORPS(a, b) xorps P_ARG2(a, b) + +#define PREFETCHNTA(a) prefetchnta P_ARG1(a) +#define PREFETCHT0(a) prefetcht0 P_ARG1(a) +#define PREFETCHT1(a) prefetcht1 P_ARG1(a) +#define PREFETCHT2(a) prefetcht2 P_ARG1(a) +#define SFENCE sfence + +/* Added by BrianP for FreeBSD (per David Dawes) */ +#if !defined(NASM_ASSEMBLER) && !defined(MASM_ASSEMBLER) && !defined(__bsdi__) +#define LLBL(a) CONCAT(.L,a) +#define LLBL2(a,b) CONCAT3(.L,a,b) +#else +#define LLBL(a) a +#define LLBL2(a,b) CONCAT(a,b) +#endif + +/* Segment overrides */ +#define SEGCS D_BYTE 46 +#define SEGDS D_BYTE 62 +#define SEGES D_BYTE 38 +#define SEGFS D_BYTE 100 +#define SEGGS D_BYTE 101 + +/* Temporary labels: valid until next non-local label */ +#ifdef NASM_ASSEMBLER +#define TLBL(a) CONCAT(.,a) +#else +#define TLBL(a) CONCAT(a,$) +#endif + +/* Hidden symbol visibility support. + * If we build with gcc's -fvisibility=hidden flag, we'll need to change + * the symbol visibility mode to 'default'. + */ +#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__) +# define HIDDEN(x) .hidden x +#elif defined(__GNUC__) && !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__) +# pragma GCC visibility push(default) +# define HIDDEN(x) .hidden x +#else +# define HIDDEN(x) +#endif + +#endif /* __ASSYNTAX_H__ */ diff --git a/mesalib/src/mesa/x86/clip_args.h b/mesalib/src/mesa/x86/clip_args.h index faa3c6f87..796611fbf 100644 --- a/mesalib/src/mesa/x86/clip_args.h +++ b/mesalib/src/mesa/x86/clip_args.h @@ -1,59 +1,59 @@ - -/* - * 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. - */ - -/* - * Clip test function interface for assembly code. Simply define - * FRAME_OFFSET to the number of bytes pushed onto the stack before - * using the ARG_* argument macros. - * - * Gareth Hughes - */ - -#ifndef __CLIP_ARGS_H__ -#define __CLIP_ARGS_H__ - -/* - * Offsets for clip_func arguments - * - * typedef GLvector4f *(*clip_func)( GLvector4f *clip_vec, - * GLvector4f *proj_vec, - * GLubyte clipMask[], - * GLubyte *orMask, - * GLubyte *andMask ); - */ - -#define OFFSET_SOURCE 4 -#define OFFSET_DEST 8 -#define OFFSET_CLIP 12 -#define OFFSET_OR 16 -#define OFFSET_AND 20 - -#define ARG_SOURCE REGOFF(FRAME_OFFSET+OFFSET_SOURCE, ESP) -#define ARG_DEST REGOFF(FRAME_OFFSET+OFFSET_DEST, ESP) -#define ARG_CLIP REGOFF(FRAME_OFFSET+OFFSET_CLIP, ESP) -#define ARG_OR REGOFF(FRAME_OFFSET+OFFSET_OR, ESP) -#define ARG_AND REGOFF(FRAME_OFFSET+OFFSET_AND, ESP) - -#endif + +/* + * 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. + */ + +/* + * Clip test function interface for assembly code. Simply define + * FRAME_OFFSET to the number of bytes pushed onto the stack before + * using the ARG_* argument macros. + * + * Gareth Hughes + */ + +#ifndef __CLIP_ARGS_H__ +#define __CLIP_ARGS_H__ + +/* + * Offsets for clip_func arguments + * + * typedef GLvector4f *(*clip_func)( GLvector4f *clip_vec, + * GLvector4f *proj_vec, + * GLubyte clipMask[], + * GLubyte *orMask, + * GLubyte *andMask ); + */ + +#define OFFSET_SOURCE 4 +#define OFFSET_DEST 8 +#define OFFSET_CLIP 12 +#define OFFSET_OR 16 +#define OFFSET_AND 20 + +#define ARG_SOURCE REGOFF(FRAME_OFFSET+OFFSET_SOURCE, ESP) +#define ARG_DEST REGOFF(FRAME_OFFSET+OFFSET_DEST, ESP) +#define ARG_CLIP REGOFF(FRAME_OFFSET+OFFSET_CLIP, ESP) +#define ARG_OR REGOFF(FRAME_OFFSET+OFFSET_OR, ESP) +#define ARG_AND REGOFF(FRAME_OFFSET+OFFSET_AND, ESP) + +#endif diff --git a/mesalib/src/mesa/x86/common_x86.c b/mesalib/src/mesa/x86/common_x86.c index f5b9357cc..b70ee5084 100644 --- a/mesalib/src/mesa/x86/common_x86.c +++ b/mesalib/src/mesa/x86/common_x86.c @@ -1,336 +1,336 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.1 - * - * Copyright (C) 1999-2006 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. - */ - -/** - * \file common_x86.c - * - * Check CPU capabilities & initialize optimized funtions for this particular - * processor. - * - * Changed by Andre Werthmann for using the new SSE functions. - * - * \author Holger Waechtler - * \author Andre Werthmann - */ - -/* XXX these includes should probably go into imports.h or glheader.h */ -#if defined(USE_SSE_ASM) && defined(__linux__) -#include -#endif -#if defined(USE_SSE_ASM) && defined(__FreeBSD__) -#include -#include -#endif -#if defined(USE_SSE_ASM) && defined(__OpenBSD__) -#include -#include -#include -#endif - -#include "main/imports.h" -#include "common_x86_asm.h" - - -/** Bitmask of X86_FEATURE_x bits */ -int _mesa_x86_cpu_features = 0x0; - -static int detection_debug = GL_FALSE; - -/* No reason for this to be public. - */ -extern GLuint _ASMAPI _mesa_x86_has_cpuid(void); -extern void _ASMAPI _mesa_x86_cpuid(GLuint op, GLuint *reg_eax, GLuint *reg_ebx, GLuint *reg_ecx, GLuint *reg_edx); -extern GLuint _ASMAPI _mesa_x86_cpuid_eax(GLuint op); -extern GLuint _ASMAPI _mesa_x86_cpuid_ebx(GLuint op); -extern GLuint _ASMAPI _mesa_x86_cpuid_ecx(GLuint op); -extern GLuint _ASMAPI _mesa_x86_cpuid_edx(GLuint op); - - -#if defined(USE_SSE_ASM) -/* - * We must verify that the Streaming SIMD Extensions are truly supported - * on this processor before we go ahead and hook out the optimized code. - * - * However, I have been told by Alan Cox that all 2.4 (and later) Linux - * kernels provide full SSE support on all processors that expose SSE via - * the CPUID mechanism. - */ - -/* These are assembly functions: */ -extern void _mesa_test_os_sse_support( void ); -extern void _mesa_test_os_sse_exception_support( void ); - - -#if defined(WIN32) -#ifndef STATUS_FLOAT_MULTIPLE_TRAPS -# define STATUS_FLOAT_MULTIPLE_TRAPS (0xC00002B5L) -#endif -static LONG WINAPI ExceptionFilter(LPEXCEPTION_POINTERS exp) -{ - PEXCEPTION_RECORD rec = exp->ExceptionRecord; - PCONTEXT ctx = exp->ContextRecord; - - if ( rec->ExceptionCode == EXCEPTION_ILLEGAL_INSTRUCTION ) { - _mesa_debug(NULL, "EXCEPTION_ILLEGAL_INSTRUCTION\n" ); - _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); - } else if ( rec->ExceptionCode == STATUS_FLOAT_MULTIPLE_TRAPS ) { - _mesa_debug(NULL, "STATUS_FLOAT_MULTIPLE_TRAPS\n"); - /* Windows seems to clear the exception flag itself, we just have to increment Eip */ - } else { - _mesa_debug(NULL, "UNEXPECTED EXCEPTION (0x%08x), terminating!\n" ); - return EXCEPTION_EXECUTE_HANDLER; - } - - if ( (ctx->ContextFlags & CONTEXT_CONTROL) != CONTEXT_CONTROL ) { - _mesa_debug(NULL, "Context does not contain control registers, terminating!\n"); - return EXCEPTION_EXECUTE_HANDLER; - } - ctx->Eip += 3; - - return EXCEPTION_CONTINUE_EXECUTION; -} -#endif /* WIN32 */ - - -/** - * Check if SSE is supported. - * If not, turn off the X86_FEATURE_XMM flag in _mesa_x86_cpu_features. - */ -void _mesa_check_os_sse_support( void ) -{ -#if defined(__FreeBSD__) - { - int ret, enabled; - unsigned int len; - len = sizeof(enabled); - ret = sysctlbyname("hw.instruction_sse", &enabled, &len, NULL, 0); - if (ret || !enabled) - _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); - } -#elif defined (__NetBSD__) - { - int ret, enabled; - size_t len = sizeof(enabled); - ret = sysctlbyname("machdep.sse", &enabled, &len, (void *)NULL, 0); - if (ret || !enabled) - _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); - } -#elif defined(__OpenBSD__) - { - int mib[2]; - int ret, enabled; - size_t len = sizeof(enabled); - - mib[0] = CTL_MACHDEP; - mib[1] = CPU_SSE; - - ret = sysctl(mib, 2, &enabled, &len, NULL, 0); - if (ret || !enabled) - _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); - } -#elif defined(WIN32) - LPTOP_LEVEL_EXCEPTION_FILTER oldFilter; - - /* Install our ExceptionFilter */ - oldFilter = SetUnhandledExceptionFilter( ExceptionFilter ); - - if ( cpu_has_xmm ) { - _mesa_debug(NULL, "Testing OS support for SSE...\n"); - - _mesa_test_os_sse_support(); - - if ( cpu_has_xmm ) { - _mesa_debug(NULL, "Yes.\n"); - } else { - _mesa_debug(NULL, "No!\n"); - } - } - - if ( cpu_has_xmm ) { - _mesa_debug(NULL, "Testing OS support for SSE unmasked exceptions...\n"); - - _mesa_test_os_sse_exception_support(); - - if ( cpu_has_xmm ) { - _mesa_debug(NULL, "Yes.\n"); - } else { - _mesa_debug(NULL, "No!\n"); - } - } - - /* Restore previous exception filter */ - SetUnhandledExceptionFilter( oldFilter ); - - if ( cpu_has_xmm ) { - _mesa_debug(NULL, "Tests of OS support for SSE passed.\n"); - } else { - _mesa_debug(NULL, "Tests of OS support for SSE failed!\n"); - } -#else - /* Do nothing on other platforms for now. - */ - if (detection_debug) - _mesa_debug(NULL, "Not testing OS support for SSE, leaving enabled.\n"); -#endif /* __FreeBSD__ */ -} - -#endif /* USE_SSE_ASM */ - - -/** - * Initialize the _mesa_x86_cpu_features bitfield. - * This is a no-op if called more than once. - */ -void -_mesa_get_x86_features(void) -{ - static int called = 0; - - if (called) - return; - - called = 1; - -#ifdef USE_X86_ASM - _mesa_x86_cpu_features = 0x0; - - if (_mesa_getenv( "MESA_NO_ASM")) { - return; - } - - if (!_mesa_x86_has_cpuid()) { - _mesa_debug(NULL, "CPUID not detected\n"); - } - else { - GLuint cpu_features; - GLuint cpu_ext_features; - GLuint cpu_ext_info; - char cpu_vendor[13]; - GLuint result; - - /* get vendor name */ - _mesa_x86_cpuid(0, &result, (GLuint *)(cpu_vendor + 0), (GLuint *)(cpu_vendor + 8), (GLuint *)(cpu_vendor + 4)); - cpu_vendor[12] = '\0'; - - if (detection_debug) - _mesa_debug(NULL, "CPU vendor: %s\n", cpu_vendor); - - /* get cpu features */ - cpu_features = _mesa_x86_cpuid_edx(1); - - if (cpu_features & X86_CPU_FPU) - _mesa_x86_cpu_features |= X86_FEATURE_FPU; - if (cpu_features & X86_CPU_CMOV) - _mesa_x86_cpu_features |= X86_FEATURE_CMOV; - -#ifdef USE_MMX_ASM - if (cpu_features & X86_CPU_MMX) - _mesa_x86_cpu_features |= X86_FEATURE_MMX; -#endif - -#ifdef USE_SSE_ASM - if (cpu_features & X86_CPU_XMM) - _mesa_x86_cpu_features |= X86_FEATURE_XMM; - if (cpu_features & X86_CPU_XMM2) - _mesa_x86_cpu_features |= X86_FEATURE_XMM2; -#endif - - /* query extended cpu features */ - if ((cpu_ext_info = _mesa_x86_cpuid_eax(0x80000000)) > 0x80000000) { - if (cpu_ext_info >= 0x80000001) { - - cpu_ext_features = _mesa_x86_cpuid_edx(0x80000001); - - if (cpu_features & X86_CPU_MMX) { - -#ifdef USE_3DNOW_ASM - if (cpu_ext_features & X86_CPUEXT_3DNOW) - _mesa_x86_cpu_features |= X86_FEATURE_3DNOW; - if (cpu_ext_features & X86_CPUEXT_3DNOW_EXT) - _mesa_x86_cpu_features |= X86_FEATURE_3DNOWEXT; -#endif - -#ifdef USE_MMX_ASM - if (cpu_ext_features & X86_CPUEXT_MMX_EXT) - _mesa_x86_cpu_features |= X86_FEATURE_MMXEXT; -#endif - } - } - - /* query cpu name */ - if (cpu_ext_info >= 0x80000002) { - GLuint ofs; - char cpu_name[49]; - for (ofs = 0; ofs < 3; ofs++) - _mesa_x86_cpuid(0x80000002+ofs, (GLuint *)(cpu_name + (16*ofs)+0), (GLuint *)(cpu_name + (16*ofs)+4), (GLuint *)(cpu_name + (16*ofs)+8), (GLuint *)(cpu_name + (16*ofs)+12)); - cpu_name[48] = '\0'; /* the name should be NULL terminated, but just to be sure */ - - if (detection_debug) - _mesa_debug(NULL, "CPU name: %s\n", cpu_name); - } - } - - } - -#ifdef USE_MMX_ASM - if ( cpu_has_mmx ) { - if ( _mesa_getenv( "MESA_NO_MMX" ) == 0 ) { - if (detection_debug) - _mesa_debug(NULL, "MMX cpu detected.\n"); - } else { - _mesa_x86_cpu_features &= ~(X86_FEATURE_MMX); - } - } -#endif - -#ifdef USE_3DNOW_ASM - if ( cpu_has_3dnow ) { - if ( _mesa_getenv( "MESA_NO_3DNOW" ) == 0 ) { - if (detection_debug) - _mesa_debug(NULL, "3DNow! cpu detected.\n"); - } else { - _mesa_x86_cpu_features &= ~(X86_FEATURE_3DNOW); - } - } -#endif - -#ifdef USE_SSE_ASM - if ( cpu_has_xmm ) { - if ( _mesa_getenv( "MESA_NO_SSE" ) == 0 ) { - if (detection_debug) - _mesa_debug(NULL, "SSE cpu detected.\n"); - if ( _mesa_getenv( "MESA_FORCE_SSE" ) == 0 ) { - _mesa_check_os_sse_support(); - } - } else { - _mesa_debug(NULL, "SSE cpu detected, but switched off by user.\n"); - _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); - } - } -#endif - -#endif /* USE_X86_ASM */ - - (void) detection_debug; -} +/* + * Mesa 3-D graphics library + * Version: 6.5.1 + * + * Copyright (C) 1999-2006 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. + */ + +/** + * \file common_x86.c + * + * Check CPU capabilities & initialize optimized funtions for this particular + * processor. + * + * Changed by Andre Werthmann for using the new SSE functions. + * + * \author Holger Waechtler + * \author Andre Werthmann + */ + +/* XXX these includes should probably go into imports.h or glheader.h */ +#if defined(USE_SSE_ASM) && defined(__linux__) +#include +#endif +#if defined(USE_SSE_ASM) && defined(__FreeBSD__) +#include +#include +#endif +#if defined(USE_SSE_ASM) && defined(__OpenBSD__) +#include +#include +#include +#endif + +#include "main/imports.h" +#include "common_x86_asm.h" + + +/** Bitmask of X86_FEATURE_x bits */ +int _mesa_x86_cpu_features = 0x0; + +static int detection_debug = GL_FALSE; + +/* No reason for this to be public. + */ +extern GLuint _ASMAPI _mesa_x86_has_cpuid(void); +extern void _ASMAPI _mesa_x86_cpuid(GLuint op, GLuint *reg_eax, GLuint *reg_ebx, GLuint *reg_ecx, GLuint *reg_edx); +extern GLuint _ASMAPI _mesa_x86_cpuid_eax(GLuint op); +extern GLuint _ASMAPI _mesa_x86_cpuid_ebx(GLuint op); +extern GLuint _ASMAPI _mesa_x86_cpuid_ecx(GLuint op); +extern GLuint _ASMAPI _mesa_x86_cpuid_edx(GLuint op); + + +#if defined(USE_SSE_ASM) +/* + * We must verify that the Streaming SIMD Extensions are truly supported + * on this processor before we go ahead and hook out the optimized code. + * + * However, I have been told by Alan Cox that all 2.4 (and later) Linux + * kernels provide full SSE support on all processors that expose SSE via + * the CPUID mechanism. + */ + +/* These are assembly functions: */ +extern void _mesa_test_os_sse_support( void ); +extern void _mesa_test_os_sse_exception_support( void ); + + +#if defined(WIN32) +#ifndef STATUS_FLOAT_MULTIPLE_TRAPS +# define STATUS_FLOAT_MULTIPLE_TRAPS (0xC00002B5L) +#endif +static LONG WINAPI ExceptionFilter(LPEXCEPTION_POINTERS exp) +{ + PEXCEPTION_RECORD rec = exp->ExceptionRecord; + PCONTEXT ctx = exp->ContextRecord; + + if ( rec->ExceptionCode == EXCEPTION_ILLEGAL_INSTRUCTION ) { + _mesa_debug(NULL, "EXCEPTION_ILLEGAL_INSTRUCTION\n" ); + _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); + } else if ( rec->ExceptionCode == STATUS_FLOAT_MULTIPLE_TRAPS ) { + _mesa_debug(NULL, "STATUS_FLOAT_MULTIPLE_TRAPS\n"); + /* Windows seems to clear the exception flag itself, we just have to increment Eip */ + } else { + _mesa_debug(NULL, "UNEXPECTED EXCEPTION (0x%08x), terminating!\n" ); + return EXCEPTION_EXECUTE_HANDLER; + } + + if ( (ctx->ContextFlags & CONTEXT_CONTROL) != CONTEXT_CONTROL ) { + _mesa_debug(NULL, "Context does not contain control registers, terminating!\n"); + return EXCEPTION_EXECUTE_HANDLER; + } + ctx->Eip += 3; + + return EXCEPTION_CONTINUE_EXECUTION; +} +#endif /* WIN32 */ + + +/** + * Check if SSE is supported. + * If not, turn off the X86_FEATURE_XMM flag in _mesa_x86_cpu_features. + */ +void _mesa_check_os_sse_support( void ) +{ +#if defined(__FreeBSD__) + { + int ret, enabled; + unsigned int len; + len = sizeof(enabled); + ret = sysctlbyname("hw.instruction_sse", &enabled, &len, NULL, 0); + if (ret || !enabled) + _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); + } +#elif defined (__NetBSD__) + { + int ret, enabled; + size_t len = sizeof(enabled); + ret = sysctlbyname("machdep.sse", &enabled, &len, (void *)NULL, 0); + if (ret || !enabled) + _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); + } +#elif defined(__OpenBSD__) + { + int mib[2]; + int ret, enabled; + size_t len = sizeof(enabled); + + mib[0] = CTL_MACHDEP; + mib[1] = CPU_SSE; + + ret = sysctl(mib, 2, &enabled, &len, NULL, 0); + if (ret || !enabled) + _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); + } +#elif defined(WIN32) + LPTOP_LEVEL_EXCEPTION_FILTER oldFilter; + + /* Install our ExceptionFilter */ + oldFilter = SetUnhandledExceptionFilter( ExceptionFilter ); + + if ( cpu_has_xmm ) { + _mesa_debug(NULL, "Testing OS support for SSE...\n"); + + _mesa_test_os_sse_support(); + + if ( cpu_has_xmm ) { + _mesa_debug(NULL, "Yes.\n"); + } else { + _mesa_debug(NULL, "No!\n"); + } + } + + if ( cpu_has_xmm ) { + _mesa_debug(NULL, "Testing OS support for SSE unmasked exceptions...\n"); + + _mesa_test_os_sse_exception_support(); + + if ( cpu_has_xmm ) { + _mesa_debug(NULL, "Yes.\n"); + } else { + _mesa_debug(NULL, "No!\n"); + } + } + + /* Restore previous exception filter */ + SetUnhandledExceptionFilter( oldFilter ); + + if ( cpu_has_xmm ) { + _mesa_debug(NULL, "Tests of OS support for SSE passed.\n"); + } else { + _mesa_debug(NULL, "Tests of OS support for SSE failed!\n"); + } +#else + /* Do nothing on other platforms for now. + */ + if (detection_debug) + _mesa_debug(NULL, "Not testing OS support for SSE, leaving enabled.\n"); +#endif /* __FreeBSD__ */ +} + +#endif /* USE_SSE_ASM */ + + +/** + * Initialize the _mesa_x86_cpu_features bitfield. + * This is a no-op if called more than once. + */ +void +_mesa_get_x86_features(void) +{ + static int called = 0; + + if (called) + return; + + called = 1; + +#ifdef USE_X86_ASM + _mesa_x86_cpu_features = 0x0; + + if (_mesa_getenv( "MESA_NO_ASM")) { + return; + } + + if (!_mesa_x86_has_cpuid()) { + _mesa_debug(NULL, "CPUID not detected\n"); + } + else { + GLuint cpu_features; + GLuint cpu_ext_features; + GLuint cpu_ext_info; + char cpu_vendor[13]; + GLuint result; + + /* get vendor name */ + _mesa_x86_cpuid(0, &result, (GLuint *)(cpu_vendor + 0), (GLuint *)(cpu_vendor + 8), (GLuint *)(cpu_vendor + 4)); + cpu_vendor[12] = '\0'; + + if (detection_debug) + _mesa_debug(NULL, "CPU vendor: %s\n", cpu_vendor); + + /* get cpu features */ + cpu_features = _mesa_x86_cpuid_edx(1); + + if (cpu_features & X86_CPU_FPU) + _mesa_x86_cpu_features |= X86_FEATURE_FPU; + if (cpu_features & X86_CPU_CMOV) + _mesa_x86_cpu_features |= X86_FEATURE_CMOV; + +#ifdef USE_MMX_ASM + if (cpu_features & X86_CPU_MMX) + _mesa_x86_cpu_features |= X86_FEATURE_MMX; +#endif + +#ifdef USE_SSE_ASM + if (cpu_features & X86_CPU_XMM) + _mesa_x86_cpu_features |= X86_FEATURE_XMM; + if (cpu_features & X86_CPU_XMM2) + _mesa_x86_cpu_features |= X86_FEATURE_XMM2; +#endif + + /* query extended cpu features */ + if ((cpu_ext_info = _mesa_x86_cpuid_eax(0x80000000)) > 0x80000000) { + if (cpu_ext_info >= 0x80000001) { + + cpu_ext_features = _mesa_x86_cpuid_edx(0x80000001); + + if (cpu_features & X86_CPU_MMX) { + +#ifdef USE_3DNOW_ASM + if (cpu_ext_features & X86_CPUEXT_3DNOW) + _mesa_x86_cpu_features |= X86_FEATURE_3DNOW; + if (cpu_ext_features & X86_CPUEXT_3DNOW_EXT) + _mesa_x86_cpu_features |= X86_FEATURE_3DNOWEXT; +#endif + +#ifdef USE_MMX_ASM + if (cpu_ext_features & X86_CPUEXT_MMX_EXT) + _mesa_x86_cpu_features |= X86_FEATURE_MMXEXT; +#endif + } + } + + /* query cpu name */ + if (cpu_ext_info >= 0x80000002) { + GLuint ofs; + char cpu_name[49]; + for (ofs = 0; ofs < 3; ofs++) + _mesa_x86_cpuid(0x80000002+ofs, (GLuint *)(cpu_name + (16*ofs)+0), (GLuint *)(cpu_name + (16*ofs)+4), (GLuint *)(cpu_name + (16*ofs)+8), (GLuint *)(cpu_name + (16*ofs)+12)); + cpu_name[48] = '\0'; /* the name should be NULL terminated, but just to be sure */ + + if (detection_debug) + _mesa_debug(NULL, "CPU name: %s\n", cpu_name); + } + } + + } + +#ifdef USE_MMX_ASM + if ( cpu_has_mmx ) { + if ( _mesa_getenv( "MESA_NO_MMX" ) == 0 ) { + if (detection_debug) + _mesa_debug(NULL, "MMX cpu detected.\n"); + } else { + _mesa_x86_cpu_features &= ~(X86_FEATURE_MMX); + } + } +#endif + +#ifdef USE_3DNOW_ASM + if ( cpu_has_3dnow ) { + if ( _mesa_getenv( "MESA_NO_3DNOW" ) == 0 ) { + if (detection_debug) + _mesa_debug(NULL, "3DNow! cpu detected.\n"); + } else { + _mesa_x86_cpu_features &= ~(X86_FEATURE_3DNOW); + } + } +#endif + +#ifdef USE_SSE_ASM + if ( cpu_has_xmm ) { + if ( _mesa_getenv( "MESA_NO_SSE" ) == 0 ) { + if (detection_debug) + _mesa_debug(NULL, "SSE cpu detected.\n"); + if ( _mesa_getenv( "MESA_FORCE_SSE" ) == 0 ) { + _mesa_check_os_sse_support(); + } + } else { + _mesa_debug(NULL, "SSE cpu detected, but switched off by user.\n"); + _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); + } + } +#endif + +#endif /* USE_X86_ASM */ + + (void) detection_debug; +} diff --git a/mesalib/src/mesa/x86/common_x86_asm.S b/mesalib/src/mesa/x86/common_x86_asm.S index 1d61bde58..ea4047a0e 100644 --- a/mesalib/src/mesa/x86/common_x86_asm.S +++ b/mesalib/src/mesa/x86/common_x86_asm.S @@ -1,220 +1,220 @@ -/* - * 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. - */ - -/* - * Check extended CPU capabilities. Now justs returns the raw CPUID - * feature information, allowing the higher level code to interpret the - * results. - * - * Written by Holger Waechtler - * - * Cleaned up and simplified by Gareth Hughes - * - */ - -/* - * NOTE: Avoid using spaces in between '(' ')' and arguments, especially - * with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces - * in there will break the build on some platforms. - */ - -#include "matypes.h" -#include "assyntax.h" -#include "common_x86_features.h" - - SEG_TEXT - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_x86_has_cpuid) -HIDDEN(_mesa_x86_has_cpuid) -GLNAME(_mesa_x86_has_cpuid): - - /* Test for the CPUID command. If the ID Flag bit in EFLAGS - * (bit 21) is writable, the CPUID command is present */ - PUSHF_L - POP_L (EAX) - MOV_L (EAX, ECX) - XOR_L (CONST(0x00200000), EAX) - PUSH_L (EAX) - POPF_L - PUSHF_L - POP_L (EAX) - - /* Verify the ID Flag bit has been written. */ - CMP_L (ECX, EAX) - SETNE (AL) - XOR_L (CONST(0xff), EAX) - - RET - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_x86_cpuid) -HIDDEN(_mesa_x86_cpuid) -GLNAME(_mesa_x86_cpuid): - - MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ - PUSH_L (EDI) - PUSH_L (EBX) - - CPUID - - MOV_L (REGOFF(16, ESP), EDI) /* *eax */ - MOV_L (EAX, REGIND(EDI)) - MOV_L (REGOFF(20, ESP), EDI) /* *ebx */ - MOV_L (EBX, REGIND(EDI)) - MOV_L (REGOFF(24, ESP), EDI) /* *ecx */ - MOV_L (ECX, REGIND(EDI)) - MOV_L (REGOFF(28, ESP), EDI) /* *edx */ - MOV_L (EDX, REGIND(EDI)) - - POP_L (EBX) - POP_L (EDI) - RET - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_x86_cpuid_eax) -HIDDEN(_mesa_x86_cpuid_eax) -GLNAME(_mesa_x86_cpuid_eax): - - MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ - PUSH_L (EBX) - - CPUID - - POP_L (EBX) - RET - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_x86_cpuid_ebx) -HIDDEN(_mesa_x86_cpuid_ebx) -GLNAME(_mesa_x86_cpuid_ebx): - - MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ - PUSH_L (EBX) - - CPUID - MOV_L (EBX, EAX) /* return EBX */ - - POP_L (EBX) - RET - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_x86_cpuid_ecx) -HIDDEN(_mesa_x86_cpuid_ecx) -GLNAME(_mesa_x86_cpuid_ecx): - - MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ - PUSH_L (EBX) - - CPUID - MOV_L (ECX, EAX) /* return ECX */ - - POP_L (EBX) - RET - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_x86_cpuid_edx) -HIDDEN(_mesa_x86_cpuid_edx) -GLNAME(_mesa_x86_cpuid_edx): - - MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ - PUSH_L (EBX) - - CPUID - MOV_L (EDX, EAX) /* return EDX */ - - POP_L (EBX) - RET - -#ifdef USE_SSE_ASM -/* Execute an SSE instruction to see if the operating system correctly - * supports SSE. A signal handler for SIGILL should have been set - * before calling this function, otherwise this could kill the client - * application. - * - * -----> !!!! ATTENTION DEVELOPERS !!!! <----- - * - * If you're debugging with gdb and you get stopped in this function, - * just type 'continue'! Execution will proceed normally. - * See freedesktop.org bug #1709 for more info. - */ -ALIGNTEXT4 -GLOBL GLNAME( _mesa_test_os_sse_support ) -HIDDEN(_mesa_test_os_sse_support) -GLNAME( _mesa_test_os_sse_support ): - - XORPS ( XMM0, XMM0 ) - - RET - - -/* Perform an SSE divide-by-zero to see if the operating system - * correctly supports unmasked SIMD FPU exceptions. Signal handlers for - * SIGILL and SIGFPE should have been set before calling this function, - * otherwise this could kill the client application. - */ -ALIGNTEXT4 -GLOBL GLNAME( _mesa_test_os_sse_exception_support ) -HIDDEN(_mesa_test_os_sse_exception_support) -GLNAME( _mesa_test_os_sse_exception_support ): - - PUSH_L ( EBP ) - MOV_L ( ESP, EBP ) - SUB_L ( CONST( 8 ), ESP ) - - /* Save the original MXCSR register value. - */ - STMXCSR ( REGOFF( -4, EBP ) ) - - /* Unmask the divide-by-zero exception and perform one. - */ - STMXCSR ( REGOFF( -8, EBP ) ) - AND_L ( CONST( 0xfffffdff ), REGOFF( -8, EBP ) ) - LDMXCSR ( REGOFF( -8, EBP ) ) - - XORPS ( XMM0, XMM0 ) - - PUSH_L ( CONST( 0x3f800000 ) ) - PUSH_L ( CONST( 0x3f800000 ) ) - PUSH_L ( CONST( 0x3f800000 ) ) - PUSH_L ( CONST( 0x3f800000 ) ) - - MOVUPS ( REGIND( ESP ), XMM1 ) - - DIVPS ( XMM0, XMM1 ) - - /* Restore the original MXCSR register value. - */ - LDMXCSR ( REGOFF( -4, EBP ) ) - - LEAVE - RET - -#endif - - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif +/* + * 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. + */ + +/* + * Check extended CPU capabilities. Now justs returns the raw CPUID + * feature information, allowing the higher level code to interpret the + * results. + * + * Written by Holger Waechtler + * + * Cleaned up and simplified by Gareth Hughes + * + */ + +/* + * NOTE: Avoid using spaces in between '(' ')' and arguments, especially + * with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces + * in there will break the build on some platforms. + */ + +#include "matypes.h" +#include "assyntax.h" +#include "common_x86_features.h" + + SEG_TEXT + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_has_cpuid) +HIDDEN(_mesa_x86_has_cpuid) +GLNAME(_mesa_x86_has_cpuid): + + /* Test for the CPUID command. If the ID Flag bit in EFLAGS + * (bit 21) is writable, the CPUID command is present */ + PUSHF_L + POP_L (EAX) + MOV_L (EAX, ECX) + XOR_L (CONST(0x00200000), EAX) + PUSH_L (EAX) + POPF_L + PUSHF_L + POP_L (EAX) + + /* Verify the ID Flag bit has been written. */ + CMP_L (ECX, EAX) + SETNE (AL) + XOR_L (CONST(0xff), EAX) + + RET + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_cpuid) +HIDDEN(_mesa_x86_cpuid) +GLNAME(_mesa_x86_cpuid): + + MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ + PUSH_L (EDI) + PUSH_L (EBX) + + CPUID + + MOV_L (REGOFF(16, ESP), EDI) /* *eax */ + MOV_L (EAX, REGIND(EDI)) + MOV_L (REGOFF(20, ESP), EDI) /* *ebx */ + MOV_L (EBX, REGIND(EDI)) + MOV_L (REGOFF(24, ESP), EDI) /* *ecx */ + MOV_L (ECX, REGIND(EDI)) + MOV_L (REGOFF(28, ESP), EDI) /* *edx */ + MOV_L (EDX, REGIND(EDI)) + + POP_L (EBX) + POP_L (EDI) + RET + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_cpuid_eax) +HIDDEN(_mesa_x86_cpuid_eax) +GLNAME(_mesa_x86_cpuid_eax): + + MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ + PUSH_L (EBX) + + CPUID + + POP_L (EBX) + RET + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_cpuid_ebx) +HIDDEN(_mesa_x86_cpuid_ebx) +GLNAME(_mesa_x86_cpuid_ebx): + + MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ + PUSH_L (EBX) + + CPUID + MOV_L (EBX, EAX) /* return EBX */ + + POP_L (EBX) + RET + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_cpuid_ecx) +HIDDEN(_mesa_x86_cpuid_ecx) +GLNAME(_mesa_x86_cpuid_ecx): + + MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ + PUSH_L (EBX) + + CPUID + MOV_L (ECX, EAX) /* return ECX */ + + POP_L (EBX) + RET + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_cpuid_edx) +HIDDEN(_mesa_x86_cpuid_edx) +GLNAME(_mesa_x86_cpuid_edx): + + MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ + PUSH_L (EBX) + + CPUID + MOV_L (EDX, EAX) /* return EDX */ + + POP_L (EBX) + RET + +#ifdef USE_SSE_ASM +/* Execute an SSE instruction to see if the operating system correctly + * supports SSE. A signal handler for SIGILL should have been set + * before calling this function, otherwise this could kill the client + * application. + * + * -----> !!!! ATTENTION DEVELOPERS !!!! <----- + * + * If you're debugging with gdb and you get stopped in this function, + * just type 'continue'! Execution will proceed normally. + * See freedesktop.org bug #1709 for more info. + */ +ALIGNTEXT4 +GLOBL GLNAME( _mesa_test_os_sse_support ) +HIDDEN(_mesa_test_os_sse_support) +GLNAME( _mesa_test_os_sse_support ): + + XORPS ( XMM0, XMM0 ) + + RET + + +/* Perform an SSE divide-by-zero to see if the operating system + * correctly supports unmasked SIMD FPU exceptions. Signal handlers for + * SIGILL and SIGFPE should have been set before calling this function, + * otherwise this could kill the client application. + */ +ALIGNTEXT4 +GLOBL GLNAME( _mesa_test_os_sse_exception_support ) +HIDDEN(_mesa_test_os_sse_exception_support) +GLNAME( _mesa_test_os_sse_exception_support ): + + PUSH_L ( EBP ) + MOV_L ( ESP, EBP ) + SUB_L ( CONST( 8 ), ESP ) + + /* Save the original MXCSR register value. + */ + STMXCSR ( REGOFF( -4, EBP ) ) + + /* Unmask the divide-by-zero exception and perform one. + */ + STMXCSR ( REGOFF( -8, EBP ) ) + AND_L ( CONST( 0xfffffdff ), REGOFF( -8, EBP ) ) + LDMXCSR ( REGOFF( -8, EBP ) ) + + XORPS ( XMM0, XMM0 ) + + PUSH_L ( CONST( 0x3f800000 ) ) + PUSH_L ( CONST( 0x3f800000 ) ) + PUSH_L ( CONST( 0x3f800000 ) ) + PUSH_L ( CONST( 0x3f800000 ) ) + + MOVUPS ( REGIND( ESP ), XMM1 ) + + DIVPS ( XMM0, XMM1 ) + + /* Restore the original MXCSR register value. + */ + LDMXCSR ( REGOFF( -4, EBP ) ) + + LEAVE + RET + +#endif + + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/common_x86_asm.h b/mesalib/src/mesa/x86/common_x86_asm.h index efda4a0c8..0d39e3d23 100644 --- a/mesalib/src/mesa/x86/common_x86_asm.h +++ b/mesalib/src/mesa/x86/common_x86_asm.h @@ -1,53 +1,53 @@ - -/* - * 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. - */ - -/* - * Check CPU capabilities & initialize optimized funtions for this particular - * processor. - * - * Written by Holger Waechtler - * Changed by Andre Werthmann for using the - * new SSE functions - * - * Reimplemented by Gareth Hughes in a more - * future-proof manner, based on code in the Linux kernel. - */ - -#ifndef __COMMON_X86_ASM_H__ -#define __COMMON_X86_ASM_H__ - -/* Do not reference mtypes.h from this file. - */ -#include "common_x86_features.h" - -extern int _mesa_x86_cpu_features; - -extern void _mesa_get_x86_features(void); - -extern void _mesa_check_os_sse_support(void); - -extern void _mesa_init_all_x86_transform_asm( void ); - -#endif + +/* + * 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. + */ + +/* + * Check CPU capabilities & initialize optimized funtions for this particular + * processor. + * + * Written by Holger Waechtler + * Changed by Andre Werthmann for using the + * new SSE functions + * + * Reimplemented by Gareth Hughes in a more + * future-proof manner, based on code in the Linux kernel. + */ + +#ifndef __COMMON_X86_ASM_H__ +#define __COMMON_X86_ASM_H__ + +/* Do not reference mtypes.h from this file. + */ +#include "common_x86_features.h" + +extern int _mesa_x86_cpu_features; + +extern void _mesa_get_x86_features(void); + +extern void _mesa_check_os_sse_support(void); + +extern void _mesa_init_all_x86_transform_asm( void ); + +#endif diff --git a/mesalib/src/mesa/x86/common_x86_features.h b/mesalib/src/mesa/x86/common_x86_features.h index 2482d00ab..676af8c1f 100644 --- a/mesalib/src/mesa/x86/common_x86_features.h +++ b/mesalib/src/mesa/x86/common_x86_features.h @@ -1,67 +1,67 @@ - -/* - * Mesa 3-D graphics library - * Version: 5.1 - * - * 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. - */ - -/* - * x86 CPUID feature information. The raw data is returned by - * _mesa_identify_x86_cpu_features() and interpreted with the cpu_has_* - * helper macros. - * - * Gareth Hughes - */ - -#ifndef __COMMON_X86_FEATURES_H__ -#define __COMMON_X86_FEATURES_H__ - -#define X86_FEATURE_FPU (1<<0) -#define X86_FEATURE_CMOV (1<<1) -#define X86_FEATURE_MMXEXT (1<<2) -#define X86_FEATURE_MMX (1<<3) -#define X86_FEATURE_FXSR (1<<4) -#define X86_FEATURE_XMM (1<<5) -#define X86_FEATURE_XMM2 (1<<6) -#define X86_FEATURE_3DNOWEXT (1<<7) -#define X86_FEATURE_3DNOW (1<<8) - -/* standard X86 CPU features */ -#define X86_CPU_FPU (1<<0) -#define X86_CPU_CMOV (1<<15) -#define X86_CPU_MMX (1<<23) -#define X86_CPU_XMM (1<<25) -#define X86_CPU_XMM2 (1<<26) - -/* extended X86 CPU features */ -#define X86_CPUEXT_MMX_EXT (1<<22) -#define X86_CPUEXT_3DNOW_EXT (1<<30) -#define X86_CPUEXT_3DNOW (1<<31) - -#define cpu_has_mmx (_mesa_x86_cpu_features & X86_FEATURE_MMX) -#define cpu_has_mmxext (_mesa_x86_cpu_features & X86_FEATURE_MMXEXT) -#define cpu_has_xmm (_mesa_x86_cpu_features & X86_FEATURE_XMM) -#define cpu_has_xmm2 (_mesa_x86_cpu_features & X86_FEATURE_XMM2) -#define cpu_has_3dnow (_mesa_x86_cpu_features & X86_FEATURE_3DNOW) -#define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT) - -#endif - + +/* + * Mesa 3-D graphics library + * Version: 5.1 + * + * 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. + */ + +/* + * x86 CPUID feature information. The raw data is returned by + * _mesa_identify_x86_cpu_features() and interpreted with the cpu_has_* + * helper macros. + * + * Gareth Hughes + */ + +#ifndef __COMMON_X86_FEATURES_H__ +#define __COMMON_X86_FEATURES_H__ + +#define X86_FEATURE_FPU (1<<0) +#define X86_FEATURE_CMOV (1<<1) +#define X86_FEATURE_MMXEXT (1<<2) +#define X86_FEATURE_MMX (1<<3) +#define X86_FEATURE_FXSR (1<<4) +#define X86_FEATURE_XMM (1<<5) +#define X86_FEATURE_XMM2 (1<<6) +#define X86_FEATURE_3DNOWEXT (1<<7) +#define X86_FEATURE_3DNOW (1<<8) + +/* standard X86 CPU features */ +#define X86_CPU_FPU (1<<0) +#define X86_CPU_CMOV (1<<15) +#define X86_CPU_MMX (1<<23) +#define X86_CPU_XMM (1<<25) +#define X86_CPU_XMM2 (1<<26) + +/* extended X86 CPU features */ +#define X86_CPUEXT_MMX_EXT (1<<22) +#define X86_CPUEXT_3DNOW_EXT (1<<30) +#define X86_CPUEXT_3DNOW (1<<31) + +#define cpu_has_mmx (_mesa_x86_cpu_features & X86_FEATURE_MMX) +#define cpu_has_mmxext (_mesa_x86_cpu_features & X86_FEATURE_MMXEXT) +#define cpu_has_xmm (_mesa_x86_cpu_features & X86_FEATURE_XMM) +#define cpu_has_xmm2 (_mesa_x86_cpu_features & X86_FEATURE_XMM2) +#define cpu_has_3dnow (_mesa_x86_cpu_features & X86_FEATURE_3DNOW) +#define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT) + +#endif + diff --git a/mesalib/src/mesa/x86/mmx.h b/mesalib/src/mesa/x86/mmx.h index 28a43d18d..74e9979d3 100644 --- a/mesalib/src/mesa/x86/mmx.h +++ b/mesalib/src/mesa/x86/mmx.h @@ -1,59 +1,59 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 1999-2006 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 ASM_MMX_H -#define ASM_MMX_H - -#include "main/compiler.h" -#include "main/glheader.h" - -struct gl_context; - -extern void _ASMAPI -_mesa_mmx_blend_transparency( struct gl_context *ctx, GLuint n, const GLubyte mask[], - GLvoid *rgba, const GLvoid *dest, - GLenum chanType ); - -extern void _ASMAPI -_mesa_mmx_blend_add( struct gl_context *ctx, GLuint n, const GLubyte mask[], - GLvoid *rgba, const GLvoid *dest, - GLenum chanType ); - -extern void _ASMAPI -_mesa_mmx_blend_min( struct gl_context *ctx, GLuint n, const GLubyte mask[], - GLvoid *rgba, const GLvoid *dest, - GLenum chanType ); - -extern void _ASMAPI -_mesa_mmx_blend_max( struct gl_context *ctx, GLuint n, const GLubyte mask[], - GLvoid *rgba, const GLvoid *dest, - GLenum chanType ); - -extern void _ASMAPI -_mesa_mmx_blend_modulate( struct gl_context *ctx, GLuint n, const GLubyte mask[], - GLvoid *rgba, const GLvoid *dest, - GLenum chanType ); - -#endif +/* + * Mesa 3-D graphics library + * Version: 6.5.2 + * + * Copyright (C) 1999-2006 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 ASM_MMX_H +#define ASM_MMX_H + +#include "main/compiler.h" +#include "main/glheader.h" + +struct gl_context; + +extern void _ASMAPI +_mesa_mmx_blend_transparency( struct gl_context *ctx, GLuint n, const GLubyte mask[], + GLvoid *rgba, const GLvoid *dest, + GLenum chanType ); + +extern void _ASMAPI +_mesa_mmx_blend_add( struct gl_context *ctx, GLuint n, const GLubyte mask[], + GLvoid *rgba, const GLvoid *dest, + GLenum chanType ); + +extern void _ASMAPI +_mesa_mmx_blend_min( struct gl_context *ctx, GLuint n, const GLubyte mask[], + GLvoid *rgba, const GLvoid *dest, + GLenum chanType ); + +extern void _ASMAPI +_mesa_mmx_blend_max( struct gl_context *ctx, GLuint n, const GLubyte mask[], + GLvoid *rgba, const GLvoid *dest, + GLenum chanType ); + +extern void _ASMAPI +_mesa_mmx_blend_modulate( struct gl_context *ctx, GLuint n, const GLubyte mask[], + GLvoid *rgba, const GLvoid *dest, + GLenum chanType ); + +#endif diff --git a/mesalib/src/mesa/x86/mmx_blend.S b/mesalib/src/mesa/x86/mmx_blend.S index 1e3954730..eeaf43ea9 100644 --- a/mesalib/src/mesa/x86/mmx_blend.S +++ b/mesalib/src/mesa/x86/mmx_blend.S @@ -1,402 +1,402 @@ - ; -/* - * Written by Jos� Fonseca - */ - - -#ifdef USE_MMX_ASM -#include "assyntax.h" -#include "matypes.h" - -/* integer multiplication - alpha plus one - * - * makes the following approximation to the division (Sree) - * - * rgb*a/255 ~= (rgb*(a+1)) >> 256 - * - * which is the fastest method that satisfies the following OpenGL criteria - * - * 0*0 = 0 and 255*255 = 255 - * - * note that MX1 is a register with 0xffffffffffffffff constant which can be easily obtained making - * - * PCMPEQW ( MX1, MX1 ) - */ -#define GMB_MULT_AP1( MP1, MA1, MP2, MA2, MX1 ) \ - PSUBW ( MX1, MA1 ) /* a1 + 1 | a1 + 1 | a1 + 1 | a1 + 1 */ ;\ - PMULLW ( MP1, MA1 ) /* t1 = p1*a1 */ ;\ - ;\ -TWO(PSUBW ( MX1, MA2 )) /* a2 + 1 | a2 + 1 | a2 + 1 | a2 + 1 */ ;\ -TWO(PMULLW ( MP2, MA2 )) /* t2 = p2*a2 */ ;\ - ;\ - PSRLW ( CONST(8), MA1 ) /* t1 >> 8 ~= t1/255 */ ;\ -TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 ~= t2/255 */ - - -/* integer multiplication - geometric series - * - * takes the geometric series approximation to the division - * - * t/255 = (t >> 8) + (t >> 16) + (t >> 24) .. - * - * in this case just the first two terms to fit in 16bit arithmetic - * - * t/255 ~= (t + (t >> 8)) >> 8 - * - * note that just by itself it doesn't satisfies the OpenGL criteria, as 255*255 = 254, - * so the special case a = 255 must be accounted or roundoff must be used - */ -#define GMB_MULT_GS( MP1, MA1, MP2, MA2 ) \ - PMULLW ( MP1, MA1 ) /* t1 = p1*a1 */ ;\ -TWO(PMULLW ( MP2, MA2 )) /* t2 = p2*a2 */ ;\ - ;\ - MOVQ ( MA1, MP1 ) ;\ - PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ - ;\ -TWO(MOVQ ( MA2, MP2 )) ;\ -TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ - ;\ - PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ - PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ - ;\ -TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ -TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ - - -/* integer multiplication - geometric series plus rounding - * - * when using a geometric series division instead of truncating the result - * use roundoff in the approximation (Jim Blinn) - * - * t = rgb*a + 0x80 - * - * achieving the exact results - * - * note that M80 is register with the 0x0080008000800080 constant - */ -#define GMB_MULT_GSR( MP1, MA1, MP2, MA2, M80 ) \ - PMULLW ( MP1, MA1 ) /* t1 = p1*a1 */ ;\ - PADDW ( M80, MA1 ) /* t1 += 0x80 */ ;\ - ;\ -TWO(PMULLW ( MP2, MA2 )) /* t2 = p2*a2 */ ;\ -TWO(PADDW ( M80, MA2 )) /* t2 += 0x80 */ ;\ - ;\ - MOVQ ( MA1, MP1 ) ;\ - PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ - ;\ -TWO(MOVQ ( MA2, MP2 )) ;\ -TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ - ;\ - PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ - PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ - ;\ -TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ -TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ - - -/* linear interpolation - geometric series - */ -#define GMB_LERP_GS( MP1, MQ1, MA1, MP2, MQ2, MA2) \ - PSUBW ( MQ1, MP1 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ ;\ - PSLLW ( CONST(8), MQ1 ) /* q1 << 8 */ ;\ - PMULLW ( MP1, MA1 ) /* t1 = (q1 - p1)*pa1 */ ;\ - ;\ -TWO(PSUBW ( MQ2, MP2 )) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ ;\ -TWO(PSLLW ( CONST(8), MQ2 )) /* q2 << 8 */ ;\ -TWO(PMULLW ( MP2, MA2 )) /* t2 = (q2 - p2)*pa2 */ ;\ - ;\ - MOVQ ( MA1, MP1 ) ;\ - PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ - ;\ -TWO(MOVQ ( MA2, MP2 )) ;\ -TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ - ;\ - PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ -TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ - ;\ - PADDW ( MQ1, MA1 ) /* (t1/255 + q1) << 8 */ ;\ -TWO(PADDW ( MQ2, MA2 )) /* (t2/255 + q2) << 8 */ ;\ - ;\ - PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ -TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ - - -/* linear interpolation - geometric series with roundoff - * - * this is a generalization of Blinn's formula to signed arithmetic - * - * note that M80 is a register with the 0x0080008000800080 constant - */ -#define GMB_LERP_GSR( MP1, MQ1, MA1, MP2, MQ2, MA2, M80) \ - PSUBW ( MQ1, MP1 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ ;\ - PSLLW ( CONST(8), MQ1 ) /* q1 << 8 */ ;\ - PMULLW ( MP1, MA1 ) /* t1 = (q1 - p1)*pa1 */ ;\ - ;\ -TWO(PSUBW ( MQ2, MP2 )) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ ;\ -TWO(PSLLW ( CONST(8), MQ2 )) /* q2 << 8 */ ;\ -TWO(PMULLW ( MP2, MA2 )) /* t2 = (q2 - p2)*pa2 */ ;\ - ;\ - PSRLW ( CONST(15), MP1 ) /* q1 > p1 ? 1 : 0 */ ;\ -TWO(PSRLW ( CONST(15), MP2 )) /* q2 > q2 ? 1 : 0 */ ;\ - ;\ - PSLLW ( CONST(8), MP1 ) /* q1 > p1 ? 0x100 : 0 */ ;\ -TWO(PSLLW ( CONST(8), MP2 )) /* q2 > q2 ? 0x100 : 0 */ ;\ - ;\ - PSUBW ( MP1, MA1 ) /* t1 -=? 0x100 */ ;\ -TWO(PSUBW ( MP2, MA2 )) /* t2 -=? 0x100 */ ;\ - ;\ - PADDW ( M80, MA1 ) /* t1 += 0x80 */ ;\ -TWO(PADDW ( M80, MA2 )) /* t2 += 0x80 */ ;\ - ;\ - MOVQ ( MA1, MP1 ) ;\ - PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ - ;\ -TWO(MOVQ ( MA2, MP2 )) ;\ -TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ - ;\ - PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ -TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ - ;\ - PADDW ( MQ1, MA1 ) /* (t1/255 + q1) << 8 */ ;\ -TWO(PADDW ( MQ2, MA2 )) /* (t2/255 + q2) << 8 */ ;\ - ;\ - PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ -TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ - - -/* linear interpolation - geometric series with correction - * - * instead of the roundoff this adds a small correction to satisfy the OpenGL criteria - * - * t/255 ~= (t + (t >> 8) + (t >> 15)) >> 8 - * - * note that although is faster than rounding off it doesn't give always the exact results - */ -#define GMB_LERP_GSC( MP1, MQ1, MA1, MP2, MQ2, MA2) \ - PSUBW ( MQ1, MP1 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ ;\ - PSLLW ( CONST(8), MQ1 ) /* q1 << 8 */ ;\ - PMULLW ( MP1, MA1 ) /* t1 = (q1 - p1)*pa1 */ ;\ - ;\ -TWO(PSUBW ( MQ2, MP2 )) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ ;\ -TWO(PSLLW ( CONST(8), MQ2 )) /* q2 << 8 */ ;\ -TWO(PMULLW ( MP2, MA2 )) /* t2 = (q2 - p2)*pa2 */ ;\ - ;\ - MOVQ ( MA1, MP1 ) ;\ - PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ - ;\ -TWO(MOVQ ( MA2, MP2 )) ;\ -TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ - ;\ - PADDW ( MA1, MP1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ - PSRLW ( CONST(7), MA1 ) /* t1 >> 15 */ ;\ - ;\ -TWO(PADDW ( MA2, MP2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ -TWO(PSRLW ( CONST(7), MA2 )) /* t2 >> 15 */ ;\ - ;\ - PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) + (t1 >>15) ~= (t1/255) << 8 */ ;\ -TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) + (t2 >>15) ~= (t2/255) << 8 */ ;\ - ;\ - PADDW ( MQ1, MA1 ) /* (t1/255 + q1) << 8 */ ;\ -TWO(PADDW ( MQ2, MA2 )) /* (t2/255 + q2) << 8 */ ;\ - ;\ - PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ -TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ - - -/* common blending setup code - * - * note that M00 is a register with 0x0000000000000000 constant which can be easily obtained making - * - * PXOR ( M00, M00 ) - */ -#define GMB_LOAD(rgba, dest, MPP, MQQ) \ -ONE(MOVD ( REGIND(rgba), MPP )) /* | | | | qa1 | qb1 | qg1 | qr1 */ ;\ -ONE(MOVD ( REGIND(dest), MQQ )) /* | | | | pa1 | pb1 | pg1 | pr1 */ ;\ - ;\ -TWO(MOVQ ( REGIND(rgba), MPP )) /* qa2 | qb2 | qg2 | qr2 | qa1 | qb1 | qg1 | qr1 */ ;\ -TWO(MOVQ ( REGIND(dest), MQQ )) /* pa2 | pb2 | pg2 | pr2 | pa1 | pb1 | pg1 | pr1 */ - -#define GMB_UNPACK(MP1, MQ1, MP2, MQ2, M00) \ -TWO(MOVQ ( MP1, MP2 )) ;\ -TWO(MOVQ ( MQ1, MQ2 )) ;\ - ;\ - PUNPCKLBW ( M00, MQ1 ) /* qa1 | qb1 | qg1 | qr1 */ ;\ -TWO(PUNPCKHBW ( M00, MQ2 )) /* qa2 | qb2 | qg2 | qr2 */ ;\ - PUNPCKLBW ( M00, MP1 ) /* pa1 | pb1 | pg1 | pr1 */ ;\ -TWO(PUNPCKHBW ( M00, MP2 )) /* pa2 | pb2 | pg2 | pr2 */ - -#define GMB_ALPHA(MP1, MA1, MP2, MA2) \ - MOVQ ( MP1, MA1 ) ;\ -TWO(MOVQ ( MP2, MA2 )) ;\ - ;\ - PUNPCKHWD ( MA1, MA1 ) /* pa1 | pa1 | | */ ;\ -TWO(PUNPCKHWD ( MA2, MA2 )) /* pa2 | pa2 | | */ ;\ - PUNPCKHDQ ( MA1, MA1 ) /* pa1 | pa1 | pa1 | pa1 */ ;\ -TWO(PUNPCKHDQ ( MA2, MA2 )) /* pa2 | pa2 | pa2 | pa2 */ - -#define GMB_PACK( MS1, MS2 ) \ - PACKUSWB ( MS2, MS1 ) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ ;\ - -#define GMB_STORE(rgba, MSS ) \ -ONE(MOVD ( MSS, REGIND(rgba) )) /* | | | | sa1 | sb1 | sg1 | sr1 */ ;\ -TWO(MOVQ ( MSS, REGIND(rgba) )) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ - -/* Kevin F. Quinn 2 July 2006 - * Replace data segment constants with text-segment - * constants (via pushl/movq) - SEG_DATA - -ALIGNDATA8 -const_0080: - D_LONG 0x00800080, 0x00800080 - -const_80: - D_LONG 0x80808080, 0x80808080 -*/ -#define const_0080_l 0x00800080 -#define const_0080_h 0x00800080 -#define const_80_l 0x80808080 -#define const_80_h 0x80808080 - - SEG_TEXT - - -/* Blend transparency function - */ - -#define TAG(x) CONCAT(x,_transparency) -#define LLTAG(x) LLBL2(x,_transparency) - -#define INIT \ - PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ - -#define MAIN( rgba, dest ) \ - GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ - GMB_UNPACK( MM1, MM2, MM4, MM5, MM0 ) ;\ - GMB_ALPHA( MM1, MM3, MM4, MM6 ) ;\ - GMB_LERP_GSC( MM1, MM2, MM3, MM4, MM5, MM6 ) ;\ - GMB_PACK( MM3, MM6 ) ;\ - GMB_STORE( rgba, MM3 ) - -#include "mmx_blendtmp.h" - - -/* Blend add function - * - * FIXME: Add some loop unrolling here... - */ - -#define TAG(x) CONCAT(x,_add) -#define LLTAG(x) LLBL2(x,_add) - -#define INIT - -#define MAIN( rgba, dest ) \ -ONE(MOVD ( REGIND(rgba), MM1 )) /* | | | | qa1 | qb1 | qg1 | qr1 */ ;\ -ONE(MOVD ( REGIND(dest), MM2 )) /* | | | | pa1 | pb1 | pg1 | pr1 */ ;\ -ONE(PADDUSB ( MM2, MM1 )) ;\ -ONE(MOVD ( MM1, REGIND(rgba) )) /* | | | | sa1 | sb1 | sg1 | sr1 */ ;\ - ;\ -TWO(MOVQ ( REGIND(rgba), MM1 )) /* qa2 | qb2 | qg2 | qr2 | qa1 | qb1 | qg1 | qr1 */ ;\ -TWO(PADDUSB ( REGIND(dest), MM1 )) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ ;\ -TWO(MOVQ ( MM1, REGIND(rgba) )) - -#include "mmx_blendtmp.h" - - -/* Blend min function - */ - -#define TAG(x) CONCAT(x,_min) -#define LLTAG(x) LLBL2(x,_min) - -/* Kevin F. Quinn 2nd July 2006 - * Replace data segment constants with text-segment instructions -#define INIT \ - MOVQ ( CONTENT(const_80), MM7 ) - */ -#define INIT \ - PUSH_L ( CONST(const_80_h) ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/ ;\ - PUSH_L ( CONST(const_80_l) ) ;\ - MOVQ ( REGIND(ESP), MM7 ) ;\ - ADD_L ( CONST(8), ESP) - -#define MAIN( rgba, dest ) \ - GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ - MOVQ ( MM1, MM3 ) ;\ - MOVQ ( MM2, MM4 ) ;\ - PXOR ( MM7, MM3 ) /* unsigned -> signed */ ;\ - PXOR ( MM7, MM4 ) /* unsigned -> signed */ ;\ - PCMPGTB ( MM3, MM4 ) /* q > p ? 0xff : 0x00 */ ;\ - PAND ( MM4, MM1 ) /* q > p ? p : 0 */ ;\ - PANDN ( MM2, MM4 ) /* q > p ? 0 : q */ ;\ - POR ( MM1, MM4 ) /* q > p ? p : q */ ;\ - GMB_STORE( rgba, MM4 ) - -#include "mmx_blendtmp.h" - - -/* Blend max function - */ - -#define TAG(x) CONCAT(x,_max) -#define LLTAG(x) LLBL2(x,_max) - -/* Kevin F. Quinn 2nd July 2006 - * Replace data segment constants with text-segment instructions -#define INIT \ - MOVQ ( CONTENT(const_80), MM7 ) - */ -#define INIT \ - PUSH_L ( CONST(const_80_l) ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/ ;\ - PUSH_L ( CONST(const_80_h) ) ;\ - MOVQ ( REGIND(ESP), MM7 ) ;\ - ADD_L ( CONST(8), ESP) - -#define MAIN( rgba, dest ) \ - GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ - MOVQ ( MM1, MM3 ) ;\ - MOVQ ( MM2, MM4 ) ;\ - PXOR ( MM7, MM3 ) /* unsigned -> signed */ ;\ - PXOR ( MM7, MM4 ) /* unsigned -> signed */ ;\ - PCMPGTB ( MM3, MM4 ) /* q > p ? 0xff : 0x00 */ ;\ - PAND ( MM4, MM2 ) /* q > p ? q : 0 */ ;\ - PANDN ( MM1, MM4 ) /* q > p ? 0 : p */ ;\ - POR ( MM2, MM4 ) /* q > p ? p : q */ ;\ - GMB_STORE( rgba, MM4 ) - -#include "mmx_blendtmp.h" - - -/* Blend modulate function - */ - -#define TAG(x) CONCAT(x,_modulate) -#define LLTAG(x) LLBL2(x,_modulate) - -/* Kevin F. Quinn 2nd July 2006 - * Replace data segment constants with text-segment instructions -#define INIT \ - MOVQ ( CONTENT(const_0080), MM7 ) - */ -#define INIT \ - PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ ;\ - PUSH_L ( CONST(const_0080_l) ) /* 0x0080 | 0x0080 | 0x0080 | 0x0080 */ ;\ - PUSH_L ( CONST(const_0080_h) ) ;\ - MOVQ ( REGIND(ESP), MM7 ) ;\ - ADD_L ( CONST(8), ESP) - -#define MAIN( rgba, dest ) \ - GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ - GMB_UNPACK( MM1, MM2, MM4, MM5, MM0 ) ;\ - GMB_MULT_GSR( MM1, MM2, MM4, MM5, MM7 ) ;\ - GMB_PACK( MM2, MM5 ) ;\ - GMB_STORE( rgba, MM2 ) - -#include "mmx_blendtmp.h" - -#endif - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif + ; +/* + * Written by Jos� Fonseca + */ + + +#ifdef USE_MMX_ASM +#include "assyntax.h" +#include "matypes.h" + +/* integer multiplication - alpha plus one + * + * makes the following approximation to the division (Sree) + * + * rgb*a/255 ~= (rgb*(a+1)) >> 256 + * + * which is the fastest method that satisfies the following OpenGL criteria + * + * 0*0 = 0 and 255*255 = 255 + * + * note that MX1 is a register with 0xffffffffffffffff constant which can be easily obtained making + * + * PCMPEQW ( MX1, MX1 ) + */ +#define GMB_MULT_AP1( MP1, MA1, MP2, MA2, MX1 ) \ + PSUBW ( MX1, MA1 ) /* a1 + 1 | a1 + 1 | a1 + 1 | a1 + 1 */ ;\ + PMULLW ( MP1, MA1 ) /* t1 = p1*a1 */ ;\ + ;\ +TWO(PSUBW ( MX1, MA2 )) /* a2 + 1 | a2 + 1 | a2 + 1 | a2 + 1 */ ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = p2*a2 */ ;\ + ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 ~= t1/255 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 ~= t2/255 */ + + +/* integer multiplication - geometric series + * + * takes the geometric series approximation to the division + * + * t/255 = (t >> 8) + (t >> 16) + (t >> 24) .. + * + * in this case just the first two terms to fit in 16bit arithmetic + * + * t/255 ~= (t + (t >> 8)) >> 8 + * + * note that just by itself it doesn't satisfies the OpenGL criteria, as 255*255 = 254, + * so the special case a = 255 must be accounted or roundoff must be used + */ +#define GMB_MULT_GS( MP1, MA1, MP2, MA2 ) \ + PMULLW ( MP1, MA1 ) /* t1 = p1*a1 */ ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = p2*a2 */ ;\ + ;\ + MOVQ ( MA1, MP1 ) ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ + ;\ +TWO(MOVQ ( MA2, MP2 )) ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ + ;\ + PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ + PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ + ;\ +TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ + + +/* integer multiplication - geometric series plus rounding + * + * when using a geometric series division instead of truncating the result + * use roundoff in the approximation (Jim Blinn) + * + * t = rgb*a + 0x80 + * + * achieving the exact results + * + * note that M80 is register with the 0x0080008000800080 constant + */ +#define GMB_MULT_GSR( MP1, MA1, MP2, MA2, M80 ) \ + PMULLW ( MP1, MA1 ) /* t1 = p1*a1 */ ;\ + PADDW ( M80, MA1 ) /* t1 += 0x80 */ ;\ + ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = p2*a2 */ ;\ +TWO(PADDW ( M80, MA2 )) /* t2 += 0x80 */ ;\ + ;\ + MOVQ ( MA1, MP1 ) ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ + ;\ +TWO(MOVQ ( MA2, MP2 )) ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ + ;\ + PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ + PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ + ;\ +TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ + + +/* linear interpolation - geometric series + */ +#define GMB_LERP_GS( MP1, MQ1, MA1, MP2, MQ2, MA2) \ + PSUBW ( MQ1, MP1 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ ;\ + PSLLW ( CONST(8), MQ1 ) /* q1 << 8 */ ;\ + PMULLW ( MP1, MA1 ) /* t1 = (q1 - p1)*pa1 */ ;\ + ;\ +TWO(PSUBW ( MQ2, MP2 )) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ ;\ +TWO(PSLLW ( CONST(8), MQ2 )) /* q2 << 8 */ ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = (q2 - p2)*pa2 */ ;\ + ;\ + MOVQ ( MA1, MP1 ) ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ + ;\ +TWO(MOVQ ( MA2, MP2 )) ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ + ;\ + PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ +TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ + ;\ + PADDW ( MQ1, MA1 ) /* (t1/255 + q1) << 8 */ ;\ +TWO(PADDW ( MQ2, MA2 )) /* (t2/255 + q2) << 8 */ ;\ + ;\ + PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ + + +/* linear interpolation - geometric series with roundoff + * + * this is a generalization of Blinn's formula to signed arithmetic + * + * note that M80 is a register with the 0x0080008000800080 constant + */ +#define GMB_LERP_GSR( MP1, MQ1, MA1, MP2, MQ2, MA2, M80) \ + PSUBW ( MQ1, MP1 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ ;\ + PSLLW ( CONST(8), MQ1 ) /* q1 << 8 */ ;\ + PMULLW ( MP1, MA1 ) /* t1 = (q1 - p1)*pa1 */ ;\ + ;\ +TWO(PSUBW ( MQ2, MP2 )) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ ;\ +TWO(PSLLW ( CONST(8), MQ2 )) /* q2 << 8 */ ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = (q2 - p2)*pa2 */ ;\ + ;\ + PSRLW ( CONST(15), MP1 ) /* q1 > p1 ? 1 : 0 */ ;\ +TWO(PSRLW ( CONST(15), MP2 )) /* q2 > q2 ? 1 : 0 */ ;\ + ;\ + PSLLW ( CONST(8), MP1 ) /* q1 > p1 ? 0x100 : 0 */ ;\ +TWO(PSLLW ( CONST(8), MP2 )) /* q2 > q2 ? 0x100 : 0 */ ;\ + ;\ + PSUBW ( MP1, MA1 ) /* t1 -=? 0x100 */ ;\ +TWO(PSUBW ( MP2, MA2 )) /* t2 -=? 0x100 */ ;\ + ;\ + PADDW ( M80, MA1 ) /* t1 += 0x80 */ ;\ +TWO(PADDW ( M80, MA2 )) /* t2 += 0x80 */ ;\ + ;\ + MOVQ ( MA1, MP1 ) ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ + ;\ +TWO(MOVQ ( MA2, MP2 )) ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ + ;\ + PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ +TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ + ;\ + PADDW ( MQ1, MA1 ) /* (t1/255 + q1) << 8 */ ;\ +TWO(PADDW ( MQ2, MA2 )) /* (t2/255 + q2) << 8 */ ;\ + ;\ + PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ + + +/* linear interpolation - geometric series with correction + * + * instead of the roundoff this adds a small correction to satisfy the OpenGL criteria + * + * t/255 ~= (t + (t >> 8) + (t >> 15)) >> 8 + * + * note that although is faster than rounding off it doesn't give always the exact results + */ +#define GMB_LERP_GSC( MP1, MQ1, MA1, MP2, MQ2, MA2) \ + PSUBW ( MQ1, MP1 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ ;\ + PSLLW ( CONST(8), MQ1 ) /* q1 << 8 */ ;\ + PMULLW ( MP1, MA1 ) /* t1 = (q1 - p1)*pa1 */ ;\ + ;\ +TWO(PSUBW ( MQ2, MP2 )) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ ;\ +TWO(PSLLW ( CONST(8), MQ2 )) /* q2 << 8 */ ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = (q2 - p2)*pa2 */ ;\ + ;\ + MOVQ ( MA1, MP1 ) ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ + ;\ +TWO(MOVQ ( MA2, MP2 )) ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ + ;\ + PADDW ( MA1, MP1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ + PSRLW ( CONST(7), MA1 ) /* t1 >> 15 */ ;\ + ;\ +TWO(PADDW ( MA2, MP2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ +TWO(PSRLW ( CONST(7), MA2 )) /* t2 >> 15 */ ;\ + ;\ + PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) + (t1 >>15) ~= (t1/255) << 8 */ ;\ +TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) + (t2 >>15) ~= (t2/255) << 8 */ ;\ + ;\ + PADDW ( MQ1, MA1 ) /* (t1/255 + q1) << 8 */ ;\ +TWO(PADDW ( MQ2, MA2 )) /* (t2/255 + q2) << 8 */ ;\ + ;\ + PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ + + +/* common blending setup code + * + * note that M00 is a register with 0x0000000000000000 constant which can be easily obtained making + * + * PXOR ( M00, M00 ) + */ +#define GMB_LOAD(rgba, dest, MPP, MQQ) \ +ONE(MOVD ( REGIND(rgba), MPP )) /* | | | | qa1 | qb1 | qg1 | qr1 */ ;\ +ONE(MOVD ( REGIND(dest), MQQ )) /* | | | | pa1 | pb1 | pg1 | pr1 */ ;\ + ;\ +TWO(MOVQ ( REGIND(rgba), MPP )) /* qa2 | qb2 | qg2 | qr2 | qa1 | qb1 | qg1 | qr1 */ ;\ +TWO(MOVQ ( REGIND(dest), MQQ )) /* pa2 | pb2 | pg2 | pr2 | pa1 | pb1 | pg1 | pr1 */ + +#define GMB_UNPACK(MP1, MQ1, MP2, MQ2, M00) \ +TWO(MOVQ ( MP1, MP2 )) ;\ +TWO(MOVQ ( MQ1, MQ2 )) ;\ + ;\ + PUNPCKLBW ( M00, MQ1 ) /* qa1 | qb1 | qg1 | qr1 */ ;\ +TWO(PUNPCKHBW ( M00, MQ2 )) /* qa2 | qb2 | qg2 | qr2 */ ;\ + PUNPCKLBW ( M00, MP1 ) /* pa1 | pb1 | pg1 | pr1 */ ;\ +TWO(PUNPCKHBW ( M00, MP2 )) /* pa2 | pb2 | pg2 | pr2 */ + +#define GMB_ALPHA(MP1, MA1, MP2, MA2) \ + MOVQ ( MP1, MA1 ) ;\ +TWO(MOVQ ( MP2, MA2 )) ;\ + ;\ + PUNPCKHWD ( MA1, MA1 ) /* pa1 | pa1 | | */ ;\ +TWO(PUNPCKHWD ( MA2, MA2 )) /* pa2 | pa2 | | */ ;\ + PUNPCKHDQ ( MA1, MA1 ) /* pa1 | pa1 | pa1 | pa1 */ ;\ +TWO(PUNPCKHDQ ( MA2, MA2 )) /* pa2 | pa2 | pa2 | pa2 */ + +#define GMB_PACK( MS1, MS2 ) \ + PACKUSWB ( MS2, MS1 ) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ ;\ + +#define GMB_STORE(rgba, MSS ) \ +ONE(MOVD ( MSS, REGIND(rgba) )) /* | | | | sa1 | sb1 | sg1 | sr1 */ ;\ +TWO(MOVQ ( MSS, REGIND(rgba) )) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ + +/* Kevin F. Quinn 2 July 2006 + * Replace data segment constants with text-segment + * constants (via pushl/movq) + SEG_DATA + +ALIGNDATA8 +const_0080: + D_LONG 0x00800080, 0x00800080 + +const_80: + D_LONG 0x80808080, 0x80808080 +*/ +#define const_0080_l 0x00800080 +#define const_0080_h 0x00800080 +#define const_80_l 0x80808080 +#define const_80_h 0x80808080 + + SEG_TEXT + + +/* Blend transparency function + */ + +#define TAG(x) CONCAT(x,_transparency) +#define LLTAG(x) LLBL2(x,_transparency) + +#define INIT \ + PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ + +#define MAIN( rgba, dest ) \ + GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ + GMB_UNPACK( MM1, MM2, MM4, MM5, MM0 ) ;\ + GMB_ALPHA( MM1, MM3, MM4, MM6 ) ;\ + GMB_LERP_GSC( MM1, MM2, MM3, MM4, MM5, MM6 ) ;\ + GMB_PACK( MM3, MM6 ) ;\ + GMB_STORE( rgba, MM3 ) + +#include "mmx_blendtmp.h" + + +/* Blend add function + * + * FIXME: Add some loop unrolling here... + */ + +#define TAG(x) CONCAT(x,_add) +#define LLTAG(x) LLBL2(x,_add) + +#define INIT + +#define MAIN( rgba, dest ) \ +ONE(MOVD ( REGIND(rgba), MM1 )) /* | | | | qa1 | qb1 | qg1 | qr1 */ ;\ +ONE(MOVD ( REGIND(dest), MM2 )) /* | | | | pa1 | pb1 | pg1 | pr1 */ ;\ +ONE(PADDUSB ( MM2, MM1 )) ;\ +ONE(MOVD ( MM1, REGIND(rgba) )) /* | | | | sa1 | sb1 | sg1 | sr1 */ ;\ + ;\ +TWO(MOVQ ( REGIND(rgba), MM1 )) /* qa2 | qb2 | qg2 | qr2 | qa1 | qb1 | qg1 | qr1 */ ;\ +TWO(PADDUSB ( REGIND(dest), MM1 )) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ ;\ +TWO(MOVQ ( MM1, REGIND(rgba) )) + +#include "mmx_blendtmp.h" + + +/* Blend min function + */ + +#define TAG(x) CONCAT(x,_min) +#define LLTAG(x) LLBL2(x,_min) + +/* Kevin F. Quinn 2nd July 2006 + * Replace data segment constants with text-segment instructions +#define INIT \ + MOVQ ( CONTENT(const_80), MM7 ) + */ +#define INIT \ + PUSH_L ( CONST(const_80_h) ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/ ;\ + PUSH_L ( CONST(const_80_l) ) ;\ + MOVQ ( REGIND(ESP), MM7 ) ;\ + ADD_L ( CONST(8), ESP) + +#define MAIN( rgba, dest ) \ + GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ + MOVQ ( MM1, MM3 ) ;\ + MOVQ ( MM2, MM4 ) ;\ + PXOR ( MM7, MM3 ) /* unsigned -> signed */ ;\ + PXOR ( MM7, MM4 ) /* unsigned -> signed */ ;\ + PCMPGTB ( MM3, MM4 ) /* q > p ? 0xff : 0x00 */ ;\ + PAND ( MM4, MM1 ) /* q > p ? p : 0 */ ;\ + PANDN ( MM2, MM4 ) /* q > p ? 0 : q */ ;\ + POR ( MM1, MM4 ) /* q > p ? p : q */ ;\ + GMB_STORE( rgba, MM4 ) + +#include "mmx_blendtmp.h" + + +/* Blend max function + */ + +#define TAG(x) CONCAT(x,_max) +#define LLTAG(x) LLBL2(x,_max) + +/* Kevin F. Quinn 2nd July 2006 + * Replace data segment constants with text-segment instructions +#define INIT \ + MOVQ ( CONTENT(const_80), MM7 ) + */ +#define INIT \ + PUSH_L ( CONST(const_80_l) ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/ ;\ + PUSH_L ( CONST(const_80_h) ) ;\ + MOVQ ( REGIND(ESP), MM7 ) ;\ + ADD_L ( CONST(8), ESP) + +#define MAIN( rgba, dest ) \ + GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ + MOVQ ( MM1, MM3 ) ;\ + MOVQ ( MM2, MM4 ) ;\ + PXOR ( MM7, MM3 ) /* unsigned -> signed */ ;\ + PXOR ( MM7, MM4 ) /* unsigned -> signed */ ;\ + PCMPGTB ( MM3, MM4 ) /* q > p ? 0xff : 0x00 */ ;\ + PAND ( MM4, MM2 ) /* q > p ? q : 0 */ ;\ + PANDN ( MM1, MM4 ) /* q > p ? 0 : p */ ;\ + POR ( MM2, MM4 ) /* q > p ? p : q */ ;\ + GMB_STORE( rgba, MM4 ) + +#include "mmx_blendtmp.h" + + +/* Blend modulate function + */ + +#define TAG(x) CONCAT(x,_modulate) +#define LLTAG(x) LLBL2(x,_modulate) + +/* Kevin F. Quinn 2nd July 2006 + * Replace data segment constants with text-segment instructions +#define INIT \ + MOVQ ( CONTENT(const_0080), MM7 ) + */ +#define INIT \ + PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ ;\ + PUSH_L ( CONST(const_0080_l) ) /* 0x0080 | 0x0080 | 0x0080 | 0x0080 */ ;\ + PUSH_L ( CONST(const_0080_h) ) ;\ + MOVQ ( REGIND(ESP), MM7 ) ;\ + ADD_L ( CONST(8), ESP) + +#define MAIN( rgba, dest ) \ + GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ + GMB_UNPACK( MM1, MM2, MM4, MM5, MM0 ) ;\ + GMB_MULT_GSR( MM1, MM2, MM4, MM5, MM7 ) ;\ + GMB_PACK( MM2, MM5 ) ;\ + GMB_STORE( rgba, MM2 ) + +#include "mmx_blendtmp.h" + +#endif + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/mmx_blendtmp.h b/mesalib/src/mesa/x86/mmx_blendtmp.h index f282c0c21..8534792e2 100644 --- a/mesalib/src/mesa/x86/mmx_blendtmp.h +++ b/mesalib/src/mesa/x86/mmx_blendtmp.h @@ -1,114 +1,114 @@ -/* - * Written by José Fonseca - */ - - -/* - * void _mesa_mmx_blend( struct gl_context *ctx, - * GLuint n, - * const GLubyte mask[], - * GLchan rgba[][4], - * CONST GLchan dest[][4] ) - * - */ -ALIGNTEXT16 -GLOBL GLNAME( TAG(_mesa_mmx_blend) ) -HIDDEN( TAG(_mesa_mmx_blend) ) -GLNAME( TAG(_mesa_mmx_blend) ): - - PUSH_L ( EBP ) - MOV_L ( ESP, EBP ) - PUSH_L ( ESI ) - PUSH_L ( EDI ) - PUSH_L ( EBX ) - - MOV_L ( REGOFF(12, EBP), ECX ) /* n */ - CMP_L ( CONST(0), ECX) - JE ( LLTAG(GMB_return) ) - - MOV_L ( REGOFF(16, EBP), EBX ) /* mask */ - MOV_L ( REGOFF(20, EBP), EDI ) /* rgba */ - MOV_L ( REGOFF(24, EBP), ESI ) /* dest */ - - INIT - - TEST_L ( CONST(4), EDI ) /* align rgba on an 8-byte boundary */ - JZ ( LLTAG(GMB_align_end) ) - - CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */ - JE ( LLTAG(GMB_align_continue) ) - - /* runin */ -#define ONE(x) x -#define TWO(x) - MAIN ( EDI, ESI ) -#undef ONE -#undef TWO - -LLTAG(GMB_align_continue): - - DEC_L ( ECX ) /* n -= 1 */ - INC_L ( EBX ) /* mask += 1 */ - ADD_L ( CONST(4), EDI ) /* rgba += 1 */ - ADD_L ( CONST(4), ESI ) /* dest += 1 */ - -LLTAG(GMB_align_end): - - CMP_L ( CONST(2), ECX) - JB ( LLTAG(GMB_loop_end) ) - -ALIGNTEXT16 -LLTAG(GMB_loop_begin): - - CMP_W ( CONST(0), REGIND(EBX) ) /* *mask == 0 && *(mask + 1) == 0 */ - JE ( LLTAG(GMB_loop_continue) ) - - /* main loop */ -#define ONE(x) -#define TWO(x) x - MAIN ( EDI, ESI ) -#undef ONE -#undef TWO - -LLTAG(GMB_loop_continue): - - DEC_L ( ECX ) - DEC_L ( ECX ) /* n -= 2 */ - ADD_L ( CONST(2), EBX ) /* mask += 2 */ - ADD_L ( CONST(8), EDI ) /* rgba += 2 */ - ADD_L ( CONST(8), ESI ) /* dest += 2 */ - CMP_L ( CONST(2), ECX ) - JAE ( LLTAG(GMB_loop_begin) ) - -LLTAG(GMB_loop_end): - - CMP_L ( CONST(1), ECX ) - JB ( LLTAG(GMB_done) ) - - CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */ - JE ( LLTAG(GMB_done) ) - - /* runout */ -#define ONE(x) x -#define TWO(x) - MAIN ( EDI, ESI ) -#undef ONE -#undef TWO - -LLTAG(GMB_done): - - EMMS - -LLTAG(GMB_return): - - POP_L ( EBX ) - POP_L ( EDI ) - POP_L ( ESI ) - MOV_L ( EBP, ESP ) - POP_L ( EBP ) - RET - -#undef TAG -#undef LLTAG -#undef INIT -#undef MAIN +/* + * Written by José Fonseca + */ + + +/* + * void _mesa_mmx_blend( struct gl_context *ctx, + * GLuint n, + * const GLubyte mask[], + * GLchan rgba[][4], + * CONST GLchan dest[][4] ) + * + */ +ALIGNTEXT16 +GLOBL GLNAME( TAG(_mesa_mmx_blend) ) +HIDDEN( TAG(_mesa_mmx_blend) ) +GLNAME( TAG(_mesa_mmx_blend) ): + + PUSH_L ( EBP ) + MOV_L ( ESP, EBP ) + PUSH_L ( ESI ) + PUSH_L ( EDI ) + PUSH_L ( EBX ) + + MOV_L ( REGOFF(12, EBP), ECX ) /* n */ + CMP_L ( CONST(0), ECX) + JE ( LLTAG(GMB_return) ) + + MOV_L ( REGOFF(16, EBP), EBX ) /* mask */ + MOV_L ( REGOFF(20, EBP), EDI ) /* rgba */ + MOV_L ( REGOFF(24, EBP), ESI ) /* dest */ + + INIT + + TEST_L ( CONST(4), EDI ) /* align rgba on an 8-byte boundary */ + JZ ( LLTAG(GMB_align_end) ) + + CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */ + JE ( LLTAG(GMB_align_continue) ) + + /* runin */ +#define ONE(x) x +#define TWO(x) + MAIN ( EDI, ESI ) +#undef ONE +#undef TWO + +LLTAG(GMB_align_continue): + + DEC_L ( ECX ) /* n -= 1 */ + INC_L ( EBX ) /* mask += 1 */ + ADD_L ( CONST(4), EDI ) /* rgba += 1 */ + ADD_L ( CONST(4), ESI ) /* dest += 1 */ + +LLTAG(GMB_align_end): + + CMP_L ( CONST(2), ECX) + JB ( LLTAG(GMB_loop_end) ) + +ALIGNTEXT16 +LLTAG(GMB_loop_begin): + + CMP_W ( CONST(0), REGIND(EBX) ) /* *mask == 0 && *(mask + 1) == 0 */ + JE ( LLTAG(GMB_loop_continue) ) + + /* main loop */ +#define ONE(x) +#define TWO(x) x + MAIN ( EDI, ESI ) +#undef ONE +#undef TWO + +LLTAG(GMB_loop_continue): + + DEC_L ( ECX ) + DEC_L ( ECX ) /* n -= 2 */ + ADD_L ( CONST(2), EBX ) /* mask += 2 */ + ADD_L ( CONST(8), EDI ) /* rgba += 2 */ + ADD_L ( CONST(8), ESI ) /* dest += 2 */ + CMP_L ( CONST(2), ECX ) + JAE ( LLTAG(GMB_loop_begin) ) + +LLTAG(GMB_loop_end): + + CMP_L ( CONST(1), ECX ) + JB ( LLTAG(GMB_done) ) + + CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */ + JE ( LLTAG(GMB_done) ) + + /* runout */ +#define ONE(x) x +#define TWO(x) + MAIN ( EDI, ESI ) +#undef ONE +#undef TWO + +LLTAG(GMB_done): + + EMMS + +LLTAG(GMB_return): + + POP_L ( EBX ) + POP_L ( EDI ) + POP_L ( ESI ) + MOV_L ( EBP, ESP ) + POP_L ( EBP ) + RET + +#undef TAG +#undef LLTAG +#undef INIT +#undef MAIN diff --git a/mesalib/src/mesa/x86/norm_args.h b/mesalib/src/mesa/x86/norm_args.h index bad1a1975..5d352838b 100644 --- a/mesalib/src/mesa/x86/norm_args.h +++ b/mesalib/src/mesa/x86/norm_args.h @@ -1,57 +1,57 @@ - -/* - * 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. - */ - -/* - * Normal transform function interface for assembly code. Simply define - * FRAME_OFFSET to the number of bytes pushed onto the stack before - * using the ARG_* argument macros. - * - * Gareth Hughes - */ - -#ifndef __NORM_ARGS_H__ -#define __NORM_ARGS_H__ - -/* Offsets for normal_func arguments - * - * typedef void (*normal_func)( CONST GLmatrix *mat, - * GLfloat scale, - * CONST GLvector4f *in, - * CONST GLfloat lengths[], - * GLvector4f *dest ); - */ -#define OFFSET_MAT 4 -#define OFFSET_SCALE 8 -#define OFFSET_IN 12 -#define OFFSET_LENGTHS 16 -#define OFFSET_DEST 20 - -#define ARG_MAT REGOFF(FRAME_OFFSET+OFFSET_MAT, ESP) -#define ARG_SCALE REGOFF(FRAME_OFFSET+OFFSET_SCALE, ESP) -#define ARG_IN REGOFF(FRAME_OFFSET+OFFSET_IN, ESP) -#define ARG_LENGTHS REGOFF(FRAME_OFFSET+OFFSET_LENGTHS, ESP) -#define ARG_DEST REGOFF(FRAME_OFFSET+OFFSET_DEST, ESP) - -#endif + +/* + * 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. + */ + +/* + * Normal transform function interface for assembly code. Simply define + * FRAME_OFFSET to the number of bytes pushed onto the stack before + * using the ARG_* argument macros. + * + * Gareth Hughes + */ + +#ifndef __NORM_ARGS_H__ +#define __NORM_ARGS_H__ + +/* Offsets for normal_func arguments + * + * typedef void (*normal_func)( CONST GLmatrix *mat, + * GLfloat scale, + * CONST GLvector4f *in, + * CONST GLfloat lengths[], + * GLvector4f *dest ); + */ +#define OFFSET_MAT 4 +#define OFFSET_SCALE 8 +#define OFFSET_IN 12 +#define OFFSET_LENGTHS 16 +#define OFFSET_DEST 20 + +#define ARG_MAT REGOFF(FRAME_OFFSET+OFFSET_MAT, ESP) +#define ARG_SCALE REGOFF(FRAME_OFFSET+OFFSET_SCALE, ESP) +#define ARG_IN REGOFF(FRAME_OFFSET+OFFSET_IN, ESP) +#define ARG_LENGTHS REGOFF(FRAME_OFFSET+OFFSET_LENGTHS, ESP) +#define ARG_DEST REGOFF(FRAME_OFFSET+OFFSET_DEST, ESP) + +#endif diff --git a/mesalib/src/mesa/x86/read_rgba_span_x86.S b/mesalib/src/mesa/x86/read_rgba_span_x86.S index 04571afb7..3be4515b1 100644 --- a/mesalib/src/mesa/x86/read_rgba_span_x86.S +++ b/mesalib/src/mesa/x86/read_rgba_span_x86.S @@ -1,686 +1,686 @@ -/* - * (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 read_rgba_span_x86.S - * Optimized routines to transfer pixel data from the framebuffer to a - * buffer in main memory. - * - * \author Ian Romanick - */ - - .file "read_rgba_span_x86.S" -#if !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__) /* this one cries for assyntax.h */ -/* Kevin F. Quinn 2nd July 2006 - * Replaced data segment constants with text-segment instructions. - */ -#define LOAD_MASK(mvins,m1,m2) \ - pushl $0xff00ff00 ;\ - pushl $0xff00ff00 ;\ - pushl $0xff00ff00 ;\ - pushl $0xff00ff00 ;\ - mvins (%esp), m1 ;\ - pushl $0x00ff0000 ;\ - pushl $0x00ff0000 ;\ - pushl $0x00ff0000 ;\ - pushl $0x00ff0000 ;\ - mvins (%esp), m2 ;\ - addl $32, %esp - -/* I implemented these as macros because they appear in several places, - * and I've tweaked them a number of times. I got tired of changing every - * place they appear. :) - */ - -#define DO_ONE_PIXEL() \ - movl (%ebx), %eax ; \ - addl $4, %ebx ; \ - bswap %eax /* ARGB -> BGRA */ ; \ - rorl $8, %eax /* BGRA -> ABGR */ ; \ - movl %eax, (%ecx) /* ABGR -> R, G, B, A */ ; \ - addl $4, %ecx - -#define DO_ONE_LAST_PIXEL() \ - movl (%ebx), %eax ; \ - bswap %eax /* ARGB -> BGRA */ ; \ - rorl $8, %eax /* BGRA -> ABGR */ ; \ - movl %eax, (%ecx) /* ABGR -> R, G, B, A */ ; \ - - -/** - * MMX optimized version of the BGRA8888_REV to RGBA copy routine. - * - * \warning - * This function assumes that the caller will issue the EMMS instruction - * at the correct places. - */ - -.globl _generic_read_RGBA_span_BGRA8888_REV_MMX -#ifndef USE_DRICORE -.hidden _generic_read_RGBA_span_BGRA8888_REV_MMX -#endif - .type _generic_read_RGBA_span_BGRA8888_REV_MMX, @function -_generic_read_RGBA_span_BGRA8888_REV_MMX: - pushl %ebx - -#ifdef USE_INNER_EMMS - emms -#endif - LOAD_MASK(movq,%mm1,%mm2) - - movl 8(%esp), %ebx /* source pointer */ - movl 16(%esp), %edx /* number of pixels to copy */ - movl 12(%esp), %ecx /* destination pointer */ - - testl %edx, %edx - jle .L20 /* Bail if there's nothing to do. */ - - movl %ebx, %eax - - negl %eax - sarl $2, %eax - andl $1, %eax - je .L17 - - subl %eax, %edx - DO_ONE_PIXEL() -.L17: - - /* Would it be faster to unroll this loop once and process 4 pixels - * per pass, instead of just two? - */ - - movl %edx, %eax - shrl %eax - jmp .L18 -.L19: - movq (%ebx), %mm0 - addl $8, %ebx - - /* These 9 instructions do what PSHUFB (if there were such an - * instruction) could do in 1. :( - */ - - movq %mm0, %mm3 - movq %mm0, %mm4 - - pand %mm2, %mm3 - psllq $16, %mm4 - psrlq $16, %mm3 - pand %mm2, %mm4 - - pand %mm1, %mm0 - por %mm4, %mm3 - por %mm3, %mm0 - - movq %mm0, (%ecx) - addl $8, %ecx - subl $1, %eax -.L18: - jne .L19 - -#ifdef USE_INNER_EMMS - emms -#endif - - /* At this point there are either 1 or 0 pixels remaining to be - * converted. Convert the last pixel, if needed. - */ - - testl $1, %edx - je .L20 - - DO_ONE_LAST_PIXEL() - -.L20: - popl %ebx - ret - .size _generic_read_RGBA_span_BGRA8888_REV_MMX, .-_generic_read_RGBA_span_BGRA8888_REV_MMX - - -/** - * SSE optimized version of the BGRA8888_REV to RGBA copy routine. SSE - * instructions are only actually used to read data from the framebuffer. - * In practice, the speed-up is pretty small. - * - * \todo - * Do some more testing and determine if there's any reason to have this - * function in addition to the MMX version. - * - * \warning - * This function assumes that the caller will issue the EMMS instruction - * at the correct places. - */ - -.globl _generic_read_RGBA_span_BGRA8888_REV_SSE -#ifndef USE_DRICORE -.hidden _generic_read_RGBA_span_BGRA8888_REV_SSE -#endif - .type _generic_read_RGBA_span_BGRA8888_REV_SSE, @function -_generic_read_RGBA_span_BGRA8888_REV_SSE: - pushl %esi - pushl %ebx - pushl %ebp - -#ifdef USE_INNER_EMMS - emms -#endif - - LOAD_MASK(movq,%mm1,%mm2) - - movl 16(%esp), %ebx /* source pointer */ - movl 24(%esp), %edx /* number of pixels to copy */ - movl 20(%esp), %ecx /* destination pointer */ - - testl %edx, %edx - jle .L35 /* Bail if there's nothing to do. */ - - movl %esp, %ebp - subl $16, %esp - andl $0xfffffff0, %esp - - movl %ebx, %eax - movl %edx, %esi - - negl %eax - andl $15, %eax - sarl $2, %eax - cmpl %edx, %eax - cmovle %eax, %esi - - subl %esi, %edx - - testl $1, %esi - je .L32 - - DO_ONE_PIXEL() -.L32: - - testl $2, %esi - je .L31 - - movq (%ebx), %mm0 - addl $8, %ebx - - movq %mm0, %mm3 - movq %mm0, %mm4 - - pand %mm2, %mm3 - psllq $16, %mm4 - psrlq $16, %mm3 - pand %mm2, %mm4 - - pand %mm1, %mm0 - por %mm4, %mm3 - por %mm3, %mm0 - - movq %mm0, (%ecx) - addl $8, %ecx -.L31: - - movl %edx, %eax - shrl $2, %eax - jmp .L33 -.L34: - movaps (%ebx), %xmm0 - addl $16, %ebx - - /* This would be so much better if we could just move directly from - * an SSE register to an MMX register. Unfortunately, that - * functionality wasn't introduced until SSE2 with the MOVDQ2Q - * instruction. - */ - - movaps %xmm0, (%esp) - movq (%esp), %mm0 - movq 8(%esp), %mm5 - - movq %mm0, %mm3 - movq %mm0, %mm4 - movq %mm5, %mm6 - movq %mm5, %mm7 - - pand %mm2, %mm3 - pand %mm2, %mm6 - - psllq $16, %mm4 - psllq $16, %mm7 - - psrlq $16, %mm3 - psrlq $16, %mm6 - - pand %mm2, %mm4 - pand %mm2, %mm7 - - pand %mm1, %mm0 - pand %mm1, %mm5 - - por %mm4, %mm3 - por %mm7, %mm6 - - por %mm3, %mm0 - por %mm6, %mm5 - - movq %mm0, (%ecx) - movq %mm5, 8(%ecx) - addl $16, %ecx - - subl $1, %eax -.L33: - jne .L34 - -#ifdef USE_INNER_EMMS - emms -#endif - movl %ebp, %esp - - /* At this point there are either [0, 3] pixels remaining to be - * converted. - */ - - testl $2, %edx - je .L36 - - movq (%ebx), %mm0 - addl $8, %ebx - - movq %mm0, %mm3 - movq %mm0, %mm4 - - pand %mm2, %mm3 - psllq $16, %mm4 - psrlq $16, %mm3 - pand %mm2, %mm4 - - pand %mm1, %mm0 - por %mm4, %mm3 - por %mm3, %mm0 - - movq %mm0, (%ecx) - addl $8, %ecx -.L36: - - testl $1, %edx - je .L35 - - DO_ONE_LAST_PIXEL() -.L35: - popl %ebp - popl %ebx - popl %esi - ret - .size _generic_read_RGBA_span_BGRA8888_REV_SSE, .-_generic_read_RGBA_span_BGRA8888_REV_SSE - - -/** - * SSE2 optimized version of the BGRA8888_REV to RGBA copy routine. - */ - - .text -.globl _generic_read_RGBA_span_BGRA8888_REV_SSE2 -#ifndef USE_DRICORE -.hidden _generic_read_RGBA_span_BGRA8888_REV_SSE2 -#endif - .type _generic_read_RGBA_span_BGRA8888_REV_SSE2, @function -_generic_read_RGBA_span_BGRA8888_REV_SSE2: - pushl %esi - pushl %ebx - - LOAD_MASK(movdqu,%xmm1,%xmm2) - - movl 12(%esp), %ebx /* source pointer */ - movl 20(%esp), %edx /* number of pixels to copy */ - movl 16(%esp), %ecx /* destination pointer */ - - movl %ebx, %eax - movl %edx, %esi - - testl %edx, %edx - jle .L46 /* Bail if there's nothing to do. */ - - /* If the source pointer isn't a multiple of 16 we have to process - * a few pixels the "slow" way to get the address aligned for - * the SSE fetch intsructions. - */ - - negl %eax - andl $15, %eax - sarl $2, %eax - - cmpl %edx, %eax - cmovbe %eax, %esi - subl %esi, %edx - - testl $1, %esi - je .L41 - - DO_ONE_PIXEL() -.L41: - testl $2, %esi - je .L40 - - movq (%ebx), %xmm0 - addl $8, %ebx - - movdqa %xmm0, %xmm3 - movdqa %xmm0, %xmm4 - andps %xmm1, %xmm0 - - andps %xmm2, %xmm3 - pslldq $2, %xmm4 - psrldq $2, %xmm3 - andps %xmm2, %xmm4 - - orps %xmm4, %xmm3 - orps %xmm3, %xmm0 - - movq %xmm0, (%ecx) - addl $8, %ecx -.L40: - - /* Would it be worth having a specialized version of this loop for - * the case where the destination is 16-byte aligned? That version - * would be identical except that it could use movedqa instead of - * movdqu. - */ - - movl %edx, %eax - shrl $2, %eax - jmp .L42 -.L43: - movdqa (%ebx), %xmm0 - addl $16, %ebx - - movdqa %xmm0, %xmm3 - movdqa %xmm0, %xmm4 - andps %xmm1, %xmm0 - - andps %xmm2, %xmm3 - pslldq $2, %xmm4 - psrldq $2, %xmm3 - andps %xmm2, %xmm4 - - orps %xmm4, %xmm3 - orps %xmm3, %xmm0 - - movdqu %xmm0, (%ecx) - addl $16, %ecx - subl $1, %eax -.L42: - jne .L43 - - - /* There may be upto 3 pixels remaining to be copied. Take care - * of them now. We do the 2 pixel case first because the data - * will be aligned. - */ - - testl $2, %edx - je .L47 - - movq (%ebx), %xmm0 - addl $8, %ebx - - movdqa %xmm0, %xmm3 - movdqa %xmm0, %xmm4 - andps %xmm1, %xmm0 - - andps %xmm2, %xmm3 - pslldq $2, %xmm4 - psrldq $2, %xmm3 - andps %xmm2, %xmm4 - - orps %xmm4, %xmm3 - orps %xmm3, %xmm0 - - movq %xmm0, (%ecx) - addl $8, %ecx -.L47: - - testl $1, %edx - je .L46 - - DO_ONE_LAST_PIXEL() -.L46: - - popl %ebx - popl %esi - ret - .size _generic_read_RGBA_span_BGRA8888_REV_SSE2, .-_generic_read_RGBA_span_BGRA8888_REV_SSE2 - - - -#define MASK_565_L 0x07e0f800 -#define MASK_565_H 0x0000001f -/* Setting SCALE_ADJUST to 5 gives a perfect match with the - * classic C implementation in Mesa. Setting SCALE_ADJUST - * to 0 is slightly faster but at a small cost to accuracy. - */ -#define SCALE_ADJUST 5 -#if SCALE_ADJUST == 5 -#define PRESCALE_L 0x00100001 -#define PRESCALE_H 0x00000200 -#define SCALE_L 0x40C620E8 -#define SCALE_H 0x0000839d -#elif SCALE_ADJUST == 0 -#define PRESCALE_L 0x00200001 -#define PRESCALE_H 0x00000800 -#define SCALE_L 0x01040108 -#define SCALE_H 0x00000108 -#else -#error SCALE_ADJUST must either be 5 or 0. -#endif -#define ALPHA_L 0x00000000 -#define ALPHA_H 0x00ff0000 - -/** - * MMX optimized version of the RGB565 to RGBA copy routine. - */ - - .text - .globl _generic_read_RGBA_span_RGB565_MMX -#ifndef USE_DRICORE - .hidden _generic_read_RGBA_span_RGB565_MMX -#endif - .type _generic_read_RGBA_span_RGB565_MMX, @function - -_generic_read_RGBA_span_RGB565_MMX: - -#ifdef USE_INNER_EMMS - emms -#endif - - movl 4(%esp), %eax /* source pointer */ - movl 8(%esp), %edx /* destination pointer */ - movl 12(%esp), %ecx /* number of pixels to copy */ - - pushl $MASK_565_H - pushl $MASK_565_L - movq (%esp), %mm5 - pushl $PRESCALE_H - pushl $PRESCALE_L - movq (%esp), %mm6 - pushl $SCALE_H - pushl $SCALE_L - movq (%esp), %mm7 - pushl $ALPHA_H - pushl $ALPHA_L - movq (%esp), %mm3 - addl $32,%esp - - sarl $2, %ecx - jl .L01 /* Bail early if the count is negative. */ - jmp .L02 - -.L03: - /* Fetch 4 RGB565 pixels into %mm4. Distribute the first and - * second pixels into the four words of %mm0 and %mm2. - */ - - movq (%eax), %mm4 - addl $8, %eax - - pshufw $0x00, %mm4, %mm0 - pshufw $0x55, %mm4, %mm2 - - - /* Mask the pixels so that each word of each register contains only - * one color component. - */ - - pand %mm5, %mm0 - pand %mm5, %mm2 - - - /* Adjust the component values so that they are as small as possible, - * but large enough so that we can multiply them by an unsigned 16-bit - * number and get a value as large as 0x00ff0000. - */ - - pmullw %mm6, %mm0 - pmullw %mm6, %mm2 -#if SCALE_ADJUST > 0 - psrlw $SCALE_ADJUST, %mm0 - psrlw $SCALE_ADJUST, %mm2 -#endif - - /* Scale the input component values to be on the range - * [0, 0x00ff0000]. This it the real magic of the whole routine. - */ - - pmulhuw %mm7, %mm0 - pmulhuw %mm7, %mm2 - - - /* Always set the alpha value to 0xff. - */ - - por %mm3, %mm0 - por %mm3, %mm2 - - - /* Pack the 16-bit values to 8-bit values and store the converted - * pixel data. - */ - - packuswb %mm2, %mm0 - movq %mm0, (%edx) - addl $8, %edx - - pshufw $0xaa, %mm4, %mm0 - pshufw $0xff, %mm4, %mm2 - - pand %mm5, %mm0 - pand %mm5, %mm2 - pmullw %mm6, %mm0 - pmullw %mm6, %mm2 -#if SCALE_ADJUST > 0 - psrlw $SCALE_ADJUST, %mm0 - psrlw $SCALE_ADJUST, %mm2 -#endif - pmulhuw %mm7, %mm0 - pmulhuw %mm7, %mm2 - - por %mm3, %mm0 - por %mm3, %mm2 - - packuswb %mm2, %mm0 - - movq %mm0, (%edx) - addl $8, %edx - - subl $1, %ecx -.L02: - jne .L03 - - - /* At this point there can be at most 3 pixels left to process. If - * there is either 2 or 3 left, process 2. - */ - - movl 12(%esp), %ecx - testl $0x02, %ecx - je .L04 - - movd (%eax), %mm4 - addl $4, %eax - - pshufw $0x00, %mm4, %mm0 - pshufw $0x55, %mm4, %mm2 - - pand %mm5, %mm0 - pand %mm5, %mm2 - pmullw %mm6, %mm0 - pmullw %mm6, %mm2 -#if SCALE_ADJUST > 0 - psrlw $SCALE_ADJUST, %mm0 - psrlw $SCALE_ADJUST, %mm2 -#endif - pmulhuw %mm7, %mm0 - pmulhuw %mm7, %mm2 - - por %mm3, %mm0 - por %mm3, %mm2 - - packuswb %mm2, %mm0 - - movq %mm0, (%edx) - addl $8, %edx - -.L04: - /* At this point there can be at most 1 pixel left to process. - * Process it if needed. - */ - - testl $0x01, %ecx - je .L01 - - movzwl (%eax), %ecx - movd %ecx, %mm4 - - pshufw $0x00, %mm4, %mm0 - - pand %mm5, %mm0 - pmullw %mm6, %mm0 -#if SCALE_ADJUST > 0 - psrlw $SCALE_ADJUST, %mm0 -#endif - pmulhuw %mm7, %mm0 - - por %mm3, %mm0 - - packuswb %mm0, %mm0 - - movd %mm0, (%edx) - -.L01: -#ifdef USE_INNER_EMMS - emms -#endif - ret -#endif /* !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__) */ - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif +/* + * (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 read_rgba_span_x86.S + * Optimized routines to transfer pixel data from the framebuffer to a + * buffer in main memory. + * + * \author Ian Romanick + */ + + .file "read_rgba_span_x86.S" +#if !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__) /* this one cries for assyntax.h */ +/* Kevin F. Quinn 2nd July 2006 + * Replaced data segment constants with text-segment instructions. + */ +#define LOAD_MASK(mvins,m1,m2) \ + pushl $0xff00ff00 ;\ + pushl $0xff00ff00 ;\ + pushl $0xff00ff00 ;\ + pushl $0xff00ff00 ;\ + mvins (%esp), m1 ;\ + pushl $0x00ff0000 ;\ + pushl $0x00ff0000 ;\ + pushl $0x00ff0000 ;\ + pushl $0x00ff0000 ;\ + mvins (%esp), m2 ;\ + addl $32, %esp + +/* I implemented these as macros because they appear in several places, + * and I've tweaked them a number of times. I got tired of changing every + * place they appear. :) + */ + +#define DO_ONE_PIXEL() \ + movl (%ebx), %eax ; \ + addl $4, %ebx ; \ + bswap %eax /* ARGB -> BGRA */ ; \ + rorl $8, %eax /* BGRA -> ABGR */ ; \ + movl %eax, (%ecx) /* ABGR -> R, G, B, A */ ; \ + addl $4, %ecx + +#define DO_ONE_LAST_PIXEL() \ + movl (%ebx), %eax ; \ + bswap %eax /* ARGB -> BGRA */ ; \ + rorl $8, %eax /* BGRA -> ABGR */ ; \ + movl %eax, (%ecx) /* ABGR -> R, G, B, A */ ; \ + + +/** + * MMX optimized version of the BGRA8888_REV to RGBA copy routine. + * + * \warning + * This function assumes that the caller will issue the EMMS instruction + * at the correct places. + */ + +.globl _generic_read_RGBA_span_BGRA8888_REV_MMX +#ifndef USE_DRICORE +.hidden _generic_read_RGBA_span_BGRA8888_REV_MMX +#endif + .type _generic_read_RGBA_span_BGRA8888_REV_MMX, @function +_generic_read_RGBA_span_BGRA8888_REV_MMX: + pushl %ebx + +#ifdef USE_INNER_EMMS + emms +#endif + LOAD_MASK(movq,%mm1,%mm2) + + movl 8(%esp), %ebx /* source pointer */ + movl 16(%esp), %edx /* number of pixels to copy */ + movl 12(%esp), %ecx /* destination pointer */ + + testl %edx, %edx + jle .L20 /* Bail if there's nothing to do. */ + + movl %ebx, %eax + + negl %eax + sarl $2, %eax + andl $1, %eax + je .L17 + + subl %eax, %edx + DO_ONE_PIXEL() +.L17: + + /* Would it be faster to unroll this loop once and process 4 pixels + * per pass, instead of just two? + */ + + movl %edx, %eax + shrl %eax + jmp .L18 +.L19: + movq (%ebx), %mm0 + addl $8, %ebx + + /* These 9 instructions do what PSHUFB (if there were such an + * instruction) could do in 1. :( + */ + + movq %mm0, %mm3 + movq %mm0, %mm4 + + pand %mm2, %mm3 + psllq $16, %mm4 + psrlq $16, %mm3 + pand %mm2, %mm4 + + pand %mm1, %mm0 + por %mm4, %mm3 + por %mm3, %mm0 + + movq %mm0, (%ecx) + addl $8, %ecx + subl $1, %eax +.L18: + jne .L19 + +#ifdef USE_INNER_EMMS + emms +#endif + + /* At this point there are either 1 or 0 pixels remaining to be + * converted. Convert the last pixel, if needed. + */ + + testl $1, %edx + je .L20 + + DO_ONE_LAST_PIXEL() + +.L20: + popl %ebx + ret + .size _generic_read_RGBA_span_BGRA8888_REV_MMX, .-_generic_read_RGBA_span_BGRA8888_REV_MMX + + +/** + * SSE optimized version of the BGRA8888_REV to RGBA copy routine. SSE + * instructions are only actually used to read data from the framebuffer. + * In practice, the speed-up is pretty small. + * + * \todo + * Do some more testing and determine if there's any reason to have this + * function in addition to the MMX version. + * + * \warning + * This function assumes that the caller will issue the EMMS instruction + * at the correct places. + */ + +.globl _generic_read_RGBA_span_BGRA8888_REV_SSE +#ifndef USE_DRICORE +.hidden _generic_read_RGBA_span_BGRA8888_REV_SSE +#endif + .type _generic_read_RGBA_span_BGRA8888_REV_SSE, @function +_generic_read_RGBA_span_BGRA8888_REV_SSE: + pushl %esi + pushl %ebx + pushl %ebp + +#ifdef USE_INNER_EMMS + emms +#endif + + LOAD_MASK(movq,%mm1,%mm2) + + movl 16(%esp), %ebx /* source pointer */ + movl 24(%esp), %edx /* number of pixels to copy */ + movl 20(%esp), %ecx /* destination pointer */ + + testl %edx, %edx + jle .L35 /* Bail if there's nothing to do. */ + + movl %esp, %ebp + subl $16, %esp + andl $0xfffffff0, %esp + + movl %ebx, %eax + movl %edx, %esi + + negl %eax + andl $15, %eax + sarl $2, %eax + cmpl %edx, %eax + cmovle %eax, %esi + + subl %esi, %edx + + testl $1, %esi + je .L32 + + DO_ONE_PIXEL() +.L32: + + testl $2, %esi + je .L31 + + movq (%ebx), %mm0 + addl $8, %ebx + + movq %mm0, %mm3 + movq %mm0, %mm4 + + pand %mm2, %mm3 + psllq $16, %mm4 + psrlq $16, %mm3 + pand %mm2, %mm4 + + pand %mm1, %mm0 + por %mm4, %mm3 + por %mm3, %mm0 + + movq %mm0, (%ecx) + addl $8, %ecx +.L31: + + movl %edx, %eax + shrl $2, %eax + jmp .L33 +.L34: + movaps (%ebx), %xmm0 + addl $16, %ebx + + /* This would be so much better if we could just move directly from + * an SSE register to an MMX register. Unfortunately, that + * functionality wasn't introduced until SSE2 with the MOVDQ2Q + * instruction. + */ + + movaps %xmm0, (%esp) + movq (%esp), %mm0 + movq 8(%esp), %mm5 + + movq %mm0, %mm3 + movq %mm0, %mm4 + movq %mm5, %mm6 + movq %mm5, %mm7 + + pand %mm2, %mm3 + pand %mm2, %mm6 + + psllq $16, %mm4 + psllq $16, %mm7 + + psrlq $16, %mm3 + psrlq $16, %mm6 + + pand %mm2, %mm4 + pand %mm2, %mm7 + + pand %mm1, %mm0 + pand %mm1, %mm5 + + por %mm4, %mm3 + por %mm7, %mm6 + + por %mm3, %mm0 + por %mm6, %mm5 + + movq %mm0, (%ecx) + movq %mm5, 8(%ecx) + addl $16, %ecx + + subl $1, %eax +.L33: + jne .L34 + +#ifdef USE_INNER_EMMS + emms +#endif + movl %ebp, %esp + + /* At this point there are either [0, 3] pixels remaining to be + * converted. + */ + + testl $2, %edx + je .L36 + + movq (%ebx), %mm0 + addl $8, %ebx + + movq %mm0, %mm3 + movq %mm0, %mm4 + + pand %mm2, %mm3 + psllq $16, %mm4 + psrlq $16, %mm3 + pand %mm2, %mm4 + + pand %mm1, %mm0 + por %mm4, %mm3 + por %mm3, %mm0 + + movq %mm0, (%ecx) + addl $8, %ecx +.L36: + + testl $1, %edx + je .L35 + + DO_ONE_LAST_PIXEL() +.L35: + popl %ebp + popl %ebx + popl %esi + ret + .size _generic_read_RGBA_span_BGRA8888_REV_SSE, .-_generic_read_RGBA_span_BGRA8888_REV_SSE + + +/** + * SSE2 optimized version of the BGRA8888_REV to RGBA copy routine. + */ + + .text +.globl _generic_read_RGBA_span_BGRA8888_REV_SSE2 +#ifndef USE_DRICORE +.hidden _generic_read_RGBA_span_BGRA8888_REV_SSE2 +#endif + .type _generic_read_RGBA_span_BGRA8888_REV_SSE2, @function +_generic_read_RGBA_span_BGRA8888_REV_SSE2: + pushl %esi + pushl %ebx + + LOAD_MASK(movdqu,%xmm1,%xmm2) + + movl 12(%esp), %ebx /* source pointer */ + movl 20(%esp), %edx /* number of pixels to copy */ + movl 16(%esp), %ecx /* destination pointer */ + + movl %ebx, %eax + movl %edx, %esi + + testl %edx, %edx + jle .L46 /* Bail if there's nothing to do. */ + + /* If the source pointer isn't a multiple of 16 we have to process + * a few pixels the "slow" way to get the address aligned for + * the SSE fetch intsructions. + */ + + negl %eax + andl $15, %eax + sarl $2, %eax + + cmpl %edx, %eax + cmovbe %eax, %esi + subl %esi, %edx + + testl $1, %esi + je .L41 + + DO_ONE_PIXEL() +.L41: + testl $2, %esi + je .L40 + + movq (%ebx), %xmm0 + addl $8, %ebx + + movdqa %xmm0, %xmm3 + movdqa %xmm0, %xmm4 + andps %xmm1, %xmm0 + + andps %xmm2, %xmm3 + pslldq $2, %xmm4 + psrldq $2, %xmm3 + andps %xmm2, %xmm4 + + orps %xmm4, %xmm3 + orps %xmm3, %xmm0 + + movq %xmm0, (%ecx) + addl $8, %ecx +.L40: + + /* Would it be worth having a specialized version of this loop for + * the case where the destination is 16-byte aligned? That version + * would be identical except that it could use movedqa instead of + * movdqu. + */ + + movl %edx, %eax + shrl $2, %eax + jmp .L42 +.L43: + movdqa (%ebx), %xmm0 + addl $16, %ebx + + movdqa %xmm0, %xmm3 + movdqa %xmm0, %xmm4 + andps %xmm1, %xmm0 + + andps %xmm2, %xmm3 + pslldq $2, %xmm4 + psrldq $2, %xmm3 + andps %xmm2, %xmm4 + + orps %xmm4, %xmm3 + orps %xmm3, %xmm0 + + movdqu %xmm0, (%ecx) + addl $16, %ecx + subl $1, %eax +.L42: + jne .L43 + + + /* There may be upto 3 pixels remaining to be copied. Take care + * of them now. We do the 2 pixel case first because the data + * will be aligned. + */ + + testl $2, %edx + je .L47 + + movq (%ebx), %xmm0 + addl $8, %ebx + + movdqa %xmm0, %xmm3 + movdqa %xmm0, %xmm4 + andps %xmm1, %xmm0 + + andps %xmm2, %xmm3 + pslldq $2, %xmm4 + psrldq $2, %xmm3 + andps %xmm2, %xmm4 + + orps %xmm4, %xmm3 + orps %xmm3, %xmm0 + + movq %xmm0, (%ecx) + addl $8, %ecx +.L47: + + testl $1, %edx + je .L46 + + DO_ONE_LAST_PIXEL() +.L46: + + popl %ebx + popl %esi + ret + .size _generic_read_RGBA_span_BGRA8888_REV_SSE2, .-_generic_read_RGBA_span_BGRA8888_REV_SSE2 + + + +#define MASK_565_L 0x07e0f800 +#define MASK_565_H 0x0000001f +/* Setting SCALE_ADJUST to 5 gives a perfect match with the + * classic C implementation in Mesa. Setting SCALE_ADJUST + * to 0 is slightly faster but at a small cost to accuracy. + */ +#define SCALE_ADJUST 5 +#if SCALE_ADJUST == 5 +#define PRESCALE_L 0x00100001 +#define PRESCALE_H 0x00000200 +#define SCALE_L 0x40C620E8 +#define SCALE_H 0x0000839d +#elif SCALE_ADJUST == 0 +#define PRESCALE_L 0x00200001 +#define PRESCALE_H 0x00000800 +#define SCALE_L 0x01040108 +#define SCALE_H 0x00000108 +#else +#error SCALE_ADJUST must either be 5 or 0. +#endif +#define ALPHA_L 0x00000000 +#define ALPHA_H 0x00ff0000 + +/** + * MMX optimized version of the RGB565 to RGBA copy routine. + */ + + .text + .globl _generic_read_RGBA_span_RGB565_MMX +#ifndef USE_DRICORE + .hidden _generic_read_RGBA_span_RGB565_MMX +#endif + .type _generic_read_RGBA_span_RGB565_MMX, @function + +_generic_read_RGBA_span_RGB565_MMX: + +#ifdef USE_INNER_EMMS + emms +#endif + + movl 4(%esp), %eax /* source pointer */ + movl 8(%esp), %edx /* destination pointer */ + movl 12(%esp), %ecx /* number of pixels to copy */ + + pushl $MASK_565_H + pushl $MASK_565_L + movq (%esp), %mm5 + pushl $PRESCALE_H + pushl $PRESCALE_L + movq (%esp), %mm6 + pushl $SCALE_H + pushl $SCALE_L + movq (%esp), %mm7 + pushl $ALPHA_H + pushl $ALPHA_L + movq (%esp), %mm3 + addl $32,%esp + + sarl $2, %ecx + jl .L01 /* Bail early if the count is negative. */ + jmp .L02 + +.L03: + /* Fetch 4 RGB565 pixels into %mm4. Distribute the first and + * second pixels into the four words of %mm0 and %mm2. + */ + + movq (%eax), %mm4 + addl $8, %eax + + pshufw $0x00, %mm4, %mm0 + pshufw $0x55, %mm4, %mm2 + + + /* Mask the pixels so that each word of each register contains only + * one color component. + */ + + pand %mm5, %mm0 + pand %mm5, %mm2 + + + /* Adjust the component values so that they are as small as possible, + * but large enough so that we can multiply them by an unsigned 16-bit + * number and get a value as large as 0x00ff0000. + */ + + pmullw %mm6, %mm0 + pmullw %mm6, %mm2 +#if SCALE_ADJUST > 0 + psrlw $SCALE_ADJUST, %mm0 + psrlw $SCALE_ADJUST, %mm2 +#endif + + /* Scale the input component values to be on the range + * [0, 0x00ff0000]. This it the real magic of the whole routine. + */ + + pmulhuw %mm7, %mm0 + pmulhuw %mm7, %mm2 + + + /* Always set the alpha value to 0xff. + */ + + por %mm3, %mm0 + por %mm3, %mm2 + + + /* Pack the 16-bit values to 8-bit values and store the converted + * pixel data. + */ + + packuswb %mm2, %mm0 + movq %mm0, (%edx) + addl $8, %edx + + pshufw $0xaa, %mm4, %mm0 + pshufw $0xff, %mm4, %mm2 + + pand %mm5, %mm0 + pand %mm5, %mm2 + pmullw %mm6, %mm0 + pmullw %mm6, %mm2 +#if SCALE_ADJUST > 0 + psrlw $SCALE_ADJUST, %mm0 + psrlw $SCALE_ADJUST, %mm2 +#endif + pmulhuw %mm7, %mm0 + pmulhuw %mm7, %mm2 + + por %mm3, %mm0 + por %mm3, %mm2 + + packuswb %mm2, %mm0 + + movq %mm0, (%edx) + addl $8, %edx + + subl $1, %ecx +.L02: + jne .L03 + + + /* At this point there can be at most 3 pixels left to process. If + * there is either 2 or 3 left, process 2. + */ + + movl 12(%esp), %ecx + testl $0x02, %ecx + je .L04 + + movd (%eax), %mm4 + addl $4, %eax + + pshufw $0x00, %mm4, %mm0 + pshufw $0x55, %mm4, %mm2 + + pand %mm5, %mm0 + pand %mm5, %mm2 + pmullw %mm6, %mm0 + pmullw %mm6, %mm2 +#if SCALE_ADJUST > 0 + psrlw $SCALE_ADJUST, %mm0 + psrlw $SCALE_ADJUST, %mm2 +#endif + pmulhuw %mm7, %mm0 + pmulhuw %mm7, %mm2 + + por %mm3, %mm0 + por %mm3, %mm2 + + packuswb %mm2, %mm0 + + movq %mm0, (%edx) + addl $8, %edx + +.L04: + /* At this point there can be at most 1 pixel left to process. + * Process it if needed. + */ + + testl $0x01, %ecx + je .L01 + + movzwl (%eax), %ecx + movd %ecx, %mm4 + + pshufw $0x00, %mm4, %mm0 + + pand %mm5, %mm0 + pmullw %mm6, %mm0 +#if SCALE_ADJUST > 0 + psrlw $SCALE_ADJUST, %mm0 +#endif + pmulhuw %mm7, %mm0 + + por %mm3, %mm0 + + packuswb %mm0, %mm0 + + movd %mm0, (%edx) + +.L01: +#ifdef USE_INNER_EMMS + emms +#endif + ret +#endif /* !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__) */ + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/read_rgba_span_x86.h b/mesalib/src/mesa/x86/read_rgba_span_x86.h index d255f6dcb..564b1bb0f 100644 --- a/mesalib/src/mesa/x86/read_rgba_span_x86.h +++ b/mesalib/src/mesa/x86/read_rgba_span_x86.h @@ -1,56 +1,56 @@ -/* - * (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 read_rgba_span_x86.h - * - * \author Ian Romanick - */ - -#ifndef READ_RGBA_SPAN_X86_H -#define READ_RGBA_SPAN_X86_H - -#if defined(USE_SSE_ASM) || defined(USE_MMX_ASM) -#include "x86/common_x86_asm.h" -#endif - -#if defined(USE_SSE_ASM) -extern void _generic_read_RGBA_span_BGRA8888_REV_SSE2( const unsigned char *, - unsigned char *, unsigned ); -#endif - -#if defined(USE_SSE_ASM) -extern void _generic_read_RGBA_span_BGRA8888_REV_SSE( const unsigned char *, - unsigned char *, unsigned ); -#endif - -#if defined(USE_MMX_ASM) -extern void _generic_read_RGBA_span_BGRA8888_REV_MMX( const unsigned char *, - unsigned char *, unsigned ); - -extern void _generic_read_RGBA_span_RGB565_MMX( const unsigned char *, - unsigned char *, unsigned ); -#endif - -#endif /* READ_RGBA_SPAN_X86_H */ +/* + * (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 read_rgba_span_x86.h + * + * \author Ian Romanick + */ + +#ifndef READ_RGBA_SPAN_X86_H +#define READ_RGBA_SPAN_X86_H + +#if defined(USE_SSE_ASM) || defined(USE_MMX_ASM) +#include "x86/common_x86_asm.h" +#endif + +#if defined(USE_SSE_ASM) +extern void _generic_read_RGBA_span_BGRA8888_REV_SSE2( const unsigned char *, + unsigned char *, unsigned ); +#endif + +#if defined(USE_SSE_ASM) +extern void _generic_read_RGBA_span_BGRA8888_REV_SSE( const unsigned char *, + unsigned char *, unsigned ); +#endif + +#if defined(USE_MMX_ASM) +extern void _generic_read_RGBA_span_BGRA8888_REV_MMX( const unsigned char *, + unsigned char *, unsigned ); + +extern void _generic_read_RGBA_span_RGB565_MMX( const unsigned char *, + unsigned char *, unsigned ); +#endif + +#endif /* READ_RGBA_SPAN_X86_H */ diff --git a/mesalib/src/mesa/x86/rtasm/x86sse.c b/mesalib/src/mesa/x86/rtasm/x86sse.c index 08e3969b2..c93faba79 100644 --- a/mesalib/src/mesa/x86/rtasm/x86sse.c +++ b/mesalib/src/mesa/x86/rtasm/x86sse.c @@ -1,1203 +1,1203 @@ -#ifdef USE_X86_ASM -#if defined(__i386__) || defined(__386__) - -#include "main/imports.h" -#include "x86sse.h" - -#define DISASSEM 0 -#define X86_TWOB 0x0f - -#if 0 -static unsigned char *cptr( void (*label)() ) -{ - return (unsigned char *)(unsigned long)label; -} -#endif - - -static void do_realloc( struct x86_function *p ) -{ - if (p->size == 0) { - p->size = 1024; - p->store = _mesa_exec_malloc(p->size); - p->csr = p->store; - } - else { - unsigned used = p->csr - p->store; - unsigned char *tmp = p->store; - p->size *= 2; - p->store = _mesa_exec_malloc(p->size); - memcpy(p->store, tmp, used); - p->csr = p->store + used; - _mesa_exec_free(tmp); - } -} - -/* Emit bytes to the instruction stream: - */ -static unsigned char *reserve( struct x86_function *p, int bytes ) -{ - if (p->csr + bytes - p->store > p->size) - do_realloc(p); - - { - unsigned char *csr = p->csr; - p->csr += bytes; - return csr; - } -} - - - -static void emit_1b( struct x86_function *p, char b0 ) -{ - char *csr = (char *)reserve(p, 1); - *csr = b0; -} - -static void emit_1i( struct x86_function *p, int i0 ) -{ - int *icsr = (int *)reserve(p, sizeof(i0)); - *icsr = i0; -} - -static void emit_1ub( struct x86_function *p, unsigned char b0 ) -{ - unsigned char *csr = reserve(p, 1); - *csr++ = b0; -} - -static void emit_2ub( struct x86_function *p, unsigned char b0, unsigned char b1 ) -{ - unsigned char *csr = reserve(p, 2); - *csr++ = b0; - *csr++ = b1; -} - -static void emit_3ub( struct x86_function *p, unsigned char b0, unsigned char b1, unsigned char b2 ) -{ - unsigned char *csr = reserve(p, 3); - *csr++ = b0; - *csr++ = b1; - *csr++ = b2; -} - - -/* Build a modRM byte + possible displacement. No treatment of SIB - * indexing. BZZT - no way to encode an absolute address. - */ -static void emit_modrm( struct x86_function *p, - struct x86_reg reg, - struct x86_reg regmem ) -{ - unsigned char val = 0; - - assert(reg.mod == mod_REG); - - val |= regmem.mod << 6; /* mod field */ - val |= reg.idx << 3; /* reg field */ - val |= regmem.idx; /* r/m field */ - - emit_1ub(p, val); - - /* Oh-oh we've stumbled into the SIB thing. - */ - if (regmem.file == file_REG32 && - regmem.idx == reg_SP) { - emit_1ub(p, 0x24); /* simplistic! */ - } - - switch (regmem.mod) { - case mod_REG: - case mod_INDIRECT: - break; - case mod_DISP8: - emit_1b(p, regmem.disp); - break; - case mod_DISP32: - emit_1i(p, regmem.disp); - break; - default: - assert(0); - break; - } -} - - -static void emit_modrm_noreg( struct x86_function *p, - unsigned op, - struct x86_reg regmem ) -{ - struct x86_reg dummy = x86_make_reg(file_REG32, op); - emit_modrm(p, dummy, regmem); -} - -/* Many x86 instructions have two opcodes to cope with the situations - * where the destination is a register or memory reference - * respectively. This function selects the correct opcode based on - * the arguments presented. - */ -static void emit_op_modrm( struct x86_function *p, - unsigned char op_dst_is_reg, - unsigned char op_dst_is_mem, - struct x86_reg dst, - struct x86_reg src ) -{ - switch (dst.mod) { - case mod_REG: - emit_1ub(p, op_dst_is_reg); - emit_modrm(p, dst, src); - break; - case mod_INDIRECT: - case mod_DISP32: - case mod_DISP8: - assert(src.mod == mod_REG); - emit_1ub(p, op_dst_is_mem); - emit_modrm(p, src, dst); - break; - default: - assert(0); - break; - } -} - - - - - - - -/* Create and manipulate registers and regmem values: - */ -struct x86_reg x86_make_reg( enum x86_reg_file file, - enum x86_reg_name idx ) -{ - struct x86_reg reg; - - reg.file = file; - reg.idx = idx; - reg.mod = mod_REG; - reg.disp = 0; - - return reg; -} - -struct x86_reg x86_make_disp( struct x86_reg reg, - int disp ) -{ - assert(reg.file == file_REG32); - - if (reg.mod == mod_REG) - reg.disp = disp; - else - reg.disp += disp; - - if (reg.disp == 0) - reg.mod = mod_INDIRECT; - else if (reg.disp <= 127 && reg.disp >= -128) - reg.mod = mod_DISP8; - else - reg.mod = mod_DISP32; - - return reg; -} - -struct x86_reg x86_deref( struct x86_reg reg ) -{ - return x86_make_disp(reg, 0); -} - -struct x86_reg x86_get_base_reg( struct x86_reg reg ) -{ - return x86_make_reg( reg.file, reg.idx ); -} - -unsigned char *x86_get_label( struct x86_function *p ) -{ - return p->csr; -} - - - -/*********************************************************************** - * x86 instructions - */ - - -void x86_jcc( struct x86_function *p, - enum x86_cc cc, - unsigned char *label ) -{ - int offset = label - (x86_get_label(p) + 2); - - if (offset <= 127 && offset >= -128) { - emit_1ub(p, 0x70 + cc); - emit_1b(p, (char) offset); - } - else { - offset = label - (x86_get_label(p) + 6); - emit_2ub(p, 0x0f, 0x80 + cc); - emit_1i(p, offset); - } -} - -/* Always use a 32bit offset for forward jumps: - */ -unsigned char *x86_jcc_forward( struct x86_function *p, - enum x86_cc cc ) -{ - emit_2ub(p, 0x0f, 0x80 + cc); - emit_1i(p, 0); - return x86_get_label(p); -} - -unsigned char *x86_jmp_forward( struct x86_function *p) -{ - emit_1ub(p, 0xe9); - emit_1i(p, 0); - return x86_get_label(p); -} - -unsigned char *x86_call_forward( struct x86_function *p) -{ - emit_1ub(p, 0xe8); - emit_1i(p, 0); - return x86_get_label(p); -} - -/* Fixup offset from forward jump: - */ -void x86_fixup_fwd_jump( struct x86_function *p, - unsigned char *fixup ) -{ - *(int *)(fixup - 4) = x86_get_label(p) - fixup; -} - -void x86_jmp( struct x86_function *p, unsigned char *label) -{ - emit_1ub(p, 0xe9); - emit_1i(p, label - x86_get_label(p) - 4); -} - -#if 0 -/* This doesn't work once we start reallocating & copying the - * generated code on buffer fills, because the call is relative to the - * current pc. - */ -void x86_call( struct x86_function *p, void (*label)()) -{ - emit_1ub(p, 0xe8); - emit_1i(p, cptr(label) - x86_get_label(p) - 4); -} -#else -void x86_call( struct x86_function *p, struct x86_reg reg) -{ - emit_1ub(p, 0xff); - emit_modrm_noreg(p, 2, reg); -} -#endif - - -/* michal: - * Temporary. As I need immediate operands, and dont want to mess with the codegen, - * I load the immediate into general purpose register and use it. - */ -void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm ) -{ - assert(dst.mod == mod_REG); - emit_1ub(p, 0xb8 + dst.idx); - emit_1i(p, imm); -} - -void x86_push( struct x86_function *p, - struct x86_reg reg ) -{ - assert(reg.mod == mod_REG); - emit_1ub(p, 0x50 + reg.idx); - p->stack_offset += 4; -} - -void x86_pop( struct x86_function *p, - struct x86_reg reg ) -{ - assert(reg.mod == mod_REG); - emit_1ub(p, 0x58 + reg.idx); - p->stack_offset -= 4; -} - -void x86_inc( struct x86_function *p, - struct x86_reg reg ) -{ - assert(reg.mod == mod_REG); - emit_1ub(p, 0x40 + reg.idx); -} - -void x86_dec( struct x86_function *p, - struct x86_reg reg ) -{ - assert(reg.mod == mod_REG); - emit_1ub(p, 0x48 + reg.idx); -} - -void x86_ret( struct x86_function *p ) -{ - emit_1ub(p, 0xc3); -} - -void x86_sahf( struct x86_function *p ) -{ - emit_1ub(p, 0x9e); -} - -void x86_mov( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_op_modrm( p, 0x8b, 0x89, dst, src ); -} - -void x86_xor( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_op_modrm( p, 0x33, 0x31, dst, src ); -} - -void x86_cmp( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_op_modrm( p, 0x3b, 0x39, dst, src ); -} - -void x86_lea( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_1ub(p, 0x8d); - emit_modrm( p, dst, src ); -} - -void x86_test( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_1ub(p, 0x85); - emit_modrm( p, dst, src ); -} - -void x86_add( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_op_modrm(p, 0x03, 0x01, dst, src ); -} - -void x86_mul( struct x86_function *p, - struct x86_reg src ) -{ - assert (src.file == file_REG32 && src.mod == mod_REG); - emit_op_modrm(p, 0xf7, 0, x86_make_reg (file_REG32, reg_SP), src ); -} - -void x86_sub( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_op_modrm(p, 0x2b, 0x29, dst, src ); -} - -void x86_or( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_op_modrm( p, 0x0b, 0x09, dst, src ); -} - -void x86_and( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_op_modrm( p, 0x23, 0x21, dst, src ); -} - - - -/*********************************************************************** - * SSE instructions - */ - - -void sse_movss( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_2ub(p, 0xF3, X86_TWOB); - emit_op_modrm( p, 0x10, 0x11, dst, src ); -} - -void sse_movaps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_1ub(p, X86_TWOB); - emit_op_modrm( p, 0x28, 0x29, dst, src ); -} - -void sse_movups( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_1ub(p, X86_TWOB); - emit_op_modrm( p, 0x10, 0x11, dst, src ); -} - -void sse_movhps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - assert(dst.mod != mod_REG || src.mod != mod_REG); - emit_1ub(p, X86_TWOB); - emit_op_modrm( p, 0x16, 0x17, dst, src ); /* cf movlhps */ -} - -void sse_movlps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - assert(dst.mod != mod_REG || src.mod != mod_REG); - emit_1ub(p, X86_TWOB); - emit_op_modrm( p, 0x12, 0x13, dst, src ); /* cf movhlps */ -} - -void sse_maxps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_2ub(p, X86_TWOB, 0x5F); - emit_modrm( p, dst, src ); -} - -void sse_maxss( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_3ub(p, 0xF3, X86_TWOB, 0x5F); - emit_modrm( p, dst, src ); -} - -void sse_divss( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_3ub(p, 0xF3, X86_TWOB, 0x5E); - emit_modrm( p, dst, src ); -} - -void sse_minps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_2ub(p, X86_TWOB, 0x5D); - emit_modrm( p, dst, src ); -} - -void sse_subps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_2ub(p, X86_TWOB, 0x5C); - emit_modrm( p, dst, src ); -} - -void sse_mulps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_2ub(p, X86_TWOB, 0x59); - emit_modrm( p, dst, src ); -} - -void sse_mulss( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_3ub(p, 0xF3, X86_TWOB, 0x59); - emit_modrm( p, dst, src ); -} - -void sse_addps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_2ub(p, X86_TWOB, 0x58); - emit_modrm( p, dst, src ); -} - -void sse_addss( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_3ub(p, 0xF3, X86_TWOB, 0x58); - emit_modrm( p, dst, src ); -} - -void sse_andnps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_2ub(p, X86_TWOB, 0x55); - emit_modrm( p, dst, src ); -} - -void sse_andps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_2ub(p, X86_TWOB, 0x54); - emit_modrm( p, dst, src ); -} - -void sse_rsqrtps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_2ub(p, X86_TWOB, 0x52); - emit_modrm( p, dst, src ); -} - -void sse_rsqrtss( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_3ub(p, 0xF3, X86_TWOB, 0x52); - emit_modrm( p, dst, src ); - -} - -void sse_movhlps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - assert(dst.mod == mod_REG && src.mod == mod_REG); - emit_2ub(p, X86_TWOB, 0x12); - emit_modrm( p, dst, src ); -} - -void sse_movlhps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - assert(dst.mod == mod_REG && src.mod == mod_REG); - emit_2ub(p, X86_TWOB, 0x16); - emit_modrm( p, dst, src ); -} - -void sse_orps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_2ub(p, X86_TWOB, 0x56); - emit_modrm( p, dst, src ); -} - -void sse_xorps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_2ub(p, X86_TWOB, 0x57); - emit_modrm( p, dst, src ); -} - -void sse_cvtps2pi( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - assert(dst.file == file_MMX && - (src.file == file_XMM || src.mod != mod_REG)); - - p->need_emms = 1; - - emit_2ub(p, X86_TWOB, 0x2d); - emit_modrm( p, dst, src ); -} - - -/* Shufps can also be used to implement a reduced swizzle when dest == - * arg0. - */ -void sse_shufps( struct x86_function *p, - struct x86_reg dest, - struct x86_reg arg0, - unsigned char shuf) -{ - emit_2ub(p, X86_TWOB, 0xC6); - emit_modrm(p, dest, arg0); - emit_1ub(p, shuf); -} - -void sse_cmpps( struct x86_function *p, - struct x86_reg dest, - struct x86_reg arg0, - unsigned char cc) -{ - emit_2ub(p, X86_TWOB, 0xC2); - emit_modrm(p, dest, arg0); - emit_1ub(p, cc); -} - -void sse_pmovmskb( struct x86_function *p, - struct x86_reg dest, - struct x86_reg src) -{ - emit_3ub(p, 0x66, X86_TWOB, 0xD7); - emit_modrm(p, dest, src); -} - -/*********************************************************************** - * SSE2 instructions - */ - -/** - * Perform a reduced swizzle: - */ -void sse2_pshufd( struct x86_function *p, - struct x86_reg dest, - struct x86_reg arg0, - unsigned char shuf) -{ - emit_3ub(p, 0x66, X86_TWOB, 0x70); - emit_modrm(p, dest, arg0); - emit_1ub(p, shuf); -} - -void sse2_cvttps2dq( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_3ub( p, 0xF3, X86_TWOB, 0x5B ); - emit_modrm( p, dst, src ); -} - -void sse2_cvtps2dq( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_3ub(p, 0x66, X86_TWOB, 0x5B); - emit_modrm( p, dst, src ); -} - -void sse2_packssdw( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_3ub(p, 0x66, X86_TWOB, 0x6B); - emit_modrm( p, dst, src ); -} - -void sse2_packsswb( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_3ub(p, 0x66, X86_TWOB, 0x63); - emit_modrm( p, dst, src ); -} - -void sse2_packuswb( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_3ub(p, 0x66, X86_TWOB, 0x67); - emit_modrm( p, dst, src ); -} - -void sse2_rcpps( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_2ub(p, X86_TWOB, 0x53); - emit_modrm( p, dst, src ); -} - -void sse2_rcpss( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_3ub(p, 0xF3, X86_TWOB, 0x53); - emit_modrm( p, dst, src ); -} - -void sse2_movd( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - emit_2ub(p, 0x66, X86_TWOB); - emit_op_modrm( p, 0x6e, 0x7e, dst, src ); -} - - - - -/*********************************************************************** - * x87 instructions - */ -void x87_fist( struct x86_function *p, struct x86_reg dst ) -{ - emit_1ub(p, 0xdb); - emit_modrm_noreg(p, 2, dst); -} - -void x87_fistp( struct x86_function *p, struct x86_reg dst ) -{ - emit_1ub(p, 0xdb); - emit_modrm_noreg(p, 3, dst); -} - -void x87_fild( struct x86_function *p, struct x86_reg arg ) -{ - emit_1ub(p, 0xdf); - emit_modrm_noreg(p, 0, arg); -} - -void x87_fldz( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xee); -} - - -void x87_fldcw( struct x86_function *p, struct x86_reg arg ) -{ - assert(arg.file == file_REG32); - assert(arg.mod != mod_REG); - emit_1ub(p, 0xd9); - emit_modrm_noreg(p, 5, arg); -} - -void x87_fld1( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xe8); -} - -void x87_fldl2e( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xea); -} - -void x87_fldln2( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xed); -} - -void x87_fwait( struct x86_function *p ) -{ - emit_1ub(p, 0x9b); -} - -void x87_fnclex( struct x86_function *p ) -{ - emit_2ub(p, 0xdb, 0xe2); -} - -void x87_fclex( struct x86_function *p ) -{ - x87_fwait(p); - x87_fnclex(p); -} - - -static void x87_arith_op( struct x86_function *p, struct x86_reg dst, struct x86_reg arg, - unsigned char dst0ub0, - unsigned char dst0ub1, - unsigned char arg0ub0, - unsigned char arg0ub1, - unsigned char argmem_noreg) -{ - assert(dst.file == file_x87); - - if (arg.file == file_x87) { - if (dst.idx == 0) - emit_2ub(p, dst0ub0, dst0ub1+arg.idx); - else if (arg.idx == 0) - emit_2ub(p, arg0ub0, arg0ub1+arg.idx); - else - assert(0); - } - else if (dst.idx == 0) { - assert(arg.file == file_REG32); - emit_1ub(p, 0xd8); - emit_modrm_noreg(p, argmem_noreg, arg); - } - else - assert(0); -} - -void x87_fmul( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) -{ - x87_arith_op(p, dst, arg, - 0xd8, 0xc8, - 0xdc, 0xc8, - 4); -} - -void x87_fsub( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) -{ - x87_arith_op(p, dst, arg, - 0xd8, 0xe0, - 0xdc, 0xe8, - 4); -} - -void x87_fsubr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) -{ - x87_arith_op(p, dst, arg, - 0xd8, 0xe8, - 0xdc, 0xe0, - 5); -} - -void x87_fadd( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) -{ - x87_arith_op(p, dst, arg, - 0xd8, 0xc0, - 0xdc, 0xc0, - 0); -} - -void x87_fdiv( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) -{ - x87_arith_op(p, dst, arg, - 0xd8, 0xf0, - 0xdc, 0xf8, - 6); -} - -void x87_fdivr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) -{ - x87_arith_op(p, dst, arg, - 0xd8, 0xf8, - 0xdc, 0xf0, - 7); -} - -void x87_fmulp( struct x86_function *p, struct x86_reg dst ) -{ - assert(dst.file == file_x87); - assert(dst.idx >= 1); - emit_2ub(p, 0xde, 0xc8+dst.idx); -} - -void x87_fsubp( struct x86_function *p, struct x86_reg dst ) -{ - assert(dst.file == file_x87); - assert(dst.idx >= 1); - emit_2ub(p, 0xde, 0xe8+dst.idx); -} - -void x87_fsubrp( struct x86_function *p, struct x86_reg dst ) -{ - assert(dst.file == file_x87); - assert(dst.idx >= 1); - emit_2ub(p, 0xde, 0xe0+dst.idx); -} - -void x87_faddp( struct x86_function *p, struct x86_reg dst ) -{ - assert(dst.file == file_x87); - assert(dst.idx >= 1); - emit_2ub(p, 0xde, 0xc0+dst.idx); -} - -void x87_fdivp( struct x86_function *p, struct x86_reg dst ) -{ - assert(dst.file == file_x87); - assert(dst.idx >= 1); - emit_2ub(p, 0xde, 0xf8+dst.idx); -} - -void x87_fdivrp( struct x86_function *p, struct x86_reg dst ) -{ - assert(dst.file == file_x87); - assert(dst.idx >= 1); - emit_2ub(p, 0xde, 0xf0+dst.idx); -} - -void x87_fucom( struct x86_function *p, struct x86_reg arg ) -{ - assert(arg.file == file_x87); - emit_2ub(p, 0xdd, 0xe0+arg.idx); -} - -void x87_fucomp( struct x86_function *p, struct x86_reg arg ) -{ - assert(arg.file == file_x87); - emit_2ub(p, 0xdd, 0xe8+arg.idx); -} - -void x87_fucompp( struct x86_function *p ) -{ - emit_2ub(p, 0xda, 0xe9); -} - -void x87_fxch( struct x86_function *p, struct x86_reg arg ) -{ - assert(arg.file == file_x87); - emit_2ub(p, 0xd9, 0xc8+arg.idx); -} - -void x87_fabs( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xe1); -} - -void x87_fchs( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xe0); -} - -void x87_fcos( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xff); -} - - -void x87_fprndint( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xfc); -} - -void x87_fscale( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xfd); -} - -void x87_fsin( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xfe); -} - -void x87_fsincos( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xfb); -} - -void x87_fsqrt( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xfa); -} - -void x87_fxtract( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xf4); -} - -/* st0 = (2^st0)-1 - * - * Restrictions: -1.0 <= st0 <= 1.0 - */ -void x87_f2xm1( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xf0); -} - -/* st1 = st1 * log2(st0); - * pop_stack; - */ -void x87_fyl2x( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xf1); -} - -/* st1 = st1 * log2(st0 + 1.0); - * pop_stack; - * - * A fast operation, with restrictions: -.29 < st0 < .29 - */ -void x87_fyl2xp1( struct x86_function *p ) -{ - emit_2ub(p, 0xd9, 0xf9); -} - - -void x87_fld( struct x86_function *p, struct x86_reg arg ) -{ - if (arg.file == file_x87) - emit_2ub(p, 0xd9, 0xc0 + arg.idx); - else { - emit_1ub(p, 0xd9); - emit_modrm_noreg(p, 0, arg); - } -} - -void x87_fst( struct x86_function *p, struct x86_reg dst ) -{ - if (dst.file == file_x87) - emit_2ub(p, 0xdd, 0xd0 + dst.idx); - else { - emit_1ub(p, 0xd9); - emit_modrm_noreg(p, 2, dst); - } -} - -void x87_fstp( struct x86_function *p, struct x86_reg dst ) -{ - if (dst.file == file_x87) - emit_2ub(p, 0xdd, 0xd8 + dst.idx); - else { - emit_1ub(p, 0xd9); - emit_modrm_noreg(p, 3, dst); - } -} - -void x87_fcom( struct x86_function *p, struct x86_reg dst ) -{ - if (dst.file == file_x87) - emit_2ub(p, 0xd8, 0xd0 + dst.idx); - else { - emit_1ub(p, 0xd8); - emit_modrm_noreg(p, 2, dst); - } -} - -void x87_fcomp( struct x86_function *p, struct x86_reg dst ) -{ - if (dst.file == file_x87) - emit_2ub(p, 0xd8, 0xd8 + dst.idx); - else { - emit_1ub(p, 0xd8); - emit_modrm_noreg(p, 3, dst); - } -} - - -void x87_fnstsw( struct x86_function *p, struct x86_reg dst ) -{ - assert(dst.file == file_REG32); - - if (dst.idx == reg_AX && - dst.mod == mod_REG) - emit_2ub(p, 0xdf, 0xe0); - else { - emit_1ub(p, 0xdd); - emit_modrm_noreg(p, 7, dst); - } -} - - - - -/*********************************************************************** - * MMX instructions - */ - -void mmx_emms( struct x86_function *p ) -{ - assert(p->need_emms); - emit_2ub(p, 0x0f, 0x77); - p->need_emms = 0; -} - -void mmx_packssdw( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - assert(dst.file == file_MMX && - (src.file == file_MMX || src.mod != mod_REG)); - - p->need_emms = 1; - - emit_2ub(p, X86_TWOB, 0x6b); - emit_modrm( p, dst, src ); -} - -void mmx_packuswb( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - assert(dst.file == file_MMX && - (src.file == file_MMX || src.mod != mod_REG)); - - p->need_emms = 1; - - emit_2ub(p, X86_TWOB, 0x67); - emit_modrm( p, dst, src ); -} - -void mmx_movd( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - p->need_emms = 1; - emit_1ub(p, X86_TWOB); - emit_op_modrm( p, 0x6e, 0x7e, dst, src ); -} - -void mmx_movq( struct x86_function *p, - struct x86_reg dst, - struct x86_reg src ) -{ - p->need_emms = 1; - emit_1ub(p, X86_TWOB); - emit_op_modrm( p, 0x6f, 0x7f, dst, src ); -} - - -/*********************************************************************** - * Helper functions - */ - - -/* Retreive a reference to one of the function arguments, taking into - * account any push/pop activity: - */ -struct x86_reg x86_fn_arg( struct x86_function *p, - unsigned arg ) -{ - return x86_make_disp(x86_make_reg(file_REG32, reg_SP), - p->stack_offset + arg * 4); /* ??? */ -} - - -void x86_init_func( struct x86_function *p ) -{ - p->size = 0; - p->store = NULL; - p->csr = p->store; -} - -int x86_init_func_size( struct x86_function *p, unsigned code_size ) -{ - p->size = code_size; - p->store = _mesa_exec_malloc(code_size); - p->csr = p->store; - return p->store != NULL; -} - -void x86_release_func( struct x86_function *p ) -{ - _mesa_exec_free(p->store); - p->store = NULL; - p->csr = NULL; - p->size = 0; -} - - -void (*x86_get_func( struct x86_function *p ))(void) -{ - if (DISASSEM && p->store) - printf("disassemble %p %p\n", p->store, p->csr); - return (void (*)(void)) (unsigned long) p->store; -} - -#else - -void x86sse_dummy( void ) -{ -} - -#endif - -#else /* USE_X86_ASM */ - -int x86sse_c_dummy_var; /* silence warning */ - -#endif /* USE_X86_ASM */ +#ifdef USE_X86_ASM +#if defined(__i386__) || defined(__386__) + +#include "main/imports.h" +#include "x86sse.h" + +#define DISASSEM 0 +#define X86_TWOB 0x0f + +#if 0 +static unsigned char *cptr( void (*label)() ) +{ + return (unsigned char *)(unsigned long)label; +} +#endif + + +static void do_realloc( struct x86_function *p ) +{ + if (p->size == 0) { + p->size = 1024; + p->store = _mesa_exec_malloc(p->size); + p->csr = p->store; + } + else { + unsigned used = p->csr - p->store; + unsigned char *tmp = p->store; + p->size *= 2; + p->store = _mesa_exec_malloc(p->size); + memcpy(p->store, tmp, used); + p->csr = p->store + used; + _mesa_exec_free(tmp); + } +} + +/* Emit bytes to the instruction stream: + */ +static unsigned char *reserve( struct x86_function *p, int bytes ) +{ + if (p->csr + bytes - p->store > p->size) + do_realloc(p); + + { + unsigned char *csr = p->csr; + p->csr += bytes; + return csr; + } +} + + + +static void emit_1b( struct x86_function *p, char b0 ) +{ + char *csr = (char *)reserve(p, 1); + *csr = b0; +} + +static void emit_1i( struct x86_function *p, int i0 ) +{ + int *icsr = (int *)reserve(p, sizeof(i0)); + *icsr = i0; +} + +static void emit_1ub( struct x86_function *p, unsigned char b0 ) +{ + unsigned char *csr = reserve(p, 1); + *csr++ = b0; +} + +static void emit_2ub( struct x86_function *p, unsigned char b0, unsigned char b1 ) +{ + unsigned char *csr = reserve(p, 2); + *csr++ = b0; + *csr++ = b1; +} + +static void emit_3ub( struct x86_function *p, unsigned char b0, unsigned char b1, unsigned char b2 ) +{ + unsigned char *csr = reserve(p, 3); + *csr++ = b0; + *csr++ = b1; + *csr++ = b2; +} + + +/* Build a modRM byte + possible displacement. No treatment of SIB + * indexing. BZZT - no way to encode an absolute address. + */ +static void emit_modrm( struct x86_function *p, + struct x86_reg reg, + struct x86_reg regmem ) +{ + unsigned char val = 0; + + assert(reg.mod == mod_REG); + + val |= regmem.mod << 6; /* mod field */ + val |= reg.idx << 3; /* reg field */ + val |= regmem.idx; /* r/m field */ + + emit_1ub(p, val); + + /* Oh-oh we've stumbled into the SIB thing. + */ + if (regmem.file == file_REG32 && + regmem.idx == reg_SP) { + emit_1ub(p, 0x24); /* simplistic! */ + } + + switch (regmem.mod) { + case mod_REG: + case mod_INDIRECT: + break; + case mod_DISP8: + emit_1b(p, regmem.disp); + break; + case mod_DISP32: + emit_1i(p, regmem.disp); + break; + default: + assert(0); + break; + } +} + + +static void emit_modrm_noreg( struct x86_function *p, + unsigned op, + struct x86_reg regmem ) +{ + struct x86_reg dummy = x86_make_reg(file_REG32, op); + emit_modrm(p, dummy, regmem); +} + +/* Many x86 instructions have two opcodes to cope with the situations + * where the destination is a register or memory reference + * respectively. This function selects the correct opcode based on + * the arguments presented. + */ +static void emit_op_modrm( struct x86_function *p, + unsigned char op_dst_is_reg, + unsigned char op_dst_is_mem, + struct x86_reg dst, + struct x86_reg src ) +{ + switch (dst.mod) { + case mod_REG: + emit_1ub(p, op_dst_is_reg); + emit_modrm(p, dst, src); + break; + case mod_INDIRECT: + case mod_DISP32: + case mod_DISP8: + assert(src.mod == mod_REG); + emit_1ub(p, op_dst_is_mem); + emit_modrm(p, src, dst); + break; + default: + assert(0); + break; + } +} + + + + + + + +/* Create and manipulate registers and regmem values: + */ +struct x86_reg x86_make_reg( enum x86_reg_file file, + enum x86_reg_name idx ) +{ + struct x86_reg reg; + + reg.file = file; + reg.idx = idx; + reg.mod = mod_REG; + reg.disp = 0; + + return reg; +} + +struct x86_reg x86_make_disp( struct x86_reg reg, + int disp ) +{ + assert(reg.file == file_REG32); + + if (reg.mod == mod_REG) + reg.disp = disp; + else + reg.disp += disp; + + if (reg.disp == 0) + reg.mod = mod_INDIRECT; + else if (reg.disp <= 127 && reg.disp >= -128) + reg.mod = mod_DISP8; + else + reg.mod = mod_DISP32; + + return reg; +} + +struct x86_reg x86_deref( struct x86_reg reg ) +{ + return x86_make_disp(reg, 0); +} + +struct x86_reg x86_get_base_reg( struct x86_reg reg ) +{ + return x86_make_reg( reg.file, reg.idx ); +} + +unsigned char *x86_get_label( struct x86_function *p ) +{ + return p->csr; +} + + + +/*********************************************************************** + * x86 instructions + */ + + +void x86_jcc( struct x86_function *p, + enum x86_cc cc, + unsigned char *label ) +{ + int offset = label - (x86_get_label(p) + 2); + + if (offset <= 127 && offset >= -128) { + emit_1ub(p, 0x70 + cc); + emit_1b(p, (char) offset); + } + else { + offset = label - (x86_get_label(p) + 6); + emit_2ub(p, 0x0f, 0x80 + cc); + emit_1i(p, offset); + } +} + +/* Always use a 32bit offset for forward jumps: + */ +unsigned char *x86_jcc_forward( struct x86_function *p, + enum x86_cc cc ) +{ + emit_2ub(p, 0x0f, 0x80 + cc); + emit_1i(p, 0); + return x86_get_label(p); +} + +unsigned char *x86_jmp_forward( struct x86_function *p) +{ + emit_1ub(p, 0xe9); + emit_1i(p, 0); + return x86_get_label(p); +} + +unsigned char *x86_call_forward( struct x86_function *p) +{ + emit_1ub(p, 0xe8); + emit_1i(p, 0); + return x86_get_label(p); +} + +/* Fixup offset from forward jump: + */ +void x86_fixup_fwd_jump( struct x86_function *p, + unsigned char *fixup ) +{ + *(int *)(fixup - 4) = x86_get_label(p) - fixup; +} + +void x86_jmp( struct x86_function *p, unsigned char *label) +{ + emit_1ub(p, 0xe9); + emit_1i(p, label - x86_get_label(p) - 4); +} + +#if 0 +/* This doesn't work once we start reallocating & copying the + * generated code on buffer fills, because the call is relative to the + * current pc. + */ +void x86_call( struct x86_function *p, void (*label)()) +{ + emit_1ub(p, 0xe8); + emit_1i(p, cptr(label) - x86_get_label(p) - 4); +} +#else +void x86_call( struct x86_function *p, struct x86_reg reg) +{ + emit_1ub(p, 0xff); + emit_modrm_noreg(p, 2, reg); +} +#endif + + +/* michal: + * Temporary. As I need immediate operands, and dont want to mess with the codegen, + * I load the immediate into general purpose register and use it. + */ +void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm ) +{ + assert(dst.mod == mod_REG); + emit_1ub(p, 0xb8 + dst.idx); + emit_1i(p, imm); +} + +void x86_push( struct x86_function *p, + struct x86_reg reg ) +{ + assert(reg.mod == mod_REG); + emit_1ub(p, 0x50 + reg.idx); + p->stack_offset += 4; +} + +void x86_pop( struct x86_function *p, + struct x86_reg reg ) +{ + assert(reg.mod == mod_REG); + emit_1ub(p, 0x58 + reg.idx); + p->stack_offset -= 4; +} + +void x86_inc( struct x86_function *p, + struct x86_reg reg ) +{ + assert(reg.mod == mod_REG); + emit_1ub(p, 0x40 + reg.idx); +} + +void x86_dec( struct x86_function *p, + struct x86_reg reg ) +{ + assert(reg.mod == mod_REG); + emit_1ub(p, 0x48 + reg.idx); +} + +void x86_ret( struct x86_function *p ) +{ + emit_1ub(p, 0xc3); +} + +void x86_sahf( struct x86_function *p ) +{ + emit_1ub(p, 0x9e); +} + +void x86_mov( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_op_modrm( p, 0x8b, 0x89, dst, src ); +} + +void x86_xor( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_op_modrm( p, 0x33, 0x31, dst, src ); +} + +void x86_cmp( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_op_modrm( p, 0x3b, 0x39, dst, src ); +} + +void x86_lea( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_1ub(p, 0x8d); + emit_modrm( p, dst, src ); +} + +void x86_test( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_1ub(p, 0x85); + emit_modrm( p, dst, src ); +} + +void x86_add( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_op_modrm(p, 0x03, 0x01, dst, src ); +} + +void x86_mul( struct x86_function *p, + struct x86_reg src ) +{ + assert (src.file == file_REG32 && src.mod == mod_REG); + emit_op_modrm(p, 0xf7, 0, x86_make_reg (file_REG32, reg_SP), src ); +} + +void x86_sub( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_op_modrm(p, 0x2b, 0x29, dst, src ); +} + +void x86_or( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_op_modrm( p, 0x0b, 0x09, dst, src ); +} + +void x86_and( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_op_modrm( p, 0x23, 0x21, dst, src ); +} + + + +/*********************************************************************** + * SSE instructions + */ + + +void sse_movss( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, 0xF3, X86_TWOB); + emit_op_modrm( p, 0x10, 0x11, dst, src ); +} + +void sse_movaps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_1ub(p, X86_TWOB); + emit_op_modrm( p, 0x28, 0x29, dst, src ); +} + +void sse_movups( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_1ub(p, X86_TWOB); + emit_op_modrm( p, 0x10, 0x11, dst, src ); +} + +void sse_movhps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + assert(dst.mod != mod_REG || src.mod != mod_REG); + emit_1ub(p, X86_TWOB); + emit_op_modrm( p, 0x16, 0x17, dst, src ); /* cf movlhps */ +} + +void sse_movlps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + assert(dst.mod != mod_REG || src.mod != mod_REG); + emit_1ub(p, X86_TWOB); + emit_op_modrm( p, 0x12, 0x13, dst, src ); /* cf movhlps */ +} + +void sse_maxps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x5F); + emit_modrm( p, dst, src ); +} + +void sse_maxss( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0xF3, X86_TWOB, 0x5F); + emit_modrm( p, dst, src ); +} + +void sse_divss( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0xF3, X86_TWOB, 0x5E); + emit_modrm( p, dst, src ); +} + +void sse_minps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x5D); + emit_modrm( p, dst, src ); +} + +void sse_subps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x5C); + emit_modrm( p, dst, src ); +} + +void sse_mulps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x59); + emit_modrm( p, dst, src ); +} + +void sse_mulss( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0xF3, X86_TWOB, 0x59); + emit_modrm( p, dst, src ); +} + +void sse_addps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x58); + emit_modrm( p, dst, src ); +} + +void sse_addss( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0xF3, X86_TWOB, 0x58); + emit_modrm( p, dst, src ); +} + +void sse_andnps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x55); + emit_modrm( p, dst, src ); +} + +void sse_andps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x54); + emit_modrm( p, dst, src ); +} + +void sse_rsqrtps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x52); + emit_modrm( p, dst, src ); +} + +void sse_rsqrtss( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0xF3, X86_TWOB, 0x52); + emit_modrm( p, dst, src ); + +} + +void sse_movhlps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + assert(dst.mod == mod_REG && src.mod == mod_REG); + emit_2ub(p, X86_TWOB, 0x12); + emit_modrm( p, dst, src ); +} + +void sse_movlhps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + assert(dst.mod == mod_REG && src.mod == mod_REG); + emit_2ub(p, X86_TWOB, 0x16); + emit_modrm( p, dst, src ); +} + +void sse_orps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x56); + emit_modrm( p, dst, src ); +} + +void sse_xorps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x57); + emit_modrm( p, dst, src ); +} + +void sse_cvtps2pi( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + assert(dst.file == file_MMX && + (src.file == file_XMM || src.mod != mod_REG)); + + p->need_emms = 1; + + emit_2ub(p, X86_TWOB, 0x2d); + emit_modrm( p, dst, src ); +} + + +/* Shufps can also be used to implement a reduced swizzle when dest == + * arg0. + */ +void sse_shufps( struct x86_function *p, + struct x86_reg dest, + struct x86_reg arg0, + unsigned char shuf) +{ + emit_2ub(p, X86_TWOB, 0xC6); + emit_modrm(p, dest, arg0); + emit_1ub(p, shuf); +} + +void sse_cmpps( struct x86_function *p, + struct x86_reg dest, + struct x86_reg arg0, + unsigned char cc) +{ + emit_2ub(p, X86_TWOB, 0xC2); + emit_modrm(p, dest, arg0); + emit_1ub(p, cc); +} + +void sse_pmovmskb( struct x86_function *p, + struct x86_reg dest, + struct x86_reg src) +{ + emit_3ub(p, 0x66, X86_TWOB, 0xD7); + emit_modrm(p, dest, src); +} + +/*********************************************************************** + * SSE2 instructions + */ + +/** + * Perform a reduced swizzle: + */ +void sse2_pshufd( struct x86_function *p, + struct x86_reg dest, + struct x86_reg arg0, + unsigned char shuf) +{ + emit_3ub(p, 0x66, X86_TWOB, 0x70); + emit_modrm(p, dest, arg0); + emit_1ub(p, shuf); +} + +void sse2_cvttps2dq( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub( p, 0xF3, X86_TWOB, 0x5B ); + emit_modrm( p, dst, src ); +} + +void sse2_cvtps2dq( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0x66, X86_TWOB, 0x5B); + emit_modrm( p, dst, src ); +} + +void sse2_packssdw( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0x66, X86_TWOB, 0x6B); + emit_modrm( p, dst, src ); +} + +void sse2_packsswb( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0x66, X86_TWOB, 0x63); + emit_modrm( p, dst, src ); +} + +void sse2_packuswb( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0x66, X86_TWOB, 0x67); + emit_modrm( p, dst, src ); +} + +void sse2_rcpps( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, X86_TWOB, 0x53); + emit_modrm( p, dst, src ); +} + +void sse2_rcpss( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_3ub(p, 0xF3, X86_TWOB, 0x53); + emit_modrm( p, dst, src ); +} + +void sse2_movd( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + emit_2ub(p, 0x66, X86_TWOB); + emit_op_modrm( p, 0x6e, 0x7e, dst, src ); +} + + + + +/*********************************************************************** + * x87 instructions + */ +void x87_fist( struct x86_function *p, struct x86_reg dst ) +{ + emit_1ub(p, 0xdb); + emit_modrm_noreg(p, 2, dst); +} + +void x87_fistp( struct x86_function *p, struct x86_reg dst ) +{ + emit_1ub(p, 0xdb); + emit_modrm_noreg(p, 3, dst); +} + +void x87_fild( struct x86_function *p, struct x86_reg arg ) +{ + emit_1ub(p, 0xdf); + emit_modrm_noreg(p, 0, arg); +} + +void x87_fldz( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xee); +} + + +void x87_fldcw( struct x86_function *p, struct x86_reg arg ) +{ + assert(arg.file == file_REG32); + assert(arg.mod != mod_REG); + emit_1ub(p, 0xd9); + emit_modrm_noreg(p, 5, arg); +} + +void x87_fld1( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xe8); +} + +void x87_fldl2e( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xea); +} + +void x87_fldln2( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xed); +} + +void x87_fwait( struct x86_function *p ) +{ + emit_1ub(p, 0x9b); +} + +void x87_fnclex( struct x86_function *p ) +{ + emit_2ub(p, 0xdb, 0xe2); +} + +void x87_fclex( struct x86_function *p ) +{ + x87_fwait(p); + x87_fnclex(p); +} + + +static void x87_arith_op( struct x86_function *p, struct x86_reg dst, struct x86_reg arg, + unsigned char dst0ub0, + unsigned char dst0ub1, + unsigned char arg0ub0, + unsigned char arg0ub1, + unsigned char argmem_noreg) +{ + assert(dst.file == file_x87); + + if (arg.file == file_x87) { + if (dst.idx == 0) + emit_2ub(p, dst0ub0, dst0ub1+arg.idx); + else if (arg.idx == 0) + emit_2ub(p, arg0ub0, arg0ub1+arg.idx); + else + assert(0); + } + else if (dst.idx == 0) { + assert(arg.file == file_REG32); + emit_1ub(p, 0xd8); + emit_modrm_noreg(p, argmem_noreg, arg); + } + else + assert(0); +} + +void x87_fmul( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) +{ + x87_arith_op(p, dst, arg, + 0xd8, 0xc8, + 0xdc, 0xc8, + 4); +} + +void x87_fsub( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) +{ + x87_arith_op(p, dst, arg, + 0xd8, 0xe0, + 0xdc, 0xe8, + 4); +} + +void x87_fsubr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) +{ + x87_arith_op(p, dst, arg, + 0xd8, 0xe8, + 0xdc, 0xe0, + 5); +} + +void x87_fadd( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) +{ + x87_arith_op(p, dst, arg, + 0xd8, 0xc0, + 0xdc, 0xc0, + 0); +} + +void x87_fdiv( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) +{ + x87_arith_op(p, dst, arg, + 0xd8, 0xf0, + 0xdc, 0xf8, + 6); +} + +void x87_fdivr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ) +{ + x87_arith_op(p, dst, arg, + 0xd8, 0xf8, + 0xdc, 0xf0, + 7); +} + +void x87_fmulp( struct x86_function *p, struct x86_reg dst ) +{ + assert(dst.file == file_x87); + assert(dst.idx >= 1); + emit_2ub(p, 0xde, 0xc8+dst.idx); +} + +void x87_fsubp( struct x86_function *p, struct x86_reg dst ) +{ + assert(dst.file == file_x87); + assert(dst.idx >= 1); + emit_2ub(p, 0xde, 0xe8+dst.idx); +} + +void x87_fsubrp( struct x86_function *p, struct x86_reg dst ) +{ + assert(dst.file == file_x87); + assert(dst.idx >= 1); + emit_2ub(p, 0xde, 0xe0+dst.idx); +} + +void x87_faddp( struct x86_function *p, struct x86_reg dst ) +{ + assert(dst.file == file_x87); + assert(dst.idx >= 1); + emit_2ub(p, 0xde, 0xc0+dst.idx); +} + +void x87_fdivp( struct x86_function *p, struct x86_reg dst ) +{ + assert(dst.file == file_x87); + assert(dst.idx >= 1); + emit_2ub(p, 0xde, 0xf8+dst.idx); +} + +void x87_fdivrp( struct x86_function *p, struct x86_reg dst ) +{ + assert(dst.file == file_x87); + assert(dst.idx >= 1); + emit_2ub(p, 0xde, 0xf0+dst.idx); +} + +void x87_fucom( struct x86_function *p, struct x86_reg arg ) +{ + assert(arg.file == file_x87); + emit_2ub(p, 0xdd, 0xe0+arg.idx); +} + +void x87_fucomp( struct x86_function *p, struct x86_reg arg ) +{ + assert(arg.file == file_x87); + emit_2ub(p, 0xdd, 0xe8+arg.idx); +} + +void x87_fucompp( struct x86_function *p ) +{ + emit_2ub(p, 0xda, 0xe9); +} + +void x87_fxch( struct x86_function *p, struct x86_reg arg ) +{ + assert(arg.file == file_x87); + emit_2ub(p, 0xd9, 0xc8+arg.idx); +} + +void x87_fabs( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xe1); +} + +void x87_fchs( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xe0); +} + +void x87_fcos( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xff); +} + + +void x87_fprndint( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xfc); +} + +void x87_fscale( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xfd); +} + +void x87_fsin( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xfe); +} + +void x87_fsincos( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xfb); +} + +void x87_fsqrt( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xfa); +} + +void x87_fxtract( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xf4); +} + +/* st0 = (2^st0)-1 + * + * Restrictions: -1.0 <= st0 <= 1.0 + */ +void x87_f2xm1( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xf0); +} + +/* st1 = st1 * log2(st0); + * pop_stack; + */ +void x87_fyl2x( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xf1); +} + +/* st1 = st1 * log2(st0 + 1.0); + * pop_stack; + * + * A fast operation, with restrictions: -.29 < st0 < .29 + */ +void x87_fyl2xp1( struct x86_function *p ) +{ + emit_2ub(p, 0xd9, 0xf9); +} + + +void x87_fld( struct x86_function *p, struct x86_reg arg ) +{ + if (arg.file == file_x87) + emit_2ub(p, 0xd9, 0xc0 + arg.idx); + else { + emit_1ub(p, 0xd9); + emit_modrm_noreg(p, 0, arg); + } +} + +void x87_fst( struct x86_function *p, struct x86_reg dst ) +{ + if (dst.file == file_x87) + emit_2ub(p, 0xdd, 0xd0 + dst.idx); + else { + emit_1ub(p, 0xd9); + emit_modrm_noreg(p, 2, dst); + } +} + +void x87_fstp( struct x86_function *p, struct x86_reg dst ) +{ + if (dst.file == file_x87) + emit_2ub(p, 0xdd, 0xd8 + dst.idx); + else { + emit_1ub(p, 0xd9); + emit_modrm_noreg(p, 3, dst); + } +} + +void x87_fcom( struct x86_function *p, struct x86_reg dst ) +{ + if (dst.file == file_x87) + emit_2ub(p, 0xd8, 0xd0 + dst.idx); + else { + emit_1ub(p, 0xd8); + emit_modrm_noreg(p, 2, dst); + } +} + +void x87_fcomp( struct x86_function *p, struct x86_reg dst ) +{ + if (dst.file == file_x87) + emit_2ub(p, 0xd8, 0xd8 + dst.idx); + else { + emit_1ub(p, 0xd8); + emit_modrm_noreg(p, 3, dst); + } +} + + +void x87_fnstsw( struct x86_function *p, struct x86_reg dst ) +{ + assert(dst.file == file_REG32); + + if (dst.idx == reg_AX && + dst.mod == mod_REG) + emit_2ub(p, 0xdf, 0xe0); + else { + emit_1ub(p, 0xdd); + emit_modrm_noreg(p, 7, dst); + } +} + + + + +/*********************************************************************** + * MMX instructions + */ + +void mmx_emms( struct x86_function *p ) +{ + assert(p->need_emms); + emit_2ub(p, 0x0f, 0x77); + p->need_emms = 0; +} + +void mmx_packssdw( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + assert(dst.file == file_MMX && + (src.file == file_MMX || src.mod != mod_REG)); + + p->need_emms = 1; + + emit_2ub(p, X86_TWOB, 0x6b); + emit_modrm( p, dst, src ); +} + +void mmx_packuswb( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + assert(dst.file == file_MMX && + (src.file == file_MMX || src.mod != mod_REG)); + + p->need_emms = 1; + + emit_2ub(p, X86_TWOB, 0x67); + emit_modrm( p, dst, src ); +} + +void mmx_movd( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + p->need_emms = 1; + emit_1ub(p, X86_TWOB); + emit_op_modrm( p, 0x6e, 0x7e, dst, src ); +} + +void mmx_movq( struct x86_function *p, + struct x86_reg dst, + struct x86_reg src ) +{ + p->need_emms = 1; + emit_1ub(p, X86_TWOB); + emit_op_modrm( p, 0x6f, 0x7f, dst, src ); +} + + +/*********************************************************************** + * Helper functions + */ + + +/* Retreive a reference to one of the function arguments, taking into + * account any push/pop activity: + */ +struct x86_reg x86_fn_arg( struct x86_function *p, + unsigned arg ) +{ + return x86_make_disp(x86_make_reg(file_REG32, reg_SP), + p->stack_offset + arg * 4); /* ??? */ +} + + +void x86_init_func( struct x86_function *p ) +{ + p->size = 0; + p->store = NULL; + p->csr = p->store; +} + +int x86_init_func_size( struct x86_function *p, unsigned code_size ) +{ + p->size = code_size; + p->store = _mesa_exec_malloc(code_size); + p->csr = p->store; + return p->store != NULL; +} + +void x86_release_func( struct x86_function *p ) +{ + _mesa_exec_free(p->store); + p->store = NULL; + p->csr = NULL; + p->size = 0; +} + + +void (*x86_get_func( struct x86_function *p ))(void) +{ + if (DISASSEM && p->store) + printf("disassemble %p %p\n", p->store, p->csr); + return (void (*)(void)) (unsigned long) p->store; +} + +#else + +void x86sse_dummy( void ) +{ +} + +#endif + +#else /* USE_X86_ASM */ + +int x86sse_c_dummy_var; /* silence warning */ + +#endif /* USE_X86_ASM */ diff --git a/mesalib/src/mesa/x86/rtasm/x86sse.h b/mesalib/src/mesa/x86/rtasm/x86sse.h index 399a694bc..f6282f5bd 100644 --- a/mesalib/src/mesa/x86/rtasm/x86sse.h +++ b/mesalib/src/mesa/x86/rtasm/x86sse.h @@ -1,256 +1,256 @@ - -#ifndef _X86SSE_H_ -#define _X86SSE_H_ - -#if defined(__i386__) || defined(__386__) - -/* It is up to the caller to ensure that instructions issued are - * suitable for the host cpu. There are no checks made in this module - * for mmx/sse/sse2 support on the cpu. - */ -struct x86_reg { - unsigned file:3; - unsigned idx:3; - unsigned mod:2; /* mod_REG if this is just a register */ - int disp:24; /* only +/- 23bits of offset - should be enough... */ -}; - -struct x86_function { - unsigned size; - unsigned char *store; - unsigned char *csr; - unsigned stack_offset; - int need_emms; - const char *fn; -}; - -enum x86_reg_file { - file_REG32, - file_MMX, - file_XMM, - file_x87 -}; - -/* Values for mod field of modr/m byte - */ -enum x86_reg_mod { - mod_INDIRECT, - mod_DISP8, - mod_DISP32, - mod_REG -}; - -enum x86_reg_name { - reg_AX, - reg_CX, - reg_DX, - reg_BX, - reg_SP, - reg_BP, - reg_SI, - reg_DI -}; - - -enum x86_cc { - cc_O, /* overflow */ - cc_NO, /* not overflow */ - cc_NAE, /* not above or equal / carry */ - cc_AE, /* above or equal / not carry */ - cc_E, /* equal / zero */ - cc_NE /* not equal / not zero */ -}; - -enum sse_cc { - cc_Equal, - cc_LessThan, - cc_LessThanEqual, - cc_Unordered, - cc_NotEqual, - cc_NotLessThan, - cc_NotLessThanEqual, - cc_Ordered -}; - -#define cc_Z cc_E -#define cc_NZ cc_NE - -/* Begin/end/retreive function creation: - */ - - -void x86_init_func( struct x86_function *p ); -int x86_init_func_size( struct x86_function *p, unsigned code_size ); -void x86_release_func( struct x86_function *p ); -void (*x86_get_func( struct x86_function *p ))( void ); - - - -/* Create and manipulate registers and regmem values: - */ -struct x86_reg x86_make_reg( enum x86_reg_file file, - enum x86_reg_name idx ); - -struct x86_reg x86_make_disp( struct x86_reg reg, - int disp ); - -struct x86_reg x86_deref( struct x86_reg reg ); - -struct x86_reg x86_get_base_reg( struct x86_reg reg ); - - -/* Labels, jumps and fixup: - */ -unsigned char *x86_get_label( struct x86_function *p ); - -void x86_jcc( struct x86_function *p, - enum x86_cc cc, - unsigned char *label ); - -unsigned char *x86_jcc_forward( struct x86_function *p, - enum x86_cc cc ); - -unsigned char *x86_jmp_forward( struct x86_function *p); - -unsigned char *x86_call_forward( struct x86_function *p); - -void x86_fixup_fwd_jump( struct x86_function *p, - unsigned char *fixup ); - -void x86_jmp( struct x86_function *p, unsigned char *label ); - -/* void x86_call( struct x86_function *p, void (*label)() ); */ -void x86_call( struct x86_function *p, struct x86_reg reg); - -/* michal: - * Temporary. As I need immediate operands, and dont want to mess with the codegen, - * I load the immediate into general purpose register and use it. - */ -void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm ); - - -/* Macro for sse_shufps() and sse2_pshufd(): - */ -#define SHUF(_x,_y,_z,_w) (((_x)<<0) | ((_y)<<2) | ((_z)<<4) | ((_w)<<6)) -#define SHUF_NOOP RSW(0,1,2,3) -#define GET_SHUF(swz, idx) (((swz) >> ((idx)*2)) & 0x3) - -void mmx_emms( struct x86_function *p ); -void mmx_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void mmx_movq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void mmx_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void mmx_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); - -void sse2_cvtps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse2_cvttps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse2_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse2_packsswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse2_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, - unsigned char shuf ); -void sse2_rcpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse2_rcpss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); - -void sse_addps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_addss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_cvtps2pi( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_divss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_andnps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_andps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_cmpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src, - unsigned char cc ); -void sse_maxps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_maxss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_minps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_movaps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_movhlps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_movhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_movlhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_movlps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_movss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_movups( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_mulps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_mulss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_orps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_xorps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_subps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_rsqrtps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_rsqrtss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, - unsigned char shuf ); -void sse_pmovmskb( struct x86_function *p, struct x86_reg dest, struct x86_reg src ); - -void x86_add( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void x86_and( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void x86_cmp( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void x86_dec( struct x86_function *p, struct x86_reg reg ); -void x86_inc( struct x86_function *p, struct x86_reg reg ); -void x86_lea( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void x86_mov( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void x86_mul( struct x86_function *p, struct x86_reg src ); -void x86_or( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void x86_pop( struct x86_function *p, struct x86_reg reg ); -void x86_push( struct x86_function *p, struct x86_reg reg ); -void x86_ret( struct x86_function *p ); -void x86_sub( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void x86_test( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void x86_xor( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void x86_sahf( struct x86_function *p ); - -void x87_f2xm1( struct x86_function *p ); -void x87_fabs( struct x86_function *p ); -void x87_fadd( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); -void x87_faddp( struct x86_function *p, struct x86_reg dst ); -void x87_fchs( struct x86_function *p ); -void x87_fclex( struct x86_function *p ); -void x87_fcom( struct x86_function *p, struct x86_reg dst ); -void x87_fcomp( struct x86_function *p, struct x86_reg dst ); -void x87_fcos( struct x86_function *p ); -void x87_fdiv( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); -void x87_fdivp( struct x86_function *p, struct x86_reg dst ); -void x87_fdivr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); -void x87_fdivrp( struct x86_function *p, struct x86_reg dst ); -void x87_fild( struct x86_function *p, struct x86_reg arg ); -void x87_fist( struct x86_function *p, struct x86_reg dst ); -void x87_fistp( struct x86_function *p, struct x86_reg dst ); -void x87_fld( struct x86_function *p, struct x86_reg arg ); -void x87_fld1( struct x86_function *p ); -void x87_fldcw( struct x86_function *p, struct x86_reg arg ); -void x87_fldl2e( struct x86_function *p ); -void x87_fldln2( struct x86_function *p ); -void x87_fldz( struct x86_function *p ); -void x87_fmul( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); -void x87_fmulp( struct x86_function *p, struct x86_reg dst ); -void x87_fnclex( struct x86_function *p ); -void x87_fprndint( struct x86_function *p ); -void x87_fscale( struct x86_function *p ); -void x87_fsin( struct x86_function *p ); -void x87_fsincos( struct x86_function *p ); -void x87_fsqrt( struct x86_function *p ); -void x87_fst( struct x86_function *p, struct x86_reg dst ); -void x87_fstp( struct x86_function *p, struct x86_reg dst ); -void x87_fsub( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); -void x87_fsubp( struct x86_function *p, struct x86_reg dst ); -void x87_fsubr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); -void x87_fsubrp( struct x86_function *p, struct x86_reg dst ); -void x87_fxch( struct x86_function *p, struct x86_reg dst ); -void x87_fxtract( struct x86_function *p ); -void x87_fyl2x( struct x86_function *p ); -void x87_fyl2xp1( struct x86_function *p ); -void x87_fwait( struct x86_function *p ); -void x87_fnstsw( struct x86_function *p, struct x86_reg dst ); -void x87_fucompp( struct x86_function *p ); -void x87_fucomp( struct x86_function *p, struct x86_reg arg ); -void x87_fucom( struct x86_function *p, struct x86_reg arg ); - - - -/* Retreive a reference to one of the function arguments, taking into - * account any push/pop activity. Note - doesn't track explict - * manipulation of ESP by other instructions. - */ -struct x86_reg x86_fn_arg( struct x86_function *p, unsigned arg ); - -#endif -#endif + +#ifndef _X86SSE_H_ +#define _X86SSE_H_ + +#if defined(__i386__) || defined(__386__) + +/* It is up to the caller to ensure that instructions issued are + * suitable for the host cpu. There are no checks made in this module + * for mmx/sse/sse2 support on the cpu. + */ +struct x86_reg { + unsigned file:3; + unsigned idx:3; + unsigned mod:2; /* mod_REG if this is just a register */ + int disp:24; /* only +/- 23bits of offset - should be enough... */ +}; + +struct x86_function { + unsigned size; + unsigned char *store; + unsigned char *csr; + unsigned stack_offset; + int need_emms; + const char *fn; +}; + +enum x86_reg_file { + file_REG32, + file_MMX, + file_XMM, + file_x87 +}; + +/* Values for mod field of modr/m byte + */ +enum x86_reg_mod { + mod_INDIRECT, + mod_DISP8, + mod_DISP32, + mod_REG +}; + +enum x86_reg_name { + reg_AX, + reg_CX, + reg_DX, + reg_BX, + reg_SP, + reg_BP, + reg_SI, + reg_DI +}; + + +enum x86_cc { + cc_O, /* overflow */ + cc_NO, /* not overflow */ + cc_NAE, /* not above or equal / carry */ + cc_AE, /* above or equal / not carry */ + cc_E, /* equal / zero */ + cc_NE /* not equal / not zero */ +}; + +enum sse_cc { + cc_Equal, + cc_LessThan, + cc_LessThanEqual, + cc_Unordered, + cc_NotEqual, + cc_NotLessThan, + cc_NotLessThanEqual, + cc_Ordered +}; + +#define cc_Z cc_E +#define cc_NZ cc_NE + +/* Begin/end/retreive function creation: + */ + + +void x86_init_func( struct x86_function *p ); +int x86_init_func_size( struct x86_function *p, unsigned code_size ); +void x86_release_func( struct x86_function *p ); +void (*x86_get_func( struct x86_function *p ))( void ); + + + +/* Create and manipulate registers and regmem values: + */ +struct x86_reg x86_make_reg( enum x86_reg_file file, + enum x86_reg_name idx ); + +struct x86_reg x86_make_disp( struct x86_reg reg, + int disp ); + +struct x86_reg x86_deref( struct x86_reg reg ); + +struct x86_reg x86_get_base_reg( struct x86_reg reg ); + + +/* Labels, jumps and fixup: + */ +unsigned char *x86_get_label( struct x86_function *p ); + +void x86_jcc( struct x86_function *p, + enum x86_cc cc, + unsigned char *label ); + +unsigned char *x86_jcc_forward( struct x86_function *p, + enum x86_cc cc ); + +unsigned char *x86_jmp_forward( struct x86_function *p); + +unsigned char *x86_call_forward( struct x86_function *p); + +void x86_fixup_fwd_jump( struct x86_function *p, + unsigned char *fixup ); + +void x86_jmp( struct x86_function *p, unsigned char *label ); + +/* void x86_call( struct x86_function *p, void (*label)() ); */ +void x86_call( struct x86_function *p, struct x86_reg reg); + +/* michal: + * Temporary. As I need immediate operands, and dont want to mess with the codegen, + * I load the immediate into general purpose register and use it. + */ +void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm ); + + +/* Macro for sse_shufps() and sse2_pshufd(): + */ +#define SHUF(_x,_y,_z,_w) (((_x)<<0) | ((_y)<<2) | ((_z)<<4) | ((_w)<<6)) +#define SHUF_NOOP RSW(0,1,2,3) +#define GET_SHUF(swz, idx) (((swz) >> ((idx)*2)) & 0x3) + +void mmx_emms( struct x86_function *p ); +void mmx_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void mmx_movq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void mmx_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void mmx_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); + +void sse2_cvtps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_cvttps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_packsswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, + unsigned char shuf ); +void sse2_rcpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse2_rcpss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); + +void sse_addps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_addss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_cvtps2pi( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_divss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_andnps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_andps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_cmpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src, + unsigned char cc ); +void sse_maxps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_maxss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_minps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_movaps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_movhlps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_movhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_movlhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_movlps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_movss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_movups( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_mulps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_mulss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_orps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_xorps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_subps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_rsqrtps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_rsqrtss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, + unsigned char shuf ); +void sse_pmovmskb( struct x86_function *p, struct x86_reg dest, struct x86_reg src ); + +void x86_add( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_and( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_cmp( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_dec( struct x86_function *p, struct x86_reg reg ); +void x86_inc( struct x86_function *p, struct x86_reg reg ); +void x86_lea( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_mov( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_mul( struct x86_function *p, struct x86_reg src ); +void x86_or( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_pop( struct x86_function *p, struct x86_reg reg ); +void x86_push( struct x86_function *p, struct x86_reg reg ); +void x86_ret( struct x86_function *p ); +void x86_sub( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_test( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_xor( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); +void x86_sahf( struct x86_function *p ); + +void x87_f2xm1( struct x86_function *p ); +void x87_fabs( struct x86_function *p ); +void x87_fadd( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); +void x87_faddp( struct x86_function *p, struct x86_reg dst ); +void x87_fchs( struct x86_function *p ); +void x87_fclex( struct x86_function *p ); +void x87_fcom( struct x86_function *p, struct x86_reg dst ); +void x87_fcomp( struct x86_function *p, struct x86_reg dst ); +void x87_fcos( struct x86_function *p ); +void x87_fdiv( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); +void x87_fdivp( struct x86_function *p, struct x86_reg dst ); +void x87_fdivr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); +void x87_fdivrp( struct x86_function *p, struct x86_reg dst ); +void x87_fild( struct x86_function *p, struct x86_reg arg ); +void x87_fist( struct x86_function *p, struct x86_reg dst ); +void x87_fistp( struct x86_function *p, struct x86_reg dst ); +void x87_fld( struct x86_function *p, struct x86_reg arg ); +void x87_fld1( struct x86_function *p ); +void x87_fldcw( struct x86_function *p, struct x86_reg arg ); +void x87_fldl2e( struct x86_function *p ); +void x87_fldln2( struct x86_function *p ); +void x87_fldz( struct x86_function *p ); +void x87_fmul( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); +void x87_fmulp( struct x86_function *p, struct x86_reg dst ); +void x87_fnclex( struct x86_function *p ); +void x87_fprndint( struct x86_function *p ); +void x87_fscale( struct x86_function *p ); +void x87_fsin( struct x86_function *p ); +void x87_fsincos( struct x86_function *p ); +void x87_fsqrt( struct x86_function *p ); +void x87_fst( struct x86_function *p, struct x86_reg dst ); +void x87_fstp( struct x86_function *p, struct x86_reg dst ); +void x87_fsub( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); +void x87_fsubp( struct x86_function *p, struct x86_reg dst ); +void x87_fsubr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); +void x87_fsubrp( struct x86_function *p, struct x86_reg dst ); +void x87_fxch( struct x86_function *p, struct x86_reg dst ); +void x87_fxtract( struct x86_function *p ); +void x87_fyl2x( struct x86_function *p ); +void x87_fyl2xp1( struct x86_function *p ); +void x87_fwait( struct x86_function *p ); +void x87_fnstsw( struct x86_function *p, struct x86_reg dst ); +void x87_fucompp( struct x86_function *p ); +void x87_fucomp( struct x86_function *p, struct x86_reg arg ); +void x87_fucom( struct x86_function *p, struct x86_reg arg ); + + + +/* Retreive a reference to one of the function arguments, taking into + * account any push/pop activity. Note - doesn't track explict + * manipulation of ESP by other instructions. + */ +struct x86_reg x86_fn_arg( struct x86_function *p, unsigned arg ); + +#endif +#endif diff --git a/mesalib/src/mesa/x86/sse.c b/mesalib/src/mesa/x86/sse.c index b249811c7..aef15b531 100644 --- a/mesalib/src/mesa/x86/sse.c +++ b/mesalib/src/mesa/x86/sse.c @@ -1,123 +1,123 @@ -/* - * Mesa 3-D graphics library - * Version: 6.0 - * - * 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. - */ - -/* - * PentiumIII-SIMD (SSE) optimizations contributed by - * Andre Werthmann - */ - -#include "main/glheader.h" -#include "main/context.h" -#include "math/m_xform.h" -#include "tnl/t_context.h" - -#include "sse.h" -#include "x86_xform.h" - -#ifdef DEBUG_MATH -#include "math/m_debug.h" -#endif - - -#ifdef USE_SSE_ASM -DECLARE_XFORM_GROUP( sse, 2 ) -DECLARE_XFORM_GROUP( sse, 3 ) - -#if 1 -/* Some functions are not written in SSE-assembly, because the fpu ones are faster */ -extern void _ASMAPI _mesa_sse_transform_normals_no_rot( NORM_ARGS ); -extern void _ASMAPI _mesa_sse_transform_rescale_normals( NORM_ARGS ); -extern void _ASMAPI _mesa_sse_transform_rescale_normals_no_rot( NORM_ARGS ); - -extern void _ASMAPI _mesa_sse_transform_points4_general( XFORM_ARGS ); -extern void _ASMAPI _mesa_sse_transform_points4_3d( XFORM_ARGS ); -/* XXX this function segfaults, see below */ -extern void _ASMAPI _mesa_sse_transform_points4_identity( XFORM_ARGS ); -/* XXX this one works, see below */ -extern void _ASMAPI _mesa_x86_transform_points4_identity( XFORM_ARGS ); -#else -DECLARE_NORM_GROUP( sse ) -#endif - - -extern void _ASMAPI -_mesa_v16_sse_general_xform( GLfloat *first_vert, - const GLfloat *m, - const GLfloat *src, - GLuint src_stride, - GLuint count ); - -extern void _ASMAPI -_mesa_sse_project_vertices( GLfloat *first, - GLfloat *last, - const GLfloat *m, - GLuint stride ); - -extern void _ASMAPI -_mesa_sse_project_clipped_vertices( GLfloat *first, - GLfloat *last, - const GLfloat *m, - GLuint stride, - const GLubyte *clipmask ); -#endif - - -void _mesa_init_sse_transform_asm( void ) -{ -#ifdef USE_SSE_ASM - ASSIGN_XFORM_GROUP( sse, 2 ); - ASSIGN_XFORM_GROUP( sse, 3 ); - -#if 1 - /* TODO: Finish these off. - */ - _mesa_transform_tab[4][MATRIX_GENERAL] = - _mesa_sse_transform_points4_general; - _mesa_transform_tab[4][MATRIX_3D] = - _mesa_sse_transform_points4_3d; - /* XXX NOTE: _mesa_sse_transform_points4_identity segfaults with the - conformance tests, so use the x86 version. - */ - _mesa_transform_tab[4][MATRIX_IDENTITY] = - _mesa_x86_transform_points4_identity;/*_mesa_sse_transform_points4_identity;*/ - - _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = - _mesa_sse_transform_normals_no_rot; - _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = - _mesa_sse_transform_rescale_normals; - _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = - _mesa_sse_transform_rescale_normals_no_rot; -#else - ASSIGN_XFORM_GROUP( sse, 4 ); - - ASSIGN_NORM_GROUP( sse ); -#endif - -#ifdef DEBUG_MATH - _math_test_all_transform_functions( "SSE" ); - _math_test_all_normal_transform_functions( "SSE" ); -#endif -#endif -} - +/* + * Mesa 3-D graphics library + * Version: 6.0 + * + * 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. + */ + +/* + * PentiumIII-SIMD (SSE) optimizations contributed by + * Andre Werthmann + */ + +#include "main/glheader.h" +#include "main/context.h" +#include "math/m_xform.h" +#include "tnl/t_context.h" + +#include "sse.h" +#include "x86_xform.h" + +#ifdef DEBUG_MATH +#include "math/m_debug.h" +#endif + + +#ifdef USE_SSE_ASM +DECLARE_XFORM_GROUP( sse, 2 ) +DECLARE_XFORM_GROUP( sse, 3 ) + +#if 1 +/* Some functions are not written in SSE-assembly, because the fpu ones are faster */ +extern void _ASMAPI _mesa_sse_transform_normals_no_rot( NORM_ARGS ); +extern void _ASMAPI _mesa_sse_transform_rescale_normals( NORM_ARGS ); +extern void _ASMAPI _mesa_sse_transform_rescale_normals_no_rot( NORM_ARGS ); + +extern void _ASMAPI _mesa_sse_transform_points4_general( XFORM_ARGS ); +extern void _ASMAPI _mesa_sse_transform_points4_3d( XFORM_ARGS ); +/* XXX this function segfaults, see below */ +extern void _ASMAPI _mesa_sse_transform_points4_identity( XFORM_ARGS ); +/* XXX this one works, see below */ +extern void _ASMAPI _mesa_x86_transform_points4_identity( XFORM_ARGS ); +#else +DECLARE_NORM_GROUP( sse ) +#endif + + +extern void _ASMAPI +_mesa_v16_sse_general_xform( GLfloat *first_vert, + const GLfloat *m, + const GLfloat *src, + GLuint src_stride, + GLuint count ); + +extern void _ASMAPI +_mesa_sse_project_vertices( GLfloat *first, + GLfloat *last, + const GLfloat *m, + GLuint stride ); + +extern void _ASMAPI +_mesa_sse_project_clipped_vertices( GLfloat *first, + GLfloat *last, + const GLfloat *m, + GLuint stride, + const GLubyte *clipmask ); +#endif + + +void _mesa_init_sse_transform_asm( void ) +{ +#ifdef USE_SSE_ASM + ASSIGN_XFORM_GROUP( sse, 2 ); + ASSIGN_XFORM_GROUP( sse, 3 ); + +#if 1 + /* TODO: Finish these off. + */ + _mesa_transform_tab[4][MATRIX_GENERAL] = + _mesa_sse_transform_points4_general; + _mesa_transform_tab[4][MATRIX_3D] = + _mesa_sse_transform_points4_3d; + /* XXX NOTE: _mesa_sse_transform_points4_identity segfaults with the + conformance tests, so use the x86 version. + */ + _mesa_transform_tab[4][MATRIX_IDENTITY] = + _mesa_x86_transform_points4_identity;/*_mesa_sse_transform_points4_identity;*/ + + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = + _mesa_sse_transform_normals_no_rot; + _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = + _mesa_sse_transform_rescale_normals; + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = + _mesa_sse_transform_rescale_normals_no_rot; +#else + ASSIGN_XFORM_GROUP( sse, 4 ); + + ASSIGN_NORM_GROUP( sse ); +#endif + +#ifdef DEBUG_MATH + _math_test_all_transform_functions( "SSE" ); + _math_test_all_normal_transform_functions( "SSE" ); +#endif +#endif +} + diff --git a/mesalib/src/mesa/x86/sse.h b/mesalib/src/mesa/x86/sse.h index d240bf38b..e92ddc139 100644 --- a/mesalib/src/mesa/x86/sse.h +++ b/mesalib/src/mesa/x86/sse.h @@ -1,36 +1,36 @@ - -/* - * 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. - */ - -/* - * PentiumIII-SIMD (SSE) optimizations contributed by - * Andre Werthmann - */ - -#ifndef __SSE_H__ -#define __SSE_H__ - -void _mesa_init_sse_transform_asm( void ); - -#endif + +/* + * 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. + */ + +/* + * PentiumIII-SIMD (SSE) optimizations contributed by + * Andre Werthmann + */ + +#ifndef __SSE_H__ +#define __SSE_H__ + +void _mesa_init_sse_transform_asm( void ); + +#endif diff --git a/mesalib/src/mesa/x86/sse_normal.S b/mesalib/src/mesa/x86/sse_normal.S index b6d5ef965..a8c0d38c7 100644 --- a/mesalib/src/mesa/x86/sse_normal.S +++ b/mesalib/src/mesa/x86/sse_normal.S @@ -1,261 +1,261 @@ - -/* - * 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. - */ - -/** TODO: - * - insert PREFETCH instructions to avoid cache-misses ! - * - some more optimizations are possible... - * - for 40-50% more performance in the SSE-functions, the - * data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! - */ - -#ifdef USE_SSE_ASM -#include "assyntax.h" -#include "matypes.h" -#include "norm_args.h" - - SEG_TEXT - -#define M(i) REGOFF(i * 4, EDX) -#define S(i) REGOFF(i * 4, ESI) -#define D(i) REGOFF(i * 4, EDI) -#define STRIDE REGOFF(12, ESI) - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_sse_transform_rescale_normals_no_rot) -HIDDEN(_mesa_sse_transform_rescale_normals_no_rot) -GLNAME(_mesa_sse_transform_rescale_normals_no_rot): - -#define FRAME_OFFSET 8 - PUSH_L ( ESI ) - PUSH_L ( EDI ) - - MOV_L ( ARG_IN, ESI ) /* ptr to source GLvector3f */ - MOV_L ( ARG_DEST, EDI ) /* ptr to dest GLvector3f */ - - MOV_L ( ARG_MAT, EDX ) /* ptr to matrix */ - MOV_L ( REGOFF(MATRIX_INV, EDX), EDX) /* matrix->inv */ - - MOV_L ( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L ( ECX, ECX ) - JZ( LLBL(K_G3TRNNRR_finish) ) /* count was zero; go to finish */ - - MOV_L ( STRIDE, EAX ) /* stride */ - MOV_L ( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest-count */ - - IMUL_L( CONST(16), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - -ALIGNTEXT32 - MOVSS ( M(0), XMM1 ) /* m0 */ - MOVSS ( M(5), XMM2 ) /* m5 */ - UNPCKLPS( XMM2, XMM1 ) /* m5 | m0 */ - MOVSS ( ARG_SCALE, XMM0 ) /* scale */ - SHUFPS ( CONST(0x0), XMM0, XMM0 ) /* scale | scale */ - MULPS ( XMM0, XMM1 ) /* m5*scale | m0*scale */ - MULSS ( M(10), XMM0 ) /* m10*scale */ - -ALIGNTEXT32 -LLBL(K_G3TRNNRR_top): - MOVLPS ( S(0), XMM2 ) /* uy | ux */ - MULPS ( XMM1, XMM2 ) /* uy*m5*scale | ux*m0*scale */ - MOVLPS ( XMM2, D(0) ) /* ->D(1) | D(0) */ - - MOVSS ( S(2), XMM2 ) /* uz */ - MULSS ( XMM0, XMM2 ) /* uz*m10*scale */ - MOVSS ( XMM2, D(2) ) /* ->D(2) */ - -LLBL(K_G3TRNNRR_skip): - ADD_L ( CONST(16), EDI ) - ADD_L ( EAX, ESI ) - CMP_L ( ECX, EDI ) - JNE ( LLBL(K_G3TRNNRR_top) ) - -LLBL(K_G3TRNNRR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_sse_transform_rescale_normals) -HIDDEN(_mesa_sse_transform_rescale_normals) -GLNAME(_mesa_sse_transform_rescale_normals): - -#define FRAME_OFFSET 8 - PUSH_L ( ESI ) - PUSH_L ( EDI ) - - MOV_L ( ARG_IN, ESI ) /* ptr to source GLvector3f */ - MOV_L ( ARG_DEST, EDI ) /* ptr to dest GLvector3f */ - - MOV_L ( ARG_MAT, EDX ) /* ptr to matrix */ - MOV_L ( REGOFF(MATRIX_INV, EDX), EDX) /* matrix->inv */ - - MOV_L ( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L ( ECX, ECX ) - JZ( LLBL(K_G3TRNR_finish) ) /* count was zero; go to finish */ - - MOV_L ( STRIDE, EAX ) /* stride */ - MOV_L ( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest-count */ - - IMUL_L( CONST(16), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - -ALIGNTEXT32 - MOVSS ( M(0), XMM0 ) /* m0 */ - MOVSS ( M(4), XMM1 ) /* m4 */ - UNPCKLPS( XMM1, XMM0 ) /* m4 | m0 */ - - MOVSS ( ARG_SCALE, XMM4 ) /* scale */ - SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* scale | scale */ - - MULPS ( XMM4, XMM0 ) /* m4*scale | m0*scale */ - MOVSS ( M(1), XMM1 ) /* m1 */ - MOVSS ( M(5), XMM2 ) /* m5 */ - UNPCKLPS( XMM2, XMM1 ) /* m5 | m1 */ - MULPS ( XMM4, XMM1 ) /* m5*scale | m1*scale */ - MOVSS ( M(2), XMM2 ) /* m2 */ - MOVSS ( M(6), XMM3 ) /* m6 */ - UNPCKLPS( XMM3, XMM2 ) /* m6 | m2 */ - MULPS ( XMM4, XMM2 ) /* m6*scale | m2*scale */ - - MOVSS ( M(8), XMM6 ) /* m8 */ - MULSS ( ARG_SCALE, XMM6 ) /* m8*scale */ - MOVSS ( M(9), XMM7 ) /* m9 */ - MULSS ( ARG_SCALE, XMM7 ) /* m9*scale */ - -ALIGNTEXT32 -LLBL(K_G3TRNR_top): - MOVSS ( S(0), XMM3 ) /* ux */ - SHUFPS ( CONST(0x0), XMM3, XMM3 ) /* ux | ux */ - MULPS ( XMM0, XMM3 ) /* ux*m4 | ux*m0 */ - MOVSS ( S(1), XMM4 ) /* uy */ - SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* uy | uy */ - MULPS ( XMM1, XMM4 ) /* uy*m5 | uy*m1 */ - MOVSS ( S(2), XMM5 ) /* uz */ - SHUFPS ( CONST(0x0), XMM5, XMM5 ) /* uz | uz */ - MULPS ( XMM2, XMM5 ) /* uz*m6 | uz*m2 */ - - ADDPS ( XMM4, XMM3 ) - ADDPS ( XMM5, XMM3 ) - MOVLPS ( XMM3, D(0) ) - - MOVSS ( M(10), XMM3 ) /* m10 */ - MULSS ( ARG_SCALE, XMM3 ) /* m10*scale */ - MULSS ( S(2), XMM3 ) /* m10*scale*uz */ - MOVSS ( S(1), XMM4 ) /* uy */ - MULSS ( XMM7, XMM4 ) /* uy*m9*scale */ - MOVSS ( S(0), XMM5 ) /* ux */ - MULSS ( XMM6, XMM5 ) /* ux*m8*scale */ - - ADDSS ( XMM4, XMM3 ) - ADDSS ( XMM5, XMM3 ) - MOVSS ( XMM3, D(2) ) - -LLBL(K_G3TRNR_skip): - ADD_L ( CONST(16), EDI ) - ADD_L ( EAX, ESI ) - CMP_L ( ECX, EDI ) - JNE ( LLBL(K_G3TRNR_top) ) - -LLBL(K_G3TRNR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_sse_transform_normals_no_rot) -HIDDEN(_mesa_sse_transform_normals_no_rot) -GLNAME(_mesa_sse_transform_normals_no_rot): - -#define FRAME_OFFSET 8 - PUSH_L ( ESI ) - PUSH_L ( EDI ) - - MOV_L ( ARG_IN, ESI ) /* ptr to source GLvector3f */ - MOV_L ( ARG_DEST, EDI ) /* ptr to dest GLvector3f */ - - MOV_L ( ARG_MAT, EDX ) /* ptr to matrix */ - MOV_L ( REGOFF(MATRIX_INV, EDX), EDX) /* matrix->inv */ - - MOV_L ( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L ( ECX, ECX ) - JZ( LLBL(K_G3TNNRR_finish) ) /* count was zero; go to finish */ - - MOV_L ( STRIDE, EAX ) /* stride */ - MOV_L ( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest-count */ - - IMUL_L( CONST(16), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - -ALIGNTEXT32 - MOVSS( M(0), XMM0 ) /* m0 */ - MOVSS( M(5), XMM1 ) /* m5 */ - UNPCKLPS( XMM1, XMM0 ) /* m5 | m0 */ - MOVSS( M(10), XMM1 ) /* m10 */ - -ALIGNTEXT32 -LLBL(K_G3TNNRR_top): - MOVLPS( S(0), XMM2 ) /* uy | ux */ - MULPS( XMM0, XMM2 ) /* uy*m5 | ux*m0 */ - MOVLPS( XMM2, D(0) ) - - MOVSS( S(2), XMM2 ) /* uz */ - MULSS( XMM1, XMM2 ) /* uz*m10 */ - MOVSS( XMM2, D(2) ) - -LLBL(K_G3TNNRR_skip): - ADD_L ( CONST(16), EDI ) - ADD_L ( EAX, ESI ) - CMP_L ( ECX, EDI ) - JNE ( LLBL(K_G3TNNRR_top) ) - -LLBL(K_G3TNNRR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET -#endif - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif + +/* + * 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. + */ + +/** TODO: + * - insert PREFETCH instructions to avoid cache-misses ! + * - some more optimizations are possible... + * - for 40-50% more performance in the SSE-functions, the + * data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! + */ + +#ifdef USE_SSE_ASM +#include "assyntax.h" +#include "matypes.h" +#include "norm_args.h" + + SEG_TEXT + +#define M(i) REGOFF(i * 4, EDX) +#define S(i) REGOFF(i * 4, ESI) +#define D(i) REGOFF(i * 4, EDI) +#define STRIDE REGOFF(12, ESI) + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_sse_transform_rescale_normals_no_rot) +HIDDEN(_mesa_sse_transform_rescale_normals_no_rot) +GLNAME(_mesa_sse_transform_rescale_normals_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L ( ARG_IN, ESI ) /* ptr to source GLvector3f */ + MOV_L ( ARG_DEST, EDI ) /* ptr to dest GLvector3f */ + + MOV_L ( ARG_MAT, EDX ) /* ptr to matrix */ + MOV_L ( REGOFF(MATRIX_INV, EDX), EDX) /* matrix->inv */ + + MOV_L ( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L ( ECX, ECX ) + JZ( LLBL(K_G3TRNNRR_finish) ) /* count was zero; go to finish */ + + MOV_L ( STRIDE, EAX ) /* stride */ + MOV_L ( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest-count */ + + IMUL_L( CONST(16), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS ( M(0), XMM1 ) /* m0 */ + MOVSS ( M(5), XMM2 ) /* m5 */ + UNPCKLPS( XMM2, XMM1 ) /* m5 | m0 */ + MOVSS ( ARG_SCALE, XMM0 ) /* scale */ + SHUFPS ( CONST(0x0), XMM0, XMM0 ) /* scale | scale */ + MULPS ( XMM0, XMM1 ) /* m5*scale | m0*scale */ + MULSS ( M(10), XMM0 ) /* m10*scale */ + +ALIGNTEXT32 +LLBL(K_G3TRNNRR_top): + MOVLPS ( S(0), XMM2 ) /* uy | ux */ + MULPS ( XMM1, XMM2 ) /* uy*m5*scale | ux*m0*scale */ + MOVLPS ( XMM2, D(0) ) /* ->D(1) | D(0) */ + + MOVSS ( S(2), XMM2 ) /* uz */ + MULSS ( XMM0, XMM2 ) /* uz*m10*scale */ + MOVSS ( XMM2, D(2) ) /* ->D(2) */ + +LLBL(K_G3TRNNRR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_G3TRNNRR_top) ) + +LLBL(K_G3TRNNRR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_sse_transform_rescale_normals) +HIDDEN(_mesa_sse_transform_rescale_normals) +GLNAME(_mesa_sse_transform_rescale_normals): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L ( ARG_IN, ESI ) /* ptr to source GLvector3f */ + MOV_L ( ARG_DEST, EDI ) /* ptr to dest GLvector3f */ + + MOV_L ( ARG_MAT, EDX ) /* ptr to matrix */ + MOV_L ( REGOFF(MATRIX_INV, EDX), EDX) /* matrix->inv */ + + MOV_L ( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L ( ECX, ECX ) + JZ( LLBL(K_G3TRNR_finish) ) /* count was zero; go to finish */ + + MOV_L ( STRIDE, EAX ) /* stride */ + MOV_L ( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest-count */ + + IMUL_L( CONST(16), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS ( M(0), XMM0 ) /* m0 */ + MOVSS ( M(4), XMM1 ) /* m4 */ + UNPCKLPS( XMM1, XMM0 ) /* m4 | m0 */ + + MOVSS ( ARG_SCALE, XMM4 ) /* scale */ + SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* scale | scale */ + + MULPS ( XMM4, XMM0 ) /* m4*scale | m0*scale */ + MOVSS ( M(1), XMM1 ) /* m1 */ + MOVSS ( M(5), XMM2 ) /* m5 */ + UNPCKLPS( XMM2, XMM1 ) /* m5 | m1 */ + MULPS ( XMM4, XMM1 ) /* m5*scale | m1*scale */ + MOVSS ( M(2), XMM2 ) /* m2 */ + MOVSS ( M(6), XMM3 ) /* m6 */ + UNPCKLPS( XMM3, XMM2 ) /* m6 | m2 */ + MULPS ( XMM4, XMM2 ) /* m6*scale | m2*scale */ + + MOVSS ( M(8), XMM6 ) /* m8 */ + MULSS ( ARG_SCALE, XMM6 ) /* m8*scale */ + MOVSS ( M(9), XMM7 ) /* m9 */ + MULSS ( ARG_SCALE, XMM7 ) /* m9*scale */ + +ALIGNTEXT32 +LLBL(K_G3TRNR_top): + MOVSS ( S(0), XMM3 ) /* ux */ + SHUFPS ( CONST(0x0), XMM3, XMM3 ) /* ux | ux */ + MULPS ( XMM0, XMM3 ) /* ux*m4 | ux*m0 */ + MOVSS ( S(1), XMM4 ) /* uy */ + SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* uy | uy */ + MULPS ( XMM1, XMM4 ) /* uy*m5 | uy*m1 */ + MOVSS ( S(2), XMM5 ) /* uz */ + SHUFPS ( CONST(0x0), XMM5, XMM5 ) /* uz | uz */ + MULPS ( XMM2, XMM5 ) /* uz*m6 | uz*m2 */ + + ADDPS ( XMM4, XMM3 ) + ADDPS ( XMM5, XMM3 ) + MOVLPS ( XMM3, D(0) ) + + MOVSS ( M(10), XMM3 ) /* m10 */ + MULSS ( ARG_SCALE, XMM3 ) /* m10*scale */ + MULSS ( S(2), XMM3 ) /* m10*scale*uz */ + MOVSS ( S(1), XMM4 ) /* uy */ + MULSS ( XMM7, XMM4 ) /* uy*m9*scale */ + MOVSS ( S(0), XMM5 ) /* ux */ + MULSS ( XMM6, XMM5 ) /* ux*m8*scale */ + + ADDSS ( XMM4, XMM3 ) + ADDSS ( XMM5, XMM3 ) + MOVSS ( XMM3, D(2) ) + +LLBL(K_G3TRNR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_G3TRNR_top) ) + +LLBL(K_G3TRNR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_sse_transform_normals_no_rot) +HIDDEN(_mesa_sse_transform_normals_no_rot) +GLNAME(_mesa_sse_transform_normals_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L ( ARG_IN, ESI ) /* ptr to source GLvector3f */ + MOV_L ( ARG_DEST, EDI ) /* ptr to dest GLvector3f */ + + MOV_L ( ARG_MAT, EDX ) /* ptr to matrix */ + MOV_L ( REGOFF(MATRIX_INV, EDX), EDX) /* matrix->inv */ + + MOV_L ( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L ( ECX, ECX ) + JZ( LLBL(K_G3TNNRR_finish) ) /* count was zero; go to finish */ + + MOV_L ( STRIDE, EAX ) /* stride */ + MOV_L ( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest-count */ + + IMUL_L( CONST(16), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS( M(0), XMM0 ) /* m0 */ + MOVSS( M(5), XMM1 ) /* m5 */ + UNPCKLPS( XMM1, XMM0 ) /* m5 | m0 */ + MOVSS( M(10), XMM1 ) /* m10 */ + +ALIGNTEXT32 +LLBL(K_G3TNNRR_top): + MOVLPS( S(0), XMM2 ) /* uy | ux */ + MULPS( XMM0, XMM2 ) /* uy*m5 | ux*m0 */ + MOVLPS( XMM2, D(0) ) + + MOVSS( S(2), XMM2 ) /* uz */ + MULSS( XMM1, XMM2 ) /* uz*m10 */ + MOVSS( XMM2, D(2) ) + +LLBL(K_G3TNNRR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_G3TNNRR_top) ) + +LLBL(K_G3TNNRR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET +#endif + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/sse_xform1.S b/mesalib/src/mesa/x86/sse_xform1.S index 45a6dd7ec..4aa9de607 100644 --- a/mesalib/src/mesa/x86/sse_xform1.S +++ b/mesalib/src/mesa/x86/sse_xform1.S @@ -1,446 +1,446 @@ - -/* - * 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. - */ - -/** TODO: - * - insert PREFETCH instructions to avoid cache-misses ! - * - some more optimizations are possible... - * - for 40-50% more performance in the SSE-functions, the - * data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! - */ - -#ifdef USE_SSE_ASM -#include "assyntax.h" -#include "matypes.h" -#include "xform_args.h" - - SEG_TEXT - -#define S(i) REGOFF(i * 4, ESI) -#define D(i) REGOFF(i * 4, EDI) -#define M(i) REGOFF(i * 4, EDX) - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points1_general) -HIDDEN( _mesa_sse_transform_points1_general ) -GLNAME( _mesa_sse_transform_points1_general ): - -#define FRAME_OFFSET 8 - PUSH_L ( ESI ) - PUSH_L ( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - CMP_L( CONST(0), ECX ) /* count == 0 ? */ - JE( LLBL(K_GTP1GR_finish) ) /* yes -> nothing to do. */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - - -ALIGNTEXT32 - MOVAPS( M(0), XMM0 ) /* m3 | m2 | m1 | m0 */ - MOVAPS( M(12), XMM1 ) /* m15 | m14 | m13 | m12 */ - -ALIGNTEXT32 -LLBL(K_GTP1GR_top): - MOVSS( S(0), XMM2 ) /* ox */ - SHUFPS( CONST(0x0), XMM2, XMM2 ) /* ox | ox | ox | ox */ - MULPS( XMM0, XMM2 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ - ADDPS( XMM1, XMM2 ) /* + | + | + | + */ - MOVUPS( XMM2, D(0) ) - -LLBL(K_GTP1GR_skip): - ADD_L ( CONST(16), EDI ) - ADD_L ( EAX, ESI ) - CMP_L ( ECX, EDI ) - JNE ( LLBL(K_GTP1GR_top) ) - -LLBL(K_GTP1GR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points1_identity) -HIDDEN(_mesa_sse_transform_points1_identity) -GLNAME( _mesa_sse_transform_points1_identity ): - -#define FRAME_OFFSET 8 - PUSH_L ( ESI ) - PUSH_L ( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP1IR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_1), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(1), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - - CMP_L( ESI, EDI ) - JE( LLBL(K_GTP1IR_finish) ) - - -ALIGNTEXT32 -LLBL(K_GTP1IR_top): - MOV_L( S(0), EDX ) - MOV_L( EDX, D(0) ) - -LLBL(K_GTP1IR_skip): - ADD_L ( CONST(16), EDI ) - ADD_L ( EAX, ESI ) - CMP_L ( ECX, EDI ) - JNE ( LLBL(K_GTP1IR_top) ) - -LLBL(K_GTP1IR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points1_3d_no_rot) -HIDDEN(_mesa_sse_transform_points1_3d_no_rot) -GLNAME(_mesa_sse_transform_points1_3d_no_rot): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP13DNRR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - - -ALIGNTEXT32 - MOVSS( M(0), XMM0 ) /* m0 */ - MOVSS( M(12), XMM1 ) /* m12 */ - MOVSS( M(13), XMM2 ) /* m13 */ - MOVSS( M(14), XMM3 ) /* m14 */ - -ALIGNTEXT32 -LLBL(K_GTP13DNRR_top): - MOVSS( S(0), XMM4 ) /* ox */ - MULSS( XMM0, XMM4 ) /* ox*m0 */ - ADDSS( XMM1, XMM4 ) /* ox*m0+m12 */ - MOVSS( XMM4, D(0) ) - - MOVSS( XMM2, D(1) ) - MOVSS( XMM3, D(2) ) - -LLBL(K_GTP13DNRR_skip): - ADD_L ( CONST(16), EDI ) - ADD_L ( EAX, ESI ) - CMP_L ( ECX, EDI ) - JNE ( LLBL(K_GTP13DNRR_top) ) - -LLBL(K_GTP13DNRR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points1_perspective) -HIDDEN(_mesa_sse_transform_points1_perspective) -GLNAME(_mesa_sse_transform_points1_perspective): - -#define FRAME_OFFSET 8 - PUSH_L ( ESI ) - PUSH_L ( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP13PR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - - -ALIGNTEXT32 - XORPS( XMM0, XMM0 ) /* 0 | 0 | 0 | 0 */ - MOVSS( M(0), XMM1 ) /* m0 */ - MOVSS( M(14), XMM2 ) /* m14 */ - -ALIGNTEXT32 -LLBL(K_GTP13PR_top): - MOVSS( S(0), XMM3 ) /* ox */ - MULSS( XMM1, XMM3 ) /* ox*m0 */ - MOVSS( XMM3, D(0) ) /* ox*m0->D(0) */ - MOVSS( XMM2, D(2) ) /* m14->D(2) */ - - MOVSS( XMM0, D(1) ) - MOVSS( XMM0, D(3) ) - -LLBL(K_GTP13PR_skip): - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(K_GTP13PR_top) ) - -LLBL(K_GTP13PR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points1_2d) -HIDDEN(_mesa_sse_transform_points1_2d) -GLNAME(_mesa_sse_transform_points1_2d): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP13P2DR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - -ALIGNTEXT32 - MOVLPS( M(0), XMM0 ) /* m1 | m0 */ - MOVLPS( M(12), XMM1 ) /* m13 | m12 */ - -ALIGNTEXT32 -LLBL(K_GTP13P2DR_top): - MOVSS( S(0), XMM2 ) /* ox */ - SHUFPS( CONST(0x0), XMM2, XMM2 ) /* ox | ox | ox | ox */ - MULPS( XMM0, XMM2 ) /* - | - | ox*m1 | ox*m0 */ - ADDPS( XMM1, XMM2 ) /* - | - | ox*m1+m13 | ox*m0+m12 */ - MOVLPS( XMM2, D(0) ) - -LLBL(K_GTP13P2DR_skip): - ADD_L ( CONST(16), EDI ) - ADD_L ( EAX, ESI ) - CMP_L ( ECX, EDI ) - JNE ( LLBL(K_GTP13P2DR_top) ) - -LLBL(K_GTP13P2DR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points1_2d_no_rot) -HIDDEN(_mesa_sse_transform_points1_2d_no_rot) -GLNAME(_mesa_sse_transform_points1_2d_no_rot): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP13P2DNRR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - -ALIGNTEXT32 - MOVSS( M(0), XMM0 ) /* m0 */ - MOVSS( M(12), XMM1 ) /* m12 */ - MOVSS( M(13), XMM2 ) /* m13 */ - -ALIGNTEXT32 -LLBL(K_GTP13P2DNRR_top): - MOVSS( S(0), XMM3 ) /* ox */ - MULSS( XMM0, XMM3 ) /* ox*m0 */ - ADDSS( XMM1, XMM3 ) /* ox*m0+m12 */ - MOVSS( XMM3, D(0) ) - MOVSS( XMM2, D(1) ) - -LLBL(K_GTP13P2DNRR_skip): - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(K_GTP13P2DNRR_top) ) - -LLBL(K_GTP13P2DNRR_finish): - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points1_3d) -HIDDEN(_mesa_sse_transform_points1_3d) -GLNAME(_mesa_sse_transform_points1_3d): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP13P3DR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - - -ALIGNTEXT32 - MOVAPS( M(0), XMM0 ) /* m3 | m2 | m1 | m0 */ - MOVAPS( M(12), XMM1 ) /* m15 | m14 | m13 | m12 */ - -ALIGNTEXT32 -LLBL(K_GTP13P3DR_top): - MOVSS( S(0), XMM2 ) /* ox */ - SHUFPS( CONST(0x0), XMM2, XMM2 ) /* ox | ox | ox | ox */ - MULPS( XMM0, XMM2 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ - ADDPS( XMM1, XMM2 ) /* +m15 | +m14 | +m13 | +m12 */ - MOVLPS( XMM2, D(0) ) /* - | - | ->D(1)| ->D(0)*/ - UNPCKHPS( XMM2, XMM2 ) /* ox*m3+m15 | ox*m3+m15 | ox*m2+m14 | ox*m2+m14 */ - MOVSS( XMM2, D(2) ) - -LLBL(K_GTP13P3DR_skip): - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(K_GTP13P3DR_top) ) - -LLBL(K_GTP13P3DR_finish): - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET -#endif - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif + +/* + * 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. + */ + +/** TODO: + * - insert PREFETCH instructions to avoid cache-misses ! + * - some more optimizations are possible... + * - for 40-50% more performance in the SSE-functions, the + * data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! + */ + +#ifdef USE_SSE_ASM +#include "assyntax.h" +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define S(i) REGOFF(i * 4, ESI) +#define D(i) REGOFF(i * 4, EDI) +#define M(i) REGOFF(i * 4, EDX) + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points1_general) +HIDDEN( _mesa_sse_transform_points1_general ) +GLNAME( _mesa_sse_transform_points1_general ): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + CMP_L( CONST(0), ECX ) /* count == 0 ? */ + JE( LLBL(K_GTP1GR_finish) ) /* yes -> nothing to do. */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + +ALIGNTEXT32 + MOVAPS( M(0), XMM0 ) /* m3 | m2 | m1 | m0 */ + MOVAPS( M(12), XMM1 ) /* m15 | m14 | m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP1GR_top): + MOVSS( S(0), XMM2 ) /* ox */ + SHUFPS( CONST(0x0), XMM2, XMM2 ) /* ox | ox | ox | ox */ + MULPS( XMM0, XMM2 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ + ADDPS( XMM1, XMM2 ) /* + | + | + | + */ + MOVUPS( XMM2, D(0) ) + +LLBL(K_GTP1GR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP1GR_top) ) + +LLBL(K_GTP1GR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points1_identity) +HIDDEN(_mesa_sse_transform_points1_identity) +GLNAME( _mesa_sse_transform_points1_identity ): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP1IR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_1), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(1), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + CMP_L( ESI, EDI ) + JE( LLBL(K_GTP1IR_finish) ) + + +ALIGNTEXT32 +LLBL(K_GTP1IR_top): + MOV_L( S(0), EDX ) + MOV_L( EDX, D(0) ) + +LLBL(K_GTP1IR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP1IR_top) ) + +LLBL(K_GTP1IR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points1_3d_no_rot) +HIDDEN(_mesa_sse_transform_points1_3d_no_rot) +GLNAME(_mesa_sse_transform_points1_3d_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP13DNRR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + +ALIGNTEXT32 + MOVSS( M(0), XMM0 ) /* m0 */ + MOVSS( M(12), XMM1 ) /* m12 */ + MOVSS( M(13), XMM2 ) /* m13 */ + MOVSS( M(14), XMM3 ) /* m14 */ + +ALIGNTEXT32 +LLBL(K_GTP13DNRR_top): + MOVSS( S(0), XMM4 ) /* ox */ + MULSS( XMM0, XMM4 ) /* ox*m0 */ + ADDSS( XMM1, XMM4 ) /* ox*m0+m12 */ + MOVSS( XMM4, D(0) ) + + MOVSS( XMM2, D(1) ) + MOVSS( XMM3, D(2) ) + +LLBL(K_GTP13DNRR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP13DNRR_top) ) + +LLBL(K_GTP13DNRR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points1_perspective) +HIDDEN(_mesa_sse_transform_points1_perspective) +GLNAME(_mesa_sse_transform_points1_perspective): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP13PR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + +ALIGNTEXT32 + XORPS( XMM0, XMM0 ) /* 0 | 0 | 0 | 0 */ + MOVSS( M(0), XMM1 ) /* m0 */ + MOVSS( M(14), XMM2 ) /* m14 */ + +ALIGNTEXT32 +LLBL(K_GTP13PR_top): + MOVSS( S(0), XMM3 ) /* ox */ + MULSS( XMM1, XMM3 ) /* ox*m0 */ + MOVSS( XMM3, D(0) ) /* ox*m0->D(0) */ + MOVSS( XMM2, D(2) ) /* m14->D(2) */ + + MOVSS( XMM0, D(1) ) + MOVSS( XMM0, D(3) ) + +LLBL(K_GTP13PR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP13PR_top) ) + +LLBL(K_GTP13PR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points1_2d) +HIDDEN(_mesa_sse_transform_points1_2d) +GLNAME(_mesa_sse_transform_points1_2d): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP13P2DR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVLPS( M(0), XMM0 ) /* m1 | m0 */ + MOVLPS( M(12), XMM1 ) /* m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP13P2DR_top): + MOVSS( S(0), XMM2 ) /* ox */ + SHUFPS( CONST(0x0), XMM2, XMM2 ) /* ox | ox | ox | ox */ + MULPS( XMM0, XMM2 ) /* - | - | ox*m1 | ox*m0 */ + ADDPS( XMM1, XMM2 ) /* - | - | ox*m1+m13 | ox*m0+m12 */ + MOVLPS( XMM2, D(0) ) + +LLBL(K_GTP13P2DR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP13P2DR_top) ) + +LLBL(K_GTP13P2DR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points1_2d_no_rot) +HIDDEN(_mesa_sse_transform_points1_2d_no_rot) +GLNAME(_mesa_sse_transform_points1_2d_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP13P2DNRR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS( M(0), XMM0 ) /* m0 */ + MOVSS( M(12), XMM1 ) /* m12 */ + MOVSS( M(13), XMM2 ) /* m13 */ + +ALIGNTEXT32 +LLBL(K_GTP13P2DNRR_top): + MOVSS( S(0), XMM3 ) /* ox */ + MULSS( XMM0, XMM3 ) /* ox*m0 */ + ADDSS( XMM1, XMM3 ) /* ox*m0+m12 */ + MOVSS( XMM3, D(0) ) + MOVSS( XMM2, D(1) ) + +LLBL(K_GTP13P2DNRR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP13P2DNRR_top) ) + +LLBL(K_GTP13P2DNRR_finish): + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points1_3d) +HIDDEN(_mesa_sse_transform_points1_3d) +GLNAME(_mesa_sse_transform_points1_3d): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP13P3DR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + +ALIGNTEXT32 + MOVAPS( M(0), XMM0 ) /* m3 | m2 | m1 | m0 */ + MOVAPS( M(12), XMM1 ) /* m15 | m14 | m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP13P3DR_top): + MOVSS( S(0), XMM2 ) /* ox */ + SHUFPS( CONST(0x0), XMM2, XMM2 ) /* ox | ox | ox | ox */ + MULPS( XMM0, XMM2 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ + ADDPS( XMM1, XMM2 ) /* +m15 | +m14 | +m13 | +m12 */ + MOVLPS( XMM2, D(0) ) /* - | - | ->D(1)| ->D(0)*/ + UNPCKHPS( XMM2, XMM2 ) /* ox*m3+m15 | ox*m3+m15 | ox*m2+m14 | ox*m2+m14 */ + MOVSS( XMM2, D(2) ) + +LLBL(K_GTP13P3DR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP13P3DR_top) ) + +LLBL(K_GTP13P3DR_finish): + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET +#endif + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/sse_xform2.S b/mesalib/src/mesa/x86/sse_xform2.S index 7fb52e2e7..a443dad35 100644 --- a/mesalib/src/mesa/x86/sse_xform2.S +++ b/mesalib/src/mesa/x86/sse_xform2.S @@ -1,466 +1,466 @@ - -/* - * 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. - */ - -/** TODO: - * - insert PREFETCH instructions to avoid cache-misses ! - * - some more optimizations are possible... - * - for 40-50% more performance in the SSE-functions, the - * data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! - */ - -#ifdef USE_SSE_ASM -#include "assyntax.h" -#include "matypes.h" -#include "xform_args.h" - - SEG_TEXT - -#define S(i) REGOFF(i * 4, ESI) -#define D(i) REGOFF(i * 4, EDI) -#define M(i) REGOFF(i * 4, EDX) - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points2_general) -HIDDEN (_mesa_sse_transform_points2_general) -GLNAME( _mesa_sse_transform_points2_general ): - -#define FRAME_OFFSET 8 - PUSH_L ( ESI ) - PUSH_L ( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX ) - JZ( LLBL(K_GTP2GR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - -ALIGNTEXT32 - MOVAPS( M(0), XMM0 ) /* m3 | m2 | m1 | m0 */ - MOVAPS( M(4), XMM1 ) /* m7 | m6 | m5 | m4 */ - MOVAPS( M(12), XMM2 ) /* m15 | m14 | m13 | m12 */ - -ALIGNTEXT32 -LLBL(K_GTP2GR_top): - MOVSS( S(0), XMM3 ) /* ox */ - SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ox | ox | ox | ox */ - MULPS( XMM0, XMM3 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ - MOVSS( S(1), XMM4 ) /* oy */ - SHUFPS( CONST(0x0), XMM4, XMM4 ) /* oy | oy | oy | oy */ - MULPS( XMM1, XMM4 ) /* oy*m7 | oy*m6 | oy*m5 | oy*m4 */ - - ADDPS( XMM4, XMM3 ) - ADDPS( XMM2, XMM3 ) - MOVAPS( XMM3, D(0) ) - -LLBL(K_GTP2GR_skip): - ADD_L ( CONST(16), EDI ) - ADD_L ( EAX, ESI ) - CMP_L ( ECX, EDI ) - JNE ( LLBL(K_GTP2GR_top) ) - -LLBL(K_GTP2GR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points2_identity) -HIDDEN(_mesa_sse_transform_points2_identity) -GLNAME( _mesa_sse_transform_points2_identity ): - -#define FRAME_OFFSET 8 - PUSH_L ( ESI ) - PUSH_L ( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP2IR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - - CMP_L( ESI, EDI ) - JE( LLBL(K_GTP2IR_finish) ) - - -ALIGNTEXT32 -LLBL(K_GTP2IR_top): - MOV_L ( S(0), EDX ) - MOV_L ( EDX, D(0) ) - MOV_L ( S(1), EDX ) - MOV_L ( EDX, D(1) ) - -LLBL(K_GTP2IR_skip): - ADD_L ( CONST(16), EDI ) - ADD_L ( EAX, ESI ) - CMP_L ( ECX, EDI ) - JNE ( LLBL(K_GTP2IR_top) ) - -LLBL(K_GTP2IR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points2_3d_no_rot) -HIDDEN(_mesa_sse_transform_points2_3d_no_rot) -GLNAME(_mesa_sse_transform_points2_3d_no_rot): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP23DNRR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - - XORPS( XMM0, XMM0 ) /* clean the working register */ - -ALIGNTEXT32 - MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ - MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ - UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ - MOVLPS ( M(12), XMM2 ) /* - | - | m13 | m12 */ - MOVSS ( M(14), XMM3 ) /* - | - | - | m14 */ - -ALIGNTEXT32 -LLBL(K_GTP23DNRR_top): - MOVLPS ( S(0), XMM0 ) /* - | - | oy | ox */ - MULPS ( XMM1, XMM0 ) /* - | - | oy*m5 | ox*m0 */ - ADDPS ( XMM2, XMM0 ) /* - | - | +m13 | +m12 */ - MOVLPS ( XMM0, D(0) ) /* -> D(1) | -> D(0) */ - - MOVSS ( XMM3, D(2) ) /* -> D(2) */ - -LLBL(K_GTP23DNRR_skip): - ADD_L ( CONST(16), EDI ) - ADD_L ( EAX, ESI ) - CMP_L ( ECX, EDI ) - JNE ( LLBL(K_GTP23DNRR_top) ) - -LLBL(K_GTP23DNRR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points2_perspective) -HIDDEN(_mesa_sse_transform_points2_perspective) -GLNAME(_mesa_sse_transform_points2_perspective): - -#define FRAME_OFFSET 8 - PUSH_L ( ESI ) - PUSH_L ( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP23PR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - -ALIGNTEXT32 - MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ - MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ - UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ - MOVSS ( M(14), XMM3 ) /* m14 */ - XORPS ( XMM0, XMM0 ) /* 0 | 0 | 0 | 0 */ - -ALIGNTEXT32 -LLBL(K_GTP23PR_top): - MOVLPS( S(0), XMM4 ) /* oy | ox */ - MULPS( XMM1, XMM4 ) /* oy*m5 | ox*m0 */ - MOVLPS( XMM4, D(0) ) /* ->D(1) | ->D(0) */ - MOVSS( XMM3, D(2) ) /* ->D(2) */ - MOVSS( XMM0, D(3) ) /* ->D(3) */ - -LLBL(K_GTP23PR_skip): - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(K_GTP23PR_top) ) - -LLBL(K_GTP23PR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points2_2d) -HIDDEN(_mesa_sse_transform_points2_2d) -GLNAME(_mesa_sse_transform_points2_2d): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP23P2DR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - -ALIGNTEXT32 - MOVLPS( M(0), XMM0 ) /* m1 | m0 */ - MOVLPS( M(4), XMM1 ) /* m5 | m4 */ - MOVLPS( M(12), XMM2 ) /* m13 | m12 */ - -ALIGNTEXT32 -LLBL(K_GTP23P2DR_top): - MOVSS( S(0), XMM3 ) /* ox */ - SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ox | ox */ - MULPS( XMM0, XMM3 ) /* ox*m1 | ox*m0 */ - - MOVSS( S(1), XMM4 ) /* oy */ - SHUFPS( CONST(0x0), XMM4, XMM4 ) /* oy | oy */ - MULPS( XMM1, XMM4 ) /* oy*m5 | oy*m4 */ - - ADDPS( XMM4, XMM3 ) - ADDPS( XMM2, XMM3 ) - MOVLPS( XMM3, D(0) ) /* ->D(1) | ->D(0) */ - -LLBL(K_GTP23P2DR_skip): - ADD_L ( CONST(16), EDI ) - ADD_L ( EAX, ESI ) - CMP_L ( ECX, EDI ) - JNE ( LLBL(K_GTP23P2DR_top) ) - -LLBL(K_GTP23P2DR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points2_2d_no_rot) -HIDDEN(_mesa_sse_transform_points2_2d_no_rot) -GLNAME(_mesa_sse_transform_points2_2d_no_rot): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP23P2DNRR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - -ALIGNTEXT32 - MOVSS ( M(0), XMM1 ) /* m0 */ - MOVSS ( M(5), XMM2 ) /* m5 */ - UNPCKLPS ( XMM2, XMM1 ) /* m5 | m0 */ - MOVLPS ( M(12), XMM2 ) /* m13 | m12 */ - -ALIGNTEXT32 -LLBL(K_GTP23P2DNRR_top): - MOVLPS( S(0), XMM0 ) /* oy | ox */ - MULPS( XMM1, XMM0 ) /* oy*m5 | ox*m0 */ - ADDPS( XMM2, XMM0 ) /* +m13 | +m12 */ - MOVLPS( XMM0, D(0) ) /* ->D(1) | ->D(0) */ - -LLBL(K_GTP23P2DNRR_skip): - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(K_GTP23P2DNRR_top) ) - -LLBL(K_GTP23P2DNRR_finish): - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points2_3d) -HIDDEN(_mesa_sse_transform_points2_3d) -GLNAME(_mesa_sse_transform_points2_3d): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP23P3DR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - -ALIGNTEXT32 - MOVAPS( M(0), XMM0 ) /* m2 | m1 | m0 */ - MOVAPS( M(4), XMM1 ) /* m6 | m5 | m4 */ - MOVAPS( M(12), XMM2 ) /* m14 | m13 | m12 */ - -ALIGNTEXT32 -LLBL(K_GTP23P3DR_top): - MOVSS( S(0), XMM3 ) /* ox */ - SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ox | ox | ox */ - MULPS( XMM0, XMM3 ) /* ox*m2 | ox*m1 | ox*m0 */ - - MOVSS( S(1), XMM4 ) /* oy */ - SHUFPS( CONST(0x0), XMM4, XMM4 ) /* oy | oy | oy */ - MULPS( XMM1, XMM4 ) /* oy*m6 | oy*m5 | oy*m4 */ - - ADDPS( XMM4, XMM3 ) - ADDPS( XMM2, XMM3 ) - - MOVLPS( XMM3, D(0) ) /* ->D(1) | ->D(0) */ - UNPCKHPS( XMM3, XMM3 ) - MOVSS( XMM3, D(2) ) /* ->D(2) */ - -LLBL(K_GTP23P3DR_skip): - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(K_GTP23P3DR_top) ) - -LLBL(K_GTP23P3DR_finish): - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET -#endif - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif + +/* + * 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. + */ + +/** TODO: + * - insert PREFETCH instructions to avoid cache-misses ! + * - some more optimizations are possible... + * - for 40-50% more performance in the SSE-functions, the + * data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! + */ + +#ifdef USE_SSE_ASM +#include "assyntax.h" +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define S(i) REGOFF(i * 4, ESI) +#define D(i) REGOFF(i * 4, EDI) +#define M(i) REGOFF(i * 4, EDX) + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points2_general) +HIDDEN (_mesa_sse_transform_points2_general) +GLNAME( _mesa_sse_transform_points2_general ): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX ) + JZ( LLBL(K_GTP2GR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVAPS( M(0), XMM0 ) /* m3 | m2 | m1 | m0 */ + MOVAPS( M(4), XMM1 ) /* m7 | m6 | m5 | m4 */ + MOVAPS( M(12), XMM2 ) /* m15 | m14 | m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP2GR_top): + MOVSS( S(0), XMM3 ) /* ox */ + SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ox | ox | ox | ox */ + MULPS( XMM0, XMM3 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ + MOVSS( S(1), XMM4 ) /* oy */ + SHUFPS( CONST(0x0), XMM4, XMM4 ) /* oy | oy | oy | oy */ + MULPS( XMM1, XMM4 ) /* oy*m7 | oy*m6 | oy*m5 | oy*m4 */ + + ADDPS( XMM4, XMM3 ) + ADDPS( XMM2, XMM3 ) + MOVAPS( XMM3, D(0) ) + +LLBL(K_GTP2GR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP2GR_top) ) + +LLBL(K_GTP2GR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points2_identity) +HIDDEN(_mesa_sse_transform_points2_identity) +GLNAME( _mesa_sse_transform_points2_identity ): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP2IR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + CMP_L( ESI, EDI ) + JE( LLBL(K_GTP2IR_finish) ) + + +ALIGNTEXT32 +LLBL(K_GTP2IR_top): + MOV_L ( S(0), EDX ) + MOV_L ( EDX, D(0) ) + MOV_L ( S(1), EDX ) + MOV_L ( EDX, D(1) ) + +LLBL(K_GTP2IR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP2IR_top) ) + +LLBL(K_GTP2IR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points2_3d_no_rot) +HIDDEN(_mesa_sse_transform_points2_3d_no_rot) +GLNAME(_mesa_sse_transform_points2_3d_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP23DNRR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + XORPS( XMM0, XMM0 ) /* clean the working register */ + +ALIGNTEXT32 + MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ + MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ + UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ + MOVLPS ( M(12), XMM2 ) /* - | - | m13 | m12 */ + MOVSS ( M(14), XMM3 ) /* - | - | - | m14 */ + +ALIGNTEXT32 +LLBL(K_GTP23DNRR_top): + MOVLPS ( S(0), XMM0 ) /* - | - | oy | ox */ + MULPS ( XMM1, XMM0 ) /* - | - | oy*m5 | ox*m0 */ + ADDPS ( XMM2, XMM0 ) /* - | - | +m13 | +m12 */ + MOVLPS ( XMM0, D(0) ) /* -> D(1) | -> D(0) */ + + MOVSS ( XMM3, D(2) ) /* -> D(2) */ + +LLBL(K_GTP23DNRR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP23DNRR_top) ) + +LLBL(K_GTP23DNRR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points2_perspective) +HIDDEN(_mesa_sse_transform_points2_perspective) +GLNAME(_mesa_sse_transform_points2_perspective): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP23PR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ + MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ + UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ + MOVSS ( M(14), XMM3 ) /* m14 */ + XORPS ( XMM0, XMM0 ) /* 0 | 0 | 0 | 0 */ + +ALIGNTEXT32 +LLBL(K_GTP23PR_top): + MOVLPS( S(0), XMM4 ) /* oy | ox */ + MULPS( XMM1, XMM4 ) /* oy*m5 | ox*m0 */ + MOVLPS( XMM4, D(0) ) /* ->D(1) | ->D(0) */ + MOVSS( XMM3, D(2) ) /* ->D(2) */ + MOVSS( XMM0, D(3) ) /* ->D(3) */ + +LLBL(K_GTP23PR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP23PR_top) ) + +LLBL(K_GTP23PR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points2_2d) +HIDDEN(_mesa_sse_transform_points2_2d) +GLNAME(_mesa_sse_transform_points2_2d): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP23P2DR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVLPS( M(0), XMM0 ) /* m1 | m0 */ + MOVLPS( M(4), XMM1 ) /* m5 | m4 */ + MOVLPS( M(12), XMM2 ) /* m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP23P2DR_top): + MOVSS( S(0), XMM3 ) /* ox */ + SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ox | ox */ + MULPS( XMM0, XMM3 ) /* ox*m1 | ox*m0 */ + + MOVSS( S(1), XMM4 ) /* oy */ + SHUFPS( CONST(0x0), XMM4, XMM4 ) /* oy | oy */ + MULPS( XMM1, XMM4 ) /* oy*m5 | oy*m4 */ + + ADDPS( XMM4, XMM3 ) + ADDPS( XMM2, XMM3 ) + MOVLPS( XMM3, D(0) ) /* ->D(1) | ->D(0) */ + +LLBL(K_GTP23P2DR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP23P2DR_top) ) + +LLBL(K_GTP23P2DR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points2_2d_no_rot) +HIDDEN(_mesa_sse_transform_points2_2d_no_rot) +GLNAME(_mesa_sse_transform_points2_2d_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP23P2DNRR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS ( M(0), XMM1 ) /* m0 */ + MOVSS ( M(5), XMM2 ) /* m5 */ + UNPCKLPS ( XMM2, XMM1 ) /* m5 | m0 */ + MOVLPS ( M(12), XMM2 ) /* m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP23P2DNRR_top): + MOVLPS( S(0), XMM0 ) /* oy | ox */ + MULPS( XMM1, XMM0 ) /* oy*m5 | ox*m0 */ + ADDPS( XMM2, XMM0 ) /* +m13 | +m12 */ + MOVLPS( XMM0, D(0) ) /* ->D(1) | ->D(0) */ + +LLBL(K_GTP23P2DNRR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP23P2DNRR_top) ) + +LLBL(K_GTP23P2DNRR_finish): + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points2_3d) +HIDDEN(_mesa_sse_transform_points2_3d) +GLNAME(_mesa_sse_transform_points2_3d): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP23P3DR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVAPS( M(0), XMM0 ) /* m2 | m1 | m0 */ + MOVAPS( M(4), XMM1 ) /* m6 | m5 | m4 */ + MOVAPS( M(12), XMM2 ) /* m14 | m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP23P3DR_top): + MOVSS( S(0), XMM3 ) /* ox */ + SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ox | ox | ox */ + MULPS( XMM0, XMM3 ) /* ox*m2 | ox*m1 | ox*m0 */ + + MOVSS( S(1), XMM4 ) /* oy */ + SHUFPS( CONST(0x0), XMM4, XMM4 ) /* oy | oy | oy */ + MULPS( XMM1, XMM4 ) /* oy*m6 | oy*m5 | oy*m4 */ + + ADDPS( XMM4, XMM3 ) + ADDPS( XMM2, XMM3 ) + + MOVLPS( XMM3, D(0) ) /* ->D(1) | ->D(0) */ + UNPCKHPS( XMM3, XMM3 ) + MOVSS( XMM3, D(2) ) /* ->D(2) */ + +LLBL(K_GTP23P3DR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP23P3DR_top) ) + +LLBL(K_GTP23P3DR_finish): + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET +#endif + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/sse_xform3.S b/mesalib/src/mesa/x86/sse_xform3.S index 4e39312bf..4bc22d8a5 100644 --- a/mesalib/src/mesa/x86/sse_xform3.S +++ b/mesalib/src/mesa/x86/sse_xform3.S @@ -1,512 +1,512 @@ - -/* - * 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. - */ - -/** TODO: - * - insert PREFETCH instructions to avoid cache-misses ! - * - some more optimizations are possible... - * - for 40-50% more performance in the SSE-functions, the - * data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! - */ - -#ifdef USE_SSE_ASM -#include "assyntax.h" -#include "matypes.h" -#include "xform_args.h" - - SEG_TEXT - -#define S(i) REGOFF(i * 4, ESI) -#define D(i) REGOFF(i * 4, EDI) -#define M(i) REGOFF(i * 4, EDX) - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points3_general) -HIDDEN(_mesa_sse_transform_points3_general) -GLNAME( _mesa_sse_transform_points3_general ): - -#define FRAME_OFFSET 8 - PUSH_L ( ESI ) - PUSH_L ( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - CMP_L ( CONST(0), ECX ) /* count == 0 ? */ - JE ( LLBL(K_GTPGR_finish) ) /* yes -> nothing to do. */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - - -ALIGNTEXT32 - MOVAPS ( REGOFF(0, EDX), XMM0 ) /* m0 | m1 | m2 | m3 */ - MOVAPS ( REGOFF(16, EDX), XMM1 ) /* m4 | m5 | m6 | m7 */ - MOVAPS ( REGOFF(32, EDX), XMM2 ) /* m8 | m9 | m10 | m11 */ - MOVAPS ( REGOFF(48, EDX), XMM3 ) /* m12 | m13 | m14 | m15 */ - - -ALIGNTEXT32 -LLBL(K_GTPGR_top): - MOVSS ( REGOFF(0, ESI), XMM4 ) /* | | | ox */ - SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* ox | ox | ox | ox */ - MOVSS ( REGOFF(4, ESI), XMM5 ) /* | | | oy */ - SHUFPS ( CONST(0x0), XMM5, XMM5 ) /* oy | oy | oy | oy */ - MOVSS ( REGOFF(8, ESI), XMM6 ) /* | | | oz */ - SHUFPS ( CONST(0x0), XMM6, XMM6 ) /* oz | oz | oz | oz */ - - MULPS ( XMM0, XMM4 ) /* m3*ox | m2*ox | m1*ox | m0*ox */ - MULPS ( XMM1, XMM5 ) /* m7*oy | m6*oy | m5*oy | m4*oy */ - MULPS ( XMM2, XMM6 ) /* m11*oz | m10*oz | m9*oz | m8*oz */ - - ADDPS ( XMM5, XMM4 ) - ADDPS ( XMM6, XMM4 ) - ADDPS ( XMM3, XMM4 ) - - MOVAPS ( XMM4, REGOFF(0, EDI) ) - -LLBL(K_GTPGR_skip): - ADD_L ( CONST(16), EDI ) - ADD_L ( EAX, ESI ) - CMP_L ( ECX, EDI ) - JNE ( LLBL(K_GTPGR_top) ) - -LLBL(K_GTPGR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points3_identity) -HIDDEN(_mesa_sse_transform_points3_identity) -GLNAME( _mesa_sse_transform_points3_identity ): - -#define FRAME_OFFSET 8 - PUSH_L ( ESI ) - PUSH_L ( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTPIR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - - CMP_L( ESI, EDI ) - JE( LLBL(K_GTPIR_finish) ) - - -ALIGNTEXT32 -LLBL(K_GTPIR_top): - MOVLPS ( S(0), XMM0 ) - MOVLPS ( XMM0, D(0) ) - MOVSS ( S(2), XMM0 ) - MOVSS ( XMM0, D(2) ) - -LLBL(K_GTPIR_skip): - ADD_L ( CONST(16), EDI ) - ADD_L ( EAX, ESI ) - CMP_L ( ECX, EDI ) - JNE ( LLBL(K_GTPIR_top) ) - -LLBL(K_GTPIR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points3_3d_no_rot) -HIDDEN(_mesa_sse_transform_points3_3d_no_rot) -GLNAME(_mesa_sse_transform_points3_3d_no_rot): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP3DNRR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - - XORPS( XMM0, XMM0 ) /* clean the working register */ - -ALIGNTEXT32 - MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ - MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ - UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ - MOVLPS ( M(12), XMM2 ) /* - | - | m13 | m12 */ - MOVSS ( M(10), XMM3 ) /* - | - | - | m10 */ - MOVSS ( M(14), XMM4 ) /* - | - | - | m14 */ - -ALIGNTEXT32 -LLBL(K_GTP3DNRR_top): - - MOVLPS ( S(0), XMM0 ) /* - | - | s1 | s0 */ - MULPS ( XMM1, XMM0 ) /* - | - | s1*m5 | s0*m0 */ - ADDPS ( XMM2, XMM0 ) /* - | - | +m13 | +m12 */ - MOVLPS ( XMM0, D(0) ) /* -> D(1) | -> D(0) */ - - MOVSS ( S(2), XMM0 ) /* sz */ - MULSS ( XMM3, XMM0 ) /* sz*m10 */ - ADDSS ( XMM4, XMM0 ) /* +m14 */ - MOVSS ( XMM0, D(2) ) /* -> D(2) */ - -LLBL(K_GTP3DNRR_skip): - ADD_L ( CONST(16), EDI ) - ADD_L ( EAX, ESI ) - CMP_L ( ECX, EDI ) - JNE ( LLBL(K_GTP3DNRR_top) ) - -LLBL(K_GTP3DNRR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points3_perspective) -HIDDEN(_mesa_sse_transform_points3_perspective) -GLNAME(_mesa_sse_transform_points3_perspective): - -#define FRAME_OFFSET 8 - PUSH_L ( ESI ) - PUSH_L ( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP3PR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - -ALIGNTEXT32 - MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ - MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ - UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ - MOVLPS ( M(8), XMM2 ) /* - | - | m9 | m8 */ - MOVSS ( M(10), XMM3 ) /* m10 */ - MOVSS ( M(14), XMM4 ) /* m14 */ - XORPS ( XMM6, XMM6 ) /* 0 */ - -ALIGNTEXT32 -LLBL(K_GTP3PR_top): - MOVLPS ( S(0), XMM0 ) /* oy | ox */ - MULPS ( XMM1, XMM0 ) /* oy*m5 | ox*m0 */ - MOVSS ( S(2), XMM5 ) /* oz */ - SHUFPS ( CONST(0x0), XMM5, XMM5 ) /* oz | oz */ - MULPS ( XMM2, XMM5 ) /* oz*m9 | oz*m8 */ - ADDPS ( XMM5, XMM0 ) /* +oy*m5 | +ox*m0 */ - MOVLPS ( XMM0, D(0) ) /* ->D(1) | ->D(0) */ - - MOVSS ( S(2), XMM0 ) /* oz */ - MULSS ( XMM3, XMM0 ) /* oz*m10 */ - ADDSS ( XMM4, XMM0 ) /* +m14 */ - MOVSS ( XMM0, D(2) ) /* ->D(2) */ - - MOVSS ( S(2), XMM0 ) /* oz */ - MOVSS ( XMM6, XMM5 ) /* 0 */ - SUBPS ( XMM0, XMM5 ) /* -oz */ - MOVSS ( XMM5, D(3) ) /* ->D(3) */ - -LLBL(K_GTP3PR_skip): - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(K_GTP3PR_top) ) - -LLBL(K_GTP3PR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points3_2d) -HIDDEN(_mesa_sse_transform_points3_2d) -GLNAME(_mesa_sse_transform_points3_2d): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP3P2DR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - -ALIGNTEXT32 - MOVLPS( M(0), XMM0 ) /* m1 | m0 */ - MOVLPS( M(4), XMM1 ) /* m5 | m4 */ - MOVLPS( M(12), XMM2 ) /* m13 | m12 */ - -ALIGNTEXT32 -LLBL(K_GTP3P2DR_top): - MOVSS ( S(0), XMM3 ) /* ox */ - SHUFPS ( CONST(0x0), XMM3, XMM3 ) /* ox | ox */ - MULPS ( XMM0, XMM3 ) /* ox*m1 | ox*m0 */ - MOVSS ( S(1), XMM4 ) /* oy */ - SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* oy | oy */ - MULPS ( XMM1, XMM4 ) /* oy*m5 | oy*m4 */ - - ADDPS ( XMM4, XMM3 ) - ADDPS ( XMM2, XMM3 ) - MOVLPS ( XMM3, D(0) ) - - MOVSS ( S(2), XMM3 ) - MOVSS ( XMM3, D(2) ) - -LLBL(K_GTP3P2DR_skip): - ADD_L ( CONST(16), EDI ) - ADD_L ( EAX, ESI ) - CMP_L ( ECX, EDI ) - JNE ( LLBL(K_GTP3P2DR_top) ) - -LLBL(K_GTP3P2DR_finish): - POP_L ( EDI ) - POP_L ( ESI ) - RET -#undef FRAME_OFFSET - - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points3_2d_no_rot) -HIDDEN(_mesa_sse_transform_points3_2d_no_rot) -GLNAME(_mesa_sse_transform_points3_2d_no_rot): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP3P2DNRR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - -ALIGNTEXT32 - MOVSS ( M(0), XMM1 ) /* m0 */ - MOVSS ( M(5), XMM2 ) /* m5 */ - UNPCKLPS ( XMM2, XMM1 ) /* m5 | m0 */ - MOVLPS ( M(12), XMM2 ) /* m13 | m12 */ - -ALIGNTEXT32 -LLBL(K_GTP3P2DNRR_top): - MOVLPS( S(0), XMM0 ) /* oy | ox */ - MULPS( XMM1, XMM0 ) /* oy*m5 | ox*m0 */ - ADDPS( XMM2, XMM0 ) /* +m13 | +m12 */ - MOVLPS( XMM0, D(0) ) /* ->D(1) | ->D(0) */ - - MOVSS( S(2), XMM0 ) - MOVSS( XMM0, D(2) ) - -LLBL(K_GTP3P2DNRR_skip): - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(K_GTP3P2DNRR_top) ) - -LLBL(K_GTP3P2DNRR_finish): - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT4 -GLOBL GLNAME(_mesa_sse_transform_points3_3d) -HIDDEN(_mesa_sse_transform_points3_3d) -GLNAME(_mesa_sse_transform_points3_3d): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ - MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ - - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP3P3DR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - - -ALIGNTEXT32 - MOVAPS( M(0), XMM0 ) /* m2 | m1 | m0 */ - MOVAPS( M(4), XMM1 ) /* m6 | m5 | m4 */ - MOVAPS( M(8), XMM2 ) /* m10 | m9 | m8 */ - MOVAPS( M(12), XMM3 ) /* m14 | m13 | m12 */ - -ALIGNTEXT32 -LLBL(K_GTP3P3DR_top): - MOVSS( S(0), XMM4 ) - SHUFPS( CONST(0x0), XMM4, XMM4 ) /* ox | ox | ox */ - MULPS( XMM0, XMM4 ) /* ox*m2 | ox*m1 | ox*m0 */ - - MOVSS( S(1), XMM5 ) - SHUFPS( CONST(0x0), XMM5, XMM5 ) /* oy | oy | oy */ - MULPS( XMM1, XMM5 ) /* oy*m6 | oy*m5 | oy*m4 */ - - MOVSS( S(2), XMM6 ) - SHUFPS( CONST(0x0), XMM6, XMM6 ) /* oz | oz | oz */ - MULPS( XMM2, XMM6 ) /* oz*m10 | oz*m9 | oz*m8 */ - - ADDPS( XMM5, XMM4 ) /* + | + | + */ - ADDPS( XMM6, XMM4 ) /* + | + | + */ - ADDPS( XMM3, XMM4 ) /* + | + | + */ - - MOVLPS( XMM4, D(0) ) /* => D(1) | => D(0) */ - UNPCKHPS( XMM4, XMM4 ) - MOVSS( XMM4, D(2) ) - -LLBL(K_GTP3P3DR_skip): - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(K_GTP3P3DR_top) ) - -LLBL(K_GTP3P3DR_finish): - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET -#endif - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif + +/* + * 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. + */ + +/** TODO: + * - insert PREFETCH instructions to avoid cache-misses ! + * - some more optimizations are possible... + * - for 40-50% more performance in the SSE-functions, the + * data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! + */ + +#ifdef USE_SSE_ASM +#include "assyntax.h" +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define S(i) REGOFF(i * 4, ESI) +#define D(i) REGOFF(i * 4, EDI) +#define M(i) REGOFF(i * 4, EDX) + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points3_general) +HIDDEN(_mesa_sse_transform_points3_general) +GLNAME( _mesa_sse_transform_points3_general ): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + CMP_L ( CONST(0), ECX ) /* count == 0 ? */ + JE ( LLBL(K_GTPGR_finish) ) /* yes -> nothing to do. */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + +ALIGNTEXT32 + MOVAPS ( REGOFF(0, EDX), XMM0 ) /* m0 | m1 | m2 | m3 */ + MOVAPS ( REGOFF(16, EDX), XMM1 ) /* m4 | m5 | m6 | m7 */ + MOVAPS ( REGOFF(32, EDX), XMM2 ) /* m8 | m9 | m10 | m11 */ + MOVAPS ( REGOFF(48, EDX), XMM3 ) /* m12 | m13 | m14 | m15 */ + + +ALIGNTEXT32 +LLBL(K_GTPGR_top): + MOVSS ( REGOFF(0, ESI), XMM4 ) /* | | | ox */ + SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* ox | ox | ox | ox */ + MOVSS ( REGOFF(4, ESI), XMM5 ) /* | | | oy */ + SHUFPS ( CONST(0x0), XMM5, XMM5 ) /* oy | oy | oy | oy */ + MOVSS ( REGOFF(8, ESI), XMM6 ) /* | | | oz */ + SHUFPS ( CONST(0x0), XMM6, XMM6 ) /* oz | oz | oz | oz */ + + MULPS ( XMM0, XMM4 ) /* m3*ox | m2*ox | m1*ox | m0*ox */ + MULPS ( XMM1, XMM5 ) /* m7*oy | m6*oy | m5*oy | m4*oy */ + MULPS ( XMM2, XMM6 ) /* m11*oz | m10*oz | m9*oz | m8*oz */ + + ADDPS ( XMM5, XMM4 ) + ADDPS ( XMM6, XMM4 ) + ADDPS ( XMM3, XMM4 ) + + MOVAPS ( XMM4, REGOFF(0, EDI) ) + +LLBL(K_GTPGR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTPGR_top) ) + +LLBL(K_GTPGR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points3_identity) +HIDDEN(_mesa_sse_transform_points3_identity) +GLNAME( _mesa_sse_transform_points3_identity ): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTPIR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + CMP_L( ESI, EDI ) + JE( LLBL(K_GTPIR_finish) ) + + +ALIGNTEXT32 +LLBL(K_GTPIR_top): + MOVLPS ( S(0), XMM0 ) + MOVLPS ( XMM0, D(0) ) + MOVSS ( S(2), XMM0 ) + MOVSS ( XMM0, D(2) ) + +LLBL(K_GTPIR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTPIR_top) ) + +LLBL(K_GTPIR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points3_3d_no_rot) +HIDDEN(_mesa_sse_transform_points3_3d_no_rot) +GLNAME(_mesa_sse_transform_points3_3d_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP3DNRR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + XORPS( XMM0, XMM0 ) /* clean the working register */ + +ALIGNTEXT32 + MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ + MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ + UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ + MOVLPS ( M(12), XMM2 ) /* - | - | m13 | m12 */ + MOVSS ( M(10), XMM3 ) /* - | - | - | m10 */ + MOVSS ( M(14), XMM4 ) /* - | - | - | m14 */ + +ALIGNTEXT32 +LLBL(K_GTP3DNRR_top): + + MOVLPS ( S(0), XMM0 ) /* - | - | s1 | s0 */ + MULPS ( XMM1, XMM0 ) /* - | - | s1*m5 | s0*m0 */ + ADDPS ( XMM2, XMM0 ) /* - | - | +m13 | +m12 */ + MOVLPS ( XMM0, D(0) ) /* -> D(1) | -> D(0) */ + + MOVSS ( S(2), XMM0 ) /* sz */ + MULSS ( XMM3, XMM0 ) /* sz*m10 */ + ADDSS ( XMM4, XMM0 ) /* +m14 */ + MOVSS ( XMM0, D(2) ) /* -> D(2) */ + +LLBL(K_GTP3DNRR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP3DNRR_top) ) + +LLBL(K_GTP3DNRR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points3_perspective) +HIDDEN(_mesa_sse_transform_points3_perspective) +GLNAME(_mesa_sse_transform_points3_perspective): + +#define FRAME_OFFSET 8 + PUSH_L ( ESI ) + PUSH_L ( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP3PR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ + MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ + UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ + MOVLPS ( M(8), XMM2 ) /* - | - | m9 | m8 */ + MOVSS ( M(10), XMM3 ) /* m10 */ + MOVSS ( M(14), XMM4 ) /* m14 */ + XORPS ( XMM6, XMM6 ) /* 0 */ + +ALIGNTEXT32 +LLBL(K_GTP3PR_top): + MOVLPS ( S(0), XMM0 ) /* oy | ox */ + MULPS ( XMM1, XMM0 ) /* oy*m5 | ox*m0 */ + MOVSS ( S(2), XMM5 ) /* oz */ + SHUFPS ( CONST(0x0), XMM5, XMM5 ) /* oz | oz */ + MULPS ( XMM2, XMM5 ) /* oz*m9 | oz*m8 */ + ADDPS ( XMM5, XMM0 ) /* +oy*m5 | +ox*m0 */ + MOVLPS ( XMM0, D(0) ) /* ->D(1) | ->D(0) */ + + MOVSS ( S(2), XMM0 ) /* oz */ + MULSS ( XMM3, XMM0 ) /* oz*m10 */ + ADDSS ( XMM4, XMM0 ) /* +m14 */ + MOVSS ( XMM0, D(2) ) /* ->D(2) */ + + MOVSS ( S(2), XMM0 ) /* oz */ + MOVSS ( XMM6, XMM5 ) /* 0 */ + SUBPS ( XMM0, XMM5 ) /* -oz */ + MOVSS ( XMM5, D(3) ) /* ->D(3) */ + +LLBL(K_GTP3PR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP3PR_top) ) + +LLBL(K_GTP3PR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points3_2d) +HIDDEN(_mesa_sse_transform_points3_2d) +GLNAME(_mesa_sse_transform_points3_2d): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP3P2DR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVLPS( M(0), XMM0 ) /* m1 | m0 */ + MOVLPS( M(4), XMM1 ) /* m5 | m4 */ + MOVLPS( M(12), XMM2 ) /* m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP3P2DR_top): + MOVSS ( S(0), XMM3 ) /* ox */ + SHUFPS ( CONST(0x0), XMM3, XMM3 ) /* ox | ox */ + MULPS ( XMM0, XMM3 ) /* ox*m1 | ox*m0 */ + MOVSS ( S(1), XMM4 ) /* oy */ + SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* oy | oy */ + MULPS ( XMM1, XMM4 ) /* oy*m5 | oy*m4 */ + + ADDPS ( XMM4, XMM3 ) + ADDPS ( XMM2, XMM3 ) + MOVLPS ( XMM3, D(0) ) + + MOVSS ( S(2), XMM3 ) + MOVSS ( XMM3, D(2) ) + +LLBL(K_GTP3P2DR_skip): + ADD_L ( CONST(16), EDI ) + ADD_L ( EAX, ESI ) + CMP_L ( ECX, EDI ) + JNE ( LLBL(K_GTP3P2DR_top) ) + +LLBL(K_GTP3P2DR_finish): + POP_L ( EDI ) + POP_L ( ESI ) + RET +#undef FRAME_OFFSET + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points3_2d_no_rot) +HIDDEN(_mesa_sse_transform_points3_2d_no_rot) +GLNAME(_mesa_sse_transform_points3_2d_no_rot): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP3P2DNRR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + +ALIGNTEXT32 + MOVSS ( M(0), XMM1 ) /* m0 */ + MOVSS ( M(5), XMM2 ) /* m5 */ + UNPCKLPS ( XMM2, XMM1 ) /* m5 | m0 */ + MOVLPS ( M(12), XMM2 ) /* m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP3P2DNRR_top): + MOVLPS( S(0), XMM0 ) /* oy | ox */ + MULPS( XMM1, XMM0 ) /* oy*m5 | ox*m0 */ + ADDPS( XMM2, XMM0 ) /* +m13 | +m12 */ + MOVLPS( XMM0, D(0) ) /* ->D(1) | ->D(0) */ + + MOVSS( S(2), XMM0 ) + MOVSS( XMM0, D(2) ) + +LLBL(K_GTP3P2DNRR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP3P2DNRR_top) ) + +LLBL(K_GTP3P2DNRR_finish): + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT4 +GLOBL GLNAME(_mesa_sse_transform_points3_3d) +HIDDEN(_mesa_sse_transform_points3_3d) +GLNAME(_mesa_sse_transform_points3_3d): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ + MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ + + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP3P3DR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + +ALIGNTEXT32 + MOVAPS( M(0), XMM0 ) /* m2 | m1 | m0 */ + MOVAPS( M(4), XMM1 ) /* m6 | m5 | m4 */ + MOVAPS( M(8), XMM2 ) /* m10 | m9 | m8 */ + MOVAPS( M(12), XMM3 ) /* m14 | m13 | m12 */ + +ALIGNTEXT32 +LLBL(K_GTP3P3DR_top): + MOVSS( S(0), XMM4 ) + SHUFPS( CONST(0x0), XMM4, XMM4 ) /* ox | ox | ox */ + MULPS( XMM0, XMM4 ) /* ox*m2 | ox*m1 | ox*m0 */ + + MOVSS( S(1), XMM5 ) + SHUFPS( CONST(0x0), XMM5, XMM5 ) /* oy | oy | oy */ + MULPS( XMM1, XMM5 ) /* oy*m6 | oy*m5 | oy*m4 */ + + MOVSS( S(2), XMM6 ) + SHUFPS( CONST(0x0), XMM6, XMM6 ) /* oz | oz | oz */ + MULPS( XMM2, XMM6 ) /* oz*m10 | oz*m9 | oz*m8 */ + + ADDPS( XMM5, XMM4 ) /* + | + | + */ + ADDPS( XMM6, XMM4 ) /* + | + | + */ + ADDPS( XMM3, XMM4 ) /* + | + | + */ + + MOVLPS( XMM4, D(0) ) /* => D(1) | => D(0) */ + UNPCKHPS( XMM4, XMM4 ) + MOVSS( XMM4, D(2) ) + +LLBL(K_GTP3P3DR_skip): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP3P3DR_top) ) + +LLBL(K_GTP3P3DR_finish): + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET +#endif + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/sse_xform4.S b/mesalib/src/mesa/x86/sse_xform4.S index 75e0ff396..fb1fa741c 100644 --- a/mesalib/src/mesa/x86/sse_xform4.S +++ b/mesalib/src/mesa/x86/sse_xform4.S @@ -1,235 +1,235 @@ - -/* - * 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. - */ - -#ifdef USE_SSE_ASM -#include "assyntax.h" -#include "matypes.h" -#include "xform_args.h" - - SEG_TEXT - -#define FRAME_OFFSET 8 - -#define SRC(i) REGOFF(i * 4, ESI) -#define DST(i) REGOFF(i * 4, EDI) -#define MAT(i) REGOFF(i * 4, EDX) - -#define SELECT(r0, r1, r2, r3) CONST( r0 * 64 + r1 * 16 + r2 * 4 + r3 ) - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_sse_transform_points4_general ) -HIDDEN(_mesa_sse_transform_points4_general) -GLNAME( _mesa_sse_transform_points4_general ): - - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) /* verify non-zero count */ - JE( LLBL( sse_general_done ) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) )/* set dest size */ - - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - - PREFETCHT0( REGIND(ESI) ) - - MOVAPS( MAT(0), XMM4 ) /* m3 | m2 | m1 | m0 */ - MOVAPS( MAT(4), XMM5 ) /* m7 | m6 | m5 | m4 */ - MOVAPS( MAT(8), XMM6 ) /* m11 | m10 | m9 | m8 */ - MOVAPS( MAT(12), XMM7 ) /* m15 | m14 | m13 | m12 */ - -ALIGNTEXT16 -LLBL( sse_general_loop ): - - MOVSS( SRC(0), XMM0 ) /* ox */ - SHUFPS( CONST(0x0), XMM0, XMM0 ) /* ox | ox | ox | ox */ - MULPS( XMM4, XMM0 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ - - MOVSS( SRC(1), XMM1 ) /* oy */ - SHUFPS( CONST(0x0), XMM1, XMM1 ) /* oy | oy | oy | oy */ - MULPS( XMM5, XMM1 ) /* oy*m7 | oy*m6 | oy*m5 | oy*m4 */ - - MOVSS( SRC(2), XMM2 ) /* oz */ - SHUFPS( CONST(0x0), XMM2, XMM2 ) /* oz | oz | oz | oz */ - MULPS( XMM6, XMM2 ) /* oz*m11 | oz*m10 | oz*m9 | oz*m8 */ - - MOVSS( SRC(3), XMM3 ) /* ow */ - SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ow | ow | ow | ow */ - MULPS( XMM7, XMM3 ) /* ow*m15 | ow*m14 | ow*m13 | ow*m12 */ - - ADDPS( XMM1, XMM0 ) /* ox*m3+oy*m7 | ... */ - ADDPS( XMM2, XMM0 ) /* ox*m3+oy*m7+oz*m11 | ... */ - ADDPS( XMM3, XMM0 ) /* ox*m3+oy*m7+oz*m11+ow*m15 | ... */ - MOVAPS( XMM0, DST(0) ) /* ->D(3) | ->D(2) | ->D(1) | ->D(0) */ - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - - DEC_L( ECX ) - JNZ( LLBL( sse_general_loop ) ) - -LLBL( sse_general_done ): - - POP_L( EDI ) - POP_L( ESI ) - RET - - - - -ALIGNTEXT4 -GLOBL GLNAME( _mesa_sse_transform_points4_3d ) -HIDDEN(_mesa_sse_transform_points4_3d) -GLNAME( _mesa_sse_transform_points4_3d ): - - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( ARG_SOURCE, ESI ) /* ptr to source GLvector4f */ - MOV_L( ARG_DEST, EDI ) /* ptr to dest GLvector4f */ - - MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ - - TEST_L( ECX, ECX) - JZ( LLBL(K_GTP43P3DR_finish) ) /* count was zero; go to finish */ - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) )/* set dest size */ - - SHL_L( CONST(4), ECX ) /* count *= 16 */ - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - ADD_L( EDI, ECX ) /* count += dest ptr */ - - MOVAPS( MAT(0), XMM0 ) /* m3 | m2 | m1 | m0 */ - MOVAPS( MAT(4), XMM1 ) /* m7 | m6 | m5 | m4 */ - MOVAPS( MAT(8), XMM2 ) /* m11 | m10 | m9 | m8 */ - MOVAPS( MAT(12), XMM3 ) /* m15 | m14 | m13 | m12 */ - -ALIGNTEXT32 -LLBL( K_GTP43P3DR_top ): - MOVSS( SRC(0), XMM4 ) /* ox */ - SHUFPS( CONST(0x0), XMM4, XMM4 ) /* ox | ox | ox | ox */ - MULPS( XMM0, XMM4 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ - - MOVSS( SRC(1), XMM5 ) /* oy */ - SHUFPS( CONST(0x0), XMM5, XMM5 ) /* oy | oy | oy | oy */ - MULPS( XMM1, XMM5 ) /* oy*m7 | oy*m6 | oy*m5 | oy*m4 */ - - MOVSS( SRC(2), XMM6 ) /* oz */ - SHUFPS( CONST(0x0), XMM6, XMM6 ) /* oz | oz | oz | oz */ - MULPS( XMM2, XMM6 ) /* oz*m11 | oz*m10 | oz*m9 | oz*m8 */ - - MOVSS( SRC(3), XMM7 ) /* ow */ - SHUFPS( CONST(0x0), XMM7, XMM7 ) /* ow | ow | ow | ow */ - MULPS( XMM3, XMM7 ) /* ow*m15 | ow*m14 | ow*m13 | ow*m12 */ - - ADDPS( XMM5, XMM4 ) /* ox*m3+oy*m7 | ... */ - ADDPS( XMM6, XMM4 ) /* ox*m3+oy*m7+oz*m11 | ... */ - ADDPS( XMM7, XMM4 ) /* ox*m3+oy*m7+oz*m11+ow*m15 | ... */ - MOVAPS( XMM4, DST(0) ) /* ->D(3) | ->D(2) | ->D(1) | ->D(0) */ - - MOVSS( SRC(3), XMM4 ) /* ow */ - MOVSS( XMM4, DST(3) ) /* ->D(3) */ - -LLBL( K_GTP43P3DR_skip ): - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(K_GTP43P3DR_top) ) - -LLBL( K_GTP43P3DR_finish ): - POP_L( EDI ) - POP_L( ESI ) - RET - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_sse_transform_points4_identity ) -HIDDEN(_mesa_sse_transform_points4_identity) -GLNAME( _mesa_sse_transform_points4_identity ): - - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) /* verify non-zero count */ - JE( LLBL( sse_identity_done ) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) )/* set dest size */ - - MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ - MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ - -ALIGNTEXT16 -LLBL( sse_identity_loop ): - - PREFETCHNTA( REGOFF(32, ESI) ) - - MOVAPS( REGIND(ESI), XMM0 ) - ADD_L( EAX, ESI ) - - MOVAPS( XMM0, REGIND(EDI) ) - ADD_L( CONST(16), EDI ) - - DEC_L( ECX ) - JNZ( LLBL( sse_identity_loop ) ) - -LLBL( sse_identity_done ): - - POP_L( EDI ) - POP_L( ESI ) - RET -#endif - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif + +/* + * 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. + */ + +#ifdef USE_SSE_ASM +#include "assyntax.h" +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FRAME_OFFSET 8 + +#define SRC(i) REGOFF(i * 4, ESI) +#define DST(i) REGOFF(i * 4, EDI) +#define MAT(i) REGOFF(i * 4, EDX) + +#define SELECT(r0, r1, r2, r3) CONST( r0 * 64 + r1 * 16 + r2 * 4 + r3 ) + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_sse_transform_points4_general ) +HIDDEN(_mesa_sse_transform_points4_general) +GLNAME( _mesa_sse_transform_points4_general ): + + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) /* verify non-zero count */ + JE( LLBL( sse_general_done ) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) )/* set dest size */ + + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + + PREFETCHT0( REGIND(ESI) ) + + MOVAPS( MAT(0), XMM4 ) /* m3 | m2 | m1 | m0 */ + MOVAPS( MAT(4), XMM5 ) /* m7 | m6 | m5 | m4 */ + MOVAPS( MAT(8), XMM6 ) /* m11 | m10 | m9 | m8 */ + MOVAPS( MAT(12), XMM7 ) /* m15 | m14 | m13 | m12 */ + +ALIGNTEXT16 +LLBL( sse_general_loop ): + + MOVSS( SRC(0), XMM0 ) /* ox */ + SHUFPS( CONST(0x0), XMM0, XMM0 ) /* ox | ox | ox | ox */ + MULPS( XMM4, XMM0 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ + + MOVSS( SRC(1), XMM1 ) /* oy */ + SHUFPS( CONST(0x0), XMM1, XMM1 ) /* oy | oy | oy | oy */ + MULPS( XMM5, XMM1 ) /* oy*m7 | oy*m6 | oy*m5 | oy*m4 */ + + MOVSS( SRC(2), XMM2 ) /* oz */ + SHUFPS( CONST(0x0), XMM2, XMM2 ) /* oz | oz | oz | oz */ + MULPS( XMM6, XMM2 ) /* oz*m11 | oz*m10 | oz*m9 | oz*m8 */ + + MOVSS( SRC(3), XMM3 ) /* ow */ + SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ow | ow | ow | ow */ + MULPS( XMM7, XMM3 ) /* ow*m15 | ow*m14 | ow*m13 | ow*m12 */ + + ADDPS( XMM1, XMM0 ) /* ox*m3+oy*m7 | ... */ + ADDPS( XMM2, XMM0 ) /* ox*m3+oy*m7+oz*m11 | ... */ + ADDPS( XMM3, XMM0 ) /* ox*m3+oy*m7+oz*m11+ow*m15 | ... */ + MOVAPS( XMM0, DST(0) ) /* ->D(3) | ->D(2) | ->D(1) | ->D(0) */ + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + + DEC_L( ECX ) + JNZ( LLBL( sse_general_loop ) ) + +LLBL( sse_general_done ): + + POP_L( EDI ) + POP_L( ESI ) + RET + + + + +ALIGNTEXT4 +GLOBL GLNAME( _mesa_sse_transform_points4_3d ) +HIDDEN(_mesa_sse_transform_points4_3d) +GLNAME( _mesa_sse_transform_points4_3d ): + + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) /* ptr to source GLvector4f */ + MOV_L( ARG_DEST, EDI ) /* ptr to dest GLvector4f */ + + MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ + + TEST_L( ECX, ECX) + JZ( LLBL(K_GTP43P3DR_finish) ) /* count was zero; go to finish */ + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) )/* set dest size */ + + SHL_L( CONST(4), ECX ) /* count *= 16 */ + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + ADD_L( EDI, ECX ) /* count += dest ptr */ + + MOVAPS( MAT(0), XMM0 ) /* m3 | m2 | m1 | m0 */ + MOVAPS( MAT(4), XMM1 ) /* m7 | m6 | m5 | m4 */ + MOVAPS( MAT(8), XMM2 ) /* m11 | m10 | m9 | m8 */ + MOVAPS( MAT(12), XMM3 ) /* m15 | m14 | m13 | m12 */ + +ALIGNTEXT32 +LLBL( K_GTP43P3DR_top ): + MOVSS( SRC(0), XMM4 ) /* ox */ + SHUFPS( CONST(0x0), XMM4, XMM4 ) /* ox | ox | ox | ox */ + MULPS( XMM0, XMM4 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ + + MOVSS( SRC(1), XMM5 ) /* oy */ + SHUFPS( CONST(0x0), XMM5, XMM5 ) /* oy | oy | oy | oy */ + MULPS( XMM1, XMM5 ) /* oy*m7 | oy*m6 | oy*m5 | oy*m4 */ + + MOVSS( SRC(2), XMM6 ) /* oz */ + SHUFPS( CONST(0x0), XMM6, XMM6 ) /* oz | oz | oz | oz */ + MULPS( XMM2, XMM6 ) /* oz*m11 | oz*m10 | oz*m9 | oz*m8 */ + + MOVSS( SRC(3), XMM7 ) /* ow */ + SHUFPS( CONST(0x0), XMM7, XMM7 ) /* ow | ow | ow | ow */ + MULPS( XMM3, XMM7 ) /* ow*m15 | ow*m14 | ow*m13 | ow*m12 */ + + ADDPS( XMM5, XMM4 ) /* ox*m3+oy*m7 | ... */ + ADDPS( XMM6, XMM4 ) /* ox*m3+oy*m7+oz*m11 | ... */ + ADDPS( XMM7, XMM4 ) /* ox*m3+oy*m7+oz*m11+ow*m15 | ... */ + MOVAPS( XMM4, DST(0) ) /* ->D(3) | ->D(2) | ->D(1) | ->D(0) */ + + MOVSS( SRC(3), XMM4 ) /* ow */ + MOVSS( XMM4, DST(3) ) /* ->D(3) */ + +LLBL( K_GTP43P3DR_skip ): + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(K_GTP43P3DR_top) ) + +LLBL( K_GTP43P3DR_finish ): + POP_L( EDI ) + POP_L( ESI ) + RET + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_sse_transform_points4_identity ) +HIDDEN(_mesa_sse_transform_points4_identity) +GLNAME( _mesa_sse_transform_points4_identity ): + + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) /* verify non-zero count */ + JE( LLBL( sse_identity_done ) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) )/* set dest size */ + + MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ + MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ + +ALIGNTEXT16 +LLBL( sse_identity_loop ): + + PREFETCHNTA( REGOFF(32, ESI) ) + + MOVAPS( REGIND(ESI), XMM0 ) + ADD_L( EAX, ESI ) + + MOVAPS( XMM0, REGIND(EDI) ) + ADD_L( CONST(16), EDI ) + + DEC_L( ECX ) + JNZ( LLBL( sse_identity_loop ) ) + +LLBL( sse_identity_done ): + + POP_L( EDI ) + POP_L( ESI ) + RET +#endif + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/x86_cliptest.S b/mesalib/src/mesa/x86/x86_cliptest.S index 8556a887a..e413aee61 100644 --- a/mesalib/src/mesa/x86/x86_cliptest.S +++ b/mesalib/src/mesa/x86/x86_cliptest.S @@ -1,407 +1,407 @@ - -/* - * 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. - */ - -/* - * NOTE: Avoid using spaces in between '(' ')' and arguments, especially - * with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces - * in there will break the build on some platforms. - */ - -#include "assyntax.h" -#include "matypes.h" -#include "clip_args.h" - -#define SRC0 REGOFF(0, ESI) -#define SRC1 REGOFF(4, ESI) -#define SRC2 REGOFF(8, ESI) -#define SRC3 REGOFF(12, ESI) -#define DST0 REGOFF(0, EDI) -#define DST1 REGOFF(4, EDI) -#define DST2 REGOFF(8, EDI) -#define DST3 REGOFF(12, EDI) -#define MAT0 REGOFF(0, EDX) -#define MAT1 REGOFF(4, EDX) -#define MAT2 REGOFF(8, EDX) -#define MAT3 REGOFF(12, EDX) - - -/* - * Table for clip test. - * - * bit6 = SRC3 < 0 - * bit5 = SRC2 < 0 - * bit4 = abs(S(2)) > abs(S(3)) - * bit3 = SRC1 < 0 - * bit2 = abs(S(1)) > abs(S(3)) - * bit1 = SRC0 < 0 - * bit0 = abs(S(0)) > abs(S(3)) - */ - - SEG_DATA - -clip_table: - D_BYTE 0x00, 0x01, 0x00, 0x02, 0x04, 0x05, 0x04, 0x06 - D_BYTE 0x00, 0x01, 0x00, 0x02, 0x08, 0x09, 0x08, 0x0a - D_BYTE 0x20, 0x21, 0x20, 0x22, 0x24, 0x25, 0x24, 0x26 - D_BYTE 0x20, 0x21, 0x20, 0x22, 0x28, 0x29, 0x28, 0x2a - D_BYTE 0x00, 0x01, 0x00, 0x02, 0x04, 0x05, 0x04, 0x06 - D_BYTE 0x00, 0x01, 0x00, 0x02, 0x08, 0x09, 0x08, 0x0a - D_BYTE 0x10, 0x11, 0x10, 0x12, 0x14, 0x15, 0x14, 0x16 - D_BYTE 0x10, 0x11, 0x10, 0x12, 0x18, 0x19, 0x18, 0x1a - D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x37, 0x35, 0x37, 0x36 - D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x3b, 0x39, 0x3b, 0x3a - D_BYTE 0x2f, 0x2d, 0x2f, 0x2e, 0x27, 0x25, 0x27, 0x26 - D_BYTE 0x2f, 0x2d, 0x2f, 0x2e, 0x2b, 0x29, 0x2b, 0x2a - D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x37, 0x35, 0x37, 0x36 - D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x3b, 0x39, 0x3b, 0x3a - D_BYTE 0x1f, 0x1d, 0x1f, 0x1e, 0x17, 0x15, 0x17, 0x16 - D_BYTE 0x1f, 0x1d, 0x1f, 0x1e, 0x1b, 0x19, 0x1b, 0x1a - - - SEG_TEXT - -/* - * _mesa_x86_cliptest_points4 - * - * AL: ormask - * AH: andmask - * EBX: temp0 - * ECX: temp1 - * EDX: clipmask[] - * ESI: clip[] - * EDI: proj[] - * EBP: temp2 - */ - -#if defined(__ELF__) && defined(__PIC__) && defined(GNU_ASSEMBLER) && !defined(ELFPIC) -#define ELFPIC -#endif - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_cliptest_points4 ) -HIDDEN(_mesa_x86_cliptest_points4) -GLNAME( _mesa_x86_cliptest_points4 ): - -#ifdef ELFPIC -#define FRAME_OFFSET 20 -#else -#define FRAME_OFFSET 16 -#endif - PUSH_L( ESI ) - PUSH_L( EDI ) - PUSH_L( EBP ) - PUSH_L( EBX ) - -#ifdef ELFPIC - /* store pointer to clip_table on stack */ - CALL( LLBL(ctp4_get_eip) ) - ADD_L( CONST(_GLOBAL_OFFSET_TABLE_), EBX ) - MOV_L( REGOFF(clip_table@GOT, EBX), EBX ) - PUSH_L( EBX ) - JMP( LLBL(ctp4_clip_table_ready) ) - -LLBL(ctp4_get_eip): - /* store eip in ebx */ - MOV_L( REGIND(ESP), EBX ) - RET - -LLBL(ctp4_clip_table_ready): -#endif - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_CLIP, EDX ) - MOV_L( ARG_OR, EBX ) - - MOV_L( ARG_AND, EBP ) - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) - MOV_L( EAX, ARG_SOURCE ) /* put stride in ARG_SOURCE */ - - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDX, ECX ) - - MOV_L( ECX, ARG_CLIP ) /* put clipmask + count in ARG_CLIP */ - CMP_L( ECX, EDX ) - - MOV_B( REGIND(EBX), AL ) - MOV_B( REGIND(EBP), AH ) - - JZ( LLBL(ctp4_finish) ) - -ALIGNTEXT16 -LLBL(ctp4_top): - - FLD1 /* F3 */ - FDIV_S( SRC3 ) /* GH: don't care about div-by-zero */ - - MOV_L( SRC3, EBP ) - MOV_L( SRC2, EBX ) - - XOR_L( ECX, ECX ) - ADD_L( EBP, EBP ) /* ebp = abs(S(3))*2 ; carry = sign of S(3) */ - - ADC_L( ECX, ECX ) - ADD_L( EBX, EBX ) /* ebx = abs(S(2))*2 ; carry = sign of S(2) */ - - ADC_L( ECX, ECX ) - CMP_L( EBX, EBP ) /* carry = abs(S(2))*2 > abs(S(3))*2 */ - - ADC_L( ECX, ECX ) - MOV_L( SRC1, EBX ) - - ADD_L( EBX, EBX ) /* ebx = abs(S(1))*2 ; carry = sign of S(1) */ - - ADC_L( ECX, ECX ) - CMP_L( EBX, EBP ) /* carry = abs(S(1))*2 > abs(S(3))*2 */ - - ADC_L( ECX, ECX ) - MOV_L( SRC0, EBX ) - - ADD_L( EBX, EBX ) /* ebx = abs(S(0))*2 ; carry = sign of S(0) */ - - ADC_L( ECX, ECX ) - CMP_L( EBX, EBP ) /* carry = abs(S(0))*2 > abs(S(3))*2 */ - - ADC_L( ECX, ECX ) - -#ifdef ELFPIC - MOV_L( REGIND(ESP), EBP ) /* clip_table */ - - MOV_B( REGBI(EBP, ECX), CL ) -#else - MOV_B( REGOFF(clip_table,ECX), CL ) -#endif - - OR_B( CL, AL ) - AND_B( CL, AH ) - - TEST_B( CL, CL ) - MOV_B( CL, REGIND(EDX) ) - - JZ( LLBL(ctp4_proj) ) - -LLBL(ctp4_noproj): - - FSTP( ST(0) ) /* */ - - MOV_L( CONST(0), DST0 ) - MOV_L( CONST(0), DST1 ) - MOV_L( CONST(0), DST2 ) - MOV_L( CONST(0x3f800000), DST3 ) - - JMP( LLBL(ctp4_next) ) - -LLBL(ctp4_proj): - - FLD_S( SRC0 ) /* F0 F3 */ - FMUL2( ST(1), ST0 ) - - FLD_S( SRC1 ) /* F1 F0 F3 */ - FMUL2( ST(2), ST0 ) - - FLD_S( SRC2 ) /* F2 F1 F0 F3 */ - FMUL2( ST(3), ST0 ) - - FXCH( ST(2) ) /* F0 F1 F2 F3 */ - FSTP_S( DST0 ) /* F1 F2 F3 */ - FSTP_S( DST1 ) /* F2 F3 */ - FSTP_S( DST2 ) /* F3 */ - FSTP_S( DST3 ) /* */ - -LLBL(ctp4_next): - - INC_L( EDX ) - ADD_L( CONST(16), EDI ) - - ADD_L( ARG_SOURCE, ESI ) - CMP_L( EDX, ARG_CLIP ) - - JNZ( LLBL(ctp4_top) ) - - MOV_L( ARG_OR, ECX ) - MOV_L( ARG_AND, EDX ) - - MOV_B( AL, REGIND(ECX) ) - MOV_B( AH, REGIND(EDX) ) - -LLBL(ctp4_finish): - - MOV_L( ARG_DEST, EAX ) -#ifdef ELFPIC - POP_L( ESI ) /* discard ptr to clip_table */ -#endif - POP_L( EBX ) - POP_L( EBP ) - POP_L( EDI ) - POP_L( ESI ) - - RET - - - - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_cliptest_points4_np ) -HIDDEN(_mesa_x86_cliptest_points4_np) -GLNAME( _mesa_x86_cliptest_points4_np ): - -#ifdef ELFPIC -#define FRAME_OFFSET 20 -#else -#define FRAME_OFFSET 16 -#endif - PUSH_L( ESI ) - PUSH_L( EDI ) - PUSH_L( EBP ) - PUSH_L( EBX ) - -#ifdef ELFPIC - /* store pointer to clip_table on stack */ - CALL( LLBL(ctp4_np_get_eip) ) - ADD_L( CONST(_GLOBAL_OFFSET_TABLE_), EBX ) - MOV_L( REGOFF(clip_table@GOT, EBX), EBX ) - PUSH_L( EBX ) - JMP( LLBL(ctp4_np_clip_table_ready) ) - -LLBL(ctp4_np_get_eip): - /* store eip in ebx */ - MOV_L( REGIND(ESP), EBX ) - RET - -LLBL(ctp4_np_clip_table_ready): -#endif - - MOV_L( ARG_SOURCE, ESI ) - /* slot */ - - MOV_L( ARG_CLIP, EDX ) - MOV_L( ARG_OR, EBX ) - - MOV_L( ARG_AND, EBP ) - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( EAX, ARG_DEST ) /* put stride in ARG_DEST */ - ADD_L( EDX, ECX ) - - MOV_L( ECX, EDI ) /* put clipmask + count in EDI */ - CMP_L( ECX, EDX ) - - MOV_B( REGIND(EBX), AL ) - MOV_B( REGIND(EBP), AH ) - - JZ( LLBL(ctp4_np_finish) ) - -ALIGNTEXT16 -LLBL(ctp4_np_top): - - MOV_L( SRC3, EBP ) - MOV_L( SRC2, EBX ) - - XOR_L( ECX, ECX ) - ADD_L( EBP, EBP ) /* ebp = abs(S(3))*2 ; carry = sign of S(3) */ - - ADC_L( ECX, ECX ) - ADD_L( EBX, EBX ) /* ebx = abs(S(2))*2 ; carry = sign of S(2) */ - - ADC_L( ECX, ECX ) - CMP_L( EBX, EBP ) /* carry = abs(S(2))*2 > abs(S(3))*2 */ - - ADC_L( ECX, ECX ) - MOV_L( SRC1, EBX ) - - ADD_L( EBX, EBX ) /* ebx = abs(S(1))*2 ; carry = sign of S(1) */ - - ADC_L( ECX, ECX ) - CMP_L( EBX, EBP ) /* carry = abs(S(1))*2 > abs(S(3))*2 */ - - ADC_L( ECX, ECX ) - MOV_L( SRC0, EBX ) - - ADD_L( EBX, EBX ) /* ebx = abs(S(0))*2 ; carry = sign of S(0) */ - - ADC_L( ECX, ECX ) - CMP_L( EBX, EBP ) /* carry = abs(S(0))*2 > abs(S(3))*2 */ - - ADC_L( ECX, ECX ) - -#ifdef ELFPIC - MOV_L( REGIND(ESP), EBP ) /* clip_table */ - - MOV_B( REGBI(EBP, ECX), CL ) -#else - MOV_B( REGOFF(clip_table,ECX), CL ) -#endif - - OR_B( CL, AL ) - AND_B( CL, AH ) - - TEST_B( CL, CL ) - MOV_B( CL, REGIND(EDX) ) - - INC_L( EDX ) - /* slot */ - - ADD_L( ARG_DEST, ESI ) - CMP_L( EDX, EDI ) - - JNZ( LLBL(ctp4_np_top) ) - - MOV_L( ARG_OR, ECX ) - MOV_L( ARG_AND, EDX ) - - MOV_B( AL, REGIND(ECX) ) - MOV_B( AH, REGIND(EDX) ) - -LLBL(ctp4_np_finish): - - MOV_L( ARG_SOURCE, EAX ) -#ifdef ELFPIC - POP_L( ESI ) /* discard ptr to clip_table */ -#endif - POP_L( EBX ) - POP_L( EBP ) - POP_L( EDI ) - POP_L( ESI ) - - RET - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif + +/* + * 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. + */ + +/* + * NOTE: Avoid using spaces in between '(' ')' and arguments, especially + * with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces + * in there will break the build on some platforms. + */ + +#include "assyntax.h" +#include "matypes.h" +#include "clip_args.h" + +#define SRC0 REGOFF(0, ESI) +#define SRC1 REGOFF(4, ESI) +#define SRC2 REGOFF(8, ESI) +#define SRC3 REGOFF(12, ESI) +#define DST0 REGOFF(0, EDI) +#define DST1 REGOFF(4, EDI) +#define DST2 REGOFF(8, EDI) +#define DST3 REGOFF(12, EDI) +#define MAT0 REGOFF(0, EDX) +#define MAT1 REGOFF(4, EDX) +#define MAT2 REGOFF(8, EDX) +#define MAT3 REGOFF(12, EDX) + + +/* + * Table for clip test. + * + * bit6 = SRC3 < 0 + * bit5 = SRC2 < 0 + * bit4 = abs(S(2)) > abs(S(3)) + * bit3 = SRC1 < 0 + * bit2 = abs(S(1)) > abs(S(3)) + * bit1 = SRC0 < 0 + * bit0 = abs(S(0)) > abs(S(3)) + */ + + SEG_DATA + +clip_table: + D_BYTE 0x00, 0x01, 0x00, 0x02, 0x04, 0x05, 0x04, 0x06 + D_BYTE 0x00, 0x01, 0x00, 0x02, 0x08, 0x09, 0x08, 0x0a + D_BYTE 0x20, 0x21, 0x20, 0x22, 0x24, 0x25, 0x24, 0x26 + D_BYTE 0x20, 0x21, 0x20, 0x22, 0x28, 0x29, 0x28, 0x2a + D_BYTE 0x00, 0x01, 0x00, 0x02, 0x04, 0x05, 0x04, 0x06 + D_BYTE 0x00, 0x01, 0x00, 0x02, 0x08, 0x09, 0x08, 0x0a + D_BYTE 0x10, 0x11, 0x10, 0x12, 0x14, 0x15, 0x14, 0x16 + D_BYTE 0x10, 0x11, 0x10, 0x12, 0x18, 0x19, 0x18, 0x1a + D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x37, 0x35, 0x37, 0x36 + D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x3b, 0x39, 0x3b, 0x3a + D_BYTE 0x2f, 0x2d, 0x2f, 0x2e, 0x27, 0x25, 0x27, 0x26 + D_BYTE 0x2f, 0x2d, 0x2f, 0x2e, 0x2b, 0x29, 0x2b, 0x2a + D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x37, 0x35, 0x37, 0x36 + D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x3b, 0x39, 0x3b, 0x3a + D_BYTE 0x1f, 0x1d, 0x1f, 0x1e, 0x17, 0x15, 0x17, 0x16 + D_BYTE 0x1f, 0x1d, 0x1f, 0x1e, 0x1b, 0x19, 0x1b, 0x1a + + + SEG_TEXT + +/* + * _mesa_x86_cliptest_points4 + * + * AL: ormask + * AH: andmask + * EBX: temp0 + * ECX: temp1 + * EDX: clipmask[] + * ESI: clip[] + * EDI: proj[] + * EBP: temp2 + */ + +#if defined(__ELF__) && defined(__PIC__) && defined(GNU_ASSEMBLER) && !defined(ELFPIC) +#define ELFPIC +#endif + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_cliptest_points4 ) +HIDDEN(_mesa_x86_cliptest_points4) +GLNAME( _mesa_x86_cliptest_points4 ): + +#ifdef ELFPIC +#define FRAME_OFFSET 20 +#else +#define FRAME_OFFSET 16 +#endif + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBP ) + PUSH_L( EBX ) + +#ifdef ELFPIC + /* store pointer to clip_table on stack */ + CALL( LLBL(ctp4_get_eip) ) + ADD_L( CONST(_GLOBAL_OFFSET_TABLE_), EBX ) + MOV_L( REGOFF(clip_table@GOT, EBX), EBX ) + PUSH_L( EBX ) + JMP( LLBL(ctp4_clip_table_ready) ) + +LLBL(ctp4_get_eip): + /* store eip in ebx */ + MOV_L( REGIND(ESP), EBX ) + RET + +LLBL(ctp4_clip_table_ready): +#endif + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_CLIP, EDX ) + MOV_L( ARG_OR, EBX ) + + MOV_L( ARG_AND, EBP ) + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + MOV_L( EAX, ARG_SOURCE ) /* put stride in ARG_SOURCE */ + + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDX, ECX ) + + MOV_L( ECX, ARG_CLIP ) /* put clipmask + count in ARG_CLIP */ + CMP_L( ECX, EDX ) + + MOV_B( REGIND(EBX), AL ) + MOV_B( REGIND(EBP), AH ) + + JZ( LLBL(ctp4_finish) ) + +ALIGNTEXT16 +LLBL(ctp4_top): + + FLD1 /* F3 */ + FDIV_S( SRC3 ) /* GH: don't care about div-by-zero */ + + MOV_L( SRC3, EBP ) + MOV_L( SRC2, EBX ) + + XOR_L( ECX, ECX ) + ADD_L( EBP, EBP ) /* ebp = abs(S(3))*2 ; carry = sign of S(3) */ + + ADC_L( ECX, ECX ) + ADD_L( EBX, EBX ) /* ebx = abs(S(2))*2 ; carry = sign of S(2) */ + + ADC_L( ECX, ECX ) + CMP_L( EBX, EBP ) /* carry = abs(S(2))*2 > abs(S(3))*2 */ + + ADC_L( ECX, ECX ) + MOV_L( SRC1, EBX ) + + ADD_L( EBX, EBX ) /* ebx = abs(S(1))*2 ; carry = sign of S(1) */ + + ADC_L( ECX, ECX ) + CMP_L( EBX, EBP ) /* carry = abs(S(1))*2 > abs(S(3))*2 */ + + ADC_L( ECX, ECX ) + MOV_L( SRC0, EBX ) + + ADD_L( EBX, EBX ) /* ebx = abs(S(0))*2 ; carry = sign of S(0) */ + + ADC_L( ECX, ECX ) + CMP_L( EBX, EBP ) /* carry = abs(S(0))*2 > abs(S(3))*2 */ + + ADC_L( ECX, ECX ) + +#ifdef ELFPIC + MOV_L( REGIND(ESP), EBP ) /* clip_table */ + + MOV_B( REGBI(EBP, ECX), CL ) +#else + MOV_B( REGOFF(clip_table,ECX), CL ) +#endif + + OR_B( CL, AL ) + AND_B( CL, AH ) + + TEST_B( CL, CL ) + MOV_B( CL, REGIND(EDX) ) + + JZ( LLBL(ctp4_proj) ) + +LLBL(ctp4_noproj): + + FSTP( ST(0) ) /* */ + + MOV_L( CONST(0), DST0 ) + MOV_L( CONST(0), DST1 ) + MOV_L( CONST(0), DST2 ) + MOV_L( CONST(0x3f800000), DST3 ) + + JMP( LLBL(ctp4_next) ) + +LLBL(ctp4_proj): + + FLD_S( SRC0 ) /* F0 F3 */ + FMUL2( ST(1), ST0 ) + + FLD_S( SRC1 ) /* F1 F0 F3 */ + FMUL2( ST(2), ST0 ) + + FLD_S( SRC2 ) /* F2 F1 F0 F3 */ + FMUL2( ST(3), ST0 ) + + FXCH( ST(2) ) /* F0 F1 F2 F3 */ + FSTP_S( DST0 ) /* F1 F2 F3 */ + FSTP_S( DST1 ) /* F2 F3 */ + FSTP_S( DST2 ) /* F3 */ + FSTP_S( DST3 ) /* */ + +LLBL(ctp4_next): + + INC_L( EDX ) + ADD_L( CONST(16), EDI ) + + ADD_L( ARG_SOURCE, ESI ) + CMP_L( EDX, ARG_CLIP ) + + JNZ( LLBL(ctp4_top) ) + + MOV_L( ARG_OR, ECX ) + MOV_L( ARG_AND, EDX ) + + MOV_B( AL, REGIND(ECX) ) + MOV_B( AH, REGIND(EDX) ) + +LLBL(ctp4_finish): + + MOV_L( ARG_DEST, EAX ) +#ifdef ELFPIC + POP_L( ESI ) /* discard ptr to clip_table */ +#endif + POP_L( EBX ) + POP_L( EBP ) + POP_L( EDI ) + POP_L( ESI ) + + RET + + + + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_cliptest_points4_np ) +HIDDEN(_mesa_x86_cliptest_points4_np) +GLNAME( _mesa_x86_cliptest_points4_np ): + +#ifdef ELFPIC +#define FRAME_OFFSET 20 +#else +#define FRAME_OFFSET 16 +#endif + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBP ) + PUSH_L( EBX ) + +#ifdef ELFPIC + /* store pointer to clip_table on stack */ + CALL( LLBL(ctp4_np_get_eip) ) + ADD_L( CONST(_GLOBAL_OFFSET_TABLE_), EBX ) + MOV_L( REGOFF(clip_table@GOT, EBX), EBX ) + PUSH_L( EBX ) + JMP( LLBL(ctp4_np_clip_table_ready) ) + +LLBL(ctp4_np_get_eip): + /* store eip in ebx */ + MOV_L( REGIND(ESP), EBX ) + RET + +LLBL(ctp4_np_clip_table_ready): +#endif + + MOV_L( ARG_SOURCE, ESI ) + /* slot */ + + MOV_L( ARG_CLIP, EDX ) + MOV_L( ARG_OR, EBX ) + + MOV_L( ARG_AND, EBP ) + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( EAX, ARG_DEST ) /* put stride in ARG_DEST */ + ADD_L( EDX, ECX ) + + MOV_L( ECX, EDI ) /* put clipmask + count in EDI */ + CMP_L( ECX, EDX ) + + MOV_B( REGIND(EBX), AL ) + MOV_B( REGIND(EBP), AH ) + + JZ( LLBL(ctp4_np_finish) ) + +ALIGNTEXT16 +LLBL(ctp4_np_top): + + MOV_L( SRC3, EBP ) + MOV_L( SRC2, EBX ) + + XOR_L( ECX, ECX ) + ADD_L( EBP, EBP ) /* ebp = abs(S(3))*2 ; carry = sign of S(3) */ + + ADC_L( ECX, ECX ) + ADD_L( EBX, EBX ) /* ebx = abs(S(2))*2 ; carry = sign of S(2) */ + + ADC_L( ECX, ECX ) + CMP_L( EBX, EBP ) /* carry = abs(S(2))*2 > abs(S(3))*2 */ + + ADC_L( ECX, ECX ) + MOV_L( SRC1, EBX ) + + ADD_L( EBX, EBX ) /* ebx = abs(S(1))*2 ; carry = sign of S(1) */ + + ADC_L( ECX, ECX ) + CMP_L( EBX, EBP ) /* carry = abs(S(1))*2 > abs(S(3))*2 */ + + ADC_L( ECX, ECX ) + MOV_L( SRC0, EBX ) + + ADD_L( EBX, EBX ) /* ebx = abs(S(0))*2 ; carry = sign of S(0) */ + + ADC_L( ECX, ECX ) + CMP_L( EBX, EBP ) /* carry = abs(S(0))*2 > abs(S(3))*2 */ + + ADC_L( ECX, ECX ) + +#ifdef ELFPIC + MOV_L( REGIND(ESP), EBP ) /* clip_table */ + + MOV_B( REGBI(EBP, ECX), CL ) +#else + MOV_B( REGOFF(clip_table,ECX), CL ) +#endif + + OR_B( CL, AL ) + AND_B( CL, AH ) + + TEST_B( CL, CL ) + MOV_B( CL, REGIND(EDX) ) + + INC_L( EDX ) + /* slot */ + + ADD_L( ARG_DEST, ESI ) + CMP_L( EDX, EDI ) + + JNZ( LLBL(ctp4_np_top) ) + + MOV_L( ARG_OR, ECX ) + MOV_L( ARG_AND, EDX ) + + MOV_B( AL, REGIND(ECX) ) + MOV_B( AH, REGIND(EDX) ) + +LLBL(ctp4_np_finish): + + MOV_L( ARG_SOURCE, EAX ) +#ifdef ELFPIC + POP_L( ESI ) /* discard ptr to clip_table */ +#endif + POP_L( EBX ) + POP_L( EBP ) + POP_L( EDI ) + POP_L( ESI ) + + RET + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/x86_xform.c b/mesalib/src/mesa/x86/x86_xform.c index 57b10c262..3dcc55e16 100644 --- a/mesalib/src/mesa/x86/x86_xform.c +++ b/mesalib/src/mesa/x86/x86_xform.c @@ -1,126 +1,126 @@ - -/* - * 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. - */ - -/* - * Intel x86 assembly code by Josh Vanderhoof - */ - -#include "main/glheader.h" -#include "main/context.h" -#include "math/m_xform.h" - -#include "x86_xform.h" -#include "common_x86_asm.h" - -#ifdef USE_X86_ASM -#ifdef USE_3DNOW_ASM -#include "3dnow.h" -#endif -#ifdef USE_SSE_ASM -#include "sse.h" -#endif -#endif - -#ifdef DEBUG_MATH -#include "math/m_debug.h" -#endif - - -#ifdef USE_X86_ASM -DECLARE_XFORM_GROUP( x86, 2 ) -DECLARE_XFORM_GROUP( x86, 3 ) -DECLARE_XFORM_GROUP( x86, 4 ) - - -extern GLvector4f * _ASMAPI -_mesa_x86_cliptest_points4( GLvector4f *clip_vec, - GLvector4f *proj_vec, - GLubyte clipMask[], - GLubyte *orMask, - GLubyte *andMask, - GLboolean viewport_z_clip ); - -extern GLvector4f * _ASMAPI -_mesa_x86_cliptest_points4_np( GLvector4f *clip_vec, - GLvector4f *proj_vec, - GLubyte clipMask[], - GLubyte *orMask, - GLubyte *andMask, - GLboolean viewport_z_clip ); - -extern void _ASMAPI -_mesa_v16_x86_cliptest_points4( GLfloat *first_vert, - GLfloat *last_vert, - GLubyte *or_mask, - GLubyte *and_mask, - GLubyte *clip_mask, - GLboolean viewport_z_clip ); - -extern void _ASMAPI -_mesa_v16_x86_general_xform( GLfloat *dest, - const GLfloat *m, - const GLfloat *src, - GLuint src_stride, - GLuint count ); -#endif - - -#ifdef USE_X86_ASM -static void _mesa_init_x86_transform_asm( void ) -{ - ASSIGN_XFORM_GROUP( x86, 2 ); - ASSIGN_XFORM_GROUP( x86, 3 ); - ASSIGN_XFORM_GROUP( x86, 4 ); - - _mesa_clip_tab[4] = _mesa_x86_cliptest_points4; - _mesa_clip_np_tab[4] = _mesa_x86_cliptest_points4_np; - -#ifdef DEBUG_MATH - _math_test_all_transform_functions( "x86" ); - _math_test_all_cliptest_functions( "x86" ); -#endif -} -#endif - - -void _mesa_init_all_x86_transform_asm( void ) -{ - _mesa_get_x86_features(); - -#ifdef USE_X86_ASM - if ( _mesa_x86_cpu_features ) { - _mesa_init_x86_transform_asm(); - } - - if (cpu_has_3dnow) { - _mesa_init_3dnow_transform_asm(); - } - - if ( cpu_has_xmm ) { - _mesa_init_sse_transform_asm(); - } - -#endif -} + +/* + * 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. + */ + +/* + * Intel x86 assembly code by Josh Vanderhoof + */ + +#include "main/glheader.h" +#include "main/context.h" +#include "math/m_xform.h" + +#include "x86_xform.h" +#include "common_x86_asm.h" + +#ifdef USE_X86_ASM +#ifdef USE_3DNOW_ASM +#include "3dnow.h" +#endif +#ifdef USE_SSE_ASM +#include "sse.h" +#endif +#endif + +#ifdef DEBUG_MATH +#include "math/m_debug.h" +#endif + + +#ifdef USE_X86_ASM +DECLARE_XFORM_GROUP( x86, 2 ) +DECLARE_XFORM_GROUP( x86, 3 ) +DECLARE_XFORM_GROUP( x86, 4 ) + + +extern GLvector4f * _ASMAPI +_mesa_x86_cliptest_points4( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask, + GLboolean viewport_z_clip ); + +extern GLvector4f * _ASMAPI +_mesa_x86_cliptest_points4_np( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask, + GLboolean viewport_z_clip ); + +extern void _ASMAPI +_mesa_v16_x86_cliptest_points4( GLfloat *first_vert, + GLfloat *last_vert, + GLubyte *or_mask, + GLubyte *and_mask, + GLubyte *clip_mask, + GLboolean viewport_z_clip ); + +extern void _ASMAPI +_mesa_v16_x86_general_xform( GLfloat *dest, + const GLfloat *m, + const GLfloat *src, + GLuint src_stride, + GLuint count ); +#endif + + +#ifdef USE_X86_ASM +static void _mesa_init_x86_transform_asm( void ) +{ + ASSIGN_XFORM_GROUP( x86, 2 ); + ASSIGN_XFORM_GROUP( x86, 3 ); + ASSIGN_XFORM_GROUP( x86, 4 ); + + _mesa_clip_tab[4] = _mesa_x86_cliptest_points4; + _mesa_clip_np_tab[4] = _mesa_x86_cliptest_points4_np; + +#ifdef DEBUG_MATH + _math_test_all_transform_functions( "x86" ); + _math_test_all_cliptest_functions( "x86" ); +#endif +} +#endif + + +void _mesa_init_all_x86_transform_asm( void ) +{ + _mesa_get_x86_features(); + +#ifdef USE_X86_ASM + if ( _mesa_x86_cpu_features ) { + _mesa_init_x86_transform_asm(); + } + + if (cpu_has_3dnow) { + _mesa_init_3dnow_transform_asm(); + } + + if ( cpu_has_xmm ) { + _mesa_init_sse_transform_asm(); + } + +#endif +} diff --git a/mesalib/src/mesa/x86/x86_xform.h b/mesalib/src/mesa/x86/x86_xform.h index 055fd6a1f..e886d9add 100644 --- a/mesalib/src/mesa/x86/x86_xform.h +++ b/mesalib/src/mesa/x86/x86_xform.h @@ -1,106 +1,106 @@ - -/* - * 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: - * Gareth Hughes - */ - -#ifndef X86_XFORM_H -#define X86_XFORM_H - - -/* ============================================================= - * Transformation function declarations: - */ - -#define XFORM_ARGS GLvector4f *to_vec, \ - const GLfloat m[16], \ - const GLvector4f *from_vec - -#define DECLARE_XFORM_GROUP( pfx, sz ) \ -extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general( XFORM_ARGS ); \ -extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity( XFORM_ARGS ); \ -extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot( XFORM_ARGS ); \ -extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective( XFORM_ARGS ); \ -extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d( XFORM_ARGS ); \ -extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot( XFORM_ARGS ); \ -extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d( XFORM_ARGS ); - -#define ASSIGN_XFORM_GROUP( pfx, sz ) \ - _mesa_transform_tab[sz][MATRIX_GENERAL] = \ - _mesa_##pfx##_transform_points##sz##_general; \ - _mesa_transform_tab[sz][MATRIX_IDENTITY] = \ - _mesa_##pfx##_transform_points##sz##_identity; \ - _mesa_transform_tab[sz][MATRIX_3D_NO_ROT] = \ - _mesa_##pfx##_transform_points##sz##_3d_no_rot; \ - _mesa_transform_tab[sz][MATRIX_PERSPECTIVE] = \ - _mesa_##pfx##_transform_points##sz##_perspective; \ - _mesa_transform_tab[sz][MATRIX_2D] = \ - _mesa_##pfx##_transform_points##sz##_2d; \ - _mesa_transform_tab[sz][MATRIX_2D_NO_ROT] = \ - _mesa_##pfx##_transform_points##sz##_2d_no_rot; \ - _mesa_transform_tab[sz][MATRIX_3D] = \ - _mesa_##pfx##_transform_points##sz##_3d; - - -/* ============================================================= - * Normal transformation function declarations: - */ - -#define NORM_ARGS const GLmatrix *mat, \ - GLfloat scale, \ - const GLvector4f *in, \ - const GLfloat *lengths, \ - GLvector4f *dest - -#define DECLARE_NORM_GROUP( pfx ) \ -extern void _ASMAPI _mesa_##pfx##_rescale_normals( NORM_ARGS ); \ -extern void _ASMAPI _mesa_##pfx##_normalize_normals( NORM_ARGS ); \ -extern void _ASMAPI _mesa_##pfx##_transform_normals( NORM_ARGS ); \ -extern void _ASMAPI _mesa_##pfx##_transform_normals_no_rot( NORM_ARGS ); \ -extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals( NORM_ARGS ); \ -extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals_no_rot( NORM_ARGS ); \ -extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals( NORM_ARGS ); \ -extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals_no_rot( NORM_ARGS ); - -#define ASSIGN_NORM_GROUP( pfx ) \ - _mesa_normal_tab[NORM_RESCALE] = \ - _mesa_##pfx##_rescale_normals; \ - _mesa_normal_tab[NORM_NORMALIZE] = \ - _mesa_##pfx##_normalize_normals; \ - _mesa_normal_tab[NORM_TRANSFORM] = \ - _mesa_##pfx##_transform_normals; \ - _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = \ - _mesa_##pfx##_transform_normals_no_rot; \ - _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = \ - _mesa_##pfx##_transform_rescale_normals; \ - _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = \ - _mesa_##pfx##_transform_rescale_normals_no_rot; \ - _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] = \ - _mesa_##pfx##_transform_normalize_normals; \ - _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] = \ - _mesa_##pfx##_transform_normalize_normals_no_rot; - - -#endif + +/* + * 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: + * Gareth Hughes + */ + +#ifndef X86_XFORM_H +#define X86_XFORM_H + + +/* ============================================================= + * Transformation function declarations: + */ + +#define XFORM_ARGS GLvector4f *to_vec, \ + const GLfloat m[16], \ + const GLvector4f *from_vec + +#define DECLARE_XFORM_GROUP( pfx, sz ) \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d( XFORM_ARGS ); + +#define ASSIGN_XFORM_GROUP( pfx, sz ) \ + _mesa_transform_tab[sz][MATRIX_GENERAL] = \ + _mesa_##pfx##_transform_points##sz##_general; \ + _mesa_transform_tab[sz][MATRIX_IDENTITY] = \ + _mesa_##pfx##_transform_points##sz##_identity; \ + _mesa_transform_tab[sz][MATRIX_3D_NO_ROT] = \ + _mesa_##pfx##_transform_points##sz##_3d_no_rot; \ + _mesa_transform_tab[sz][MATRIX_PERSPECTIVE] = \ + _mesa_##pfx##_transform_points##sz##_perspective; \ + _mesa_transform_tab[sz][MATRIX_2D] = \ + _mesa_##pfx##_transform_points##sz##_2d; \ + _mesa_transform_tab[sz][MATRIX_2D_NO_ROT] = \ + _mesa_##pfx##_transform_points##sz##_2d_no_rot; \ + _mesa_transform_tab[sz][MATRIX_3D] = \ + _mesa_##pfx##_transform_points##sz##_3d; + + +/* ============================================================= + * Normal transformation function declarations: + */ + +#define NORM_ARGS const GLmatrix *mat, \ + GLfloat scale, \ + const GLvector4f *in, \ + const GLfloat *lengths, \ + GLvector4f *dest + +#define DECLARE_NORM_GROUP( pfx ) \ +extern void _ASMAPI _mesa_##pfx##_rescale_normals( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_normalize_normals( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_normals( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_normals_no_rot( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals_no_rot( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals_no_rot( NORM_ARGS ); + +#define ASSIGN_NORM_GROUP( pfx ) \ + _mesa_normal_tab[NORM_RESCALE] = \ + _mesa_##pfx##_rescale_normals; \ + _mesa_normal_tab[NORM_NORMALIZE] = \ + _mesa_##pfx##_normalize_normals; \ + _mesa_normal_tab[NORM_TRANSFORM] = \ + _mesa_##pfx##_transform_normals; \ + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = \ + _mesa_##pfx##_transform_normals_no_rot; \ + _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = \ + _mesa_##pfx##_transform_rescale_normals; \ + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = \ + _mesa_##pfx##_transform_rescale_normals_no_rot; \ + _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] = \ + _mesa_##pfx##_transform_normalize_normals; \ + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] = \ + _mesa_##pfx##_transform_normalize_normals_no_rot; + + +#endif diff --git a/mesalib/src/mesa/x86/x86_xform2.S b/mesalib/src/mesa/x86/x86_xform2.S index 482035c1f..980725ef5 100644 --- a/mesalib/src/mesa/x86/x86_xform2.S +++ b/mesalib/src/mesa/x86/x86_xform2.S @@ -1,574 +1,574 @@ - -/* - * 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. - */ - -/* - * NOTE: Avoid using spaces in between '(' ')' and arguments, especially - * with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces - * in there will break the build on some platforms. - */ - -#include "assyntax.h" -#include "matypes.h" -#include "xform_args.h" - - SEG_TEXT - -#define FP_ONE 1065353216 -#define FP_ZERO 0 - -#define SRC0 REGOFF(0, ESI) -#define SRC1 REGOFF(4, ESI) -#define SRC2 REGOFF(8, ESI) -#define SRC3 REGOFF(12, ESI) -#define DST0 REGOFF(0, EDI) -#define DST1 REGOFF(4, EDI) -#define DST2 REGOFF(8, EDI) -#define DST3 REGOFF(12, EDI) -#define MAT0 REGOFF(0, EDX) -#define MAT1 REGOFF(4, EDX) -#define MAT2 REGOFF(8, EDX) -#define MAT3 REGOFF(12, EDX) -#define MAT4 REGOFF(16, EDX) -#define MAT5 REGOFF(20, EDX) -#define MAT6 REGOFF(24, EDX) -#define MAT7 REGOFF(28, EDX) -#define MAT8 REGOFF(32, EDX) -#define MAT9 REGOFF(36, EDX) -#define MAT10 REGOFF(40, EDX) -#define MAT11 REGOFF(44, EDX) -#define MAT12 REGOFF(48, EDX) -#define MAT13 REGOFF(52, EDX) -#define MAT14 REGOFF(56, EDX) -#define MAT15 REGOFF(60, EDX) - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points2_general ) -HIDDEN(_mesa_x86_transform_points2_general) -GLNAME( _mesa_x86_transform_points2_general ): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p2_gr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p2_gr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - FLD_S( SRC0 ) /* F5 F4 */ - FMUL_S( MAT1 ) - FLD_S( SRC0 ) /* F6 F5 F4 */ - FMUL_S( MAT2 ) - FLD_S( SRC0 ) /* F7 F6 F5 F4 */ - FMUL_S( MAT3 ) - - FLD_S( SRC1 ) /* F0 F7 F6 F5 F4 */ - FMUL_S( MAT4 ) - FLD_S( SRC1 ) /* F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT5 ) - FLD_S( SRC1 ) /* F2 F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT6 ) - FLD_S( SRC1 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT7 ) - - FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ - FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ - - FXCH( ST(3) ) /* F4 F6 F5 F7 */ - FADD_S( MAT12 ) - FXCH( ST(2) ) /* F5 F6 F4 F7 */ - FADD_S( MAT13 ) - FXCH( ST(1) ) /* F6 F5 F4 F7 */ - FADD_S( MAT14 ) - FXCH( ST(3) ) /* F7 F5 F4 F6 */ - FADD_S( MAT15 ) - - FXCH( ST(2) ) /* F4 F5 F7 F6 */ - FSTP_S( DST0 ) /* F5 F7 F6 */ - FSTP_S( DST1 ) /* F7 F6 */ - FXCH( ST(1) ) /* F6 F7 */ - FSTP_S( DST2 ) /* F7 */ - FSTP_S( DST3 ) /* */ - -LLBL(x86_p2_gr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p2_gr_loop) ) - -LLBL(x86_p2_gr_done): - - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points2_perspective ) -HIDDEN(_mesa_x86_transform_points2_perspective) -GLNAME( _mesa_x86_transform_points2_perspective ): - -#define FRAME_OFFSET 12 - PUSH_L( ESI ) - PUSH_L( EDI ) - PUSH_L( EBX ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p2_pr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - - MOV_L( MAT14, EBX ) - -ALIGNTEXT16 -LLBL(x86_p2_pr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - - FLD_S( SRC1 ) /* F1 F4 */ - FMUL_S( MAT5 ) - - FXCH( ST(1) ) /* F4 F1 */ - FSTP_S( DST0 ) /* F1 */ - FSTP_S( DST1 ) /* */ - MOV_L( EBX, DST2 ) - MOV_L( CONST(FP_ZERO), DST3 ) - -LLBL(x86_p2_pr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p2_pr_loop) ) - -LLBL(x86_p2_pr_done): - - POP_L( EBX ) - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points2_3d ) -HIDDEN(_mesa_x86_transform_points2_3d) -GLNAME( _mesa_x86_transform_points2_3d ): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p2_3dr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p2_3dr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - FLD_S( SRC0 ) /* F5 F4 */ - FMUL_S( MAT1 ) - FLD_S( SRC0 ) /* F6 F5 F4 */ - FMUL_S( MAT2 ) - - FLD_S( SRC1 ) /* F0 F6 F5 F4 */ - FMUL_S( MAT4 ) - FLD_S( SRC1 ) /* F1 F0 F6 F5 F4 */ - FMUL_S( MAT5 ) - FLD_S( SRC1 ) /* F2 F1 F0 F6 F5 F4 */ - FMUL_S( MAT6 ) - - FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ - FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ - FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ - FADDP( ST0, ST(1) ) /* F6 F5 F4 */ - - FXCH( ST(2) ) /* F4 F5 F6 */ - FADD_S( MAT12 ) - FXCH( ST(1) ) /* F5 F4 F6 */ - FADD_S( MAT13 ) - FXCH( ST(2) ) /* F6 F4 F5 */ - FADD_S( MAT14 ) - - FXCH( ST(1) ) /* F4 F6 F5 */ - FSTP_S( DST0 ) /* F6 F5 */ - FXCH( ST(1) ) /* F5 F6 */ - FSTP_S( DST1 ) /* F6 */ - FSTP_S( DST2 ) /* */ - -LLBL(x86_p2_3dr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p2_3dr_loop) ) - -LLBL(x86_p2_3dr_done): - - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points2_3d_no_rot ) -HIDDEN(_mesa_x86_transform_points2_3d_no_rot) -GLNAME( _mesa_x86_transform_points2_3d_no_rot ): - -#define FRAME_OFFSET 12 - PUSH_L( ESI ) - PUSH_L( EDI ) - PUSH_L( EBX ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p2_3dnrr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - - MOV_L( MAT14, EBX ) - -ALIGNTEXT16 -LLBL(x86_p2_3dnrr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - - FLD_S( SRC1 ) /* F1 F4 */ - FMUL_S( MAT5 ) - - FXCH( ST(1) ) /* F4 F1 */ - FADD_S( MAT12 ) - FLD_S( MAT13 ) /* F5 F4 F1 */ - FXCH( ST(2) ) /* F1 F4 F5 */ - FADDP( ST0, ST(2) ) /* F4 F5 */ - - FSTP_S( DST0 ) /* F5 */ - FSTP_S( DST1 ) /* */ - MOV_L( EBX, DST2 ) - -LLBL(x86_p2_3dnrr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p2_3dnrr_loop) ) - -LLBL(x86_p2_3dnrr_done): - - POP_L( EBX ) - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points2_2d ) -HIDDEN(_mesa_x86_transform_points2_2d) -GLNAME( _mesa_x86_transform_points2_2d ): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p2_2dr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p2_2dr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - FLD_S( SRC0 ) /* F5 F4 */ - FMUL_S( MAT1 ) - - FLD_S( SRC1 ) /* F0 F5 F4 */ - FMUL_S( MAT4 ) - FLD_S( SRC1 ) /* F1 F0 F5 F4 */ - FMUL_S( MAT5 ) - - FXCH( ST(1) ) /* F0 F1 F5 F4 */ - FADDP( ST0, ST(3) ) /* F1 F5 F4 */ - FADDP( ST0, ST(1) ) /* F5 F4 */ - - FXCH( ST(1) ) /* F4 F5 */ - FADD_S( MAT12 ) - FXCH( ST(1) ) /* F5 F4 */ - FADD_S( MAT13 ) - - FXCH( ST(1) ) /* F4 F5 */ - FSTP_S( DST0 ) /* F5 */ - FSTP_S( DST1 ) /* */ - -LLBL(x86_p2_2dr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p2_2dr_loop) ) - -LLBL(x86_p2_2dr_done): - - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT4 -GLOBL GLNAME( _mesa_x86_transform_points2_2d_no_rot ) -HIDDEN(_mesa_x86_transform_points2_2d_no_rot) -GLNAME( _mesa_x86_transform_points2_2d_no_rot ): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p2_2dnrr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p2_2dnrr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - - FLD_S( SRC1 ) /* F1 F4 */ - FMUL_S( MAT5 ) - - FXCH( ST(1) ) /* F4 F1 */ - FADD_S( MAT12 ) - FLD_S( MAT13 ) /* F5 F4 F1 */ - FXCH( ST(2) ) /* F1 F4 F5 */ - FADDP( ST0, ST(2) ) /* F4 F5 */ - - FSTP_S( DST0 ) /* F5 */ - FSTP_S( DST1 ) /* */ - -LLBL(x86_p2_2dnrr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p2_2dnrr_loop) ) - -LLBL(x86_p2_2dnrr_done): - - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points2_identity ) -HIDDEN(_mesa_x86_transform_points2_identity) -GLNAME( _mesa_x86_transform_points2_identity ): - -#define FRAME_OFFSET 12 - PUSH_L( ESI ) - PUSH_L( EDI ) - PUSH_L( EBX ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p2_ir_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - - CMP_L( ESI, EDI ) - JE( LLBL(x86_p2_ir_done) ) - -ALIGNTEXT16 -LLBL(x86_p2_ir_loop): - - MOV_L( SRC0, EBX ) - MOV_L( SRC1, EDX ) - - MOV_L( EBX, DST0 ) - MOV_L( EDX, DST1 ) - -LLBL(x86_p2_ir_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p2_ir_loop) ) - -LLBL(x86_p2_ir_done): - - POP_L( EBX ) - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif + +/* + * 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. + */ + +/* + * NOTE: Avoid using spaces in between '(' ')' and arguments, especially + * with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces + * in there will break the build on some platforms. + */ + +#include "assyntax.h" +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FP_ONE 1065353216 +#define FP_ZERO 0 + +#define SRC0 REGOFF(0, ESI) +#define SRC1 REGOFF(4, ESI) +#define SRC2 REGOFF(8, ESI) +#define SRC3 REGOFF(12, ESI) +#define DST0 REGOFF(0, EDI) +#define DST1 REGOFF(4, EDI) +#define DST2 REGOFF(8, EDI) +#define DST3 REGOFF(12, EDI) +#define MAT0 REGOFF(0, EDX) +#define MAT1 REGOFF(4, EDX) +#define MAT2 REGOFF(8, EDX) +#define MAT3 REGOFF(12, EDX) +#define MAT4 REGOFF(16, EDX) +#define MAT5 REGOFF(20, EDX) +#define MAT6 REGOFF(24, EDX) +#define MAT7 REGOFF(28, EDX) +#define MAT8 REGOFF(32, EDX) +#define MAT9 REGOFF(36, EDX) +#define MAT10 REGOFF(40, EDX) +#define MAT11 REGOFF(44, EDX) +#define MAT12 REGOFF(48, EDX) +#define MAT13 REGOFF(52, EDX) +#define MAT14 REGOFF(56, EDX) +#define MAT15 REGOFF(60, EDX) + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points2_general ) +HIDDEN(_mesa_x86_transform_points2_general) +GLNAME( _mesa_x86_transform_points2_general ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p2_gr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p2_gr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + FLD_S( SRC0 ) /* F6 F5 F4 */ + FMUL_S( MAT2 ) + FLD_S( SRC0 ) /* F7 F6 F5 F4 */ + FMUL_S( MAT3 ) + + FLD_S( SRC1 ) /* F0 F7 F6 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT5 ) + FLD_S( SRC1 ) /* F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT6 ) + FLD_S( SRC1 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT7 ) + + FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ + FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ + + FXCH( ST(3) ) /* F4 F6 F5 F7 */ + FADD_S( MAT12 ) + FXCH( ST(2) ) /* F5 F6 F4 F7 */ + FADD_S( MAT13 ) + FXCH( ST(1) ) /* F6 F5 F4 F7 */ + FADD_S( MAT14 ) + FXCH( ST(3) ) /* F7 F5 F4 F6 */ + FADD_S( MAT15 ) + + FXCH( ST(2) ) /* F4 F5 F7 F6 */ + FSTP_S( DST0 ) /* F5 F7 F6 */ + FSTP_S( DST1 ) /* F7 F6 */ + FXCH( ST(1) ) /* F6 F7 */ + FSTP_S( DST2 ) /* F7 */ + FSTP_S( DST3 ) /* */ + +LLBL(x86_p2_gr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p2_gr_loop) ) + +LLBL(x86_p2_gr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points2_perspective ) +HIDDEN(_mesa_x86_transform_points2_perspective) +GLNAME( _mesa_x86_transform_points2_perspective ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p2_pr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + + MOV_L( MAT14, EBX ) + +ALIGNTEXT16 +LLBL(x86_p2_pr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F1 F4 */ + FMUL_S( MAT5 ) + + FXCH( ST(1) ) /* F4 F1 */ + FSTP_S( DST0 ) /* F1 */ + FSTP_S( DST1 ) /* */ + MOV_L( EBX, DST2 ) + MOV_L( CONST(FP_ZERO), DST3 ) + +LLBL(x86_p2_pr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p2_pr_loop) ) + +LLBL(x86_p2_pr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points2_3d ) +HIDDEN(_mesa_x86_transform_points2_3d) +GLNAME( _mesa_x86_transform_points2_3d ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p2_3dr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p2_3dr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + FLD_S( SRC0 ) /* F6 F5 F4 */ + FMUL_S( MAT2 ) + + FLD_S( SRC1 ) /* F0 F6 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F6 F5 F4 */ + FMUL_S( MAT5 ) + FLD_S( SRC1 ) /* F2 F1 F0 F6 F5 F4 */ + FMUL_S( MAT6 ) + + FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + FXCH( ST(2) ) /* F4 F5 F6 */ + FADD_S( MAT12 ) + FXCH( ST(1) ) /* F5 F4 F6 */ + FADD_S( MAT13 ) + FXCH( ST(2) ) /* F6 F4 F5 */ + FADD_S( MAT14 ) + + FXCH( ST(1) ) /* F4 F6 F5 */ + FSTP_S( DST0 ) /* F6 F5 */ + FXCH( ST(1) ) /* F5 F6 */ + FSTP_S( DST1 ) /* F6 */ + FSTP_S( DST2 ) /* */ + +LLBL(x86_p2_3dr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p2_3dr_loop) ) + +LLBL(x86_p2_3dr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points2_3d_no_rot ) +HIDDEN(_mesa_x86_transform_points2_3d_no_rot) +GLNAME( _mesa_x86_transform_points2_3d_no_rot ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p2_3dnrr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + + MOV_L( MAT14, EBX ) + +ALIGNTEXT16 +LLBL(x86_p2_3dnrr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F1 F4 */ + FMUL_S( MAT5 ) + + FXCH( ST(1) ) /* F4 F1 */ + FADD_S( MAT12 ) + FLD_S( MAT13 ) /* F5 F4 F1 */ + FXCH( ST(2) ) /* F1 F4 F5 */ + FADDP( ST0, ST(2) ) /* F4 F5 */ + + FSTP_S( DST0 ) /* F5 */ + FSTP_S( DST1 ) /* */ + MOV_L( EBX, DST2 ) + +LLBL(x86_p2_3dnrr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p2_3dnrr_loop) ) + +LLBL(x86_p2_3dnrr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points2_2d ) +HIDDEN(_mesa_x86_transform_points2_2d) +GLNAME( _mesa_x86_transform_points2_2d ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p2_2dr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p2_2dr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + + FLD_S( SRC1 ) /* F0 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F5 F4 */ + FMUL_S( MAT5 ) + + FXCH( ST(1) ) /* F0 F1 F5 F4 */ + FADDP( ST0, ST(3) ) /* F1 F5 F4 */ + FADDP( ST0, ST(1) ) /* F5 F4 */ + + FXCH( ST(1) ) /* F4 F5 */ + FADD_S( MAT12 ) + FXCH( ST(1) ) /* F5 F4 */ + FADD_S( MAT13 ) + + FXCH( ST(1) ) /* F4 F5 */ + FSTP_S( DST0 ) /* F5 */ + FSTP_S( DST1 ) /* */ + +LLBL(x86_p2_2dr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p2_2dr_loop) ) + +LLBL(x86_p2_2dr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT4 +GLOBL GLNAME( _mesa_x86_transform_points2_2d_no_rot ) +HIDDEN(_mesa_x86_transform_points2_2d_no_rot) +GLNAME( _mesa_x86_transform_points2_2d_no_rot ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p2_2dnrr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p2_2dnrr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F1 F4 */ + FMUL_S( MAT5 ) + + FXCH( ST(1) ) /* F4 F1 */ + FADD_S( MAT12 ) + FLD_S( MAT13 ) /* F5 F4 F1 */ + FXCH( ST(2) ) /* F1 F4 F5 */ + FADDP( ST0, ST(2) ) /* F4 F5 */ + + FSTP_S( DST0 ) /* F5 */ + FSTP_S( DST1 ) /* */ + +LLBL(x86_p2_2dnrr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p2_2dnrr_loop) ) + +LLBL(x86_p2_2dnrr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points2_identity ) +HIDDEN(_mesa_x86_transform_points2_identity) +GLNAME( _mesa_x86_transform_points2_identity ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p2_ir_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + + CMP_L( ESI, EDI ) + JE( LLBL(x86_p2_ir_done) ) + +ALIGNTEXT16 +LLBL(x86_p2_ir_loop): + + MOV_L( SRC0, EBX ) + MOV_L( SRC1, EDX ) + + MOV_L( EBX, DST0 ) + MOV_L( EDX, DST1 ) + +LLBL(x86_p2_ir_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p2_ir_loop) ) + +LLBL(x86_p2_ir_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/x86_xform3.S b/mesalib/src/mesa/x86/x86_xform3.S index 6f717caf9..1c782f1c5 100644 --- a/mesalib/src/mesa/x86/x86_xform3.S +++ b/mesalib/src/mesa/x86/x86_xform3.S @@ -1,644 +1,644 @@ - -/* - * 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. - */ - -/* - * NOTE: Avoid using spaces in between '(' ')' and arguments, especially - * with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces - * in there will break the build on some platforms. - */ - -#include "assyntax.h" -#include "matypes.h" -#include "xform_args.h" - - SEG_TEXT - -#define FP_ONE 1065353216 -#define FP_ZERO 0 - -#define SRC0 REGOFF(0, ESI) -#define SRC1 REGOFF(4, ESI) -#define SRC2 REGOFF(8, ESI) -#define SRC3 REGOFF(12, ESI) -#define DST0 REGOFF(0, EDI) -#define DST1 REGOFF(4, EDI) -#define DST2 REGOFF(8, EDI) -#define DST3 REGOFF(12, EDI) -#define MAT0 REGOFF(0, EDX) -#define MAT1 REGOFF(4, EDX) -#define MAT2 REGOFF(8, EDX) -#define MAT3 REGOFF(12, EDX) -#define MAT4 REGOFF(16, EDX) -#define MAT5 REGOFF(20, EDX) -#define MAT6 REGOFF(24, EDX) -#define MAT7 REGOFF(28, EDX) -#define MAT8 REGOFF(32, EDX) -#define MAT9 REGOFF(36, EDX) -#define MAT10 REGOFF(40, EDX) -#define MAT11 REGOFF(44, EDX) -#define MAT12 REGOFF(48, EDX) -#define MAT13 REGOFF(52, EDX) -#define MAT14 REGOFF(56, EDX) -#define MAT15 REGOFF(60, EDX) - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points3_general ) -HIDDEN(_mesa_x86_transform_points3_general) -GLNAME( _mesa_x86_transform_points3_general ): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p3_gr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p3_gr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - FLD_S( SRC0 ) /* F5 F4 */ - FMUL_S( MAT1 ) - FLD_S( SRC0 ) /* F6 F5 F4 */ - FMUL_S( MAT2 ) - FLD_S( SRC0 ) /* F7 F6 F5 F4 */ - FMUL_S( MAT3 ) - - FLD_S( SRC1 ) /* F0 F7 F6 F5 F4 */ - FMUL_S( MAT4 ) - FLD_S( SRC1 ) /* F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT5 ) - FLD_S( SRC1 ) /* F2 F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT6 ) - FLD_S( SRC1 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT7 ) - - FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ - FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ - - FLD_S( SRC2 ) /* F0 F7 F6 F5 F4 */ - FMUL_S( MAT8 ) - FLD_S( SRC2 ) /* F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT9 ) - FLD_S( SRC2 ) /* F2 F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT10 ) - FLD_S( SRC2 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT11 ) - - FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ - FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ - - FXCH( ST(3) ) /* F4 F6 F5 F7 */ - FADD_S( MAT12 ) - FXCH( ST(2) ) /* F5 F6 F4 F7 */ - FADD_S( MAT13 ) - FXCH( ST(1) ) /* F6 F5 F4 F7 */ - FADD_S( MAT14 ) - FXCH( ST(3) ) /* F7 F5 F4 F6 */ - FADD_S( MAT15 ) - - FXCH( ST(2) ) /* F4 F5 F7 F6 */ - FSTP_S( DST0 ) /* F5 F7 F6 */ - FSTP_S( DST1 ) /* F7 F6 */ - FXCH( ST(1) ) /* F6 F7 */ - FSTP_S( DST2 ) /* F7 */ - FSTP_S( DST3 ) /* */ - -LLBL(x86_p3_gr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p3_gr_loop) ) - -LLBL(x86_p3_gr_done): - - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points3_perspective ) -HIDDEN(_mesa_x86_transform_points3_perspective) -GLNAME( _mesa_x86_transform_points3_perspective ): - -#define FRAME_OFFSET 12 - PUSH_L( ESI ) - PUSH_L( EDI ) - PUSH_L( EBX ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p3_pr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p3_pr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - - FLD_S( SRC1 ) /* F5 F4 */ - FMUL_S( MAT5 ) - - FLD_S( SRC2 ) /* F0 F5 F4 */ - FMUL_S( MAT8 ) - FLD_S( SRC2 ) /* F1 F0 F5 F4 */ - FMUL_S( MAT9 ) - FLD_S( SRC2 ) /* F2 F1 F0 F5 F4 */ - FMUL_S( MAT10 ) - - FXCH( ST(2) ) /* F0 F1 F2 F5 F4 */ - FADDP( ST0, ST(4) ) /* F1 F2 F5 F4 */ - FADDP( ST0, ST(2) ) /* F2 F5 F4 */ - FLD_S( MAT14 ) /* F6 F2 F5 F4 */ - FXCH( ST(1) ) /* F2 F6 F5 F4 */ - FADDP( ST0, ST(1) ) /* F6 F5 F4 */ - - MOV_L( SRC2, EBX ) - XOR_L( CONST(-2147483648), EBX )/* change sign */ - - FXCH( ST(2) ) /* F4 F5 F6 */ - FSTP_S( DST0 ) /* F5 F6 */ - FSTP_S( DST1 ) /* F6 */ - FSTP_S( DST2 ) /* */ - MOV_L( EBX, DST3 ) - -LLBL(x86_p3_pr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p3_pr_loop) ) - -LLBL(x86_p3_pr_done): - - POP_L( EBX ) - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points3_3d ) -HIDDEN(_mesa_x86_transform_points3_3d) -GLNAME( _mesa_x86_transform_points3_3d ): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p3_3dr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p3_3dr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - FLD_S( SRC0 ) /* F5 F4 */ - FMUL_S( MAT1 ) - FLD_S( SRC0 ) /* F6 F5 F4 */ - FMUL_S( MAT2 ) - - FLD_S( SRC1 ) /* F0 F6 F5 F4 */ - FMUL_S( MAT4 ) - FLD_S( SRC1 ) /* F1 F0 F6 F5 F4 */ - FMUL_S( MAT5 ) - FLD_S( SRC1 ) /* F2 F1 F0 F6 F5 F4 */ - FMUL_S( MAT6 ) - - FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ - FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ - FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ - FADDP( ST0, ST(1) ) /* F6 F5 F4 */ - - FLD_S( SRC2 ) /* F0 F6 F5 F4 */ - FMUL_S( MAT8 ) - FLD_S( SRC2 ) /* F1 F0 F6 F5 F4 */ - FMUL_S( MAT9 ) - FLD_S( SRC2 ) /* F2 F1 F0 F6 F5 F4 */ - FMUL_S( MAT10 ) - - FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ - FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ - FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ - FADDP( ST0, ST(1) ) /* F6 F5 F4 */ - - FXCH( ST(2) ) /* F4 F5 F6 */ - FADD_S( MAT12 ) - FXCH( ST(1) ) /* F5 F4 F6 */ - FADD_S( MAT13 ) - FXCH( ST(2) ) /* F6 F4 F5 */ - FADD_S( MAT14 ) - - FXCH( ST(1) ) /* F4 F6 F5 */ - FSTP_S( DST0 ) /* F6 F5 */ - FXCH( ST(1) ) /* F5 F6 */ - FSTP_S( DST1 ) /* F6 */ - FSTP_S( DST2 ) /* */ - -LLBL(x86_p3_3dr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p3_3dr_loop) ) - -LLBL(x86_p3_3dr_done): - - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points3_3d_no_rot ) -HIDDEN(_mesa_x86_transform_points3_3d_no_rot) -GLNAME( _mesa_x86_transform_points3_3d_no_rot ): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p3_3dnrr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p3_3dnrr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - - FLD_S( SRC1 ) /* F1 F4 */ - FMUL_S( MAT5 ) - - FLD_S( SRC2 ) /* F2 F1 F4 */ - FMUL_S( MAT10 ) - - FXCH( ST(2) ) /* F4 F1 F2 */ - FADD_S( MAT12 ) - FLD_S( MAT13 ) /* F5 F4 F1 F2 */ - FXCH( ST(2) ) /* F1 F4 F5 F2 */ - FADDP( ST0, ST(2) ) /* F4 F5 F2 */ - FLD_S( MAT14 ) /* F6 F4 F5 F2 */ - FXCH( ST(3) ) /* F2 F4 F5 F6 */ - FADDP( ST0, ST(3) ) /* F4 F5 F6 */ - - FSTP_S( DST0 ) /* F5 F6 */ - FSTP_S( DST1 ) /* F6 */ - FSTP_S( DST2 ) /* */ - -LLBL(x86_p3_3dnrr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p3_3dnrr_loop) ) - -LLBL(x86_p3_3dnrr_done): - - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points3_2d ) -HIDDEN(_mesa_x86_transform_points3_2d) -GLNAME( _mesa_x86_transform_points3_2d ): - -#define FRAME_OFFSET 12 - PUSH_L( ESI ) - PUSH_L( EDI ) - PUSH_L( EBX ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p3_2dr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p3_2dr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - FLD_S( SRC0 ) /* F5 F4 */ - FMUL_S( MAT1 ) - - FLD_S( SRC1 ) /* F0 F5 F4 */ - FMUL_S( MAT4 ) - FLD_S( SRC1 ) /* F1 F0 F5 F4 */ - FMUL_S( MAT5 ) - - FXCH( ST(1) ) /* F0 F1 F5 F4 */ - FADDP( ST0, ST(3) ) /* F1 F5 F4 */ - FADDP( ST0, ST(1) ) /* F5 F4 */ - - FXCH( ST(1) ) /* F4 F5 */ - FADD_S( MAT12 ) - FXCH( ST(1) ) /* F5 F4 */ - FADD_S( MAT13 ) - - MOV_L( SRC2, EBX ) - - FXCH( ST(1) ) /* F4 F5 */ - FSTP_S( DST0 ) /* F5 */ - FSTP_S( DST1 ) /* */ - MOV_L( EBX, DST2 ) - -LLBL(x86_p3_2dr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p3_2dr_loop) ) - -LLBL(x86_p3_2dr_done): - - POP_L( EBX ) - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points3_2d_no_rot ) -HIDDEN(_mesa_x86_transform_points3_2d_no_rot) -GLNAME( _mesa_x86_transform_points3_2d_no_rot ): - -#define FRAME_OFFSET 12 - PUSH_L( ESI ) - PUSH_L( EDI ) - PUSH_L( EBX ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p3_2dnrr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p3_2dnrr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - - FLD_S( SRC1 ) /* F1 F4 */ - FMUL_S( MAT5 ) - - FXCH( ST(1) ) /* F4 F1 */ - FADD_S( MAT12 ) - FLD_S( MAT13 ) /* F5 F4 F1 */ - - FXCH( ST(2) ) /* F1 F4 F5 */ - FADDP( ST0, ST(2) ) /* F4 F5 */ - - MOV_L( SRC2, EBX ) - - FSTP_S( DST0 ) /* F5 */ - FSTP_S( DST1 ) /* */ - MOV_L( EBX, DST2 ) - -LLBL(x86_p3_2dnrr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p3_2dnrr_loop) ) - -LLBL(x86_p3_2dnrr_done): - - POP_L( EBX ) - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points3_identity ) -HIDDEN(_mesa_x86_transform_points3_identity) -GLNAME(_mesa_x86_transform_points3_identity ): - -#define FRAME_OFFSET 16 - PUSH_L( ESI ) - PUSH_L( EDI ) - PUSH_L( EBX ) - PUSH_L( EBP ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p3_ir_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - - CMP_L( ESI, EDI ) - JE( LLBL(x86_p3_ir_done) ) - -ALIGNTEXT16 -LLBL(x86_p3_ir_loop): - -#if 1 - MOV_L( SRC0, EBX ) - MOV_L( SRC1, EBP ) - MOV_L( SRC2, EDX ) - - MOV_L( EBX, DST0 ) - MOV_L( EBP, DST1 ) - MOV_L( EDX, DST2 ) -#else - FLD_S( SRC0 ) - FLD_S( SRC1 ) - FLD_S( SRC2 ) - - FSTP_S( DST2 ) - FSTP_S( DST1 ) - FSTP_S( DST0 ) -#endif - -LLBL(x86_p3_ir_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p3_ir_loop) ) - -LLBL(x86_p3_ir_done): - - POP_L( EBP ) - POP_L( EBX ) - POP_L( EDI ) - POP_L( ESI ) - RET - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif + +/* + * 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. + */ + +/* + * NOTE: Avoid using spaces in between '(' ')' and arguments, especially + * with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces + * in there will break the build on some platforms. + */ + +#include "assyntax.h" +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FP_ONE 1065353216 +#define FP_ZERO 0 + +#define SRC0 REGOFF(0, ESI) +#define SRC1 REGOFF(4, ESI) +#define SRC2 REGOFF(8, ESI) +#define SRC3 REGOFF(12, ESI) +#define DST0 REGOFF(0, EDI) +#define DST1 REGOFF(4, EDI) +#define DST2 REGOFF(8, EDI) +#define DST3 REGOFF(12, EDI) +#define MAT0 REGOFF(0, EDX) +#define MAT1 REGOFF(4, EDX) +#define MAT2 REGOFF(8, EDX) +#define MAT3 REGOFF(12, EDX) +#define MAT4 REGOFF(16, EDX) +#define MAT5 REGOFF(20, EDX) +#define MAT6 REGOFF(24, EDX) +#define MAT7 REGOFF(28, EDX) +#define MAT8 REGOFF(32, EDX) +#define MAT9 REGOFF(36, EDX) +#define MAT10 REGOFF(40, EDX) +#define MAT11 REGOFF(44, EDX) +#define MAT12 REGOFF(48, EDX) +#define MAT13 REGOFF(52, EDX) +#define MAT14 REGOFF(56, EDX) +#define MAT15 REGOFF(60, EDX) + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points3_general ) +HIDDEN(_mesa_x86_transform_points3_general) +GLNAME( _mesa_x86_transform_points3_general ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p3_gr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p3_gr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + FLD_S( SRC0 ) /* F6 F5 F4 */ + FMUL_S( MAT2 ) + FLD_S( SRC0 ) /* F7 F6 F5 F4 */ + FMUL_S( MAT3 ) + + FLD_S( SRC1 ) /* F0 F7 F6 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT5 ) + FLD_S( SRC1 ) /* F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT6 ) + FLD_S( SRC1 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT7 ) + + FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ + FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ + + FLD_S( SRC2 ) /* F0 F7 F6 F5 F4 */ + FMUL_S( MAT8 ) + FLD_S( SRC2 ) /* F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT9 ) + FLD_S( SRC2 ) /* F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT10 ) + FLD_S( SRC2 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT11 ) + + FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ + FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ + + FXCH( ST(3) ) /* F4 F6 F5 F7 */ + FADD_S( MAT12 ) + FXCH( ST(2) ) /* F5 F6 F4 F7 */ + FADD_S( MAT13 ) + FXCH( ST(1) ) /* F6 F5 F4 F7 */ + FADD_S( MAT14 ) + FXCH( ST(3) ) /* F7 F5 F4 F6 */ + FADD_S( MAT15 ) + + FXCH( ST(2) ) /* F4 F5 F7 F6 */ + FSTP_S( DST0 ) /* F5 F7 F6 */ + FSTP_S( DST1 ) /* F7 F6 */ + FXCH( ST(1) ) /* F6 F7 */ + FSTP_S( DST2 ) /* F7 */ + FSTP_S( DST3 ) /* */ + +LLBL(x86_p3_gr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p3_gr_loop) ) + +LLBL(x86_p3_gr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points3_perspective ) +HIDDEN(_mesa_x86_transform_points3_perspective) +GLNAME( _mesa_x86_transform_points3_perspective ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p3_pr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p3_pr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F5 F4 */ + FMUL_S( MAT5 ) + + FLD_S( SRC2 ) /* F0 F5 F4 */ + FMUL_S( MAT8 ) + FLD_S( SRC2 ) /* F1 F0 F5 F4 */ + FMUL_S( MAT9 ) + FLD_S( SRC2 ) /* F2 F1 F0 F5 F4 */ + FMUL_S( MAT10 ) + + FXCH( ST(2) ) /* F0 F1 F2 F5 F4 */ + FADDP( ST0, ST(4) ) /* F1 F2 F5 F4 */ + FADDP( ST0, ST(2) ) /* F2 F5 F4 */ + FLD_S( MAT14 ) /* F6 F2 F5 F4 */ + FXCH( ST(1) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + MOV_L( SRC2, EBX ) + XOR_L( CONST(-2147483648), EBX )/* change sign */ + + FXCH( ST(2) ) /* F4 F5 F6 */ + FSTP_S( DST0 ) /* F5 F6 */ + FSTP_S( DST1 ) /* F6 */ + FSTP_S( DST2 ) /* */ + MOV_L( EBX, DST3 ) + +LLBL(x86_p3_pr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p3_pr_loop) ) + +LLBL(x86_p3_pr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points3_3d ) +HIDDEN(_mesa_x86_transform_points3_3d) +GLNAME( _mesa_x86_transform_points3_3d ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p3_3dr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p3_3dr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + FLD_S( SRC0 ) /* F6 F5 F4 */ + FMUL_S( MAT2 ) + + FLD_S( SRC1 ) /* F0 F6 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F6 F5 F4 */ + FMUL_S( MAT5 ) + FLD_S( SRC1 ) /* F2 F1 F0 F6 F5 F4 */ + FMUL_S( MAT6 ) + + FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + FLD_S( SRC2 ) /* F0 F6 F5 F4 */ + FMUL_S( MAT8 ) + FLD_S( SRC2 ) /* F1 F0 F6 F5 F4 */ + FMUL_S( MAT9 ) + FLD_S( SRC2 ) /* F2 F1 F0 F6 F5 F4 */ + FMUL_S( MAT10 ) + + FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + FXCH( ST(2) ) /* F4 F5 F6 */ + FADD_S( MAT12 ) + FXCH( ST(1) ) /* F5 F4 F6 */ + FADD_S( MAT13 ) + FXCH( ST(2) ) /* F6 F4 F5 */ + FADD_S( MAT14 ) + + FXCH( ST(1) ) /* F4 F6 F5 */ + FSTP_S( DST0 ) /* F6 F5 */ + FXCH( ST(1) ) /* F5 F6 */ + FSTP_S( DST1 ) /* F6 */ + FSTP_S( DST2 ) /* */ + +LLBL(x86_p3_3dr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p3_3dr_loop) ) + +LLBL(x86_p3_3dr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points3_3d_no_rot ) +HIDDEN(_mesa_x86_transform_points3_3d_no_rot) +GLNAME( _mesa_x86_transform_points3_3d_no_rot ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p3_3dnrr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p3_3dnrr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F1 F4 */ + FMUL_S( MAT5 ) + + FLD_S( SRC2 ) /* F2 F1 F4 */ + FMUL_S( MAT10 ) + + FXCH( ST(2) ) /* F4 F1 F2 */ + FADD_S( MAT12 ) + FLD_S( MAT13 ) /* F5 F4 F1 F2 */ + FXCH( ST(2) ) /* F1 F4 F5 F2 */ + FADDP( ST0, ST(2) ) /* F4 F5 F2 */ + FLD_S( MAT14 ) /* F6 F4 F5 F2 */ + FXCH( ST(3) ) /* F2 F4 F5 F6 */ + FADDP( ST0, ST(3) ) /* F4 F5 F6 */ + + FSTP_S( DST0 ) /* F5 F6 */ + FSTP_S( DST1 ) /* F6 */ + FSTP_S( DST2 ) /* */ + +LLBL(x86_p3_3dnrr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p3_3dnrr_loop) ) + +LLBL(x86_p3_3dnrr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points3_2d ) +HIDDEN(_mesa_x86_transform_points3_2d) +GLNAME( _mesa_x86_transform_points3_2d ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p3_2dr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p3_2dr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + + FLD_S( SRC1 ) /* F0 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F5 F4 */ + FMUL_S( MAT5 ) + + FXCH( ST(1) ) /* F0 F1 F5 F4 */ + FADDP( ST0, ST(3) ) /* F1 F5 F4 */ + FADDP( ST0, ST(1) ) /* F5 F4 */ + + FXCH( ST(1) ) /* F4 F5 */ + FADD_S( MAT12 ) + FXCH( ST(1) ) /* F5 F4 */ + FADD_S( MAT13 ) + + MOV_L( SRC2, EBX ) + + FXCH( ST(1) ) /* F4 F5 */ + FSTP_S( DST0 ) /* F5 */ + FSTP_S( DST1 ) /* */ + MOV_L( EBX, DST2 ) + +LLBL(x86_p3_2dr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p3_2dr_loop) ) + +LLBL(x86_p3_2dr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points3_2d_no_rot ) +HIDDEN(_mesa_x86_transform_points3_2d_no_rot) +GLNAME( _mesa_x86_transform_points3_2d_no_rot ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p3_2dnrr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p3_2dnrr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F1 F4 */ + FMUL_S( MAT5 ) + + FXCH( ST(1) ) /* F4 F1 */ + FADD_S( MAT12 ) + FLD_S( MAT13 ) /* F5 F4 F1 */ + + FXCH( ST(2) ) /* F1 F4 F5 */ + FADDP( ST0, ST(2) ) /* F4 F5 */ + + MOV_L( SRC2, EBX ) + + FSTP_S( DST0 ) /* F5 */ + FSTP_S( DST1 ) /* */ + MOV_L( EBX, DST2 ) + +LLBL(x86_p3_2dnrr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p3_2dnrr_loop) ) + +LLBL(x86_p3_2dnrr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points3_identity ) +HIDDEN(_mesa_x86_transform_points3_identity) +GLNAME(_mesa_x86_transform_points3_identity ): + +#define FRAME_OFFSET 16 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + PUSH_L( EBP ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p3_ir_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + + CMP_L( ESI, EDI ) + JE( LLBL(x86_p3_ir_done) ) + +ALIGNTEXT16 +LLBL(x86_p3_ir_loop): + +#if 1 + MOV_L( SRC0, EBX ) + MOV_L( SRC1, EBP ) + MOV_L( SRC2, EDX ) + + MOV_L( EBX, DST0 ) + MOV_L( EBP, DST1 ) + MOV_L( EDX, DST2 ) +#else + FLD_S( SRC0 ) + FLD_S( SRC1 ) + FLD_S( SRC2 ) + + FSTP_S( DST2 ) + FSTP_S( DST1 ) + FSTP_S( DST0 ) +#endif + +LLBL(x86_p3_ir_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p3_ir_loop) ) + +LLBL(x86_p3_ir_done): + + POP_L( EBP ) + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/x86_xform4.S b/mesalib/src/mesa/x86/x86_xform4.S index 687426eb5..97a841138 100644 --- a/mesalib/src/mesa/x86/x86_xform4.S +++ b/mesalib/src/mesa/x86/x86_xform4.S @@ -1,677 +1,677 @@ - -/* - * 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. - */ - -/* - * NOTE: Avoid using spaces in between '(' ')' and arguments, especially - * with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces - * in there will break the build on some platforms. - */ - -#include "assyntax.h" -#include "matypes.h" -#include "xform_args.h" - - SEG_TEXT - -#define FP_ONE 1065353216 -#define FP_ZERO 0 - -#define SRC0 REGOFF(0, ESI) -#define SRC1 REGOFF(4, ESI) -#define SRC2 REGOFF(8, ESI) -#define SRC3 REGOFF(12, ESI) -#define DST0 REGOFF(0, EDI) -#define DST1 REGOFF(4, EDI) -#define DST2 REGOFF(8, EDI) -#define DST3 REGOFF(12, EDI) -#define MAT0 REGOFF(0, EDX) -#define MAT1 REGOFF(4, EDX) -#define MAT2 REGOFF(8, EDX) -#define MAT3 REGOFF(12, EDX) -#define MAT4 REGOFF(16, EDX) -#define MAT5 REGOFF(20, EDX) -#define MAT6 REGOFF(24, EDX) -#define MAT7 REGOFF(28, EDX) -#define MAT8 REGOFF(32, EDX) -#define MAT9 REGOFF(36, EDX) -#define MAT10 REGOFF(40, EDX) -#define MAT11 REGOFF(44, EDX) -#define MAT12 REGOFF(48, EDX) -#define MAT13 REGOFF(52, EDX) -#define MAT14 REGOFF(56, EDX) -#define MAT15 REGOFF(60, EDX) - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points4_general ) -HIDDEN(_mesa_x86_transform_points4_general) -GLNAME( _mesa_x86_transform_points4_general ): - -#define FRAME_OFFSET 8 - PUSH_L( ESI ) - PUSH_L( EDI ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p4_gr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p4_gr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - FLD_S( SRC0 ) /* F5 F4 */ - FMUL_S( MAT1 ) - FLD_S( SRC0 ) /* F6 F5 F4 */ - FMUL_S( MAT2 ) - FLD_S( SRC0 ) /* F7 F6 F5 F4 */ - FMUL_S( MAT3 ) - - FLD_S( SRC1 ) /* F0 F7 F6 F5 F4 */ - FMUL_S( MAT4 ) - FLD_S( SRC1 ) /* F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT5 ) - FLD_S( SRC1 ) /* F2 F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT6 ) - FLD_S( SRC1 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT7 ) - - FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ - FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ - - FLD_S( SRC2 ) /* F0 F7 F6 F5 F4 */ - FMUL_S( MAT8 ) - FLD_S( SRC2 ) /* F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT9 ) - FLD_S( SRC2 ) /* F2 F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT10 ) - FLD_S( SRC2 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT11 ) - - FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ - FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ - - FLD_S( SRC3 ) /* F0 F7 F6 F5 F4 */ - FMUL_S( MAT12 ) - FLD_S( SRC3 ) /* F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT13 ) - FLD_S( SRC3 ) /* F2 F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT14 ) - FLD_S( SRC3 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ - FMUL_S( MAT15 ) - - FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ - FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ - FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ - - FXCH( ST(3) ) /* F4 F6 F5 F7 */ - FSTP_S( DST0 ) /* F6 F5 F7 */ - FXCH( ST(1) ) /* F5 F6 F7 */ - FSTP_S( DST1 ) /* F6 F7 */ - FSTP_S( DST2 ) /* F7 */ - FSTP_S( DST3 ) /* */ - -LLBL(x86_p4_gr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p4_gr_loop) ) - -LLBL(x86_p4_gr_done): - - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points4_perspective ) -HIDDEN(_mesa_x86_transform_points4_perspective) -GLNAME( _mesa_x86_transform_points4_perspective ): - -#define FRAME_OFFSET 12 - PUSH_L( ESI ) - PUSH_L( EDI ) - PUSH_L( EBX ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p4_pr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p4_pr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - - FLD_S( SRC1 ) /* F5 F4 */ - FMUL_S( MAT5 ) - - FLD_S( SRC2 ) /* F0 F5 F4 */ - FMUL_S( MAT8 ) - FLD_S( SRC2 ) /* F1 F0 F5 F4 */ - FMUL_S( MAT9 ) - FLD_S( SRC2 ) /* F6 F1 F0 F5 F4 */ - FMUL_S( MAT10 ) - - FXCH( ST(2) ) /* F0 F1 F6 F5 F4 */ - FADDP( ST0, ST(4) ) /* F1 F6 F5 F4 */ - FADDP( ST0, ST(2) ) /* F6 F5 F4 */ - - FLD_S( SRC3 ) /* F2 F6 F5 F4 */ - FMUL_S( MAT14 ) - - FADDP( ST0, ST(1) ) /* F6 F5 F4 */ - - MOV_L( SRC2, EBX ) - XOR_L( CONST(-2147483648), EBX )/* change sign */ - - FXCH( ST(2) ) /* F4 F5 F6 */ - FSTP_S( DST0 ) /* F5 F6 */ - FSTP_S( DST1 ) /* F6 */ - FSTP_S( DST2 ) /* */ - MOV_L( EBX, DST3 ) - -LLBL(x86_p4_pr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p4_pr_loop) ) - -LLBL(x86_p4_pr_done): - - POP_L( EBX ) - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points4_3d ) -HIDDEN(_mesa_x86_transform_points4_3d) -GLNAME( _mesa_x86_transform_points4_3d ): - -#define FRAME_OFFSET 12 - PUSH_L( ESI ) - PUSH_L( EDI ) - PUSH_L( EBX ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p4_3dr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p4_3dr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - FLD_S( SRC0 ) /* F5 F4 */ - FMUL_S( MAT1 ) - FLD_S( SRC0 ) /* F6 F5 F4 */ - FMUL_S( MAT2 ) - - FLD_S( SRC1 ) /* F0 F6 F5 F4 */ - FMUL_S( MAT4 ) - FLD_S( SRC1 ) /* F1 F0 F6 F5 F4 */ - FMUL_S( MAT5 ) - FLD_S( SRC1 ) /* F2 F1 F0 F6 F5 F4 */ - FMUL_S( MAT6 ) - - FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ - FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ - FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ - FADDP( ST0, ST(1) ) /* F6 F5 F4 */ - - FLD_S( SRC2 ) /* F0 F6 F5 F4 */ - FMUL_S( MAT8 ) - FLD_S( SRC2 ) /* F1 F0 F6 F5 F4 */ - FMUL_S( MAT9 ) - FLD_S( SRC2 ) /* F2 F1 F0 F6 F5 F4 */ - FMUL_S( MAT10 ) - - FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ - FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ - FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ - FADDP( ST0, ST(1) ) /* F6 F5 F4 */ - - FLD_S( SRC3 ) /* F0 F6 F5 F4 */ - FMUL_S( MAT12 ) - FLD_S( SRC3 ) /* F1 F0 F6 F5 F4 */ - FMUL_S( MAT13 ) - FLD_S( SRC3 ) /* F2 F1 F0 F6 F5 F4 */ - FMUL_S( MAT14 ) - - FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ - FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ - FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ - FADDP( ST0, ST(1) ) /* F6 F5 F4 */ - - MOV_L( SRC3, EBX ) - - FXCH( ST(2) ) /* F4 F5 F6 */ - FSTP_S( DST0 ) /* F5 F6 */ - FSTP_S( DST1 ) /* F6 */ - FSTP_S( DST2 ) /* */ - MOV_L( EBX, DST3 ) - -LLBL(x86_p4_3dr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p4_3dr_loop) ) - -LLBL(x86_p4_3dr_done): - - POP_L( EBX ) - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_x86_transform_points4_3d_no_rot) -HIDDEN(_mesa_x86_transform_points4_3d_no_rot) -GLNAME(_mesa_x86_transform_points4_3d_no_rot): - -#define FRAME_OFFSET 12 - PUSH_L( ESI ) - PUSH_L( EDI ) - PUSH_L( EBX ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p4_3dnrr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p4_3dnrr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - - FLD_S( SRC1 ) /* F5 F4 */ - FMUL_S( MAT5 ) - - FLD_S( SRC2 ) /* F6 F5 F4 */ - FMUL_S( MAT10 ) - - FLD_S( SRC3 ) /* F0 F6 F5 F4 */ - FMUL_S( MAT12 ) - FLD_S( SRC3 ) /* F1 F0 F6 F5 F4 */ - FMUL_S( MAT13 ) - FLD_S( SRC3 ) /* F2 F1 F0 F6 F5 F4 */ - FMUL_S( MAT14 ) - - FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ - FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ - FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ - FADDP( ST0, ST(1) ) /* F6 F5 F4 */ - - MOV_L( SRC3, EBX ) - - FXCH( ST(2) ) /* F4 F5 F6 */ - FSTP_S( DST0 ) /* F5 F6 */ - FSTP_S( DST1 ) /* F6 */ - FSTP_S( DST2 ) /* */ - MOV_L( EBX, DST3 ) - -LLBL(x86_p4_3dnrr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p4_3dnrr_loop) ) - -LLBL(x86_p4_3dnrr_done): - - POP_L( EBX ) - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points4_2d ) -HIDDEN(_mesa_x86_transform_points4_2d) -GLNAME( _mesa_x86_transform_points4_2d ): - -#define FRAME_OFFSET 16 - PUSH_L( ESI ) - PUSH_L( EDI ) - PUSH_L( EBX ) - PUSH_L( EBP ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p4_2dr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p4_2dr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - FLD_S( SRC0 ) /* F5 F4 */ - FMUL_S( MAT1 ) - - FLD_S( SRC1 ) /* F0 F5 F4 */ - FMUL_S( MAT4 ) - FLD_S( SRC1 ) /* F1 F0 F5 F4 */ - FMUL_S( MAT5 ) - - FXCH( ST(1) ) /* F0 F1 F5 F4 */ - FADDP( ST0, ST(3) ) /* F1 F5 F4 */ - FADDP( ST0, ST(1) ) /* F5 F4 */ - - FLD_S( SRC3 ) /* F0 F5 F4 */ - FMUL_S( MAT12 ) - FLD_S( SRC3 ) /* F1 F0 F5 F4 */ - FMUL_S( MAT13 ) - - FXCH( ST(1) ) /* F0 F1 F5 F4 */ - FADDP( ST0, ST(3) ) /* F1 F5 F4 */ - FADDP( ST0, ST(1) ) /* F5 F4 */ - - MOV_L( SRC2, EBX ) - MOV_L( SRC3, EBP ) - - FXCH( ST(1) ) /* F4 F5 */ - FSTP_S( DST0 ) /* F5 */ - FSTP_S( DST1 ) /* */ - MOV_L( EBX, DST2 ) - MOV_L( EBP, DST3 ) - -LLBL(x86_p4_2dr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p4_2dr_loop) ) - -LLBL(x86_p4_2dr_done): - - POP_L( EBP ) - POP_L( EBX ) - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points4_2d_no_rot ) -HIDDEN(_mesa_x86_transform_points4_2d_no_rot) -GLNAME( _mesa_x86_transform_points4_2d_no_rot ): - -#define FRAME_OFFSET 16 - PUSH_L( ESI ) - PUSH_L( EDI ) - PUSH_L( EBX ) - PUSH_L( EBP ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p4_2dnrr_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - -ALIGNTEXT16 -LLBL(x86_p4_2dnrr_loop): - - FLD_S( SRC0 ) /* F4 */ - FMUL_S( MAT0 ) - - FLD_S( SRC1 ) /* F5 F4 */ - FMUL_S( MAT5 ) - - FLD_S( SRC3 ) /* F0 F5 F4 */ - FMUL_S( MAT12 ) - FLD_S( SRC3 ) /* F1 F0 F5 F4 */ - FMUL_S( MAT13 ) - - FXCH( ST(1) ) /* F0 F1 F5 F4 */ - FADDP( ST0, ST(3) ) /* F1 F5 F4 */ - FADDP( ST0, ST(1) ) /* F5 F4 */ - - MOV_L( SRC2, EBX ) - MOV_L( SRC3, EBP ) - - FXCH( ST(1) ) /* F4 F5 */ - FSTP_S( DST0 ) /* F5 */ - FSTP_S( DST1 ) /* */ - MOV_L( EBX, DST2 ) - MOV_L( EBP, DST3 ) - -LLBL(x86_p4_2dnrr_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p4_2dnrr_loop) ) - -LLBL(x86_p4_2dnrr_done): - - POP_L( EBP ) - POP_L( EBX ) - POP_L( EDI ) - POP_L( ESI ) - RET -#undef FRAME_OFFSET - - - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_x86_transform_points4_identity ) -HIDDEN(_mesa_x86_transform_points4_identity) -GLNAME( _mesa_x86_transform_points4_identity ): - -#define FRAME_OFFSET 12 - PUSH_L( ESI ) - PUSH_L( EDI ) - PUSH_L( EBX ) - - MOV_L( ARG_SOURCE, ESI ) - MOV_L( ARG_DEST, EDI ) - - MOV_L( ARG_MATRIX, EDX ) - MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) - - TEST_L( ECX, ECX ) - JZ( LLBL(x86_p4_ir_done) ) - - MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) - OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) - - MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) - MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) - - SHL_L( CONST(4), ECX ) - MOV_L( REGOFF(V4F_START, ESI), ESI ) - - MOV_L( REGOFF(V4F_START, EDI), EDI ) - ADD_L( EDI, ECX ) - - CMP_L( ESI, EDI ) - JE( LLBL(x86_p4_ir_done) ) - -ALIGNTEXT16 -LLBL(x86_p4_ir_loop): - - MOV_L( SRC0, EBX ) - MOV_L( SRC1, EDX ) - - MOV_L( EBX, DST0 ) - MOV_L( EDX, DST1 ) - - MOV_L( SRC2, EBX ) - MOV_L( SRC3, EDX ) - - MOV_L( EBX, DST2 ) - MOV_L( EDX, DST3 ) - -LLBL(x86_p4_ir_skip): - - ADD_L( CONST(16), EDI ) - ADD_L( EAX, ESI ) - CMP_L( ECX, EDI ) - JNE( LLBL(x86_p4_ir_loop) ) - -LLBL(x86_p4_ir_done): - - POP_L( EBX ) - POP_L( EDI ) - POP_L( ESI ) - RET - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif + +/* + * 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. + */ + +/* + * NOTE: Avoid using spaces in between '(' ')' and arguments, especially + * with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces + * in there will break the build on some platforms. + */ + +#include "assyntax.h" +#include "matypes.h" +#include "xform_args.h" + + SEG_TEXT + +#define FP_ONE 1065353216 +#define FP_ZERO 0 + +#define SRC0 REGOFF(0, ESI) +#define SRC1 REGOFF(4, ESI) +#define SRC2 REGOFF(8, ESI) +#define SRC3 REGOFF(12, ESI) +#define DST0 REGOFF(0, EDI) +#define DST1 REGOFF(4, EDI) +#define DST2 REGOFF(8, EDI) +#define DST3 REGOFF(12, EDI) +#define MAT0 REGOFF(0, EDX) +#define MAT1 REGOFF(4, EDX) +#define MAT2 REGOFF(8, EDX) +#define MAT3 REGOFF(12, EDX) +#define MAT4 REGOFF(16, EDX) +#define MAT5 REGOFF(20, EDX) +#define MAT6 REGOFF(24, EDX) +#define MAT7 REGOFF(28, EDX) +#define MAT8 REGOFF(32, EDX) +#define MAT9 REGOFF(36, EDX) +#define MAT10 REGOFF(40, EDX) +#define MAT11 REGOFF(44, EDX) +#define MAT12 REGOFF(48, EDX) +#define MAT13 REGOFF(52, EDX) +#define MAT14 REGOFF(56, EDX) +#define MAT15 REGOFF(60, EDX) + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points4_general ) +HIDDEN(_mesa_x86_transform_points4_general) +GLNAME( _mesa_x86_transform_points4_general ): + +#define FRAME_OFFSET 8 + PUSH_L( ESI ) + PUSH_L( EDI ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p4_gr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p4_gr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + FLD_S( SRC0 ) /* F6 F5 F4 */ + FMUL_S( MAT2 ) + FLD_S( SRC0 ) /* F7 F6 F5 F4 */ + FMUL_S( MAT3 ) + + FLD_S( SRC1 ) /* F0 F7 F6 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT5 ) + FLD_S( SRC1 ) /* F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT6 ) + FLD_S( SRC1 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT7 ) + + FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ + FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ + + FLD_S( SRC2 ) /* F0 F7 F6 F5 F4 */ + FMUL_S( MAT8 ) + FLD_S( SRC2 ) /* F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT9 ) + FLD_S( SRC2 ) /* F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT10 ) + FLD_S( SRC2 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT11 ) + + FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ + FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ + + FLD_S( SRC3 ) /* F0 F7 F6 F5 F4 */ + FMUL_S( MAT12 ) + FLD_S( SRC3 ) /* F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT13 ) + FLD_S( SRC3 ) /* F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT14 ) + FLD_S( SRC3 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ + FMUL_S( MAT15 ) + + FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ + FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ + + FXCH( ST(3) ) /* F4 F6 F5 F7 */ + FSTP_S( DST0 ) /* F6 F5 F7 */ + FXCH( ST(1) ) /* F5 F6 F7 */ + FSTP_S( DST1 ) /* F6 F7 */ + FSTP_S( DST2 ) /* F7 */ + FSTP_S( DST3 ) /* */ + +LLBL(x86_p4_gr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p4_gr_loop) ) + +LLBL(x86_p4_gr_done): + + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points4_perspective ) +HIDDEN(_mesa_x86_transform_points4_perspective) +GLNAME( _mesa_x86_transform_points4_perspective ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p4_pr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p4_pr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F5 F4 */ + FMUL_S( MAT5 ) + + FLD_S( SRC2 ) /* F0 F5 F4 */ + FMUL_S( MAT8 ) + FLD_S( SRC2 ) /* F1 F0 F5 F4 */ + FMUL_S( MAT9 ) + FLD_S( SRC2 ) /* F6 F1 F0 F5 F4 */ + FMUL_S( MAT10 ) + + FXCH( ST(2) ) /* F0 F1 F6 F5 F4 */ + FADDP( ST0, ST(4) ) /* F1 F6 F5 F4 */ + FADDP( ST0, ST(2) ) /* F6 F5 F4 */ + + FLD_S( SRC3 ) /* F2 F6 F5 F4 */ + FMUL_S( MAT14 ) + + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + MOV_L( SRC2, EBX ) + XOR_L( CONST(-2147483648), EBX )/* change sign */ + + FXCH( ST(2) ) /* F4 F5 F6 */ + FSTP_S( DST0 ) /* F5 F6 */ + FSTP_S( DST1 ) /* F6 */ + FSTP_S( DST2 ) /* */ + MOV_L( EBX, DST3 ) + +LLBL(x86_p4_pr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p4_pr_loop) ) + +LLBL(x86_p4_pr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points4_3d ) +HIDDEN(_mesa_x86_transform_points4_3d) +GLNAME( _mesa_x86_transform_points4_3d ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p4_3dr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p4_3dr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + FLD_S( SRC0 ) /* F6 F5 F4 */ + FMUL_S( MAT2 ) + + FLD_S( SRC1 ) /* F0 F6 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F6 F5 F4 */ + FMUL_S( MAT5 ) + FLD_S( SRC1 ) /* F2 F1 F0 F6 F5 F4 */ + FMUL_S( MAT6 ) + + FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + FLD_S( SRC2 ) /* F0 F6 F5 F4 */ + FMUL_S( MAT8 ) + FLD_S( SRC2 ) /* F1 F0 F6 F5 F4 */ + FMUL_S( MAT9 ) + FLD_S( SRC2 ) /* F2 F1 F0 F6 F5 F4 */ + FMUL_S( MAT10 ) + + FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + FLD_S( SRC3 ) /* F0 F6 F5 F4 */ + FMUL_S( MAT12 ) + FLD_S( SRC3 ) /* F1 F0 F6 F5 F4 */ + FMUL_S( MAT13 ) + FLD_S( SRC3 ) /* F2 F1 F0 F6 F5 F4 */ + FMUL_S( MAT14 ) + + FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + MOV_L( SRC3, EBX ) + + FXCH( ST(2) ) /* F4 F5 F6 */ + FSTP_S( DST0 ) /* F5 F6 */ + FSTP_S( DST1 ) /* F6 */ + FSTP_S( DST2 ) /* */ + MOV_L( EBX, DST3 ) + +LLBL(x86_p4_3dr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p4_3dr_loop) ) + +LLBL(x86_p4_3dr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME(_mesa_x86_transform_points4_3d_no_rot) +HIDDEN(_mesa_x86_transform_points4_3d_no_rot) +GLNAME(_mesa_x86_transform_points4_3d_no_rot): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p4_3dnrr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p4_3dnrr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F5 F4 */ + FMUL_S( MAT5 ) + + FLD_S( SRC2 ) /* F6 F5 F4 */ + FMUL_S( MAT10 ) + + FLD_S( SRC3 ) /* F0 F6 F5 F4 */ + FMUL_S( MAT12 ) + FLD_S( SRC3 ) /* F1 F0 F6 F5 F4 */ + FMUL_S( MAT13 ) + FLD_S( SRC3 ) /* F2 F1 F0 F6 F5 F4 */ + FMUL_S( MAT14 ) + + FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ + FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ + FADDP( ST0, ST(1) ) /* F6 F5 F4 */ + + MOV_L( SRC3, EBX ) + + FXCH( ST(2) ) /* F4 F5 F6 */ + FSTP_S( DST0 ) /* F5 F6 */ + FSTP_S( DST1 ) /* F6 */ + FSTP_S( DST2 ) /* */ + MOV_L( EBX, DST3 ) + +LLBL(x86_p4_3dnrr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p4_3dnrr_loop) ) + +LLBL(x86_p4_3dnrr_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points4_2d ) +HIDDEN(_mesa_x86_transform_points4_2d) +GLNAME( _mesa_x86_transform_points4_2d ): + +#define FRAME_OFFSET 16 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + PUSH_L( EBP ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p4_2dr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p4_2dr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + FLD_S( SRC0 ) /* F5 F4 */ + FMUL_S( MAT1 ) + + FLD_S( SRC1 ) /* F0 F5 F4 */ + FMUL_S( MAT4 ) + FLD_S( SRC1 ) /* F1 F0 F5 F4 */ + FMUL_S( MAT5 ) + + FXCH( ST(1) ) /* F0 F1 F5 F4 */ + FADDP( ST0, ST(3) ) /* F1 F5 F4 */ + FADDP( ST0, ST(1) ) /* F5 F4 */ + + FLD_S( SRC3 ) /* F0 F5 F4 */ + FMUL_S( MAT12 ) + FLD_S( SRC3 ) /* F1 F0 F5 F4 */ + FMUL_S( MAT13 ) + + FXCH( ST(1) ) /* F0 F1 F5 F4 */ + FADDP( ST0, ST(3) ) /* F1 F5 F4 */ + FADDP( ST0, ST(1) ) /* F5 F4 */ + + MOV_L( SRC2, EBX ) + MOV_L( SRC3, EBP ) + + FXCH( ST(1) ) /* F4 F5 */ + FSTP_S( DST0 ) /* F5 */ + FSTP_S( DST1 ) /* */ + MOV_L( EBX, DST2 ) + MOV_L( EBP, DST3 ) + +LLBL(x86_p4_2dr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p4_2dr_loop) ) + +LLBL(x86_p4_2dr_done): + + POP_L( EBP ) + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points4_2d_no_rot ) +HIDDEN(_mesa_x86_transform_points4_2d_no_rot) +GLNAME( _mesa_x86_transform_points4_2d_no_rot ): + +#define FRAME_OFFSET 16 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + PUSH_L( EBP ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p4_2dnrr_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + +ALIGNTEXT16 +LLBL(x86_p4_2dnrr_loop): + + FLD_S( SRC0 ) /* F4 */ + FMUL_S( MAT0 ) + + FLD_S( SRC1 ) /* F5 F4 */ + FMUL_S( MAT5 ) + + FLD_S( SRC3 ) /* F0 F5 F4 */ + FMUL_S( MAT12 ) + FLD_S( SRC3 ) /* F1 F0 F5 F4 */ + FMUL_S( MAT13 ) + + FXCH( ST(1) ) /* F0 F1 F5 F4 */ + FADDP( ST0, ST(3) ) /* F1 F5 F4 */ + FADDP( ST0, ST(1) ) /* F5 F4 */ + + MOV_L( SRC2, EBX ) + MOV_L( SRC3, EBP ) + + FXCH( ST(1) ) /* F4 F5 */ + FSTP_S( DST0 ) /* F5 */ + FSTP_S( DST1 ) /* */ + MOV_L( EBX, DST2 ) + MOV_L( EBP, DST3 ) + +LLBL(x86_p4_2dnrr_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p4_2dnrr_loop) ) + +LLBL(x86_p4_2dnrr_done): + + POP_L( EBP ) + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET +#undef FRAME_OFFSET + + + + +ALIGNTEXT16 +GLOBL GLNAME( _mesa_x86_transform_points4_identity ) +HIDDEN(_mesa_x86_transform_points4_identity) +GLNAME( _mesa_x86_transform_points4_identity ): + +#define FRAME_OFFSET 12 + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBX ) + + MOV_L( ARG_SOURCE, ESI ) + MOV_L( ARG_DEST, EDI ) + + MOV_L( ARG_MATRIX, EDX ) + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + + TEST_L( ECX, ECX ) + JZ( LLBL(x86_p4_ir_done) ) + + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) + + MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) + + SHL_L( CONST(4), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( REGOFF(V4F_START, EDI), EDI ) + ADD_L( EDI, ECX ) + + CMP_L( ESI, EDI ) + JE( LLBL(x86_p4_ir_done) ) + +ALIGNTEXT16 +LLBL(x86_p4_ir_loop): + + MOV_L( SRC0, EBX ) + MOV_L( SRC1, EDX ) + + MOV_L( EBX, DST0 ) + MOV_L( EDX, DST1 ) + + MOV_L( SRC2, EBX ) + MOV_L( SRC3, EDX ) + + MOV_L( EBX, DST2 ) + MOV_L( EDX, DST3 ) + +LLBL(x86_p4_ir_skip): + + ADD_L( CONST(16), EDI ) + ADD_L( EAX, ESI ) + CMP_L( ECX, EDI ) + JNE( LLBL(x86_p4_ir_loop) ) + +LLBL(x86_p4_ir_done): + + POP_L( EBX ) + POP_L( EDI ) + POP_L( ESI ) + RET + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mesa/x86/xform_args.h b/mesalib/src/mesa/x86/xform_args.h index 772ab9d1f..b773f5198 100644 --- a/mesalib/src/mesa/x86/xform_args.h +++ b/mesalib/src/mesa/x86/xform_args.h @@ -1,51 +1,51 @@ - -/* - * 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. - */ - -/* - * Transform function interface for assembly code. Simply define - * FRAME_OFFSET to the number of bytes pushed onto the stack before - * using the ARG_* argument macros. - * - * Gareth Hughes - */ - -#ifndef __XFORM_ARGS_H__ -#define __XFORM_ARGS_H__ - -/* Offsets for transform_func arguments - * - * typedef void (*transform_func)( GLvector4f *to_vec, - * const GLfloat m[16], - * const GLvector4f *from_vec ); - */ -#define OFFSET_DEST 4 -#define OFFSET_MATRIX 8 -#define OFFSET_SOURCE 12 - -#define ARG_DEST REGOFF(FRAME_OFFSET+OFFSET_DEST, ESP) -#define ARG_MATRIX REGOFF(FRAME_OFFSET+OFFSET_MATRIX, ESP) -#define ARG_SOURCE REGOFF(FRAME_OFFSET+OFFSET_SOURCE, ESP) - -#endif + +/* + * 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. + */ + +/* + * Transform function interface for assembly code. Simply define + * FRAME_OFFSET to the number of bytes pushed onto the stack before + * using the ARG_* argument macros. + * + * Gareth Hughes + */ + +#ifndef __XFORM_ARGS_H__ +#define __XFORM_ARGS_H__ + +/* Offsets for transform_func arguments + * + * typedef void (*transform_func)( GLvector4f *to_vec, + * const GLfloat m[16], + * const GLvector4f *from_vec ); + */ +#define OFFSET_DEST 4 +#define OFFSET_MATRIX 8 +#define OFFSET_SOURCE 12 + +#define ARG_DEST REGOFF(FRAME_OFFSET+OFFSET_DEST, ESP) +#define ARG_MATRIX REGOFF(FRAME_OFFSET+OFFSET_MATRIX, ESP) +#define ARG_SOURCE REGOFF(FRAME_OFFSET+OFFSET_SOURCE, ESP) + +#endif -- cgit v1.2.3