From e1a407256a5c1571d8f4871fd981a51cfbd46e37 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 22 Jun 2012 08:30:33 +0200 Subject: mesa xserver libxcb fontconfig --- mesalib/src/gallium/.gitignore | 1 + mesalib/src/gallium/Makefile | 12 - mesalib/src/gallium/Makefile.am | 22 ++ mesalib/src/mapi/glapi/gen/.gitignore | 1 + .../mapi/glapi/gen/ARB_uniform_buffer_object.xml | 97 +++++++++ mesalib/src/mapi/glapi/gen/Makefile | 241 --------------------- mesalib/src/mapi/glapi/gen/Makefile.am | 240 ++++++++++++++++++++ mesalib/src/mapi/glapi/gen/gl_API.xml | 4 +- mesalib/src/mesa/.gitignore | 6 +- mesalib/src/mesa/Makefile | 238 -------------------- mesalib/src/mesa/Makefile.am | 107 +++++++++ mesalib/src/mesa/Makefile.old | 82 +++++++ mesalib/src/mesa/drivers/.gitignore | 1 + mesalib/src/mesa/drivers/Makefile | 29 --- mesalib/src/mesa/drivers/Makefile.am | 22 ++ mesalib/src/mesa/drivers/dri/common/Makefile.am | 1 - mesalib/src/mesa/drivers/dri/swrast/Makefile.am | 1 - mesalib/src/mesa/gl.pc.in | 8 +- mesalib/src/mesa/main/api_exec.c | 12 +- mesalib/src/mesa/main/bufferobj.c | 240 ++++++++++++++++++++ mesalib/src/mesa/main/bufferobj.h | 10 + mesalib/src/mesa/main/context.c | 9 + mesalib/src/mesa/main/extensions.c | 2 +- mesalib/src/mesa/main/get.c | 60 +++++ mesalib/src/mesa/main/mtypes.h | 41 ++++ mesalib/src/mesa/main/transformfeedback.c | 66 +----- mesalib/src/mesa/main/transformfeedback.h | 15 +- mesalib/src/mesa/osmesa.pc.in | 8 +- mesalib/src/mesa/x86/.gitignore | 3 + mesalib/src/mesa/x86/Makefile | 46 ---- mesalib/src/mesa/x86/Makefile.am | 39 ++++ 31 files changed, 1011 insertions(+), 653 deletions(-) create mode 100644 mesalib/src/gallium/.gitignore delete mode 100644 mesalib/src/gallium/Makefile create mode 100644 mesalib/src/gallium/Makefile.am create mode 100644 mesalib/src/mapi/glapi/gen/.gitignore create mode 100644 mesalib/src/mapi/glapi/gen/ARB_uniform_buffer_object.xml delete mode 100644 mesalib/src/mapi/glapi/gen/Makefile create mode 100644 mesalib/src/mapi/glapi/gen/Makefile.am delete mode 100644 mesalib/src/mesa/Makefile create mode 100644 mesalib/src/mesa/Makefile.am create mode 100644 mesalib/src/mesa/Makefile.old create mode 100644 mesalib/src/mesa/drivers/.gitignore delete mode 100644 mesalib/src/mesa/drivers/Makefile create mode 100644 mesalib/src/mesa/drivers/Makefile.am create mode 100644 mesalib/src/mesa/x86/.gitignore delete mode 100644 mesalib/src/mesa/x86/Makefile create mode 100644 mesalib/src/mesa/x86/Makefile.am (limited to 'mesalib/src') diff --git a/mesalib/src/gallium/.gitignore b/mesalib/src/gallium/.gitignore new file mode 100644 index 000000000..5fc607b9e --- /dev/null +++ b/mesalib/src/gallium/.gitignore @@ -0,0 +1 @@ +/Makefile diff --git a/mesalib/src/gallium/Makefile b/mesalib/src/gallium/Makefile deleted file mode 100644 index 79ca767f7..000000000 --- a/mesalib/src/gallium/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# src/gallium/Makefile -TOP = ../.. -include $(TOP)/configs/current - -SUBDIRS = $(GALLIUM_DIRS) - -default install clean: - @for dir in $(SUBDIRS) ; do \ - if [ -d $$dir ] ; then \ - (cd $$dir && $(MAKE) $@) || exit 1; \ - fi \ - done diff --git a/mesalib/src/gallium/Makefile.am b/mesalib/src/gallium/Makefile.am new file mode 100644 index 000000000..e7cff8920 --- /dev/null +++ b/mesalib/src/gallium/Makefile.am @@ -0,0 +1,22 @@ +# Copyright © 2012 Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +SUBDIRS = $(GALLIUM_DIRS) diff --git a/mesalib/src/mapi/glapi/gen/.gitignore b/mesalib/src/mapi/glapi/gen/.gitignore new file mode 100644 index 000000000..5fc607b9e --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/.gitignore @@ -0,0 +1 @@ +/Makefile diff --git a/mesalib/src/mapi/glapi/gen/ARB_uniform_buffer_object.xml b/mesalib/src/mapi/glapi/gen/ARB_uniform_buffer_object.xml new file mode 100644 index 000000000..cbcd339e7 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/ARB_uniform_buffer_object.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/Makefile b/mesalib/src/mapi/glapi/gen/Makefile deleted file mode 100644 index 0ac798957..000000000 --- a/mesalib/src/mapi/glapi/gen/Makefile +++ /dev/null @@ -1,241 +0,0 @@ -# This file isn't used during a normal compilation since we don't want to -# require Python in order to compile Mesa. -# Instead, when the Mesa developers update/change the API interface it's -# up to him/her to re-run this makefile and check in the newly generated files. - - -TOP = ../../../.. -include $(TOP)/configs/current - -MESA_DIR = $(TOP)/src/mesa -MESA_GLAPI_DIR = $(TOP)/src/mapi/glapi -MESA_MAPI_DIR = $(TOP)/src/mapi/mapi -MESA_GLX_DIR = $(TOP)/src/glx - -MESA_GLAPI_OUTPUTS = \ - $(MESA_GLAPI_DIR)/glapi_mapi_tmp.h \ - $(MESA_GLAPI_DIR)/glprocs.h \ - $(MESA_GLAPI_DIR)/glapitemp.h \ - $(MESA_GLAPI_DIR)/glapitable.h \ - $(MESA_GLAPI_DIR)/glapi_gentable.c - -MESA_GLAPI_ASM_OUTPUTS = \ - $(MESA_GLAPI_DIR)/glapi_x86.S \ - $(MESA_GLAPI_DIR)/glapi_x86-64.S \ - $(MESA_GLAPI_DIR)/glapi_sparc.S - -MESA_OUTPUTS = \ - $(MESA_GLAPI_OUTPUTS) \ - $(MESA_GLAPI_ASM_OUTPUTS) \ - $(MESA_DIR)/main/enums.c \ - $(MESA_DIR)/main/dispatch.h \ - $(MESA_DIR)/main/remap_helper.h \ - $(MESA_GLX_DIR)/indirect.c \ - $(MESA_GLX_DIR)/indirect.h \ - $(MESA_GLX_DIR)/indirect_init.c \ - $(MESA_GLX_DIR)/indirect_size.h \ - $(MESA_GLX_DIR)/indirect_size.c - -###################################################################### - -XORG_GLX_DIR = $(XORG_BASE)/glx -XORG_GLAPI_DIR = $(XORG_BASE)/glx - -XORG_GLAPI_OUTPUTS = \ - $(XORG_GLAPI_DIR)/glprocs.h \ - $(XORG_GLAPI_DIR)/glapitable.h \ - $(XORG_GLAPI_DIR)/dispatch.h \ - $(XORG_GLAPI_DIR)/glapi_gentable.c - -XORG_OUTPUTS = \ - $(XORG_GLAPI_OUTPUTS) \ - $(XORG_GLX_DIR)/indirect_dispatch.c \ - $(XORG_GLX_DIR)/indirect_dispatch_swap.c \ - $(XORG_GLX_DIR)/indirect_dispatch.h \ - $(XORG_GLX_DIR)/indirect_reqsize.c \ - $(XORG_GLX_DIR)/indirect_reqsize.h \ - $(XORG_GLX_DIR)/indirect_size.h \ - $(XORG_GLX_DIR)/indirect_size_get.c \ - $(XORG_GLX_DIR)/indirect_size_get.h \ - $(XORG_GLX_DIR)/indirect_table.c - -###################################################################### - -API_XML = \ - gl_API.xml \ - ARB_base_instance.xml \ - ARB_color_buffer_float.xml \ - ARB_copy_buffer.xml \ - ARB_debug_output.xml \ - ARB_depth_buffer_float.xml \ - ARB_depth_clamp.xml \ - ARB_draw_buffers_blend.xml \ - ARB_draw_elements_base_vertex.xml \ - ARB_draw_instanced.xml \ - ARB_ES2_compatibility.xml \ - ARB_framebuffer_object.xml \ - ARB_geometry_shader4.xml \ - ARB_instanced_arrays.xml \ - ARB_map_buffer_range.xml \ - ARB_robustness.xml \ - ARB_sampler_objects.xml \ - ARB_seamless_cube_map.xml \ - ARB_sync.xml \ - ARB_texture_buffer_object.xml \ - ARB_texture_compression_rgtc.xml \ - ARB_texture_float.xml \ - ARB_texture_rg.xml \ - ARB_texture_storage.xml \ - ARB_vertex_array_object.xml \ - AMD_draw_buffers_blend.xml \ - ARB_vertex_type_2_10_10_10_rev.xml \ - APPLE_object_purgeable.xml \ - APPLE_vertex_array_object.xml \ - EXT_draw_buffers2.xml \ - EXT_framebuffer_object.xml \ - EXT_gpu_shader4.xml \ - EXT_packed_depth_stencil.xml \ - EXT_provoking_vertex.xml \ - EXT_separate_shader_objects.xml \ - EXT_texture_array.xml \ - EXT_texture_integer.xml \ - EXT_transform_feedback.xml \ - NV_conditional_render.xml \ - NV_primitive_restart.xml \ - NV_texture_barrier.xml \ - OES_EGL_image.xml \ - GL3x.xml - - -COMMON = $(API_XML) gl_XML.py glX_XML.py license.py typeexpr.py - -COMMON_ES = \ - $(COMMON) \ - gl_and_es_API.xml \ - es_EXT.xml \ - ARB_ES2_compatibility.xml \ - ARB_get_program_binary.xml \ - OES_fixed_point.xml \ - OES_single_precision.xml - -COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py - -###################################################################### - -default: mesa -install: mesa - -mesa: $(MESA_OUTPUTS) - -xorg: check-xorg-source $(XORG_OUTPUTS) - -check-xorg-source: - @if ! test -d $(XORG_GLX_DIR); then \ - echo "ERROR: Must specify path to xserver/ checkout. Set XORG_BASE env var."; \ - if test x$(XORG_BASE) != x; then \ - echo "'$(XORG_GLX_DIR)' does not exist."; \ - fi; \ - exit 1; \ - fi - -clean: - -rm -f *~ *.pyo - -rm -f $(MESA_OUTPUTS) - -###################################################################### - -$(XORG_GLAPI_DIR)/%.c: $(MESA_GLAPI_DIR)/%.c - cp $< $@ - -$(XORG_GLAPI_DIR)/dispatch.h: $(MESA_DIR)/main/dispatch.h - cp $< $@ - -$(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h - cp $< $@ - -###################################################################### - -$(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON_ES) - $(PYTHON2) $(PYTHON_FLAGS) $< \ - --printer glapi --mode lib gl_and_es_API.xml > $@ - -$(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -$(MESA_GLAPI_DIR)/glapitemp.h: gl_apitemp.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -$(MESA_GLAPI_DIR)/glapitable.h: gl_table.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -$(MESA_GLAPI_DIR)/glapi_gentable.c: gl_gentable.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -###################################################################### - -$(MESA_GLAPI_DIR)/glapi_x86.S: gl_x86_asm.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -$(MESA_GLAPI_DIR)/glapi_x86-64.S: gl_x86-64_asm.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -$(MESA_GLAPI_DIR)/glapi_sparc.S: gl_SPARC_asm.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -###################################################################### - -$(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON_ES) - $(PYTHON2) $(PYTHON_FLAGS) $< -f gl_and_es_API.xml > $@ - -$(MESA_DIR)/main/dispatch.h: gl_table.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< -m remap_table > $@ - -$(MESA_DIR)/main/remap_helper.h: remap_helper.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -###################################################################### - -$(MESA_GLX_DIR)/indirect.c: glX_proto_send.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m proto | $(INDENT) $(INDENT_FLAGS) > $@ - -$(MESA_GLX_DIR)/indirect.h: glX_proto_send.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m init_h > $@ - -$(MESA_GLX_DIR)/indirect_init.c: glX_proto_send.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m init_c > $@ - -$(MESA_GLX_DIR)/indirect_size.h $(XORG_GLX_DIR)/indirect_size.h: glX_proto_size.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m size_h --only-set -h _INDIRECT_SIZE_H_ \ - | $(INDENT) $(INDENT_FLAGS) > $@ - -$(MESA_GLX_DIR)/indirect_size.c: glX_proto_size.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c --only-set \ - | $(INDENT) $(INDENT_FLAGS) > $@ - -###################################################################### - -$(XORG_GLX_DIR)/indirect_dispatch.c: glX_proto_recv.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_c > $@ - -$(XORG_GLX_DIR)/indirect_dispatch_swap.c: glX_proto_recv.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_c -s > $@ - -$(XORG_GLX_DIR)/indirect_dispatch.h: glX_proto_recv.py gl_and_glX_API.xml $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_h -f gl_and_glX_API.xml -s > $@ - -$(XORG_GLX_DIR)/indirect_size_get.h: glX_proto_size.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m size_h --only-get -h '_INDIRECT_SIZE_GET_H_' \ - | $(INDENT) $(INDENT_FLAGS) > $@ - -$(XORG_GLX_DIR)/indirect_size_get.c: glX_proto_size.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c | $(INDENT) $(INDENT_FLAGS) > $@ - -$(XORG_GLX_DIR)/indirect_reqsize.h: glX_proto_size.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m reqsize_h --only-get -h '_INDIRECT_SIZE_GET_H_' \ - | $(INDENT) $(INDENT_FLAGS) -l200 > $@ - -$(XORG_GLX_DIR)/indirect_reqsize.c: glX_proto_size.py $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -m reqsize_c | $(INDENT) $(INDENT_FLAGS) > $@ - -$(XORG_GLX_DIR)/indirect_table.c: glX_server_table.py gl_and_glX_API.xml $(COMMON_GLX) - $(PYTHON2) $(PYTHON_FLAGS) $< -f gl_and_glX_API.xml > $@ diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am new file mode 100644 index 000000000..d0d0a7ba0 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/Makefile.am @@ -0,0 +1,240 @@ +# This file isn't used during a normal compilation since we don't want to +# require Python in order to compile Mesa. +# Instead, when the Mesa developers update/change the API interface it's +# up to him/her to re-run this makefile and check in the newly generated files. + + +TOP = ../../../.. + +MESA_DIR = $(TOP)/src/mesa +MESA_GLAPI_DIR = $(TOP)/src/mapi/glapi +MESA_MAPI_DIR = $(TOP)/src/mapi/mapi +MESA_GLX_DIR = $(TOP)/src/glx + +MESA_GLAPI_OUTPUTS = \ + $(MESA_GLAPI_DIR)/glapi_mapi_tmp.h \ + $(MESA_GLAPI_DIR)/glprocs.h \ + $(MESA_GLAPI_DIR)/glapitemp.h \ + $(MESA_GLAPI_DIR)/glapitable.h \ + $(MESA_GLAPI_DIR)/glapi_gentable.c + +MESA_GLAPI_ASM_OUTPUTS = \ + $(MESA_GLAPI_DIR)/glapi_x86.S \ + $(MESA_GLAPI_DIR)/glapi_x86-64.S \ + $(MESA_GLAPI_DIR)/glapi_sparc.S + +MESA_OUTPUTS = \ + $(MESA_GLAPI_OUTPUTS) \ + $(MESA_GLAPI_ASM_OUTPUTS) \ + $(MESA_DIR)/main/enums.c \ + $(MESA_DIR)/main/dispatch.h \ + $(MESA_DIR)/main/remap_helper.h \ + $(MESA_GLX_DIR)/indirect.c \ + $(MESA_GLX_DIR)/indirect.h \ + $(MESA_GLX_DIR)/indirect_init.c \ + $(MESA_GLX_DIR)/indirect_size.h \ + $(MESA_GLX_DIR)/indirect_size.c + +###################################################################### + +XORG_GLX_DIR = $(XORG_BASE)/glx +XORG_GLAPI_DIR = $(XORG_BASE)/glx + +XORG_GLAPI_OUTPUTS = \ + $(XORG_GLAPI_DIR)/glprocs.h \ + $(XORG_GLAPI_DIR)/glapitable.h \ + $(XORG_GLAPI_DIR)/dispatch.h \ + $(XORG_GLAPI_DIR)/glapi_gentable.c + +XORG_OUTPUTS = \ + $(XORG_GLAPI_OUTPUTS) \ + $(XORG_GLX_DIR)/indirect_dispatch.c \ + $(XORG_GLX_DIR)/indirect_dispatch_swap.c \ + $(XORG_GLX_DIR)/indirect_dispatch.h \ + $(XORG_GLX_DIR)/indirect_reqsize.c \ + $(XORG_GLX_DIR)/indirect_reqsize.h \ + $(XORG_GLX_DIR)/indirect_size.h \ + $(XORG_GLX_DIR)/indirect_size_get.c \ + $(XORG_GLX_DIR)/indirect_size_get.h \ + $(XORG_GLX_DIR)/indirect_table.c + +###################################################################### + +API_XML = \ + gl_API.xml \ + ARB_base_instance.xml \ + ARB_color_buffer_float.xml \ + ARB_copy_buffer.xml \ + ARB_debug_output.xml \ + ARB_depth_buffer_float.xml \ + ARB_depth_clamp.xml \ + ARB_draw_buffers_blend.xml \ + ARB_draw_elements_base_vertex.xml \ + ARB_draw_instanced.xml \ + ARB_ES2_compatibility.xml \ + ARB_framebuffer_object.xml \ + ARB_geometry_shader4.xml \ + ARB_instanced_arrays.xml \ + ARB_map_buffer_range.xml \ + ARB_robustness.xml \ + ARB_sampler_objects.xml \ + ARB_seamless_cube_map.xml \ + ARB_sync.xml \ + ARB_texture_buffer_object.xml \ + ARB_texture_compression_rgtc.xml \ + ARB_texture_float.xml \ + ARB_texture_rg.xml \ + ARB_texture_storage.xml \ + ARB_vertex_array_object.xml \ + AMD_draw_buffers_blend.xml \ + ARB_vertex_type_2_10_10_10_rev.xml \ + APPLE_object_purgeable.xml \ + APPLE_vertex_array_object.xml \ + ARB_uniform_buffer_object.xml \ + EXT_draw_buffers2.xml \ + EXT_framebuffer_object.xml \ + EXT_gpu_shader4.xml \ + EXT_packed_depth_stencil.xml \ + EXT_provoking_vertex.xml \ + EXT_separate_shader_objects.xml \ + EXT_texture_array.xml \ + EXT_texture_integer.xml \ + EXT_transform_feedback.xml \ + NV_conditional_render.xml \ + NV_primitive_restart.xml \ + NV_texture_barrier.xml \ + OES_EGL_image.xml \ + GL3x.xml + + +COMMON = $(API_XML) gl_XML.py glX_XML.py license.py typeexpr.py + +COMMON_ES = \ + $(COMMON) \ + gl_and_es_API.xml \ + es_EXT.xml \ + ARB_ES2_compatibility.xml \ + ARB_get_program_binary.xml \ + OES_fixed_point.xml \ + OES_single_precision.xml + +COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py + +PYTHON_GEN = $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) + +###################################################################### + +all-local: $(MESA_OUTPUTS) + +xorg: check-xorg-source $(XORG_OUTPUTS) + +check-xorg-source: + @if ! test -d $(XORG_GLX_DIR); then \ + echo "ERROR: Must specify path to xserver/ checkout. Set XORG_BASE env var."; \ + if test x$(XORG_BASE) != x; then \ + echo "'$(XORG_GLX_DIR)' does not exist."; \ + fi; \ + exit 1; \ + fi + +clean-local: + -rm -f *~ *.pyo + -rm -f $(MESA_OUTPUTS) + +###################################################################### + +$(XORG_GLAPI_DIR)/%.c: $(MESA_GLAPI_DIR)/%.c + cp $< $@ + +$(XORG_GLAPI_DIR)/dispatch.h: $(MESA_DIR)/main/dispatch.h + cp $< $@ + +$(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h + cp $< $@ + +###################################################################### + +$(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON_ES) + $(PYTHON_GEN) $< \ + --printer glapi --mode lib gl_and_es_API.xml > $@ + +$(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON) + $(PYTHON_GEN) $< > $@ + +$(MESA_GLAPI_DIR)/glapitemp.h: gl_apitemp.py $(COMMON) + $(PYTHON_GEN) $< > $@ + +$(MESA_GLAPI_DIR)/glapitable.h: gl_table.py $(COMMON) + $(PYTHON_GEN) $< > $@ + +$(MESA_GLAPI_DIR)/glapi_gentable.c: gl_gentable.py $(COMMON) + $(PYTHON_GEN) $< > $@ + +###################################################################### + +$(MESA_GLAPI_DIR)/glapi_x86.S: gl_x86_asm.py $(COMMON) + $(PYTHON_GEN) $< > $@ + +$(MESA_GLAPI_DIR)/glapi_x86-64.S: gl_x86-64_asm.py $(COMMON) + $(PYTHON_GEN) $< > $@ + +$(MESA_GLAPI_DIR)/glapi_sparc.S: gl_SPARC_asm.py $(COMMON) + $(PYTHON_GEN) $< > $@ + +###################################################################### + +$(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON_ES) + $(PYTHON_GEN) $< -f gl_and_es_API.xml > $@ + +$(MESA_DIR)/main/dispatch.h: gl_table.py $(COMMON) + $(PYTHON_GEN) $< -m remap_table > $@ + +$(MESA_DIR)/main/remap_helper.h: remap_helper.py $(COMMON) + $(PYTHON_GEN) $< > $@ + +###################################################################### + +$(MESA_GLX_DIR)/indirect.c: glX_proto_send.py $(COMMON_GLX) + $(PYTHON_GEN) $< -m proto | $(INDENT) $(INDENT_FLAGS) > $@ + +$(MESA_GLX_DIR)/indirect.h: glX_proto_send.py $(COMMON_GLX) + $(PYTHON_GEN) $< -m init_h > $@ + +$(MESA_GLX_DIR)/indirect_init.c: glX_proto_send.py $(COMMON_GLX) + $(PYTHON_GEN) $< -m init_c > $@ + +$(MESA_GLX_DIR)/indirect_size.h $(XORG_GLX_DIR)/indirect_size.h: glX_proto_size.py $(COMMON_GLX) + $(PYTHON_GEN) $< -m size_h --only-set -h _INDIRECT_SIZE_H_ \ + | $(INDENT) $(INDENT_FLAGS) > $@ + +$(MESA_GLX_DIR)/indirect_size.c: glX_proto_size.py $(COMMON_GLX) + $(PYTHON_GEN) $< -m size_c --only-set \ + | $(INDENT) $(INDENT_FLAGS) > $@ + +###################################################################### + +$(XORG_GLX_DIR)/indirect_dispatch.c: glX_proto_recv.py $(COMMON_GLX) + $(PYTHON_GEN) $< -m dispatch_c > $@ + +$(XORG_GLX_DIR)/indirect_dispatch_swap.c: glX_proto_recv.py $(COMMON_GLX) + $(PYTHON_GEN) $< -m dispatch_c -s > $@ + +$(XORG_GLX_DIR)/indirect_dispatch.h: glX_proto_recv.py gl_and_glX_API.xml $(COMMON_GLX) + $(PYTHON_GEN) $< -m dispatch_h -f gl_and_glX_API.xml -s > $@ + +$(XORG_GLX_DIR)/indirect_size_get.h: glX_proto_size.py $(COMMON_GLX) + $(PYTHON_GEN) $< -m size_h --only-get -h '_INDIRECT_SIZE_GET_H_' \ + | $(INDENT) $(INDENT_FLAGS) > $@ + +$(XORG_GLX_DIR)/indirect_size_get.c: glX_proto_size.py $(COMMON_GLX) + $(PYTHON_GEN) $< -m size_c | $(INDENT) $(INDENT_FLAGS) > $@ + +$(XORG_GLX_DIR)/indirect_reqsize.h: glX_proto_size.py $(COMMON_GLX) + $(PYTHON_GEN) $< -m reqsize_h --only-get -h '_INDIRECT_SIZE_GET_H_' \ + | $(INDENT) $(INDENT_FLAGS) -l200 > $@ + +$(XORG_GLX_DIR)/indirect_reqsize.c: glX_proto_size.py $(COMMON_GLX) + $(PYTHON_GEN) $< -m reqsize_c | $(INDENT) $(INDENT_FLAGS) > $@ + +$(XORG_GLX_DIR)/indirect_table.c: glX_server_table.py gl_and_glX_API.xml $(COMMON_GLX) + $(PYTHON_GEN) $< -f gl_and_glX_API.xml > $@ diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml index c96b2a00f..af0513556 100644 --- a/mesalib/src/mapi/glapi/gen/gl_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_API.xml @@ -7927,7 +7927,9 @@ - + + + diff --git a/mesalib/src/mesa/.gitignore b/mesalib/src/mesa/.gitignore index ce83eaf47..5fc607b9e 100644 --- a/mesalib/src/mesa/.gitignore +++ b/mesalib/src/mesa/.gitignore @@ -1,5 +1 @@ -*/gen_matypes -*/matypes.h -depend.es* -depend.es* -objs-es* +/Makefile diff --git a/mesalib/src/mesa/Makefile b/mesalib/src/mesa/Makefile deleted file mode 100644 index b0b461fdd..000000000 --- a/mesalib/src/mesa/Makefile +++ /dev/null @@ -1,238 +0,0 @@ -# src/mesa/Makefile - -TOP = ../.. -include $(TOP)/configs/current - -MESA_LIBS := libmesa.a libmesagallium.a -DEPENDS := depend - -SRCDIR = . -include sources.mak - -# define preprocessor flags -MESA_CPPFLAGS := $(API_DEFINES) $(DEFINES) - -# append include dirs -MESA_CPPFLAGS += $(INCLUDE_DIRS) - -# tidy compiler flags -CFLAGS := $(filter-out $(DEFINES), $(CFLAGS)) -CXXFLAGS := $(filter-out $(DEFINES), $(CXXFLAGS)) - -# LLVM is needed for the state tracker -MESA_CFLAGS := $(LLVM_CFLAGS) $(CFLAGS) -MESA_CXXFLAGS := $(LLVM_CFLAGS) $(CXXFLAGS) - -%.o: %.c - $(CC) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CFLAGS) - -%.o: %.cpp - $(CXX) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CXXFLAGS) - -%.o: %.S - $(CC) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CFLAGS) - -# Default: build dependencies, then asm_subdirs, GLSL built-in lib, -# then convenience libs (.a) and finally the device drivers: -default: $(DEPENDS) asm_subdirs $(MESA_LIBS) driver_subdirs - -.PHONY: main/git_sha1.h.tmp -main/git_sha1.h.tmp: - @touch main/git_sha1.h.tmp - @if test -d ../../.git; then \ - if which git > /dev/null; then \ - git log -n 1 --oneline | \ - sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \ - > main/git_sha1.h.tmp ; \ - fi \ - fi - -main/git_sha1.h: main/git_sha1.h.tmp - @echo "updating main/git_sha1.h" - @if ! cmp -s main/git_sha1.h.tmp main/git_sha1.h; then \ - mv main/git_sha1.h.tmp main/git_sha1.h ;\ - fi - -# include glapi_gen.mk for generating glapi headers for GLES -GLAPI := $(TOP)/src/mapi/glapi/gen -include $(GLAPI)/glapi_gen.mk - -BUILT_SOURCES = \ - main/api_exec_es1_dispatch.h \ - main/api_exec_es1_remap_helper.h \ - main/api_exec_es2_dispatch.h \ - main/api_exec_es2_remap_helper.h \ - main/api_exec_es1.c \ - main/api_exec_es2.c \ - program/program_parse.tab.c \ - program/program_parse.tab.h \ - program/lex.yy.c - -main/api_exec_es1_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps) - $(call glapi_gen_dispatch,$<,es1) - -main/api_exec_es1_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps) - $(call glapi_gen_remap,$<,es1) - -main/api_exec_es1.o: main/api_exec_es1_dispatch.h main/api_exec_es1_remap_helper.h - -main/api_exec_es2_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps) - $(call glapi_gen_dispatch,$<,es2) - -main/api_exec_es2_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps) - $(call glapi_gen_remap,$<,es2) - -main/api_exec_es2.o: main/api_exec_es2_dispatch.h main/api_exec_es2_remap_helper.h - -main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py - $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@ - -main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py - $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@ - -program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y - $(BISON) -v -d --output=program/program_parse.tab.c $< - -program/lex.yy.c: program/program_lexer.l - $(FLEX) --never-interactive --outfile=$@ $< - -ifneq (,$(DRICORE_LIBS)) -DRICORE_TARGET = dricore -DRICORE_INSTALL_TARGET = install-dricore -endif - -###################################################################### -# Helper libraries used by many drivers: - -# Make archive of core mesa object files -libmesa.a: $(MESA_OBJECTS) $(GLSL_LIBS) - @ $(MKLIB) -o mesa -static $(MESA_OBJECTS) $(GLSL_LIBS) - -# Make archive of subset of core mesa object files for gallium -libmesagallium.a: $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS) - @ $(MKLIB) -o mesagallium -static $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS) - -dricore: $(BUILT_SOURCES) - @ (cd libdricore && $(MAKE)) - -###################################################################### -# Device drivers -driver_subdirs: $(MESA_LIBS) $(DRICORE_TARGET) - @ (cd drivers && $(MAKE)) - - -###################################################################### -# Assembly subdirs -asm_subdirs: - @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \ - (cd x86 && $(MAKE)) || exit 1 ; \ - fi - @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \ - (cd x86 && $(MAKE)) || exit 1 ; \ - (cd x86-64 && $(MAKE)) || exit 1 ; \ - fi - -###################################################################### -# Dependency generation - -depend: $(ALL_FILES) main/git_sha1.h - @ echo "running $(MKDEP)" - @ touch depend - @$(MKDEP) $(MKDEP_OPTIONS) $(MESA_CPPFLAGS) \ - $(ALL_FILES) > /dev/null 2>/dev/null - -###################################################################### -# Installation rules - -# this isn't fleshed out yet but is probably the way to go in the future -new_install: - (cd drivers && $(MAKE) install) - -# XXX replace this with new_install above someday -install: default $(DRICORE_INSTALL_TARGET) - @for driver in $(DRIVER_DIRS) ; do \ - case "$$driver" in \ - osmesa) if [ "$(DRIVER_DIRS)" = osmesa ]; then \ - $(MAKE) install-headers install-osmesa || exit 1 ; \ - else \ - $(MAKE) install-osmesa || exit 1 ; \ - fi ;; \ - dri) $(MAKE) install-libgl-pc install-dri || exit 1 ;; \ - *) $(MAKE) install-libgl-pc install-libgl || exit 1 ;; \ - esac ; \ - done - -pcedit = \ - -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ - -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ - -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ - -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ - - -gl_pcedit = sed \ - $(pcedit) \ - -e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \ - -e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \ - -e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' \ - -e 's,@GLX_TLS@,$(GLX_TLS),' \ - -e 's,@GL_LIB@,$(GL_LIB),' - -gl.pc: gl.pc.in - $(gl_pcedit) $< > $@ - -osmesa_pcedit = sed \ - $(pcedit) \ - -e 's,@OSMESA_LIB@,$(OSMESA_LIB),' \ - -e 's,@OSMESA_PC_REQ@,$(OSMESA_PC_REQ),' \ - -e 's,@OSMESA_PC_LIB_PRIV@,$(OSMESA_PC_LIB_PRIV),' - -osmesa.pc: osmesa.pc.in - $(osmesa_pcedit) $< > $@ - -install-headers: - $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL - $(INSTALL) -m 644 $(TOP)/include/GL/*.h \ - $(DESTDIR)$(INSTALL_INC_DIR)/GL - -install-libgl: default - $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) \ - $(DESTDIR)$(INSTALL_LIB_DIR) - -install-libgl-pc: gl.pc install-headers - $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) - $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig - $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig - -install-osmesa: default osmesa.pc - $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) - $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig - $(MINSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_GLOB) \ - $(DESTDIR)$(INSTALL_LIB_DIR) - $(INSTALL) -m 644 osmesa.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig - -install-dri: default - cd drivers/dri && $(MAKE) install - -install-dricore: default - @ (cd libdricore && $(MAKE) install) - -# Emacs tags -tags: - etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h - -clean: - -rm -f */*.o - -rm -f */*/*.o - -rm -f depend depend.bak libmesa.a libmesagallium.a - -rm -f drivers/*/*.o - -rm -f *.pc - -rm -f $(BUILT_SOURCES) - -@cd drivers/dri && $(MAKE) clean - -@cd drivers/x11 && $(MAKE) clean - -@cd drivers/osmesa && $(MAKE) clean - -@cd x86 && $(MAKE) clean - -@cd x86-64 && $(MAKE) clean - -@cd libdricore && $(MAKE) clean - - --include $(DEPENDS) diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am new file mode 100644 index 000000000..e52678d58 --- /dev/null +++ b/mesalib/src/mesa/Makefile.am @@ -0,0 +1,107 @@ +# Copyright © 2012 Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +SUBDIRS = x86 x86-64 . libdricore drivers + +gldir = $(includedir)/GL +gl_HEADERS = $(top_srcdir)/include/GL/*.h + +.PHONY: main/git_sha1.h.tmp +main/git_sha1.h.tmp: + @touch main/git_sha1.h.tmp + @if test -d ../../.git; then \ + if which git > /dev/null; then \ + git log -n 1 --oneline | \ + sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \ + > main/git_sha1.h.tmp ; \ + fi \ + fi + +main/git_sha1.h: main/git_sha1.h.tmp + @echo "updating main/git_sha1.h" + @if ! cmp -s main/git_sha1.h.tmp main/git_sha1.h; then \ + mv main/git_sha1.h.tmp main/git_sha1.h ;\ + fi + +# include glapi_gen.mk for generating glapi headers for GLES +TOP = $(top_srcdir) +GLAPI = $(TOP)/src/mapi/glapi/gen +include $(GLAPI)/glapi_gen.mk + +BUILT_SOURCES = \ + main/git_sha1.h \ + main/api_exec_es1_dispatch.h \ + main/api_exec_es1_remap_helper.h \ + main/api_exec_es2_dispatch.h \ + main/api_exec_es2_remap_helper.h \ + main/api_exec_es1.c \ + main/api_exec_es2.c \ + program/program_parse.tab.c \ + program/program_parse.tab.h \ + program/lex.yy.c +CLEANFILES = \ + $(BUILT_SOURCES) \ + git_sha1.h.tmp + +main/api_exec_es1_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps) + $(call glapi_gen_dispatch,$<,es1) + +main/api_exec_es1_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps) + $(call glapi_gen_remap,$<,es1) + +main/api_exec_es1.o: main/api_exec_es1_dispatch.h main/api_exec_es1_remap_helper.h + +main/api_exec_es2_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps) + $(call glapi_gen_dispatch,$<,es2) + +main/api_exec_es2_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps) + $(call glapi_gen_remap,$<,es2) + +main/api_exec_es2.o: main/api_exec_es2_dispatch.h main/api_exec_es2_remap_helper.h + +main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py + $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@ + +main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py + $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@ + +program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y + $(YACC) -v -d --output=program/program_parse.tab.c $< + +program/lex.yy.c: program/program_lexer.l + $(LEX) --never-interactive --outfile=$@ $< + +all-local: + $(MAKE) -f Makefile.old + +install-exec-local: + $(MAKE) -f Makefile.old install + +clean-local: + $(MAKE) -f Makefile.old clean + +pkgconfigdir = $(libdir)/pkgconfig + +if HAVE_OSMESA_DRIVER +pkgconfig_DATA = osmesa.pc +else +pkgconfig_DATA = gl.pc +endif diff --git a/mesalib/src/mesa/Makefile.old b/mesalib/src/mesa/Makefile.old new file mode 100644 index 000000000..4ea70d43d --- /dev/null +++ b/mesalib/src/mesa/Makefile.old @@ -0,0 +1,82 @@ +# src/mesa/Makefile + +TOP = ../.. +include $(TOP)/configs/current + +MESA_LIBS := libmesa.a libmesagallium.a +DEPENDS := depend + +SRCDIR = . +include sources.mak + +# define preprocessor flags +MESA_CPPFLAGS := $(API_DEFINES) $(DEFINES) + +# append include dirs +MESA_CPPFLAGS += $(INCLUDE_DIRS) + +# tidy compiler flags +CFLAGS := $(filter-out $(DEFINES), $(CFLAGS)) +CXXFLAGS := $(filter-out $(DEFINES), $(CXXFLAGS)) + +# LLVM is needed for the state tracker +MESA_CFLAGS := $(LLVM_CFLAGS) $(CFLAGS) +MESA_CXXFLAGS := $(LLVM_CFLAGS) $(CXXFLAGS) + +%.o: %.c + $(CC) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CFLAGS) + +%.o: %.cpp + $(CXX) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CXXFLAGS) + +%.o: %.S + $(CC) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CFLAGS) + +# Default: build dependencies, then asm_subdirs, GLSL built-in lib, +# then convenience libs (.a) and finally the device drivers: +default: $(DEPENDS) $(MESA_LIBS) + +###################################################################### +# Helper libraries used by many drivers: + +# Make archive of core mesa object files +libmesa.a: $(MESA_OBJECTS) $(GLSL_LIBS) + @ $(MKLIB) -o mesa -static $(MESA_OBJECTS) $(GLSL_LIBS) + +# Make archive of subset of core mesa object files for gallium +libmesagallium.a: $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS) + @ $(MKLIB) -o mesagallium -static $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS) + +###################################################################### +# Dependency generation + +depend: $(ALL_FILES) main/git_sha1.h + @ echo "running $(MKDEP)" + @ touch depend + @$(MKDEP) $(MKDEP_OPTIONS) $(MESA_CPPFLAGS) \ + $(ALL_FILES) > /dev/null 2>/dev/null + +###################################################################### +# Installation rules + +install: default $(DRICORE_INSTALL_TARGET) + @for driver in $(DRIVER_DIRS) ; do \ + case "$$driver" in \ + osmesa) $(MAKE) -f Makefile.old install-osmesa || exit 1 ;; \ + esac ; \ + done + +install-osmesa: default + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_GLOB) \ + $(DESTDIR)$(INSTALL_LIB_DIR) + +# Emacs tags +tags: + etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h + +clean: + -rm -f */*.o + -rm -f */*/*.o + -rm -f depend depend.bak libmesa.a libmesagallium.a + +-include $(DEPENDS) diff --git a/mesalib/src/mesa/drivers/.gitignore b/mesalib/src/mesa/drivers/.gitignore new file mode 100644 index 000000000..5fc607b9e --- /dev/null +++ b/mesalib/src/mesa/drivers/.gitignore @@ -0,0 +1 @@ +/Makefile diff --git a/mesalib/src/mesa/drivers/Makefile b/mesalib/src/mesa/drivers/Makefile deleted file mode 100644 index c5998413e..000000000 --- a/mesalib/src/mesa/drivers/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# src/mesa/drivers/Makefile - -TOP = ../../.. -include $(TOP)/configs/current - - -default: - @for dir in $(DRIVER_DIRS) ; do \ - if [ -d $$dir ] ; then \ - (cd $$dir && $(MAKE)) || exit 1; \ - fi \ - done - - -clean: - @for dir in $(DRIVER_DIRS) ; do \ - if [ -d $$dir ] ; then \ - (cd $$dir && $(MAKE) clean) || exit 1; \ - fi \ - done - - -install: - @for dir in $(DRIVER_DIRS) ; do \ - if [ -d $$dir ] ; then \ - (cd $$dir && $(MAKE) install) || exit 1; \ - fi \ - done - diff --git a/mesalib/src/mesa/drivers/Makefile.am b/mesalib/src/mesa/drivers/Makefile.am new file mode 100644 index 000000000..1bc74eadf --- /dev/null +++ b/mesalib/src/mesa/drivers/Makefile.am @@ -0,0 +1,22 @@ +# Copyright © 2012 Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +SUBDIRS = $(DRIVER_DIRS) diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.am b/mesalib/src/mesa/drivers/dri/common/Makefile.am index 27c3e3d42..d81bc0e3f 100644 --- a/mesalib/src/mesa/drivers/dri/common/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/common/Makefile.am @@ -25,7 +25,6 @@ AM_CFLAGS = \ -I$(top_srcdir)/src/mapi \ -I$(top_srcdir)/src/mesa/ \ $(DEFINES) \ - $(ASM_FLAGS) \ $(API_DEFINES) \ $(LIBDRM_CFLAGS) diff --git a/mesalib/src/mesa/drivers/dri/swrast/Makefile.am b/mesalib/src/mesa/drivers/dri/swrast/Makefile.am index 3dc7c1044..16a34413b 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/swrast/Makefile.am @@ -34,7 +34,6 @@ AM_CFLAGS = \ -I$(top_srcdir)/src/mesa/ \ -I$(top_srcdir)/src/mesa/drivers/dri/common \ $(DEFINES) \ - $(ASM_FLAGS) \ $(API_DEFINES) dridir = $(DRI_DRIVER_INSTALL_DIR) diff --git a/mesalib/src/mesa/gl.pc.in b/mesalib/src/mesa/gl.pc.in index 2d3bc917e..181724b97 100644 --- a/mesalib/src/mesa/gl.pc.in +++ b/mesalib/src/mesa/gl.pc.in @@ -1,12 +1,12 @@ -prefix=@INSTALL_DIR@ +prefix=@prefix@ exec_prefix=${prefix} -libdir=@INSTALL_LIB_DIR@ -includedir=@INSTALL_INC_DIR@ +libdir=@libdir@ +includedir=@includedir@ Name: gl Description: Mesa OpenGL library Requires.private: @GL_PC_REQ_PRIV@ -Version: @VERSION@ +Version: @PACKAGE_VERSION@ Libs: -L${libdir} -l@GL_LIB@ Libs.private: @GL_PC_LIB_PRIV@ Cflags: -I${includedir} @GL_PC_CFLAGS@ diff --git a/mesalib/src/mesa/main/api_exec.c b/mesalib/src/mesa/main/api_exec.c index 15b9f6974..19e7f9807 100644 --- a/mesalib/src/mesa/main/api_exec.c +++ b/mesalib/src/mesa/main/api_exec.c @@ -579,17 +579,7 @@ _mesa_create_exec_table(void) #endif /* ARB 28. GL_ARB_vertex_buffer_object */ - SET_BindBufferARB(exec, _mesa_BindBufferARB); - SET_BufferDataARB(exec, _mesa_BufferDataARB); - SET_BufferSubDataARB(exec, _mesa_BufferSubDataARB); - SET_DeleteBuffersARB(exec, _mesa_DeleteBuffersARB); - SET_GenBuffersARB(exec, _mesa_GenBuffersARB); - SET_GetBufferParameterivARB(exec, _mesa_GetBufferParameterivARB); - SET_GetBufferPointervARB(exec, _mesa_GetBufferPointervARB); - SET_GetBufferSubDataARB(exec, _mesa_GetBufferSubDataARB); - SET_IsBufferARB(exec, _mesa_IsBufferARB); - SET_MapBufferARB(exec, _mesa_MapBufferARB); - SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB); + _mesa_init_bufferobj_dispatch(exec); /* ARB 29. GL_ARB_occlusion_query */ _mesa_init_queryobj_dispatch(exec); diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index 332af3d36..5f724ace3 100644 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -43,6 +43,7 @@ #include "mtypes.h" #include "texobj.h" #include "transformfeedback.h" +#include "dispatch.h" /* Debug flags */ @@ -92,6 +93,11 @@ get_buffer_target(struct gl_context *ctx, GLenum target) return &ctx->Texture.BufferObject; } break; + case GL_UNIFORM_BUFFER: + if (ctx->Extensions.ARB_uniform_buffer_object) { + return &ctx->UniformBuffer; + } + break; default: return NULL; } @@ -598,6 +604,8 @@ _mesa_copy_buffer_subdata(struct gl_context *ctx, void _mesa_init_buffer_objects( struct gl_context *ctx ) { + GLuint i; + memset(&DummyBufferObject, 0, sizeof(DummyBufferObject)); _glthread_INIT_MUTEX(DummyBufferObject.Mutex); DummyBufferObject.RefCount = 1000*1000*1000; /* never delete */ @@ -609,16 +617,43 @@ _mesa_init_buffer_objects( struct gl_context *ctx ) ctx->Shared->NullBufferObj); _mesa_reference_buffer_object(ctx, &ctx->CopyWriteBuffer, ctx->Shared->NullBufferObj); + + ctx->UniformBufferBindings = calloc(ctx->Const.MaxUniformBufferBindings, + sizeof(*ctx->UniformBufferBindings)); + + _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, + ctx->Shared->NullBufferObj); + + for (i = 0; i < ctx->Const.MaxUniformBufferBindings; i++) { + _mesa_reference_buffer_object(ctx, + &ctx->UniformBufferBindings[i].BufferObject, + ctx->Shared->NullBufferObj); + ctx->UniformBufferBindings[i].Offset = -1; + ctx->UniformBufferBindings[i].Size = -1; + } } void _mesa_free_buffer_objects( struct gl_context *ctx ) { + GLuint i; + _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL); _mesa_reference_buffer_object(ctx, &ctx->CopyReadBuffer, NULL); _mesa_reference_buffer_object(ctx, &ctx->CopyWriteBuffer, NULL); + + _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, NULL); + + for (i = 0; i < ctx->Const.MaxUniformBufferBindings; i++) { + _mesa_reference_buffer_object(ctx, + &ctx->UniformBufferBindings[i].BufferObject, + NULL); + } + + free(ctx->UniformBufferBindings); + ctx->UniformBufferBindings = NULL; } @@ -840,6 +875,10 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) } } + if (ctx->UniformBuffer == bufObj) { + _mesa_BindBufferARB( GL_UNIFORM_BUFFER, 0 ); + } + /* unbind any pixel pack/unpack pointers bound to this buffer */ if (ctx->Pack.BufferObj == bufObj) { _mesa_BindBufferARB( GL_PIXEL_PACK_BUFFER_EXT, 0 ); @@ -1954,3 +1993,204 @@ _mesa_GetObjectParameterivAPPLE(GLenum objectType, GLuint name, GLenum pname, } #endif /* FEATURE_APPLE_object_purgeable */ + +static void +set_ubo_binding(struct gl_context *ctx, + int index, + struct gl_buffer_object *bufObj, + GLintptr offset, + GLsizeiptr size, + GLboolean autoSize) +{ + struct gl_uniform_buffer_binding *binding; + + binding = &ctx->UniformBufferBindings[index]; + if (binding->BufferObject == bufObj && + binding->Offset == offset && + binding->Size == size && + binding->AutomaticSize == autoSize) { + return; + } + + FLUSH_VERTICES(ctx, _NEW_BUFFER_OBJECT); + + _mesa_reference_buffer_object(ctx, &binding->BufferObject, bufObj); + binding->Offset = offset; + binding->Size = size; + binding->AutomaticSize = autoSize; +} + +/** + * Specify a buffer object to receive vertex shader results. Plus, + * specify the starting offset to place the results, and max size. + */ +static void +bind_buffer_range_uniform_buffer(struct gl_context *ctx, + GLuint index, + struct gl_buffer_object *bufObj, + GLintptr offset, + GLsizeiptr size) +{ + if (index >= ctx->Const.MaxUniformBufferBindings) { + _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(index=%d)", index); + return; + } + + if (offset & (ctx->Const.UniformBufferOffsetAlignment - 1)) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glBindBufferRange(offset misalgned %d/%d)", (int) offset, + ctx->Const.UniformBufferOffsetAlignment); + return; + } + + if (bufObj == ctx->Shared->NullBufferObj) { + offset = -1; + size = -1; + } + + _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, bufObj); + set_ubo_binding(ctx, index, bufObj, offset, size, GL_FALSE); +} + + +/** + * Specify a buffer object to receive vertex shader results. + * As above, but start at offset = 0. + */ +static void +bind_buffer_base_uniform_buffer(struct gl_context *ctx, + GLuint index, + struct gl_buffer_object *bufObj) +{ + if (index >= ctx->Const.MaxUniformBufferBindings) { + _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferBase(index=%d)", index); + return; + } + + _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, bufObj); + if (bufObj == ctx->Shared->NullBufferObj) + set_ubo_binding(ctx, index, bufObj, -1, -1, GL_TRUE); + else + set_ubo_binding(ctx, index, bufObj, 0, 0, GL_TRUE); +} + +void GLAPIENTRY +_mesa_BindBufferRange(GLenum target, GLuint index, + GLuint buffer, GLintptr offset, GLsizeiptr size) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_buffer_object *bufObj; + + if (buffer == 0) { + bufObj = ctx->Shared->NullBufferObj; + } else { + bufObj = _mesa_lookup_bufferobj(ctx, buffer); + } + + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindBufferRange(invalid buffer=%u)", buffer); + return; + } + + if (size <= 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)", + (int) size); + return; + } + + if (offset + size > bufObj->Size) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glBindBufferRange(offset + size %d > buffer size %d)", + (int) (offset + size), (int) (bufObj->Size)); + return; + } + + switch (target) { + case GL_TRANSFORM_FEEDBACK_BUFFER: + _mesa_bind_buffer_range_transform_feedback(ctx, index, bufObj, + offset, size); + return; + case GL_UNIFORM_BUFFER: + bind_buffer_range_uniform_buffer(ctx, index, bufObj, offset, size); + return; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferRange(target)"); + return; + } +} + +void GLAPIENTRY +_mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_buffer_object *bufObj; + + if (buffer == 0) { + bufObj = ctx->Shared->NullBufferObj; + } else { + bufObj = _mesa_lookup_bufferobj(ctx, buffer); + } + + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindBufferBase(invalid buffer=%u)", buffer); + return; + } + + /* Note that there's some oddness in the GL 3.1-GL 3.3 specifications with + * regards to BindBufferBase. It says (GL 3.1 core spec, page 63): + * + * "BindBufferBase is equivalent to calling BindBufferRange with offset + * zero and size equal to the size of buffer." + * + * but it says for glGetIntegeri_v (GL 3.1 core spec, page 230): + * + * "If the parameter (starting offset or size) was not specified when the + * buffer object was bound, zero is returned." + * + * What happens if the size of the buffer changes? Does the size of the + * buffer at the moment glBindBufferBase was called still play a role, like + * the first quote would imply, or is the size meaningless in the + * glBindBufferBase case like the second quote would suggest? The GL 4.1 + * core spec page 45 says: + * + * "It is equivalent to calling BindBufferRange with offset zero, while + * size is determined by the size of the bound buffer at the time the + * binding is used." + * + * My interpretation is that the GL 4.1 spec was a clarification of the + * behavior, not a change. In particular, this choice will only make + * rendering work in cases where it would have had undefined results. + */ + + switch (target) { + case GL_TRANSFORM_FEEDBACK_BUFFER: + _mesa_bind_buffer_base_transform_feedback(ctx, index, bufObj); + return; + case GL_UNIFORM_BUFFER: + bind_buffer_base_uniform_buffer(ctx, index, bufObj); + return; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferBase(target)"); + return; + } +} + +void +_mesa_init_bufferobj_dispatch(struct _glapi_table *disp) +{ + SET_BindBufferARB(disp, _mesa_BindBufferARB); + SET_BufferDataARB(disp, _mesa_BufferDataARB); + SET_BufferSubDataARB(disp, _mesa_BufferSubDataARB); + SET_DeleteBuffersARB(disp, _mesa_DeleteBuffersARB); + SET_GenBuffersARB(disp, _mesa_GenBuffersARB); + SET_GetBufferParameterivARB(disp, _mesa_GetBufferParameterivARB); + SET_GetBufferPointervARB(disp, _mesa_GetBufferPointervARB); + SET_GetBufferSubDataARB(disp, _mesa_GetBufferSubDataARB); + SET_IsBufferARB(disp, _mesa_IsBufferARB); + SET_MapBufferARB(disp, _mesa_MapBufferARB); + SET_UnmapBufferARB(disp, _mesa_UnmapBufferARB); + SET_BindBufferRangeEXT(disp, _mesa_BindBufferRange); + SET_BindBufferBaseEXT(disp, _mesa_BindBufferBase); +} diff --git a/mesalib/src/mesa/main/bufferobj.h b/mesalib/src/mesa/main/bufferobj.h index 66343c3cd..e1d0f7a97 100644 --- a/mesalib/src/mesa/main/bufferobj.h +++ b/mesalib/src/mesa/main/bufferobj.h @@ -159,4 +159,14 @@ extern void GLAPIENTRY _mesa_GetObjectParameterivAPPLE(GLenum objectType, GLuint name, GLenum pname, GLint* params); #endif +void GLAPIENTRY +_mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer); + +void GLAPIENTRY +_mesa_BindBufferRange(GLenum target, GLuint index, + GLuint buffer, GLintptr offset, GLsizeiptr size); + +extern void +_mesa_init_bufferobj_dispatch(struct _glapi_table *disp); + #endif diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index 3bcedecd9..643476b94 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -542,6 +542,9 @@ init_program_limits(GLenum type, struct gl_program_constants *prog) prog->MediumInt.RangeMax = 24; prog->MediumInt.Precision = 0; prog->LowInt = prog->HighInt = prog->MediumInt; + + prog->MaxUniformBlocks = 12; + prog->MaxCombinedUniformComponents = prog->MaxUniformComponents; } @@ -653,6 +656,12 @@ _mesa_init_constants(struct gl_context *ctx) ctx->Const.MaxTransformFeedbackSeparateComponents = 4 * MAX_FEEDBACK_ATTRIBS; ctx->Const.MaxTransformFeedbackInterleavedComponents = 4 * MAX_FEEDBACK_ATTRIBS; + /** GL_ARB_uniform_buffer_object */ + ctx->Const.MaxCombinedUniformBlocks = 36; + ctx->Const.MaxUniformBufferBindings = 36; + ctx->Const.MaxUniformBlockSize = 16384; + ctx->Const.UniformBufferOffsetAlignment = 1; + /* GL 3.2: hard-coded for now: */ ctx->Const.ProfileMask = GL_CONTEXT_COMPATIBILITY_PROFILE_BIT; diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 079316145..e4fe73307 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -141,7 +141,7 @@ static const struct extension extension_table[] = { { "GL_ARB_texture_swizzle", o(EXT_texture_swizzle), GL, 2008 }, { "GL_ARB_transform_feedback2", o(ARB_transform_feedback2), GL, 2010 }, { "GL_ARB_transpose_matrix", o(ARB_transpose_matrix), GL, 1999 }, - { "GL_ARB_uniform_buffer_object", o(ARB_uniform_buffer_object), GL, 2002 }, + { "GL_ARB_uniform_buffer_object", o(ARB_uniform_buffer_object), GL, 2009 }, { "GL_ARB_vertex_array_bgra", o(EXT_vertex_array_bgra), GL, 2008 }, { "GL_ARB_vertex_array_object", o(ARB_vertex_array_object), GL, 2006 }, { "GL_ARB_vertex_buffer_object", o(dummy_true), GL, 2003 }, diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index 8dc47306f..67732521c 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -289,6 +289,12 @@ static const int extra_ARB_sampler_objects[] = { EXTRA_END }; +static const int extra_ARB_uniform_buffer_object_and_geometry_shader[] = { + EXT(ARB_uniform_buffer_object), + EXT(ARB_geometry_shader4), + EXTRA_END +}; + EXTRA_EXT(ARB_ES2_compatibility); EXTRA_EXT(ARB_texture_cube_map); @@ -335,6 +341,7 @@ EXTRA_EXT(EXT_framebuffer_sRGB); EXTRA_EXT(ARB_texture_buffer_object); EXTRA_EXT(OES_EGL_image_external); EXTRA_EXT(ARB_blend_func_extended); +EXTRA_EXT(ARB_uniform_buffer_object); static const int extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = { @@ -1321,6 +1328,31 @@ static const struct value_desc values[] = { { GL_MAX_DUAL_SOURCE_DRAW_BUFFERS, CONTEXT_INT(Const.MaxDualSourceDrawBuffers), extra_ARB_blend_func_extended }, + /* GL_ARB_uniform_buffer_object */ + { GL_MAX_VERTEX_UNIFORM_BLOCKS, CONTEXT_INT(Const.VertexProgram.MaxUniformBlocks), + extra_ARB_uniform_buffer_object }, + { GL_MAX_FRAGMENT_UNIFORM_BLOCKS, CONTEXT_INT(Const.FragmentProgram.MaxUniformBlocks), + extra_ARB_uniform_buffer_object }, + { GL_MAX_GEOMETRY_UNIFORM_BLOCKS, CONTEXT_INT(Const.GeometryProgram.MaxUniformBlocks), + extra_ARB_uniform_buffer_object_and_geometry_shader }, + { GL_MAX_COMBINED_UNIFORM_BLOCKS, CONTEXT_INT(Const.MaxCombinedUniformBlocks), + extra_ARB_uniform_buffer_object }, + { GL_MAX_UNIFORM_BLOCK_SIZE, CONTEXT_INT(Const.MaxUniformBlockSize), + extra_ARB_uniform_buffer_object }, + { GL_MAX_UNIFORM_BUFFER_BINDINGS, CONTEXT_INT(Const.MaxUniformBufferBindings), + extra_ARB_uniform_buffer_object }, + + { GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, CONTEXT_INT(Const.VertexProgram.MaxCombinedUniformComponents), + extra_ARB_uniform_buffer_object }, + { GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, CONTEXT_INT(Const.FragmentProgram.MaxCombinedUniformComponents), + extra_ARB_uniform_buffer_object }, + { GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS, CONTEXT_INT(Const.GeometryProgram.MaxCombinedUniformComponents), + extra_ARB_uniform_buffer_object_and_geometry_shader }, + { GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, CONTEXT_INT(Const.UniformBufferOffsetAlignment), + extra_ARB_uniform_buffer_object }, + + { GL_UNIFORM_BUFFER_BINDING, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_uniform_buffer_object }, + #endif /* FEATURE_GL */ }; @@ -1771,6 +1803,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu v->value_int = samp ? samp->Name : 0; } break; + /* GL_ARB_uniform_buffer_object */ + case GL_UNIFORM_BUFFER_BINDING: + v->value_int = ctx->UniformBuffer->Name; + break; } } @@ -2530,6 +2566,30 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v) goto invalid_enum; v->value_int = ctx->TransformFeedback.CurrentObject->BufferNames[index]; return TYPE_INT; + + case GL_UNIFORM_BUFFER_BINDING: + if (index >= ctx->Const.MaxUniformBufferBindings) + goto invalid_value; + if (!ctx->Extensions.ARB_uniform_buffer_object) + goto invalid_enum; + v->value_int = ctx->UniformBufferBindings[index].BufferObject->Name; + return TYPE_INT; + + case GL_UNIFORM_BUFFER_START: + if (index >= ctx->Const.MaxUniformBufferBindings) + goto invalid_value; + if (!ctx->Extensions.ARB_uniform_buffer_object) + goto invalid_enum; + v->value_int = ctx->UniformBufferBindings[index].Offset; + return TYPE_INT; + + case GL_UNIFORM_BUFFER_SIZE: + if (index >= ctx->Const.MaxUniformBufferBindings) + goto invalid_value; + if (!ctx->Extensions.ARB_uniform_buffer_object) + goto invalid_enum; + v->value_int = ctx->UniformBufferBindings[index].Size; + return TYPE_INT; } invalid_enum: diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index d52ab151a..def0db1aa 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2709,6 +2709,9 @@ struct gl_program_constants /* ES 2.0 and GL_ARB_ES2_compatibility */ struct gl_precision LowFloat, MediumFloat, HighFloat; struct gl_precision LowInt, MediumInt, HighInt; + /* GL_ARB_uniform_buffer_object */ + GLuint MaxUniformBlocks; + GLuint MaxCombinedUniformComponents; }; @@ -2774,6 +2777,15 @@ struct gl_constants GLuint MaxVertexVaryingComponents; /**< Between vert and geom shader */ GLuint MaxGeometryVaryingComponents; /**< Between geom and frag shader */ + /** @{ + * GL_ARB_uniform_buffer_object + */ + GLuint MaxCombinedUniformBlocks; + GLuint MaxUniformBufferBindings; + GLuint MaxUniformBlockSize; + GLuint UniformBufferOffsetAlignment; + /** @} */ + /** GL_ARB_geometry_shader4 */ GLuint MaxGeometryOutputVertices; GLuint MaxGeometryTotalOutputComponents; @@ -3283,6 +3295,20 @@ struct gl_driver_flags GLbitfield NewArray; /**< Vertex array state */ }; +struct gl_uniform_buffer_binding +{ + struct gl_buffer_object *BufferObject; + /** Start of uniform block data in the buffer */ + GLintptr Offset; + /** Size of data allowed to be referenced from the buffer (in bytes) */ + GLsizeiptr Size; + /** + * glBindBufferBase() indicates that the Size should be ignored and only + * limited by the current size of the BufferObject. + */ + GLboolean AutomaticSize; +}; + /** * Mesa rendering context. * @@ -3418,6 +3444,21 @@ struct gl_context struct gl_buffer_object *CopyReadBuffer; /**< GL_ARB_copy_buffer */ struct gl_buffer_object *CopyWriteBuffer; /**< GL_ARB_copy_buffer */ + + /** + * Current GL_ARB_uniform_buffer_object binding referenced by + * GL_UNIFORM_BUFFER target for glBufferData, glMapBuffer, etc. + */ + struct gl_buffer_object *UniformBuffer; + + /** + * Array of uniform buffers for GL_ARB_uniform_buffer_object and GL 3.1. + * This is set up using glBindBufferRange() or glBindBufferBase(). They are + * associated with uniform blocks by glUniformBlockBinding()'s state in the + * shader program. + */ + struct gl_uniform_buffer_binding *UniformBufferBindings; + /*@}*/ struct gl_meta_state *Meta; /**< for "meta" operations */ diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c index 1bd76d130..84c409185 100644 --- a/mesalib/src/mesa/main/transformfeedback.c +++ b/mesalib/src/mesa/main/transformfeedback.c @@ -291,8 +291,6 @@ _mesa_init_transform_feedback_dispatch(struct _glapi_table *disp) /* EXT_transform_feedback */ SET_BeginTransformFeedbackEXT(disp, _mesa_BeginTransformFeedback); SET_EndTransformFeedbackEXT(disp, _mesa_EndTransformFeedback); - SET_BindBufferRangeEXT(disp, _mesa_BindBufferRange); - SET_BindBufferBaseEXT(disp, _mesa_BindBufferBase); SET_BindBufferOffsetEXT(disp, _mesa_BindBufferOffsetEXT); SET_TransformFeedbackVaryingsEXT(disp, _mesa_TransformFeedbackVaryings); SET_GetTransformFeedbackVaryingEXT(disp, _mesa_GetTransformFeedbackVarying); @@ -431,18 +429,14 @@ bind_buffer_range(struct gl_context *ctx, GLuint index, * Specify a buffer object to receive vertex shader results. Plus, * specify the starting offset to place the results, and max size. */ -void GLAPIENTRY -_mesa_BindBufferRange(GLenum target, GLuint index, - GLuint buffer, GLintptr offset, GLsizeiptr size) +void +_mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx, + GLuint index, + struct gl_buffer_object *bufObj, + GLintptr offset, + GLsizeiptr size) { struct gl_transform_feedback_object *obj; - struct gl_buffer_object *bufObj; - GET_CURRENT_CONTEXT(ctx); - - if (target != GL_TRANSFORM_FEEDBACK_BUFFER) { - _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferRange(target)"); - return; - } obj = ctx->TransformFeedback.CurrentObject; @@ -457,8 +451,8 @@ _mesa_BindBufferRange(GLenum target, GLuint index, return; } - if ((size <= 0) || (size & 0x3)) { - /* must be positive and multiple of four */ + if (size & 0x3) { + /* must a multiple of four */ _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)", (int) size); return; } @@ -470,25 +464,6 @@ _mesa_BindBufferRange(GLenum target, GLuint index, return; } - if (buffer == 0) { - bufObj = ctx->Shared->NullBufferObj; - } else { - bufObj = _mesa_lookup_bufferobj(ctx, buffer); - } - - if (!bufObj) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBindBufferRange(invalid buffer=%u)", buffer); - return; - } - - if (offset + size > bufObj->Size) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glBindBufferRange(offset + size %d > buffer size %d)", - (int) (offset + size), (int) (bufObj->Size)); - return; - } - bind_buffer_range(ctx, index, bufObj, offset, size); } @@ -497,18 +472,13 @@ _mesa_BindBufferRange(GLenum target, GLuint index, * Specify a buffer object to receive vertex shader results. * As above, but start at offset = 0. */ -void GLAPIENTRY -_mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer) +void +_mesa_bind_buffer_base_transform_feedback(struct gl_context *ctx, + GLuint index, + struct gl_buffer_object *bufObj) { struct gl_transform_feedback_object *obj; - struct gl_buffer_object *bufObj; GLsizeiptr size; - GET_CURRENT_CONTEXT(ctx); - - if (target != GL_TRANSFORM_FEEDBACK_BUFFER) { - _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferBase(target)"); - return; - } obj = ctx->TransformFeedback.CurrentObject; @@ -523,18 +493,6 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer) return; } - if (buffer == 0) { - bufObj = ctx->Shared->NullBufferObj; - } else { - bufObj = _mesa_lookup_bufferobj(ctx, buffer); - } - - if (!bufObj) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBindBufferBase(invalid buffer=%u)", buffer); - return; - } - /* default size is the buffer size rounded down to nearest * multiple of four. */ diff --git a/mesalib/src/mesa/main/transformfeedback.h b/mesalib/src/mesa/main/transformfeedback.h index 7d63de017..85f4cbc77 100644 --- a/mesalib/src/mesa/main/transformfeedback.h +++ b/mesalib/src/mesa/main/transformfeedback.h @@ -60,12 +60,17 @@ _mesa_BeginTransformFeedback(GLenum mode); extern void GLAPIENTRY _mesa_EndTransformFeedback(void); -extern void GLAPIENTRY -_mesa_BindBufferRange(GLenum target, GLuint index, - GLuint buffer, GLintptr offset, GLsizeiptr size); +extern void +_mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx, + GLuint index, + struct gl_buffer_object *bufObj, + GLintptr offset, + GLsizeiptr size); -extern void GLAPIENTRY -_mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer); +extern void +_mesa_bind_buffer_base_transform_feedback(struct gl_context *ctx, + GLuint index, + struct gl_buffer_object *bufObj); extern void GLAPIENTRY _mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer, diff --git a/mesalib/src/mesa/osmesa.pc.in b/mesalib/src/mesa/osmesa.pc.in index 05327f40a..307255ffc 100644 --- a/mesalib/src/mesa/osmesa.pc.in +++ b/mesalib/src/mesa/osmesa.pc.in @@ -1,12 +1,12 @@ -prefix=@INSTALL_DIR@ +prefix=@prefix@ exec_prefix=${prefix} -libdir=@INSTALL_LIB_DIR@ -includedir=@INSTALL_INC_DIR@ +libdir=@libdir@ +includedir=@includedir@ Name: osmesa Description: Mesa Off-screen Rendering library Requires: @OSMESA_PC_REQ@ -Version: @VERSION@ +Version: @PACKAGE_VERSION@ Libs: -L${libdir} -l@OSMESA_LIB@ Libs.private: @OSMESA_PC_LIB_PRIV@ Cflags: -I${includedir} diff --git a/mesalib/src/mesa/x86/.gitignore b/mesalib/src/mesa/x86/.gitignore new file mode 100644 index 000000000..ba7486c0b --- /dev/null +++ b/mesalib/src/mesa/x86/.gitignore @@ -0,0 +1,3 @@ +Makefile +gen_matypes +matypes.h diff --git a/mesalib/src/mesa/x86/Makefile b/mesalib/src/mesa/x86/Makefile deleted file mode 100644 index 9716dc27f..000000000 --- a/mesalib/src/mesa/x86/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# src/mesa/x86/Makefile - -TOP = ../../.. -include $(TOP)/configs/current - - -INCLUDE_DIRS = \ - -I$(TOP)/include/GL \ - -I$(TOP)/include \ - -I$(TOP)/src/mapi \ - -I.. \ - -I../main \ - -I../math \ - -I../tnl - - -default: gen_matypes matypes.h - -clean: - -rm -f matypes.h gen_matypes - - -gen_matypes: gen_matypes.c - $(HOST_CC) $(ARCH_FLAGS) $(INCLUDE_DIRS) $(HOST_CFLAGS) gen_matypes.c -o gen_matypes - -# need some special rules here, unfortunately -matypes.h: ../main/mtypes.h ../tnl/t_context.h gen_matypes - ./gen_matypes > matypes.h - -common_x86_asm.o: matypes.h -3dnow_normal.o: matypes.h -3dnow_xform1.o: matypes.h -3dnow_xform2.o: matypes.h -3dnow_xform3.o: matypes.h -3dnow_xform4.o: matypes.h -mmx_blend.o: matypes.h -sse_normal.o: matypes.h -sse_xform1.o: matypes.h -sse_xform2.o: matypes.h -sse_xform3.o: matypes.h -sse_xform4.o: matypes.h -x86_cliptest.o: matypes.h -x86_xform2.o: matypes.h -x86_xform3.o: matypes.h -x86_xform4.o: matypes.h - diff --git a/mesalib/src/mesa/x86/Makefile.am b/mesalib/src/mesa/x86/Makefile.am new file mode 100644 index 000000000..f241de505 --- /dev/null +++ b/mesalib/src/mesa/x86/Makefile.am @@ -0,0 +1,39 @@ +# Copyright © 2012 Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +if HAVE_X86_ASM + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src/mesa \ + -I$(top_srcdir)/src/mapi \ + $(API_DEFINES) \ + $(DEFINES) + +noinst_PROGRAMS = gen_matypes + +gen_matypes_SOURCES = gen_matypes.c +BUILT_SOURCES = matypes.h +CLEANFILES = matypes.h + +matypes.h: gen_matypes + $(AM_V_GEN)./gen_matypes > $@ + +endif -- cgit v1.2.3