diff options
author | marha <marha@users.sourceforge.net> | 2015-01-04 16:25:32 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2015-01-04 16:25:32 +0100 |
commit | 5e5a48ff8cd08f123601cd0625ca62a86675aac9 (patch) | |
tree | ea1c2cee139e8e1ce389a7f956e9874db1e0a650 /mesalib/src/mesa | |
parent | a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9 (diff) | |
download | vcxsrv-5e5a48ff8cd08f123601cd0625ca62a86675aac9.tar.gz vcxsrv-5e5a48ff8cd08f123601cd0625ca62a86675aac9.tar.bz2 vcxsrv-5e5a48ff8cd08f123601cd0625ca62a86675aac9.zip |
fontconfig libX11 mesa xserver git update 4 Jan 2015
xserver commit dc777c346d5d452a53b13b917c45f6a1bad2f20b
libX11 commit 446f5f7f41317a85a0cd0efa5e6a1b37bc99fba2
fontconfig commit 4420b27c074821a1d1f9d6ebe822a610176a417d
mesa commit 48094d0e6554a9df36bf00fc2793ade46cf92406
Diffstat (limited to 'mesalib/src/mesa')
60 files changed, 919 insertions, 1541 deletions
diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am index 932db4fb8..8d8082ae3 100644 --- a/mesalib/src/mesa/Makefile.am +++ b/mesalib/src/mesa/Makefile.am @@ -62,6 +62,23 @@ include $(GLAPI)/glapi_gen.mk BUILDDIR = $(builddir)/ include Makefile.sources +EXTRA_DIST = \ + drivers/haiku \ + drivers/SConscript \ + drivers/windows \ + main/format_info.py \ + main/format_parser.py \ + main/formats.csv \ + main/get_hash_generator.py \ + main/get_hash_params.py \ + program/program_lexer.l \ + program/program_parse.y \ + SConscript \ + swrast/NOTES \ + swrast_setup/NOTES \ + tnl/NOTES \ + tnl_dd + BUILT_SOURCES = \ main/get_hash.h \ main/format_info.c \ @@ -152,8 +169,10 @@ libmesagallium_la_LIBADD = \ libmesa_sse41_la_SOURCES = \ main/streaming-load-memcpy.c \ - main/sse_minmax.c -libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) -msse4.1 + main/streaming-load-memcpy.h \ + main/sse_minmax.c \ + main/sse_minmax.h +libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) $(SSE41_CFLAGS) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = gl.pc diff --git a/mesalib/src/mesa/Makefile.sources b/mesalib/src/mesa/Makefile.sources index 475501877..7ac3bbc71 100644 --- a/mesalib/src/mesa/Makefile.sources +++ b/mesalib/src/mesa/Makefile.sources @@ -8,283 +8,526 @@ BUILDDIR = $(top_builddir)/src/mesa/ # this is part of MAIN_FILES MAIN_ES_FILES = \ - $(SRCDIR)main/es1_conversion.c + $(SRCDIR)main/es1_conversion.c \ + $(SRCDIR)main/es1_conversion.h MAIN_FILES = \ + $(SRCDIR)main/accum.c \ + $(SRCDIR)main/accum.h \ $(SRCDIR)main/api_arrayelt.c \ + $(SRCDIR)main/api_arrayelt.h \ $(BUILDDIR)main/api_exec.c \ + $(SRCDIR)main/api_exec.h \ $(SRCDIR)main/api_loopback.c \ + $(SRCDIR)main/api_loopback.h \ $(SRCDIR)main/api_validate.c \ - $(SRCDIR)main/accum.c \ + $(SRCDIR)main/api_validate.h \ $(SRCDIR)main/arbprogram.c \ + $(SRCDIR)main/arbprogram.h \ + $(SRCDIR)main/arrayobj.c \ + $(SRCDIR)main/arrayobj.h \ $(SRCDIR)main/atifragshader.c \ + $(SRCDIR)main/atifragshader.h \ $(SRCDIR)main/attrib.c \ - $(SRCDIR)main/arrayobj.c \ + $(SRCDIR)main/attrib.h \ + $(SRCDIR)main/bitset.h \ $(SRCDIR)main/blend.c \ + $(SRCDIR)main/blend.h \ $(SRCDIR)main/blit.c \ + $(SRCDIR)main/blit.h \ $(SRCDIR)main/bufferobj.c \ + $(SRCDIR)main/bufferobj.h \ $(SRCDIR)main/buffers.c \ + $(SRCDIR)main/buffers.h \ $(SRCDIR)main/clear.c \ + $(SRCDIR)main/clear.h \ $(SRCDIR)main/clip.c \ + $(SRCDIR)main/clip.h \ + $(SRCDIR)main/colormac.h \ $(SRCDIR)main/colortab.c \ + $(SRCDIR)main/colortab.h \ $(SRCDIR)main/compute.c \ + $(SRCDIR)main/compute.h \ + $(SRCDIR)main/compiler.h \ $(SRCDIR)main/condrender.c \ + $(SRCDIR)main/condrender.h \ + $(SRCDIR)main/config.h \ $(SRCDIR)main/context.c \ + $(SRCDIR)main/context.h \ $(SRCDIR)main/convolve.c \ + $(SRCDIR)main/convolve.h \ $(SRCDIR)main/copyimage.c \ + $(SRCDIR)main/copyimage.h \ + $(SRCDIR)main/core.h \ $(SRCDIR)main/cpuinfo.c \ + $(SRCDIR)main/cpuinfo.h \ + $(SRCDIR)main/dd.h \ $(SRCDIR)main/debug.c \ + $(SRCDIR)main/debug.h \ $(SRCDIR)main/depth.c \ + $(SRCDIR)main/depth.h \ $(SRCDIR)main/dlist.c \ + $(SRCDIR)main/dlist.h \ + $(SRCDIR)main/dlopen.h \ $(SRCDIR)main/drawpix.c \ + $(SRCDIR)main/drawpix.h \ $(SRCDIR)main/drawtex.c \ + $(SRCDIR)main/drawtex.h \ $(SRCDIR)main/enable.c \ + $(SRCDIR)main/enable.h \ + $(BUILDDIR)main/enums.c \ + $(SRCDIR)main/enums.h \ $(SRCDIR)main/errors.c \ + $(SRCDIR)main/errors.h \ $(SRCDIR)main/eval.c \ + $(SRCDIR)main/eval.h \ $(SRCDIR)main/execmem.c \ $(SRCDIR)main/extensions.c \ + $(SRCDIR)main/extensions.h \ $(SRCDIR)main/fbobject.c \ + $(SRCDIR)main/fbobject.h \ $(SRCDIR)main/feedback.c \ - $(SRCDIR)main/ffvertex_prog.c \ + $(SRCDIR)main/feedback.h \ $(SRCDIR)main/ff_fragment_shader.cpp \ + $(SRCDIR)main/ffvertex_prog.c \ + $(SRCDIR)main/ffvertex_prog.h \ $(SRCDIR)main/fog.c \ + $(SRCDIR)main/fog.h \ + $(SRCDIR)main/format_pack.c \ + $(SRCDIR)main/format_pack.h \ $(SRCDIR)main/formatquery.c \ + $(SRCDIR)main/formatquery.h \ $(SRCDIR)main/formats.c \ - $(SRCDIR)main/format_pack.c \ + $(SRCDIR)main/formats.h \ $(SRCDIR)main/format_unpack.c \ + $(SRCDIR)main/format_unpack.h \ $(SRCDIR)main/format_utils.c \ + $(SRCDIR)main/format_utils.h \ $(SRCDIR)main/framebuffer.c \ + $(SRCDIR)main/framebuffer.h \ $(SRCDIR)main/get.c \ + $(SRCDIR)main/get.h \ $(SRCDIR)main/genmipmap.c \ + $(SRCDIR)main/genmipmap.h \ $(SRCDIR)main/getstring.c \ $(SRCDIR)main/glformats.c \ + $(SRCDIR)main/glformats.h \ + $(SRCDIR)main/glheader.h \ $(SRCDIR)main/hash.c \ + $(SRCDIR)main/hash.h \ $(SRCDIR)main/hint.c \ + $(SRCDIR)main/hint.h \ $(SRCDIR)main/histogram.c \ + $(SRCDIR)main/histogram.h \ $(SRCDIR)main/image.c \ + $(SRCDIR)main/image.h \ $(SRCDIR)main/imports.c \ + $(SRCDIR)main/imports.h \ $(SRCDIR)main/light.c \ + $(SRCDIR)main/light.h \ $(SRCDIR)main/lines.c \ + $(SRCDIR)main/lines.h \ + $(SRCDIR)main/macros.h \ $(SRCDIR)main/matrix.c \ + $(SRCDIR)main/matrix.h \ $(SRCDIR)main/mipmap.c \ + $(SRCDIR)main/mipmap.h \ $(SRCDIR)main/mm.c \ + $(SRCDIR)main/mm.h \ + $(SRCDIR)main/mtypes.h \ $(SRCDIR)main/multisample.c \ - $(SRCDIR)main/objectlabel.c \ + $(SRCDIR)main/multisample.h \ + $(SRCDIR)main/objectlabel.c \ + $(SRCDIR)main/objectlabel.h \ $(SRCDIR)main/pack.c \ + $(SRCDIR)main/pack.h \ + $(SRCDIR)main/pack_tmp.h \ $(SRCDIR)main/pbo.c \ + $(SRCDIR)main/pbo.h \ $(SRCDIR)main/performance_monitor.c \ + $(SRCDIR)main/performance_monitor.h \ $(SRCDIR)main/pipelineobj.c \ + $(SRCDIR)main/pipelineobj.h \ $(SRCDIR)main/pixel.c \ + $(SRCDIR)main/pixel.h \ $(SRCDIR)main/pixelstore.c \ + $(SRCDIR)main/pixelstore.h \ $(SRCDIR)main/pixeltransfer.c \ + $(SRCDIR)main/pixeltransfer.h \ $(SRCDIR)main/points.c \ + $(SRCDIR)main/points.h \ $(SRCDIR)main/polygon.c \ - $(SRCDIR)main/queryobj.c \ + $(SRCDIR)main/polygon.h \ $(SRCDIR)main/querymatrix.c \ + $(SRCDIR)main/querymatrix.h \ + $(SRCDIR)main/queryobj.c \ + $(SRCDIR)main/queryobj.h \ $(SRCDIR)main/rastpos.c \ + $(SRCDIR)main/rastpos.h \ $(SRCDIR)main/readpix.c \ + $(SRCDIR)main/readpix.h \ $(SRCDIR)main/remap.c \ + $(SRCDIR)main/remap.h \ $(SRCDIR)main/renderbuffer.c \ + $(SRCDIR)main/renderbuffer.h \ $(SRCDIR)main/samplerobj.c \ + $(SRCDIR)main/samplerobj.h \ $(SRCDIR)main/scissor.c \ + $(SRCDIR)main/scissor.h \ $(SRCDIR)main/set.c \ + $(SRCDIR)main/set.h \ $(SRCDIR)main/shaderapi.c \ + $(SRCDIR)main/shaderapi.h \ $(SRCDIR)main/shaderimage.c \ + $(SRCDIR)main/shaderimage.h \ $(SRCDIR)main/shaderobj.c \ + $(SRCDIR)main/shaderobj.h \ $(SRCDIR)main/shader_query.cpp \ $(SRCDIR)main/shared.c \ + $(SRCDIR)main/shared.h \ + $(SRCDIR)main/simple_list.h \ $(SRCDIR)main/state.c \ + $(SRCDIR)main/state.h \ $(SRCDIR)main/stencil.c \ + $(SRCDIR)main/stencil.h \ $(SRCDIR)main/syncobj.c \ + $(SRCDIR)main/syncobj.h \ $(SRCDIR)main/texcompress.c \ $(SRCDIR)main/texcompress_bptc.c \ + $(SRCDIR)main/texcompress_bptc.h \ $(SRCDIR)main/texcompress_cpal.c \ + $(SRCDIR)main/texcompress_cpal.h \ + $(SRCDIR)main/texcompress_etc.c \ + $(SRCDIR)main/texcompress_etc.h \ + $(SRCDIR)main/texcompress_etc_tmp.h \ + $(SRCDIR)main/texcompress_fxt1.c \ + $(SRCDIR)main/texcompress_fxt1.h \ + $(SRCDIR)main/texcompress.h \ $(SRCDIR)main/texcompress_rgtc.c \ + $(SRCDIR)main/texcompress_rgtc.h \ $(SRCDIR)main/texcompress_s3tc.c \ - $(SRCDIR)main/texcompress_fxt1.c \ - $(SRCDIR)main/texcompress_etc.c \ + $(SRCDIR)main/texcompress_s3tc.h \ $(SRCDIR)main/texenv.c \ + $(SRCDIR)main/texenv.h \ + $(SRCDIR)main/texenvprogram.h \ $(SRCDIR)main/texformat.c \ + $(SRCDIR)main/texformat.h \ $(SRCDIR)main/texgen.c \ + $(SRCDIR)main/texgen.h \ $(SRCDIR)main/texgetimage.c \ + $(SRCDIR)main/texgetimage.h \ $(SRCDIR)main/teximage.c \ + $(SRCDIR)main/teximage.h \ $(SRCDIR)main/texobj.c \ + $(SRCDIR)main/texobj.h \ $(SRCDIR)main/texparam.c \ + $(SRCDIR)main/texparam.h \ $(SRCDIR)main/texstate.c \ + $(SRCDIR)main/texstate.h \ $(SRCDIR)main/texstorage.c \ + $(SRCDIR)main/texstorage.h \ $(SRCDIR)main/texstore.c \ - $(SRCDIR)main/textureview.c \ + $(SRCDIR)main/texstore.h \ + $(SRCDIR)main/textureview.c \ + $(SRCDIR)main/textureview.h \ $(SRCDIR)main/texturebarrier.c \ + $(SRCDIR)main/texturebarrier.h \ $(SRCDIR)main/transformfeedback.c \ - $(SRCDIR)main/uniforms.c \ + $(SRCDIR)main/transformfeedback.h \ $(SRCDIR)main/uniform_query.cpp \ + $(SRCDIR)main/uniforms.c \ + $(SRCDIR)main/uniforms.h \ $(SRCDIR)main/varray.c \ + $(SRCDIR)main/varray.h \ $(SRCDIR)main/vdpau.c \ + $(SRCDIR)main/vdpau.h \ $(SRCDIR)main/version.c \ + $(SRCDIR)main/version.h \ $(SRCDIR)main/viewport.c \ + $(SRCDIR)main/viewport.h \ $(SRCDIR)main/vtxfmt.c \ - $(BUILDDIR)main/enums.c \ + $(SRCDIR)main/vtxfmt.h \ $(MAIN_ES_FILES) MATH_FILES = \ + $(SRCDIR)math/m_debug.h \ $(SRCDIR)math/m_debug_clip.c \ $(SRCDIR)math/m_debug_norm.c \ + $(SRCDIR)math/m_debug_util.h \ $(SRCDIR)math/m_debug_xform.c \ $(SRCDIR)math/m_eval.c \ + $(SRCDIR)math/m_eval.h \ $(SRCDIR)math/m_matrix.c \ + $(SRCDIR)math/m_matrix.h \ + $(SRCDIR)math/m_trans_tmp.h \ $(SRCDIR)math/m_translate.c \ - $(SRCDIR)math/m_vector.c + $(SRCDIR)math/m_translate.h \ + $(SRCDIR)math/m_vector.c \ + $(SRCDIR)math/m_vector.h MATH_XFORM_FILES = \ - $(SRCDIR)math/m_xform.c + $(SRCDIR)math/m_clip_tmp.h \ + $(SRCDIR)math/m_copy_tmp.h \ + $(SRCDIR)math/m_dotprod_tmp.h \ + $(SRCDIR)math/m_norm_tmp.h \ + $(SRCDIR)math/m_xform.c \ + $(SRCDIR)math/m_xform.h \ + $(SRCDIR)math/m_xform_tmp.h SWRAST_FILES = \ $(SRCDIR)swrast/s_aaline.c \ + $(SRCDIR)swrast/s_aaline.h \ + $(SRCDIR)swrast/s_aalinetemp.h \ $(SRCDIR)swrast/s_aatriangle.c \ + $(SRCDIR)swrast/s_aatriangle.h \ + $(SRCDIR)swrast/s_aatritemp.h \ $(SRCDIR)swrast/s_alpha.c \ + $(SRCDIR)swrast/s_alpha.h \ $(SRCDIR)swrast/s_atifragshader.c \ + $(SRCDIR)swrast/s_atifragshader.h \ $(SRCDIR)swrast/s_bitmap.c \ $(SRCDIR)swrast/s_blend.c \ + $(SRCDIR)swrast/s_blend.h \ $(SRCDIR)swrast/s_blit.c \ + $(SRCDIR)swrast/s_chan.h \ $(SRCDIR)swrast/s_clear.c \ - $(SRCDIR)swrast/s_copypix.c \ $(SRCDIR)swrast/s_context.c \ + $(SRCDIR)swrast/s_context.h \ + $(SRCDIR)swrast/s_copypix.c \ $(SRCDIR)swrast/s_depth.c \ + $(SRCDIR)swrast/s_depth.h \ $(SRCDIR)swrast/s_drawpix.c \ + $(SRCDIR)swrast_setup/ss_tritmp.h \ + $(SRCDIR)swrast_setup/ss_vb.h \ + $(SRCDIR)swrast_setup/swrast_setup.h \ $(SRCDIR)swrast/s_feedback.c \ + $(SRCDIR)swrast/s_feedback.h \ $(SRCDIR)swrast/s_fog.c \ + $(SRCDIR)swrast/s_fog.h \ $(SRCDIR)swrast/s_fragprog.c \ + $(SRCDIR)swrast/s_fragprog.h \ $(SRCDIR)swrast/s_lines.c \ + $(SRCDIR)swrast/s_lines.h \ + $(SRCDIR)swrast/s_linetemp.h \ $(SRCDIR)swrast/s_logic.c \ + $(SRCDIR)swrast/s_logic.h \ $(SRCDIR)swrast/s_masking.c \ + $(SRCDIR)swrast/s_masking.h \ $(SRCDIR)swrast/s_points.c \ + $(SRCDIR)swrast/s_points.h \ $(SRCDIR)swrast/s_renderbuffer.c \ + $(SRCDIR)swrast/s_renderbuffer.h \ $(SRCDIR)swrast/s_span.c \ + $(SRCDIR)swrast/s_span.h \ $(SRCDIR)swrast/s_stencil.c \ + $(SRCDIR)swrast/s_stencil.h \ $(SRCDIR)swrast/s_texcombine.c \ + $(SRCDIR)swrast/s_texcombine.h \ $(SRCDIR)swrast/s_texfetch.c \ + $(SRCDIR)swrast/s_texfetch.h \ + $(SRCDIR)swrast/s_texfetch_tmp.h \ $(SRCDIR)swrast/s_texfilter.c \ + $(SRCDIR)swrast/s_texfilter.h \ $(SRCDIR)swrast/s_texrender.c \ $(SRCDIR)swrast/s_texture.c \ $(SRCDIR)swrast/s_triangle.c \ - $(SRCDIR)swrast/s_zoom.c + $(SRCDIR)swrast/s_triangle.h \ + $(SRCDIR)swrast/s_tritemp.h \ + $(SRCDIR)swrast/swrast.h \ + $(SRCDIR)swrast/s_zoom.c \ + $(SRCDIR)swrast/s_zoom.h SWRAST_SETUP_FILES = \ $(SRCDIR)swrast_setup/ss_context.c \ - $(SRCDIR)swrast_setup/ss_triangle.c + $(SRCDIR)swrast_setup/ss_context.h \ + $(SRCDIR)swrast_setup/ss_triangle.c \ + $(SRCDIR)swrast_setup/ss_triangle.h TNL_FILES = \ $(SRCDIR)tnl/t_context.c \ - $(SRCDIR)tnl/t_pipeline.c \ + $(SRCDIR)tnl/t_context.h \ $(SRCDIR)tnl/t_draw.c \ + $(SRCDIR)tnl/tnl.h \ + $(SRCDIR)tnl/t_pipeline.c \ + $(SRCDIR)tnl/t_pipeline.h \ $(SRCDIR)tnl/t_rasterpos.c \ + $(SRCDIR)tnl/t_vb_cliptmp.h \ + $(SRCDIR)tnl/t_vb_fog.c \ + $(SRCDIR)tnl/t_vb_light.c \ + $(SRCDIR)tnl/t_vb_lighttmp.h \ + $(SRCDIR)tnl/t_vb_normals.c \ + $(SRCDIR)tnl/t_vb_points.c \ $(SRCDIR)tnl/t_vb_program.c \ $(SRCDIR)tnl/t_vb_render.c \ + $(SRCDIR)tnl/t_vb_rendertmp.h \ $(SRCDIR)tnl/t_vb_texgen.c \ $(SRCDIR)tnl/t_vb_texmat.c \ $(SRCDIR)tnl/t_vb_vertex.c \ - $(SRCDIR)tnl/t_vb_fog.c \ - $(SRCDIR)tnl/t_vb_light.c \ - $(SRCDIR)tnl/t_vb_normals.c \ - $(SRCDIR)tnl/t_vb_points.c \ - $(SRCDIR)tnl/t_vp_build.c \ $(SRCDIR)tnl/t_vertex.c \ + $(SRCDIR)tnl/t_vertex_generic.c \ + $(SRCDIR)tnl/t_vertex.h \ $(SRCDIR)tnl/t_vertex_sse.c \ - $(SRCDIR)tnl/t_vertex_generic.c + $(SRCDIR)tnl/t_vp_build.c \ + $(SRCDIR)tnl/t_vp_build.h VBO_FILES = \ + $(SRCDIR)vbo/vbo_attrib.h \ + $(SRCDIR)vbo/vbo_attrib_tmp.h \ $(SRCDIR)vbo/vbo_context.c \ - $(SRCDIR)vbo/vbo_exec.c \ + $(SRCDIR)vbo/vbo_context.h \ $(SRCDIR)vbo/vbo_exec_api.c \ $(SRCDIR)vbo/vbo_exec_array.c \ + $(SRCDIR)vbo/vbo_exec.c \ $(SRCDIR)vbo/vbo_exec_draw.c \ $(SRCDIR)vbo/vbo_exec_eval.c \ + $(SRCDIR)vbo/vbo_exec.h \ + $(SRCDIR)vbo/vbo.h \ $(SRCDIR)vbo/vbo_noop.c \ + $(SRCDIR)vbo/vbo_noop.h \ $(SRCDIR)vbo/vbo_primitive_restart.c \ $(SRCDIR)vbo/vbo_rebase.c \ - $(SRCDIR)vbo/vbo_split.c \ - $(SRCDIR)vbo/vbo_split_copy.c \ - $(SRCDIR)vbo/vbo_split_inplace.c \ - $(SRCDIR)vbo/vbo_save.c \ $(SRCDIR)vbo/vbo_save_api.c \ + $(SRCDIR)vbo/vbo_save.c \ $(SRCDIR)vbo/vbo_save_draw.c \ - $(SRCDIR)vbo/vbo_save_loopback.c + $(SRCDIR)vbo/vbo_save.h \ + $(SRCDIR)vbo/vbo_save_loopback.c \ + $(SRCDIR)vbo/vbo_split.c \ + $(SRCDIR)vbo/vbo_split_copy.c \ + $(SRCDIR)vbo/vbo_split.h \ + $(SRCDIR)vbo/vbo_split_inplace.c STATETRACKER_FILES = \ - $(SRCDIR)state_tracker/st_atom.c \ $(SRCDIR)state_tracker/st_atom_array.c \ $(SRCDIR)state_tracker/st_atom_blend.c \ + $(SRCDIR)state_tracker/st_atom.c \ $(SRCDIR)state_tracker/st_atom_clip.c \ $(SRCDIR)state_tracker/st_atom_constbuf.c \ + $(SRCDIR)state_tracker/st_atom_constbuf.h \ $(SRCDIR)state_tracker/st_atom_depth.c \ $(SRCDIR)state_tracker/st_atom_framebuffer.c \ + $(SRCDIR)state_tracker/st_atom.h \ $(SRCDIR)state_tracker/st_atom_msaa.c \ $(SRCDIR)state_tracker/st_atom_pixeltransfer.c \ + $(SRCDIR)state_tracker/st_atom_rasterizer.c \ $(SRCDIR)state_tracker/st_atom_sampler.c \ $(SRCDIR)state_tracker/st_atom_scissor.c \ $(SRCDIR)state_tracker/st_atom_shader.c \ - $(SRCDIR)state_tracker/st_atom_rasterizer.c \ + $(SRCDIR)state_tracker/st_atom_shader.h \ $(SRCDIR)state_tracker/st_atom_stipple.c \ $(SRCDIR)state_tracker/st_atom_texture.c \ $(SRCDIR)state_tracker/st_atom_viewport.c \ + $(SRCDIR)state_tracker/st_cache.h \ $(SRCDIR)state_tracker/st_cb_bitmap.c \ + $(SRCDIR)state_tracker/st_cb_bitmap.h \ $(SRCDIR)state_tracker/st_cb_blit.c \ + $(SRCDIR)state_tracker/st_cb_blit.h \ $(SRCDIR)state_tracker/st_cb_bufferobjects.c \ + $(SRCDIR)state_tracker/st_cb_bufferobjects.h \ $(SRCDIR)state_tracker/st_cb_clear.c \ + $(SRCDIR)state_tracker/st_cb_clear.h \ $(SRCDIR)state_tracker/st_cb_condrender.c \ - $(SRCDIR)state_tracker/st_cb_flush.c \ + $(SRCDIR)state_tracker/st_cb_condrender.h \ $(SRCDIR)state_tracker/st_cb_drawpixels.c \ + $(SRCDIR)state_tracker/st_cb_drawpixels.h \ $(SRCDIR)state_tracker/st_cb_drawtex.c \ + $(SRCDIR)state_tracker/st_cb_drawtex.h \ $(SRCDIR)state_tracker/st_cb_eglimage.c \ + $(SRCDIR)state_tracker/st_cb_eglimage.h \ $(SRCDIR)state_tracker/st_cb_fbo.c \ + $(SRCDIR)state_tracker/st_cb_fbo.h \ $(SRCDIR)state_tracker/st_cb_feedback.c \ + $(SRCDIR)state_tracker/st_cb_feedback.h \ + $(SRCDIR)state_tracker/st_cb_flush.c \ + $(SRCDIR)state_tracker/st_cb_flush.h \ $(SRCDIR)state_tracker/st_cb_msaa.c \ + $(SRCDIR)state_tracker/st_cb_msaa.h \ $(SRCDIR)state_tracker/st_cb_program.c \ + $(SRCDIR)state_tracker/st_cb_program.h \ $(SRCDIR)state_tracker/st_cb_queryobj.c \ + $(SRCDIR)state_tracker/st_cb_queryobj.h \ $(SRCDIR)state_tracker/st_cb_rasterpos.c \ + $(SRCDIR)state_tracker/st_cb_rasterpos.h \ $(SRCDIR)state_tracker/st_cb_readpixels.c \ - $(SRCDIR)state_tracker/st_cb_syncobj.c \ + $(SRCDIR)state_tracker/st_cb_readpixels.h \ $(SRCDIR)state_tracker/st_cb_strings.c \ - $(SRCDIR)state_tracker/st_cb_texture.c \ + $(SRCDIR)state_tracker/st_cb_strings.h \ + $(SRCDIR)state_tracker/st_cb_syncobj.c \ + $(SRCDIR)state_tracker/st_cb_syncobj.h \ $(SRCDIR)state_tracker/st_cb_texturebarrier.c \ + $(SRCDIR)state_tracker/st_cb_texturebarrier.h \ + $(SRCDIR)state_tracker/st_cb_texture.c \ + $(SRCDIR)state_tracker/st_cb_texture.h \ $(SRCDIR)state_tracker/st_cb_viewport.c \ + $(SRCDIR)state_tracker/st_cb_viewport.h \ $(SRCDIR)state_tracker/st_cb_xformfb.c \ + $(SRCDIR)state_tracker/st_cb_xformfb.h \ $(SRCDIR)state_tracker/st_context.c \ + $(SRCDIR)state_tracker/st_context.h \ $(SRCDIR)state_tracker/st_debug.c \ + $(SRCDIR)state_tracker/st_debug.h \ $(SRCDIR)state_tracker/st_draw.c \ $(SRCDIR)state_tracker/st_draw_feedback.c \ + $(SRCDIR)state_tracker/st_draw.h \ $(SRCDIR)state_tracker/st_extensions.c \ + $(SRCDIR)state_tracker/st_extensions.h \ $(SRCDIR)state_tracker/st_format.c \ + $(SRCDIR)state_tracker/st_format.h \ $(SRCDIR)state_tracker/st_gen_mipmap.c \ + $(SRCDIR)state_tracker/st_gen_mipmap.h \ + $(SRCDIR)state_tracker/st_gl_api.h \ $(SRCDIR)state_tracker/st_glsl_to_tgsi.cpp \ + $(SRCDIR)state_tracker/st_glsl_to_tgsi.h \ $(SRCDIR)state_tracker/st_manager.c \ + $(SRCDIR)state_tracker/st_manager.h \ $(SRCDIR)state_tracker/st_mesa_to_tgsi.c \ + $(SRCDIR)state_tracker/st_mesa_to_tgsi.h \ $(SRCDIR)state_tracker/st_program.c \ + $(SRCDIR)state_tracker/st_program.h \ $(SRCDIR)state_tracker/st_texture.c \ - $(SRCDIR)state_tracker/st_vdpau.c + $(SRCDIR)state_tracker/st_texture.h \ + $(SRCDIR)state_tracker/st_vdpau.c \ + $(SRCDIR)state_tracker/st_vdpau.h PROGRAM_FILES = \ $(SRCDIR)program/arbprogparse.c \ - $(SRCDIR)program/prog_hash_table.c \ + $(SRCDIR)program/arbprogparse.h \ + $(SRCDIR)program/hash_table.h \ $(SRCDIR)program/ir_to_mesa.cpp \ - $(SRCDIR)program/program.c \ - $(SRCDIR)program/program_parse_extra.c \ + $(SRCDIR)program/ir_to_mesa.h \ + $(BUILDDIR)program/lex.yy.c \ $(SRCDIR)program/prog_cache.c \ + $(SRCDIR)program/prog_cache.h \ $(SRCDIR)program/prog_execute.c \ + $(SRCDIR)program/prog_execute.h \ + $(SRCDIR)program/prog_hash_table.c \ $(SRCDIR)program/prog_instruction.c \ + $(SRCDIR)program/prog_instruction.h \ $(SRCDIR)program/prog_noise.c \ - $(SRCDIR)program/prog_optimize.c \ + $(SRCDIR)program/prog_noise.h \ $(SRCDIR)program/prog_opt_constant_fold.c \ + $(SRCDIR)program/prog_optimize.c \ + $(SRCDIR)program/prog_optimize.h \ $(SRCDIR)program/prog_parameter.c \ + $(SRCDIR)program/prog_parameter.h \ $(SRCDIR)program/prog_parameter_layout.c \ + $(SRCDIR)program/prog_parameter_layout.h \ $(SRCDIR)program/prog_print.c \ - $(SRCDIR)program/prog_statevars.c \ + $(SRCDIR)program/prog_print.h \ + $(SRCDIR)program/program.c \ + $(SRCDIR)program/program.h \ $(SRCDIR)program/programopt.c \ + $(SRCDIR)program/programopt.h \ + $(SRCDIR)program/program_parse_extra.c \ + $(BUILDDIR)program/program_parse.tab.c \ + $(BUILDDIR)program/program_parse.tab.h \ + $(SRCDIR)program/program_parser.h \ + $(SRCDIR)program/prog_statevars.c \ + $(SRCDIR)program/prog_statevars.h \ $(SRCDIR)program/sampler.cpp \ + $(SRCDIR)program/sampler.h \ $(SRCDIR)program/string_to_uint_map.cpp \ $(SRCDIR)program/symbol_table.c \ - $(BUILDDIR)program/lex.yy.c \ - $(BUILDDIR)program/program_parse.tab.c + $(SRCDIR)program/symbol_table.h ASM_C_FILES = \ $(SRCDIR)x86/common_x86.c \ @@ -292,21 +535,32 @@ ASM_C_FILES = \ $(SRCDIR)x86/3dnow.c \ $(SRCDIR)x86/sse.c \ $(SRCDIR)x86/rtasm/x86sse.c \ + $(SRCDIR)x86/rtasm/x86sse.h \ $(SRCDIR)sparc/sparc.c \ $(SRCDIR)x86-64/x86-64.c X86_FILES = \ + $(SRCDIR)x86/assyntax.h \ + $(SRCDIR)x86/clip_args.h \ + $(SRCDIR)x86/norm_args.h \ + $(SRCDIR)x86/xform_args.h \ $(SRCDIR)x86/common_x86_asm.S \ + $(SRCDIR)x86/common_x86_asm.h \ + $(SRCDIR)x86/common_x86_features.h \ + $(SRCDIR)x86/x86_xform.h \ $(SRCDIR)x86/x86_xform2.S \ $(SRCDIR)x86/x86_xform3.S \ $(SRCDIR)x86/x86_xform4.S \ $(SRCDIR)x86/x86_cliptest.S \ - $(SRCDIR)x86/mmx_blend.S \ + $(SRCDIR)x86/mmx.h \ + $(SRCDIR)x86/mmx_blend.S \ + $(SRCDIR)x86/mmx_blendtmp.h \ + $(SRCDIR)x86/3dnow.h \ $(SRCDIR)x86/3dnow_xform1.S \ $(SRCDIR)x86/3dnow_xform2.S \ $(SRCDIR)x86/3dnow_xform3.S \ $(SRCDIR)x86/3dnow_xform4.S \ - $(SRCDIR)x86/3dnow_normal.S \ + $(SRCDIR)x86/sse.h \ $(SRCDIR)x86/sse_xform1.S \ $(SRCDIR)x86/sse_xform2.S \ $(SRCDIR)x86/sse_xform3.S \ @@ -315,19 +569,24 @@ X86_FILES = \ $(SRCDIR)x86/read_rgba_span_x86.S X86_64_FILES = \ + $(SRCDIR)x86-64/x86-64.h \ $(SRCDIR)x86-64/xform4.S SPARC_FILES = \ + $(SRCDIR)sparc/sparc.h \ $(SRCDIR)sparc/sparc_clip.S \ + $(SRCDIR)sparc/sparc_matrix.h \ $(SRCDIR)sparc/norm.S \ $(SRCDIR)sparc/xform.S COMMON_DRIVER_FILES = \ $(SRCDIR)drivers/common/driverfuncs.c \ + $(SRCDIR)drivers/common/driverfuncs.h \ $(SRCDIR)drivers/common/meta_blit.c \ $(SRCDIR)drivers/common/meta_copy_image.c \ $(SRCDIR)drivers/common/meta_generate_mipmap.c \ - $(SRCDIR)drivers/common/meta.c + $(SRCDIR)drivers/common/meta.c \ + $(SRCDIR)drivers/common/meta.h # Sources for building non-Gallium drivers diff --git a/mesalib/src/mesa/drivers/dri/Makefile.am b/mesalib/src/mesa/drivers/dri/Makefile.am index 2009da921..fa1de103b 100644 --- a/mesalib/src/mesa/drivers/dri/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/Makefile.am @@ -46,7 +46,8 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = dri.pc driincludedir = $(includedir)/GL/internal -driinclude_HEADERS = $(top_srcdir)/include/GL/internal/dri_interface.h +driinclude_HEADERS = \ + $(top_srcdir)/include/GL/internal/dri_interface.h nodist_EXTRA_mesa_dri_drivers_la_SOURCES = dummy.cpp mesa_dri_drivers_la_SOURCES = @@ -76,6 +77,12 @@ all-local: mesa_dri_drivers.la ln -f $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so \ $(top_builddir)/$(LIB_DIR)/$$i; \ done; + +clean-local: + $(AM_V_GEN)$(RM) $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so; + $(AM_V_GEN)for i in $(MEGADRIVERS); do \ + $(RM) $(top_builddir)/$(LIB_DIR)/$$i; \ + done; endif # hardlink each megadriver instance, but don't actually have @@ -85,6 +92,11 @@ install-data-hook: ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so \ $(DESTDIR)$(dridir)/$$i; \ done; - $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.* + $(RM) $(DESTDIR)$(dridir)/mesa_dri_drivers.* + +uninstall-hook: + for i in $(MEGADRIVERS); do \ + $(RM) $(DESTDIR)$(dridir)/$$i; \ + done; endif diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.am b/mesalib/src/mesa/drivers/dri/common/Makefile.am index 7222a96c6..af6f742a0 100644 --- a/mesalib/src/mesa/drivers/dri/common/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/common/Makefile.am @@ -23,6 +23,8 @@ SUBDIRS = xmlpool include Makefile.sources +EXTRA_DIST = drirc xmlpool.h SConscript + AM_CFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/ \ diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.sources b/mesalib/src/mesa/drivers/dri/common/Makefile.sources index 43b289e90..d00ec5f73 100644 --- a/mesalib/src/mesa/drivers/dri/common/Makefile.sources +++ b/mesalib/src/mesa/drivers/dri/common/Makefile.sources @@ -1,7 +1,10 @@ DRI_COMMON_FILES := \ utils.c \ + utils.h \ dri_util.c \ - xmlconfig.c + dri_util.h \ + xmlconfig.c \ + xmlconfig.h # Paths are relative to MESA_TOP. mesa_dri_common_INCLUDES := \ diff --git a/mesalib/src/mesa/drivers/dri/common/mmio.h b/mesalib/src/mesa/drivers/dri/common/mmio.h deleted file mode 100644 index ce95d8c90..000000000 --- a/mesalib/src/mesa/drivers/dri/common/mmio.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2004 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file mmio.h - * Functions for properly handling memory mapped IO on various platforms. - * - * \author Ian Romanick <idr@us.ibm.com> - */ - - -#ifndef MMIO_H -#define MMIO_H - -#include "main/glheader.h" - -#if defined( __powerpc__ ) - -static INLINE uint32_t -read_MMIO_LE32( volatile void * base, unsigned long offset ) -{ - uint32_t val; - - __asm__ __volatile__( "lwbrx %0, %1, %2 ; eieio" - : "=r" (val) - : "b" (base), "r" (offset) ); - return val; -} - -#else - -static INLINE uint32_t -read_MMIO_LE32( volatile void * base, unsigned long offset ) -{ - volatile uint32_t * p = (volatile uint32_t *) (((volatile char *) base) + offset); - return LE32_TO_CPU( p[0] ); -} - -#endif - -#endif /* MMIO_H */ diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c index 8e48522e2..d69eb0196 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c +++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c @@ -312,8 +312,7 @@ static unsigned char parseValue (driOptionValue *v, driOptionType type, v->_float = strToF (string, &tail); break; case DRI_STRING: - if (v->_string) - free (v->_string); + free (v->_string); v->_string = strndup(string, STRING_CONF_MAXLEN); return GL_TRUE; } diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am b/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am index 57e604845..da7d03480 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am @@ -52,7 +52,9 @@ POT=xmlpool.pot .PHONY: all clean pot po mo +EXTRA_DIST = gen_xmlpool.py t_options.h $(POS) SConscript BUILT_SOURCES = options.h +CLEANFILES = $(MOS) options.h # All generated files are cleaned up. clean: diff --git a/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources b/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources index 70e432feb..8154fcaf7 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources +++ b/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources @@ -1,5 +1,6 @@ SWRAST_DRIVER_FILES = \ - swrast.c + swrast.c \ + swrast_priv.h SWRAST_C_FILES = \ $(SWRAST_DRIVER_FILES) diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c index e8a2c12d7..d62fed30c 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c +++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c @@ -61,8 +61,8 @@ const __DRIextension **__driDriverGetExtensions_swrast(void); -const char const *swrast_vendor_string = "Mesa Project"; -const char const *swrast_renderer_string = "Software Rasterizer"; +const char * const swrast_vendor_string = "Mesa Project"; +const char * const swrast_renderer_string = "Software Rasterizer"; /** * Screen and config-related functions diff --git a/mesalib/src/mesa/drivers/haiku/swrast/SConscript b/mesalib/src/mesa/drivers/haiku/swrast/SConscript index 2c25f727d..907325e32 100644 --- a/mesalib/src/mesa/drivers/haiku/swrast/SConscript +++ b/mesalib/src/mesa/drivers/haiku/swrast/SConscript @@ -13,6 +13,7 @@ env.Append(CPPPATH = [ ]) env.Prepend(LIBS = [ + mesautil, glsl, mesa, ]) diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c index bf4fa3ea8..7d9893385 100644 --- a/mesalib/src/mesa/main/api_validate.c +++ b/mesalib/src/mesa/main/api_validate.c @@ -57,58 +57,65 @@ index_bytes(GLenum type, GLsizei count) /** * Check if OK to draw arrays/elements. */ -static GLboolean +static bool check_valid_to_render(struct gl_context *ctx, const char *function) { if (!_mesa_valid_to_render(ctx, function)) { - return GL_FALSE; + return false; } switch (ctx->API) { case API_OPENGLES2: /* For ES2, we can draw if we have a vertex program/shader). */ if (!ctx->VertexProgram._Current) - return GL_FALSE; + return false; break; case API_OPENGLES: /* For OpenGL ES, only draw if we have vertex positions */ if (!ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled) - return GL_FALSE; + return false; break; case API_OPENGL_CORE: - if (ctx->Array.VAO == ctx->Array.DefaultVAO) - return GL_FALSE; + /* Section 10.4 (Drawing Commands Using Vertex Arrays) of the OpenGL 4.5 + * Core Profile spec says: + * + * "An INVALID_OPERATION error is generated if no vertex array + * object is bound (see section 10.3.1)." + */ + if (ctx->Array.VAO == ctx->Array.DefaultVAO) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no VAO bound)", function); + return false; + } /* fallthrough */ - case API_OPENGL_COMPAT: - { - const struct gl_shader_program *vsProg = - ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]; - GLboolean haveVertexShader = (vsProg && vsProg->LinkStatus); - GLboolean haveVertexProgram = ctx->VertexProgram._Enabled; - if (haveVertexShader || haveVertexProgram) { - /* Draw regardless of whether or not we have any vertex arrays. - * (Ex: could draw a point using a constant vertex pos) - */ - return GL_TRUE; - } - else { - /* Draw if we have vertex positions (GL_VERTEX_ARRAY or generic - * array [0]). - */ - return (ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled || - ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled); - } + case API_OPENGL_COMPAT: { + const struct gl_shader_program *const vsProg = + ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]; + const bool haveVertexShader = (vsProg && vsProg->LinkStatus); + const bool haveVertexProgram = ctx->VertexProgram._Enabled; + + if (haveVertexShader || haveVertexProgram) { + /* Draw regardless of whether or not we have any vertex arrays. + * (Ex: could draw a point using a constant vertex pos) + */ + return true; + } else { + /* Draw if we have vertex positions (GL_VERTEX_ARRAY or generic + * array [0]). + */ + return (ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled || + ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled); } break; + } default: - assert(!"Invalid API value in check_valid_to_render()"); + unreachable("Invalid API value in check_valid_to_render()"); } - return GL_TRUE; + return true; } @@ -310,18 +317,12 @@ valid_elements_type(struct gl_context *ctx, GLenum type, const char *name) } } -/** - * Error checking for glDrawElements(). Includes parameter checking - * and VBO bounds checking. - * \return GL_TRUE if OK to render, GL_FALSE if error found - */ -GLboolean -_mesa_validate_DrawElements(struct gl_context *ctx, - GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices, GLint basevertex) +static bool +validate_DrawElements_common(struct gl_context *ctx, + GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices, + const char *caller) { - FLUSH_CURRENT(ctx, 0); - /* From the GLES3 specification, section 2.14.2 (Transform Feedback * Primitive Capture): * @@ -331,44 +332,60 @@ _mesa_validate_DrawElements(struct gl_context *ctx, */ if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawElements(transform feedback active)"); - return GL_FALSE; + "%s(transform feedback active)", caller); + return false; } if (count < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" ); - return GL_FALSE; + _mesa_error(ctx, GL_INVALID_VALUE, "%s(count)", caller); + return false; } - if (!_mesa_valid_prim_mode(ctx, mode, "glDrawElements")) { - return GL_FALSE; + if (!_mesa_valid_prim_mode(ctx, mode, caller)) { + return false; } - if (!valid_elements_type(ctx, type, "glDrawElements")) - return GL_FALSE; + if (!valid_elements_type(ctx, type, caller)) + return false; - if (!check_valid_to_render(ctx, "glDrawElements")) - return GL_FALSE; + if (!check_valid_to_render(ctx, caller)) + return false; /* Vertex buffer object tests */ if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { /* use indices in the buffer object */ /* make sure count doesn't go outside buffer bounds */ if (index_bytes(type, count) > ctx->Array.VAO->IndexBufferObj->Size) { - _mesa_warning(ctx, "glDrawElements index out of buffer bounds"); - return GL_FALSE; + _mesa_warning(ctx, "%s index out of buffer bounds", caller); + return false; } } else { /* not using a VBO */ if (!indices) - return GL_FALSE; + return false; } if (count == 0) - return GL_FALSE; + return false; - return GL_TRUE; + return true; +} + +/** + * Error checking for glDrawElements(). Includes parameter checking + * and VBO bounds checking. + * \return GL_TRUE if OK to render, GL_FALSE if error found + */ +GLboolean +_mesa_validate_DrawElements(struct gl_context *ctx, + GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices) +{ + FLUSH_CURRENT(ctx, 0); + + return validate_DrawElements_common(ctx, mode, count, type, indices, + "glDrawElements"); } @@ -381,7 +398,7 @@ GLboolean _mesa_validate_MultiDrawElements(struct gl_context *ctx, GLenum mode, const GLsizei *count, GLenum type, const GLvoid * const *indices, - GLuint primcount, const GLint *basevertex) + GLuint primcount) { unsigned i; @@ -439,62 +456,17 @@ GLboolean _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, - const GLvoid *indices, GLint basevertex) + const GLvoid *indices) { FLUSH_CURRENT(ctx, 0); - /* From the GLES3 specification, section 2.14.2 (Transform Feedback - * Primitive Capture): - * - * The error INVALID_OPERATION is also generated by DrawElements, - * DrawElementsInstanced, and DrawRangeElements while transform feedback - * is active and not paused, regardless of mode. - */ - if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawElements(transform feedback active)"); - return GL_FALSE; - } - - if (count < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)" ); - return GL_FALSE; - } - - if (!_mesa_valid_prim_mode(ctx, mode, "glDrawRangeElements")) { - return GL_FALSE; - } - if (end < start) { _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(end<start)"); return GL_FALSE; } - if (!valid_elements_type(ctx, type, "glDrawRangeElements")) - return GL_FALSE; - - if (!check_valid_to_render(ctx, "glDrawRangeElements")) - return GL_FALSE; - - /* Vertex buffer object tests */ - if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { - /* use indices in the buffer object */ - /* make sure count doesn't go outside buffer bounds */ - if (index_bytes(type, count) > ctx->Array.VAO->IndexBufferObj->Size) { - _mesa_warning(ctx, "glDrawRangeElements index out of buffer bounds"); - return GL_FALSE; - } - } - else { - /* not using a VBO */ - if (!indices) - return GL_FALSE; - } - - if (count == 0) - return GL_FALSE; - - return GL_TRUE; + return validate_DrawElements_common(ctx, mode, count, type, indices, + "glDrawRangeElements"); } @@ -504,8 +476,7 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode, * \return GL_TRUE if OK to render, GL_FALSE if error found */ GLboolean -_mesa_validate_DrawArrays(struct gl_context *ctx, - GLenum mode, GLint start, GLsizei count) +_mesa_validate_DrawArrays(struct gl_context *ctx, GLenum mode, GLsizei count) { struct gl_transform_feedback_object *xfb_obj = ctx->TransformFeedback.CurrentObject; @@ -621,67 +592,19 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi GLboolean _mesa_validate_DrawElementsInstanced(struct gl_context *ctx, GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices, GLsizei numInstances, - GLint basevertex) + const GLvoid *indices, GLsizei numInstances) { FLUSH_CURRENT(ctx, 0); - /* From the GLES3 specification, section 2.14.2 (Transform Feedback - * Primitive Capture): - * - * The error INVALID_OPERATION is also generated by DrawElements, - * DrawElementsInstanced, and DrawRangeElements while transform feedback - * is active and not paused, regardless of mode. - */ - if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawElements(transform feedback active)"); - return GL_FALSE; - } - - if (count < 0) { + if (numInstances < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glDrawElementsInstanced(count=%d)", count); - return GL_FALSE; - } - - if (!_mesa_valid_prim_mode(ctx, mode, "glDrawElementsInstanced")) { + "glDrawElementsInstanced(numInstances=%d)", numInstances); return GL_FALSE; } - if (!valid_elements_type(ctx, type, "glDrawElementsInstanced")) - return GL_FALSE; - - if (numInstances <= 0) { - if (numInstances < 0) - _mesa_error(ctx, GL_INVALID_VALUE, - "glDrawElementsInstanced(numInstances=%d)", numInstances); - return GL_FALSE; - } - - if (!check_valid_to_render(ctx, "glDrawElementsInstanced")) - return GL_FALSE; - - /* Vertex buffer object tests */ - if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { - /* use indices in the buffer object */ - /* make sure count doesn't go outside buffer bounds */ - if (index_bytes(type, count) > ctx->Array.VAO->IndexBufferObj->Size) { - _mesa_warning(ctx, - "glDrawElementsInstanced index out of buffer bounds"); - return GL_FALSE; - } - } - else { - /* not using a VBO */ - if (!indices) - return GL_FALSE; - } - - if (count == 0) - return GL_FALSE; - - return GL_TRUE; + return validate_DrawElements_common(ctx, mode, count, type, indices, + "glDrawElementsInstanced") + && (numInstances > 0); } diff --git a/mesalib/src/mesa/main/api_validate.h b/mesalib/src/mesa/main/api_validate.h index 0bb91c675..0ce7b69d5 100644 --- a/mesalib/src/mesa/main/api_validate.h +++ b/mesalib/src/mesa/main/api_validate.h @@ -43,25 +43,24 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name); extern GLboolean -_mesa_validate_DrawArrays(struct gl_context *ctx, - GLenum mode, GLint start, GLsizei count); +_mesa_validate_DrawArrays(struct gl_context *ctx, GLenum mode, GLsizei count); extern GLboolean _mesa_validate_DrawElements(struct gl_context *ctx, GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices, GLint basevertex); + const GLvoid *indices); extern GLboolean _mesa_validate_MultiDrawElements(struct gl_context *ctx, GLenum mode, const GLsizei *count, GLenum type, const GLvoid * const *indices, - GLuint primcount, const GLint *basevertex); + GLuint primcount); extern GLboolean _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, - const GLvoid *indices, GLint basevertex); + const GLvoid *indices); extern GLboolean @@ -71,8 +70,7 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi extern GLboolean _mesa_validate_DrawElementsInstanced(struct gl_context *ctx, GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices, GLsizei primcount, - GLint basevertex); + const GLvoid *indices, GLsizei primcount); extern GLboolean _mesa_validate_DrawTransformFeedback(struct gl_context *ctx, diff --git a/mesalib/src/mesa/main/clear.c b/mesalib/src/mesa/main/clear.c index f7f15cf59..4671ee245 100644 --- a/mesalib/src/mesa/main/clear.c +++ b/mesalib/src/mesa/main/clear.c @@ -58,10 +58,6 @@ _mesa_ClearIndex( GLfloat c ) * \param alpha alpha component. * * \sa glClearColor(). - * - * Clamps the parameters and updates gl_colorbuffer_attrib::ClearColor. On a - * change, flushes the vertices and notifies the driver via the - * dd_function_table::ClearColor callback. */ void GLAPIENTRY _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) @@ -132,14 +128,15 @@ color_buffer_writes_enabled(const struct gl_context *ctx, unsigned idx) /** * Clear buffers. - * + * * \param mask bit-mask indicating the buffers to be cleared. * - * Flushes the vertices and verifies the parameter. If __struct gl_contextRec::NewState - * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin, - * etc. If the rasterization mode is set to GL_RENDER then requests the driver - * to clear the buffers, via the dd_function_table::Clear callback. - */ + * Flushes the vertices and verifies the parameter. + * If __struct gl_contextRec::NewState is set then calls _mesa_update_state() + * to update gl_frame_buffer::_Xmin, etc. If the rasterization mode is set to + * GL_RENDER then requests the driver to clear the buffers, via the + * dd_function_table::Clear callback. + */ void GLAPIENTRY _mesa_Clear( GLbitfield mask ) { @@ -340,7 +337,8 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value) drawbuffer); return; } - else if (ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer && !ctx->RasterDiscard) { + else if (ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer + && !ctx->RasterDiscard) { /* Save current stencil clear value, set to 'value', do the * stencil clear and restore the clear value. * XXX in the future we may have a new ctx->Driver.ClearBuffer() @@ -503,7 +501,8 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value) drawbuffer); return; } - else if (ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer && !ctx->RasterDiscard) { + else if (ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer + && !ctx->RasterDiscard) { /* Save current depth clear value, set to 'value', do the * depth clear and restore the clear value. * XXX in the future we may have a new ctx->Driver.ClearBuffer() diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h index 34671dc7e..cdc843db2 100644 --- a/mesalib/src/mesa/main/compiler.h +++ b/mesalib/src/mesa/main/compiler.h @@ -122,7 +122,7 @@ extern "C" { * inline a static function that we later use in an alias. - ajax */ #ifndef PUBLIC -# if (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PUBLIC __attribute__((visibility("default"))) # define USED __attribute__((used)) # else diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c index 4b7b0604b..d297f5120 100644 --- a/mesalib/src/mesa/main/dlist.c +++ b/mesalib/src/mesa/main/dlist.c @@ -81,7 +81,7 @@ struct gl_list_instruction GLuint Size; void (*Execute)( struct gl_context *ctx, void *data ); void (*Destroy)( struct gl_context *ctx, void *data ); - void (*Print)( struct gl_context *ctx, void *data ); + void (*Print)( struct gl_context *ctx, void *data, FILE *f ); }; @@ -666,11 +666,11 @@ ext_opcode_execute(struct gl_context *ctx, Node *node) /** Print an extended opcode instruction */ static GLint -ext_opcode_print(struct gl_context *ctx, Node *node) +ext_opcode_print(struct gl_context *ctx, Node *node, FILE *f) { const GLint i = node[0].opcode - OPCODE_EXT_0; GLint step; - ctx->ListExt->Opcode[i].Print(ctx, &node[1]); + ctx->ListExt->Opcode[i].Print(ctx, &node[1], f); step = ctx->ListExt->Opcode[i].Size; return step; } @@ -1098,7 +1098,7 @@ _mesa_dlist_alloc_opcode(struct gl_context *ctx, GLuint size, void (*execute) (struct gl_context *, void *), void (*destroy) (struct gl_context *, void *), - void (*print) (struct gl_context *, void *)) + void (*print) (struct gl_context *, void *, FILE *)) { if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) { const GLuint i = ctx->ListExt->NumOpcodes++; @@ -9716,16 +9716,24 @@ enum_string(GLenum k) /** * Print the commands in a display list. For debugging only. * TODO: many commands aren't handled yet. + * \param fname filename to write display list to. If null, use stdout. */ static void GLAPIENTRY -print_list(struct gl_context *ctx, GLuint list) +print_list(struct gl_context *ctx, GLuint list, const char *fname) { struct gl_display_list *dlist; Node *n; GLboolean done; + FILE *f = stdout; + + if (fname) { + f = fopen(fname, "w"); + if (!f) + return; + } if (!islist(ctx, list)) { - printf("%u is not a display list ID\n", list); + fprintf(f, "%u is not a display list ID\n", list); return; } @@ -9735,199 +9743,202 @@ print_list(struct gl_context *ctx, GLuint list) n = dlist->Head; - printf("START-LIST %u, address %p\n", list, (void *) n); + fprintf(f, "START-LIST %u, address %p\n", list, (void *) n); done = n ? GL_FALSE : GL_TRUE; while (!done) { const OpCode opcode = n[0].opcode; if (is_ext_opcode(opcode)) { - n += ext_opcode_print(ctx, n); + n += ext_opcode_print(ctx, n, f); } else { switch (opcode) { case OPCODE_ACCUM: - printf("Accum %s %g\n", enum_string(n[1].e), n[2].f); + fprintf(f, "Accum %s %g\n", enum_string(n[1].e), n[2].f); + break; + case OPCODE_ACTIVE_TEXTURE: + fprintf(f, "ActiveTexture(%s)\n", enum_string(n[1].e)); break; case OPCODE_BITMAP: - printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i, + fprintf(f, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f, get_pointer(&n[7])); break; case OPCODE_CALL_LIST: - printf("CallList %d\n", (int) n[1].ui); + fprintf(f, "CallList %d\n", (int) n[1].ui); break; case OPCODE_CALL_LIST_OFFSET: - printf("CallList %d + offset %u = %u\n", (int) n[1].ui, + fprintf(f, "CallList %d + offset %u = %u\n", (int) n[1].ui, ctx->List.ListBase, ctx->List.ListBase + n[1].ui); break; case OPCODE_DISABLE: - printf("Disable %s\n", enum_string(n[1].e)); + fprintf(f, "Disable %s\n", enum_string(n[1].e)); break; case OPCODE_ENABLE: - printf("Enable %s\n", enum_string(n[1].e)); + fprintf(f, "Enable %s\n", enum_string(n[1].e)); break; case OPCODE_FRUSTUM: - printf("Frustum %g %g %g %g %g %g\n", + fprintf(f, "Frustum %g %g %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f); break; case OPCODE_LINE_STIPPLE: - printf("LineStipple %d %x\n", n[1].i, (int) n[2].us); + fprintf(f, "LineStipple %d %x\n", n[1].i, (int) n[2].us); break; case OPCODE_LOAD_IDENTITY: - printf("LoadIdentity\n"); + fprintf(f, "LoadIdentity\n"); break; case OPCODE_LOAD_MATRIX: - printf("LoadMatrix\n"); - printf(" %8f %8f %8f %8f\n", + fprintf(f, "LoadMatrix\n"); + fprintf(f, " %8f %8f %8f %8f\n", n[1].f, n[5].f, n[9].f, n[13].f); - printf(" %8f %8f %8f %8f\n", + fprintf(f, " %8f %8f %8f %8f\n", n[2].f, n[6].f, n[10].f, n[14].f); - printf(" %8f %8f %8f %8f\n", + fprintf(f, " %8f %8f %8f %8f\n", n[3].f, n[7].f, n[11].f, n[15].f); - printf(" %8f %8f %8f %8f\n", + fprintf(f, " %8f %8f %8f %8f\n", n[4].f, n[8].f, n[12].f, n[16].f); break; case OPCODE_MULT_MATRIX: - printf("MultMatrix (or Rotate)\n"); - printf(" %8f %8f %8f %8f\n", + fprintf(f, "MultMatrix (or Rotate)\n"); + fprintf(f, " %8f %8f %8f %8f\n", n[1].f, n[5].f, n[9].f, n[13].f); - printf(" %8f %8f %8f %8f\n", + fprintf(f, " %8f %8f %8f %8f\n", n[2].f, n[6].f, n[10].f, n[14].f); - printf(" %8f %8f %8f %8f\n", + fprintf(f, " %8f %8f %8f %8f\n", n[3].f, n[7].f, n[11].f, n[15].f); - printf(" %8f %8f %8f %8f\n", + fprintf(f, " %8f %8f %8f %8f\n", n[4].f, n[8].f, n[12].f, n[16].f); break; case OPCODE_ORTHO: - printf("Ortho %g %g %g %g %g %g\n", + fprintf(f, "Ortho %g %g %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f); break; case OPCODE_POP_ATTRIB: - printf("PopAttrib\n"); + fprintf(f, "PopAttrib\n"); break; case OPCODE_POP_MATRIX: - printf("PopMatrix\n"); + fprintf(f, "PopMatrix\n"); break; case OPCODE_POP_NAME: - printf("PopName\n"); + fprintf(f, "PopName\n"); break; case OPCODE_PUSH_ATTRIB: - printf("PushAttrib %x\n", n[1].bf); + fprintf(f, "PushAttrib %x\n", n[1].bf); break; case OPCODE_PUSH_MATRIX: - printf("PushMatrix\n"); + fprintf(f, "PushMatrix\n"); break; case OPCODE_PUSH_NAME: - printf("PushName %d\n", (int) n[1].ui); + fprintf(f, "PushName %d\n", (int) n[1].ui); break; case OPCODE_RASTER_POS: - printf("RasterPos %g %g %g %g\n", + fprintf(f, "RasterPos %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f); break; case OPCODE_ROTATE: - printf("Rotate %g %g %g %g\n", + fprintf(f, "Rotate %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f); break; case OPCODE_SCALE: - printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f); + fprintf(f, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f); break; case OPCODE_TRANSLATE: - printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f); + fprintf(f, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f); break; case OPCODE_BIND_TEXTURE: - printf("BindTexture %s %d\n", + fprintf(f, "BindTexture %s %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui); break; case OPCODE_SHADE_MODEL: - printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui)); + fprintf(f, "ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui)); break; case OPCODE_MAP1: - printf("Map1 %s %.3f %.3f %d %d\n", + fprintf(f, "Map1 %s %.3f %.3f %d %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].f, n[3].f, n[4].i, n[5].i); break; case OPCODE_MAP2: - printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n", + fprintf(f, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].f, n[3].f, n[4].f, n[5].f, n[6].i, n[7].i, n[8].i, n[9].i); break; case OPCODE_MAPGRID1: - printf("MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f); + fprintf(f, "MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f); break; case OPCODE_MAPGRID2: - printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n", + fprintf(f, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f); break; case OPCODE_EVALMESH1: - printf("EvalMesh1 %d %d\n", n[1].i, n[2].i); + fprintf(f, "EvalMesh1 %d %d\n", n[1].i, n[2].i); break; case OPCODE_EVALMESH2: - printf("EvalMesh2 %d %d %d %d\n", + fprintf(f, "EvalMesh2 %d %d %d %d\n", n[1].i, n[2].i, n[3].i, n[4].i); break; case OPCODE_ATTR_1F_NV: - printf("ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f); + fprintf(f, "ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f); break; case OPCODE_ATTR_2F_NV: - printf("ATTR_2F_NV attr %d: %f %f\n", + fprintf(f, "ATTR_2F_NV attr %d: %f %f\n", n[1].i, n[2].f, n[3].f); break; case OPCODE_ATTR_3F_NV: - printf("ATTR_3F_NV attr %d: %f %f %f\n", + fprintf(f, "ATTR_3F_NV attr %d: %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f); break; case OPCODE_ATTR_4F_NV: - printf("ATTR_4F_NV attr %d: %f %f %f %f\n", + fprintf(f, "ATTR_4F_NV attr %d: %f %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f, n[5].f); break; case OPCODE_ATTR_1F_ARB: - printf("ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f); + fprintf(f, "ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f); break; case OPCODE_ATTR_2F_ARB: - printf("ATTR_2F_ARB attr %d: %f %f\n", + fprintf(f, "ATTR_2F_ARB attr %d: %f %f\n", n[1].i, n[2].f, n[3].f); break; case OPCODE_ATTR_3F_ARB: - printf("ATTR_3F_ARB attr %d: %f %f %f\n", + fprintf(f, "ATTR_3F_ARB attr %d: %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f); break; case OPCODE_ATTR_4F_ARB: - printf("ATTR_4F_ARB attr %d: %f %f %f %f\n", + fprintf(f, "ATTR_4F_ARB attr %d: %f %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f, n[5].f); break; case OPCODE_MATERIAL: - printf("MATERIAL %x %x: %f %f %f %f\n", + fprintf(f, "MATERIAL %x %x: %f %f %f %f\n", n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f); break; case OPCODE_BEGIN: - printf("BEGIN %x\n", n[1].i); + fprintf(f, "BEGIN %x\n", n[1].i); break; case OPCODE_END: - printf("END\n"); + fprintf(f, "END\n"); break; case OPCODE_RECTF: - printf("RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f, + fprintf(f, "RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f, n[4].f); break; case OPCODE_EVAL_C1: - printf("EVAL_C1 %f\n", n[1].f); + fprintf(f, "EVAL_C1 %f\n", n[1].f); break; case OPCODE_EVAL_C2: - printf("EVAL_C2 %f %f\n", n[1].f, n[2].f); + fprintf(f, "EVAL_C2 %f %f\n", n[1].f, n[2].f); break; case OPCODE_EVAL_P1: - printf("EVAL_P1 %d\n", n[1].i); + fprintf(f, "EVAL_P1 %d\n", n[1].i); break; case OPCODE_EVAL_P2: - printf("EVAL_P2 %d %d\n", n[1].i, n[2].i); + fprintf(f, "EVAL_P2 %d %d\n", n[1].i, n[2].i); break; case OPCODE_PROVOKING_VERTEX: - printf("ProvokingVertex %s\n", + fprintf(f, "ProvokingVertex %s\n", _mesa_lookup_enum_by_nr(n[1].ui)); break; @@ -9935,15 +9946,15 @@ print_list(struct gl_context *ctx, GLuint list) * meta opcodes/commands */ case OPCODE_ERROR: - printf("Error: %s %s\n", enum_string(n[1].e), + fprintf(f, "Error: %s %s\n", enum_string(n[1].e), (const char *) get_pointer(&n[2])); break; case OPCODE_CONTINUE: - printf("DISPLAY-LIST-CONTINUE\n"); + fprintf(f, "DISPLAY-LIST-CONTINUE\n"); n = (Node *) get_pointer(&n[1]); break; case OPCODE_END_OF_LIST: - printf("END-LIST %u\n", list); + fprintf(f, "END-LIST %u\n", list); done = GL_TRUE; break; default: @@ -9954,7 +9965,7 @@ print_list(struct gl_context *ctx, GLuint list) return; } else { - printf("command %d, %u operands\n", opcode, + fprintf(f, "command %d, %u operands\n", opcode, InstSize[opcode]); } } @@ -9964,6 +9975,10 @@ print_list(struct gl_context *ctx, GLuint list) } } } + + fflush(f); + if (fname) + fclose(f); } @@ -9977,7 +9992,7 @@ void mesa_print_display_list(GLuint list) { GET_CURRENT_CONTEXT(ctx); - print_list(ctx, list); + print_list(ctx, list, NULL); } diff --git a/mesalib/src/mesa/main/dlist.h b/mesalib/src/mesa/main/dlist.h index 7726e77d8..c57eb74da 100644 --- a/mesalib/src/mesa/main/dlist.h +++ b/mesalib/src/mesa/main/dlist.h @@ -63,7 +63,7 @@ extern void *_mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint sz) extern GLint _mesa_dlist_alloc_opcode( struct gl_context *ctx, GLuint sz, void (*execute)( struct gl_context *, void * ), void (*destroy)( struct gl_context *, void * ), - void (*print)( struct gl_context *, void * ) ); + void (*print)( struct gl_context *, void *, FILE * ) ); extern void _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist); diff --git a/mesalib/src/mesa/main/enums.h b/mesalib/src/mesa/main/enums.h index 36c053d4b..66bdd53bb 100644 --- a/mesalib/src/mesa/main/enums.h +++ b/mesalib/src/mesa/main/enums.h @@ -37,6 +37,11 @@ #define _ENUMS_H_ +#ifdef __cplusplus +extern "C" { +#endif + + extern const char *_mesa_lookup_enum_by_nr( int nr ); /* Get the name of an enum given that it is a primitive type. Avoids @@ -44,4 +49,10 @@ extern const char *_mesa_lookup_enum_by_nr( int nr ); */ const char *_mesa_lookup_prim_by_nr( unsigned nr ); + +#ifdef __cplusplus +} +#endif + + #endif diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c index 7d622bb16..4e7853b90 100644 --- a/mesalib/src/mesa/main/errors.c +++ b/mesalib/src/mesa/main/errors.c @@ -1395,6 +1395,7 @@ should_output(struct gl_context *ctx, GLenum error, const char *fmtString) void _mesa_gl_debug(struct gl_context *ctx, GLuint *id, + enum mesa_debug_source source, enum mesa_debug_type type, enum mesa_debug_severity severity, const char *fmtString, ...) @@ -1409,7 +1410,7 @@ _mesa_gl_debug(struct gl_context *ctx, len = _mesa_vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args); va_end(args); - log_msg(ctx, MESA_DEBUG_SOURCE_API, type, *id, severity, len, s); + log_msg(ctx, source, type, *id, severity, len, s); } diff --git a/mesalib/src/mesa/main/errors.h b/mesalib/src/mesa/main/errors.h index b388138e8..0c521c0d0 100644 --- a/mesalib/src/mesa/main/errors.h +++ b/mesalib/src/mesa/main/errors.h @@ -38,14 +38,13 @@ #include "compiler.h" #include "glheader.h" +#include "mtypes.h" #ifdef __cplusplus extern "C" { #endif -#include "mtypes.h" - struct _glapi_table; extern void @@ -72,14 +71,16 @@ _mesa_debug( const struct gl_context *ctx, const char *fmtString, ... ) PRINTFLI extern void _mesa_gl_debug(struct gl_context *ctx, GLuint *id, + enum mesa_debug_source source, enum mesa_debug_type type, enum mesa_debug_severity severity, - const char *fmtString, ...) PRINTFLIKE(5, 6); + const char *fmtString, ...) PRINTFLIKE(6, 7); #define _mesa_perf_debug(ctx, sev, ...) do { \ static GLuint msg_id = 0; \ if (unlikely(ctx->Const.ContextFlags & GL_CONTEXT_FLAG_DEBUG_BIT)) { \ _mesa_gl_debug(ctx, &msg_id, \ + MESA_DEBUG_SOURCE_API, \ MESA_DEBUG_TYPE_PERFORMANCE, \ sev, \ __VA_ARGS__); \ diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index 8283373a4..4c3c157a4 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -599,6 +599,7 @@ fbo_incomplete(struct gl_context *ctx, const char *msg, int index) static GLuint msg_id; _mesa_gl_debug(ctx, &msg_id, + MESA_DEBUG_SOURCE_API, MESA_DEBUG_TYPE_OTHER, MESA_DEBUG_SEVERITY_MEDIUM, "FBO incomplete: %s [%d]\n", msg, index); @@ -1429,6 +1430,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) case GL_RGB8: return GL_RGB; case GL_RGB: + if (_mesa_is_gles3(ctx)) + return GL_RGB; + /* fallthrough */ case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: @@ -1443,6 +1447,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) case GL_RGBA8: return GL_RGBA; case GL_RGBA: + if (_mesa_is_gles3(ctx)) + return GL_RGBA; + /* fallthrough */ case GL_RGBA2: case GL_RGBA12: case GL_RGBA16: @@ -3073,6 +3080,14 @@ invalidate_framebuffer_storage(GLenum target, GLsizei numAttachments, case GL_DEPTH_ATTACHMENT: case GL_STENCIL_ATTACHMENT: break; + case GL_DEPTH_STENCIL_ATTACHMENT: + /* GL_DEPTH_STENCIL_ATTACHMENT is a valid attachment point only + * in desktop and ES 3.0 profiles. Note that OES_packed_depth_stencil + * extension does not make this attachment point valid on ES 2.0. + */ + if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) + break; + /* fallthrough */ case GL_COLOR_ATTACHMENT0: case GL_COLOR_ATTACHMENT1: case GL_COLOR_ATTACHMENT2: diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp index 5591d57df..bc6fdbdd8 100644 --- a/mesalib/src/mesa/main/ff_fragment_shader.cpp +++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp @@ -27,13 +27,15 @@ * **************************************************************************/ -extern "C" { #include "glheader.h" #include "imports.h" #include "mtypes.h" #include "main/context.h" #include "main/macros.h" #include "main/samplerobj.h" +#include "main/texenvprogram.h" +#include "main/texobj.h" +#include "main/uniforms.h" #include "program/program.h" #include "program/prog_parameter.h" #include "program/prog_cache.h" @@ -41,10 +43,6 @@ extern "C" { #include "program/prog_print.h" #include "program/prog_statevars.h" #include "program/programopt.h" -#include "texenvprogram.h" -#include "texobj.h" -} -#include "main/uniforms.h" #include "../glsl/glsl_types.h" #include "../glsl/ir.h" #include "../glsl/ir_builder.h" diff --git a/mesalib/src/mesa/main/formatquery.c b/mesalib/src/mesa/main/formatquery.c index 40eca8711..f6274fe30 100644 --- a/mesalib/src/mesa/main/formatquery.c +++ b/mesalib/src/mesa/main/formatquery.c @@ -115,29 +115,40 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, internalformat, buffer); break; case GL_NUM_SAMPLE_COUNTS: { - /* The driver can return 0, and we should pass that along to the - * application. The ARB decided that ARB_internalformat_query should - * behave as ARB_internalformat_query2 in this situation. - * - * The ARB_internalformat_query2 spec says: - * - * "- NUM_SAMPLE_COUNTS: The number of sample counts that would be - * returned by querying SAMPLES is returned in <params>. - * * If <internalformat> is not color-renderable, - * depth-renderable, or stencil-renderable (as defined in - * section 4.4.4), or if <target> does not support multiple - * samples (ie other than TEXTURE_2D_MULTISAMPLE, - * TEXTURE_2D_MULTISAMPLE_ARRAY, or RENDERBUFFER), 0 is - * returned." - */ - const size_t num_samples = - ctx->Driver.QuerySamplesForFormat(ctx, target, internalformat, buffer); - - /* QuerySamplesForFormat writes some stuff to buffer, so we have to - * separately over-write it with the requested value. - */ - buffer[0] = (GLint) num_samples; - count = 1; + if (_mesa_is_gles3(ctx) && _mesa_is_enum_format_integer(internalformat)) { + /* From GL ES 3.0 specification, section 6.1.15 page 236: "Since + * multisampling is not supported for signed and unsigned integer + * internal formats, the value of NUM_SAMPLE_COUNTS will be zero + * for such formats. + */ + buffer[0] = 0; + count = 1; + } else { + size_t num_samples; + + /* The driver can return 0, and we should pass that along to the + * application. The ARB decided that ARB_internalformat_query should + * behave as ARB_internalformat_query2 in this situation. + * + * The ARB_internalformat_query2 spec says: + * + * "- NUM_SAMPLE_COUNTS: The number of sample counts that would be + * returned by querying SAMPLES is returned in <params>. + * * If <internalformat> is not color-renderable, + * depth-renderable, or stencil-renderable (as defined in + * section 4.4.4), or if <target> does not support multiple + * samples (ie other than TEXTURE_2D_MULTISAMPLE, + * TEXTURE_2D_MULTISAMPLE_ARRAY, or RENDERBUFFER), 0 is + * returned." + */ + num_samples = ctx->Driver.QuerySamplesForFormat(ctx, target, internalformat, buffer); + + /* QuerySamplesForFormat writes some stuff to buffer, so we have to + * separately over-write it with the requested value. + */ + buffer[0] = (GLint) num_samples; + count = 1; + } break; } default: diff --git a/mesalib/src/mesa/main/getstring.c b/mesalib/src/mesa/main/getstring.c index 431d60b03..1b2c7f054 100644 --- a/mesalib/src/mesa/main/getstring.c +++ b/mesalib/src/mesa/main/getstring.c @@ -58,6 +58,12 @@ shading_language_version(struct gl_context *ctx) return (const GLubyte *) "4.10"; case 420: return (const GLubyte *) "4.20"; + case 430: + return (const GLubyte *) "4.30"; + case 440: + return (const GLubyte *) "4.40"; + case 450: + return (const GLubyte *) "4.50"; default: _mesa_problem(ctx, "Invalid GLSL version in shading_language_version()"); @@ -68,7 +74,7 @@ shading_language_version(struct gl_context *ctx) case API_OPENGLES2: return (ctx->Version < 30) ? (const GLubyte *) "OpenGL ES GLSL ES 1.0.16" - : (const GLubyte *) "OpenGL ES GLSL ES 3.0"; + : (const GLubyte *) "OpenGL ES GLSL ES 3.00"; case API_OPENGLES: /* fall-through */ diff --git a/mesalib/src/mesa/main/hash.c b/mesalib/src/mesa/main/hash.c index 52095f7d1..a8c796b9a 100644 --- a/mesalib/src/mesa/main/hash.c +++ b/mesalib/src/mesa/main/hash.c @@ -96,6 +96,12 @@ uint_hash(GLuint id) return id; } +static uint32_t +uint_key_hash(const void *key) +{ + return uint_hash((uintptr_t)key); +} + static void * uint_key(GLuint id) { @@ -114,7 +120,8 @@ _mesa_NewHashTable(void) struct _mesa_HashTable *table = CALLOC_STRUCT(_mesa_HashTable); if (table) { - table->ht = _mesa_hash_table_create(NULL, uint_key_compare); + table->ht = _mesa_hash_table_create(NULL, uint_key_hash, + uint_key_compare); if (table->ht == NULL) { free(table); _mesa_error_no_memory(__func__); @@ -175,7 +182,7 @@ _mesa_HashLookup_unlocked(struct _mesa_HashTable *table, GLuint key) if (key == DELETED_KEY_VALUE) return table->deleted_key_data; - entry = _mesa_hash_table_search(table->ht, uint_hash(key), uint_key(key)); + entry = _mesa_hash_table_search(table->ht, uint_key(key)); if (!entry) return NULL; @@ -266,11 +273,11 @@ _mesa_HashInsert_unlocked(struct _mesa_HashTable *table, GLuint key, void *data) if (key == DELETED_KEY_VALUE) { table->deleted_key_data = data; } else { - entry = _mesa_hash_table_search(table->ht, hash, uint_key(key)); + entry = _mesa_hash_table_search_pre_hashed(table->ht, hash, uint_key(key)); if (entry) { entry->data = data; } else { - _mesa_hash_table_insert(table->ht, hash, uint_key(key), data); + _mesa_hash_table_insert_with_hash(table->ht, hash, uint_key(key), data); } } } @@ -340,7 +347,7 @@ _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key) if (key == DELETED_KEY_VALUE) { table->deleted_key_data = NULL; } else { - entry = _mesa_hash_table_search(table->ht, uint_hash(key), uint_key(key)); + entry = _mesa_hash_table_search(table->ht, uint_key(key)); _mesa_hash_table_remove(table->ht, entry); } mtx_unlock(&table->Mutex); diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c index 4f5a2d11f..6945c2f62 100644 --- a/mesalib/src/mesa/main/imports.c +++ b/mesalib/src/mesa/main/imports.c @@ -94,7 +94,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment) ASSERT( alignment > 0 ); - ptr = (uintptr_t)malloc(bytes + alignment + sizeof(void *)); + ptr = malloc(bytes + alignment + sizeof(void *)); if (!ptr) return NULL; @@ -143,7 +143,7 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment) ASSERT( alignment > 0 ); - ptr = (uintptr_t)calloc(1, bytes + alignment + sizeof(void *)); + ptr = calloc(1, bytes + alignment + sizeof(void *)); if (!ptr) return NULL; diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 7389baa1d..b95dfb9f7 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -1657,6 +1657,20 @@ typedef enum { DRAW_ARRAYS } gl_draw_method; +/** + * Enum for the OpenGL APIs we know about and may support. + * + * NOTE: This must match the api_enum table in + * src/mesa/main/get_hash_generator.py + */ +typedef enum +{ + API_OPENGL_COMPAT, /* legacy / compatibility contexts */ + API_OPENGLES, + API_OPENGLES2, + API_OPENGL_CORE, + API_OPENGL_LAST = API_OPENGL_CORE +} gl_api; /** * Vertex array state @@ -1701,8 +1715,9 @@ struct gl_array_attrib /** One of the DRAW_xxx flags, not consumed by drivers */ gl_draw_method DrawMethod; - /** Legal array datatypes */ + /** Legal array datatypes and the API for which they have been computed */ GLbitfield LegalTypesMask; + gl_api LegalTypesMaskAPI; }; @@ -2990,6 +3005,7 @@ struct gl_shader_compiler_options GLboolean EmitNoMainReturn; /**< Emit CONT/RET opcodes? */ GLboolean EmitNoNoise; /**< Emit NOISE opcodes? */ GLboolean EmitNoPow; /**< Emit POW opcodes? */ + GLboolean EmitNoSat; /**< Emit SAT opcodes? */ GLboolean LowerClipDistance; /**< Lower gl_ClipDistance from float[8] to vec4[2]? */ /** @@ -4039,21 +4055,6 @@ enum mesa_debug_severity { /** @} */ /** - * Enum for the OpenGL APIs we know about and may support. - * - * NOTE: This must match the api_enum table in - * src/mesa/main/get_hash_generator.py - */ -typedef enum -{ - API_OPENGL_COMPAT, /* legacy / compatibility contexts */ - API_OPENGLES, - API_OPENGLES2, - API_OPENGL_CORE, - API_OPENGL_LAST = API_OPENGL_CORE -} gl_api; - -/** * Driver-specific state flags. * * These are or'd with gl_context::NewDriverState to notify a driver about diff --git a/mesalib/src/mesa/main/objectlabel.c b/mesalib/src/mesa/main/objectlabel.c index 8efc33e0d..78df96b9b 100644 --- a/mesalib/src/mesa/main/objectlabel.c +++ b/mesalib/src/mesa/main/objectlabel.c @@ -45,11 +45,8 @@ static void set_label(struct gl_context *ctx, char **labelPtr, const char *label, int length, const char *caller) { - if (*labelPtr) { - /* free old label string */ - free(*labelPtr); - *labelPtr = NULL; - } + free(*labelPtr); + *labelPtr = NULL; /* set new label string */ if (label) { @@ -61,7 +58,7 @@ set_label(struct gl_context *ctx, char **labelPtr, const char *label, MAX_LABEL_LENGTH); /* explicit length */ - *labelPtr = (char *) malloc(length+1); + *labelPtr = malloc(length+1); if (*labelPtr) { memcpy(*labelPtr, label, length); /* length is not required to include the null terminator so diff --git a/mesalib/src/mesa/main/polygon.c b/mesalib/src/mesa/main/polygon.c index 76d601977..cdaa24483 100644 --- a/mesalib/src/mesa/main/polygon.c +++ b/mesalib/src/mesa/main/polygon.c @@ -176,19 +176,18 @@ _mesa_PolygonMode( GLenum face, GLenum mode ) /** - * This routine updates the ctx->Polygon.Stipple state. - * If we're getting the stipple data from a PBO, we map the buffer - * in order to access the data. - * In any case, we obey the current pixel unpacking parameters when fetching - * the stipple data. - * - * In the future, this routine should be used as a fallback, called via - * ctx->Driver.PolygonStipple(). We'll have to update all the DRI drivers - * too. + * Called by glPolygonStipple. */ -void -_mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern) +void GLAPIENTRY +_mesa_PolygonStipple(const GLubyte *pattern) { + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glPolygonStipple\n"); + + FLUSH_VERTICES(ctx, _NEW_POLYGONSTIPPLE); + pattern = _mesa_map_validate_pbo_source(ctx, 2, &ctx->Unpack, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, @@ -200,23 +199,6 @@ _mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern) _mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &ctx->Unpack); _mesa_unmap_pbo_source(ctx, &ctx->Unpack); -} - - -/** - * Called by glPolygonStipple. - */ -void GLAPIENTRY -_mesa_PolygonStipple( const GLubyte *pattern ) -{ - GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE&VERBOSE_API) - _mesa_debug(ctx, "glPolygonStipple\n"); - - FLUSH_VERTICES(ctx, _NEW_POLYGONSTIPPLE); - - _mesa_polygon_stipple(ctx, pattern); if (ctx->Driver.PolygonStipple) ctx->Driver.PolygonStipple(ctx, pattern); diff --git a/mesalib/src/mesa/main/polygon.h b/mesalib/src/mesa/main/polygon.h index 69c5cbc45..530adba4c 100644 --- a/mesalib/src/mesa/main/polygon.h +++ b/mesalib/src/mesa/main/polygon.h @@ -39,10 +39,6 @@ struct gl_context; extern void GLAPIENTRY _mesa_GetnPolygonStippleARB( GLsizei bufSize, GLubyte *dest ); -extern void -_mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern); - - extern void GLAPIENTRY _mesa_CullFace( GLenum mode ); diff --git a/mesalib/src/mesa/main/samplerobj.h b/mesalib/src/mesa/main/samplerobj.h index 7d80b383d..1bb3193e4 100644 --- a/mesalib/src/mesa/main/samplerobj.h +++ b/mesalib/src/mesa/main/samplerobj.h @@ -27,6 +27,11 @@ #ifndef SAMPLEROBJ_H #define SAMPLEROBJ_H +#ifdef __cplusplus +extern "C" { +#endif + + struct dd_function_table; static inline struct gl_sampler_object * @@ -103,4 +108,8 @@ _mesa_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params); void GLAPIENTRY _mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params); +#ifdef __cplusplus +} +#endif + #endif /* SAMPLEROBJ_H */ diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 66578204f..6d831f762 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -274,9 +274,8 @@ attach_shader(struct gl_context *ctx, GLuint program, GLuint shader) } /* grow list */ - shProg->Shaders = (struct gl_shader **) - realloc(shProg->Shaders, - (n + 1) * sizeof(struct gl_shader *)); + shProg->Shaders = realloc(shProg->Shaders, + (n + 1) * sizeof(struct gl_shader *)); if (!shProg->Shaders) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glAttachShader"); return; diff --git a/mesalib/src/mesa/main/sse_minmax.c b/mesalib/src/mesa/main/sse_minmax.c index 222ac1454..2e3471625 100644 --- a/mesalib/src/mesa/main/sse_minmax.c +++ b/mesalib/src/mesa/main/sse_minmax.c @@ -25,7 +25,6 @@ * */ -#ifdef __SSE4_1__ #include "main/sse_minmax.h" #include <smmintrin.h> #include <stdint.h> @@ -93,5 +92,3 @@ _mesa_uint_array_min_max(const unsigned *ui_indices, unsigned *min_index, *min_index = min_ui; *max_index = max_ui; } - -#endif diff --git a/mesalib/src/mesa/main/texenvprogram.h b/mesalib/src/mesa/main/texenvprogram.h index 15ab31a50..11439f13b 100644 --- a/mesalib/src/mesa/main/texenvprogram.h +++ b/mesalib/src/mesa/main/texenvprogram.h @@ -27,9 +27,20 @@ #define TEXENVPROGRAM_H +#ifdef __cplusplus +extern "C" { +#endif + + struct gl_context; extern struct gl_shader_program * _mesa_get_fixed_func_fragment_program(struct gl_context *ctx); + +#ifdef __cplusplus +} +#endif + + #endif diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 4f4bb11dd..7766904c9 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -1542,7 +1542,7 @@ _mesa_legal_texture_dimensions(struct gl_context *ctx, GLenum target, maxSize >>= level; if (width < 2 * border || width > 2 * border + maxSize) return GL_FALSE; - if (height < 1 || height > ctx->Const.MaxArrayTextureLayers) + if (height < 0 || height > ctx->Const.MaxArrayTextureLayers) return GL_FALSE; if (!ctx->Extensions.ARB_texture_non_power_of_two) { if (width > 0 && !_mesa_is_pow_two(width - 2 * border)) diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index 923cf60d7..f0ff605fc 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -89,7 +89,7 @@ _mesa_lookup_texture_locked(struct gl_context *ctx, GLuint id) * * Called via ctx->Driver.NewTextureObject, unless overridden by a device * driver. - * + * * \param shared the shared GL state structure to contain the texture object * \param name integer name for the texture object * \param target either GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, @@ -268,7 +268,6 @@ _mesa_delete_texture_object(struct gl_context *ctx, } - /** * Copy texture object state from one texture object to another. * Use for glPush/PopAttrib. @@ -653,7 +652,8 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, if (height > 1 && t->Target != GL_TEXTURE_1D_ARRAY) { height /= 2; } - if (depth > 1 && t->Target != GL_TEXTURE_2D_ARRAY && t->Target != GL_TEXTURE_CUBE_MAP_ARRAY) { + if (depth > 1 && t->Target != GL_TEXTURE_2D_ARRAY + && t->Target != GL_TEXTURE_CUBE_MAP_ARRAY) { depth /= 2; } @@ -675,22 +675,25 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, return; } if (img->Width2 != width) { - incomplete(t, MIPMAP, "TexImage[%d] bad width %u", i, img->Width2); + incomplete(t, MIPMAP, "TexImage[%d] bad width %u", i, + img->Width2); return; } if (img->Height2 != height) { - incomplete(t, MIPMAP, "TexImage[%d] bad height %u", i, img->Height2); + incomplete(t, MIPMAP, "TexImage[%d] bad height %u", i, + img->Height2); return; } if (img->Depth2 != depth) { - incomplete(t, MIPMAP, "TexImage[%d] bad depth %u", i, img->Depth2); + incomplete(t, MIPMAP, "TexImage[%d] bad depth %u", i, + img->Depth2); return; } /* Extra checks for cube textures */ if (face > 0) { /* check that cube faces are the same size */ - if (img->Width2 != t->Image[0][i]->Width2 || + if (img->Width2 != t->Image[0][i]->Width2 || img->Height2 != t->Image[0][i]->Height2) { incomplete(t, MIPMAP, "CubeMap Image[n][i] bad size"); return; @@ -698,7 +701,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, } } } - + if (width == 1 && height == 1 && depth == 1) { return; /* found smallest needed mipmap, all done! */ } @@ -950,6 +953,7 @@ _mesa_total_texture_memory(struct gl_context *ctx) return total; } + static struct gl_texture_object * invalidate_tex_image_error_check(struct gl_context *ctx, GLuint texture, GLint level, const char *name) @@ -1022,7 +1026,7 @@ invalidate_tex_image_error_check(struct gl_context *ctx, GLuint texture, * Calls _mesa_HashFindFreeKeyBlock() to find a block of free texture * IDs which are stored in \p textures. Corresponding empty texture * objects are also generated. - */ + */ void GLAPIENTRY _mesa_GenTextures( GLsizei n, GLuint *textures ) { @@ -1155,6 +1159,7 @@ unbind_texobj_from_image_units(struct gl_context *ctx, } } + /** * Unbinds all textures bound to the given texture image unit. */ @@ -1178,6 +1183,7 @@ unbind_textures_from_unit(struct gl_context *ctx, GLuint unit) } } + /** * Delete named textures. * @@ -1305,10 +1311,10 @@ _mesa_tex_target_to_index(const struct gl_context *ctx, GLenum target) /** * Bind a named texture to a texturing target. - * + * * \param target texture target. * \param texName texture name. - * + * * \sa glBindTexture(). * * Determines the old texture object bound and returns immediately if rebinding @@ -1350,7 +1356,9 @@ _mesa_BindTexture( GLenum target, GLuint texName ) if (newTexObj) { /* error checking */ if (newTexObj->Target != 0 && newTexObj->Target != target) { - /* the named texture object's target doesn't match the given target */ + /* The named texture object's target doesn't match the + * given target + */ _mesa_error( ctx, GL_INVALID_OPERATION, "glBindTexture(target mismatch)" ); return; @@ -1361,7 +1369,8 @@ _mesa_BindTexture( GLenum target, GLuint texName ) } else { if (ctx->API == API_OPENGL_CORE) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBindTexture(non-gen name)"); + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindTexture(non-gen name)"); return; } @@ -1526,13 +1535,13 @@ _mesa_BindTextures(GLuint first, GLsizei count, const GLuint *textures) /** * Set texture priorities. - * + * * \param n number of textures. * \param texName texture names. * \param priorities corresponding texture priorities. - * + * * \sa glPrioritizeTextures(). - * + * * Looks up each texture in the hash, clamps the corresponding priority between * 0.0 and 1.0, and calls dd_function_table::PrioritizeTexture. */ @@ -1572,13 +1581,14 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, /** * See if textures are loaded in texture memory. - * + * * \param n number of textures to query. * \param texName array with the texture names. * \param residences array which will hold the residence status. * - * \return GL_TRUE if all textures are resident and \p residences is left unchanged, - * + * \return GL_TRUE if all textures are resident and + * residences is left unchanged, + * * Note: we assume all textures are always resident */ GLboolean GLAPIENTRY @@ -1614,7 +1624,7 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName, return GL_FALSE; } } - + return allResident; } @@ -1626,7 +1636,7 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName, * * \return GL_TRUE if texture name corresponds to a texture, or GL_FALSE * otherwise. - * + * * \sa glIsTexture(). * * Calls _mesa_HashLookup(). @@ -1681,6 +1691,7 @@ _mesa_unlock_context_textures( struct gl_context *ctx ) mtx_unlock(&ctx->Shared->TexMutex); } + void GLAPIENTRY _mesa_InvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, @@ -1827,6 +1838,7 @@ _mesa_InvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, return; } + void GLAPIENTRY _mesa_InvalidateTexImage(GLuint texture, GLint level) { diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h index b1b7a3027..efcd7661e 100644 --- a/mesalib/src/mesa/main/texobj.h +++ b/mesalib/src/mesa/main/texobj.h @@ -38,6 +38,11 @@ #include "samplerobj.h" +#ifdef __cplusplus +extern "C" { +#endif + + /** * \name Internal functions */ @@ -212,4 +217,9 @@ _mesa_InvalidateTexImage(GLuint texture, GLint level); /*@}*/ +#ifdef __cplusplus +} +#endif + + #endif diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index f858cef50..50aa1fd5e 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -2231,7 +2231,7 @@ _mesa_compute_compressed_pixelstore(GLuint dims, mesa_format texFormat, if (packing->RowLength) { store->TotalBytesPerRow = packing->CompressedBlockSize * - (packing->RowLength + bw - 1) / bw; + ((packing->RowLength + bw - 1) / bw); } store->SkipBytes += packing->SkipPixels * packing->CompressedBlockSize / bw; diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index 96c2b26f7..89aaad1aa 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -258,11 +258,14 @@ update_array_format(struct gl_context *ctx, GLuint elementSize; GLenum format = GL_RGBA; - if (ctx->Array.LegalTypesMask == 0) { - /* One-time initialization. We can't do this in _mesa_init_varrays() - * below because extensions are not yet enabled at that point. + if (ctx->Array.LegalTypesMask == 0 || ctx->Array.LegalTypesMaskAPI != ctx->API) { + /* Compute the LegalTypesMask only once, unless the context API has + * changed, in which case we want to compute it again. We can't do this + * in _mesa_init_varrays() below because extensions are not yet enabled + * at that point. */ ctx->Array.LegalTypesMask = get_legal_types_mask(ctx); + ctx->Array.LegalTypesMaskAPI = ctx->API; } legalTypesMask &= ctx->Array.LegalTypesMask; diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 5cd905822..ce3af3120 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -43,19 +43,18 @@ #include "linker.h" #include "main/mtypes.h" +#include "main/shaderapi.h" #include "main/shaderobj.h" #include "main/uniforms.h" -#include "program/hash_table.h" -extern "C" { -#include "main/shaderapi.h" +#include "program/hash_table.h" #include "program/prog_instruction.h" #include "program/prog_optimize.h" #include "program/prog_print.h" #include "program/program.h" #include "program/prog_parameter.h" #include "program/sampler.h" -} + static int swizzle_for_size(int size); @@ -2943,12 +2942,9 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) /* Lowering */ do_mat_op_to_vec(ir); - GLenum target = _mesa_shader_stage_to_program(prog->_LinkedShaders[i]->Stage); lower_instructions(ir, (MOD_TO_FRACT | DIV_TO_MUL_RCP | EXP_TO_EXP2 | LOG_TO_LOG2 | INT_DIV_TO_MUL_RCP - | ((options->EmitNoPow) ? POW_TO_EXP2 : 0) - | ((target == GL_VERTEX_PROGRAM_ARB) ? SAT_TO_CLAMP - : 0))); + | ((options->EmitNoPow) ? POW_TO_EXP2 : 0))); progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress; diff --git a/mesalib/src/mesa/program/prog_cache.h b/mesalib/src/mesa/program/prog_cache.h index fdd7e264b..e37f1d7be 100644 --- a/mesalib/src/mesa/program/prog_cache.h +++ b/mesalib/src/mesa/program/prog_cache.h @@ -32,6 +32,12 @@ #include "main/glheader.h" + +#ifdef __cplusplus +extern "C" { +#endif + + struct gl_context; /** Opaque type */ @@ -65,4 +71,9 @@ _mesa_shader_cache_insert(struct gl_context *ctx, struct gl_shader_program *program); +#ifdef __cplusplus +} +#endif + + #endif /* PROG_CACHE_H */ diff --git a/mesalib/src/mesa/program/prog_execute.c b/mesalib/src/mesa/program/prog_execute.c index 650c40f2a..33c1751e8 100644 --- a/mesalib/src/mesa/program/prog_execute.c +++ b/mesalib/src/mesa/program/prog_execute.c @@ -298,15 +298,6 @@ fetch_vector1(const struct prog_src_register *source, } -static GLuint -fetch_vector1ui(const struct prog_src_register *source, - const struct gl_program_machine *machine) -{ - const GLuint *src = (GLuint *) get_src_register_pointer(source, machine); - return src[GET_SWZ(source->Swizzle, 0)]; -} - - /** * Fetch texel from texture. Use partial derivatives when possible. */ @@ -488,71 +479,6 @@ store_vector4(const struct prog_instruction *inst, /** - * Store 4 uints into a register. Observe the set-condition-code flags. - */ -static void -store_vector4ui(const struct prog_instruction *inst, - struct gl_program_machine *machine, const GLuint value[4]) -{ - const struct prog_dst_register *dstReg = &(inst->DstReg); - GLuint writeMask = dstReg->WriteMask; - GLuint *dst = (GLuint *) get_dst_register_pointer(dstReg, machine); - - if (dstReg->CondMask != COND_TR) { - /* condition codes may turn off some writes */ - if (writeMask & WRITEMASK_X) { - if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 0)], - dstReg->CondMask)) - writeMask &= ~WRITEMASK_X; - } - if (writeMask & WRITEMASK_Y) { - if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 1)], - dstReg->CondMask)) - writeMask &= ~WRITEMASK_Y; - } - if (writeMask & WRITEMASK_Z) { - if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 2)], - dstReg->CondMask)) - writeMask &= ~WRITEMASK_Z; - } - if (writeMask & WRITEMASK_W) { - if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 3)], - dstReg->CondMask)) - writeMask &= ~WRITEMASK_W; - } - } - - if (writeMask & WRITEMASK_X) - dst[0] = value[0]; - if (writeMask & WRITEMASK_Y) - dst[1] = value[1]; - if (writeMask & WRITEMASK_Z) - dst[2] = value[2]; - if (writeMask & WRITEMASK_W) - dst[3] = value[3]; - - if (inst->CondUpdate) { - if (writeMask & WRITEMASK_X) - machine->CondCodes[0] = generate_cc((float)value[0]); - if (writeMask & WRITEMASK_Y) - machine->CondCodes[1] = generate_cc((float)value[1]); - if (writeMask & WRITEMASK_Z) - machine->CondCodes[2] = generate_cc((float)value[2]); - if (writeMask & WRITEMASK_W) - machine->CondCodes[3] = generate_cc((float)value[3]); -#if DEBUG_PROG - printf("CondCodes=(%s,%s,%s,%s) for:\n", - _mesa_condcode_string(machine->CondCodes[0]), - _mesa_condcode_string(machine->CondCodes[1]), - _mesa_condcode_string(machine->CondCodes[2]), - _mesa_condcode_string(machine->CondCodes[3])); -#endif - } -} - - - -/** * Execute the given vertex/fragment program. * * \param ctx rendering context diff --git a/mesalib/src/mesa/program/prog_instruction.c b/mesalib/src/mesa/program/prog_instruction.c index 976024e3c..254c0128f 100644 --- a/mesalib/src/mesa/program/prog_instruction.c +++ b/mesalib/src/mesa/program/prog_instruction.c @@ -75,29 +75,6 @@ _mesa_alloc_instructions(GLuint numInst) /** - * Reallocate memory storing an array of program instructions. - * This is used when we need to append additional instructions onto an - * program. - * \param oldInst pointer to first of old/src instructions - * \param numOldInst number of instructions at <oldInst> - * \param numNewInst desired size of new instruction array. - * \return pointer to start of new instruction array. - */ -struct prog_instruction * -_mesa_realloc_instructions(struct prog_instruction *oldInst, - GLuint numOldInst, GLuint numNewInst) -{ - struct prog_instruction *newInst; - - newInst = (struct prog_instruction *) - realloc(oldInst, - numNewInst * sizeof(struct prog_instruction)); - - return newInst; -} - - -/** * Copy an array of program instructions. * \param dest pointer to destination. * \param src pointer to source. diff --git a/mesalib/src/mesa/program/prog_instruction.h b/mesalib/src/mesa/program/prog_instruction.h index de7880499..0957bd9d7 100644 --- a/mesalib/src/mesa/program/prog_instruction.h +++ b/mesalib/src/mesa/program/prog_instruction.h @@ -385,10 +385,6 @@ extern struct prog_instruction * _mesa_alloc_instructions(GLuint numInst); extern struct prog_instruction * -_mesa_realloc_instructions(struct prog_instruction *oldInst, - GLuint numOldInst, GLuint numNewInst); - -extern struct prog_instruction * _mesa_copy_instructions(struct prog_instruction *dest, const struct prog_instruction *src, GLuint n); diff --git a/mesalib/src/mesa/program/prog_optimize.h b/mesalib/src/mesa/program/prog_optimize.h index 7607bffdd..1f20ac0f8 100644 --- a/mesalib/src/mesa/program/prog_optimize.h +++ b/mesalib/src/mesa/program/prog_optimize.h @@ -29,6 +29,11 @@ #include "main/glheader.h" +#ifdef __cplusplus +extern "C" { +#endif + + struct gl_context; struct gl_program; struct prog_instruction; @@ -46,4 +51,10 @@ _mesa_optimize_program(struct gl_context *ctx, struct gl_program *program); extern GLboolean _mesa_constant_fold(struct gl_program *prog); + +#ifdef __cplusplus +} +#endif + + #endif diff --git a/mesalib/src/mesa/program/prog_parameter.c b/mesalib/src/mesa/program/prog_parameter.c index 896c6052b..0ef46415d 100644 --- a/mesalib/src/mesa/program/prog_parameter.c +++ b/mesalib/src/mesa/program/prog_parameter.c @@ -120,7 +120,7 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList, paramList->Size = paramList->Size + 4 * sz4; /* realloc arrays */ - paramList->Parameters = (struct gl_program_parameter *) + paramList->Parameters = realloc(paramList->Parameters, paramList->Size * sizeof(struct gl_program_parameter)); diff --git a/mesalib/src/mesa/program/prog_print.h b/mesalib/src/mesa/program/prog_print.h index cd61568e9..9058dfa76 100644 --- a/mesalib/src/mesa/program/prog_print.h +++ b/mesalib/src/mesa/program/prog_print.h @@ -31,6 +31,12 @@ #include "main/glheader.h" #include "main/mtypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + + struct gl_program; struct gl_program_parameter_list; struct gl_shader; @@ -115,4 +121,9 @@ extern void _mesa_append_uniforms_to_file(const struct gl_shader *shader); +#ifdef __cplusplus +} +#endif + + #endif /* PROG_PRINT_H */ diff --git a/mesalib/src/mesa/program/programopt.h b/mesalib/src/mesa/program/programopt.h index f22109fb4..93c00f740 100644 --- a/mesalib/src/mesa/program/programopt.h +++ b/mesalib/src/mesa/program/programopt.h @@ -28,6 +28,12 @@ #include "main/mtypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + + extern void _mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog); @@ -52,4 +58,8 @@ extern void _mesa_nop_vertex_program(struct gl_context *ctx, struct gl_vertex_program *prog); +#ifdef __cplusplus +} +#endif + #endif /* PROGRAMOPT_H */ diff --git a/mesalib/src/mesa/program/sampler.cpp b/mesalib/src/mesa/program/sampler.cpp index 29a540871..f8584c968 100644 --- a/mesalib/src/mesa/program/sampler.cpp +++ b/mesalib/src/mesa/program/sampler.cpp @@ -27,15 +27,14 @@ #include "glsl_types.h" #include "ir_visitor.h" #include "../glsl/program.h" -#include "program/hash_table.h" #include "ir_uniform.h" -extern "C" { #include "main/compiler.h" #include "main/mtypes.h" +#include "program/hash_table.h" #include "program/prog_parameter.h" #include "program/program.h" -} + class get_sampler_name : public ir_hierarchical_visitor { @@ -104,7 +103,7 @@ public: }; -extern "C" int +int _mesa_get_sampler_uniform_value(class ir_dereference *sampler, struct gl_shader_program *shader_program, const struct gl_program *prog) @@ -136,7 +135,7 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler, } -extern "C" class ir_rvalue * +class ir_rvalue * _mesa_get_sampler_array_nonconst_index(class ir_dereference *sampler) { ir_dereference_array *deref_arr = sampler->as_dereference_array(); diff --git a/mesalib/src/mesa/program/sampler.h b/mesalib/src/mesa/program/sampler.h index 8b7c3b63e..61c7f5851 100644 --- a/mesalib/src/mesa/program/sampler.h +++ b/mesalib/src/mesa/program/sampler.h @@ -23,6 +23,10 @@ * DEALINGS IN THE SOFTWARE. */ +#ifndef SAMPLER_H +#define SAMPLER_H + + int _mesa_get_sampler_uniform_value(class ir_dereference *sampler, struct gl_shader_program *shader_program, @@ -30,3 +34,6 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler, class ir_rvalue * _mesa_get_sampler_array_nonconst_index(class ir_dereference *sampler); + + +#endif /* SAMPLER_H */ diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index 17235132e..9fd6caece 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -136,6 +136,8 @@ st_destroy_context_priv(struct st_context *st) if (st->constbuf_uploader) { u_upload_destroy(st->constbuf_uploader); } + + cso_destroy_context(st->cso_context); free( st ); } @@ -271,6 +273,8 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, */ st->ctx->Point.MaxSize = MAX2(ctx->Const.MaxPointSize, ctx->Const.MaxPointSizeAA); + /* For vertex shaders, make sure not to emit saturate when SM 3.0 is not supported */ + ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].EmitNoSat = !st->has_shader_model3; _mesa_compute_version(ctx); @@ -346,15 +350,11 @@ destroy_tex_sampler_cb(GLuint id, void *data, void *userData) void st_destroy_context( struct st_context *st ) { struct pipe_context *pipe = st->pipe; - struct cso_context *cso = st->cso_context; struct gl_context *ctx = st->ctx; GLuint i; _mesa_HashWalk(ctx->Shared->TexObjects, destroy_tex_sampler_cb, st); - /* need to unbind and destroy CSO objects before anything else */ - cso_release_all(st->cso_context); - st_reference_fragprog(st, &st->fp, NULL); st_reference_geomprog(st, &st->gp, NULL); st_reference_vertprog(st, &st->vp, NULL); @@ -384,8 +384,6 @@ void st_destroy_context( struct st_context *st ) st_destroy_context_priv(st); st = NULL; - cso_destroy_context(cso); - pipe->destroy( pipe ); free(ctx); diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h index 15f9df492..20d567864 100644 --- a/mesalib/src/mesa/state_tracker/st_context.h +++ b/mesalib/src/mesa/state_tracker/st_context.h @@ -33,6 +33,12 @@ #include "state_tracker/st_api.h" #include "main/fbobject.h" + +#ifdef __cplusplus +extern "C" { +#endif + + struct bitmap_cache; struct dd_function_table; struct draw_context; @@ -278,4 +284,8 @@ extern void st_destroy_context(struct st_context *st); +#ifdef __cplusplus +} +#endif + #endif diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index bdfab8b41..e472b84a8 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -674,6 +674,10 @@ void st_init_extensions(struct pipe_screen *screen, consts->NativeIntegers = GL_TRUE; consts->MaxClipPlanes = 8; + if (screen->get_param(screen, PIPE_CAP_VERTEXID_NOBASE)) { + consts->VertexID_is_zero_based = GL_TRUE; + } + /* Extensions that either depend on GLSL 1.30 or are a subset thereof. */ extensions->ARB_conservative_depth = GL_TRUE; extensions->ARB_shading_language_packing = GL_TRUE; @@ -696,6 +700,9 @@ void st_init_extensions(struct pipe_screen *screen, extensions->EXT_shader_integer_mix = GL_TRUE; } + + /* Integer textures make no sense before GLSL 1.30 */ + extensions->EXT_texture_integer = GL_FALSE; } consts->UniformBooleanTrue = consts->NativeIntegers ? ~0 : fui(1.0f); 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 8e91c4b61..89654344b 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -44,10 +44,8 @@ #include "main/mtypes.h" #include "main/shaderobj.h" #include "main/uniforms.h" -#include "program/hash_table.h" - -extern "C" { #include "main/shaderapi.h" +#include "program/hash_table.h" #include "program/prog_instruction.h" #include "program/prog_optimize.h" #include "program/prog_print.h" @@ -67,7 +65,7 @@ extern "C" { #include "st_program.h" #include "st_glsl_to_tgsi.h" #include "st_mesa_to_tgsi.h" -} + #define PROGRAM_IMMEDIATE PROGRAM_FILE_MAX #define PROGRAM_ANY_CONST ((1 << PROGRAM_STATE_VAR) | \ @@ -2288,6 +2286,37 @@ glsl_to_tgsi_visitor::process_move_condition(ir_rvalue *ir) bool switch_order = false; ir_expression *const expr = ir->as_expression(); + + if (native_integers) { + if ((expr != NULL) && (expr->get_num_operands() == 2)) { + enum glsl_base_type type = expr->operands[0]->type->base_type; + if (type == GLSL_TYPE_INT || type == GLSL_TYPE_UINT || + type == GLSL_TYPE_BOOL) { + if (expr->operation == ir_binop_equal) { + if (expr->operands[0]->is_zero()) { + src_ir = expr->operands[1]; + switch_order = true; + } + else if (expr->operands[1]->is_zero()) { + src_ir = expr->operands[0]; + switch_order = true; + } + } + else if (expr->operation == ir_binop_nequal) { + if (expr->operands[0]->is_zero()) { + src_ir = expr->operands[1]; + } + else if (expr->operands[1]->is_zero()) { + src_ir = expr->operands[0]; + } + } + } + } + + src_ir->accept(this); + return switch_order; + } + if ((expr != NULL) && (expr->get_num_operands() == 2)) { bool zero_on_left = false; @@ -2379,7 +2408,7 @@ glsl_to_tgsi_visitor::emit_block_mov(ir_assignment *ir, const struct glsl_type * const struct glsl_type *vec_type; vec_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, - type->vector_elements, 1); + type->vector_elements, 1); for (int i = 0; i < type->matrix_columns; i++) { emit_block_mov(ir, vec_type, l, r); @@ -2447,7 +2476,7 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) swizzles[i] = first_enabled_chan; } r.swizzle = MAKE_SWIZZLE4(swizzles[0], swizzles[1], - swizzles[2], swizzles[3]); + swizzles[2], swizzles[3]); } assert(l.file != PROGRAM_UNDEFINED); @@ -2460,24 +2489,21 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) for (i = 0; i < type_size(ir->lhs->type); i++) { st_src_reg l_src = st_src_reg(l); st_src_reg condition_temp = condition; + st_src_reg op1, op2; l_src.swizzle = swizzle_for_size(ir->lhs->type->vector_elements); - + + op1 = r; + op2 = l_src; + if (switch_order) { + op1 = l_src; + op2 = r; + } + if (native_integers) { - /* This is necessary because TGSI's CMP instruction expects the - * condition to be a float, and we store booleans as integers. - * TODO: really want to avoid i2f path and use UCMP. Requires - * changes to process_move_condition though too. - */ - condition_temp = get_temp(glsl_type::vec4_type); - condition.negate = 0; - emit(ir, TGSI_OPCODE_I2F, st_dst_reg(condition_temp), condition); - condition_temp.swizzle = condition.swizzle; + emit(ir, TGSI_OPCODE_UCMP, l, condition_temp, op1, op2); } - - if (switch_order) { - emit(ir, TGSI_OPCODE_CMP, l, condition_temp, l_src, r); - } else { - emit(ir, TGSI_OPCODE_CMP, l, condition_temp, r, l_src); + else { + emit(ir, TGSI_OPCODE_CMP, l, condition_temp, op1, op2); } l.index++; @@ -3527,7 +3553,8 @@ glsl_to_tgsi_visitor::copy_propagate(void) first = copy_chan; } else { if (first->src[0].file != copy_chan->src[0].file || - first->src[0].index != copy_chan->src[0].index) { + first->src[0].index != copy_chan->src[0].index || + first->src[0].index2D != copy_chan->src[0].index2D) { good = false; break; } @@ -4167,8 +4194,8 @@ const unsigned _mesa_sysval_to_semantic[SYSTEM_VALUE_MAX] = { */ TGSI_SEMANTIC_VERTEXID, TGSI_SEMANTIC_INSTANCEID, - 0, - 0, + TGSI_SEMANTIC_VERTEXID_NOBASE, + TGSI_SEMANTIC_BASEVERTEX, /* Geometry shader */ @@ -4879,6 +4906,10 @@ st_translate_program( TGSI_SEMANTIC_SAMPLEMASK); assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_INVOCATION_ID] == TGSI_SEMANTIC_INVOCATIONID); + assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_VERTEX_ID_ZERO_BASE] == + TGSI_SEMANTIC_VERTEXID_NOBASE); + assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_BASE_VERTEX] == + TGSI_SEMANTIC_BASEVERTEX); t = CALLOC_STRUCT(st_translate); if (!t) { @@ -5391,9 +5422,6 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) if (!pscreen->get_param(pscreen, PIPE_CAP_TEXTURE_GATHER_OFFSETS)) lower_offset_arrays(ir); do_mat_op_to_vec(ir); - /* Emit saturates in the vertex shader only if SM 3.0 is supported. */ - bool vs_sm3 = (_mesa_shader_stage_to_program(prog->_LinkedShaders[i]->Stage) == - GL_VERTEX_PROGRAM_ARB) && st_context(ctx)->has_shader_model3; lower_instructions(ir, MOD_TO_FRACT | DIV_TO_MUL_RCP | @@ -5404,7 +5432,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) BORROW_TO_ARITH | (options->EmitNoPow ? POW_TO_EXP2 : 0) | (!ctx->Const.NativeIntegers ? INT_DIV_TO_MUL_RCP : 0) | - (vs_sm3 ? SAT_TO_CLAMP : 0)); + (options->EmitNoSat ? SAT_TO_CLAMP : 0)); lower_ubo_reference(prog->_LinkedShaders[i], ir); do_vec_index_to_cond_assign(ir); diff --git a/mesalib/src/mesa/state_tracker/st_program.h b/mesalib/src/mesa/state_tracker/st_program.h index cf1b40a55..870d0d57a 100644 --- a/mesalib/src/mesa/state_tracker/st_program.h +++ b/mesalib/src/mesa/state_tracker/st_program.h @@ -41,6 +41,11 @@ #include "st_glsl_to_tgsi.h" +#ifdef __cplusplus +extern "C" { +#endif + + /** Fragment program variant key */ struct st_fp_variant_key { @@ -347,4 +352,8 @@ extern void st_print_current_vertex_program(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c index 65cf52e21..faeccae7c 100644 --- a/mesalib/src/mesa/swrast/s_texfilter.c +++ b/mesalib/src/mesa/swrast/s_texfilter.c @@ -73,7 +73,7 @@ lerp_2d(GLfloat a, GLfloat b, * Do 3D/trilinear interpolation of float values. * \sa lerp_2d */ -static inline GLfloat +static GLfloat lerp_3d(GLfloat a, GLfloat b, GLfloat c, GLfloat v000, GLfloat v100, GLfloat v010, GLfloat v110, GLfloat v001, GLfloat v101, GLfloat v011, GLfloat v111) @@ -91,7 +91,7 @@ lerp_3d(GLfloat a, GLfloat b, GLfloat c, /** * Do linear interpolation of colors. */ -static inline void +static void lerp_rgba(GLfloat result[4], GLfloat t, const GLfloat a[4], const GLfloat b[4]) { result[0] = LERP(t, a[0], b[0]); @@ -104,7 +104,7 @@ lerp_rgba(GLfloat result[4], GLfloat t, const GLfloat a[4], const GLfloat b[4]) /** * Do bilinear interpolation of colors. */ -static inline void +static void lerp_rgba_2d(GLfloat result[4], GLfloat a, GLfloat b, const GLfloat t00[4], const GLfloat t10[4], const GLfloat t01[4], const GLfloat t11[4]) @@ -119,7 +119,7 @@ lerp_rgba_2d(GLfloat result[4], GLfloat a, GLfloat b, /** * Do trilinear interpolation of colors. */ -static inline void +static void lerp_rgba_3d(GLfloat result[4], GLfloat a, GLfloat b, GLfloat c, const GLfloat t000[4], const GLfloat t100[4], const GLfloat t010[4], const GLfloat t110[4], @@ -155,7 +155,7 @@ lerp_rgba_3d(GLfloat result[4], GLfloat a, GLfloat b, GLfloat c, * i0, i1 = returns two nearest texel indexes * weight = returns blend factor between texels */ -static inline void +static void linear_texel_locations(GLenum wrapMode, const struct gl_texture_image *img, GLint size, GLfloat s, @@ -285,7 +285,7 @@ linear_texel_locations(GLenum wrapMode, /** * Used to compute texel location for nearest sampling. */ -static inline GLint +static GLint nearest_texel_location(GLenum wrapMode, const struct gl_texture_image *img, GLint size, GLfloat s) @@ -410,7 +410,7 @@ nearest_texel_location(GLenum wrapMode, /* Power of two image sizes only */ -static inline void +static void linear_repeat_texel_location(GLuint size, GLfloat s, GLint *i0, GLint *i1, GLfloat *weight) { @@ -424,7 +424,7 @@ linear_repeat_texel_location(GLuint size, GLfloat s, /** * Do clamp/wrap for a texture rectangle coord, GL_NEAREST filter mode. */ -static inline GLint +static GLint clamp_rect_coord_nearest(GLenum wrapMode, GLfloat coord, GLint max) { switch (wrapMode) { @@ -444,7 +444,7 @@ clamp_rect_coord_nearest(GLenum wrapMode, GLfloat coord, GLint max) /** * As above, but GL_LINEAR filtering. */ -static inline void +static void clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max, GLint *i0out, GLint *i1out, GLfloat *weight) { @@ -486,7 +486,7 @@ clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max, /** * Compute slice/image to use for 1D or 2D array texture. */ -static inline GLint +static GLint tex_array_slice(GLfloat coord, GLsizei size) { GLint slice = IFLOOR(coord + 0.5f); @@ -499,7 +499,7 @@ tex_array_slice(GLfloat coord, GLsizei size) * Compute nearest integer texcoords for given texobj and coordinate. * NOTE: only used for depth texture sampling. */ -static inline void +static void nearest_texcoord(const struct gl_sampler_object *samp, const struct gl_texture_object *texObj, GLuint level, @@ -548,7 +548,7 @@ nearest_texcoord(const struct gl_sampler_object *samp, * Compute linear integer texcoords for given texobj and coordinate. * NOTE: only used for depth texture sampling. */ -static inline void +static void linear_texcoord(const struct gl_sampler_object *samp, const struct gl_texture_object *texObj, GLuint level, @@ -607,7 +607,7 @@ linear_texcoord(const struct gl_sampler_object *samp, * For linear interpolation between mipmap levels N and N+1, this function * computes N. */ -static inline GLint +static GLint linear_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda) { if (lambda < 0.0F) @@ -622,7 +622,7 @@ linear_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda) /** * Compute the nearest mipmap level to take texels from. */ -static inline GLint +static GLint nearest_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda) { GLfloat l; @@ -658,7 +658,7 @@ nearest_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda) * will be minified, magnified, or split between the two. This function * determines the subranges in [0, n-1] that are to be minified or magnified. */ -static inline void +static void compute_min_mag_ranges(const struct gl_sampler_object *samp, GLuint n, const GLfloat lambda[], GLuint *minStart, GLuint *minEnd, @@ -767,7 +767,7 @@ compute_min_mag_ranges(const struct gl_sampler_object *samp, * the base texture format. Ex: if the texture base format it GL_ALPHA, * we return (0,0,0,BorderAlpha). */ -static inline void +static void get_border_color(const struct gl_sampler_object *samp, const struct gl_texture_image *img, GLfloat rgba[4]) @@ -804,7 +804,7 @@ get_border_color(const struct gl_sampler_object *samp, /** * Put z into texel according to GL_DEPTH_MODE. */ -static inline void +static void apply_depth_mode(GLenum depthMode, GLfloat z, GLfloat texel[4]) { switch (depthMode) { @@ -844,7 +844,7 @@ is_depth_texture(const struct gl_texture_object *tObj) /** * Return the texture sample for coordinate (s) using GL_NEAREST filter. */ -static inline void +static void sample_1d_nearest(struct gl_context *ctx, const struct gl_sampler_object *samp, const struct gl_texture_image *img, @@ -869,7 +869,7 @@ sample_1d_nearest(struct gl_context *ctx, /** * Return the texture sample for coordinate (s) using GL_LINEAR filter. */ -static inline void +static void sample_1d_linear(struct gl_context *ctx, const struct gl_sampler_object *samp, const struct gl_texture_image *img, @@ -1110,7 +1110,7 @@ sample_lambda_1d( struct gl_context *ctx, /** * Return the texture sample for coordinate (s,t) using GL_NEAREST filter. */ -static inline void +static void sample_2d_nearest(struct gl_context *ctx, const struct gl_sampler_object *samp, const struct gl_texture_image *img, @@ -1144,7 +1144,7 @@ sample_2d_nearest(struct gl_context *ctx, * Return the texture sample for coordinate (s,t) using GL_LINEAR filter. * New sampling code contributed by Lynn Quam <quam@ai.sri.com>. */ -static inline void +static void sample_2d_linear(struct gl_context *ctx, const struct gl_sampler_object *samp, const struct gl_texture_image *img, @@ -1209,7 +1209,7 @@ sample_2d_linear(struct gl_context *ctx, * As above, but we know WRAP_S == REPEAT and WRAP_T == REPEAT. * We don't have to worry about the texture border. */ -static inline void +static void sample_2d_linear_repeat(struct gl_context *ctx, const struct gl_sampler_object *samp, const struct gl_texture_image *img, @@ -1830,7 +1830,7 @@ sample_2d_footprint(struct gl_context *ctx, * Returns the index of the specified texture object in the * gl_context texture unit array. */ -static inline GLuint +static GLuint texture_unit_index(const struct gl_context *ctx, const struct gl_texture_object *tObj) { @@ -2012,7 +2012,7 @@ sample_lambda_2d_aniso(struct gl_context *ctx, /** * Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter. */ -static inline void +static void sample_3d_nearest(struct gl_context *ctx, const struct gl_sampler_object *samp, const struct gl_texture_image *img, @@ -3416,7 +3416,7 @@ sample_lambda_1d_array(struct gl_context *ctx, /** * Compare texcoord against depth sample. Return 1.0 or 0.0 value. */ -static inline GLfloat +static GLfloat shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample) { switch (function) { @@ -3448,7 +3448,7 @@ shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample) /** * Compare texcoord against four depth samples. */ -static inline GLfloat +static GLfloat shadow_compare4(GLenum function, GLfloat coord, GLfloat depth00, GLfloat depth01, GLfloat depth10, GLfloat depth11, diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c index e623b361a..6eac841b1 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_array.c +++ b/mesalib/src/mesa/vbo/vbo_exec_array.c @@ -786,7 +786,7 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) _mesa_debug(ctx, "glDrawArrays(%s, %d, %d)\n", _mesa_lookup_enum_by_nr(mode), start, count); - if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) + if (!_mesa_validate_DrawArrays(ctx, mode, count)) return; if (0) @@ -1022,8 +1022,8 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, _mesa_lookup_enum_by_nr(mode), start, end, count, _mesa_lookup_enum_by_nr(type), indices, basevertex); - if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, - type, indices, basevertex )) + if (!_mesa_validate_DrawRangeElements(ctx, mode, start, end, count, + type, indices)) return; if ((int) end + basevertex < 0 || @@ -1120,7 +1120,7 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, _mesa_lookup_enum_by_nr(mode), count, _mesa_lookup_enum_by_nr(type), indices); - if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, 0 )) + if (!_mesa_validate_DrawElements(ctx, mode, count, type, indices)) return; vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0, @@ -1142,8 +1142,7 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, _mesa_lookup_enum_by_nr(mode), count, _mesa_lookup_enum_by_nr(type), indices, basevertex); - if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, - basevertex )) + if (!_mesa_validate_DrawElements(ctx, mode, count, type, indices)) return; vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0, @@ -1166,7 +1165,7 @@ vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, _mesa_lookup_enum_by_nr(type), indices, numInstances); if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices, - numInstances, 0)) + numInstances)) return; vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0, @@ -1191,7 +1190,7 @@ vbo_exec_DrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type numInstances, basevertex); if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices, - numInstances, basevertex)) + numInstances)) return; vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0, @@ -1216,7 +1215,7 @@ vbo_exec_DrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum ty numInstances, baseInstance); if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices, - numInstances, 0)) + numInstances)) return; vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0, @@ -1242,7 +1241,7 @@ vbo_exec_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, numInstances, basevertex, baseInstance); if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices, - numInstances, basevertex)) + numInstances)) return; vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0, @@ -1399,7 +1398,7 @@ vbo_exec_MultiDrawElements(GLenum mode, GET_CURRENT_CONTEXT(ctx); if (!_mesa_validate_MultiDrawElements(ctx, mode, count, type, indices, - primcount, NULL)) + primcount)) return; vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount, @@ -1417,7 +1416,7 @@ vbo_exec_MultiDrawElementsBaseVertex(GLenum mode, GET_CURRENT_CONTEXT(ctx); if (!_mesa_validate_MultiDrawElements(ctx, mode, count, type, indices, - primcount, basevertex)) + primcount)) return; vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount, diff --git a/mesalib/src/mesa/vbo/vbo_save_api.c b/mesalib/src/mesa/vbo/vbo_save_api.c index 848eedaa4..5055c221b 100644 --- a/mesalib/src/mesa/vbo/vbo_save_api.c +++ b/mesalib/src/mesa/vbo/vbo_save_api.c @@ -1523,18 +1523,22 @@ vbo_destroy_vertex_list(struct gl_context *ctx, void *data) static void -vbo_print_vertex_list(struct gl_context *ctx, void *data) +vbo_print_vertex_list(struct gl_context *ctx, void *data, FILE *f) { struct vbo_save_vertex_list *node = (struct vbo_save_vertex_list *) data; GLuint i; + struct gl_buffer_object *buffer = node->vertex_store ? + node->vertex_store->bufferobj : NULL; (void) ctx; - printf("VBO-VERTEX-LIST, %u vertices %d primitives, %d vertsize\n", - node->count, node->prim_count, node->vertex_size); + fprintf(f, "VBO-VERTEX-LIST, %u vertices %d primitives, %d vertsize " + "buffer %p\n", + node->count, node->prim_count, node->vertex_size, + buffer); for (i = 0; i < node->prim_count; i++) { struct _mesa_prim *prim = &node->prim[i]; - printf(" prim %d: %s%s %d..%d %s %s\n", + fprintf(f, " prim %d: %s%s %d..%d %s %s\n", i, _mesa_lookup_prim_by_nr(prim->mode), prim->weak ? " (weak)" : "", diff --git a/mesalib/src/mesa/x86/3dnow.c b/mesalib/src/mesa/x86/3dnow.c index 4e3003b43..c46cfbc57 100644 --- a/mesalib/src/mesa/x86/3dnow.c +++ b/mesalib/src/mesa/x86/3dnow.c @@ -46,8 +46,6 @@ 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, @@ -78,11 +76,6 @@ void _mesa_init_3dnow_transform_asm( void ) 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!" ); diff --git a/mesalib/src/mesa/x86/3dnow_normal.S b/mesalib/src/mesa/x86/3dnow_normal.S deleted file mode 100644 index ca95f2548..000000000 --- a/mesalib/src/mesa/x86/3dnow_normal.S +++ /dev/null @@ -1,852 +0,0 @@ - -/* - * Mesa 3-D graphics library - * - * 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 - * 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. - */ - -/* - * 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 |