Merge git://proxy01.pd.intel.com:9419/git/mesa/mesa into crestline

This commit is contained in:
Nian Wu 2007-02-25 09:40:28 -08:00
commit 675f7f627b
335 changed files with 12578 additions and 25966 deletions

16
configs/linux-dri-debug Normal file
View file

@ -0,0 +1,16 @@
# -*-makefile-*-
# Configuration for linux-dri-debug: Linux DRI hardware drivers for XFree86 & others
include $(TOP)/configs/linux-dri
CONFIG_NAME = linux-dri-debug
OPT_FLAGS = -O0 -g
ARCH_FLAGS = -DDEBUG
# Helpful to reduce the amount of stuff that gets built sometimes:
#DRI_DIRS = i915tex i915
#DRI_DIRS = i965
#DRI_DIRS = radeon r200 r300
#DRI_DIRS = unichrome sis trident
#DRI_DIRS = i810 mga r128 tdfx

View file

@ -32,10 +32,16 @@ Not for beginners.
<li><a href="http://lists.freedesktop.org/mailman/listinfo/mesa-commit"
target="_parent">mesa-commit</a> - relays git check-in messages
(for developers).
<br>
Note: the old mesa3d-cvs list is no longer in use.
</li>
</ul>
<p>Note: the old mesa3d-cvs list is no longer in use.</p>
<p>
<b>Notice</b>: non-member posts to any of these lists will be automatically
rejected.
</p>
<br>

View file

@ -24,6 +24,8 @@ TBD
<h2>New features</h2>
<ul>
<li>Updated glext.h file (version 39)
<li>Updated glxext.h file (version 18)
</ul>
<h2>Bug fixes</h2>

View file

@ -9,7 +9,7 @@ all: full subset
FULL = \
main.doxy \
math.doxy \
array_cache.doxy \
vbo.doxy \
glapi.doxy \
shader.doxy \
swrast.doxy \

View file

@ -23,7 +23,7 @@ PROJECT_NAME = Mesa
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 6.2
PROJECT_NUMBER = 6.5
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.

View file

@ -1,5 +1,5 @@
doxygen tnl_dd.doxy
doxygen array_cache.doxy
doxygen vbo.doxy
doxygen math.doxy
doxygen swrast.doxy
doxygen swrast_setup.doxy
@ -10,7 +10,7 @@ doxygen shader.doxy
echo Building again, to resolve tags
doxygen tnl_dd.doxy
doxygen array_cache.doxy
doxygen vbo.doxy
doxygen math.doxy
doxygen swrast.doxy
doxygen swrast_setup.doxy

View file

@ -45,5 +45,5 @@ TAGFILES = main.tag=../core \
swrast.tag=../swrast \
swrast_setup.tag=../swrast_setup \
tnl.tag=../tnl \
array_cache.tag=array_cache
vbo.tag=vbo
GENERATE_TAGFILE = swrast.tag

View file

@ -7,7 +7,7 @@
<div class="qindex">
<a class="qindex" href="../main/index.html">core</a> |
<a class="qindex" href="../glapi/index.html">glapi</a> |
<a class="qindex" href="../array_cache/index.html">array_cache</a> |
<a class="qindex" href="../vbo/index.html">vbo</a> |
<a class="qindex" href="../math/index.html">math</a> |
<a class="qindex" href="../shader/index.html">shader</a> |
<a class="qindex" href="../swrast/index.html">swrast</a> |

View file

@ -40,7 +40,7 @@ SKIP_FUNCTION_MACROS = YES
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES = tnl_dd.tag=../tnl_dd \
array_cache.tag=../array_cache \
vbo.tag=../vbo \
glapi.tag=../glapi \
math.tag=../math \
shader.tag=../shader \

View file

@ -45,5 +45,5 @@ TAGFILES = tnl_dd.tag=../tnl_dd \
swrast.tag=../swrast \
swrast_setup.tag=../swrast_setup \
tnl.tag=../tnl \
array_cache.tag=../array_cache
vbo.tag=../vbo
GENERATE_TAGFILE = math.tag

View file

@ -45,5 +45,5 @@ TAGFILES = main.tag=../core \
swrast.tag=../swrast \
swrast_setup.tag=../swrast_setup \
tnl.tag=../tnl \
array_cache.tag=array_cache
vbo.tag=vbo
GENERATE_TAGFILE = swrast.tag

View file

@ -44,5 +44,5 @@ TAGFILES = main.tag=../core \
tnl_dd.tag=../tnl_dd \
swrast_setup.tag=../swrast_setup \
tnl.tag=../tnl \
array_cache.tag=array_cache
vbo.tag=vbo
GENERATE_TAGFILE = swrast.tag

View file

@ -45,5 +45,5 @@ TAGFILES = tnl_dd.tag=../tnl_dd \
math.tag=../math \
swrast.tag=../swrast \
tnl.tag=../tnl \
array_cache.tag=../array_cache
vbo.tag=../vbo
GENERATE_TAGFILE = swrast_setup.tag

View file

@ -46,5 +46,5 @@ TAGFILES = tnl_dd.tag=../tnl \
shader.tag=../shader \
swrast.tag=../swrast \
swrast_setup.tag=swrast_setup \
array_cache.tag=array_cache
vbo.tag=vbo
GENERATE_TAGFILE = tnl.tag

View file

@ -45,5 +45,5 @@ TAGFILES = main.tag=../core \
swrast.tag=../swrast \
swrast_setup.tag=../swrast_setup \
tnl.tag=../tnl \
array_cache.tag=array_cache
vbo.tag=vbo
GENERATE_TAGFILE = tnl_dd.tag

View file

@ -5,11 +5,11 @@
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "Mesa array_cache"
PROJECT_NAME = "Mesa vbo"
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../src/mesa/array_cache/
INPUT = ../src/mesa/vbo/
FILE_PATTERNS = *.c \
*.h
RECURSIVE = NO
@ -24,7 +24,7 @@ FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
HTML_OUTPUT = array_cache
HTML_OUTPUT = vbo
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
@ -47,4 +47,4 @@ TAGFILES = main.tag=../core \
swrast_setup.tag=../swrast_setup \
tnl.tag=../tnl \
tnl_dd.tag=../tnl_dd
GENERATE_TAGFILE = array_cache.tag
GENERATE_TAGFILE = vbo.tag

View file

@ -52,9 +52,9 @@ extern "C" {
/*************************************************************/
/* Header file version number, required by OpenGL ABI for Linux */
/* glext.h last updated 2006/08/30 */
/* glext.h last updated 2007/02/12 */
/* Current version at http://www.opengl.org/registry/ */
#define GL_GLEXT_VERSION 34
#define GL_GLEXT_VERSION 39
#ifndef GL_VERSION_1_2
#define GL_UNSIGNED_BYTE_3_3_2 0x8032
@ -3019,7 +3019,6 @@ extern "C" {
#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
@ -3104,6 +3103,8 @@ extern "C" {
#ifndef GL_EXT_framebuffer_multisample
#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
#define GL_MAX_SAMPLES_EXT 0x8D57
#endif
#ifndef GL_MESAX_texture_stack
@ -3122,6 +3123,268 @@ extern "C" {
#ifndef GL_EXT_gpu_program_parameters
#endif
#ifndef GL_APPLE_flush_buffer_range
#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12
#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13
#endif
#ifndef GL_NV_gpu_program4
#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904
#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905
#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906
#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907
#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908
#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909
#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5
#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6
#endif
#ifndef GL_NV_geometry_program4
#define GL_LINES_ADJACENCY_EXT 0x000A
#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B
#define GL_TRIANGLES_ADJACENCY_EXT 0x000C
#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D
#define GL_GEOMETRY_PROGRAM_NV 0x8C26
#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27
#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28
#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA
#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB
#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC
#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29
#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7
#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8
#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
#define GL_PROGRAM_POINT_SIZE_EXT 0x8642
#endif
#ifndef GL_EXT_geometry_shader4
#define GL_GEOMETRY_SHADER_EXT 0x8DD9
/* reuse GL_GEOMETRY_VERTICES_OUT_EXT */
/* reuse GL_GEOMETRY_INPUT_TYPE_EXT */
/* reuse GL_GEOMETRY_OUTPUT_TYPE_EXT */
/* reuse GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT */
#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD
#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE
#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B
#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF
#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0
#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1
/* reuse GL_LINES_ADJACENCY_EXT */
/* reuse GL_LINE_STRIP_ADJACENCY_EXT */
/* reuse GL_TRIANGLES_ADJACENCY_EXT */
/* reuse GL_TRIANGLE_STRIP_ADJACENCY_EXT */
/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT */
/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT */
/* reuse GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT */
/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
/* reuse GL_PROGRAM_POINT_SIZE_EXT */
#endif
#ifndef GL_NV_vertex_program4
#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD
#endif
#ifndef GL_EXT_gpu_shader4
#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0
#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1
#define GL_SAMPLER_BUFFER_EXT 0x8DC2
#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3
#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4
#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5
#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6
#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7
#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8
#define GL_INT_SAMPLER_1D_EXT 0x8DC9
#define GL_INT_SAMPLER_2D_EXT 0x8DCA
#define GL_INT_SAMPLER_3D_EXT 0x8DCB
#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC
#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD
#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE
#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF
#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0
#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1
#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2
#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3
#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4
#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5
#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6
#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7
#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8
#endif
#ifndef GL_EXT_draw_instanced
#endif
#ifndef GL_EXT_packed_float
#define GL_R11F_G11F_B10F_EXT 0x8C3A
#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B
#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C
#endif
#ifndef GL_EXT_texture_array
#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18
#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19
#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A
#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B
#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C
#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D
#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF
#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E
/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
#endif
#ifndef GL_EXT_texture_buffer_object
#define GL_TEXTURE_BUFFER_EXT 0x8C2A
#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B
#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C
#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D
#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E
#endif
#ifndef GL_EXT_texture_compression_latc
#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71
#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73
#endif
#ifndef GL_EXT_texture_compression_rgtc
#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB
#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC
#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD
#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE
#endif
#ifndef GL_EXT_texture_shared_exponent
#define GL_RGB9_E5_EXT 0x8C3D
#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E
#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F
#endif
#ifndef GL_NV_depth_buffer_float
#define GL_DEPTH_COMPONENT32F_NV 0x8DAB
#define GL_DEPTH32F_STENCIL8_NV 0x8DAC
#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD
#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF
#endif
#ifndef GL_NV_fragment_program4
#endif
#ifndef GL_NV_framebuffer_multisample_coverage
#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB
#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10
#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11
#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12
#endif
#ifndef GL_EXT_framebuffer_sRGB
#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA
#endif
#ifndef GL_NV_geometry_shader4
#endif
#ifndef GL_NV_parameter_buffer_object
#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0
#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1
#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2
#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3
#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4
#endif
#ifndef GL_EXT_draw_buffers2
#endif
#ifndef GL_NV_transform_feedback
#define GL_BACK_PRIMARY_COLOR_NV 0x8C77
#define GL_BACK_SECONDARY_COLOR_NV 0x8C78
#define GL_TEXTURE_COORD_NV 0x8C79
#define GL_CLIP_DISTANCE_NV 0x8C7A
#define GL_VERTEX_ID_NV 0x8C7B
#define GL_PRIMITIVE_ID_NV 0x8C7C
#define GL_GENERIC_ATTRIB_NV 0x8C7D
#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E
#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F
#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80
#define GL_ACTIVE_VARYINGS_NV 0x8C81
#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82
#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83
#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84
#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85
#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86
#define GL_PRIMITIVES_GENERATED_NV 0x8C87
#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88
#define GL_RASTERIZER_DISCARD_NV 0x8C89
#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV 0x8C8A
#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B
#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C
#define GL_SEPARATE_ATTRIBS_NV 0x8C8D
#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E
#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F
#endif
#ifndef GL_EXT_bindable_uniform
#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2
#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3
#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4
#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED
#define GL_UNIFORM_BUFFER_EXT 0x8DEE
#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF
#endif
#ifndef GL_EXT_texture_integer
#define GL_RGBA32UI_EXT 0x8D70
#define GL_RGB32UI_EXT 0x8D71
#define GL_ALPHA32UI_EXT 0x8D72
#define GL_INTENSITY32UI_EXT 0x8D73
#define GL_LUMINANCE32UI_EXT 0x8D74
#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75
#define GL_RGBA16UI_EXT 0x8D76
#define GL_RGB16UI_EXT 0x8D77
#define GL_ALPHA16UI_EXT 0x8D78
#define GL_INTENSITY16UI_EXT 0x8D79
#define GL_LUMINANCE16UI_EXT 0x8D7A
#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B
#define GL_RGBA8UI_EXT 0x8D7C
#define GL_RGB8UI_EXT 0x8D7D
#define GL_ALPHA8UI_EXT 0x8D7E
#define GL_INTENSITY8UI_EXT 0x8D7F
#define GL_LUMINANCE8UI_EXT 0x8D80
#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81
#define GL_RGBA32I_EXT 0x8D82
#define GL_RGB32I_EXT 0x8D83
#define GL_ALPHA32I_EXT 0x8D84
#define GL_INTENSITY32I_EXT 0x8D85
#define GL_LUMINANCE32I_EXT 0x8D86
#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87
#define GL_RGBA16I_EXT 0x8D88
#define GL_RGB16I_EXT 0x8D89
#define GL_ALPHA16I_EXT 0x8D8A
#define GL_INTENSITY16I_EXT 0x8D8B
#define GL_LUMINANCE16I_EXT 0x8D8C
#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D
#define GL_RGBA8I_EXT 0x8D8E
#define GL_RGB8I_EXT 0x8D8F
#define GL_ALPHA8I_EXT 0x8D90
#define GL_INTENSITY8I_EXT 0x8D91
#define GL_LUMINANCE8I_EXT 0x8D92
#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93
#define GL_RED_INTEGER_EXT 0x8D94
#define GL_GREEN_INTEGER_EXT 0x8D95
#define GL_BLUE_INTEGER_EXT 0x8D96
#define GL_ALPHA_INTEGER_EXT 0x8D97
#define GL_RGB_INTEGER_EXT 0x8D98
#define GL_RGBA_INTEGER_EXT 0x8D99
#define GL_BGR_INTEGER_EXT 0x8D9A
#define GL_BGRA_INTEGER_EXT 0x8D9B
#define GL_LUMINANCE_INTEGER_EXT 0x8D9C
#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D
#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E
#endif
/*************************************************************/
@ -3162,7 +3425,7 @@ typedef unsigned short GLhalfNV;
/* This code block is duplicated in glext.h, so must be protected */
#define GLEXT_64_TYPES_DEFINED
/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
/* (as used in the GLX_OML_sync_control extension). */
/* (as used in the GL_EXT_timer_query extension). */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#include <inttypes.h>
#elif defined(__sun__)
@ -3184,12 +3447,12 @@ typedef unsigned long long int uint64_t;
typedef long int int32_t;
typedef long long int int64_t;
typedef unsigned long long int uint64_t;
#elif defined(WIN32) && defined(_MSC_VER)
typedef long int int32_t;
#elif defined(_WIN32) && defined(__GNUC__)
#include <stdint.h>
#elif defined(_WIN32)
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#elif defined(WIN32) && defined(__GNUC__)
#include <stdint.h>
#else
#include <inttypes.h> /* Fallback option */
#endif
@ -6687,6 +6950,314 @@ typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLu
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
#endif
#ifndef GL_APPLE_flush_buffer_range
#define GL_APPLE_flush_buffer_range 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glBufferParameteriAPPLE (GLenum, GLenum, GLint);
GLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum, GLintptr, GLsizeiptr);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param);
typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size);
#endif
#ifndef GL_NV_gpu_program4
#define GL_NV_gpu_program4 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum, GLuint, GLint, GLint, GLint, GLint);
GLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum, GLuint, const GLint *);
GLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum, GLuint, GLsizei, const GLint *);
GLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint);
GLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum, GLuint, const GLuint *);
GLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum, GLuint, GLsizei, const GLuint *);
GLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum, GLuint, GLint, GLint, GLint, GLint);
GLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum, GLuint, const GLint *);
GLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum, GLuint, GLsizei, const GLint *);
GLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint);
GLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum, GLuint, const GLuint *);
GLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum, GLuint, GLsizei, const GLuint *);
GLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum, GLuint, GLint *);
GLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum, GLuint, GLuint *);
GLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum, GLuint, GLint *);
GLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum, GLuint, GLuint *);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);
typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);
typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);
typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);
typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);
typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params);
typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params);
typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params);
typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params);
#endif
#ifndef GL_NV_geometry_program4
#define GL_NV_geometry_program4 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glProgramVertexLimitNV (GLenum, GLint);
GLAPI void APIENTRY glFramebufferTextureEXT (GLenum, GLenum, GLuint, GLint);
GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum, GLenum, GLuint, GLint, GLint);
GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum, GLenum, GLuint, GLint, GLenum);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit);
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
#endif
#ifndef GL_EXT_geometry_shader4
#define GL_EXT_geometry_shader4 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glProgramParameteriEXT (GLuint, GLenum, GLint);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
#endif
#ifndef GL_NV_vertex_program4
#define GL_NV_vertex_program4 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint, GLint);
GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint, GLint, GLint);
GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint, GLint, GLint, GLint);
GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint, GLint, GLint, GLint, GLint);
GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint, GLuint);
GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint, GLuint, GLuint);
GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint, GLuint, GLuint, GLuint);
GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint, GLuint, GLuint, GLuint, GLuint);
GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint, const GLint *);
GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint, const GLint *);
GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint, const GLint *);
GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint, const GLint *);
GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint, const GLuint *);
GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint, const GLuint *);
GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint, const GLuint *);
GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint, const GLuint *);
GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint, const GLbyte *);
GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint, const GLshort *);
GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint, const GLubyte *);
GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint, const GLushort *);
GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint, GLint, GLenum, GLsizei, const GLvoid *);
GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint, GLenum, GLint *);
GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint, GLenum, GLuint *);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params);
#endif
#ifndef GL_EXT_gpu_shader4
#define GL_EXT_gpu_shader4 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glGetUniformuivEXT (GLuint, GLint, GLuint *);
GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint, GLuint, const GLchar *);
GLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint, const GLchar *);
GLAPI void APIENTRY glUniform1uiEXT (GLint, GLuint);
GLAPI void APIENTRY glUniform2uiEXT (GLint, GLuint, GLuint);
GLAPI void APIENTRY glUniform3uiEXT (GLint, GLuint, GLuint, GLuint);
GLAPI void APIENTRY glUniform4uiEXT (GLint, GLuint, GLuint, GLuint, GLuint);
GLAPI void APIENTRY glUniform1uivEXT (GLint, GLsizei, const GLuint *);
GLAPI void APIENTRY glUniform2uivEXT (GLint, GLsizei, const GLuint *);
GLAPI void APIENTRY glUniform3uivEXT (GLint, GLsizei, const GLuint *);
GLAPI void APIENTRY glUniform4uivEXT (GLint, GLsizei, const GLuint *);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params);
typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name);
typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name);
typedef void (APIENTRYP PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0);
typedef void (APIENTRYP PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1);
typedef void (APIENTRYP PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
typedef void (APIENTRYP PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
#endif
#ifndef GL_EXT_draw_instanced
#define GL_EXT_draw_instanced 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum, GLint, GLsizei, GLsizei);
GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
#endif
#ifndef GL_EXT_packed_float
#define GL_EXT_packed_float 1
#endif
#ifndef GL_EXT_texture_array
#define GL_EXT_texture_array 1
#endif
#ifndef GL_EXT_texture_buffer_object
#define GL_EXT_texture_buffer_object 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glTexBufferEXT (GLenum, GLenum, GLuint);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);
#endif
#ifndef GL_EXT_texture_compression_latc
#define GL_EXT_texture_compression_latc 1
#endif
#ifndef GL_EXT_texture_compression_rgtc
#define GL_EXT_texture_compression_rgtc 1
#endif
#ifndef GL_EXT_texture_shared_exponent
#define GL_EXT_texture_shared_exponent 1
#endif
#ifndef GL_NV_depth_buffer_float
#define GL_NV_depth_buffer_float 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glDepthRangedNV (GLdouble, GLdouble);
GLAPI void APIENTRY glClearDepthdNV (GLdouble);
GLAPI void APIENTRY glDepthBoundsdNV (GLdouble, GLdouble);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar);
typedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth);
typedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax);
#endif
#ifndef GL_NV_fragment_program4
#define GL_NV_fragment_program4 1
#endif
#ifndef GL_NV_framebuffer_multisample_coverage
#define GL_NV_framebuffer_multisample_coverage 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
#endif
#ifndef GL_EXT_framebuffer_sRGB
#define GL_EXT_framebuffer_sRGB 1
#endif
#ifndef GL_NV_geometry_shader4
#define GL_NV_geometry_shader4 1
#endif
#ifndef GL_NV_parameter_buffer_object
#define GL_NV_parameter_buffer_object 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum, GLuint, GLuint, GLsizei, const GLfloat *);
GLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum, GLuint, GLuint, GLsizei, const GLint *);
GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum, GLuint, GLuint, GLsizei, const GLuint *);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params);
typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params);
typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params);
#endif
#ifndef GL_EXT_draw_buffers2
#define GL_EXT_draw_buffers2 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glColorMaskIndexedEXT (GLuint, GLboolean, GLboolean, GLboolean, GLboolean);
GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum, GLuint, GLboolean *);
GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum, GLuint, GLint *);
GLAPI void APIENTRY glEnableIndexedEXT (GLenum, GLuint);
GLAPI void APIENTRY glDisableIndexedEXT (GLenum, GLuint);
GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum, GLuint);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
typedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data);
typedef void (APIENTRYP PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLint *data);
typedef void (APIENTRYP PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index);
typedef void (APIENTRYP PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index);
typedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index);
#endif
#ifndef GL_NV_transform_feedback
#define GL_NV_transform_feedback 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum);
GLAPI void APIENTRY glEndTransformFeedbackNV (void);
GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint, const GLint *, GLenum);
GLAPI void APIENTRY glBindBufferRangeNV (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr);
GLAPI void APIENTRY glBindBufferOffsetNV (GLenum, GLuint, GLuint, GLintptr);
GLAPI void APIENTRY glBindBufferBaseNV (GLenum, GLuint, GLuint);
GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint, GLsizei, const GLint *, GLenum);
GLAPI void APIENTRY glActiveVaryingNV (GLuint, const GLchar *);
GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint, const GLchar *);
GLAPI void APIENTRY glGetActiveVaryingNV (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);
GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint, GLuint, GLint *);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode);
typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void);
typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode);
typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer);
typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);
typedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name);
typedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name);
typedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location);
#endif
#ifndef GL_EXT_bindable_uniform
#define GL_EXT_bindable_uniform 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glUniformBufferEXT (GLuint, GLint, GLuint);
GLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint, GLint);
GLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint, GLint);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer);
typedef GLint (APIENTRYP PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location);
typedef GLintptr (APIENTRYP PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location);
#endif
#ifndef GL_EXT_texture_integer
#define GL_EXT_texture_integer 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glTexParameterIivEXT (GLenum, GLenum, const GLint *);
GLAPI void APIENTRY glTexParameterIuivEXT (GLenum, GLenum, const GLuint *);
GLAPI void APIENTRY glGetTexParameterIivEXT (GLenum, GLenum, GLint *);
GLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum, GLenum, GLuint *);
GLAPI void APIENTRY glClearColorIiEXT (GLint, GLint, GLint, GLint);
GLAPI void APIENTRY glClearColorIuiEXT (GLuint, GLuint, GLuint, GLuint);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);
typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);
typedef void (APIENTRYP PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha);
typedef void (APIENTRYP PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha);
#endif
#ifdef __cplusplus
}

View file

@ -52,9 +52,9 @@ extern "C" {
/*************************************************************/
/* Header file version number, required by OpenGL ABI for Linux */
/* glxext.h last updated 2006/08/30 */
/* glxext.h last updated 2007/02/13 */
/* Current version at http://www.opengl.org/registry/ */
#define GLX_GLXEXT_VERSION 14
#define GLX_GLXEXT_VERSION 18
#ifndef GLX_VERSION_1_3
#define GLX_WINDOW_BIT 0x00000001
@ -307,6 +307,51 @@ extern "C" {
#ifndef GLX_MESA_agp_offset
#endif
#ifndef GLX_EXT_fbconfig_packed_float
#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1
#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008
#endif
#ifndef GLX_EXT_framebuffer_sRGB
#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2
#endif
#ifndef GLX_EXT_texture_from_pixmap
#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
#define GLX_Y_INVERTED_EXT 0x20D4
#define GLX_TEXTURE_FORMAT_EXT 0x20D5
#define GLX_TEXTURE_TARGET_EXT 0x20D6
#define GLX_MIPMAP_TEXTURE_EXT 0x20D7
#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8
#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9
#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA
#define GLX_TEXTURE_1D_EXT 0x20DB
#define GLX_TEXTURE_2D_EXT 0x20DC
#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD
#define GLX_FRONT_LEFT_EXT 0x20DE
#define GLX_FRONT_RIGHT_EXT 0x20DF
#define GLX_BACK_LEFT_EXT 0x20E0
#define GLX_BACK_RIGHT_EXT 0x20E1
#define GLX_FRONT_EXT GLX_FRONT_LEFT_EXT
#define GLX_BACK_EXT GLX_BACK_LEFT_EXT
#define GLX_AUX0_EXT 0x20E2
#define GLX_AUX1_EXT 0x20E3
#define GLX_AUX2_EXT 0x20E4
#define GLX_AUX3_EXT 0x20E5
#define GLX_AUX4_EXT 0x20E6
#define GLX_AUX5_EXT 0x20E7
#define GLX_AUX6_EXT 0x20E8
#define GLX_AUX7_EXT 0x20E9
#define GLX_AUX8_EXT 0x20EA
#define GLX_AUX9_EXT 0x20EB
#endif
/*************************************************************/
@ -366,8 +411,12 @@ typedef unsigned long long int uint64_t;
typedef long int int32_t;
typedef long long int int64_t;
typedef unsigned long long int uint64_t;
#elif defined(WIN32) && defined(__GNUC__)
#elif defined(_WIN32) && defined(__GNUC__)
#include <stdint.h>
#elif defined(_WIN32)
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <inttypes.h> /* Fallback option */
#endif
@ -716,6 +765,24 @@ extern unsigned int glXGetAGPOffsetMESA (const void *);
typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer);
#endif
#ifndef GLX_EXT_fbconfig_packed_float
#define GLX_EXT_fbconfig_packed_float 1
#endif
#ifndef GLX_EXT_framebuffer_sRGB
#define GLX_EXT_framebuffer_sRGB 1
#endif
#ifndef GLX_EXT_texture_from_pixmap
#define GLX_EXT_texture_from_pixmap 1
#ifdef GLX_GLXEXT_PROTOTYPES
extern void glXBindTexImageEXT (Display *, GLXDrawable, int, const int *);
extern void glXReleaseTexImageEXT (Display *, GLXDrawable, int);
#endif /* GLX_GLXEXT_PROTOTYPES */
typedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer);
#endif
#ifdef __cplusplus
}

View file

@ -189,259 +189,6 @@ typedef struct __GLcontextModesRec {
/************************************************************************/
/*
** Structure used for allocating and freeing drawable private memory.
** (like software buffers, for example).
**
** The memory allocation routines are provided by the surrounding
** "operating system" code, and they are to be used for allocating
** software buffers and things which are associated with the drawable,
** and used by any context which draws to that drawable. There are
** separate memory allocation functions for drawables and contexts
** since drawables and contexts can be created and destroyed independently
** of one another, and the "operating system" may want to use separate
** allocation arenas for each.
**
** The freePrivate function is filled in by the core routines when they
** allocates software buffers, and stick them in "private". The freePrivate
** function will destroy anything allocated to this drawable (to be called
** when the drawable is destroyed).
*/
typedef struct __GLdrawableRegionRec __GLdrawableRegion;
typedef struct __GLdrawableBufferRec __GLdrawableBuffer;
typedef struct __GLdrawablePrivateRec __GLdrawablePrivate;
typedef struct __GLregionRectRec {
/* lower left (inside the rectangle) */
GLint x0, y0;
/* upper right (outside the rectangle) */
GLint x1, y1;
} __GLregionRect;
struct __GLdrawableRegionRec {
GLint numRects;
__GLregionRect *rects;
__GLregionRect boundingRect;
};
/************************************************************************/
/* masks for the buffers */
#define __GL_FRONT_BUFFER_MASK 0x00000001
#define __GL_FRONT_LEFT_BUFFER_MASK 0x00000001
#define __GL_FRONT_RIGHT_BUFFER_MASK 0x00000002
#define __GL_BACK_BUFFER_MASK 0x00000004
#define __GL_BACK_LEFT_BUFFER_MASK 0x00000004
#define __GL_BACK_RIGHT_BUFFER_MASK 0x00000008
#define __GL_ACCUM_BUFFER_MASK 0x00000010
#define __GL_DEPTH_BUFFER_MASK 0x00000020
#define __GL_STENCIL_BUFFER_MASK 0x00000040
#define __GL_AUX_BUFFER_MASK(i) (0x0000080 << (i))
#define __GL_ALL_BUFFER_MASK 0xffffffff
/* what Resize routines return if resize resorted to fallback case */
#define __GL_BUFFER_FALLBACK 0x10
typedef void (*__GLbufFallbackInitFn)(__GLdrawableBuffer *buf,
__GLdrawablePrivate *glPriv, GLint bits);
typedef void (*__GLbufMainInitFn)(__GLdrawableBuffer *buf,
__GLdrawablePrivate *glPriv, GLint bits,
__GLbufFallbackInitFn back);
/*
** A drawable buffer
**
** This data structure describes the context side of a drawable.
**
** According to the spec there could be multiple contexts bound to the same
** drawable at the same time (from different threads). In order to avoid
** multiple-access conflicts, locks are used to serialize access. When a
** thread needs to access (read or write) a member of the drawable, it takes
** a lock first. Some of the entries in the drawable are treated "mostly
** constant", so we take the freedom of allowing access to them without
** taking a lock (for optimization reasons).
**
** For more details regarding locking, see buffers.h in the GL core
*/
struct __GLdrawableBufferRec {
/*
** Buffer dimensions
*/
GLint width, height, depth;
/*
** Framebuffer base address
*/
void *base;
/*
** Framebuffer size (in bytes)
*/
GLuint size;
/*
** Size (in bytes) of each element in the framebuffer
*/
GLuint elementSize;
GLuint elementSizeLog2;
/*
** Element skip from one scanline to the next.
** If the buffer is part of another buffer (for example, fullscreen
** front buffer), outerWidth is the width of that buffer.
*/
GLint outerWidth;
/*
** outerWidth * elementSize
*/
GLint byteWidth;
/*
** Allocation/deallocation is done based on this handle. A handle
** is conceptually different from the framebuffer 'base'.
*/
void *handle;
/* imported */
GLboolean (*resize)(__GLdrawableBuffer *buf,
GLint x, GLint y, GLuint width, GLuint height,
__GLdrawablePrivate *glPriv, GLuint bufferMask);
void (*lock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv);
void (*unlock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv);
void (*fill)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv,
GLuint val, GLint x, GLint y, GLint w, GLint h);
void (*free)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv);
/* exported */
void (*freePrivate)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv);
#ifdef __cplusplus
void *privatePtr;
#else
void *private;
#endif
/* private */
void *other; /* implementation private data */
__GLbufMainInitFn mainInit;
__GLbufFallbackInitFn fallbackInit;
};
/*
** The context side of the drawable private
*/
struct __GLdrawablePrivateRec {
/*
** Drawable Modes
*/
__GLcontextModes *modes;
/*
** Drawable size
*/
GLuint width, height;
/*
** Origin in screen coordinates of the drawable
*/
GLint xOrigin, yOrigin;
#ifdef __GL_ALIGNED_BUFFERS
/*
** Drawable offset from screen origin
*/
GLint xOffset, yOffset;
/*
** Alignment restriction
*/
GLint xAlignment, yAlignment;
#endif
/*
** Should we invert the y axis?
*/
GLint yInverted;
/*
** Mask specifying which buffers are renderable by the hw
*/
GLuint accelBufferMask;
/*
** the buffers themselves
*/
__GLdrawableBuffer frontBuffer;
__GLdrawableBuffer backBuffer;
__GLdrawableBuffer accumBuffer;
__GLdrawableBuffer depthBuffer;
__GLdrawableBuffer stencilBuffer;
#if defined(__GL_NUMBER_OF_AUX_BUFFERS) && (__GL_NUMBER_OF_AUX_BUFFERS > 0)
__GLdrawableBuffer *auxBuffer;
#endif
__GLdrawableRegion ownershipRegion;
/*
** Lock for the drawable private structure
*/
void *lock;
#ifdef DEBUG
/* lock debugging info */
int lockRefCount;
int lockLine[10];
char *lockFile[10];
#endif
/* imported */
void *(*malloc)(size_t size);
void *(*calloc)(size_t numElem, size_t elemSize);
void *(*realloc)(void *oldAddr, size_t newSize);
void (*free)(void *addr);
GLboolean (*addSwapRect)(__GLdrawablePrivate *glPriv,
GLint x, GLint y, GLsizei width, GLsizei height);
void (*setClipRect)(__GLdrawablePrivate *glPriv,
GLint x, GLint y, GLsizei width, GLsizei height);
void (*updateClipRegion)(__GLdrawablePrivate *glPriv);
GLboolean (*resize)(__GLdrawablePrivate *glPriv);
void (*getDrawableSize)(__GLdrawablePrivate *glPriv,
GLint *x, GLint *y, GLuint *width, GLuint *height);
void (*lockDP)(__GLdrawablePrivate *glPriv, __GLcontext *gc);
void (*unlockDP)(__GLdrawablePrivate *glPriv);
/* exported */
#ifdef __cplusplus
void *privatePtr;
#else
void *private;
#endif
void (*freePrivate)(__GLdrawablePrivate *);
/* client data */
void *other;
};
/*
** Macros to lock/unlock the drawable private
*/
#if defined(DEBUG)
#define __GL_LOCK_DP(glPriv,gc) \
(*(glPriv)->lockDP)(glPriv,gc); \
(glPriv)->lockLine[(glPriv)->lockRefCount] = __LINE__; \
(glPriv)->lockFile[(glPriv)->lockRefCount] = __FILE__; \
(glPriv)->lockRefCount++
#define __GL_UNLOCK_DP(glPriv) \
(glPriv)->lockRefCount--; \
(glPriv)->lockLine[(glPriv)->lockRefCount] = 0; \
(glPriv)->lockFile[(glPriv)->lockRefCount] = NULL; \
(*(glPriv)->unlockDP)(glPriv)
#else /* DEBUG */
#define __GL_LOCK_DP(glPriv,gc) (*(glPriv)->lockDP)(glPriv,gc)
#define __GL_UNLOCK_DP(glPriv) (*(glPriv)->unlockDP)(glPriv)
#endif /* DEBUG */
/*
** Procedures which are imported by the GL from the surrounding
** "operating system". Math functions are not considered part of the
@ -467,8 +214,8 @@ typedef struct __GLimportsRec {
int (CAPI *fprintf)(__GLcontext *gc, void *stream, const char *fmt, ...);
/* Drawing surface management */
__GLdrawablePrivate *(*getDrawablePrivate)(__GLcontext *gc);
__GLdrawablePrivate *(*getReadablePrivate)(__GLcontext *gc);
void *(*getDrawablePrivate)(__GLcontext *gc);
void *(*getReadablePrivate)(__GLcontext *gc);
/* Operating system dependent data goes here */
void *other;

View file

@ -149,7 +149,7 @@ TypeStr(GLenum type)
*/
#define ALIGN (1<<12)
static unsigned align(unsigned value, unsigned a)
static unsigned long align(unsigned long value, unsigned long a)
{
return (value + a - 1) & ~(a-1);
}
@ -186,10 +186,10 @@ MeasureDownloadRate(void)
printf("alloc %p %p\n", orig_texImage, orig_getImage);
texImage = (GLubyte *)align((unsigned)orig_texImage, ALIGN);
getImage = (GLubyte *)align((unsigned)orig_getImage, ALIGN);
texImage = (GLubyte *)align((unsigned long)orig_texImage, ALIGN);
getImage = (GLubyte *)align((unsigned long)orig_getImage, ALIGN);
for (i = 1; !(((unsigned)texImage) & i); i<<=1)
for (i = 1; !(((unsigned long)texImage) & i); i<<=1)
;
printf("texture image alignment: %d bytes (%p)\n", i, texImage);

View file

@ -40,11 +40,16 @@ SOURCES = \
quad-tex-2d.c \
quad-tex-pbo.c \
quad-tex-3d.c \
quad-tex-dep.c \
quad.c \
quads.c \
quadstrip.c \
quadstrip-flat.c \
dlist-edgeflag.c \
dlist-dangling.c \
dlist-edgeflag-dangling.c \
drawrange.c \
drawelements.c \
drawarrays.c \
tri-blend.c \
tri-tex-3d.c \
tri-clip.c \
@ -61,6 +66,9 @@ SOURCES = \
tri.c \
tristrip-clip.c \
tristrip.c \
vbo-drawrange.c \
vbo-drawelements.c \
vbo-drawarrays.c \
vp-clip.c \
vp-tri.c \
vp-line-clip.c \

View file

@ -0,0 +1,149 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
GLint list;
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
glClearColor(0.0, 0.0, 1.0, 0.0);
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glBegin(GL_TRIANGLES);
glVertex3f( 0.9, -0.9, -30.0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(.8,0,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glEndList();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0,.9,0);
glCallList(list);
glRotatef(45,0,0,1);
glColor3f(1,0,1);
glCallList(list);
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View file

@ -0,0 +1,152 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
GLint list;
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
glClearColor(0.0, 0.0, 1.0, 0.0);
glPolygonMode(GL_FRONT, GL_LINE);
glPolygonMode(GL_BACK, GL_POINT);
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glBegin(GL_TRIANGLES);
glVertex3f( 0.9, -0.9, -30.0);
glEdgeFlag(1);
glVertex3f( 0.9, 0.9, -30.0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glEndList();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0,.9,0);
glEdgeFlag(0);
glCallList(list);
glRotatef(45,0,0,1);
glColor3f(1,0,1);
glCallList(list);
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View file

@ -0,0 +1,156 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
GLint list;
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
glClearColor(0.0, 0.0, 1.0, 0.0);
glPolygonMode(GL_FRONT, GL_LINE);
glPolygonMode(GL_BACK, GL_POINT);
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glBegin(GL_TRIANGLES);
glEdgeFlag(1);
/* glColor3f(0,0,.7); */
glVertex3f( 0.9, -0.9, -30.0);
glEdgeFlag(0);
/* glColor3f(.8,0,0); */
glVertex3f( 0.9, 0.9, -30.0);
glEdgeFlag(1);
/* glColor3f(0,.9,0); */
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glEndList();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0,.9,0);
glCallList(list);
glRotatef(45,0,0,1);
glColor3f(1,0,1);
glCallList(list);
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

127
progs/trivial/drawarrays.c Normal file
View file

@ -0,0 +1,127 @@
/* Basic VBO */
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
struct {
GLfloat pos[3];
GLubyte color[4];
} verts[] =
{
{ { 0.9, -0.9, 0.0 },
{ 0x00, 0x00, 0xff, 0x00 }
},
{ { 0.9, 0.9, 0.0 },
{ 0x00, 0xff, 0x00, 0x00 }
},
{ { -0.9, 0.9, 0.0 },
{ 0xff, 0x00, 0x00, 0x00 }
},
{ { -0.9, -0.9, 0.0 },
{ 0xff, 0xff, 0xff, 0x00 }
},
};
static void Init( void )
{
GLint errno;
GLuint prognum;
static const char *prog1 =
"!!ARBvp1.0\n"
"MOV result.color, vertex.color;\n"
"MOV result.position, vertex.position;\n"
"END\n";
glGenProgramsARB(1, &prognum);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(prog1), (const GLubyte *) prog1);
assert(glIsProgramARB(prognum));
errno = glGetError();
printf("glGetError = %d\n", errno);
if (errno != GL_NO_ERROR)
{
GLint errorpos;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
printf("errorpos: %d\n", errorpos);
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
}
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );
glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts[0].pos );
glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), verts[0].color );
}
static void Display( void )
{
glClearColor(0.3, 0.3, 0.3, 1);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable(GL_VERTEX_PROGRAM_ARB);
// glDrawArrays( GL_TRIANGLES, 0, 3 );
glDrawArrays( GL_TRIANGLES, 1, 3 );
glFlush();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
/*glTranslatef( 0.0, 0.0, -15.0 );*/
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 250, 250 );
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}

View file

@ -0,0 +1,120 @@
/* Test rebasing */
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
GLfloat verts[][4] = {
{ 0.9, -0.9, 0.0, 1.0 },
{ 0.9, 0.9, 0.0, 1.0 },
{ -0.9, 0.9, 0.0, 1.0 },
{ -0.9, -0.9, 0.0, 1.0 },
};
GLubyte color[][4] = {
{ 0x00, 0x00, 0xff, 0x00 },
{ 0x00, 0xff, 0x00, 0x00 },
{ 0xff, 0x00, 0x00, 0x00 },
{ 0xff, 0xff, 0xff, 0x00 },
};
GLuint indices[] = { 1, 2, 3 };
static void Init( void )
{
GLint errno;
GLuint prognum;
static const char *prog1 =
"!!ARBvp1.0\n"
"MOV result.color, vertex.color;\n"
"MOV result.position, vertex.position;\n"
"END\n";
glGenProgramsARB(1, &prognum);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(prog1), (const GLubyte *) prog1);
assert(glIsProgramARB(prognum));
errno = glGetError();
printf("glGetError = %d\n", errno);
if (errno != GL_NO_ERROR)
{
GLint errorpos;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
printf("errorpos: %d\n", errorpos);
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
}
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );
glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts );
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color );
}
static void Display( void )
{
glClearColor(0.3, 0.3, 0.3, 1);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable(GL_VERTEX_PROGRAM_NV);
/* Should have min_index == 1, maybe force a rebase:
*/
glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, indices );
glFlush();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
/*glTranslatef( 0.0, 0.0, -15.0 );*/
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 250, 250 );
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}

118
progs/trivial/drawrange.c Normal file
View file

@ -0,0 +1,118 @@
/* Test rebasing */
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
GLfloat verts[][4] = {
{ 0.9, -0.9, 0.0, 1.0 },
{ 0.9, 0.9, 0.0, 1.0 },
{ -0.9, 0.9, 0.0, 1.0 },
{ -0.9, -0.9, 0.0, 1.0 },
};
GLubyte color[][4] = {
{ 0x00, 0x00, 0xff, 0x00 },
{ 0x00, 0xff, 0x00, 0x00 },
{ 0xff, 0x00, 0x00, 0x00 },
{ 0xff, 0xff, 0xff, 0x00 },
};
GLuint indices[] = { 1, 2, 3 };
static void Init( void )
{
GLint errno;
GLuint prognum;
static const char *prog1 =
"!!ARBvp1.0\n"
"MOV result.color, vertex.color;\n"
"MOV result.position, vertex.position;\n"
"END\n";
glGenProgramsARB(1, &prognum);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(prog1), (const GLubyte *) prog1);
assert(glIsProgramARB(prognum));
errno = glGetError();
printf("glGetError = %d\n", errno);
if (errno != GL_NO_ERROR)
{
GLint errorpos;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
printf("errorpos: %d\n", errorpos);
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
}
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );
glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts );
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color );
}
static void Display( void )
{
glClearColor(0.3, 0.3, 0.3, 1);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable(GL_VERTEX_PROGRAM_NV);
glDrawRangeElements( GL_TRIANGLES, 1, 3, 3, GL_UNSIGNED_INT, indices );
glFlush();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
/*glTranslatef( 0.0, 0.0, -15.0 );*/
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 250, 250 );
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}

View file

@ -0,0 +1,133 @@
/* Basic VBO */
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
struct {
GLfloat pos[3];
GLubyte color[4];
} verts[] =
{
{ { 0.9, -0.9, 0.0 },
{ 0x00, 0x00, 0xff, 0x00 }
},
{ { 0.9, 0.9, 0.0 },
{ 0x00, 0xff, 0x00, 0x00 }
},
{ { -0.9, 0.9, 0.0 },
{ 0xff, 0x00, 0x00, 0x00 }
},
{ { -0.9, -0.9, 0.0 },
{ 0xff, 0xff, 0xff, 0x00 }
},
};
GLuint arrayObj, elementObj;
static void Init( void )
{
GLint errno;
GLuint prognum;
static const char *prog1 =
"!!ARBvp1.0\n"
"MOV result.color, vertex.color;\n"
"MOV result.position, vertex.position;\n"
"END\n";
glGenProgramsARB(1, &prognum);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(prog1), (const GLubyte *) prog1);
assert(glIsProgramARB(prognum));
errno = glGetError();
printf("glGetError = %d\n", errno);
if (errno != GL_NO_ERROR)
{
GLint errorpos;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
printf("errorpos: %d\n", errorpos);
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
}
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );
glGenBuffersARB(1, &arrayObj);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_STATIC_DRAW_ARB);
glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), 0 );
glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), (void *)(3*sizeof(float)) );
}
static void Display( void )
{
glClearColor(0.3, 0.3, 0.3, 1);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable(GL_VERTEX_PROGRAM_ARB);
// glDrawArrays( GL_TRIANGLES, 0, 3 );
glDrawArrays( GL_TRIANGLES, 1, 3 );
glFlush();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
/*glTranslatef( 0.0, 0.0, -15.0 );*/
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 250, 250 );
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}

View file

@ -0,0 +1,137 @@
/* Basic VBO */
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
struct {
GLfloat pos[3];
GLubyte color[4];
} verts[] =
{
{ { 0.9, -0.9, 0.0 },
{ 0x00, 0x00, 0xff, 0x00 }
},
{ { 0.9, 0.9, 0.0 },
{ 0x00, 0xff, 0x00, 0x00 }
},
{ { -0.9, 0.9, 0.0 },
{ 0xff, 0x00, 0x00, 0x00 }
},
{ { -0.9, -0.9, 0.0 },
{ 0xff, 0xff, 0xff, 0x00 }
},
};
GLuint indices[] = { 0, 1, 2, 3 };
GLuint arrayObj, elementObj;
static void Init( void )
{
GLint errno;
GLuint prognum;
static const char *prog1 =
"!!ARBvp1.0\n"
"MOV result.color, vertex.color;\n"
"MOV result.position, vertex.position;\n"
"END\n";
glGenProgramsARB(1, &prognum);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(prog1), (const GLubyte *) prog1);
assert(glIsProgramARB(prognum));
errno = glGetError();
printf("glGetError = %d\n", errno);
if (errno != GL_NO_ERROR)
{
GLint errorpos;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
printf("errorpos: %d\n", errorpos);
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
}
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );
glGenBuffersARB(1, &arrayObj);
glGenBuffersARB(1, &elementObj);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj);
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementObj);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_STATIC_DRAW_ARB);
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(indices), indices, GL_STATIC_DRAW_ARB);
glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), 0 );
glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), (void *)(3*sizeof(float)) );
}
static void Display( void )
{
glClearColor(0.3, 0.3, 0.3, 1);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable(GL_VERTEX_PROGRAM_ARB);
glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, NULL );
glFlush();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
/*glTranslatef( 0.0, 0.0, -15.0 );*/
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 250, 250 );
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}

View file

@ -0,0 +1,145 @@
/* Basic VBO */
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#define ELTOBJ 0
struct {
GLfloat pos[3];
GLubyte color[4];
} verts[] =
{
{ { 0.9, -0.9, 0.0 },
{ 0x00, 0x00, 0xff, 0x00 }
},
{ { 0.9, 0.9, 0.0 },
{ 0x00, 0xff, 0x00, 0x00 }
},
{ { -0.9, 0.9, 0.0 },
{ 0xff, 0x00, 0x00, 0x00 }
},
{ { -0.9, -0.9, 0.0 },
{ 0xff, 0xff, 0xff, 0x00 }
},
};
GLuint indices[] = { 1, 2, 3 };
GLuint arrayObj, elementObj;
static void Init( void )
{
GLint errno;
GLuint prognum;
static const char *prog1 =
"!!ARBvp1.0\n"
"MOV result.color, vertex.color;\n"
"MOV result.position, vertex.position;\n"
"END\n";
glGenProgramsARB(1, &prognum);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(prog1), (const GLubyte *) prog1);
assert(glIsProgramARB(prognum));
errno = glGetError();
printf("glGetError = %d\n", errno);
if (errno != GL_NO_ERROR)
{
GLint errorpos;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
printf("errorpos: %d\n", errorpos);
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
}
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );
glGenBuffersARB(1, &arrayObj);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_STATIC_DRAW_ARB);
#if ELTOBJ
glGenBuffersARB(1, &elementObj);
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementObj);
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(indices), indices, GL_STATIC_DRAW_ARB);
#endif
glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), 0 );
glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), (void *)(3*sizeof(float)) );
}
static void Display( void )
{
glClearColor(0.3, 0.3, 0.3, 1);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable(GL_VERTEX_PROGRAM_ARB);
#if ELTOBJ
glDrawRangeElements( GL_TRIANGLES, 1, 3, 3, GL_UNSIGNED_INT, NULL );
#else
glDrawRangeElements( GL_TRIANGLES, 1, 3, 3, GL_UNSIGNED_INT, indices );
#endif
glFlush();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
/*glTranslatef( 0.0, 0.0, -15.0 );*/
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 250, 250 );
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}

View file

@ -6,13 +6,44 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "egllog.h"
#define MAXSTRING 1000
#define FALLBACK_LOG_LEVEL _EGL_DEBUG
#define FALLBACK_LOG_LEVEL_STR "debug"
static EGLint ReportingLevel = -1;
/* XXX init this with an env var or something */
static EGLint ReportingLevel = _EGL_DEBUG;
static void
log_level_initialize (void)
{
char *log_env = getenv ("EGL_LOG_LEVEL");
if (log_env == NULL) {
ReportingLevel = FALLBACK_LOG_LEVEL;
}
else if (strcasecmp (log_env, "fatal") == 0) {
ReportingLevel = _EGL_FATAL;
}
else if (strcasecmp (log_env, "warning") == 0) {
ReportingLevel = _EGL_WARNING;
}
else if (strcasecmp (log_env, "info") == 0) {
ReportingLevel = _EGL_INFO;
}
else if (strcasecmp (log_env, "debug") == 0) {
ReportingLevel = _EGL_DEBUG;
}
else {
fprintf (stderr, "Unrecognized EGL_LOG_LEVEL environment variable value. "
"Expected one of \"fatal\", \"warning\", \"info\", \"debug\". "
"Got \"%s\". Falling back to \"%s\".\n",
log_env, FALLBACK_LOG_LEVEL_STR);
ReportingLevel = FALLBACK_LOG_LEVEL;
}
}
/**
@ -25,6 +56,12 @@ _eglLog(EGLint level, const char *fmtStr, ...)
va_list args;
char msg[MAXSTRING];
const char *levelStr;
static int log_level_initialized = 0;
if (!log_level_initialized) {
log_level_initialize ();
log_level_initialized = 1;
}
if (level <= ReportingLevel) {
switch (level) {

View file

@ -173,6 +173,9 @@ void glutInit (int *argcp, char **argv)
int RequiredWidth = 0, RequiredHeight;
char *fbdev;
stack_t stack;
struct sigaction sa;
/* parse out args */
for (i = 1; i < *argcp;) {
if (!strcmp(argv[i], "-geometry")) {
@ -239,7 +242,19 @@ void glutInit (int *argcp, char **argv)
gettimeofday(&StartTime, 0);
atexit(Cleanup);
signal(SIGSEGV, CrashHandler);
/* set up SIGSEGV to use alternate stack */
stack.ss_flags = 0;
stack.ss_size = SIGSTKSZ;
if(!(stack.ss_sp = malloc(SIGSTKSZ)))
sprintf(exiterror, "Failed to allocate alternate stack for SIGSEGV!\n");
sigaltstack(&stack, NULL);
sa.sa_handler = CrashHandler;
sa.sa_flags = SA_ONSTACK;
sigemptyset(&sa.sa_mask);
sigaction(SIGSEGV, &sa, NULL);
signal(SIGINT, CrashHandler);
signal(SIGTERM, CrashHandler);
signal(SIGABRT, CrashHandler);

File diff suppressed because it is too large Load diff

View file

@ -376,7 +376,7 @@ const char *glXGetDriverConfig (const char *driverName) {
}
/* This function isn't currently used.
/* Called from __glXFreeDisplayPrivate.
*/
static void driDestroyDisplay(Display *dpy, void *private)
{
@ -386,8 +386,26 @@ static void driDestroyDisplay(Display *dpy, void *private)
const int numScreens = ScreenCount(dpy);
int i;
for (i = 0; i < numScreens; i++) {
if (pdpyp->libraryHandles[i])
dlclose(pdpyp->libraryHandles[i]);
if (pdpyp->libraryHandles[i]) {
__DRIdriver *driver, *prev;
/* Remove driver from Drivers list */
for (prev = NULL, driver = Drivers; driver;
prev = driver, driver = driver->next) {
if (driver->handle == pdpyp->libraryHandles[i]) {
if (prev)
prev->next = driver->next;
else
Drivers = driver->next;
Xfree(driver->name);
Xfree(driver);
break;
}
}
dlclose(pdpyp->libraryHandles[i]);
}
}
Xfree(pdpyp->libraryHandles);
Xfree(pdpyp);

View file

@ -396,6 +396,10 @@ static int __glXFreeDisplayPrivate(XExtData *extension)
(*priv->driDisplay.destroyDisplay)(priv->dpy,
priv->driDisplay.private);
priv->driDisplay.private = NULL;
if (priv->driDisplay.createNewScreen) {
Xfree(priv->driDisplay.createNewScreen); /* free array of ptrs */
priv->driDisplay.createNewScreen = NULL;
}
#endif
Xfree((char*) priv);
@ -758,7 +762,8 @@ static void __glXReportDamage(__DRInativeDisplay *dpy, int screen,
xrects[i].height = rects[i].y2 - rects[i].y1;
}
region = XFixesCreateRegion(dpy, xrects, num_rects);
XDamagePost(dpy, drawable, region);
free(xrects);
XDamageAdd(dpy, drawable, region);
XFixesDestroyRegion(dpy, region);
#endif
}

View file

@ -474,7 +474,7 @@ __indirect_glBegin(GLenum mode)
void
__indirect_glBitmap(GLsizei width, GLsizei height, GLfloat xorig,
GLfloat yorig, GLfloat xmove, GLfloat ymove,
const GLubyte * bitmap)
const GLubyte *bitmap)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint compsize =
@ -541,7 +541,7 @@ __indirect_glColor3b(GLbyte red, GLbyte green, GLbyte blue)
#define X_GLrop_Color3bv 6
void
__indirect_glColor3bv(const GLbyte * v)
__indirect_glColor3bv(const GLbyte *v)
{
generic_3_byte(X_GLrop_Color3bv, v);
}
@ -656,7 +656,7 @@ __indirect_glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
#define X_GLrop_Color3ubv 11
void
__indirect_glColor3ubv(const GLubyte * v)
__indirect_glColor3ubv(const GLubyte *v)
{
generic_3_byte(X_GLrop_Color3ubv, v);
}
@ -726,7 +726,7 @@ __indirect_glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
#define X_GLrop_Color4bv 14
void
__indirect_glColor4bv(const GLbyte * v)
__indirect_glColor4bv(const GLbyte *v)
{
generic_4_byte(X_GLrop_Color4bv, v);
}
@ -847,7 +847,7 @@ __indirect_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
#define X_GLrop_Color4ubv 19
void
__indirect_glColor4ubv(const GLubyte * v)
__indirect_glColor4ubv(const GLubyte *v)
{
generic_4_byte(X_GLrop_Color4ubv, v);
}
@ -1051,7 +1051,7 @@ __indirect_glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
#define X_GLrop_Normal3bv 28
void
__indirect_glNormal3bv(const GLbyte * v)
__indirect_glNormal3bv(const GLbyte *v)
{
generic_3_byte(X_GLrop_Normal3bv, v);
}
@ -2584,7 +2584,7 @@ __indirect_glPolygonMode(GLenum face, GLenum mode)
#define X_GLrop_PolygonStipple 102
void
__indirect_glPolygonStipple(const GLubyte * mask)
__indirect_glPolygonStipple(const GLubyte *mask)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint compsize =
@ -4207,7 +4207,7 @@ __indirect_glGetPixelMapusv(GLenum map, GLushort * values)
#define X_GLsop_GetPolygonStipple 128
void
__indirect_glGetPolygonStipple(GLubyte * mask)
__indirect_glGetPolygonStipple(GLubyte *mask)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const __GLXattribute *const state = gc->client_state_private;
@ -4977,7 +4977,7 @@ __indirect_glIndexub(GLubyte c)
#define X_GLrop_Indexubv 194
void
__indirect_glIndexubv(const GLubyte * c)
__indirect_glIndexubv(const GLubyte *c)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 8;
@ -7935,7 +7935,7 @@ __indirect_glVertexAttrib3svARB(GLuint index, const GLshort * v)
#define X_GLrop_VertexAttrib4NbvARB 4235
void
__indirect_glVertexAttrib4NbvARB(GLuint index, const GLbyte * v)
__indirect_glVertexAttrib4NbvARB(GLuint index, const GLbyte *v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12;
@ -7999,7 +7999,7 @@ __indirect_glVertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y,
#define X_GLrop_VertexAttrib4NubvARB 4201
void
__indirect_glVertexAttrib4NubvARB(GLuint index, const GLubyte * v)
__indirect_glVertexAttrib4NubvARB(GLuint index, const GLubyte *v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12;
@ -8044,7 +8044,7 @@ __indirect_glVertexAttrib4NusvARB(GLuint index, const GLushort * v)
#define X_GLrop_VertexAttrib4bvARB 4230
void
__indirect_glVertexAttrib4bvARB(GLuint index, const GLbyte * v)
__indirect_glVertexAttrib4bvARB(GLuint index, const GLbyte *v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12;
@ -8176,7 +8176,7 @@ __indirect_glVertexAttrib4svARB(GLuint index, const GLshort * v)
#define X_GLrop_VertexAttrib4ubvARB 4232
void
__indirect_glVertexAttrib4ubvARB(GLuint index, const GLubyte * v)
__indirect_glVertexAttrib4ubvARB(GLuint index, const GLubyte *v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12;
@ -8556,7 +8556,7 @@ __indirect_glSecondaryColor3bEXT(GLbyte red, GLbyte green, GLbyte blue)
#define X_GLrop_SecondaryColor3bvEXT 4126
void
__indirect_glSecondaryColor3bvEXT(const GLbyte * v)
__indirect_glSecondaryColor3bvEXT(const GLbyte *v)
{
generic_3_byte(X_GLrop_SecondaryColor3bvEXT, v);
}
@ -8671,7 +8671,7 @@ __indirect_glSecondaryColor3ubEXT(GLubyte red, GLubyte green, GLubyte blue)
#define X_GLrop_SecondaryColor3ubvEXT 4131
void
__indirect_glSecondaryColor3ubvEXT(const GLubyte * v)
__indirect_glSecondaryColor3ubvEXT(const GLubyte *v)
{
generic_3_byte(X_GLrop_SecondaryColor3ubvEXT, v);
}
@ -8943,7 +8943,7 @@ __indirect_glGetProgramParameterfvNV(GLenum target, GLuint index,
#define X_GLvop_GetProgramStringNV 1299
void
__indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte * program)
__indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte *program)
{
__GLXcontext *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
@ -9087,7 +9087,7 @@ __indirect_glIsProgramNV(GLuint program)
#define X_GLrop_LoadProgramNV 4183
void
__indirect_glLoadProgramNV(GLenum target, GLuint id, GLsizei len,
const GLubyte * program)
const GLubyte *program)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 16 + __GLX_PAD(len);
@ -9656,7 +9656,7 @@ __indirect_glVertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z,
#define X_GLrop_VertexAttrib4ubvNV 4277
void
__indirect_glVertexAttrib4ubvNV(GLuint index, const GLubyte * v)
__indirect_glVertexAttrib4ubvNV(GLuint index, const GLubyte *v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12;
@ -9887,7 +9887,7 @@ __indirect_glVertexAttribs4svNV(GLuint index, GLsizei n, const GLshort * v)
#define X_GLrop_VertexAttribs4ubvNV 4214
void
__indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte * v)
__indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
@ -9951,7 +9951,7 @@ __indirect_glActiveStencilFaceEXT(GLenum face)
#define X_GLvop_GetProgramNamedParameterdvNV 1311
void
__indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len,
const GLubyte * name,
const GLubyte *name,
GLdouble * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
@ -9975,7 +9975,7 @@ __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len,
#define X_GLvop_GetProgramNamedParameterfvNV 1310
void
__indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len,
const GLubyte * name,
const GLubyte *name,
GLfloat * params)
{
__GLXcontext *const gc = __glXGetCurrentContext();
@ -9999,7 +9999,7 @@ __indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len,
#define X_GLrop_ProgramNamedParameter4dvNV 4219
void
__indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len,
const GLubyte * name, GLdouble x,
const GLubyte *name, GLdouble x,
GLdouble y, GLdouble z, GLdouble w)
{
__GLXcontext *const gc = __glXGetCurrentContext();
@ -10023,7 +10023,7 @@ __indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len,
#define X_GLrop_ProgramNamedParameter4dvNV 4219
void
__indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len,
const GLubyte * name,
const GLubyte *name,
const GLdouble * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();
@ -10044,7 +10044,7 @@ __indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len,
#define X_GLrop_ProgramNamedParameter4fvNV 4218
void
__indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len,
const GLubyte * name, GLfloat x,
const GLubyte *name, GLfloat x,
GLfloat y, GLfloat z, GLfloat w)
{
__GLXcontext *const gc = __glXGetCurrentContext();
@ -10068,7 +10068,7 @@ __indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len,
#define X_GLrop_ProgramNamedParameter4fvNV 4218
void
__indirect_glProgramNamedParameter4fvNV(GLuint id, GLsizei len,
const GLubyte * name,
const GLubyte *name,
const GLfloat * v)
{
__GLXcontext *const gc = __glXGetCurrentContext();

View file

@ -633,7 +633,7 @@ extern HIDDEN void __indirect_glGetProgramParameterfvNV(GLenum target, GLuint in
extern HIDDEN void __indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte * program);
extern HIDDEN void __indirect_glGetProgramivNV(GLuint id, GLenum pname, GLint * params);
extern HIDDEN void __indirect_glGetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname, GLint * params);
extern HIDDEN void __indirect_glGetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid ** params);
extern HIDDEN void __indirect_glGetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid ** pointer);
extern HIDDEN void __indirect_glGetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble * params);
extern HIDDEN void __indirect_glGetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat * params);
extern HIDDEN void __indirect_glGetVertexAttribivNV(GLuint index, GLenum pname, GLint * params);

View file

@ -142,7 +142,7 @@ depend: $(ALL_SOURCES)
@ echo "running $(MKDEP)"
@ touch depend
@$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
> /dev/null
> /dev/null 2>/dev/null
subdirs:

View file

@ -1,375 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 5.1
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "macros.h"
#include "imports.h"
#include "mtypes.h"
#include "array_cache/ac_context.h"
/*
* Initialize the array fallbacks. That is, by default the fallback arrays
* point into the current vertex attribute values in ctx->Current.Attrib[]
*/
static void _ac_fallbacks_init( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
struct gl_client_array *cl;
GLuint i;
cl = &ac->Fallback.Normal;
cl->Size = 3;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Fallback.Color;
cl->Size = 4;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Fallback.SecondaryColor;
cl->Size = 3;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Fallback.FogCoord;
cl->Size = 1;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) &ctx->Current.Attrib[VERT_ATTRIB_FOG];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Fallback.Index;
cl->Size = 1;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) &ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
for (i = 0 ; i < MAX_TEXTURE_COORD_UNITS ; i++) {
cl = &ac->Fallback.TexCoord[i];
cl->Size = 4;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
}
cl = &ac->Fallback.EdgeFlag;
cl->Size = 1;
cl->Type = GL_UNSIGNED_BYTE;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) &ctx->Current.EdgeFlag;
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
cl = &ac->Fallback.Attrib[i];
cl->Size = 4;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (GLubyte *) ctx->Current.Attrib[i];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
}
}
/*
* Initialize the array cache pointers, types, strides, etc.
*/
static void _ac_cache_init( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
struct gl_client_array *cl;
GLuint size = ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES;
GLuint i;
cl = &ac->Cache.Vertex;
cl->Size = 4;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Cache.Normal;
cl->Size = 3;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 3 * sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Cache.Color;
cl->Size = 4;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Cache.SecondaryColor;
cl->Size = 3;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Cache.FogCoord;
cl->Size = 1;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
cl = &ac->Cache.Index;
cl->Size = 1;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
cl = &ac->Cache.TexCoord[i];
cl->Size = 4;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
}
cl = &ac->Cache.EdgeFlag;
cl->Size = 1;
cl->Type = GL_UNSIGNED_BYTE;
cl->Stride = 0;
cl->StrideB = sizeof(GLubyte);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
for (i = 0 ; i < VERT_ATTRIB_MAX; i++) {
cl = &ac->Cache.Attrib[i];
cl->Size = 4;
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
cl->BufferObj = ctx->Array.NullBufferObj;
#endif
}
}
/* This storage used to hold translated client data if type or stride
* need to be fixed.
*/
static void _ac_elts_init( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
GLuint size = 1000;
ac->Elts = (GLuint *)MALLOC( sizeof(GLuint) * size );
ac->elt_size = size;
}
static void _ac_raw_init( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
GLuint i;
ac->Raw.Color = ac->Fallback.Color;
ac->Raw.EdgeFlag = ac->Fallback.EdgeFlag;
ac->Raw.FogCoord = ac->Fallback.FogCoord;
ac->Raw.Index = ac->Fallback.Index;
ac->Raw.Normal = ac->Fallback.Normal;
ac->Raw.SecondaryColor = ac->Fallback.SecondaryColor;
ac->Raw.Vertex = ctx->Array.ArrayObj->Vertex;
ac->IsCached.Color = GL_FALSE;
ac->IsCached.EdgeFlag = GL_FALSE;
ac->IsCached.FogCoord = GL_FALSE;
ac->IsCached.Index = GL_FALSE;
ac->IsCached.Normal = GL_FALSE;
ac->IsCached.SecondaryColor = GL_FALSE;
ac->IsCached.Vertex = GL_FALSE;
for (i = 0 ; i < MAX_TEXTURE_COORD_UNITS ; i++) {
ac->Raw.TexCoord[i] = ac->Fallback.TexCoord[i];
ac->IsCached.TexCoord[i] = GL_FALSE;
}
for (i = 0 ; i < VERT_ATTRIB_MAX ; i++) {
ac->Raw.Attrib[i] = ac->Fallback.Attrib[i];
ac->IsCached.Attrib[i] = GL_FALSE;
}
}
GLboolean _ac_CreateContext( GLcontext *ctx )
{
ctx->acache_context = CALLOC(sizeof(ACcontext));
if (ctx->acache_context) {
_ac_cache_init( ctx );
_ac_fallbacks_init( ctx );
_ac_raw_init( ctx );
_ac_elts_init( ctx );
return GL_TRUE;
}
return GL_FALSE;
}
void _ac_DestroyContext( GLcontext *ctx )
{
struct gl_buffer_object *nullObj = ctx->Array.NullBufferObj;
ACcontext *ac = AC_CONTEXT(ctx);
GLint i;
/* only free vertex data if it's really a pointer to vertex data and
* not an offset into a buffer object.
*/
if (ac->Cache.Vertex.Ptr && ac->Cache.Vertex.BufferObj == nullObj)
FREE( (void *) ac->Cache.Vertex.Ptr );
if (ac->Cache.Normal.Ptr && ac->Cache.Normal.BufferObj == nullObj)
FREE( (void *) ac->Cache.Normal.Ptr );
if (ac->Cache.Color.Ptr && ac->Cache.Color.BufferObj == nullObj)
FREE( (void *) ac->Cache.Color.Ptr );
if (ac->Cache.SecondaryColor.Ptr && ac->Cache.SecondaryColor.BufferObj == nullObj)
FREE( (void *) ac->Cache.SecondaryColor.Ptr );
if (ac->Cache.EdgeFlag.Ptr && ac->Cache.EdgeFlag.BufferObj == nullObj)
FREE( (void *) ac->Cache.EdgeFlag.Ptr );
if (ac->Cache.Index.Ptr && ac->Cache.Index.BufferObj == nullObj)
FREE( (void *) ac->Cache.Index.Ptr );
if (ac->Cache.FogCoord.Ptr && ac->Cache.FogCoord.BufferObj == nullObj)
FREE( (void *) ac->Cache.FogCoord.Ptr );
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
if (ac->Cache.TexCoord[i].Ptr && ac->Cache.TexCoord[i].BufferObj == nullObj)
FREE( (void *) ac->Cache.TexCoord[i].Ptr );
}
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
if (ac->Cache.Attrib[i].Ptr && ac->Cache.Attrib[i].BufferObj == nullObj)
FREE( (void *) ac->Cache.Attrib[i].Ptr );
}
if (ac->Elts)
FREE( ac->Elts );
/* Free the context structure itself */
FREE(ac);
ctx->acache_context = NULL;
}
void _ac_InvalidateState( GLcontext *ctx, GLuint new_state )
{
AC_CONTEXT(ctx)->NewState |= new_state;
AC_CONTEXT(ctx)->NewArrayState |= ctx->Array.NewState;
}

View file

@ -1,99 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 5.1
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#ifndef _AC_CONTEXT_H
#define _AC_CONTEXT_H
#include "glheader.h"
#include "mtypes.h"
#include "array_cache/acache.h"
/* These are used to make the ctx->Current values look like
* arrays (with zero StrideB).
*/
struct ac_arrays {
struct gl_client_array Vertex;
struct gl_client_array Normal;
struct gl_client_array Color;
struct gl_client_array SecondaryColor;
struct gl_client_array FogCoord;
struct gl_client_array Index;
struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
struct gl_client_array EdgeFlag;
struct gl_client_array Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */
};
struct ac_array_pointers {
struct gl_client_array *Vertex;
struct gl_client_array *Normal;
struct gl_client_array *Color;
struct gl_client_array *SecondaryColor;
struct gl_client_array *FogCoord;
struct gl_client_array *Index;
struct gl_client_array *TexCoord[MAX_TEXTURE_COORD_UNITS];
struct gl_client_array *EdgeFlag;
struct gl_client_array *Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */
};
struct ac_array_flags {
GLboolean Vertex;
GLboolean Normal;
GLboolean Color;
GLboolean SecondaryColor;
GLboolean FogCoord;
GLboolean Index;
GLboolean TexCoord[MAX_TEXTURE_COORD_UNITS];
GLboolean EdgeFlag;
GLboolean Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */
};
typedef struct {
GLuint NewState; /* not needed? */
GLuint NewArrayState;
/* Facility for importing and caching array data:
*/
struct ac_arrays Fallback;
struct ac_arrays Cache;
struct ac_arrays Raw;
struct ac_array_flags IsCached;
GLuint start;
GLuint count;
/* Facility for importing element lists:
*/
GLuint *Elts;
GLuint elt_size;
} ACcontext;
#define AC_CONTEXT(ctx) ((ACcontext *)ctx->acache_context)
#endif

View file

@ -1,922 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 6.5
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "macros.h"
#include "imports.h"
#include "mtypes.h"
#include "math/m_translate.h"
#include "array_cache/ac_context.h"
#include "math/m_translate.h"
#define STRIDE_ARRAY( array, offset ) \
do { \
GLubyte *tmp = ADD_POINTERS( (array).BufferObj->Data, (array).Ptr ) \
+ (offset) * (array).StrideB; \
(array).Ptr = tmp; \
} while (0)
/* Set the array pointer back to its source when the cached data is
* invalidated:
*/
static void
reset_texcoord( GLcontext *ctx, GLuint unit )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->TexCoord[unit].Enabled) {
ac->Raw.TexCoord[unit] = ctx->Array.ArrayObj->TexCoord[unit];
STRIDE_ARRAY(ac->Raw.TexCoord[unit], ac->start);
}
else {
ac->Raw.TexCoord[unit] = ac->Fallback.TexCoord[unit];
if (ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3] != 1.0)
ac->Raw.TexCoord[unit].Size = 4;
else if (ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2] != 0.0)
ac->Raw.TexCoord[unit].Size = 3;
else
ac->Raw.TexCoord[unit].Size = 2;
}
ac->IsCached.TexCoord[unit] = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_TEXCOORD(unit);
}
static void
reset_vertex( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
ASSERT(ctx->Array.ArrayObj->Vertex.Enabled
|| (ctx->VertexProgram._Enabled && ctx->Array.ArrayObj->VertexAttrib[0].Enabled));
ac->Raw.Vertex = ctx->Array.ArrayObj->Vertex;
STRIDE_ARRAY(ac->Raw.Vertex, ac->start);
ac->IsCached.Vertex = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_VERTEX;
}
static void
reset_normal( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->Normal.Enabled) {
ac->Raw.Normal = ctx->Array.ArrayObj->Normal;
STRIDE_ARRAY(ac->Raw.Normal, ac->start);
}
else {
ac->Raw.Normal = ac->Fallback.Normal;
}
ac->IsCached.Normal = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_NORMAL;
}
static void
reset_color( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->Color.Enabled) {
ac->Raw.Color = ctx->Array.ArrayObj->Color;
STRIDE_ARRAY(ac->Raw.Color, ac->start);
}
else
ac->Raw.Color = ac->Fallback.Color;
ac->IsCached.Color = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_COLOR0;
}
static void
reset_secondarycolor( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->SecondaryColor.Enabled) {
ac->Raw.SecondaryColor = ctx->Array.ArrayObj->SecondaryColor;
STRIDE_ARRAY(ac->Raw.SecondaryColor, ac->start);
}
else
ac->Raw.SecondaryColor = ac->Fallback.SecondaryColor;
ac->IsCached.SecondaryColor = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_COLOR1;
}
static void
reset_index( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->Index.Enabled) {
ac->Raw.Index = ctx->Array.ArrayObj->Index;
STRIDE_ARRAY(ac->Raw.Index, ac->start);
}
else
ac->Raw.Index = ac->Fallback.Index;
ac->IsCached.Index = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_INDEX;
}
static void
reset_fogcoord( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->FogCoord.Enabled) {
ac->Raw.FogCoord = ctx->Array.ArrayObj->FogCoord;
STRIDE_ARRAY(ac->Raw.FogCoord, ac->start);
}
else
ac->Raw.FogCoord = ac->Fallback.FogCoord;
ac->IsCached.FogCoord = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_FOGCOORD;
}
static void
reset_edgeflag( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->EdgeFlag.Enabled) {
ac->Raw.EdgeFlag = ctx->Array.ArrayObj->EdgeFlag;
STRIDE_ARRAY(ac->Raw.EdgeFlag, ac->start);
}
else
ac->Raw.EdgeFlag = ac->Fallback.EdgeFlag;
ac->IsCached.EdgeFlag = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_EDGEFLAG;
}
/**
* \param index the generic vertex array number.
*/
static void
reset_attrib( GLcontext *ctx, GLuint index )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (ctx->Array.ArrayObj->VertexAttrib[index].Enabled) {
ac->Raw.Attrib[index] = ctx->Array.ArrayObj->VertexAttrib[index];
STRIDE_ARRAY(ac->Raw.Attrib[index], ac->start);
}
else
ac->Raw.Attrib[index] = ac->Fallback.Attrib[index];
ac->IsCached.Attrib[index] = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_ATTRIB(index);
}
/**
* Generic import function for color data
*/
static void
import( const GLcontext *ctx,
GLenum destType,
struct gl_client_array *to,
const struct gl_client_array *from )
{
const ACcontext *ac = AC_CONTEXT(ctx);
if (destType == 0)
destType = from->Type;
switch (destType) {
case GL_FLOAT:
_math_trans_4fn( (GLfloat (*)[4]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
from->Size,
0,
ac->count - ac->start);
to->StrideB = 4 * sizeof(GLfloat);
to->Type = GL_FLOAT;
break;
case GL_UNSIGNED_BYTE:
_math_trans_4ub( (GLubyte (*)[4]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
from->Size,
0,
ac->count - ac->start);
to->StrideB = 4 * sizeof(GLubyte);
to->Type = GL_UNSIGNED_BYTE;
break;
case GL_UNSIGNED_SHORT:
_math_trans_4us( (GLushort (*)[4]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
from->Size,
0,
ac->count - ac->start);
to->StrideB = 4 * sizeof(GLushort);
to->Type = GL_UNSIGNED_SHORT;
break;
default:
_mesa_problem(ctx, "Unexpected dest format in import()");
break;
}
}
/*
* Functions to import array ranges with specified types and strides.
* For example, if the vertex data is GLshort[2] and we want GLfloat[3]
* we'll use an import function to do the data conversion.
*/
static void
import_texcoord( GLcontext *ctx, GLuint unit, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.TexCoord[unit];
struct gl_client_array *to = &ac->Cache.TexCoord[unit];
(void) type; (void) stride;
ASSERT(unit < ctx->Const.MaxTextureCoordUnits);
/* Limited choices at this stage:
*/
ASSERT(type == GL_FLOAT);
ASSERT(stride == 4*sizeof(GLfloat) || stride == 0);
ASSERT(ac->count - ac->start < ctx->Const.MaxArrayLockSize);
_math_trans_4f( (GLfloat (*)[4]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
from->Size,
0,
ac->count - ac->start);
to->Size = from->Size;
to->StrideB = 4 * sizeof(GLfloat);
to->Type = GL_FLOAT;
ac->IsCached.TexCoord[unit] = GL_TRUE;
}
static void
import_vertex( GLcontext *ctx, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.Vertex;
struct gl_client_array *to = &ac->Cache.Vertex;
(void) type; (void) stride;
/* Limited choices at this stage:
*/
ASSERT(type == GL_FLOAT);
ASSERT(stride == 4*sizeof(GLfloat) || stride == 0);
_math_trans_4f( (GLfloat (*)[4]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
from->Size,
0,
ac->count - ac->start);
to->Size = from->Size;
to->StrideB = 4 * sizeof(GLfloat);
to->Type = GL_FLOAT;
ac->IsCached.Vertex = GL_TRUE;
}
static void
import_normal( GLcontext *ctx, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.Normal;
struct gl_client_array *to = &ac->Cache.Normal;
(void) type; (void) stride;
/* Limited choices at this stage:
*/
ASSERT(type == GL_FLOAT);
ASSERT(stride == 3*sizeof(GLfloat) || stride == 0);
_math_trans_3fn((GLfloat (*)[3]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
0,
ac->count - ac->start);
to->StrideB = 3 * sizeof(GLfloat);
to->Type = GL_FLOAT;
ac->IsCached.Normal = GL_TRUE;
}
static void
import_color( GLcontext *ctx, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.Color;
struct gl_client_array *to = &ac->Cache.Color;
(void) stride;
import( ctx, type, to, from );
ac->IsCached.Color = GL_TRUE;
}
static void
import_index( GLcontext *ctx, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.Index;
struct gl_client_array *to = &ac->Cache.Index;
(void) type; (void) stride;
/* Limited choices at this stage:
*/
ASSERT(type == GL_UNSIGNED_INT);
ASSERT(stride == sizeof(GLuint) || stride == 0);
_math_trans_1ui( (GLuint *) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
0,
ac->count - ac->start);
to->StrideB = sizeof(GLuint);
to->Type = GL_UNSIGNED_INT;
ac->IsCached.Index = GL_TRUE;
}
static void
import_secondarycolor( GLcontext *ctx, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.SecondaryColor;
struct gl_client_array *to = &ac->Cache.SecondaryColor;
(void) stride;
import( ctx, type, to, from );
ac->IsCached.SecondaryColor = GL_TRUE;
}
static void
import_fogcoord( GLcontext *ctx, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.FogCoord;
struct gl_client_array *to = &ac->Cache.FogCoord;
(void) type; (void) stride;
/* Limited choices at this stage:
*/
ASSERT(type == GL_FLOAT);
ASSERT(stride == sizeof(GLfloat) || stride == 0);
_math_trans_1f( (GLfloat *) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
0,
ac->count - ac->start);
to->StrideB = sizeof(GLfloat);
to->Type = GL_FLOAT;
ac->IsCached.FogCoord = GL_TRUE;
}
static void
import_edgeflag( GLcontext *ctx, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.EdgeFlag;
struct gl_client_array *to = &ac->Cache.EdgeFlag;
(void) type; (void) stride;
/* Limited choices at this stage:
*/
ASSERT(type == GL_UNSIGNED_BYTE);
ASSERT(stride == sizeof(GLubyte) || stride == 0);
_math_trans_1ub( (GLubyte *) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
0,
ac->count - ac->start);
to->StrideB = sizeof(GLubyte);
to->Type = GL_UNSIGNED_BYTE;
ac->IsCached.EdgeFlag = GL_TRUE;
}
/**
* \param index the generic vertex array number
*/
static void
import_attrib( GLcontext *ctx, GLuint index, GLenum type, GLuint stride )
{
ACcontext *ac = AC_CONTEXT(ctx);
const struct gl_client_array *from = &ac->Raw.Attrib[index];
struct gl_client_array *to = &ac->Cache.Attrib[index];
(void) type; (void) stride;
ASSERT(index < MAX_VERTEX_PROGRAM_ATTRIBS);
/* Limited choices at this stage:
*/
ASSERT(type == GL_FLOAT);
ASSERT(stride == 4*sizeof(GLfloat) || stride == 0);
ASSERT(ac->count - ac->start < ctx->Const.MaxArrayLockSize);
if (from->Normalized) {
_math_trans_4fn( (GLfloat (*)[4]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
from->Size,
0,
ac->count - ac->start);
}
else {
_math_trans_4f( (GLfloat (*)[4]) to->Ptr,
from->Ptr,
from->StrideB,
from->Type,
from->Size,
0,
ac->count - ac->start);
}
to->Size = from->Size;
to->StrideB = 4 * sizeof(GLfloat);
to->Type = GL_FLOAT;
ac->IsCached.Attrib[index] = GL_TRUE;
}
/*
* Externals to request arrays with specific properties:
*/
struct gl_client_array *
_ac_import_texcoord( GLcontext *ctx,
GLuint unit,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
ASSERT(unit < MAX_TEXTURE_COORD_UNITS);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_TEXCOORD(unit))
reset_texcoord( ctx, unit );
/* Is the request impossible?
*/
if (reqsize != 0 && ac->Raw.TexCoord[unit].Size > (GLint) reqsize)
return NULL;
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.TexCoord[unit].Type != type ||
(reqstride != 0 && ac->Raw.TexCoord[unit].StrideB != (GLint)reqstride) ||
reqwriteable)
{
if (!ac->IsCached.TexCoord[unit])
import_texcoord(ctx, unit, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.TexCoord[unit];
}
else {
*writeable = GL_FALSE;
return &ac->Raw.TexCoord[unit];
}
}
struct gl_client_array *
_ac_import_vertex( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_VERTEX)
reset_vertex( ctx );
/* Is the request impossible?
*/
if (reqsize != 0 && ac->Raw.Vertex.Size > (GLint) reqsize)
return NULL;
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.Vertex.Type != type ||
(reqstride != 0 && ac->Raw.Vertex.StrideB != (GLint) reqstride) ||
reqwriteable)
{
if (!ac->IsCached.Vertex)
import_vertex(ctx, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.Vertex;
}
else {
*writeable = GL_FALSE;
return &ac->Raw.Vertex;
}
}
struct gl_client_array *
_ac_import_normal( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_NORMAL)
reset_normal( ctx );
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.Normal.Type != type ||
(reqstride != 0 && ac->Raw.Normal.StrideB != (GLint) reqstride) ||
reqwriteable)
{
if (!ac->IsCached.Normal)
import_normal(ctx, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.Normal;
}
else {
*writeable = GL_FALSE;
return &ac->Raw.Normal;
}
}
struct gl_client_array *
_ac_import_color( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_COLOR0)
reset_color( ctx );
/* Is the request impossible?
*/
if (reqsize != 0 && ac->Raw.Color.Size > (GLint) reqsize) {
return NULL;
}
/* Do we need to pull in a copy of the client data:
*/
if ((type != 0 && ac->Raw.Color.Type != type) ||
(reqstride != 0 && ac->Raw.Color.StrideB != (GLint) reqstride) ||
reqwriteable)
{
if (!ac->IsCached.Color) {
import_color(ctx, type, reqstride );
}
*writeable = GL_TRUE;
return &ac->Cache.Color;
}
else {
*writeable = GL_FALSE;
return &ac->Raw.Color;
}
}
struct gl_client_array *
_ac_import_index( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_INDEX)
reset_index( ctx );
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.Index.Type != type ||
(reqstride != 0 && ac->Raw.Index.StrideB != (GLint) reqstride) ||
reqwriteable)
{
if (!ac->IsCached.Index)
import_index(ctx, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.Index;
}
else {
*writeable = GL_FALSE;
return &ac->Raw.Index;
}
}
struct gl_client_array *
_ac_import_secondarycolor( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_COLOR1)
reset_secondarycolor( ctx );
/* Is the request impossible?
*/
if (reqsize != 0 && ac->Raw.SecondaryColor.Size > (GLint) reqsize)
return NULL;
/* Do we need to pull in a copy of the client data:
*/
if ((type != 0 && ac->Raw.SecondaryColor.Type != type) ||
(reqstride != 0 && ac->Raw.SecondaryColor.StrideB != (GLint)reqstride) ||
reqwriteable)
{
if (!ac->IsCached.SecondaryColor)
import_secondarycolor(ctx, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.SecondaryColor;
}
else {
*writeable = GL_FALSE;
return &ac->Raw.SecondaryColor;
}
}
struct gl_client_array *
_ac_import_fogcoord( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_FOGCOORD)
reset_fogcoord( ctx );
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.FogCoord.Type != type ||
(reqstride != 0 && ac->Raw.FogCoord.StrideB != (GLint) reqstride) ||
reqwriteable)
{
if (!ac->IsCached.FogCoord)
import_fogcoord(ctx, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.FogCoord;
}
else {
*writeable = GL_FALSE;
return &ac->Raw.FogCoord;
}
}
struct gl_client_array *
_ac_import_edgeflag( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_EDGEFLAG)
reset_edgeflag( ctx );
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.EdgeFlag.Type != type ||
(reqstride != 0 && ac->Raw.EdgeFlag.StrideB != (GLint) reqstride) ||
reqwriteable)
{
if (!ac->IsCached.EdgeFlag)
import_edgeflag(ctx, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.EdgeFlag;
}
else {
*writeable = GL_FALSE;
return &ac->Raw.EdgeFlag;
}
}
/**
* For GL_ARB/NV_vertex_program
* \param index index of the vertex array, starting at zero.
*/
struct gl_client_array *
_ac_import_attrib( GLcontext *ctx,
GLuint index,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwriteable,
GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
ASSERT(index < VERT_ATTRIB_MAX);
/* Can we keep the existing version?
*/
if (ac->NewArrayState & _NEW_ARRAY_ATTRIB(index))
reset_attrib( ctx, index );
/* Is the request impossible?
*/
if (reqsize != 0 && ac->Raw.Attrib[index].Size > (GLint) reqsize)
return NULL;
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.Attrib[index].Type != type ||
(reqstride != 0 && ac->Raw.Attrib[index].StrideB != (GLint)reqstride) ||
reqwriteable)
{
if (!ac->IsCached.Attrib[index])
import_attrib(ctx, index, type, reqstride );
*writeable = GL_TRUE;
return &ac->Cache.Attrib[index];
}
else {
*writeable = GL_FALSE;
return &ac->Raw.Attrib[index];
}
}
/* Clients must call this function to validate state and set bounds
* before importing any data:
*/
void
_ac_import_range( GLcontext *ctx, GLuint start, GLuint count )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (!ctx->Array.LockCount) {
/* Not locked, discard cached data. Changes to lock
* status are caught via. _ac_invalidate_state().
*/
ac->NewArrayState = _NEW_ARRAY_ALL;
ac->start = start;
ac->count = count;
}
else {
/* Locked, discard data for any disabled arrays. Require that
* the whole locked range always be dealt with, otherwise hard to
* maintain cached data in the face of clipping.
*/
ac->NewArrayState |= ~ctx->Array.ArrayObj->_Enabled;
ac->start = ctx->Array.LockFirst;
ac->count = ctx->Array.LockCount;
ASSERT(ac->start == start); /* hmm? */
ASSERT(ac->count == count);
}
}
/* Additional convienence function for importing the element list
* for glDrawElements() and glDrawRangeElements().
*/
CONST void *
_ac_import_elements( GLcontext *ctx,
GLenum new_type,
GLuint count,
GLenum old_type,
CONST void *indices )
{
ACcontext *ac = AC_CONTEXT(ctx);
if (old_type == new_type)
return indices;
if (ac->elt_size < count * sizeof(GLuint)) {
if (ac->Elts) FREE(ac->Elts);
while (ac->elt_size < count * sizeof(GLuint))
ac->elt_size *= 2;
ac->Elts = (GLuint *) MALLOC(ac->elt_size);
}
switch (new_type) {
case GL_UNSIGNED_BYTE:
ASSERT(0);
return NULL;
case GL_UNSIGNED_SHORT:
ASSERT(0);
return NULL;
case GL_UNSIGNED_INT: {
GLuint *out = (GLuint *)ac->Elts;
GLuint i;
switch (old_type) {
case GL_UNSIGNED_BYTE: {
CONST GLubyte *in = (CONST GLubyte *)indices;
for (i = 0 ; i < count ; i++)
out[i] = in[i];
break;
}
case GL_UNSIGNED_SHORT: {
CONST GLushort *in = (CONST GLushort *)indices;
for (i = 0 ; i < count ; i++)
out[i] = in[i];
break;
}
default:
ASSERT(0);
}
return (CONST void *)out;
}
default:
ASSERT(0);
break;
}
return NULL;
}

View file

@ -1,132 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 4.1
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#ifndef _ARRAYCACHE_H
#define _ARRAYCACHE_H
#include "mtypes.h"
extern GLboolean
_ac_CreateContext( GLcontext *ctx );
extern void
_ac_DestroyContext( GLcontext *ctx );
extern void
_ac_InvalidateState( GLcontext *ctx, GLuint new_state );
extern struct gl_client_array *
_ac_import_vertex( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_normal( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_color( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_index( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_secondarycolor( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_fogcoord( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_edgeflag( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_texcoord( GLcontext *ctx,
GLuint unit,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_attrib( GLcontext *ctx,
GLuint index,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwritable,
GLboolean *writable );
/* Clients must call this function to validate state and set bounds
* before importing any data:
*/
extern void
_ac_import_range( GLcontext *ctx, GLuint start, GLuint count );
/* Additional convenience function:
*/
extern CONST void *
_ac_import_elements( GLcontext *ctx,
GLenum new_type,
GLuint count,
GLenum old_type,
CONST void *indices );
#endif

View file

@ -1,37 +0,0 @@
# Makefile for core library for VMS
# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
# Last revision : 16 June 2003
.first
define gl [---.include.gl]
define math [-.math]
define array_cache [-.array_cache]
.include [---]mms-config.
##### MACROS #####
VPATH = RCS
INCDIR = [---.include],[-.main],[-.glapi]
LIBDIR = [---.lib]
CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm
SOURCES = ac_context.c ac_import.c
OBJECTS = ac_context.obj,ac_import.obj
##### RULES #####
VERSION=Mesa V3.4
##### TARGETS #####
# Make the library
$(LIBDIR)$(GL_LIB) : $(OBJECTS)
@ library $(LIBDIR)$(GL_LIB) $(OBJECTS)
clean :
purge
delete *.obj;*
ac_context.obj : ac_context.c
ac_import.obj : ac_import.c

View file

@ -1,7 +0,0 @@
MESA_ARRAY_CACHE_SOURCES = \
ac_context.c \
ac_import.c
MESA_ARRAY_CACHE_HEADERS = \
ac_context.h \
acache.h

View file

@ -43,7 +43,7 @@ extern "C" {
#include "texobj.h"
#include "teximage.h"
#include "texstore.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "swrast/s_context.h"
@ -344,7 +344,7 @@ BGLView::BGLView(BRect rect, char *name,
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext(ctx);
_ac_CreateContext(ctx);
_vbo_CreateContext(ctx);
_tnl_CreateContext(ctx);
_swsetup_CreateContext(ctx);
_swsetup_Wakeup(ctx);
@ -830,7 +830,7 @@ void MesaDriver::UpdateState( GLcontext *ctx, GLuint new_state )
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
if (ctx->Color.DrawBuffer[0] == GL_FRONT) {

View file

@ -1,18 +1,19 @@
/*
* Copyright (C) 2004-2006 Claudio Ciccani <klan@users.sf.net>
* Copyright (C) 2004-2007 Claudio Ciccani <klan@directfb.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Based on glfbdev.c, written by Brian Paul.
@ -45,7 +46,7 @@
#include "texformat.h"
#include "teximage.h"
#include "texstore.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
@ -373,7 +374,7 @@ dfbUpdateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
}
@ -786,7 +787,7 @@ directfbgl_create_context( GLcontext *context,
}
_swrast_CreateContext( context );
_ac_CreateContext( context );
_vbo_CreateContext( context );
_tnl_CreateContext( context );
_swsetup_CreateContext( context );
_swsetup_Wakeup( context );

View file

@ -2466,10 +2466,10 @@ static const char MultiTexCoord4ivARB_names[] =
"";
#endif
#if defined(need_GL_VERSION_2_0)
static const char GetVertexAttribPointervARB_names[] =
"iip\0" /* Parameter signature */
"glGetVertexAttribPointerv\0"
#if defined(need_GL_EXT_gpu_program_parameters)
static const char ProgramLocalParameters4fvEXT_names[] =
"iiip\0" /* Parameter signature */
"glProgramLocalParameters4fvEXT\0"
"";
#endif
@ -3152,13 +3152,6 @@ static const char VertexAttribPointerNV_names[] =
"";
#endif
#if defined(need_GL_EXT_gpu_program_parameters)
static const char ProgramLocalParameters4fvEXT_names[] =
"iiip\0" /* Parameter signature */
"glProgramLocalParameters4fvEXT\0"
"";
#endif
#if defined(need_GL_EXT_framebuffer_object)
static const char GetFramebufferAttachmentParameterivEXT_names[] =
"iiip\0" /* Parameter signature */
@ -3781,9 +3774,10 @@ static const char ReplacementCodeuiColor3fVertex3fSUN_names[] =
"";
#endif
#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
static const char GetVertexAttribPointervNV_names[] =
"iip\0" /* Parameter signature */
"glGetVertexAttribPointerv\0"
"glGetVertexAttribPointervARB\0"
"glGetVertexAttribPointervNV\0"
"";
@ -5343,8 +5337,8 @@ static const struct dri_extension_function GL_EXT_framebuffer_object_functions[]
#if defined(need_GL_EXT_gpu_program_parameters)
static const struct dri_extension_function GL_EXT_gpu_program_parameters_functions[] = {
{ ProgramEnvParameters4fvEXT_names, ProgramEnvParameters4fvEXT_remap_index, -1 },
{ ProgramLocalParameters4fvEXT_names, ProgramLocalParameters4fvEXT_remap_index, -1 },
{ ProgramEnvParameters4fvEXT_names, ProgramEnvParameters4fvEXT_remap_index, -1 },
{ NULL, 0, 0 }
};
#endif
@ -6263,7 +6257,6 @@ static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
{ GetVertexAttribfvARB_names, GetVertexAttribfvARB_remap_index, -1 },
{ GetAttribLocationARB_names, GetAttribLocationARB_remap_index, -1 },
{ Uniform3ivARB_names, Uniform3ivARB_remap_index, -1 },
{ GetVertexAttribPointervARB_names, GetVertexAttribPointervARB_remap_index, -1 },
{ VertexAttrib4sARB_names, VertexAttrib4sARB_remap_index, -1 },
{ VertexAttrib2dvARB_names, VertexAttrib2dvARB_remap_index, -1 },
{ VertexAttrib2fvARB_names, VertexAttrib2fvARB_remap_index, -1 },
@ -6295,6 +6288,7 @@ static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
{ Uniform4iARB_names, Uniform4iARB_remap_index, -1 },
{ UseProgramObjectARB_names, UseProgramObjectARB_remap_index, -1 },
{ DeleteProgram_names, DeleteProgram_remap_index, -1 },
{ GetVertexAttribPointervNV_names, GetVertexAttribPointervNV_remap_index, -1 },
{ Uniform2iARB_names, Uniform2iARB_remap_index, -1 },
{ VertexAttrib4dARB_names, VertexAttrib4dARB_remap_index, -1 },
{ GetUniformLocationARB_names, GetUniformLocationARB_remap_index, -1 },

View file

@ -50,7 +50,7 @@
#include "extensions.h"
#include "framebuffer.h"
#include "renderbuffer.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
@ -93,7 +93,7 @@ update_state( GLcontext *ctx, GLuint new_state )
/* not much to do here - pass it on */
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
}
@ -365,7 +365,7 @@ fbCreateContext( const __GLcontextModes *glVisual,
/* Create module contexts */
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
_swsetup_Wakeup( ctx );
@ -399,7 +399,7 @@ fbDestroyContext( __DRIcontextPrivate *driContextPriv )
if ( fbmesa ) {
_swsetup_DestroyContext( fbmesa->glCtx );
_tnl_DestroyContext( fbmesa->glCtx );
_ac_DestroyContext( fbmesa->glCtx );
_vbo_DestroyContext( fbmesa->glCtx );
_swrast_DestroyContext( fbmesa->glCtx );
/* free the Mesa context */

View file

@ -17,7 +17,7 @@
#include "extensions.h"
#include "framebuffer.h"
#include "renderbuffer.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
@ -388,7 +388,7 @@ update_state( GLcontext *ctx, GLuint new_state )
/* not much to do here - pass it on */
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
}
@ -491,7 +491,7 @@ fbCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext sh
/* Create module contexts */
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
_swsetup_Wakeup( ctx );

View file

@ -40,7 +40,7 @@
#include "enums.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
@ -1034,7 +1034,7 @@ static void ffbDDUpdateState(GLcontext *ctx, GLuint newstate)
_swrast_InvalidateState( ctx, newstate );
_swsetup_InvalidateState( ctx, newstate );
_ac_InvalidateState( ctx, newstate );
_vbo_InvalidateState( ctx, newstate );
_tnl_InvalidateState( ctx, newstate );
if (newstate & _NEW_TEXTURE)

View file

@ -38,7 +38,7 @@
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "drivers/common/driverfuncs.h"
#include "ffb_context.h"
@ -277,7 +277,7 @@ ffbCreateContext(const __GLcontextModes *mesaVis,
/* Initialize the software rasterizer and helper modules. */
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
@ -313,7 +313,7 @@ ffbDestroyContext(__DRIcontextPrivate *driContextPriv)
_swsetup_DestroyContext( fmesa->glCtx );
_tnl_DestroyContext( fmesa->glCtx );
_ac_DestroyContext( fmesa->glCtx );
_vbo_DestroyContext( fmesa->glCtx );
_swrast_DestroyContext( fmesa->glCtx );
/* free the Mesa context */

View file

@ -28,7 +28,7 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
@ -147,7 +147,7 @@ GLboolean gammaCreateContext( const __GLcontextModes *glVisual,
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );

View file

@ -33,7 +33,7 @@
#include "colormac.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#define ENABLELIGHTING 0
@ -1663,7 +1663,7 @@ static void gammaDDUpdateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
GAMMA_CONTEXT(ctx)->new_gl_state |= new_state;
}

View file

@ -34,7 +34,7 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
static GLboolean
gammaInitDriver(__DRIscreenPrivate *sPriv)
@ -57,7 +57,7 @@ gammaDestroyContext(__DRIcontextPrivate *driContextPriv)
if (gmesa) {
_swsetup_DestroyContext( gmesa->glCtx );
_tnl_DestroyContext( gmesa->glCtx );
_ac_DestroyContext( gmesa->glCtx );
_vbo_DestroyContext( gmesa->glCtx );
_swrast_DestroyContext( gmesa->glCtx );
gammaFreeVB( gmesa->glCtx );

View file

@ -44,7 +44,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/t_pipeline.h"
@ -287,7 +287,7 @@ i810CreateContext( const __GLcontextModes *mesaVis,
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
@ -350,7 +350,7 @@ i810DestroyContext(__DRIcontextPrivate *driContextPriv)
release_texture_heaps = (imesa->glCtx->Shared->RefCount == 1);
_swsetup_DestroyContext( imesa->glCtx );
_tnl_DestroyContext( imesa->glCtx );
_ac_DestroyContext( imesa->glCtx );
_vbo_DestroyContext( imesa->glCtx );
_swrast_DestroyContext( imesa->glCtx );
i810FreeVB( imesa->glCtx );

View file

@ -21,8 +21,8 @@
#include "i810ioctl.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "tnl/tnl.h"
#include "vbo/vbo.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/t_pipeline.h"
@ -953,7 +953,7 @@ static void i810InvalidateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
I810_CONTEXT(ctx)->new_state |= new_state;
}

View file

@ -36,7 +36,8 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "utils.h"
#include "i915_reg.h"
@ -63,7 +64,7 @@ static void i915InvalidateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
_tnl_invalidate_vertex_state( ctx, new_state );
INTEL_CONTEXT(ctx)->NewGLState |= new_state;

View file

@ -611,10 +611,12 @@ void i915_update_fog( GLcontext *ctx )
i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_FOG_ENABLE;
}
if (enabled) {
_tnl_allow_vertex_fog( ctx, (i915->vertex_fog == I915_FOG_VERTEX) );
_tnl_allow_pixel_fog( ctx, (i915->vertex_fog != I915_FOG_VERTEX) );
}
/* always enbale pixel fog
* vertex fog use precaculted fog coord will conflict with appended
* fog program
*/
_tnl_allow_vertex_fog( ctx, 0 );
_tnl_allow_pixel_fog( ctx, 1 );
}
static void i915Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)

View file

@ -37,7 +37,7 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/t_pipeline.h"
#include "tnl/t_vertex.h"
@ -228,7 +228,7 @@ static void intelInvalidateState( GLcontext *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
_tnl_invalidate_vertex_state( ctx, new_state );
INTEL_CONTEXT(ctx)->NewGLState |= new_state;
@ -304,7 +304,7 @@ GLboolean intelInitContext( intelContextPtr intel,
/* Initialize the software rasterizer and helper modules. */
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
@ -423,7 +423,7 @@ void intelDestroyContext(__DRIcontextPrivate *driContextPriv)
release_texture_heaps = (intel->ctx.Shared->RefCount == 1);
_swsetup_DestroyContext (&intel->ctx);
_tnl_DestroyContext (&intel->ctx);
_ac_DestroyContext (&intel->ctx);
_vbo_DestroyContext (&intel->ctx);
_swrast_DestroyContext (&intel->ctx);
intel->Fallback = 0; /* don't call _swrast_Flush later */

View file

@ -36,7 +36,6 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "utils.h"
#include "i915_reg.h"
@ -67,7 +66,7 @@ i915InvalidateState(GLcontext * ctx, GLuint new_state)
{
_swrast_InvalidateState(ctx, new_state);
_swsetup_InvalidateState(ctx, new_state);
_ac_InvalidateState(ctx, new_state);
_vbo_InvalidateState(ctx, new_state);
_tnl_InvalidateState(ctx, new_state);
_tnl_invalidate_vertex_state(ctx, new_state);
intel_context(ctx)->NewGLState |= new_state;

View file

@ -243,7 +243,6 @@ struct i915_context
GLuint lodbias_ss2[MAX_TEXTURE_UNITS];
struct i915_fragment_program tex_program;
struct i915_fragment_program *current_program;
struct i915_hw_state meta, initial, state, *current;

View file

@ -520,7 +520,6 @@ update_specular(GLcontext * ctx)
/* A hack to trigger the rebuild of the fragment program.
*/
intel_context(ctx)->NewGLState |= _NEW_TEXTURE;
I915_CONTEXT(ctx)->tex_program.translated = 0;
}
static void
@ -646,10 +645,12 @@ i915_update_fog(GLcontext * ctx)
i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_FOG_ENABLE;
}
if (enabled) {
_tnl_allow_vertex_fog(ctx, (i915->vertex_fog == I915_FOG_VERTEX));
_tnl_allow_pixel_fog(ctx, (i915->vertex_fog != I915_FOG_VERTEX));
}
/* always enbale pixel fog
* vertex fog use precaculted fog coord will conflict with appended
* fog program
*/
_tnl_allow_vertex_fog( ctx, 0 );
_tnl_allow_pixel_fog( ctx, 1 );
}
static void

View file

@ -52,27 +52,6 @@ i915TexEnv(GLcontext * ctx, GLenum target,
struct i915_context *i915 = I915_CONTEXT(ctx);
switch (pname) {
case GL_TEXTURE_ENV_COLOR: /* Should be a tracked param */
case GL_TEXTURE_ENV_MODE:
case GL_COMBINE_RGB:
case GL_COMBINE_ALPHA:
case GL_SOURCE0_RGB:
case GL_SOURCE1_RGB:
case GL_SOURCE2_RGB:
case GL_SOURCE0_ALPHA:
case GL_SOURCE1_ALPHA:
case GL_SOURCE2_ALPHA:
case GL_OPERAND0_RGB:
case GL_OPERAND1_RGB:
case GL_OPERAND2_RGB:
case GL_OPERAND0_ALPHA:
case GL_OPERAND1_ALPHA:
case GL_OPERAND2_ALPHA:
case GL_RGB_SCALE:
case GL_ALPHA_SCALE:
i915->tex_program.translated = 0;
break;
case GL_TEXTURE_LOD_BIAS:{
GLuint unit = ctx->Texture.CurrentUnit;
GLint b = (int) ((*param) * 16.0);
@ -92,22 +71,8 @@ i915TexEnv(GLcontext * ctx, GLenum target,
}
static void
i915BindTexture(GLcontext * ctx, GLenum target,
struct gl_texture_object *texobj)
{
/* Need this if image format changes between bound textures.
* Could try and shortcircuit by checking for differences in
* state between incoming and outgoing textures:
*/
I915_CONTEXT(ctx)->tex_program.translated = 0;
}
void
i915InitTextureFuncs(struct dd_function_table *functions)
{
functions->BindTexture = i915BindTexture;
functions->TexEnv = i915TexEnv;
}

View file

@ -62,15 +62,23 @@ i915_miptree_layout(struct intel_mipmap_tree * mt)
case GL_TEXTURE_CUBE_MAP:{
const GLuint dim = mt->width0;
GLuint face;
GLuint lvlWidth = mt->width0, lvlHeight = mt->height0;
assert(lvlWidth == lvlHeight); /* cubemap images are square */
/* double pitch for cube layouts */
mt->pitch = ((dim * mt->cpp * 2 + 3) & ~3) / mt->cpp;
mt->total_height = dim * 4;
for (level = mt->first_level; level <= mt->last_level; level++)
for (level = mt->first_level; level <= mt->last_level; level++) {
intel_miptree_set_level_info(mt, level, 6,
0, 0,
mt->pitch, mt->total_height, 1);
/*OLD: mt->pitch, mt->total_height,*/
lvlWidth, lvlHeight,
1);
lvlWidth /= 2;
lvlHeight /= 2;
}
for (face = 0; face < 6; face++) {
GLuint x = initial_offsets[face][0] * dim;

View file

@ -311,7 +311,7 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
struct _DriBufferObject *buffer,
GLuint flags, GLuint mask, GLuint delta)
{
assert(batch->nr_relocs <= MAX_RELOCS);
assert(batch->nr_relocs < MAX_RELOCS);
driBOAddListItem(&batch->list, buffer, flags, mask);

View file

@ -9,7 +9,7 @@ struct intel_context;
#define BATCH_SZ 16384
#define BATCH_RESERVED 16
#define MAX_RELOCS 100
#define MAX_RELOCS 400
#define INTEL_BATCH_NO_CLIPRECTS 0x1
#define INTEL_BATCH_CLIPRECTS 0x2

View file

@ -50,7 +50,10 @@ intel_bufferobj_alloc(GLcontext * ctx, GLuint name, GLenum target)
_mesa_initialize_buffer_object(&obj->Base, name, target);
driGenBuffers(intel->intelScreen->regionPool,
"bufferobj", 1, &obj->buffer, 64, 0, 0);
"bufferobj", 1, &obj->buffer, 64,
DRM_BO_FLAG_MEM_LOCAL |
DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE,
0);
return &obj->Base;
}

View file

@ -37,7 +37,6 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "tnl/t_pipeline.h"
#include "tnl/t_vertex.h"
@ -241,7 +240,7 @@ intelInvalidateState(GLcontext * ctx, GLuint new_state)
{
_swrast_InvalidateState(ctx, new_state);
_swsetup_InvalidateState(ctx, new_state);
_ac_InvalidateState(ctx, new_state);
_vbo_InvalidateState(ctx, new_state);
_tnl_InvalidateState(ctx, new_state);
_tnl_invalidate_vertex_state(ctx, new_state);
intel_context(ctx)->NewGLState |= new_state;
@ -357,6 +356,10 @@ intelInitContext(struct intel_context *intel,
intel->driScreen = sPriv;
intel->sarea = saPriv;
intel->width = intelScreen->width;
intel->height = intelScreen->height;
intel->current_rotation = intelScreen->current_rotation;
if (!lockMutexInit) {
lockMutexInit = GL_TRUE;
_glthread_INIT_MUTEX(lockMutex);
@ -390,7 +393,7 @@ intelInitContext(struct intel_context *intel,
/* Initialize the software rasterizer and helper modules. */
_swrast_CreateContext(ctx);
_ac_CreateContext(ctx);
_vbo_CreateContext(ctx);
_tnl_CreateContext(ctx);
_swsetup_CreateContext(ctx);
@ -500,7 +503,7 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
release_texture_heaps = (intel->ctx.Shared->RefCount == 1);
_swsetup_DestroyContext(&intel->ctx);
_tnl_DestroyContext(&intel->ctx);
_ac_DestroyContext(&intel->ctx);
_vbo_DestroyContext(&intel->ctx);
_swrast_DestroyContext(&intel->ctx);
intel->Fallback = 0; /* don't call _swrast_Flush later */
@ -635,14 +638,35 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
sarea->rotation != intelScreen->current_rotation) {
intelUpdateScreenRotation(sPriv, sarea);
}
/*
* This will drop the outstanding batchbuffer on the floor
* FIXME: This should be done for all contexts?
if (sarea->width != intel->width ||
sarea->height != intel->height ||
sarea->rotation != intel->current_rotation) {
void *batchMap = intel->batch->map;
/*
* FIXME: Really only need to do this when drawing to a
* common back- or front buffer.
*/
/*
* This will drop the outstanding batchbuffer on the floor
*/
if (batchMap != NULL) {
driBOUnmap(intel->batch->buffer);
intel->batch->map = NULL;
}
intel_batchbuffer_reset(intel->batch);
if (batchMap == NULL) {
driBOUnmap(intel->batch->buffer);
intel->batch->map = NULL;
}
/* lose all primitives */
intel->prim.primitive = ~0;
intel->prim.start_ptr = 0;
@ -653,6 +677,10 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
/* force window update */
intel->lastStamp = 0;
intel->width = sarea->width;
intel->height = sarea->height;
intel->current_rotation = sarea->rotation;
}

View file

@ -286,6 +286,15 @@ struct intel_context
GLuint swap_missed_count;
GLuint swap_scheduled;
/* Rotation. Need to match that of the
* current screen.
*/
int width;
int height;
int current_rotation;
};
/* These are functions now:

View file

@ -309,8 +309,13 @@ intel_miptree_image_data(struct intel_context *intel,
height = dst->level[level].height;
if(dst->compressed)
height /= 4;
intel_region_data(intel->intelScreen, dst->region, dst_offset + dst_depth_offset[i], 0, 0, src, src_row_pitch, 0, 0, /* source x,y */
dst->level[level].width, height);
intel_region_data(intel->intelScreen, dst->region,
dst_offset + dst_depth_offset[i], /* dst_offset */
0, 0, /* dstx, dsty */
src,
src_row_pitch,
0, 0, /* source x, y */
dst->level[level].width, height); /* width, height */
src += src_image_pitch;
}

View file

@ -217,7 +217,8 @@ _mesa_copy_rect(GLubyte * dst,
GLuint dst_y,
GLuint width,
GLuint height,
GLubyte * src, GLuint src_pitch, GLuint src_x, GLuint src_y)
const GLubyte * src,
GLuint src_pitch, GLuint src_x, GLuint src_y)
{
GLuint i;
@ -253,7 +254,7 @@ intel_region_data(intelScreenPrivate *intelScreen,
struct intel_region *dst,
GLuint dst_offset,
GLuint dstx, GLuint dsty,
void *src, GLuint src_pitch,
const void *src, GLuint src_pitch,
GLuint srcx, GLuint srcy, GLuint width, GLuint height)
{
struct intel_context *intel = intelScreenContext(intelScreen);

View file

@ -103,7 +103,7 @@ void intel_region_data(intelScreenPrivate *intelScreen,
struct intel_region *dest,
GLuint dest_offset,
GLuint destx, GLuint desty,
void *src, GLuint src_stride,
const void *src, GLuint src_stride,
GLuint srcx, GLuint srcy, GLuint width, GLuint height);
/* Copy rectangular sub-regions

View file

@ -110,6 +110,8 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
GLuint nr_faces = 0;
struct intel_texture_image *firstImage;
GLboolean need_flush = GL_FALSE;
/* We know/require this is true by now:
*/
assert(intelObj->base.Complete);
@ -201,11 +203,13 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
*/
if (intelObj->mt != intelImage->mt) {
copy_image_data_to_tree(intel, intelObj, intelImage);
need_flush = GL_TRUE;
}
}
}
intel_batchbuffer_flush(intel->batch);
if (need_flush)
intel_batchbuffer_flush(intel->batch);
return GL_TRUE;
}

View file

@ -35,17 +35,11 @@ DRIVER_SOURCES = \
brw_context.c \
brw_curbe.c \
brw_draw.c \
brw_draw_current.c \
brw_draw_upload.c \
brw_eu.c \
brw_eu_debug.c \
brw_eu_emit.c \
brw_eu_util.c \
brw_exec.c \
brw_exec_api.c \
brw_exec_array.c \
brw_exec_draw.c \
brw_exec_eval.c \
brw_fallback.c \
brw_gs.c \
brw_gs_emit.c \
@ -54,9 +48,6 @@ DRIVER_SOURCES = \
brw_metaops.c \
brw_misc_state.c \
brw_program.c \
brw_save.c \
brw_save_api.c \
brw_save_draw.c \
brw_sf.c \
brw_sf_emit.c \
brw_sf_state.c \

View file

@ -116,7 +116,7 @@ struct brw_clip_compile {
GLuint last_mrf;
GLuint header_position_offset;
GLuint offset[BRW_ATTRIB_MAX];
GLuint offset[VERT_ATTRIB_MAX];
};
#define ATTR_SIZE (4*4)

View file

@ -34,8 +34,6 @@
#include "brw_aub.h"
#include "brw_defines.h"
#include "brw_draw.h"
#include "brw_exec.h"
#include "brw_save.h"
#include "brw_vs.h"
#include "imports.h"
#include "intel_tex.h"
@ -158,12 +156,6 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
brw_FrameBufferTexInit( brw );
/* Hook our functions into exec and compile dispatch tables. Only
* fallback on out-of-memory situations.
*/
brw_exec_init( ctx );
brw_save_init( ctx );
{
const char *filename = getenv("INTEL_REPLAY");
if (filename) {

View file

@ -36,7 +36,6 @@
#include "intel_context.h"
#include "brw_structs.h"
#include "imports.h"
#include "brw_attrib.h"
/* Glossary:
@ -215,7 +214,7 @@ struct brw_vs_prog_data {
GLuint total_grf;
GLuint outputs_written;
GLuint64EXT inputs_read;
GLuint inputs_read;
/* Used for calculating urb partitions:
*/
@ -382,10 +381,10 @@ struct brw_cached_batch_item {
/* Protect against a future where BRW_ATTRIB_MAX > 32. Wouldn't life
/* Protect against a future where VERT_ATTRIB_MAX > 32. Wouldn't life
* be easier if C allowed arrays of packed elements?
*/
#define ATTRIB_BIT_DWORDS ((BRW_ATTRIB_MAX+31)/32)
#define ATTRIB_BIT_DWORDS ((VERT_ATTRIB_MAX+31)/32)
struct brw_vertex_element {
const struct gl_client_array *glarray;
@ -401,8 +400,8 @@ struct brw_vertex_element {
struct brw_vertex_info {
GLuint64EXT varying; /* varying:1[BRW_ATTRIB_MAX] */
GLuint sizes[ATTRIB_BIT_DWORDS * 2]; /* sizes:2[BRW_ATTRIB_MAX] */
GLuint varying; /* varying:1[VERT_ATTRIB_MAX] */
GLuint sizes[ATTRIB_BIT_DWORDS * 2]; /* sizes:2[VERT_ATTRIB_MAX] */
};
@ -449,14 +448,13 @@ struct brw_context
struct brw_cached_batch_item *cached_batch_items;
struct {
/* Fallback values for inputs not supplied:
*/
struct gl_client_array current_values[BRW_ATTRIB_MAX];
/* Arrays with buffer objects to copy non-bufferobj arrays into
* for upload:
*/
struct gl_client_array vbo_array[BRW_ATTRIB_MAX];
struct gl_client_array vbo_array[VERT_ATTRIB_MAX];
struct brw_vertex_element inputs[VERT_ATTRIB_MAX];
#define BRW_NR_UPLOAD_BUFS 17
#define BRW_UPLOAD_INIT_SIZE (128*1024)
@ -469,11 +467,6 @@ struct brw_context
GLuint wrap;
} upload;
/* Currenly bound arrays, including fallbacks to current_values
* above:
*/
struct brw_vertex_element inputs[BRW_ATTRIB_MAX];
/* Summary of size and varying of active arrays, so we can check
* for changes to this state:
*/

View file

@ -35,7 +35,6 @@
#include "brw_draw.h"
#include "brw_defines.h"
#include "brw_attrib.h"
#include "brw_context.h"
#include "brw_aub.h"
#include "brw_state.h"
@ -45,7 +44,8 @@
#include "intel_batchbuffer.h"
#include "intel_buffer_objects.h"
#include "tnl/tnl.h"
#include "vbo/vbo_context.h"
@ -143,7 +143,7 @@ static void brw_emit_cliprect( struct brw_context *brw,
static void brw_emit_prim( struct brw_context *brw,
const struct brw_draw_prim *prim )
const struct _mesa_prim *prim )
{
struct brw_3d_primitive prim_packet;
@ -170,34 +170,9 @@ static void brw_emit_prim( struct brw_context *brw,
}
}
static void update_current_size( struct gl_client_array *array)
{
const GLfloat *ptr = (const GLfloat *)array->Ptr;
assert(array->StrideB == 0);
assert(array->Type == GL_FLOAT || array->Type == GL_UNSIGNED_BYTE);
if (ptr[3] != 1.0)
array->Size = 4;
else if (ptr[2] != 0.0)
array->Size = 3;
else if (ptr[1] != 0.0)
array->Size = 2;
else
array->Size = 1;
}
/* Fill in any gaps in passed arrays with pointers to current
* attributes:
*/
static void brw_merge_inputs( struct brw_context *brw,
const struct gl_client_array *arrays[])
{
struct gl_client_array *current_values = brw->vb.current_values;
struct brw_vertex_element *inputs = brw->vb.inputs;
struct brw_vertex_info old = brw->vb.info;
GLuint i;
@ -205,19 +180,16 @@ static void brw_merge_inputs( struct brw_context *brw,
memset(inputs, 0, sizeof(*inputs));
memset(&brw->vb.info, 0, sizeof(brw->vb.info));
for (i = 0; i < BRW_ATTRIB_MAX; i++) {
if (arrays[i] && arrays[i]->Enabled)
{
brw->vb.inputs[i].glarray = arrays[i];
brw->vb.info.varying |= (GLuint64EXT) 1 << i;
}
else
{
brw->vb.inputs[i].glarray = &current_values[i];
update_current_size(&current_values[i]);
}
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
brw->vb.inputs[i].glarray = arrays[i];
brw->vb.info.sizes[i/16] |= (inputs[i].glarray->Size - 1) << ((i%16) * 2);
/* XXX: metaops passes null arrays */
if (arrays[i]) {
if (arrays[i]->StrideB != 0)
brw->vb.info.varying |= 1 << i;
brw->vb.info.sizes[i/16] |= (inputs[i].glarray->Size - 1) << ((i%16) * 2);
}
}
/* Raise statechanges if input sizes and varying have changed:
@ -229,8 +201,11 @@ static void brw_merge_inputs( struct brw_context *brw,
brw->state.dirty.brw |= BRW_NEW_INPUT_VARYING;
}
/* XXX: could split the primitive list to fallback only on the
* non-conformant primitives.
*/
static GLboolean check_fallbacks( struct brw_context *brw,
const struct brw_draw_prim *prim,
const struct _mesa_prim *prim,
GLuint nr_prims )
{
GLuint i;
@ -281,15 +256,16 @@ static GLboolean check_fallbacks( struct brw_context *brw,
return GL_FALSE;
}
/* May fail if out of video memory for texture or vbo upload, or on
* fallback conditions.
*/
static GLboolean brw_try_draw_prims( GLcontext *ctx,
const struct gl_client_array *arrays[],
const struct brw_draw_prim *prim,
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct brw_draw_index_buffer *ib,
const struct _mesa_index_buffer *ib,
GLuint min_index,
GLuint max_index,
GLuint flags )
GLuint max_index )
{
struct intel_context *intel = intel_context(ctx);
struct brw_context *brw = brw_context(ctx);
@ -298,11 +274,11 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
if (ctx->NewState)
_mesa_update_state( ctx );
/* Bind all inputs, derive varying and size information:
*/
brw_merge_inputs( brw, arrays );
/* Have to validate state quite late. Will rebuild tnl_program,
* which depends on varying information.
*
@ -319,10 +295,6 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
}
{
assert(intel->locked);
/* Set the first primitive early, ahead of validate_state:
*/
brw_set_prim(brw, prim[0].mode);
@ -411,44 +383,88 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
return retval;
}
static GLboolean brw_need_rebase( GLcontext *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_index_buffer *ib,
GLuint min_index )
{
if (min_index == 0)
return GL_FALSE;
GLboolean brw_draw_prims( GLcontext *ctx,
const struct gl_client_array *arrays[],
const struct brw_draw_prim *prim,
GLuint nr_prims,
const struct brw_draw_index_buffer *ib,
GLuint min_index,
GLuint max_index,
GLuint flags )
if (ib) {
if (!vbo_all_varyings_in_vbos(arrays))
return GL_TRUE;
else
return GL_FALSE;
}
else {
/* Hmm. This isn't quite what I wanted. BRW can actually
* handle the mixed case well enough that we shouldn't need to
* rebase. However, it's probably not very common, nor hugely
* expensive to do it this way:
*/
if (!vbo_all_varyings_in_vbos(arrays))
return GL_TRUE;
else
return GL_FALSE;
}
}
void brw_draw_prims( GLcontext *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLuint min_index,
GLuint max_index )
{
struct intel_context *intel = intel_context(ctx);
GLboolean retval;
retval = brw_try_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index, flags);
/* Decide if we want to rebase. If so we end up recursing once
* only into this function.
*/
if (brw_need_rebase( ctx, arrays, ib, min_index )) {
vbo_rebase_prims( ctx, arrays,
prim, nr_prims,
ib, min_index, max_index,
brw_draw_prims );
return;
}
/* Make a first attempt at drawing:
*/
retval = brw_try_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
if (!retval && bmError(intel)) {
/* This looks like out-of-memory but potentially we have
* situation where there is enough memory but it has become
* fragmented. Clear out all heaps and start from scratch by
* faking a contended lock event: (done elsewhere)
*/
if (!retval && !intel->Fallback && bmError(intel)) {
DBG("retrying\n");
/* This looks like out-of-memory but potentially we have
* situation where there is enough memory but it has become
* fragmented. Clear out all heaps and start from scratch by
* faking a contended lock event: (done elsewhere)
*/
/* Then try a second time only to upload textures and draw the
* primitives:
*/
retval = brw_try_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index, flags);
retval = brw_try_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
}
/* Otherwise, we really are out of memory. Pass the drawing
* command to the software tnl module and which will in turn call
* swrast to do the drawing.
*/
if (!retval) {
_tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
}
if (intel->aub_file && (INTEL_DEBUG & DEBUG_SYNC)) {
intelFinish( &intel->ctx );
intel->aub_wrap = 1;
}
return retval;
}
@ -461,21 +477,25 @@ static void brw_invalidate_vbo_cb( struct intel_context *intel, void *ptr )
void brw_draw_init( struct brw_context *brw )
{
GLcontext *ctx = &brw->intel.ctx;
struct vbo_context *vbo = vbo_context(ctx);
GLuint i;
/* Register our drawing function:
*/
vbo->draw_prims = brw_draw_prims;
brw->vb.upload.size = BRW_UPLOAD_INIT_SIZE;
for (i = 0; i < BRW_NR_UPLOAD_BUFS; i++) {
brw->vb.upload.vbo[i] = ctx->Driver.NewBufferObject(ctx, 1, GL_ARRAY_BUFFER_ARB);
/* XXX: Set these to no-backing-store
/* NOTE: These are set to no-backing-store.
*/
bmBufferSetInvalidateCB(&brw->intel,
intel_bufferobj_buffer(intel_buffer_object(brw->vb.upload.vbo[i])),
brw_invalidate_vbo_cb,
&brw->intel,
GL_TRUE);
}
ctx->Driver.BufferData( ctx,
@ -484,9 +504,6 @@ void brw_draw_init( struct brw_context *brw )
NULL,
GL_DYNAMIC_DRAW_ARB,
brw->vb.upload.vbo[0] );
brw_init_current_values(ctx, brw->vb.current_values);
}
void brw_draw_destroy( struct brw_context *brw )

View file

@ -29,44 +29,18 @@
#define BRW_DRAW_H
#include "mtypes.h" /* for GLcontext... */
#include "brw_attrib.h"
#include "vbo/vbo.h"
struct brw_context;
struct brw_draw_prim {
GLuint mode:8;
GLuint indexed:1;
GLuint begin:1;
GLuint end:1;
GLuint weak:1;
GLuint pad:20;
GLuint start;
GLuint count;
};
struct brw_draw_index_buffer {
GLuint count;
GLenum type;
struct gl_buffer_object *obj;
const void *ptr;
GLuint rebase;
};
#define BRW_DRAW_SORTED 0x1
#define BRW_DRAW_ALL_INTERLEAVED 0x2
#define BRW_DRAW_NON_INTERLEAVED 0x4
#define BRW_DRAW_LOCKED 0x8
GLboolean brw_draw_prims( GLcontext *ctx,
const struct gl_client_array *arrays[],
const struct brw_draw_prim *prims,
GLuint nr_prims,
const struct brw_draw_index_buffer *ib,
GLuint min_index,
GLuint max_index,
GLuint flags );
void brw_draw_prims( GLcontext *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prims,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLuint min_index,
GLuint max_index );
void brw_draw_init( struct brw_context *brw );
void brw_draw_destroy( struct brw_context *brw );
@ -80,25 +54,12 @@ void brw_init_current_values(GLcontext *ctx,
/* brw_draw_upload.c
*/
void brw_upload_indices( struct brw_context *brw,
const struct brw_draw_index_buffer *index_buffer);
const struct _mesa_index_buffer *index_buffer);
GLboolean brw_upload_vertices( struct brw_context *brw,
GLuint min_index,
GLuint max_index );
/* Helpers for save, exec. Should probably have their own file:
*/
struct brw_exec_context;
struct brw_save_context;
struct brw_exec_save {
struct brw_exec_context *exec;
struct brw_save_context *save;
};
/* Doesn't really belong here:
*/
#define IMM_CONTEXT(ctx) ((struct brw_exec_save *)((ctx)->swtnl_im))
#endif

View file

@ -1,103 +0,0 @@
/**************************************************************************
*
* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include <stdlib.h>
#include "glheader.h"
#include "context.h"
#include "state.h"
#include "api_validate.h"
#include "enums.h"
#include "brw_context.h"
#include "brw_draw.h"
#include "bufmgr.h"
#include "intel_buffer_objects.h"
void brw_init_current_values(GLcontext *ctx,
struct gl_client_array *arrays)
{
GLuint i;
memset(arrays, 0, sizeof(*arrays) * BRW_ATTRIB_MAX);
/* Set up a constant (StrideB == 0) array for each current
* attribute:
*/
for (i = 0; i < BRW_ATTRIB_MAX; i++) {
struct gl_client_array *cl = &arrays[i];
switch (i) {
case BRW_ATTRIB_MAT_FRONT_SHININESS:
case BRW_ATTRIB_MAT_BACK_SHININESS:
case BRW_ATTRIB_INDEX:
case BRW_ATTRIB_EDGEFLAG:
cl->Size = 1;
break;
case BRW_ATTRIB_MAT_FRONT_INDEXES:
case BRW_ATTRIB_MAT_BACK_INDEXES:
cl->Size = 3;
break;
default:
/* This is fixed for the material attributes, for others will
* be determined at runtime:
*/
if (i >= BRW_ATTRIB_MAT_FRONT_AMBIENT)
cl->Size = 4;
else
cl->Size = 1;
break;
}
switch (i) {
case BRW_ATTRIB_EDGEFLAG:
cl->Type = GL_UNSIGNED_BYTE;
cl->Ptr = (const void *)&ctx->Current.EdgeFlag;
break;
case BRW_ATTRIB_INDEX:
cl->Type = GL_FLOAT;
cl->Ptr = (const void *)&ctx->Current.Index;
break;
default:
cl->Type = GL_FLOAT;
if (i < BRW_ATTRIB_FIRST_MATERIAL)
cl->Ptr = (const void *)ctx->Current.Attrib[i];
else
cl->Ptr = (const void *)ctx->Light.Material.Attrib[i - BRW_ATTRIB_FIRST_MATERIAL];
break;
}
cl->Stride = 0;
cl->StrideB = 0;
cl->Enabled = 1;
cl->Flags = 0;
cl->BufferObj = ctx->Array.NullBufferObj;
}
}

View file

@ -35,7 +35,6 @@
#include "brw_draw.h"
#include "brw_defines.h"
#include "brw_attrib.h"
#include "brw_context.h"
#include "brw_aub.h"
#include "brw_state.h"
@ -310,7 +309,6 @@ copy_array_to_vbo_array( struct brw_context *brw,
GLuint i,
const struct gl_client_array *array,
GLuint element_size,
GLuint min_index,
GLuint count)
{
GLcontext *ctx = &brw->intel.ctx;
@ -337,7 +335,6 @@ copy_array_to_vbo_array( struct brw_context *brw,
vbo_array->Enabled = 1;
vbo_array->Normalized = array->Normalized;
vbo_array->_MaxElement = array->_MaxElement; /* ? */
vbo_array->Flags = array->Flags; /* ? */
vbo_array->BufferObj = vbo;
{
@ -349,7 +346,7 @@ copy_array_to_vbo_array( struct brw_context *brw,
map += offset;
copy_strided_array( map,
array->Ptr + min_index * array->StrideB,
array->Ptr,
element_size,
array->StrideB,
count);
@ -380,7 +377,6 @@ interleaved_vbo_array( struct brw_context *brw,
vbo_array->Enabled = 1;
vbo_array->Normalized = array->Normalized;
vbo_array->_MaxElement = array->_MaxElement;
vbo_array->Flags = array->Flags; /* ? */
vbo_array->BufferObj = uploaded_array->BufferObj;
return vbo_array;
@ -393,17 +389,17 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
{
GLcontext *ctx = &brw->intel.ctx;
struct intel_context *intel = intel_context(ctx);
GLuint64EXT tmp = brw->vs.prog_data->inputs_read;
GLuint tmp = brw->vs.prog_data->inputs_read;
struct brw_vertex_element_packet vep;
struct brw_array_state vbp;
GLuint i;
const void *ptr = NULL;
GLuint interleave = 0;
struct brw_vertex_element *enabled[BRW_ATTRIB_MAX];
struct brw_vertex_element *enabled[VERT_ATTRIB_MAX];
GLuint nr_enabled = 0;
struct brw_vertex_element *upload[BRW_ATTRIB_MAX];
struct brw_vertex_element *upload[VERT_ATTRIB_MAX];
GLuint nr_uploads = 0;
@ -412,17 +408,19 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
/* First build an array of pointers to ve's in vb.inputs_read
*/
if (0)
_mesa_printf("%s %d..%d\n", __FUNCTION__, min_index, max_index);
while (tmp) {
GLuint i = ffsll(tmp)-1;
GLuint i = _mesa_ffsll(tmp)-1;
struct brw_vertex_element *input = &brw->vb.inputs[i];
tmp &= ~((GLuint64EXT)1<<i);
tmp &= ~(1<<i);
enabled[nr_enabled++] = input;
input->index = i;
input->element_size = get_size(input->glarray->Type) * input->glarray->Size;
input->count = input->glarray->StrideB ? max_index - min_index : 1;
input->count = input->glarray->StrideB ? max_index + 1 - min_index : 1;
if (!input->glarray->BufferObj->Name) {
if (i == 0) {
@ -441,10 +439,16 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
}
upload[nr_uploads++] = input;
input->vbo_rebase_offset = 0;
/* We rebase drawing to start at element zero only when
* varyings are not in vbos, which means we can end up
* uploading non-varying arrays (stride != 0) when min_index
* is zero. This doesn't matter as the amount to upload is
* the same for these arrays whether the draw call is rebased
* or not - we just have to upload the one element.
*/
assert(min_index == 0 || input->glarray->StrideB == 0);
}
else
input->vbo_rebase_offset = min_index * input->glarray->StrideB;
}
/* Upload interleaved arrays if all uploads are interleaved
@ -457,7 +461,6 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
input0->glarray = copy_array_to_vbo_array(brw, 0,
input0->glarray,
interleave,
min_index,
input0->count);
for (i = 1; i < nr_uploads; i++) {
@ -475,7 +478,6 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
input->glarray = copy_array_to_vbo_array(brw, i,
input->glarray,
input->element_size,
min_index,
input->count);
}
@ -523,9 +525,9 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
vbp.vb[i].vb0.bits.pad = 0;
vbp.vb[i].vb0.bits.access_type = BRW_VERTEXBUFFER_ACCESS_VERTEXDATA;
vbp.vb[i].vb0.bits.vb_index = i;
vbp.vb[i].offset = (GLuint)input->glarray->Ptr + input->vbo_rebase_offset;
vbp.vb[i].offset = (GLuint)input->glarray->Ptr;
vbp.vb[i].buffer = array_buffer(input->glarray);
vbp.vb[i].max_index = max_index - min_index;
vbp.vb[i].max_index = max_index;
}
@ -566,93 +568,31 @@ static GLuint element_size( GLenum type )
static void rebase_indices_to_vbo_indices( struct brw_context *brw,
const struct brw_draw_index_buffer *index_buffer,
struct gl_buffer_object **vbo_return,
GLuint *offset_return )
void brw_upload_indices( struct brw_context *brw,
const struct _mesa_index_buffer *index_buffer )
{
GLcontext *ctx = &brw->intel.ctx;
GLuint min_index = index_buffer->rebase;
const void *indices = index_buffer->ptr;
GLsizei count = index_buffer->count;
GLenum type = index_buffer->type;
GLuint size = element_size(type) * count;
struct gl_buffer_object *bufferobj;
GLuint offset;
GLuint i;
get_space(brw, size, &bufferobj, &offset);
*vbo_return = bufferobj;
*offset_return = offset;
if (min_index == 0) {
/* Straight upload
*/
ctx->Driver.BufferSubData( ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
offset,
size,
indices,
bufferobj);
}
else {
void *map = ctx->Driver.MapBuffer(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
GL_DYNAMIC_DRAW_ARB,
bufferobj);
map += offset;
switch (type) {
case GL_UNSIGNED_INT: {
GLuint *ui_map = (GLuint *)map;
const GLuint *ui_indices = (const GLuint *)indices;
for (i = 0; i < count; i++)
ui_map[i] = ui_indices[i] - min_index;
break;
}
case GL_UNSIGNED_SHORT: {
GLushort *us_map = (GLushort *)map;
const GLushort *us_indices = (const GLushort *)indices;
for (i = 0; i < count; i++)
us_map[i] = us_indices[i] - min_index;
break;
}
case GL_UNSIGNED_BYTE: {
GLubyte *ub_map = (GLubyte *)map;
const GLubyte *ub_indices = (const GLubyte *)indices;
for (i = 0; i < count; i++)
ub_map[i] = ub_indices[i] - min_index;
break;
}
}
ctx->Driver.UnmapBuffer(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
bufferobj);
}
}
void brw_upload_indices( struct brw_context *brw,
const struct brw_draw_index_buffer *index_buffer)
{
struct intel_context *intel = &brw->intel;
GLuint ib_size = get_size(index_buffer->type) * index_buffer->count;
struct gl_buffer_object *bufferobj = index_buffer->obj;
GLuint offset = (GLuint)index_buffer->ptr;
/* Already turned into a proper VBO:
/* Turn into a proper VBO:
*/
if (!index_buffer->obj->Name) {
rebase_indices_to_vbo_indices(brw, index_buffer, &bufferobj, &offset );
if (!bufferobj->Name) {
/* Get new bufferobj, offset:
*/
get_space(brw, ib_size, &bufferobj, &offset);
/* Straight upload
*/
ctx->Driver.BufferSubData( ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
offset,
ib_size,
index_buffer->ptr,
bufferobj);
}
/* Emit the indexbuffer packet:

View file

@ -1,150 +0,0 @@
/**************************************************************************
Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
on the rights to use, copy, modify, merge, publish, distribute, sub
license, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*
*/
#ifndef __BRW_EXEC_H__
#define __BRW_EXEC_H__
#include "mtypes.h"
#include "brw_attrib.h"
#include "brw_draw.h"
#define BRW_MAX_PRIM 64
/* Wierd implementation stuff:
*/
#define BRW_VERT_BUFFER_SIZE (1024*16) /* dwords == 64k */
#define BRW_MAX_ATTR_CODEGEN 16
#define ERROR_ATTRIB 16
struct brw_exec_eval1_map {
struct gl_1d_map *map;
GLuint sz;
};
struct brw_exec_eval2_map {
struct gl_2d_map *map;
GLuint sz;
};
struct brw_exec_copied_vtx {
GLfloat buffer[BRW_ATTRIB_MAX * 4 * BRW_MAX_COPIED_VERTS];
GLuint nr;
};
typedef void (*brw_attrfv_func)( const GLfloat * );
struct brw_exec_context
{
GLcontext *ctx;
GLvertexformat vtxfmt;
struct {
struct gl_buffer_object *bufferobj;
GLubyte *buffer_map;
GLuint vertex_size;
struct brw_draw_prim prim[BRW_MAX_PRIM];
GLuint prim_count;
GLfloat *vbptr; /* cursor, points into buffer */
GLfloat vertex[BRW_ATTRIB_MAX*4]; /* current vertex */
GLfloat *current[BRW_ATTRIB_MAX]; /* points into ctx->Current, ctx->Light.Material */
GLfloat CurrentFloatEdgeFlag;
GLuint vert_count;
GLuint max_vert;
struct brw_exec_copied_vtx copied;
GLubyte attrsz[BRW_ATTRIB_MAX];
GLubyte active_sz[BRW_ATTRIB_MAX];
GLfloat *attrptr[BRW_ATTRIB_MAX];
struct gl_client_array arrays[BRW_ATTRIB_MAX];
const struct gl_client_array *inputs[BRW_ATTRIB_MAX];
} vtx;
struct {
GLboolean recalculate_maps;
struct brw_exec_eval1_map map1[BRW_ATTRIB_MAX];
struct brw_exec_eval2_map map2[BRW_ATTRIB_MAX];
} eval;
struct {
const struct gl_client_array *inputs[BRW_ATTRIB_MAX];
struct gl_buffer_object *index_obj;
} array;
};
/* External API:
*/
void brw_exec_init( GLcontext *ctx );
void brw_exec_destroy( GLcontext *ctx );
void brw_exec_invalidate_state( GLcontext *ctx, GLuint new_state );
void brw_exec_FlushVertices( GLcontext *ctx, GLuint flags );
void brw_exec_wakeup( GLcontext *ctx );
/* Internal functions:
*/
void brw_exec_array_init( struct brw_exec_context *exec );
void brw_exec_array_destroy( struct brw_exec_context *exec );
void brw_exec_vtx_init( struct brw_exec_context *exec );
void brw_exec_vtx_destroy( struct brw_exec_context *exec );
void brw_exec_vtx_flush( struct brw_exec_context *exec );
void brw_exec_vtx_wrap( struct brw_exec_context *exec );
void brw_exec_eval_update( struct brw_exec_context *exec );
void brw_exec_do_EvalCoord2f( struct brw_exec_context *exec,
GLfloat u, GLfloat v );
void brw_exec_do_EvalCoord1f( struct brw_exec_context *exec,
GLfloat u);
#endif

View file

@ -1,283 +0,0 @@
/**************************************************************************
*
* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include "glheader.h"
#include "context.h"
#include "state.h"
#include "api_validate.h"
#include "api_noop.h"
#include "dispatch.h"
#include "brw_attrib.h"
#include "brw_draw.h"
#include "brw_exec.h"
#include "brw_fallback.h"
static GLuint get_max_index( GLuint count, GLuint type,
const GLvoid *indices )
{
GLint i;
/* Compute max element. This is only needed for upload of non-VBO,
* non-constant data elements.
*
* XXX: Postpone this calculation until it is known that it is
* needed. Otherwise could scan this pointlessly in the all-vbo
* case.
*/
switch(type) {
case GL_UNSIGNED_INT: {
const GLuint *ui_indices = (const GLuint *)indices;
GLuint max_ui = 0;
for (i = 0; i < count; i++)
if (ui_indices[i] > max_ui)
max_ui = ui_indices[i];
return max_ui;
}
case GL_UNSIGNED_SHORT: {
const GLushort *us_indices = (const GLushort *)indices;
GLuint max_us = 0;
for (i = 0; i < count; i++)
if (us_indices[i] > max_us)
max_us = us_indices[i];
return max_us;
}
case GL_UNSIGNED_BYTE: {
const GLubyte *ub_indices = (const GLubyte *)indices;
GLuint max_ub = 0;
for (i = 0; i < count; i++)
if (ub_indices[i] > max_ub)
max_ub = ub_indices[i];
return max_ub;
}
default:
return 0;
}
}
/***********************************************************************
* API functions.
*/
static void GLAPIENTRY
brw_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
{
GET_CURRENT_CONTEXT(ctx);
struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec;
struct brw_draw_prim prim[1];
GLboolean ok;
if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
return;
FLUSH_CURRENT( ctx, 0 );
if (ctx->NewState)
_mesa_update_state( ctx );
prim[0].begin = 1;
prim[0].end = 1;
prim[0].weak = 0;
prim[0].pad = 0;
if (exec->array.inputs[0]->BufferObj->Name) {
/* Use vertex attribute as a hint to tell us if we expect all
* arrays to be in VBO's and if so, don't worry about avoiding
* the upload of elements < start.
*/
prim[0].mode = mode;
prim[0].start = start;
prim[0].count = count;
prim[0].indexed = 0;
ok = brw_draw_prims( ctx, exec->array.inputs, prim, 1, NULL, 0, start + count, 0 );
}
else {
/* If not using VBO's, we don't want to upload any more elements
* than necessary from the arrays as they will not be valid next
* time the application tries to draw with them.
*/
prim[0].mode = mode;
prim[0].start = 0;
prim[0].count = count;
prim[0].indexed = 0;
ok = brw_draw_prims( ctx, exec->array.inputs, prim, 1, NULL, start, start + count, 0 );
}
if (!ok) {
brw_fallback(ctx);
CALL_DrawArrays(ctx->Exec, ( mode, start, count ));
brw_unfallback(ctx);
}
}
static void GLAPIENTRY
brw_exec_DrawRangeElements(GLenum mode,
GLuint start, GLuint end,
GLsizei count, GLenum type, const GLvoid *indices)
{
GET_CURRENT_CONTEXT(ctx);
struct brw_exec_context *exec = IMM_CONTEXT(ctx)->exec;
struct brw_draw_index_buffer ib;
struct brw_draw_prim prim[1];
if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, type, indices ))
return;
FLUSH_CURRENT( ctx, 0 );
if (ctx->NewState)
_mesa_update_state( ctx );
ib.count = count;
ib.type = type;
ib.obj = ctx->Array.ElementArrayBufferObj;
ib.ptr = indices;
if (ctx->Array.ElementArrayBufferObj->Name) {
/* Use the fact that indices are in a VBO as a hint that the
* program has put all the arrays in VBO's and we don't have to
* worry about performance implications of start > 0.
*
* XXX: consider passing start as min_index to draw_prims instead.
*/
ib.rebase = 0;
}
else {
ib.rebase = start;
}
prim[0].begin = 1;
prim[0].end = 1;
prim[0].weak = 0;
prim[0].pad = 0;
prim[0].mode = mode;
prim[0].start = 0;
prim[0].count = count;
prim[0].indexed = 1;
if (!brw_draw_prims( ctx, exec->array.inputs, prim, 1, &ib, ib.rebase, end+1, 0 )) {
brw_fallback(ctx);
CALL_DrawRangeElements(ctx->Exec, (mode, start, end, count, type, indices));
brw_unfallback(ctx);
}
}
static void GLAPIENTRY
brw_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
{
GET_CURRENT_CONTEXT(ctx);
GLuint max_index;
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices ))
return;
if (ctx->Array.ElementArrayBufferObj->Name) {
const GLvoid *map = ctx->Driver.MapBuffer(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
GL_DYNAMIC_READ_ARB,
ctx->Array.ElementArrayBufferObj);
max_index = get_max_index(count, type, ADD_POINTERS(map, indices));
ctx->Driver.UnmapBuffer(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
ctx->Array.ElementArrayBufferObj);
}
else {
max_index = get_max_index(count, type, indices);
}
brw_exec_DrawRangeElements(mode, 0, max_index, count, type, indices);
}
/***********************************************************************
* Initialization
*/
static void init_arrays( GLcontext *ctx,
const struct gl_client_array *arrays[] )
{
struct gl_array_object *obj = ctx->Array.ArrayObj;
GLuint i;
memset(arrays, 0, sizeof(*arrays) * BRW_ATTRIB_MAX);
arrays[BRW_ATTRIB_POS] = &obj->Vertex;
arrays[BRW_ATTRIB_NORMAL] = &obj->Normal;
arrays[BRW_ATTRIB_COLOR0] = &obj->Color;
arrays[BRW_ATTRIB_COLOR1] = &obj->SecondaryColor;
arrays[BRW_ATTRIB_FOG] = &obj->FogCoord;
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++)
arrays[BRW_ATTRIB_TEX0 + i] = &obj->TexCoord[i];
arrays[BRW_ATTRIB_INDEX] = &obj->Index;
arrays[BRW_ATTRIB_EDGEFLAG] = &obj->EdgeFlag;
for (i = BRW_ATTRIB_GENERIC0; i <= BRW_ATTRIB_GENERIC15; i++)
arrays[i] = &obj->VertexAttrib[i - BRW_ATTRIB_GENERIC0];
}
void brw_exec_array_init( struct brw_exec_context *exec )
{
GLcontext *ctx = exec->ctx;
init_arrays(ctx, exec->array.inputs);
#if 1
exec->vtxfmt.DrawArrays = brw_exec_DrawArrays;
exec->vtxfmt.DrawElements = brw_exec_DrawElements;
exec->vtxfmt.DrawRangeElements = brw_exec_DrawRangeElements;
#else
exec->vtxfmt.DrawArrays = _mesa_noop_DrawArrays;
exec->vtxfmt.DrawElements = _mesa_noop_DrawElements;
exec->vtxfmt.DrawRangeElements = _mesa_noop_DrawRangeElements;
#endif
exec->array.index_obj = ctx->Driver.NewBufferObject(ctx, 1, GL_ARRAY_BUFFER_ARB);
}
void brw_exec_array_destroy( struct brw_exec_context *exec )
{
GLcontext *ctx = exec->ctx;
ctx->Driver.DeleteBuffer(ctx, exec->array.index_obj);
}

View file

@ -30,8 +30,6 @@
#include "tnl/tnl.h"
#include "context.h"
#include "brw_context.h"
#include "brw_exec.h"
#include "brw_save.h"
#include "brw_fallback.h"
#include "glheader.h"
@ -40,297 +38,6 @@
#include "imports.h"
#include "macros.h"
#include "mtypes.h"
#include "dispatch.h"
typedef void (*attr_func)( GLcontext *ctx, GLint target, const GLfloat * );
/* Wrapper functions in case glVertexAttrib*fvNV doesn't exist */
static void VertexAttrib1fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib1fvNV(ctx->Exec, (target, v));
}
static void VertexAttrib2fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib2fvNV(ctx->Exec, (target, v));
}
static void VertexAttrib3fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib3fvNV(ctx->Exec, (target, v));
}
static void VertexAttrib4fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib4fvNV(ctx->Exec, (target, v));
}
static attr_func vert_attrfunc[4] = {
VertexAttrib1fvNV,
VertexAttrib2fvNV,
VertexAttrib3fvNV,
VertexAttrib4fvNV
};
#if 0
static void VertexAttrib1fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib1fvARB(ctx->Exec, (target, v));
}
static void VertexAttrib2fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib2fvARB(ctx->Exec, (target, v));
}
static void VertexAttrib3fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib3fvARB(ctx->Exec, (target, v));
}
static void VertexAttrib4fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib4fvARB(ctx->Exec, (target, v));
}
static attr_func vert_attrfunc_arb[4] = {
VertexAttrib1fvARB,
VertexAttrib2fvARB,
VertexAttrib3fvARB,
VertexAttrib4fvARB
};
#endif
static void mat_attr1fv( GLcontext *ctx, GLint target, const GLfloat *v )
{
switch (target) {
case BRW_ATTRIB_MAT_FRONT_SHININESS:
CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_SHININESS, v ));
break;
case BRW_ATTRIB_MAT_BACK_SHININESS:
CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_SHININESS, v ));
break;
}
}
static void mat_attr3fv( GLcontext *ctx, GLint target, const GLfloat *v )
{
switch (target) {
case BRW_ATTRIB_MAT_FRONT_INDEXES:
CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_COLOR_INDEXES, v ));
break;
case BRW_ATTRIB_MAT_BACK_INDEXES:
CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_COLOR_INDEXES, v ));
break;
}
}
static void mat_attr4fv( GLcontext *ctx, GLint target, const GLfloat *v )
{
switch (target) {
case BRW_ATTRIB_MAT_FRONT_EMISSION:
CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_EMISSION, v ));
break;
case BRW_ATTRIB_MAT_BACK_EMISSION:
CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_EMISSION, v ));
break;
case BRW_ATTRIB_MAT_FRONT_AMBIENT:
CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_AMBIENT, v ));
break;
case BRW_ATTRIB_MAT_BACK_AMBIENT:
CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_AMBIENT, v ));
break;
case BRW_ATTRIB_MAT_FRONT_DIFFUSE:
CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_DIFFUSE, v ));
break;
case BRW_ATTRIB_MAT_BACK_DIFFUSE:
CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_DIFFUSE, v ));
break;
case BRW_ATTRIB_MAT_FRONT_SPECULAR:
CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_SPECULAR, v ));
break;
case BRW_ATTRIB_MAT_BACK_SPECULAR:
CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_SPECULAR, v ));
break;
}
}
static attr_func mat_attrfunc[4] = {
mat_attr1fv,
NULL,
mat_attr3fv,
mat_attr4fv
};
static void index_attr1fv(GLcontext *ctx, GLint target, const GLfloat *v)
{
(void) target;
CALL_Indexf(ctx->Exec, (v[0]));
}
static void edgeflag_attr1fv(GLcontext *ctx, GLint target, const GLfloat *v)
{
(void) target;
CALL_EdgeFlag(ctx->Exec, ((GLboolean)(v[0] == 1.0)));
}
struct loopback_attr {
GLint target;
GLint sz;
attr_func func;
};
/* Don't emit ends and begins on wrapped primitives. Don't replay
* wrapped vertices. If we get here, it's probably because the the
* precalculated wrapping is wrong.
*/
static void loopback_prim( GLcontext *ctx,
const GLfloat *buffer,
const struct brw_draw_prim *prim,
GLuint wrap_count,
GLuint vertex_size,
const struct loopback_attr *la, GLuint nr )
{
GLint start = prim->start;
GLint end = start + prim->count;
const GLfloat *data;
GLint j;
GLuint k;
if (0)
_mesa_printf("loopback prim %s(%s,%s) verts %d..%d\n",
_mesa_lookup_enum_by_nr(prim->mode),
prim->begin ? "begin" : "..",
prim->end ? "end" : "..",
start,
end);
if (prim->begin) {
CALL_Begin(GET_DISPATCH(), ( prim->mode ));
}
else {
assert(start == 0);
start += wrap_count;
}
data = buffer + start * vertex_size;
for (j = start ; j < end ; j++) {
const GLfloat *tmp = data + la[0].sz;
for (k = 1 ; k < nr ; k++) {
la[k].func( ctx, la[k].target, tmp );
tmp += la[k].sz;
}
/* Fire the vertex
*/
la[0].func( ctx, BRW_ATTRIB_POS, data );
data = tmp;
}
if (prim->end) {
CALL_End(GET_DISPATCH(), ());
}
}
/* Primitives generated by DrawArrays/DrawElements/Rectf may be
* caught here. If there is no primitive in progress, execute them
* normally, otherwise need to track and discard the generated
* primitives.
*/
static void loopback_weak_prim( GLcontext *ctx,
const struct brw_draw_prim *prim )
{
/* Use the prim_weak flag to ensure that if this primitive
* wraps, we don't mistake future vertex_lists for part of the
* surrounding primitive.
*
* While this flag is set, we are simply disposing of data
* generated by an operation now known to be a noop.
*/
if (prim->begin)
ctx->Driver.CurrentExecPrimitive |= BRW_SAVE_PRIM_WEAK;
if (prim->end)
ctx->Driver.CurrentExecPrimitive &= ~BRW_SAVE_PRIM_WEAK;
}
void brw_loopback_vertex_list( GLcontext *ctx,
const GLfloat *buffer,
const GLubyte *attrsz,
const struct brw_draw_prim *prim,
GLuint prim_count,
GLuint wrap_count,
GLuint vertex_size)
{
struct loopback_attr la[BRW_ATTRIB_MAX];
GLuint i, nr = 0;
for (i = 0 ; i <= BRW_ATTRIB_TEX7 ; i++) {
if (i == BRW_ATTRIB_INDEX || i == BRW_ATTRIB_EDGEFLAG)
continue;
if (attrsz[i]) {
la[nr].target = i;
la[nr].sz = attrsz[i];
la[nr].func = vert_attrfunc[attrsz[i]-1];
nr++;
}
}
for (i = BRW_ATTRIB_MAT_FRONT_AMBIENT ;
i <= BRW_ATTRIB_MAT_BACK_INDEXES ;
i++) {
if (attrsz[i]) {
la[nr].target = i;
la[nr].sz = attrsz[i];
la[nr].func = mat_attrfunc[attrsz[i]-1];
nr++;
}
}
if (attrsz[BRW_ATTRIB_EDGEFLAG]) {
la[nr].target = BRW_ATTRIB_EDGEFLAG;
la[nr].sz = attrsz[BRW_ATTRIB_EDGEFLAG];
la[nr].func = edgeflag_attr1fv;
nr++;
}
if (attrsz[BRW_ATTRIB_INDEX]) {
la[nr].target = BRW_ATTRIB_INDEX;
la[nr].sz = attrsz[BRW_ATTRIB_INDEX];
la[nr].func = index_attr1fv;
nr++;
}
/* XXX ARB vertex attribs */
for (i = 0 ; i < prim_count ; i++) {
if ((prim[i].mode & BRW_SAVE_PRIM_WEAK) &&
(ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END))
{
loopback_weak_prim( ctx, &prim[i] );
}
else
{
loopback_prim( ctx, buffer, &prim[i], wrap_count, vertex_size, la, nr );
}
}
}
@ -405,62 +112,6 @@ const struct brw_tracked_state brw_check_fallback = {
/* If there is a fallback, fallback to software rasterization and
* transformation together. There is never a requirement to have
* software t&l but hardware rasterization.
*
* Further, all fallbacks are based on GL state, not on eg. primitive
* or vertex data.
*/
static void do_fallback( struct brw_context *brw,
GLboolean fallback )
{
GLcontext *ctx = &brw->intel.ctx;
/* flush:
*/
ctx->Driver.Flush( ctx );
if (fallback) {
_swsetup_Wakeup( ctx );
_tnl_wakeup_exec( ctx );
/* Need this because tnl_wakeup_exec does too much:
*/
brw_save_wakeup(ctx);
brw_save_fallback(ctx, GL_TRUE);
}
else {
/* Flush vertices and copy-to-current:
*/
FLUSH_CURRENT(ctx, 0);
_swrast_flush( ctx );
brw_exec_wakeup(ctx);
/* Need this because tnl_wakeup_exec does too much:
*/
brw_save_wakeup(ctx);
brw_save_fallback(ctx, GL_FALSE);
}
}
void brw_fallback( GLcontext *ctx )
{
struct brw_context *brw = brw_context(ctx);
do_fallback(brw, 1);
}
void brw_unfallback( GLcontext *ctx )
{
struct brw_context *brw = brw_context(ctx);
do_fallback(brw, 0);
}
/* Not used:
*/
void intelFallback( struct intel_context *intel, GLuint bit, GLboolean mode )

View file

@ -31,7 +31,7 @@
#include "mtypes.h" /* for GLcontext... */
struct brw_context;
struct brw_draw_prim;
struct vbo_prim;
void brw_fallback( GLcontext *ctx );
void brw_unfallback( GLcontext *ctx );
@ -39,7 +39,7 @@ void brw_unfallback( GLcontext *ctx );
void brw_loopback_vertex_list( GLcontext *ctx,
const GLfloat *buffer,
const GLubyte *attrsz,
const struct brw_draw_prim *prim,
const struct vbo_prim *prim,
GLuint prim_count,
GLuint wrap_count,
GLuint vertex_size);

View file

@ -82,6 +82,9 @@ static void compile_gs_prog( struct brw_context *brw,
case GL_QUADS:
brw_gs_quads( &c );
break;
case GL_QUAD_STRIP:
brw_gs_quad_strip( &c );
break;
case GL_LINE_LOOP:
brw_gs_lines( &c );
break;
@ -145,7 +148,7 @@ static const GLenum gs_prim[GL_POLYGON+1] = {
GL_TRIANGLES,
GL_TRIANGLES,
GL_QUADS,
GL_QUADS,
GL_QUAD_STRIP,
GL_TRIANGLES
};

View file

@ -67,6 +67,7 @@ struct brw_gs_compile {
#define ATTR_SIZE (4*4)
void brw_gs_quads( struct brw_gs_compile *c );
void brw_gs_quad_strip( struct brw_gs_compile *c );
void brw_gs_tris( struct brw_gs_compile *c );
void brw_gs_lines( struct brw_gs_compile *c );
void brw_gs_points( struct brw_gs_compile *c );

View file

@ -116,6 +116,16 @@ void brw_gs_quads( struct brw_gs_compile *c )
brw_gs_emit_vue(c, c->reg.vertex[2], 1, ((_3DPRIM_POLYGON << 2) | R02_PRIM_END));
}
void brw_gs_quad_strip( struct brw_gs_compile *c )
{
brw_gs_alloc_regs(c, 4);
brw_gs_emit_vue(c, c->reg.vertex[2], 0, ((_3DPRIM_POLYGON << 2) | R02_PRIM_START));
brw_gs_emit_vue(c, c->reg.vertex[3], 0, (_3DPRIM_POLYGON << 2));
brw_gs_emit_vue(c, c->reg.vertex[0], 0, (_3DPRIM_POLYGON << 2));
brw_gs_emit_vue(c, c->reg.vertex[1], 1, ((_3DPRIM_POLYGON << 2) | R02_PRIM_END));
}
void brw_gs_tris( struct brw_gs_compile *c )
{
brw_gs_alloc_regs(c, 3);

View file

@ -47,7 +47,6 @@
#include "brw_context.h"
#include "brw_defines.h"
#include "brw_draw.h"
#include "brw_attrib.h"
#include "brw_fallback.h"
#define INIT(brw, STRUCT, ATTRIB) \
@ -388,8 +387,8 @@ static void meta_draw_quad(struct intel_context *intel,
struct brw_context *brw = brw_context(&intel->ctx);
struct gl_client_array pos_array;
struct gl_client_array color_array;
struct gl_client_array *attribs[BRW_ATTRIB_MAX];
struct brw_draw_prim prim[1];
struct gl_client_array *attribs[VERT_ATTRIB_MAX];
struct _mesa_prim prim[1];
GLfloat pos[4][3];
GLubyte color[4];
@ -439,29 +438,29 @@ static void meta_draw_quad(struct intel_context *intel,
/* Ignoring texture coords.
*/
memset(attribs, 0, BRW_ATTRIB_MAX * sizeof(*attribs));
memset(attribs, 0, VERT_ATTRIB_MAX * sizeof(*attribs));
attribs[BRW_ATTRIB_POS] = &pos_array;
attribs[BRW_ATTRIB_POS]->Ptr = 0;
attribs[BRW_ATTRIB_POS]->Type = GL_FLOAT;
attribs[BRW_ATTRIB_POS]->Enabled = 1;
attribs[BRW_ATTRIB_POS]->Size = 3;
attribs[BRW_ATTRIB_POS]->StrideB = 3 * sizeof(GLfloat);
attribs[BRW_ATTRIB_POS]->Stride = 3 * sizeof(GLfloat);
attribs[BRW_ATTRIB_POS]->_MaxElement = 4;
attribs[BRW_ATTRIB_POS]->Normalized = 0;
attribs[BRW_ATTRIB_POS]->BufferObj = brw->metaops.vbo;
attribs[VERT_ATTRIB_POS] = &pos_array;
attribs[VERT_ATTRIB_POS]->Ptr = 0;
attribs[VERT_ATTRIB_POS]->Type = GL_FLOAT;
attribs[VERT_ATTRIB_POS]->Enabled = 1;
attribs[VERT_ATTRIB_POS]->Size = 3;
attribs[VERT_ATTRIB_POS]->StrideB = 3 * sizeof(GLfloat);
attribs[VERT_ATTRIB_POS]->Stride = 3 * sizeof(GLfloat);
attribs[VERT_ATTRIB_POS]->_MaxElement = 4;
attribs[VERT_ATTRIB_POS]->Normalized = 0;
attribs[VERT_ATTRIB_POS]->BufferObj = brw->metaops.vbo;
attribs[BRW_ATTRIB_COLOR0] = &color_array;
attribs[BRW_ATTRIB_COLOR0]->Ptr = (const GLubyte *)sizeof(pos);
attribs[BRW_ATTRIB_COLOR0]->Type = GL_UNSIGNED_BYTE;
attribs[BRW_ATTRIB_COLOR0]->Enabled = 1;
attribs[BRW_ATTRIB_COLOR0]->Size = 4;
attribs[BRW_ATTRIB_COLOR0]->StrideB = 0;
attribs[BRW_ATTRIB_COLOR0]->Stride = 0;
attribs[BRW_ATTRIB_COLOR0]->_MaxElement = 1;
attribs[BRW_ATTRIB_COLOR0]->Normalized = 1;
attribs[BRW_ATTRIB_COLOR0]->BufferObj = brw->metaops.vbo;
attribs[VERT_ATTRIB_COLOR0] = &color_array;
attribs[VERT_ATTRIB_COLOR0]->Ptr = (const GLubyte *)sizeof(pos);
attribs[VERT_ATTRIB_COLOR0]->Type = GL_UNSIGNED_BYTE;
attribs[VERT_ATTRIB_COLOR0]->Enabled = 1;
attribs[VERT_ATTRIB_COLOR0]->Size = 4;
attribs[VERT_ATTRIB_COLOR0]->StrideB = 0;
attribs[VERT_ATTRIB_COLOR0]->Stride = 0;
attribs[VERT_ATTRIB_COLOR0]->_MaxElement = 1;
attribs[VERT_ATTRIB_COLOR0]->Normalized = 1;
attribs[VERT_ATTRIB_COLOR0]->BufferObj = brw->metaops.vbo;
/* Just ignoring texture coordinates for now.
*/
@ -476,19 +475,12 @@ static void meta_draw_quad(struct intel_context *intel,
prim[0].start = 0;
prim[0].count = 4;
if (!brw_draw_prims(&brw->intel.ctx,
(const struct gl_client_array **)attribs,
prim, 1,
NULL,
0,
4,
BRW_DRAW_LOCKED ))
{
/* This should not be possible:
*/
_mesa_printf("brw_draw_prims failed in metaops!\n");
assert(0);
}
brw_draw_prims(&brw->intel.ctx,
(const struct gl_client_array **)attribs,
prim, 1,
NULL,
0,
3 );
}

View file

@ -1,126 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "mtypes.h"
#include "api_arrayelt.h"
#include "dlist.h"
#include "vtxfmt.h"
#include "imports.h"
#include "brw_save.h"
void brw_save_init( GLcontext *ctx )
{
struct brw_save_context *save = CALLOC_STRUCT(brw_save_context);
if (ctx->swtnl_im == NULL) {
ctx->swtnl_im = CALLOC_STRUCT(brw_exec_save);
}
save->ctx = ctx;
IMM_CONTEXT(ctx)->save = save;
/* Initialize the arrayelt helper
*/
if (!ctx->aelt_context &&
!_ae_create_context( ctx ))
return;
brw_save_api_init( save );
brw_save_wakeup(ctx);
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
}
void brw_save_destroy( GLcontext *ctx )
{
struct brw_save_context *save = IMM_CONTEXT(ctx)->save;
if (save) {
FREE(save);
IMM_CONTEXT(ctx)->save = NULL;
}
if (ctx->aelt_context) {
_ae_destroy_context( ctx );
ctx->aelt_context = NULL;
}
if (IMM_CONTEXT(ctx)->exec == NULL &&
IMM_CONTEXT(ctx)->save == NULL) {
FREE(IMM_CONTEXT(ctx));
ctx->swtnl_im = NULL;
}
}
void brw_save_invalidate_state( GLcontext *ctx, GLuint new_state )
{
_ae_invalidate_state(ctx, new_state);
}
/* Note that this can occur during the playback of a display list:
*/
void brw_save_fallback( GLcontext *ctx, GLboolean fallback )
{
struct brw_save_context *save = IMM_CONTEXT(ctx)->save;
if (fallback)
save->replay_flags |= BRW_SAVE_FALLBACK;
else
save->replay_flags &= ~BRW_SAVE_FALLBACK;
}
/* I don't see any reason to swap this code out on fallbacks. It
* wouldn't really mean anything to do so anyway as the old lists are
* still around from pre-fallback. Instead, the above code ensures
* that vertices are routed back through immediate mode dispatch on
* fallback.
*
* The below can be moved into init or removed:
*/
void brw_save_wakeup( GLcontext *ctx )
{
ctx->Driver.NewList = brw_save_NewList;
ctx->Driver.EndList = brw_save_EndList;
ctx->Driver.SaveFlushVertices = brw_save_SaveFlushVertices;
ctx->Driver.BeginCallList = brw_save_BeginCallList;
ctx->Driver.EndCallList = brw_save_EndCallList;
ctx->Driver.NotifySaveBegin = brw_save_NotifyBegin;
/* Assume we haven't been getting state updates either:
*/
brw_save_invalidate_state( ctx, ~0 );
}

View file

@ -54,12 +54,11 @@ static void do_vs_prog( struct brw_context *brw,
c.vp = vp;
c.prog_data.outputs_written = vp->program.Base.OutputsWritten;
c.prog_data.inputs_read = brw_translate_inputs(brw->intel.ctx.VertexProgram._Enabled,
vp->program.Base.InputsRead);
c.prog_data.inputs_read = vp->program.Base.InputsRead;
if (c.key.copy_edgeflag) {
c.prog_data.outputs_written |= 1<<VERT_RESULT_EDGE;
c.prog_data.inputs_read |= 1<<BRW_ATTRIB_EDGEFLAG;
c.prog_data.inputs_read |= 1<<VERT_ATTRIB_EDGEFLAG;
}
if (0)

View file

@ -162,6 +162,7 @@ static GLuint get_input_size(struct brw_context *brw,
GLuint sizes_dword = brw->vb.info.sizes[attr/16];
GLuint sizes_bits = (sizes_dword>>((attr%16)*2)) & 0x3;
return sizes_bits + 1;
/* return brw->vb.inputs[attr].glarray->Size; */
}
/* Calculate sizes of vertex program outputs. Size is the largest
@ -176,8 +177,6 @@ static void calc_wm_input_sizes( struct brw_context *brw )
struct tracker t;
GLuint insn;
GLuint i;
GLuint64EXT inputs = brw_translate_inputs(brw->intel.ctx.VertexProgram._Enabled,
vp->program.Base.InputsRead);
memset(&t, 0, sizeof(t));
@ -185,8 +184,8 @@ static void calc_wm_input_sizes( struct brw_context *brw )
if (brw->attribs.Light->Model.TwoSide)
t.twoside = 1;
for (i = 0; i < BRW_ATTRIB_MAX; i++)
if (inputs & (1<<i))
for (i = 0; i < VERT_ATTRIB_MAX; i++)
if (vp->program.Base.InputsRead & (1<<i))
set_active_component(&t, PROGRAM_INPUT, i,
szflag[get_input_size(brw, i)]);

View file

@ -77,8 +77,8 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
/* Allocate input regs:
*/
c->nr_inputs = 0;
for (i = 0; i < BRW_ATTRIB_MAX; i++) {
if (c->prog_data.inputs_read & ((GLuint64EXT)1<<i)) {
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
if (c->prog_data.inputs_read & (1<<i)) {
c->nr_inputs++;
c->regs[PROGRAM_INPUT][i] = brw_vec8_grf(reg, 0);
reg++;
@ -791,7 +791,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
if (c->key.copy_edgeflag) {
brw_MOV(p,
get_reg(c, PROGRAM_OUTPUT, VERT_RESULT_EDGE),
get_reg(c, PROGRAM_INPUT, BRW_ATTRIB_EDGEFLAG));
get_reg(c, PROGRAM_INPUT, VERT_ATTRIB_EDGEFLAG));
}

View file

@ -146,9 +146,13 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
}
/* BRW_NEW_INPUT_VARYING */
for (i = BRW_ATTRIB_MAT_FRONT_AMBIENT ; i < BRW_ATTRIB_MAX ; i++)
if (brw->vb.info.varying & ((GLuint64EXT)1<<i))
key->light_material_mask |= 1<<(i-BRW_ATTRIB_MAT_FRONT_AMBIENT);
/* For these programs, material values are stuffed into the
* generic slots:
*/
for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
if (brw->vb.info.varying & (1<<(VERT_ATTRIB_GENERIC0 + i)))
key->light_material_mask |= 1<<i;
for (i = 0; i < MAX_LIGHTS; i++) {
struct gl_light *light = &brw->attribs.Light->Light[i];
@ -374,17 +378,10 @@ static void release_temps( struct tnl_program *p )
static struct ureg register_input( struct tnl_program *p, GLuint input )
{
GLuint orig_input = input;
/* Cram the material flags into the generic range. We'll translate
* them back later.
*/
if (input >= BRW_ATTRIB_MAT_FRONT_AMBIENT)
input -= BRW_ATTRIB_MAT_FRONT_AMBIENT - BRW_ATTRIB_GENERIC0;
assert(input < 32);
p->program->Base.InputsRead |= (1<<input);
return make_ureg(PROGRAM_INPUT, orig_input);
return make_ureg(PROGRAM_INPUT, input);
}
static struct ureg register_output( struct tnl_program *p, GLuint output )
@ -647,7 +644,7 @@ static void emit_passthrough( struct tnl_program *p,
static struct ureg get_eye_position( struct tnl_program *p )
{
if (is_undef(p->eye_position)) {
struct ureg pos = register_input( p, BRW_ATTRIB_POS );
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
struct ureg modelview[4];
p->eye_position = reserve_temp(p);
@ -710,7 +707,7 @@ static struct ureg get_eye_position_normalized( struct tnl_program *p )
static struct ureg get_eye_normal( struct tnl_program *p )
{
if (is_undef(p->eye_normal)) {
struct ureg normal = register_input(p, BRW_ATTRIB_NORMAL );
struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL );
struct ureg mvinv[3];
register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 2,
@ -743,7 +740,7 @@ static struct ureg get_eye_normal( struct tnl_program *p )
static void build_hpos( struct tnl_program *p )
{
struct ureg pos = register_input( p, BRW_ATTRIB_POS );
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
struct ureg hpos = register_output( p, VERT_RESULT_HPOS );
struct ureg mvp[4];
@ -787,9 +784,9 @@ static struct ureg get_material( struct tnl_program *p, GLuint side,
GLuint attrib = material_attrib(side, property);
if (p->color_materials & (1<<attrib))
return register_input(p, BRW_ATTRIB_COLOR0);
return register_input(p, VERT_ATTRIB_COLOR0);
else if (p->materials & (1<<attrib))
return register_input( p, attrib + BRW_ATTRIB_MAT_FRONT_AMBIENT );
return register_input( p, attrib + _TNL_ATTRIB_MAT_FRONT_AMBIENT );
else
return register_param3( p, STATE_MATERIAL, side, property );
}
@ -1157,7 +1154,7 @@ static void build_fog( struct tnl_program *p )
input = swizzle1(get_eye_position(p), Z);
}
else {
input = swizzle1(register_input(p, BRW_ATTRIB_FOG), X);
input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X);
}
if (p->state->fog_option &&
@ -1299,7 +1296,7 @@ static void build_texture_transform( struct tnl_program *p )
for (j = 0; j < 4; j++) {
switch (modes[j]) {
case TXG_OBJ_LINEAR: {
struct ureg obj = register_input(p, BRW_ATTRIB_POS);
struct ureg obj = register_input(p, VERT_ATTRIB_POS);
struct ureg plane =
register_param3(p, STATE_TEXGEN, i,
STATE_TEXGEN_OBJECT_S + j);
@ -1348,7 +1345,7 @@ static void build_texture_transform( struct tnl_program *p )
}
if (copy_mask) {
struct ureg in = register_input(p, BRW_ATTRIB_TEX0+i);
struct ureg in = register_input(p, VERT_ATTRIB_TEX0+i);
emit_op1(p, OPCODE_MOV, out_texgen, copy_mask, in );
}
}
@ -1357,7 +1354,7 @@ static void build_texture_transform( struct tnl_program *p )
struct ureg texmat[4];
struct ureg in = (!is_undef(out_texgen) ?
out_texgen :
register_input(p, BRW_ATTRIB_TEX0+i));
register_input(p, VERT_ATTRIB_TEX0+i));
if (PREFER_DP4) {
register_matrix_param6( p, STATE_MATRIX, STATE_TEXTURE, i,
0, 3, STATE_MATRIX, texmat );
@ -1373,7 +1370,7 @@ static void build_texture_transform( struct tnl_program *p )
release_temps(p);
}
else {
emit_passthrough(p, BRW_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i);
emit_passthrough(p, VERT_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i);
}
}
}
@ -1425,10 +1422,10 @@ static void build_tnl_program( struct tnl_program *p )
build_lighting(p);
else {
if (p->state->fragprog_inputs_read & FRAG_BIT_COL0)
emit_passthrough(p, BRW_ATTRIB_COLOR0, VERT_RESULT_COL0);
emit_passthrough(p, VERT_ATTRIB_COLOR0, VERT_RESULT_COL0);
if (p->state->fragprog_inputs_read & FRAG_BIT_COL1)
emit_passthrough(p, BRW_ATTRIB_COLOR1, VERT_RESULT_COL1);
emit_passthrough(p, VERT_ATTRIB_COLOR1, VERT_RESULT_COL1);
}
}

View file

@ -46,8 +46,6 @@
#include "brw_state.h"
#include "brw_draw.h"
#include "brw_exec.h"
#include "brw_save.h"
#include "brw_state.h"
#include "brw_aub.h"
#include "brw_fallback.h"
@ -68,9 +66,6 @@ static void brw_destroy_context( struct intel_context *intel )
brw_destroy_state(brw);
brw_draw_destroy( brw );
brw_exec_destroy( ctx );
brw_save_destroy( ctx );
brw_ProgramCacheDestroy( ctx );
brw_FrameBufferTexDestroy( brw );
}
@ -166,10 +161,7 @@ static GLuint brw_flush_cmd( void )
static void brw_invalidate_state( struct intel_context *intel, GLuint new_state )
{
GLcontext *ctx = &intel->ctx;
brw_exec_invalidate_state(ctx, new_state);
brw_save_invalidate_state(ctx, new_state);
/* nothing */
}

View file

@ -38,7 +38,7 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "vbo/vbo.h"
#include "tnl/t_pipeline.h"
#include "tnl/t_vertex.h"
@ -61,6 +61,7 @@
#include "bufmgr.h"
#include "utils.h"
#include "vblank.h"
#ifndef INTEL_DEBUG
int INTEL_DEBUG = (0);
#endif
@ -86,11 +87,6 @@ int INTEL_DEBUG = (0);
int VERBOSE = 0;
#endif
#if DEBUG_LOCKING
char *prevLockFile;
int prevLockLine;
#endif
/***************************************
* Mesa's Driver Functions
***************************************/
@ -230,7 +226,7 @@ static void intelInvalidateState( GLcontext *ctx, GLuint new_state )
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
_ac_InvalidateState( ctx, new_state );
_vbo_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
_tnl_invalidate_vertex_state( ctx, new_state );
@ -260,11 +256,11 @@ intelBeginQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
{
struct intel_context *intel = intel_context( ctx );
drmI830MMIO io = {
.read_write = MMIO_WRITE,
.read_write = MMIO_READ,
.reg = MMIO_REGS_PS_DEPTH_COUNT,
.data = &q->Result
};
intel->stats_wm = GL_TRUE;
intel->stats_wm++;
intelFinish(&intel->ctx);
drmCommandRead(intel->driFd, DRM_I830_MMIO, &io, sizeof(io));
}
@ -283,7 +279,7 @@ intelEndQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
drmCommandRead(intel->driFd, DRM_I830_MMIO, &io, sizeof(io));
q->Result = tmp - q->Result;
q->Ready = GL_TRUE;
intel->stats_wm = GL_FALSE;
intel->stats_wm--;
}
@ -339,6 +335,11 @@ GLboolean intelInitContext( struct intel_context *intel,
intel->driScreen = sPriv;
intel->sarea = saPriv;
driParseConfigFiles (&intel->optionCache, &intelScreen->optionCache,
intel->driScreen->myNum, "i965");
intel->vblank_flags = (intel->intelScreen->irq_active != 0)
? driGetDefaultVBlankFlags(&intel->optionCache) : VBLANK_FLAG_NO_IRQ;
ctx->Const.MaxTextureMaxAnisotropy = 2.0;
@ -374,7 +375,7 @@ GLboolean intelInitContext( struct intel_context *intel,
/* Initialize the software rasterizer and helper modules. */
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
@ -448,8 +449,8 @@ GLboolean intelInitContext( struct intel_context *intel,
intelScreen->cpp,
intelScreen->front.pitch / intelScreen->cpp,
intelScreen->height,
intelScreen->front.tiled != 0); /* 0: LINEAR */
intelScreen->front.size,
intelScreen->front.tiled != 0);
intel->back_region =
intel_region_create_static(intel,
@ -459,6 +460,7 @@ GLboolean intelInitContext( struct intel_context *intel,
intelScreen->cpp,
intelScreen->back.pitch / intelScreen->cpp,
intelScreen->height,
intelScreen->back.size,
intelScreen->back.tiled != 0);
/* Still assuming front.cpp == depth.cpp
@ -475,6 +477,7 @@ GLboolean intelInitContext( struct intel_context *intel,
intelScreen->cpp,
intelScreen->depth.pitch / intelScreen->cpp,
intelScreen->height,
intelScreen->depth.size,
intelScreen->depth.tiled != 0);
intel_bufferobj_init( intel );
@ -517,7 +520,7 @@ void intelDestroyContext(__DRIcontextPrivate *driContextPriv)
release_texture_heaps = (intel->ctx.Shared->RefCount == 1);
_swsetup_DestroyContext (&intel->ctx);
_tnl_DestroyContext (&intel->ctx);
_ac_DestroyContext (&intel->ctx);
_vbo_DestroyContext (&intel->ctx);
_swrast_DestroyContext (&intel->ctx);
intel->Fallback = 0; /* don't call _swrast_Flush later */
@ -566,6 +569,9 @@ GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
if ( intel->driDrawable != driDrawPriv ) {
/* Shouldn't the readbuffer be stored also? */
driDrawableInitVBlank( driDrawPriv, intel->vblank_flags,
&intel->vbl_seq );
intel->driDrawable = driDrawPriv;
intelWindowMoved( intel );
}

View file

@ -177,7 +177,7 @@ struct intel_context
GLuint second_last_swap_fence;
GLboolean aub_wrap;
GLboolean stats_wm;
GLuint stats_wm;
struct intel_batchbuffer *batch;

View file

@ -108,7 +108,8 @@ void intelWaitIrq( struct intel_context *intel, int seq )
/* This seems quite often to return before it should!?!
*/
} while (ret == -EAGAIN || ret == -EINTR || (ret == -EBUSY && lastdispatch != intel->sarea->last_dispatch) || (ret == 0 && seq > intel->sarea->last_dispatch));
} while (ret == -EAGAIN || ret == -EINTR || (ret == -EBUSY && lastdispatch != intel->sarea->last_dispatch) || (ret == 0 && seq > intel->sarea->last_dispatch)
|| (ret == 0 && intel->sarea->last_dispatch - seq >= (1 << 24)));
if ( ret ) {

View file

@ -122,10 +122,10 @@ struct intel_region *intel_region_create_static( struct intel_context *intel,
GLuint cpp,
GLuint pitch,
GLuint height,
GLuint size,
GLboolean tiled )
{
struct intel_region *region = calloc(sizeof(*region), 1);
GLuint size = cpp * pitch * height;
GLint pool;
DBG("%s\n", __FUNCTION__);

View file

@ -78,6 +78,7 @@ struct intel_region *intel_region_create_static( struct intel_context *intel,
GLuint cpp,
GLuint pitch,
GLuint height,
GLuint size,
GLboolean tiled );
/* Map/unmap regions. This is refcounted also:

Some files were not shown because too many files have changed in this diff Show more