Compare commits

...

2961 Commits

Author SHA1 Message Date
Chia-I Wu
74237c1a10 mesa: Remember client active texture in _mesa_meta_draw_tex. 2009-10-31 18:03:34 +08:00
Chia-I Wu
ce5af556aa egl_android: Update native buffer only when it is really changed. 2009-10-30 17:27:14 +08:00
Chia-I Wu
f457f7a31c egl_android: Decide image config by matching the native pixmap. 2009-10-27 17:45:13 +08:00
Chia-I Wu
11ff6a0e6f egl_android: Set surface type and native visual type. 2009-10-27 17:30:24 +08:00
Chia-I Wu
b4bf8be547 intel: Correct support for GL_BGRA. 2009-10-23 17:54:49 +08:00
Chia-I Wu
6ec4bba0ea egl: Unlink image before destroying it. 2009-10-22 17:00:59 +08:00
Chia-I Wu
893bc24da3 egl_android: Wrong attribute is passed. 2009-10-22 15:48:05 +08:00
Chia-I Wu
c83d23d30d egl_android: Install customized logger. 2009-09-29 18:33:53 +08:00
Chia-I Wu
e786472b8d egl: Improve logging facility.
Add _eglSetLogger and _eglSetLogLevel to allow drivers to change the
message logger or report level.
2009-09-29 18:33:53 +08:00
Chia-I Wu
27c1ec2334 egl: Allow binding to any client API.
As a result, EGL_NONE is no longer a valid client API.  And it is
possible that no config supports the current bound API.
2009-09-29 18:33:53 +08:00
Chia-I Wu
607a4393e7 egl: Preload a driver if eglGetProcAddress is called early. 2009-09-29 18:33:53 +08:00
Chia-I Wu
74174dd5d6 egl: Better report of driver loading error. 2009-09-29 18:19:50 +08:00
Chia-I Wu
35f9a9c5c9 egl: Allow driver to be built-in.
This undoes a temporary hack.
2009-09-28 18:10:37 +08:00
Chia-I Wu
d5e732764b egl_android: Minor fixes to image surface. 2009-09-24 12:53:50 +08:00
Chia-I Wu
ef1a6243ef egl_android: Refactor tiling support. 2009-09-24 12:53:32 +08:00
Chia-I Wu
8911b7d7a1 egl_android: Merge tiling support from eagle. 2009-09-24 10:09:32 +08:00
Chia-I Wu
1ba61c244f Merge branch 'mesa-es' into android 2009-09-23 14:45:37 +08:00
Chia-I Wu
dce62509e5 mesa: Pixel zoom should be ignored in _mesa_meta_draw_tex. 2009-09-23 14:44:09 +08:00
Chia-I Wu
25e6736400 es: Add support for GL_ARB_texture_non_power_of_two. 2009-09-23 14:40:41 +08:00
Chia-I Wu
6059e6a8f2 egl_android: Add untested support for EGLImage. 2009-09-18 18:36:14 +08:00
Chia-I Wu
3c718c0e95 egl_android: Initialize __DRIbuffer properly. 2009-09-18 17:13:13 +08:00
Chia-I Wu
3806be3ddb egl_android: Remove unused variables. 2009-09-18 15:42:48 +08:00
Chia-I Wu
94f9330609 egl_android: New EGL driver for Android. 2009-09-18 15:32:26 +08:00
Chia-I Wu
08b9155eee es: Turn of FEATURE_es2_glsl. 2009-09-18 11:23:39 +08:00
Chia-I Wu
87b5e03290 Build libes1api.a. 2009-09-16 11:19:23 +08:00
Chia-I Wu
94fe206c56 mesa: Rename libmesa.a to libes1.a. 2009-09-16 11:19:23 +08:00
Chia-I Wu
62e7cd2aca mesa: Save META_SHADER in _mesa_meta_draw_tex. 2009-09-15 23:51:18 +08:00
Chia-I Wu
16678f5dbf Merge commit 'eee/mesa-es' into android 2009-09-15 18:50:51 +08:00
Chia-I Wu
705fed33ea mesa: Fix a division in _mesa_meta_draw_tex.
Both crop rectangle and texture dimensions are integers.  Cast to get
float division.
2009-09-15 18:44:38 +08:00
Chia-I Wu
4e547d5155 intel: Add support for GL_OES_draw_texture. 2009-09-15 17:51:25 +08:00
Chia-I Wu
d535d82b32 mesa: Add _mesa_meta_draw_tex. 2009-09-15 17:48:36 +08:00
Chia-I Wu
dea3bc04c1 mesa/tnl: Add support for GL_FIXED in _tnl_import_array. 2009-09-15 15:23:31 +08:00
Chia-I Wu
a49adc545b Update Android.mk for recent merge. 2009-09-15 14:20:30 +08:00
Chia-I Wu
b4d0fdf8d2 intel: Fix DRI CopyBuffer extension. 2009-09-15 14:18:27 +08:00
Chia-I Wu
a5a8bdfd9b es: Pre-generate ES1 source files. 2009-09-15 14:17:03 +08:00
Chia-I Wu
e2ba90a9cc Merge commit 'eee/mesa-es' into android 2009-09-15 14:16:22 +08:00
Chia-I Wu
b4b8800315 egl_xdri: Check that FlushCurrentContext is available. 2009-09-15 12:41:16 +08:00
Chia-I Wu
4e5934fed1 intel: Add support for GL_OES_EGL_image.
This is primitive and some pathes are not tested.
2009-09-14 16:17:21 +08:00
Chia-I Wu
c4a8ce7ffd es: Add support for GL_OES_EGL_image. 2009-09-14 16:05:46 +08:00
Chia-I Wu
9199889374 es/glapi: Add support for GL_OES_EGL_image. 2009-09-14 16:05:46 +08:00
Chia-I Wu
80c0f18f2d glapi: Generate typedef for GLeglImageOES. 2009-09-14 16:05:46 +08:00
Chia-I Wu
4db23069f9 es: Check OES_draw_texture is enabled. 2009-09-14 15:58:42 +08:00
Chia-I Wu
77e2b23ea6 egl_xdri: Flush commands on context switch and buffer swap.
The corresponding DRI functions does not flush for us.
2009-09-14 13:39:19 +08:00
Chia-I Wu
5f32756254 egl_xdri: Implement eglCreateImageKHR. 2009-09-14 13:39:19 +08:00
Chia-I Wu
9e9a4cf471 egl: Add support for EGL_KHR_image_base.
Individual drivers still need to implement the API hooks.
2009-09-14 13:39:18 +08:00
Chia-I Wu
985cefb769 egl: Update eglext.h to version 3. 2009-09-14 13:39:18 +08:00
Chia-I Wu
554361e2b2 i915: Build i915_dri with libes1.a. 2009-09-14 13:05:47 +08:00
Chia-I Wu
a1842a4f11 es: Build libesX.a. 2009-09-14 13:05:15 +08:00
Chia-I Wu
73f3765270 i915: Respect mfeatures.h. 2009-09-14 13:04:58 +08:00
Chia-I Wu
33640499b9 dri/common: Protect driDispatchRemapTable with IN_DRIVER_DRIVER. 2009-09-14 13:04:58 +08:00
Chia-I Wu
0878cce17d mesa/swrast: Define _swrast_UpdateTexturePalette to NULL.
This allows swrast to be passed to _MESA_INIT_COLORTABLE_FUNCTIONS.
2009-09-14 13:04:58 +08:00
Chia-I Wu
cbd17236c8 glapi: Respect IN_DRI_DRIVER in extension_helper.h.
This allows extension_helper.h to be used with IN_DRI_DRIVER undefined.
In such case, generate macros for source level compatibility.
2009-09-14 13:04:57 +08:00
Chia-I Wu
8077986205 es/main: Report GL_OES_draw_texture only when enabled. 2009-09-14 11:51:47 +08:00
Chia-I Wu
542c26fa4f es/st: Move state tracker code to mesa/st.
State tracker is one of the mesa drivers.  It should not belong to the
es overlay.
2009-09-14 11:51:47 +08:00
Chia-I Wu
a98c282c7d es: Proper support for FEATURE_OES_draw_texture.
Update default extensions and add DrawTex driver function.
2009-09-14 11:51:47 +08:00
Chia-I Wu
dc2ddb27d3 mesa/swrast: Respect mfeatures.h.
FEATURE_accum, FEATURE_convolve, FEATURE_colortable, and FEATURE_drawpix
cover part of the functionalities of swrast module.  Disable them when
the features are disabled.
2009-09-13 17:38:05 +08:00
Chia-I Wu
0fc1cd5e91 mesa/tnl: Respect mfeatures.h.
_tnl_RasterPos should be disabled with FEATURE_rastpos.
2009-09-13 17:38:05 +08:00
Chia-I Wu
5f471a37aa es/main: Better glGetString support. 2009-09-13 17:06:21 +08:00
Chia-I Wu
9562ca3628 es/glapi: Remove unnecessary extensions from es_COMPAT.
After disabling FEATURE_beginend, many of the extensions defined for
compatibility are not needed anymore.
2009-09-13 17:06:19 +08:00
Chia-I Wu
e6f4bc9d82 mesa: New feature FEATURE_beginend.
This feature corresponds to the Begin/End paradigm.  Disabling this
feature also eliminates the use of GLvertexformat completely.
2009-09-13 17:06:16 +08:00
Chia-I Wu
2ae5bf72c2 progs/es: Link to libX11. 2009-09-12 20:56:04 +08:00
Brian Paul
cc0d078977 es: fix comment 2009-09-12 20:56:04 +08:00
Brian Paul
4938cb77f8 es: OpenGL ES 2.x demo programs 2009-09-12 20:56:04 +08:00
Brian Paul
a00d4ab589 es: updated Makefile comment 2009-09-12 20:56:03 +08:00
Brian Paul
b5abf7b08b es: update window title 2009-09-12 20:56:03 +08:00
Brian Paul
70b6b622bf es: OpenGL ES 1.x demo programs 2009-09-12 20:56:03 +08:00
Chia-I Wu
440882f547 st/es: Add OpenGL ES state trackers. 2009-09-12 20:56:03 +08:00
Chia-I Wu
e5501bd823 Makefile: Pack ES files. 2009-09-12 20:56:03 +08:00
Chia-I Wu
919fbc5524 mesa/es: Add OpenGL ES overlay.
This is primitive support for OpenGL ES.  It uses a subset of mesa
sources to build libesXgallium.a and libesXapi.a, where X is 1 for
OpenGL ES 1.x, 2 for OpenGL ES 2.x.  The static libraries serve the same
purpose as libmesagallium.a and libglapi.a do for OpenGL.

This is based on the work of opengl-es branch.
2009-09-12 20:56:03 +08:00
Chia-I Wu
55c73512c9 mesa/es: Add OpenGL ES XMLs. 2009-09-12 20:56:02 +08:00
Chia-I Wu
4cf0415cc0 glapi: Add OpenGL ES compatibility mode to scripts.
When the mode is on, the scripts would generate headers that are
suitable for OpenGL ES overlay, that will be later introduced.
2009-09-12 20:56:02 +08:00
Chia-I Wu
3de1a6584f glapi: Prefix includes with glapi.
This allows different sets of generated headers to be used.
2009-09-12 20:56:02 +08:00
Chia-I Wu
3c417b27a2 mesa/main: Add point size array. 2009-09-12 20:56:01 +08:00
Brian Paul
9ac1d3e36f mesa: silence warning 2009-09-12 20:56:01 +08:00
Brian Paul
610e200429 st: added preprocessor test for FEATURE_texture_s3tc 2009-09-12 20:56:01 +08:00
Brian Paul
de8b4f3bbd mesa: fix set_tex_parameteri() call 2009-09-12 20:56:01 +08:00
Chia-I Wu
4132e67e31 mesa/main: Provide dummy texformats when FEATURE_texture_s3tc is disabled.
Instead of removing the related enums and texture formats, provide dummy
ones when the feature is disabled.
2009-09-12 20:55:59 +08:00
Chia-I Wu
5c8873a311 mesa/main: Provide dummy texformats when FEATURE_texture_fxt1 is disabled.
Instead of removing the related enums and texture formats, provide dummy
ones when the feature is disabled.
2009-09-12 20:55:59 +08:00
Chia-I Wu
b7c133b5c2 mesa/main: Export null texformat operations. 2009-09-12 20:55:58 +08:00
Chia-I Wu
1c497bd4c6 mesa/main: Make FEATURE_dlist follow feature conventions.
As shown in mfeatures.h, this allows users of dlist.h to work without
knowing if the feature is available.
2009-09-12 20:55:58 +08:00
Chia-I Wu
17f2649e26 mesa/main: Make FEATURE_evaluators follow feature conventions.
As shown in mfeatures.h, this allows users of eval.h to work without
knowing if the feature is available.  It is renamed to FEATURE_eval
along the way.
2009-09-12 20:55:58 +08:00
Chia-I Wu
57ce3ab323 mesa/main: New feature FEATURE_queryobj.
It merges FEATURE_ARB_occlusion_query and FEATURE_EXT_timer_query, and
follows the feature conventions.
2009-09-12 20:55:57 +08:00
Chia-I Wu
7f8045ab4e mesa/main: New feature FEATURE_arrayelt.
This allows the removal of AEcontext.
2009-09-12 20:55:57 +08:00
Chia-I Wu
6fcf6a5a7f mesa/main: Make FEATURE_texgen follow feature conventions.
As shown in mfeatures.h, this allows users of texgen.h to work without
knowing if the feature is available.
2009-09-12 20:55:57 +08:00
Chia-I Wu
b04d58c0b1 mesa/main: Make FEATURE_feedback follow feature conventions.
As shown in mfeatures.h, this allows users of feedback.h to work without
knowing if the feature is available.
2009-09-12 20:55:57 +08:00
Chia-I Wu
8df670164f mesa/main: Make FEATURE_drawpix follow feature conventions.
As shown in mfeatures.h, this allows users of drawpix.h to work
without knowing if the feature is available.
2009-09-12 20:55:56 +08:00
Chia-I Wu
940b525a5a mesa/main: New feature FEATURE_rastpos.
It is separated from FEATURE_drawpix and made to follow the feature
convensions.
2009-09-12 20:55:56 +08:00
Chia-I Wu
93c3911ca8 mesa/main: Make FEATURE_histogram follow feature conventions.
As shown in mfeatures.h, this allows users of histogram.h to work without
knowing if the feature is available.
2009-09-12 20:55:56 +08:00
Chia-I Wu
c9ae896376 mesa/main: Make FEATURE_attrib_stack follow feature conventions.
As shown in mfeatures.h, this allows users of attrib.h to work without
knowing if the feature is available.
2009-09-12 20:55:55 +08:00
Chia-I Wu
bae850f9af mesa/main: Make FEATURE_accum follow feature conventions.
As shown in mfeatures.h, this allows users of accum.h to work without
knowing if the feature is available.
2009-09-12 20:55:55 +08:00
Chia-I Wu
ec86469c55 mesa/main: Make FEATURE_convolve follow feature conventions.
As shown in mfeatures.h, this allows users of convolve.h to work
without knowing if the feature is available.
2009-09-12 20:55:55 +08:00
Chia-I Wu
5bcfe4b5c8 mesa/main: Make FEATURE_colortable follow feature conventions.
As shown in mfeatures.h, this allows users of colortab.h to work
without knowing if the feature is available.
2009-09-12 20:55:55 +08:00
Chia-I Wu
57377d5d69 mesa/main: Make FEATURE_pixel_transfer follow feature conventions.
As shown in mfeatures.h, this allows users of pixel.h to work without
knowing if the feature is available.
2009-09-12 20:55:55 +08:00
Chia-I Wu
b565e7b88c mesa/main: Add comments to mfeatures.h.
The comments document the conventions that a feature may follow.
2009-09-12 20:55:54 +08:00
Chia-I Wu
c7ebd40185 Add mine configs. 2009-09-12 20:55:54 +08:00
Eric Anholt
57d16c4cc3 i965: Move OPCODE_DDX/DDY to brw_wm_emit.c and make it actually work.
Previously, it was trying to mess around with the varying's
WM setup data to produce a result.  Along with not actually working when
passed a varying, this wouldn't work if you did dFd[xy]() on a temporary.
Instead, just calculate the derivative using the neighbors in the subspan.
2009-09-11 14:13:47 -07:00
Andre Maasikas
a79eecb913 r600: fix texcoords from constants
with some minor updates from Richard.
2009-09-11 15:59:55 -04:00
Alex Deucher
08b7d32140 Revert "r600: support tex coords from constants"
This reverts commit 4099bb7614.

Tex coord src has to be a GPR.
2009-09-11 12:11:04 -04:00
Cooper Yuan
622b31925b r300g: only allocate one BO for vertex buffers, default size is 64*1024
it can fix redbook/sceneflat, scene, scenebamb, surface, nurbs and so on
2009-09-11 23:21:28 +08:00
Alex Deucher
4099bb7614 r600: support tex coords from constants
Fixes neverball among other things.
2009-09-11 11:07:58 -04:00
Andre Maasikas
4108ed7e80 r600: enable caching of vertex programs 2009-09-11 10:59:53 -04:00
José Fonseca
672c5f52d1 llvmpipe: set dirty_render_cache in llvmpipe_clear()
Based on Brian's softpipe change on
commit 988db64119. We don't use the tile
cache for zsbuf though, only for color buffers.
2009-09-11 11:29:24 +01:00
José Fonseca
1fc4100225 llvmpipe: Update status in README and TODO/FIXME comments throughout the code. 2009-09-11 11:24:26 +01:00
Eric Anholt
7c0152fbae i965: Enable loops in the VS.
Passes piglit glsl-vs-loop testcase.

Bug #20171
2009-09-10 20:43:44 -07:00
Brian Paul
0ef5b62787 mesa: nicer vertex setup 2009-09-10 19:56:35 -06:00
Brian Paul
4781c1f459 st/mesa: use st_context() helper 2009-09-10 19:40:53 -06:00
Brian Paul
6bc36f29c7 softpipe: remove no-op softpipe_init_texture_funcs() function 2009-09-10 16:51:52 -06:00
Brian Paul
209031701a softpipe: remove unused #includes, move comment 2009-09-10 16:50:18 -06:00
Brian Paul
de059d35c3 util: remove unneeded #includes 2009-09-10 16:45:25 -06:00
Brian Paul
afcaa45a94 softpipe: reformatting, clean-ups, comments 2009-09-10 16:42:47 -06:00
Brian Paul
759696defb util: minor clean-ups, reformatting 2009-09-10 16:39:13 -06:00
Brian Paul
71b3ccc4b0 softpipe: remove unneeded #includes 2009-09-10 16:38:51 -06:00
Brian Paul
d9dc4cb0e4 Merge branch 'mesa_7_6_branch' 2009-09-10 15:41:52 -06:00
Zack Rusin
8c37a4c8fd st/xorg: rename ctx to pipe to match every other gallium state tracker
plus it avoids the "ctx->ctx->" syntax
2009-09-10 17:43:25 -04:00
Brian Paul
4b1cbfcbe6 Merge branch 'mesa_7_5_branch' into mesa_7_6_branch 2009-09-10 15:40:26 -06:00
Brian Paul
9e6ae75cc8 intel: disable intel_stencil_drawpixels() for now
It doesn't work reliably even when all the prerequisite checks are made.
2009-09-10 15:34:34 -06:00
Zack Rusin
85a716bf62 st/xorg: temporarily disablie copies 2009-09-10 17:21:06 -04:00
Zack Rusin
feb74e7753 st/xorg: implement pipelines surface/texture copies 2009-09-10 17:21:06 -04:00
Zack Rusin
57d0934bc5 st/xorg: unite finalization and stub out pipelined copies 2009-09-10 17:21:06 -04:00
Zack Rusin
974dec2e7b st/xorg: abstract flushing and syncing for the exa code 2009-09-10 17:21:06 -04:00
Zack Rusin
16886c8be3 st/xorg: disable solid fills until copies are accelerated as well 2009-09-10 17:21:06 -04:00
Zack Rusin
6be1a98ab9 st/xorg: implement exasolids with full pipelining
plus fix some small issues with the shaders
2009-09-10 17:21:06 -04:00
Zack Rusin
3167c2e8a0 st/xorg: start adding support for surface fills 2009-09-10 17:21:06 -04:00
Brian Paul
4d9bbabb83 docs: document Gallium glDrawPixels(GL_STENCIL_INDEX) fix 2009-09-10 14:15:07 -06:00
Brian Paul
3f4d776199 softpipe: minor indentation fix 2009-09-10 14:14:18 -06:00
Brian Paul
988db64119 softpipe: set dirty_render_cache in softpipe_clear()
This fixes a bug seen when doing a glDrawPixels(GL_STENCIL_INDEX) right
after a glClear().  The check-for-flush test was failing because we
didn't set the dirty_render_cache flag in softpipe_clear().  So we saw
stale data when we mapped the stencil buffer.
2009-09-10 14:11:41 -06:00
Marcin Kościelnicki
18882f4d30 nv50: Fix tiling mode for lower mipmap levels. 2009-09-10 21:06:48 +02:00
Brian Paul
79a3e298c5 docs: initial 7.5.2 release notes page 2009-09-10 12:50:08 -06:00
Ian Romanick
8fd4e4dfc3 Fix merge fail
One of the conflicst from this merge was missed:

commit 0c309bb494
Merge: c6c44bf d27d659
Author: Brian Paul <brianp@vmware.com>
Date:   Wed Sep 9 08:33:39 2009 -0600
2009-09-10 11:47:24 -07:00
Brian Paul
d78a196121 tgsi: use new tgsi_call_record to handle execution mask stacks
This fixes some issues when "return"ing from nested loops/conditionals.
2009-09-10 12:45:27 -06:00
Brian Paul
c5f8594aeb mesa: need to set all stencil bits to 0 before setting the 1 bits
Plus, check for pixel transfer stencil index/offset.
2009-09-10 12:45:27 -06:00
Ian Romanick
8398535331 Merge branch 'mesa_7_5_branch' into mesa_7_6_branch
Conflicts:
	src/mesa/drivers/dri/intel/intel_context.c
2009-09-10 11:24:56 -07:00
Eric Anholt
acfea5c705 i965: Fix relocation delta for WM surfaces.
This was a regression in 0f328c90db.

Bug #23688
Bug #23254
(cherry picked from commit 5604b27b93)
2009-09-10 11:22:56 -07:00
Zhenyu Wang
2dd3da3a4a intel: add B43 chipset support
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>

Hopefully this will be one of the last cherry-picks.

(cherry picked from commit ca246dd186)
2009-09-10 11:18:41 -07:00
Eric Anholt
36dd53a3cd intel: Don't forget to map the depth read buffer in spans.
This broke BlitFramebufferEXT(GL_DEPTH_BUFFER_BIT).
2009-09-10 11:16:18 -07:00
Alex Deucher
e669dc2b0d r300: enable rb3d_discard_src_pixel_lte_threshold for more chips on dri2 2009-09-10 12:04:38 -04:00
Alex Deucher
7dfe54a60e r300: add full support for two sided stencil on r5xx for dri2 2009-09-10 12:01:19 -04:00
Mathias Frohlich
f89751e719 mesa: fix cut&paste typos 2009-09-10 08:50:16 -06:00
Brian Paul
e9ba9ffc9a mesa: in texenvprogram code, only do saturation when really needed.
For some env modes (like modulate or replace) we don't have to clamp
because we know the results will be in [0,1].
2009-09-10 08:41:12 -06:00
Vinson Lee
23fefa031f gallium: Add PIPE_OS_APPLE back to auxiliary/util/u_time.h.
Fixes typo from commit c6c44bf481.
2009-09-10 08:40:16 -06:00
Vinson Lee
c7291f69a0 util: Add PIPE_OS_APPLE back to auxiliary/util/u_time.h.
Fixes typo from commit c6c44bf481.
2009-09-10 15:33:57 +01:00
Pauli Nieminen
3d1324a66a radeon: Change debugging code to use macros instead of inline functions.
Variadic functions can't be inlined which makes debugging to have quite large
function overead. Only aleternative method is to use variadic macros which are
inlined so compiler can optimize debugging to minimize overhead.
2009-09-10 16:53:08 +03:00
José Fonseca
6a405b4a21 llvmpipe: Fix alpha test. 2009-09-10 13:35:39 +01:00
José Fonseca
4c3a48ad0c llvmpipe: Mask out color channels not present in the color buffer. 2009-09-10 12:37:44 +01:00
José Fonseca
48f19c0bcd llvmpipe: Fix sampling from depth textures. Respect texture compare func.
Fixes Mesa shadowtex sample.
2009-09-10 12:14:53 +01:00
José Fonseca
c3c80c5c22 llvmpipe: Skip blending when mask is zero.
This increases quake3 timedemo fps another 10%.
2009-09-10 12:01:42 +01:00
José Fonseca
8e6b925d2a llvmpipe: Proper control flow builders.
New control flow helper functions which keep track of all variables
and generate the correct Phi functions.

This re-enables skipping the fs execution of quads masked out by
the rasterizer, early z testing, and kill opcode.

This yields a performance improvement of around 20%.
2009-09-10 11:44:03 +01:00
José Fonseca
bd3b59da63 llvmpipe: Copy the texture target into the sampler static state.
Hunk forgotten in previous commit.
2009-09-10 09:19:51 +01:00
José Fonseca
4139bc8f43 llvmpipe: Quick hack for 1D textures. 2009-09-09 21:48:50 +01:00
José Fonseca
b0b131b023 scons: Pass -mstackrealign option to gcc.
It is impossible to have gcc generate SSE code without it, as thirdparty
applications often call us with an unaligned stack pointer.
2009-09-09 21:48:50 +01:00
José Fonseca
abc160b664 llvmpipe: Fix depth mask computation.
Fixes depth test for 24bit depth formats.
2009-09-09 21:48:50 +01:00
José Fonseca
cdbbcdf3bd llvmpipe: Include zsbuf's format in the fragment shader key. 2009-09-09 21:48:50 +01:00
José Fonseca
da912a7a16 util: Fix depth/stencil format description.
Inverse channel order.
2009-09-09 21:48:49 +01:00
José Fonseca
01c831576e llvmpipe: Debug function to check stack alignment.
Doing alignment check in locus is redundant, as gcc alignment assumptions
will optimize away the check.
2009-09-09 21:48:49 +01:00
Eric Anholt
5604b27b93 i965: Fix relocation delta for WM surfaces.
This was a regression in 0f328c90db.

Bug #23688
Bug #23254
2009-09-09 12:52:52 -07:00
Brian Paul
2b692cd6d6 mesa: include new u_format.csv file in tarballs 2009-09-09 12:01:39 -06:00
Pauli Nieminen
e0f99b8268 radeon: Add more verbose error message for failed command buffer. 2009-09-09 18:31:52 +03:00
Brian Paul
4d85a6b393 i965: fix an overlooked merge conflict 2009-09-09 09:24:38 -06:00
Alex Deucher
49c230709c r600: check if textures are actually enabled before submission
noticed by taiu on IRC.
2009-09-09 11:17:24 -04:00
Brian Paul
7bf6347362 Merge branch 'mesa_7_6_branch' 2009-09-09 09:00:58 -06:00
Brian Paul
94a8157ef6 mesa: regenerate get.c form get_gen.py 2009-09-09 08:55:32 -06:00
Brian Paul
3fed69eb16 mesa: move call to init_c_cliptest() from enable.c to tnl module.
Fixed gallium build breakage.
2009-09-09 08:54:38 -06:00
Brian Paul
0c309bb494 Merge branch 'mesa_7_5_branch' into mesa_7_6_branch
Conflicts:

	Makefile
	configs/default
	progs/glsl/Makefile
	src/gallium/auxiliary/util/u_simple_shaders.c
	src/gallium/state_trackers/glx/xlib/xm_api.c
	src/mesa/drivers/dri/i965/brw_draw_upload.c
	src/mesa/drivers/dri/i965/brw_vs_emit.c
	src/mesa/drivers/dri/intel/intel_context.h
	src/mesa/drivers/dri/intel/intel_pixel.c
	src/mesa/drivers/dri/intel/intel_pixel_read.c
	src/mesa/main/texenvprogram.c
	src/mesa/main/version.h
2009-09-09 08:33:39 -06:00
aljen
c6c44bf481 gallium: Added HaikuOS platform 2009-09-09 08:24:18 -06:00
Brian Paul
89a765e92b mesa: disable GL_LUMINANCE case in _mesa_meta_draw_pixels()
Works around a bug found on i965.  See bug 23670.
2009-09-09 08:23:14 -06:00
Vinson Lee
d27d659043 scons: Set default_dri to no for Mac OS.
Mac OS does not have libdrm.
2009-09-09 08:21:07 -06:00
Alex Deucher
da9ed257a3 r600: fix ftp for dri1
We use t->bo for dri1 since r600 uses CS for dri1.
2009-09-09 01:43:17 -04:00
Zhenyu Wang
ca246dd186 intel: add B43 chipset support
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
2009-09-09 13:28:59 +08:00
Dave Airlie
5aaa45de4c r600: don't setup hardware state if TFP
if we have a BO here it means TFP and we should have set it
up already.

tested by b0le on #radeon
2009-09-09 15:02:16 +10:00
Brian Paul
8947cf6728 progs/tests: added Z invert option 2009-09-08 16:47:30 -06:00
Brian Paul
f78eafcacb mesa: bump version to 7.7 2009-09-08 16:46:06 -06:00
Brian Paul
97cbaab541 gallium: added r8g8b8_get/put_tile_rgba() 2009-09-08 16:45:34 -06:00
Brian Paul
079ae4c38c progs/demos: added RGB invert option 2009-09-08 16:45:07 -06:00
Brian Paul
126696caf7 mesa: fix viewport_z_clip breakage 2009-09-08 16:44:49 -06:00
Jakob Bornecrantz
e589a37f7b i915g: Add buffer write callback 2009-09-09 00:43:36 +01:00
Jakob Bornecrantz
d112132840 i915g: Reorg vbuf code a bit 2009-09-09 00:43:36 +01:00
Jakob Bornecrantz
547b726484 i915g: pwrite batchbuffer instead of map 2009-09-09 00:43:36 +01:00
Jakob Bornecrantz
d585616f5b i915g: Keep vertex buffers in a fifo 2009-09-09 00:43:35 +01:00
Jakob Bornecrantz
6e61d06209 util: Add super simple fifo 2009-09-09 00:43:35 +01:00
Jakob Bornecrantz
3833587818 i915g: Map vertex buffers via gtt 2009-09-09 00:43:35 +01:00
Jakob Bornecrantz
530fbd314e i915g: Remove lib prefix from driver 2009-09-09 00:43:35 +01:00
Eric Anholt
9fff4b46d3 docs: Add basic 7.7 relnotes. 2009-09-08 15:12:22 -07:00
Eric Anholt
f959ccdfa6 intel: Add support for ARB_draw_elements_base_vertex.
On the 965, we just drop the value into the primitive packet.  On non-945,
we rely on the sw tnl code handling it.
2009-09-08 15:12:22 -07:00
Eric Anholt
92d7ed8a20 mesa: Add support for ARB_draw_elements_base_vertex. 2009-09-08 15:12:20 -07:00
Eric Anholt
ec9e729580 glapi: Add ARB_draw_elements_base_vertex 2009-09-08 14:48:47 -07:00
Eric Anholt
b11a8ea863 mesa: Expose NV_depth_clamp if ARB_depth_clamp is supported.
The wording of these two is exactly the same, except for the issue
"Can fragments with wc<=0 be generated when this extension is supported?",
which idr thinks is a non-issue for us.
2009-09-08 14:30:18 -07:00
Eric Anholt
0310aafd9e i965: Add support for ARB_depth_clamp. 2009-09-08 14:30:18 -07:00
Eric Anholt
0e5c2598ec Regenerate files for GL_ARB_depth_clamp. 2009-09-08 14:30:18 -07:00
Eric Anholt
b4922b5331 mesa: Add support for ARB_depth_clamp.
This currently doesn't include fixing up the cliptests in the assembly
paths to support ARB_depth_clamp, so enabling depth_clamp forces the C path.
2009-09-08 14:30:15 -07:00
Eric Anholt
3e4539a471 i965: Respect spec requirement for pixel shader computed depth with no zbuffer. 2009-09-08 14:28:23 -07:00
Eric Anholt
15c0cc5cf4 i965: Set NULL WM surfaces as tiled according to requirement by specs. 2009-09-08 14:28:23 -07:00
Eric Anholt
ea6dab2537 i965: Use the renderbuffer surface size instead of region size for WM surfaces.
For drawing to lower mipmap levels, the region size makes the renderbuffer
be the size of the lowest level, instead of the current level.  On DRI1,
Brian previously found that the RB size was incorrect, so leave this broken
there.
2009-09-08 14:28:23 -07:00
Eric Anholt
58a57e3fc4 Revert "intel: helper to debug bufmgr (disabled)"
This reverts commit e0ec405a9f.

This is already available in INTEL_DEBUG=bufmgr in the environment.
2009-09-08 14:28:23 -07:00
Brian Paul
42943a4cf9 mesa: bump version to 7.5.2
I'm not 100% sure there'll be a 7.5.2 release, but just in case.
2009-09-08 14:45:27 -06:00
Brian Paul
b2de028523 i965: #include clean-ups 2009-09-08 14:33:47 -06:00
Brian Paul
e61215242b intel: #include clean-ups 2009-09-08 14:33:47 -06:00
Brian Paul
8e8d3470be i965: use _mesa_is_bufferobj()
Also, remove unneeded call to _mesa_validate_pbo_access().  It's done by
core Mesa as the comment suggested.
2009-09-08 14:33:47 -06:00
Brian Paul
ced699b37a i965: use _mesa_is_bufferobj() 2009-09-08 14:33:47 -06:00
Brian Paul
abdf2e14bc i965: use _mesa_is_bufferobj() 2009-09-08 14:33:47 -06:00
Brian Paul
00aac1d29a i965: use _mesa_is_bufferobj() 2009-09-08 14:33:47 -06:00
Alex Deucher
e6ad286a80 r600: fix dri2 clipping 2009-09-08 16:03:25 -04:00
Brian Paul
8de625c7cf i965: fix incorrect test for vertex position attribute 2009-09-08 12:21:42 -06:00
Michel Dänzer
e34ea368d9 st/xorg: Add support for EXA_MIXED_PIXMAPS and EXA_SUPPORTS_PREPARE_AUX.
Also make sure not to leak malloced memory when switching pixmaps to texture
based.
2009-09-08 18:08:24 +02:00
Brian Paul
18bdb6e712 egl: also use X types for building on Apple/MacOS X
See bug 20413.
2009-09-08 09:20:43 -06:00
Vinson Lee
2c307c7750 scons: Add Mac OS to target platform list. 2009-09-08 12:32:37 +01:00
Michal Krol
fcb94f6e3e gdi: Fix prototype of gdi_softpipe_surface_buffer_create(). 2009-09-08 10:22:07 +02:00
Vinson Lee
79f48c9f9e scons: Don't set LLVM_VERSION if one of the llvm-config calls fails.
Ubuntu 8.10 has llvm-config version 2.2, which doesn't have
nativecodegen. This triggers an exception.
2009-09-07 15:16:25 +01:00
José Fonseca
b481fb2c6d llvmpipe: Silent debug statement. 2009-09-07 15:02:08 +01:00
José Fonseca
1127201088 llvmpipe: Better abs for floating points. 2009-09-07 15:02:08 +01:00
José Fonseca
e4c76c02f7 llvmpipe: Code generate the texture sampling inside the shader.
Finally a substantial performance improvement: framerates of apps using
texturing tripled, and furthermore, enabling/disabling texturing only
affects around 15% of the framerate, which means the bottleneck is now
somewhere else.

Generated texture sampling code is not complete though -- we always
sample from the base level -- so final figures will be different.
2009-09-07 15:02:08 +01:00
José Fonseca
de8376e2f2 llvmpipe: Texture sampling code generation primitives.
Only supports single level 2d textures, with neareast and bilinear
filtering for now.
2009-09-07 15:02:07 +01:00
José Fonseca
0c2ea24338 llvmpipe: Convenience function to obtain the integer type with same bitdepth of an arbitrary type. 2009-09-07 15:02:07 +01:00
José Fonseca
fa0f4b35be llvmpipe: Utility functions for linear and bilinear interpolation. 2009-09-07 15:02:07 +01:00
José Fonseca
4da20234f3 llvmpipe: Correct implementation of floor. 2009-09-07 15:02:07 +01:00
José Fonseca
b1eff018c7 llvmpipe: Utility function to get the pointer to a structure member. 2009-09-07 15:02:07 +01:00
José Fonseca
866fbacf2b llvmpipe: SoA pixel unpacking specialization. 2009-09-07 15:02:06 +01:00
José Fonseca
6b129a8222 util: Utility function to check if a number is a power of two. 2009-09-07 15:02:06 +01:00
José Fonseca
8be72bb764 llvmpipe: Further abstract the texture sampling generation from TGSI translation. 2009-09-07 15:02:06 +01:00
Michal Krol
970823978c mesa: Include <unistd.h> only when one is available. 2009-09-07 09:31:17 +02:00
Michal Krol
826d441cdf mesa: Fix calling conventions of sync object api callbacks. 2009-09-07 09:16:35 +02:00
Peter Hutterer
bf19638a00 prog/glsl: fix Makefile for samplers_array.
The rule added in 488b3c4d1b does not use the
right INCDIR, breaking the build when GL isn't installed in the default include
paths.

7.5 branch only fix, already fixed in master by rewriting the Makefile
(ceb9459ed5)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-07 12:37:54 +10:00
Michel Dänzer
617202b578 r300g: Fix some issues pointed out by compiler warnings. 2009-09-06 18:12:14 +02:00
Michel Dänzer
7b8ec0d8e7 r300g: Handle PIPE_BUFFER_USAGE_DONTBLOCK as intended.
Return NULL if the BO is busy, otherwise just map it.
2009-09-06 18:12:14 +02:00
Brian Paul
23663ae914 mesa: initial version of _mesa_meta_generate_mipmap()
Incomplete and totally untested.  Based on intel_generate_mipmap().
2009-09-06 09:39:50 -06:00
Brian Paul
4d63c626d0 xlib: test _mesa_meta_bitmap() 2009-09-06 09:37:30 -06:00
Brian Paul
886e7b318d mesa: use separate temp texture for bitmaps 2009-09-06 09:37:30 -06:00
Brian Paul
b2951ffe96 mesa: temp_texture changes 2009-09-06 09:37:30 -06:00
Brian Paul
f477fa7a85 mesa: free meta bitmap buffers 2009-09-06 09:37:29 -06:00
Brian Paul
0e5293a240 mesa: use _mesa_set_enable() 2009-09-06 09:37:29 -06:00
Brian Paul
bcb62ae78a mesa: _mesa_meta_bitmap() function 2009-09-06 09:37:29 -06:00
Brian Paul
4fdc96db1d xlib: move misplaced brace 2009-09-06 09:37:29 -06:00
Nicolai Hähnle
1ddb22675c r300g: Fix a number of warnings
Seriously guys....
2009-09-06 15:14:22 +02:00
Nicolai Hähnle
4b01e6f614 r300g: Debug flags infrastructure
So that debugging is no longer a full-spam-or-nothing approach, you are now
supposed to set the RADEON_DEBUG environment flag just like for classic Mesa.

The available debug flags are different, however. Just running an OpenGL
application with RADEON_DEBUG set to an arbitrary string will print out
helpful information.

Everything must be compiled with -DDEBUG for any of this to work
2009-09-06 15:03:52 +02:00
Cooper Yuan
9778731732 r300g: update the value of register VAP_VF_MAX_VTX_INDX
according to actual vertex index count.
2009-09-05 20:58:32 +08:00
Cooper Yuan
80ea03bd17 r300g: update rs_block state after changing rasterizer 2009-09-05 14:26:39 +08:00
Cooper Yuan
8f990f928b r300g: need to validate scissor and viewport state if bind new rasterizer 2009-09-05 10:26:39 +08:00
Alex Deucher
9ab19a3900 r600: add support for EXT_texture_sRGB 2009-09-04 18:46:16 -04:00
Alex Deucher
60ca65c016 r300: Add support for GL_EXT_provoking_vertex 2009-09-04 18:46:15 -04:00
Alex Deucher
8fd7586bcc r600: Add support for GL_EXT_provoking_vertex 2009-09-04 18:46:15 -04:00
Eric Anholt
b2cba25f9e i965: Fix warnings in intel_pixel_read.c.
(cherry picked from commit c80ce5ac90)
2009-09-04 14:41:33 -07:00
Eric Anholt
cf820a045f intel: Also get the DRI2 front buffer when doing front buffer reading.
(cherry picked from commit df70d3049a)
2009-09-04 14:40:21 -07:00
Eric Anholt
2855ee82c6 intel: Update Mesa state before span setup in glReadPixels.
We could have mapped the wrong set of draw buffers.  Noticed while looking
into a DRI2 glean ReadPixels issue.
(cherry picked from commit afc981ee46)
2009-09-04 14:40:15 -07:00
Eric Anholt
04081a164c intel: Move intel_pixel_read.c to shared for use with i965.
(cherry picked from commit dcfe0d66bf)
2009-09-04 14:40:12 -07:00
Eric Anholt
0612ad4f19 i965: Don't set the complete field when there is more VUE yet to come.
This should help with things like lightsmark, but I don't have a testcase
for this commit.
2009-09-04 14:20:09 -07:00
Eric Anholt
a47858e45e i965: Add support for 2 threads in the GS.
This brings noop vertex shader throughput from 6.8M verts/sec to 10.4M
verts/sec using GL_QUADs on my GM45.
2009-09-04 14:20:09 -07:00
Eric Anholt
8f7f22ca1d i965: Add support for KIL_NV in brw_wm_emit.c
I ran into this lack of support when writing a shader that always discarded
the fragments.
2009-09-04 14:20:08 -07:00
Eric Anholt
1d1dfc96c4 i965: Add missing state dependency of sf_unit on _NEW_BUFFERS.
(cherry picked from commit 99174e7630)
2009-09-04 14:12:37 -07:00
Eric Anholt
a9504edee3 intel: Align cubemap texture height to its padding requirements.
(cherry picked from commit a70e131584)
(cherry picked from commit 29e51c3872)
2009-09-04 14:12:37 -07:00
Eric Anholt
945d34e88a intel: Align untiled region height to 2 according to 965 docs.
This may or may not be required pre-965, but it doesn't seem unlikely, and
I'd rather be safe.
(cherry picked from commit b053474378)
2009-09-04 14:12:36 -07:00
Eric Anholt
94d3b832cc i965: Fix source depth reg setting for FSes reading and writing to depth.
For some IZ setups, we'd forget to account for the source depth register
being present, so we'd both read the wrong reg, and write output depth to
the wrong reg.

Bug #22603.
(cherry picked from commit f44916414e)
2009-09-04 14:12:36 -07:00
Eric Anholt
8c764d5c34 i965: Respect CondSwizzle in OPCODE_IF.
Fixes piglit glsl-vs-if-bool and progs/glsl/twoside, and will likely be
useful for the looping code.

Bug #18992
(cherry picked from commit 78c022acd0)
(cherry picked from commit 63d7a2f53f)
2009-09-04 14:12:36 -07:00
Brian Paul
a0b7850f1d i965: asst clean-ups, etc in brw_vs_emit()
(cherry picked from commit fd7d764514)
2009-09-04 14:12:36 -07:00
Eric Anholt
3d6c73513c i965: Emit conditional code updates as required for GLSL VS if statements.
Previously, we'd be branching based on whatever condition code happened to be
laying around.
(cherry picked from commit 7007f8b352)
2009-09-04 14:12:36 -07:00
Eric Anholt
83e6c67363 i965: Spell "conditional" correctly. 2009-09-04 14:12:36 -07:00
Eric Anholt
f396263651 i965: Fix RECT shadow sampling by not losing the other texcoords.
Bug #20821
(cherry picked from commit 191e028de2)
2009-09-04 14:12:36 -07:00
Eric Anholt
63b3fa2bce i965: Assert that the offset in the VBO is below the VBO size.
This avoids sending a bad buffer address to the GPU due to programmer error,
and is permitted by the ARB_vbo spec.  Note that we still have the opportunity
to dereference past the end of the GPU, because we aren't clipping to a
correct _MaxElement, but that appears to be harder than it should be.  This
gets us the 90% solution.

Bug #19911.
(cherry picked from commit d7430d942f)
2009-09-04 14:12:36 -07:00
Eric Anholt
217af32c2d i965: Even if no VS inputs are set, still load some amount of URB as required.
See comment on Vertex URB Entry Read Length for VS_STATE.

This, combined with the previous three commits, fixes #22945.
(cherry picked from commit e340d4f986)
2009-09-04 14:12:35 -07:00
Eric Anholt
456a16491b i965: Make sure the VS URB size is big enough to fit a VF VUE.
This fix is just from code and docs inspection, but it may fix hangs on
some applications.

(cherry picked from commit e93848e595)
2009-09-04 14:12:35 -07:00
Eric Anholt
9eca0e5350 i965: Don't emit bad packets when no VBs are referenced.
It appears that sometimes Mesa (and I suppose a VS could as well) emits
a program which references no vertex data, and thus we end up with
nr_enabled == 0 even though some VBs are enabled.  We'd end up emitting
VB/VE packet headers of 0xffffffff in that case, leading to GPU hangs.

Bug #22945 (wine with an uncompiled VS)
(cherry picked from commit d1fbfd0f96)
2009-09-04 14:12:35 -07:00
Eric Anholt
7e26bdb849 i965: Calculate enabled[] and nr_enabled once and re-use the values.
The code duplication bothered me.
(cherry picked from commit 9b9cb30d12)
2009-09-04 14:12:35 -07:00
Eric Anholt
213ac4bb5d i965: Set the max index buffer address correctly according to the docs.
It's the last addressable byte, not the byte after the end of the buffer.
(cherry picked from commit b72dea5441)
2009-09-04 14:12:35 -07:00
Brian Paul
cab307ce6b i965: rename var: s/tmp/vs_inputs/
(cherry picked from commit 840c09fc71)
2009-09-04 14:12:35 -07:00
José Fonseca
9216b4e7be scons: Used wrong exception class. 2009-09-04 19:38:35 +01:00
José Fonseca
b9f56078cd scons: Don't use scons internal functions. 2009-09-04 19:34:11 +01:00
Alex Deucher
b13a553dd4 r600: fix Elts handling
Patch from taiu on IRC.  fixes bug 23585
2009-09-04 14:07:53 -04:00
Brian Paul
592a6642fc ARB prog: replace 'unsigned' with 'gl_state_index'
Fixes compilation warnings with MSVC.
2009-09-04 09:17:59 -06:00
Brian Paul
3fedd08779 ARB prog: rename POINT, SIZE to POINT_TOK, SIZE_TOK
Fixes symbol collisions with typedefs in Microsoft headers.
Perhaps we should prefix/suffix all the lexer tokens to avoid this.
2009-09-04 09:17:59 -06:00
Brian Paul
40636fe6f2 gallium/xlib: minor clean-ups 2009-09-04 09:17:59 -06:00
Jakob Bornecrantz
65c79c9cbd i915g: Fix warnings in scons build by using byte pointers
scons build complained about void pointer math
2009-09-04 10:55:53 +01:00
Michal Krol
ce39cd6696 tgsi: Document differencies between vs_1_1 and vs_2_0 for EXPP and LOGP. 2009-09-04 09:31:22 +02:00
Brian Paul
f6dff92c9b docs: 7.5.1 md5 sums 2009-09-03 16:07:46 -06:00
Brian Paul
5d56e31e1d docs: point to fd.o for downloads instead of SourceForge 2009-09-03 16:07:46 -06:00
Brian Paul
7ec865202e gallium/xlib: silence unitialized var warning 2009-09-03 16:07:46 -06:00
Brian Paul
9e711b6865 gallium/xlib: silence uninitialized var warning 2009-09-03 16:07:46 -06:00
Brian Paul
5a8e1ddf19 st/mesa: silence uninitialized var warnings 2009-09-03 16:07:46 -06:00
Brian Paul
f1ae72e9f2 docs: prep for 7.5.1 release 2009-09-03 16:07:46 -06:00
Brian Paul
a04e83ba15 docs: added news entry for 7.5.1 2009-09-03 16:07:46 -06:00
Brian Paul
4aee0dbf81 docs: update precompiled libs info 2009-09-03 16:07:46 -06:00
Brian Paul
7e2f01e0f1 docs: move SGI GLU link 2009-09-03 16:07:46 -06:00
Brian Paul
beb05393c8 st/mesa: fix glCopyPixels(GL_STENCIL_INDEX) inverted position
If the renderbuffer orientation is Y=0=TOP we need to invert the dstY
position.
2009-09-03 16:07:46 -06:00
Keith Whitwell
8fc945cd84 st/mesa: Do GL_RGBA->GL_RGB texsubimage on hardware
State tracker currently backs GL_RGB textures with RGBA almost always.
This means we need to maintain A==1 in these textures to give correct GL_RGB
sampling results.

This change offloads the RGBA->RGB copy to hardware using the new writemask
version of u_blit_pixels.

More src/dstLogical/dstActual triples could be shifted to hardware by
this technique in future patches.
2009-09-03 16:07:45 -06:00
Keith Whitwell
862724d3c2 util: add version of u_blit_pixels which takes a writemask
Values outside the writemask are set in the destination to {0,0,0,1}
2009-09-03 16:07:45 -06:00
Brian Paul
375a6b4c4a progs/tests: re-enable exit() call
See bug 21267.
2009-09-03 16:07:45 -06:00
Brian Paul
3b96db337d docs/: document cross-compile fix 2009-09-03 16:07:45 -06:00
Alex Deucher
6a97cca081 r600: rework cb/db setup
Setup the regs when we emit rather than during state setup.
In certain cases a proper CB target was never emitted.
This fixes bug 23658.
2009-09-03 18:04:47 -04:00
Brian Paul
1960da2e09 docs: 7.5.1 md5 sums 2009-09-03 15:49:10 -06:00
Brian Paul
7d3af894d6 docs: point to fd.o for downloads instead of SourceForge 2009-09-03 15:44:49 -06:00
Brian Paul
32156f3a11 gallium/xlib: silence unitialized var warning 2009-09-03 15:44:22 -06:00
Brian Paul
1c32caf075 gallium/xlib: silence uninitialized var warning 2009-09-03 15:23:15 -06:00
Brian Paul
67c286d20e st/mesa: silence uninitialized var warnings 2009-09-03 15:04:49 -06:00
Brian Paul
0b4e835b13 docs: prep for 7.5.1 release 2009-09-03 14:57:30 -06:00
Brian Paul
08575509e4 docs: added news entry for 7.5.1 2009-09-03 14:57:16 -06:00
Brian Paul
ccb081414b docs: update precompiled libs info 2009-09-03 14:57:04 -06:00
Brian Paul
47df7900fd docs: move SGI GLU link 2009-09-03 14:56:50 -06:00
Zack Rusin
323440b3e2 st/xorg: add linear and radial gradient acceleration 2009-09-03 16:52:04 -04:00
Zack Rusin
007a843991 st/xorg: radial gradient shader 2009-09-03 16:52:04 -04:00
Zack Rusin
5571c4fe36 st/xorg: linear gradient shader 2009-09-03 16:52:04 -04:00
Brian Paul
c3a0624ef0 st/mesa: fix glCopyPixels(GL_STENCIL_INDEX) inverted position
If the renderbuffer orientation is Y=0=TOP we need to invert the dstY
position.
2009-09-03 14:39:53 -06:00
Alex Deucher
8c1d85cebe r600: make sure the active vertex shader bo is re-added to persistent list. 2009-09-03 15:23:18 -04:00
Brian Paul
dc60d0db52 glapi: fix incorrect/missing return types for glFenceSync(), glClientWaitSync() 2009-09-03 13:02:41 -06:00
Brian Paul
e059885ce3 mesa: rename gl_sync_object::Status to StatusFlag
There's a symbol collision with X11/Xlib.h #define Status int
in the Mesa xlib code.  This seems the simpliest way to work around this.
2009-09-03 12:47:25 -06:00
Ian Romanick
446a71d1f8 docs: Document new extension support for 7.6 release. 2009-09-03 11:22:47 -07:00
Eric Anholt
5e448a8d4d Add ARB_sync to the xorg sw dri driver. 2009-09-03 11:22:47 -07:00
Eric Anholt
d5ea2dce93 savage: Fix driver build post-ARB_sync.
Like s3v, clean up absurd use of Xlib in the driver, avoiding namespace
pollution.
2009-09-03 11:22:47 -07:00
Eric Anholt
19420f02d4 s3v: Fix driver build for ARB_sync.
This driver was including Xlibint.h to get the CARD32 typedef to use for
32-bit unsigned integers, which #defined Status to something.  CARD32 isn't
actually a 32-bit unsigned integer, so replacing with uint32_t usage should
fix bugs on 64-bit along with the build.
2009-09-03 11:22:47 -07:00
Eric Anholt
afd6141934 intel: Add support for ARB_sync.
We currently weasel out of supporting the timeout parameter, but otherwise
this extension looks ready, and should make the common case happy.
2009-09-03 11:22:47 -07:00
Ian Romanick
aee282faa7 ARB sync / swrast: Use GL_ARB_sync_functions instead of GL_ARB_sync. Oops. 2009-09-03 11:22:47 -07:00
Ian Romanick
0342dce226 Don't dereference function pointers in calls.
I'm apparently alone in prefering this calling convention, so I'll be
a team player. :p  Based on review comments by Brian Paul and Eric
Anholt.
2009-09-03 11:22:47 -07:00
Ian Romanick
18d3409571 Add syncobj.c to SConscript 2009-09-03 11:22:47 -07:00
Ian Romanick
6af24b6b03 Whitespace and include file clean-up.
Based on review comments by Brian Paul.
2009-09-03 11:22:47 -07:00
Ian Romanick
0f8fdd8198 Use MIN2 instead of open-coded version
Based on review comments by Brian Paul.
2009-09-03 11:22:47 -07:00
Ian Romanick
16b393d059 ARB sync: Fix delete behavior and context destruction behavior
I believe this resolves the outstanding issues WRT sync object
deletetion.  I have also added a large comment at the top of syncobj.c
describing the expected memory management behavior.  I'm still a
little uncertain about the locking on ctx->Shared.
2009-09-03 11:22:46 -07:00
Ian Romanick
f5a22721c5 Add dummy list node type 'struct simple_node' 2009-09-03 11:22:46 -07:00
Ian Romanick
f37070bab6 ARB sync: Add support for GL_ARB_sync to swrast
This isn't quite right yet.  The delete behavior and the context
clean-up needs some work.
2009-09-03 11:22:46 -07:00
Ian Romanick
96bdd993ec Eliminate trailing whitespace in extension_helper.c 2009-09-03 11:22:46 -07:00
Ian Romanick
064913430d ARB sync: Regenerate files from previous commit 2009-09-03 11:22:46 -07:00
Ian Romanick
10a09e49fc ARB sync: Add base infrastructure for GL_ARB_sync 2009-09-03 11:22:45 -07:00
Ian Romanick
10067e4641 ARB sync: Add infrastructure for glGetInteger64v 2009-09-03 11:22:45 -07:00
Brian Paul
d75a99edd6 mesa: fix typos in separable filter functions 2009-09-03 12:10:53 -06:00
Brian Paul
7a7d5879e2 mesa: compute tex env program key size based on nr_enabled_units
When no textures are enabled, the key size is 4 bytes.  If unit[0] is
enabled, the key size is 16 bytes.

Inspired by a patch from Chris Wilson.
2009-09-03 11:48:19 -06:00
Brian Paul
5cd7042088 swrast: wrap comment to 80 columns, remove dead code 2009-09-03 11:46:28 -06:00
Brian Paul
2db37ef659 mesa: use new combined PBO validate/map helpers in convolution/filter funcs 2009-09-03 11:45:18 -06:00
Brian Paul
95027a0087 mesa: use new combined PBO validate/map helpers 2009-09-03 11:45:17 -06:00
Brian Paul
dc947c8f92 mesa: combined PBO validate/map helpers 2009-09-03 11:45:17 -06:00
Brian Paul
203f395aaf mesa: use new _mesa_map_pbo_source/dest() functions in more places
This trims down the code a bit.  The next step would be to combine
the validate and map operations into one helper...
2009-09-03 11:45:17 -06:00
Brian Paul
1b448c7a5c mesa: consolidate PBO map/unmap helpers
Instead of _mesa_map_readpix_pbo() use _mesa_map_pbo_source().

Instead of _mesa_map_drawpix_pbo() and _mesa_map_bitmap_pbo() use
_mesa_map_pbo_dest().
2009-09-03 11:45:17 -06:00
Brian Paul
e0ec405a9f intel: helper to debug bufmgr (disabled) 2009-09-03 11:45:17 -06:00
Jakob Bornecrantz
3070b13f4c i915g: Up the number of relocs 2009-09-03 19:33:07 +01:00
Jakob Bornecrantz
8303c722cb i915g: Don't run in sync with HW 2009-09-03 19:33:07 +01:00
Jakob Bornecrantz
87a4fa56ae i915g: Don't send flush flags to HW 2009-09-03 19:33:07 +01:00
Zack Rusin
5643942517 st/xorg: cleanup and adjust to the changes in the ureg code 2009-09-03 12:44:15 -04:00
Zack Rusin
07f9ad5c32 st/xorg: adjust enums in preperation for gradients 2009-09-03 12:41:39 -04:00
Brian Paul
2f6d2a9e27 mesa: change ctx->Driver.BufferData() to return GLboolean for success/failure
Return GL_FALSE if we failed to allocate the buffer.  Then raise
GL_OUT_OF_MEMORY in core Mesa.
2009-09-03 09:42:38 -06:00
Keith Whitwell
848ab8be8c aux/tgsi: pull back ureg work from 0.1 branch
Manual merge of ureg changes on the branch.  Too much unrelated stuff
for a proper merge.
2009-09-03 15:16:25 +01:00
Christoph Bumiller
8b1ef3fa35 nv50: move centroid, flat bits when making interp long
Before this, just the perspective divide bit was moved in
convert_to_long of the load interpolant instruction.
2009-09-03 12:54:41 +02:00
Christoph Bumiller
ffee352726 nv50: fix vbo_static_attrib method size error
The VTX_ATTR_3/2/1F methods also had size 4 ...
a stupid copy/paste error.
2009-09-03 12:42:42 +02:00
Christoph Bumiller
c8258b95d6 nv50: fix draw_elements_inline_u08/16
We've been emitting the same two indices over and over
without incrementing map.
2009-09-03 12:42:42 +02:00
Cooper Yuan
e938d4a053 r300g: specify point/line/triangle have stuffed texture coord 2009-09-03 17:06:18 +08:00
Dave Airlie
c19b52f10f r600: visual depth has no meaning here.
fbos get angry when this happens.
2009-09-03 14:14:47 +10:00
Dave Airlie
a25d0dc9ec r600: make sure the active shader bo is re-added to persistent list. 2009-09-03 14:14:31 +10:00
Dave Airlie
5f7c532b1e radeon: pass internal format into the miptree.
We need to figure out if the compression format changes.

without this texcmp segfaults if you change format
enough times.
2009-09-03 12:02:54 +10:00
Dave Airlie
e5b93e1161 radeon/dri2: add gl20 bits for r300/r600 just like dri1 does 2009-09-03 12:01:27 +10:00
Dave Airlie
ea26f28c8f tests/texcmp: glewInit in wrong place 2009-09-03 11:33:53 +10:00
Zack Rusin
206eb50493 st/xorg: fix warnings 2009-09-02 18:39:21 -04:00
Zack Rusin
d6b58a97c2 st/xorg: handle xrender repeat modes 2009-09-02 18:38:23 -04:00
Zack Rusin
dc9de8064f st/xorg: flip the coordinate system 2009-09-02 17:21:28 -04:00
Zack Rusin
d918896a75 st/xorg: handle solid fills in the fragment shader 2009-09-02 17:16:03 -04:00
Eric Anholt
cbde276580 Revert "i965: Use VBOs in the VBO module on 965, now that we have ARB_map_buffer_range."
This reverts commit 00413d8742.  Even with
fixes, using ARB_map_buffer_range in the VBO module isn't showing up as a
significant win, and some cases apparently regressed.

Bug #23624.
2009-09-02 12:20:01 -07:00
Eric Anholt
ec32ef12b3 intel: Add support for FlushMappedBufferRange for ARB_map_buffer_range.
This should help for the usage by the VBO module, where we would upload
the whole remaining chunk of the buffer for a series of range maps that should
cover just a segment of it.
2009-09-02 12:20:00 -07:00
Eric Anholt
82313eed01 intel: Sync a synchronized READ_BIT map buffer range with GL drawing to it.
It's probably uncommon, but would obviously have gone wrong.
2009-09-02 12:20:00 -07:00
Eric Anholt
aecba6b1c8 intel: Move MapBufferRange mesa state setting up to cover the 915 case. 2009-09-02 12:20:00 -07:00
Jakob Bornecrantz
7d8f33590f st/xorg: Guard against realy old versions of Xorg 2009-09-02 19:48:49 +02:00
Keith Whitwell
e79054cc40 st/mesa: Do GL_RGBA->GL_RGB texsubimage on hardware
State tracker currently backs GL_RGB textures with RGBA almost always.
This means we need to maintain A==1 in these textures to give correct GL_RGB
sampling results.

This change offloads the RGBA->RGB copy to hardware using the new writemask
version of u_blit_pixels.

More src/dstLogical/dstActual triples could be shifted to hardware by
this technique in future patches.
2009-09-02 18:31:48 +01:00
Keith Whitwell
de343680a3 util: add version of u_blit_pixels which takes a writemask
Values outside the writemask are set in the destination to {0,0,0,1}
2009-09-02 18:31:48 +01:00
Keith Whitwell
1d7a989b10 draw: remove unused variable 2009-09-02 18:31:47 +01:00
Brian Paul
5e809216a8 Revert "mesa: fix the non-GNU C bit-field case"
This reverts commit 4b08e74982.

Don't know what I was thinking there.
2009-09-02 10:38:46 -06:00
Brian Paul
4b08e74982 mesa: fix the non-GNU C bit-field case 2009-09-02 10:12:15 -06:00
Gary Wong
d98b9f4edb mesa: silence gcc bit-field warning 2009-09-02 10:11:15 -06:00
Brian Paul
a7a3d3c271 mesa: replace 8 with NUM_UNITS 2009-09-02 09:43:10 -06:00
Brian Paul
8cb651578d mesa: remove accidentally committed printf 2009-09-02 09:25:28 -06:00
Brian Paul
83e4470d9a mesa: added #ifdef __GNUC__ around GLubyte bitfield usage
It would be nice if there were a #pragma or something to disable the warnings:

main/texenvprogram.c:87: warning: type of bit-field ‘Source’ is a GCC extension
main/texenvprogram.c:88: warning: type of bit-field ‘Operand’ is a GCC extension

but there doesn't appear to be a way to do that.
2009-09-02 08:47:47 -06:00
Chris Wilson
a46e32787d mesa: Compact state key for TexEnv program cache
By rearranging the bitfields within the key we can reduce the size
of the key from 644 to 196 bytes, reducing the cost of both the
hashing and equality tests.
2009-09-02 08:47:47 -06:00
Michel Dänzer
c0cf0fd163 st/xorg: Remove code no longer support by xserver Git master.
Shouldn't be necessary with older versions either.
2009-09-02 16:01:21 +02:00
Michel Dänzer
ea55f8ed8f st/xorg: Add support for xserver Git master DRI2 interface.
Reorganize to handle both interfaces with common code.
2009-09-02 16:00:30 +02:00
Michel Dänzer
0b26d97f4d st/dri: Slight consolidation of DRI2 buffer handling.
Always use / assume a combined depth/stencil buffer.

Also update drawable formats from surfaces returned by the driver.
2009-09-02 15:41:41 +02:00
Michel Dänzer
385620e5eb st/xorg: Add EXA UploadToScreen and DownloadFromScreen hooks. 2009-09-02 15:41:40 +02:00
Xiang, Haihao
98a8744e02 i965: CS FENCE in URB_FENCE is 11-bits wide 2009-09-02 13:28:32 +08:00
Xiang, Haihao
f5539b6991 i965: validate sf state 2009-09-02 13:28:23 +08:00
Eric Anholt
60b08eb1fd mesa: Make MultiDrawElements submit multiple primitives at once.
Previously, MultiDrawElements just called DrawElements a bunch of times.
By sending several primitives down the pipeline at once, we avoid a bunch
of validation.  On my GL demo, this improves fps by 2.5% (+/- .41%) and
reduces CPU usage by 70.5% (+/- 2.9%) (n=3).

Reviewed by: Ian Romanick <ian.d.romanick@intel.com>
2009-09-01 20:35:19 -07:00
Ben Skeggs
a82cd55a5c nv50: SWZ is the same as MOV from our perspective 2009-09-02 12:05:34 +10:00
Brian Paul
282f578dbd mesa: skip bitmap drawing code if width==0 or height==0 2009-09-01 17:40:07 -06:00
Brian Paul
29e22059a9 intel: use _mesa_expand_bitmap() to skip an intermediate buffer 2009-09-01 17:39:32 -06:00
Brian Paul
d5b6dd0001 st/mesa: use new _mesa_expand_bitmap() function 2009-09-01 17:39:32 -06:00
Brian Paul
278e76832f mesa: new _mesa_expand_bitmap() function 2009-09-01 17:39:32 -06:00
Brian Paul
921bbfc942 mesa: remove redundant assignments 2009-09-01 17:39:32 -06:00
Brian Paul
457e427e32 mesa: more clean-ups 2009-09-01 17:39:32 -06:00
Brian Paul
84d6bed4d6 mesa: change conditional to match the previous one 2009-09-01 17:39:32 -06:00
Brian Paul
25e5a6f279 mesa: updated #includes 2009-09-01 17:39:32 -06:00
Brian Paul
95136694ab mesa: remove unused texenv_fragment_program::ctx field 2009-09-01 17:39:32 -06:00
Brian Paul
1480bcacfe mesa: remove unused ureg::abs field 2009-09-01 17:39:32 -06:00
Brian Paul
c7ba2b8622 mesa: remove unused ureg:negateabs field 2009-09-01 17:39:32 -06:00
Brian Paul
9ed0315271 mesa: more comments, clean-ups 2009-09-01 17:39:31 -06:00
Brian Paul
b5ec0a6858 mesa: simplify translate_tex_src_bit() 2009-09-01 17:39:31 -06:00
Brian Paul
f337e2c495 mesa: minor code clean-ups, comments 2009-09-01 17:39:31 -06:00
Brian Paul
d55a28e3dc mesa: replace 8 with MAX_TEXTURE_UNITS 2009-09-01 17:39:31 -06:00
Brian Paul
51334d8401 dri: remove unused meta_clear_tris() 2009-09-01 17:39:31 -06:00
Brian Paul
c2542cdaff intel: use BUFFER_BITS_COLOR 2009-09-01 17:39:31 -06:00
Brian Paul
5353961344 intel: fix incorrect parameter type for intel_bufferobj_map_range() 2009-09-01 17:39:31 -06:00
Brian Paul
85d3562385 radeon: trim down #includes 2009-09-01 17:39:31 -06:00
Brian Paul
18916986b4 radeon: use _mesa_meta_clear() 2009-09-01 17:39:30 -06:00
Brian Paul
92d63931e2 mesa: obey stencil write mask in _mesa_meta_draw_pixels() 2009-09-01 17:39:30 -06:00
Brian Paul
a1e869b417 intel: set Length/Offset fields in intel_bufferobj_map() 2009-09-01 17:39:30 -06:00
Brian Paul
15e6d08670 intel: use _mesa_meta_copy_pixels() when do_blit_copypixels() fails
Also, trim down #includes.
2009-09-01 17:39:30 -06:00
Brian Paul
be229d24c4 intel: trim down #includes 2009-09-01 17:39:30 -06:00
Brian Paul
886a0a7150 intel: use _mesa_meta_draw_pixels()
The textured quad path is slightly faster and will work with POT textures
on i945.
2009-09-01 17:39:30 -06:00
Brian Paul
90cba4a839 intel: trim down #includes 2009-09-01 17:39:30 -06:00
Brian Paul
50d8b295f6 intel: use _mesa_meta_clear(), it's a bit faster 2009-09-01 17:39:30 -06:00
Pauli Nieminen
06bf6628aa radeon: Fix OQ to set ful lstate as dirty too. 2009-09-02 02:04:10 +03:00
Pauli Nieminen
9f650e19dd radeon: Fix debug output to filter out less critical messages instead of more critical. 2009-09-02 02:04:10 +03:00
Zack Rusin
7e4487ad5c st/xorg: getting indexes right tends to be helpful 2009-09-01 19:01:05 -04:00
Zack Rusin
5c746d9214 st/xorg: redo the vertex shader 2009-09-01 18:59:01 -04:00
Zack Rusin
a8cbb15632 st/xorg: setup solid fills 2009-09-01 17:49:32 -04:00
Zack Rusin
811aa02c7a st/xorg: fold back the helper function into core 2009-09-01 14:44:55 -04:00
Zack Rusin
91c366359c st/xorg: start rendering and compositing pictures 2009-09-01 14:44:55 -04:00
Ian Romanick
847bc5c852 ARB prog parser: Fix handling of stateOptModMatNum
The optional array index should clearly be enclosed in square
brackets.  This helps the oglconform test vp_binding.c get a bit
farther, but it still fails.
2009-09-01 11:11:31 -07:00
Keith Whitwell
b3f4b56a3b tgsi: remove redundant CND0 opcode
Can be implemented with CMP src2, src1, src0
2009-09-01 17:30:01 +01:00
Brian Paul
d9b7d7875b progs/tests: re-enable exit() call
See bug 21267.
2009-09-01 08:53:34 -06:00
José Fonseca
836a9f0ae6 scons: Tool for LLVM. Gracefully disable llvmpipe if LLVM not found. 2009-09-01 12:26:00 +01:00
Jakob Bornecrantz
8c3f622a34 trace: Don't set surface_[fill|copy] if not set on pipe 2009-09-01 11:56:14 +02:00
Cooper Yuan
165e87c491 r300g: Fix clear issue on r300 2009-09-01 17:59:03 +08:00
Dave Airlie
7d36153766 radeon: fix r100/r200 polygon stipple under kms
There really need to use state emits under kms, otherwise
we end up with some dwords in the command buffer before we've
ever emitted any useful state.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-01 16:06:02 +10:00
Dave Airlie
a2bd13fec9 r100: fixup cubemap domains 2009-09-01 15:18:17 +10:00
Brian Paul
ae5d78198f xlib: plug in more meta functions, if TEST_META_FUNCS is set 2009-08-31 21:15:39 -06:00
Brian Paul
056612241a mesa: implement GL_DEPTH_BUFFER_BIT for _mesa_meta_blit_framebuffer() 2009-08-31 21:15:39 -06:00
Brian Paul
7a78e6e8af mesa: disable another debug test 2009-08-31 21:15:38 -06:00
Brian Paul
5b0f7c6c3b mesa: make verts[] arrays local vars 2009-08-31 21:15:38 -06:00
Dave Airlie
97aa3d553f r200: emit cube for kms correctly + fix tex emit reset
CS checker found some issues.
2009-09-01 12:54:48 +10:00
Brian Paul
8126dfa9c2 xlib: option to enable/test meta functions (disabled) 2009-08-31 19:34:47 -06:00
Brian Paul
1fc713a1e7 mesa: implement depth/stencil formats for meta glDrawPixels 2009-08-31 19:34:47 -06:00
Brian Paul
9c41931c0f mesa: remove accidentally commited debug/disabled code 2009-08-31 19:34:47 -06:00
Brian Paul
10d81f4667 mesa: added _mesa_is_stencil_format() 2009-08-31 19:34:47 -06:00
Brian Paul
d762b5459b progs/samples: added test/debug code for culling 2009-08-31 19:34:47 -06:00
Brian Paul
a1d3855fb0 swrast: fix selection/feedback regression
This fixes a conform selection/feedback regression introduced by commit
8f4d66c5f8
2009-08-31 19:34:47 -06:00
Brian Paul
c0633ddabb mesa: debug printf for KIL 2009-08-31 19:34:47 -06:00
Brian Paul
b3232e9280 progs/tests: disable depth test for second glDrawPixels
We don't want to z-test that glDrawPixels.  Also, set the raster color to
red when drawing GL_DEPTH_COMPONENT image to aid in debugging.
2009-08-31 19:34:47 -06:00
Brian Paul
18656201ef swrast: can't use deferred texture/shading if using KIL instruction
If the fragment program uses KIL, we have to execute it before z/stencil
testing.  Otherwise, deferred texture/shading lets us skip shading for
pixels that fail z/stencil testing.
2009-08-31 19:34:47 -06:00
Dave Airlie
31a5a9e9cc r300/compiler: fix warning due to no newline 2009-09-01 10:50:40 +10:00
Dave Airlie
e3a17904dd r200: emit max vtx info for index buffer.
We need this for the CS bounds checking.
2009-09-01 10:50:31 +10:00
Brian Paul
3f785080db swrast: fix selection/feedback regression
This fixes a conform selection/feedback regression introduced by commit
8f4d66c5f8
2009-08-31 17:54:46 -06:00
Jakob Bornecrantz
935e4c56e5 i915g: Implement new winsys 2009-09-01 00:47:02 +01:00
Jakob Bornecrantz
d2110064c2 i915g: Switch from pipe_winsys to intel_winsys
Also includes moving lots of functions from i915_batch.h
	into intel_batchbuffer.h
2009-09-01 00:47:02 +01:00
Jakob Bornecrantz
dd040753d7 i915g: Add header file for new winsys interface 2009-09-01 00:47:01 +01:00
Jakob Bornecrantz
105e4b093e i915g: Add new buffer code not yet hocked up 2009-09-01 00:46:56 +01:00
Jakob Bornecrantz
7b32da0b11 st/xorg: Fix crash in MPH 2009-09-01 00:44:36 +01:00
Pauli Nieminen
c4a3e036ed radeon: Fix null pointer reference in debug system if no context is bind. 2009-09-01 00:39:20 +03:00
Brian Paul
fcf0804c05 swrast: can't use deferred texture/shading if using KIL instruction
If the fragment program uses KIL, we have to execute it before z/stencil
testing.  Otherwise, deferred texture/shading lets us skip shading for
pixels that fail z/stencil testing.
2009-08-31 13:28:31 -06:00
Pauli Nieminen
d028cf9313 r600: Add more trace debug output to rendering pipeline. 2009-08-31 20:44:11 +03:00
Pauli Nieminen
fde929c4fd radeon: Add support for indenting debug output.
Indetion can be used to make it easier to read debug code when sections of debug output are indented.
2009-08-31 20:39:43 +03:00
Pauli Nieminen
7870edc778 radeon: Add comment warning about not choosing critical debug level. 2009-08-31 20:27:49 +03:00
Pauli Nieminen
6c963fbdd1 radeon: Change default debug level to verbose.
Verbose is a lot better for developement but we should considre changing it to normal in stable branch.
2009-08-31 20:27:49 +03:00
Pauli Nieminen
012e990160 r300: Convert to shared debug code. 2009-08-31 20:27:49 +03:00
Pauli Nieminen
239105c6c8 r200: Convert r200 to use new style debug code.
Only very few places where realy converted so there isa lot of to do.
2009-08-31 20:27:49 +03:00
Pauli Nieminen
aabb36fdd5 r600: Convert to shared debug code and add a few new debug messages.
There is only a few functions that have debugging enabled now.
2009-08-31 20:27:49 +03:00
Pauli Nieminen
fe62e4c3ff radeon: Make OQ to use new style debugging. 2009-08-31 20:27:48 +03:00
Pauli Nieminen
b6ebcf8156 radeon: Add gcc attribute to enable pritnf format warnings. 2009-08-31 20:27:48 +03:00
Pauli Nieminen
4e0d99a635 r100: Use shared debug code.
Converted r100 to use shared debug code with sed and fast compile check. New
code has compability layer so old debugging code doesn't have to be changed
all immidiatly.
2009-08-31 20:27:48 +03:00
Pauli Nieminen
f9a4a0a971 radeon: Add common debugging functions.
These function are aiming to make it very simple to add and keep large amount
of debugging code without having runtime impact in relase builds. Basic idea
is to expose simple printf style debugging functions that are inlined.

Level parameter will be evalueted in compile time so compiler can optimise
some of debugging functions out if compile time request for debug level is too
tight.
2009-08-31 20:27:48 +03:00
Brian Paul
a5e7003565 mesa: added const qualifiers, move local var 2009-08-31 11:22:36 -06:00
Brian Paul
956e6c3978 mesa: fix saturation logic in emit_texenv()
We need to clamp/saturate after each texenv stage, not just the last one.
Fixes glean texEnv failure for softpipe (and probably other fragment program-
based drivers).
2009-08-31 11:22:36 -06:00
Brian Paul
aca8dbcaa6 docs: fixed glXCreateGLXPixmap() for direct rendering 2009-08-31 11:22:36 -06:00
Brian Paul
1d64a4ceb3 docs/: document cross-compile fix 2009-08-31 11:22:36 -06:00
Marc Dietrich
c705e72382 mesa: fix 32bit cross compilation on a 64bit machine
When cross compiling on a 64bit machine, gen_matypes.c is build
for the host machine (64bit) but must generates code for the target
machine (32bit). This causes wrong offsets all over the place and
crashes googleearth on my machine. Solution is to add -m32 when
cross compiling.

Attached patch is compatible with linux-x86-32 and autoconf based
builds.
2009-08-31 11:22:36 -06:00
Zack Rusin
f315c0128b st/xorg: add code to render textured quads for composite acceleration 2009-08-31 13:26:01 -04:00
Zack Rusin
9ccbadb22d st/xorg: setup constant buffers for vertex and fragment shaders 2009-08-31 13:26:01 -04:00
Brian Paul
9f36473a8e mesa: added const qualifiers, move local var 2009-08-31 11:17:59 -06:00
Brian Paul
2241665dc6 mesa: fix saturation logic in emit_texenv()
We need to clamp/saturate after each texenv stage, not just the last one.
Fixes glean texEnv failure for softpipe (and probably other fragment program-
based drivers).
2009-08-31 11:14:16 -06:00
Michel Dänzer
3c3ad915d8 st/xorg: Re-organize the EXA ModifyPixmapHeader hook a bit.
This should also handle the case where the pixmap is backed by a (different)
texture before and afterwards.
2009-08-31 18:41:54 +02:00
Michel Dänzer
40e3148a81 st/xorg: Simplify EXA ModifyPixmapHeader hook for pPixmap != NULL.
Just let the upper layers handle it.
2009-08-31 18:41:54 +02:00
Michel Dänzer
366efd8c4b st/xorg: Don't always fall back for solid fills. 2009-08-31 18:41:53 +02:00
Brian Paul
6bf86681f5 docs: fixed glXCreateGLXPixmap() for direct rendering 2009-08-31 10:32:56 -06:00
Brian Paul
f7654faf16 docs/: document cross-compile fix 2009-08-31 10:32:14 -06:00
Marc Dietrich
a48ee529a2 mesa: fix 32bit cross compilation on a 64bit machine
When cross compiling on a 64bit machine, gen_matypes.c is build
for the host machine (64bit) but must generates code for the target
machine (32bit). This causes wrong offsets all over the place and
crashes googleearth on my machine. Solution is to add -m32 when
cross compiling.

Attached patch is compatible with linux-x86-32 and autoconf based
builds.
2009-08-31 10:32:14 -06:00
Alex Deucher
1b1673fa63 r600: add missing r7xx pci id 2009-08-31 12:18:44 -04:00
Jakob Bornecrantz
5f7b46ae5f i915g: Reorg texture layout code 2009-08-31 16:29:59 +01:00
Jakob Bornecrantz
761c8c7076 i915g: Move transfer functions into i915_texture.c 2009-08-31 16:29:58 +01:00
Jakob Bornecrantz
5374aff56f i915g: Reorg texture code a bit 2009-08-31 16:29:58 +01:00
Jakob Bornecrantz
f260652153 i915g: Don't use winsys directly in the driver 2009-08-31 16:29:58 +01:00
Jakob Bornecrantz
bd0c51874f i915g: Cleanup i915_prim_vbuf.c 2009-08-31 16:29:58 +01:00
Jakob Bornecrantz
1bb3a2c648 i915g: Cleanup i915_screen.[c|h] 2009-08-31 16:29:58 +01:00
Jakob Bornecrantz
1b5f46a3b8 i915g: Cleanup i915_context.c 2009-08-31 16:29:58 +01:00
Jakob Bornecrantz
7864b0e717 i915g: Cleanup i915_blit.[c|h] 2009-08-31 16:29:58 +01:00
Jakob Bornecrantz
5d929366aa i915g: Cleanup i915_state_emit.c 2009-08-31 16:29:57 +01:00
Jakob Bornecrantz
00b0728094 i915g: Cleanup i915_texture.c 2009-08-31 16:29:57 +01:00
Jakob Bornecrantz
4224bda684 i915g: Cleanup texture init functions a bit 2009-08-31 16:29:57 +01:00
Jakob Bornecrantz
e1741dbe45 i915g: Rename pipe field on context to base 2009-08-31 16:29:57 +01:00
Jakob Bornecrantz
ad25d450ec i915g: Rename screen field on screen to base 2009-08-31 16:29:57 +01:00
Brian Paul
2b6ab615a4 mesa: set additional fields in _mesa_buffer_map_range() 2009-08-31 09:12:04 -06:00
Brian Paul
d1da8acd82 mesa: set Length/Offset fields in _mesa_buffer_map() 2009-08-31 09:05:28 -06:00
Brian Paul
822c796481 mesa: additional assertions for ctx->Driver.UnmapBuffer()
The Pointer, Offset and Lenght fields should be cleared by the driver function
since ctx->Driver.Unmap() may be called from VBO code, etc.
2009-08-31 09:01:58 -06:00
Brian Paul
28c159d614 intel: clear buffer fields in intel_bufferobj_unmap() 2009-08-31 09:01:44 -06:00
Brian Paul
92033a9516 mesa: new assertions, comments about buffer mapping
Since ctx->Driver.MapBuffer() and ctx->Driver.MapBufferRange() may be called
from other places in Mesa (such as VBO) it's important that the driver
callbacks set all the buffer object fields properly (Pointer, Offset, Length,
etc).  Add assertions to make sure that the driver does that.
2009-08-31 08:50:15 -06:00
Brian Paul
c69a4dce75 st/mesa: fix obj->Pointer offset in st_bufferobj_map_range()
This fixes a bunch of gallium regressions since
commit 8096aa5213
2009-08-31 08:49:24 -06:00
José Fonseca
241c3a1d80 llvmpipe: Fallback to element-wise comparisons when no comparison intrinsic is available.
Although selection of vector elements is valid LLVM IR, no machine target
supports it yet.

This is a last-resort option, but it allows llvmpipe to be used on any
target supported by LLVM without modifications. Obviously better
performance is attainable by emitting SIMD intrinsics where otherwise
LLVM doesn't.
2009-08-31 10:22:36 +01:00
José Fonseca
45fb66ab7b llvmpipe: In the abcense of a min/max intrinsic, use the comparison intrinsics. 2009-08-31 10:00:38 +01:00
José Fonseca
b995af25d0 llvmpipe: Actually commit lp_buffer.[ch].
Thanks Michel.
2009-08-31 09:34:04 +01:00
Michel Dänzer
9f0495aa76 Gallium xlib: Add support for BGRA visuals. 2009-08-31 10:22:19 +02:00
Ben Skeggs
1ea114958b nouveau: fix for dri state tracker changes 2009-08-31 13:39:45 +10:00
Ben Skeggs
02f3245448 nouveau: introduce nouveau_miptree common to all nouveau pipe drivers
The winsys once again has to know about textures it seems, so we need a
common representation between all our pipe drivers to store some
information the winsys will need.

Only the nv50 driver has been fixed so far.
2009-08-31 13:39:38 +10:00
Ben Skeggs
500b260494 nouveau: hack winsys to compile again, it's broken still however 2009-08-31 12:55:56 +10:00
Marc Dietrich
a192da37ed cell: fix compilation 2009-08-30 09:24:27 -06:00
Brian Paul
d6b8664e3c swrast: minor code consolidation 2009-08-30 09:21:20 -06:00
Brian Paul
04f8193aad mesa: consolidate texture-related code in meta.c
Also, allow using texture rectangles, NPOT textures or regular POT textures
(preferred in that order).
2009-08-30 09:15:24 -06:00
Brian Paul
7dd6fa12e1 progs/util: minor updates to glutskel.c 2009-08-30 09:10:36 -06:00
Brian Paul
a068e098e2 intel: use more efficient loop over buffers 2009-08-30 09:10:36 -06:00
Brian Paul
0243f79eac mesa: avoid redundant viewport changes in meta code 2009-08-30 09:10:36 -06:00
José Fonseca
c28f253ac2 llvmpipe: Texture cache in 4 ubytes instead of 4 floats.
This is more a short term experiment than a long term commitment, as we'll
need to support higher precision textures too, as this will all be
be replaced by runtime generated code.

With this change most Mesa demos fps increased around 10%. Not a huge
improvement, but not a negligible one either.
2009-08-30 12:37:03 +01:00
José Fonseca
62b586fce4 llvmpipe: Use util_format_read_4f to read texture tiles. 2009-08-30 12:37:03 +01:00
José Fonseca
ffe1b7bad8 llvmpipe: Texture cache is read-only. No need to flush. 2009-08-30 12:37:03 +01:00
José Fonseca
3d30524393 util: Auto generate pixel format accessor functions from
This has several advantages over the u_
 - not hand written
 - no intermediate memcpy of raw pixels
 - supports 4 ubytes in addition to floats
 - no need to pass a pipe_transfer

It also has (hopefully temporary) limitations:
 - no support for YUV
 - no support for SRGB
2009-08-30 12:37:03 +01:00
José Fonseca
379304a72c llvmpipe: Eliminate internal pipe_buffer_map/unmap usage. 2009-08-30 12:37:03 +01:00
José Fonseca
d336ef410a xlib: Implement lp_winsys::destroy. 2009-08-30 12:37:03 +01:00
Michel Dänzer
9053bb0d40 Merge branch 'mesa_7_5_branch'
Conflicts:
	src/glx/x11/glxcmds.c
2009-08-30 13:06:18 +02:00
Michel Dänzer
edb1178798 glx/x11: Fix glXCreateGLXPixmap for direct rendering.
Fixes progs/xdemos/glxpixmap modified to use direct rendering.
2009-08-30 12:53:00 +02:00
Eric Anholt
3c1172f066 i965: Fix segfault with ARB_oq CheckQuery when results are already fetched. 2009-08-29 13:29:38 -07:00
Eric Anholt
09549704c6 i965: Support PROGRAM_ENV_PARAMs in brw_vs_emit.c 2009-08-29 13:29:38 -07:00
José Fonseca
c9adb4c9cb llvmpipe: List lp_buffer.c in the Makefile. 2009-08-29 20:07:53 +01:00
José Fonseca
85a0a4b296 xlib: Implement llvmpipe lp_winsys interface. 2009-08-29 20:03:44 +01:00
José Fonseca
e173a9bbd6 llvmpipe: Define an winsys for LLVM. Drop pipe_winsys
lp_winsys will eventually be unified with softpipe's eventually, but we
are free to move quicker since we don't have the myriad of users yet.

Will provide a pipe_winsys adaptor from Keith's softpipe-private-winsys
soon.
2009-08-29 20:03:44 +01:00
Pauli Nieminen
e48dc9c5ed r300: Disable threshold register for KMS.
Kernel side doesn't have required register in safe list so can't send it kernel.
2009-08-29 21:05:22 +03:00
Pauli Nieminen
9c0ab1fa85 r300: Swtcl prediction was still missing scissors.
All that state stuff should really be in state atoms :/
2009-08-29 21:05:19 +03:00
Pauli Nieminen
32df8922a9 r300: Add missing pre_emit_count to swtcl state size prediction. 2009-08-29 18:40:44 +03:00
Christoph Bumiller
8313801911 nv50: set provoking vertex state 2009-08-29 17:22:12 +02:00
José Fonseca
da1248bee5 xlib: Update llvmpipe integration for changes in master. 2009-08-29 09:21:42 +01:00
José Fonseca
f04ce6276b llvmpipe: Update for changes in master. 2009-08-29 09:21:42 +01:00
José Fonseca
6818eb9b90 mesa: Update sconscript for new ARB/FP assembler. 2009-08-29 09:21:42 +01:00
José Fonseca
fdb3e75f7e util: Add util_unsigned_logbase2.
Cherry picked from Keith's commit f911c3b989.
2009-08-29 09:21:42 +01:00
José Fonseca
c40eddd294 llvmpipe: Isolate sampling from TGSI translation. 2009-08-29 09:21:42 +01:00
José Fonseca
d4806c64a2 llvmpipe: Better structure dereference naming. 2009-08-29 09:21:42 +01:00
José Fonseca
8aa62cead7 llvmpipe: Fix shader variant key construction.
Fixes the blank screen on non-64bit mode.
2009-08-29 09:21:42 +01:00
José Fonseca
1e6cc1cf37 llvmpipe: Fix build. 2009-08-29 09:21:42 +01:00
José Fonseca
f311bacebd llvmpipe: Merge all pixel format related files. 2009-08-29 09:21:42 +01:00
José Fonseca
f85c5f8621 llvmpipe: Factor out and optimize the input interpolation.
Special attention is given to the interpolation of side by side quads.
Multiplications are made only for the first quad. Interpolation of
inputs for posterior quads are done exclusively with additions, and
perspective divide if necessary.
2009-08-29 09:21:41 +01:00
José Fonseca
03180dca7a llvmpipe: Pre-declare fetch_texel. 2009-08-29 09:21:41 +01:00
José Fonseca
635c37e118 llvmpipe: Pass the alpha ref value and blend color in the jit context. 2009-08-29 09:21:41 +01:00
José Fonseca
c022e15d1e llvmpipe: Pass fragment context to generated function in a single structure. 2009-08-29 09:21:41 +01:00
José Fonseca
8c7c108d71 llvmpipe: Structure manipulation helpers. 2009-08-29 09:21:41 +01:00
José Fonseca
08dd41fd68 llvmpipe: Centralize the C <-> JIT interfaces in one place. 2009-08-29 09:21:41 +01:00
José Fonseca
97b4681d7e llvmpipe: Drop blend derived state.
Already included in the fragment shader.
2009-08-29 09:21:41 +01:00
Keith Whitwell
04de13b9cd llvmpipe: keep texture stride 16byte aligned
Fixes crash when resizing gears window.
2009-08-29 09:21:41 +01:00
José Fonseca
4d2b0eb19e llvmpipe: Squash the quad pipeline.
It had been reduced to one fixed stage.
2009-08-29 09:21:41 +01:00
José Fonseca
77b35dc179 llvmpipe: s/uni/scalar/.
More obvious name.
2009-08-29 09:21:40 +01:00
José Fonseca
5811ed87d7 llvmpipe: Add a bunch of comments.
Description/rationale/to-do items, while I still remember them...
2009-08-29 09:21:40 +01:00
José Fonseca
3f36f4b051 llvmpipe: Split off vs stuff from lp_state_fs.c.
lp_state_fs.c is already too big without it.
2009-08-29 09:21:40 +01:00
José Fonseca
c3b7406667 llvmpipe: Avoid duplicate clamping when converting between types. 2009-08-29 09:21:40 +01:00
José Fonseca
9897180279 llvmpipe: Generate the fragment pipeline into a single function.
Still hackish. Will document and optimize later.
2009-08-29 09:21:40 +01:00
José Fonseca
64cc71167f llvmpipe: Get conversions working correctly for all integer types. 2009-08-29 09:21:39 +01:00
José Fonseca
53f9a1180e llvmpipe: Delete the quad polygon stipple stage.
Not used now -- stipple done by the draw module. May code generate later.
2009-08-29 09:21:39 +01:00
José Fonseca
3d7a88674f llvmpipe: Early depth testing. 2009-08-29 09:21:39 +01:00
José Fonseca
90b5df8d1b llvmpipe: Disassemble beyond referred code beyond the RET instruction. 2009-08-29 09:21:39 +01:00
José Fonseca
c5531f575b llvmpipe: Split control flow function declarations and notes. 2009-08-29 09:21:39 +01:00
José Fonseca
1e4376a68f llvmpipe: Back port recent softpipe-opt improvements from Keith. 2009-08-29 09:21:39 +01:00
José Fonseca
f10ee9a0a1 llvmpipe: Don't limit the number of tiles in the cache. 2009-08-29 09:21:39 +01:00
José Fonseca
87c383a2e5 llvmpipe: Clean dead tile cache code. 2009-08-29 09:21:39 +01:00
José Fonseca
e3baeb3f14 llvmpipe: Simplify tile clears. Use pipe_fill_rect instead of scratch tile. 2009-08-29 09:21:38 +01:00
José Fonseca
d94fbb4a48 llvmpipe: Start hiding llvmpipe_cached_tile. 2009-08-29 09:21:38 +01:00
José Fonseca
1cb9ce0d27 llvmpipe: Drop depth/stencil support from tile cache. 2009-08-29 09:21:38 +01:00
José Fonseca
e3b38e5ec1 llvmpipe: Code generate the depth test, and include in the shader.
Only 32bit depth/stencil surfaces supported for now. Stencil ops not
implemented yet.
2009-08-29 09:21:38 +01:00
José Fonseca
db35ac36d9 llvmpipe: Update texture block from format. 2009-08-29 09:21:38 +01:00
José Fonseca
343ccc8dd0 llvmpipe: Depth test to LLVM IR translation. 2009-08-29 09:21:38 +01:00
José Fonseca
c0472f9c34 llvmpipe: Centralize mask update logic. 2009-08-29 09:21:37 +01:00
José Fonseca
3dbf00f9ab llvmpipe: Clamped float to unsigned norm via mantissa manipulation. 2009-08-29 09:21:37 +01:00
José Fonseca
33ce51bc0d llvmpipe: Several fixes of the conversion test. 2009-08-29 09:21:37 +01:00
José Fonseca
d07b038366 llvmpipe: Generate instrinsics for integer comparisons.
It is a little messy, given the available instrucions form SIMD
integer comparisons is rather limited.
2009-08-29 09:21:37 +01:00
José Fonseca
89146cd48d llvmpipe: Mention the ability to get microbenchmarks from the unit tests.
Even better would be to have a -h/--help option to the tests...
2009-08-29 09:21:37 +01:00
José Fonseca
9ae47069b4 llvmpipe: Code generate alpha testing and append to generated fragment shader. 2009-08-29 09:21:37 +01:00
José Fonseca
b5e397c369 util: Dump PIPE_FUNC_x value names. 2009-08-29 09:21:37 +01:00
Brian Paul
d6d4f8b66e llvmpipe: use the udis86 lib to print the x86 assembly code 2009-08-29 09:21:36 +01:00
Brian Paul
03b388e1c9 llvmpipe: frag shader comments 2009-08-29 09:21:36 +01:00
Brian Paul
0f6c621aee llvmpipe: blend comments 2009-08-29 09:21:36 +01:00
Brian Paul
8329e59958 llvmpipe: comments about blend generator 2009-08-29 09:21:36 +01:00
Brian Paul
f586d9546b llvmpipe: basic comments 2009-08-29 09:21:36 +01:00
José Fonseca
b9f2f01315 llvmpipe: Hack to force the line/point rasterization also fit the blend function expectations. 2009-08-29 09:21:35 +01:00
José Fonseca
7643da88a3 llvmpipe: Refer my udis86 branch which decodes more opcodes. 2009-08-29 09:21:35 +01:00
José Fonseca
7c2dc3faa8 llvmpipe: Code generate the position interpolation. 2009-08-29 09:21:35 +01:00
José Fonseca
6f5cd15f80 llvmpipe: Simpler variant of lp_build_broadcast_scalar. 2009-08-29 09:21:35 +01:00
José Fonseca
17baa01bfb llvmpipe: Put the position coefficients together with the inputs.
The automatic search'n'replace leaves lp_setup.c a bit ugly, but this code
will be eventually code generated as well.
2009-08-29 09:21:35 +01:00
José Fonseca
7926b42d41 llvmpipe: Implement saturation. 2009-08-29 09:21:35 +01:00
José Fonseca
39352b3443 llvmpipe: Put color/depth directly into the quad structure. 2009-08-29 09:21:35 +01:00
Brian Paul
4c6fd574b1 llvmpipe: re-enable other gallium drivers
No more symbol collisions between drivers, AFAICT.
2009-08-29 09:21:35 +01:00
Brian Paul
908d8d7a1b llvmpipe: prefix point/line/tri_setup() functions with llvmpipe_
Avoid symbol collisions with softpipe.
2009-08-29 09:21:35 +01:00
Brian Paul
1ea1cd8468 llvmpipe: repurpose linux-llvm config to build the llvmpipe driver
The gallivm module is no longer built.  If/when gallivm is resuscitated we
can revisit this.
2009-08-29 09:21:35 +01:00
Brian Paul
137afe6a55 llvmpipe: updated Makefile C_SOURCES 2009-08-29 09:21:34 +01:00
Brian Paul
aa2514d12d llvmpipe: add missing break in xlib _init() 2009-08-29 09:21:34 +01:00
José Fonseca
556eecea67 llvmpipe: Allow to build without udis86. 2009-08-29 09:21:34 +01:00
José Fonseca
2fef9b3369 llvmpipe: Drop the FETCH/STORE macros. 2009-08-29 09:21:34 +01:00
José Fonseca
5999ebfb69 llvmpipe: Debug helper function to name llvm intermediate values. 2009-08-29 09:21:34 +01:00
Keith Whitwell
a22f87c994 llvmpipe: use align_malloc for all structs containing ALIGN16 members
Unless the struct is allocated aligned, aligning the members isn't very
helpful.
2009-08-29 09:21:34 +01:00
José Fonseca
49d83fdc45 llvmpipe: Document that llvm 2.5 is expected. 2009-08-29 09:21:34 +01:00
José Fonseca
8df64bb2fe llvmpipe: Briefly describe current status. 2009-08-29 09:21:34 +01:00
José Fonseca
bb867b0ae4 llvmpipe: Blend in place. 2009-08-29 09:21:34 +01:00
José Fonseca
4a414d8f87 llvmpipe: Code generate logic ops. 2009-08-29 09:21:34 +01:00
José Fonseca
3014919211 llvmpipe: Rasterize the quads according to what the blend function expects. 2009-08-29 09:21:34 +01:00
José Fonseca
efab431684 llvmpipe: Tile in SoA format identical to the blender function output. 2009-08-29 09:21:34 +01:00
José Fonseca
ee066eaf6d llvmpipe: Allow to dump the disassembly byte code.
Useful as dis86 doesn't disassemble some SSE4 opcodes yet.
2009-08-29 09:21:33 +01:00
José Fonseca
c5abcac7ef llvmpipe: Implement LIT. 2009-08-29 09:21:33 +01:00
José Fonseca
09a7b011ac llvmpipe: Move lp_build_select to lp_bld_logic.[ch]. 2009-08-29 09:21:33 +01:00
José Fonseca
1aae039ee2 llvmpipe: Implement comparison opcodes. 2009-08-29 09:21:33 +01:00
José Fonseca
aede39efd8 llvmpipe: Fix translation of KIL with repeated swizzles. 2009-08-29 09:21:33 +01:00
José Fonseca
81e7ec485d llvmpipe: Handle floating point selection. 2009-08-29 09:21:33 +01:00
José Fonseca
4d7a8194c5 llvmpipe: Silence compiler warnings. 2009-08-29 09:21:33 +01:00
José Fonseca
7821664b15 llvmpipe: Implement KIL. 2009-08-29 09:21:33 +01:00
José Fonseca
2c90652ed9 llvmpipe: More verbose error message when failed to translate opcodes. 2009-08-29 09:21:33 +01:00
José Fonseca
58f20b2b65 llvmpipe: Detect typos in LLVM intrinsics early. 2009-08-29 09:21:33 +01:00
José Fonseca
1aede69d3a llvmpipe: Comparisons translation. 2009-08-29 09:21:33 +01:00
José Fonseca
818d444e12 llvmpipe: Disassemble generated x86 code. 2009-08-29 09:21:32 +01:00
José Fonseca
a7f9b915ae llvmpipe: Shader function arguments don't alias. 2009-08-29 09:21:32 +01:00
José Fonseca
539c55da16 llvmpipe: Test only present functionality to allow regression testing. 2009-08-29 09:21:32 +01:00
José Fonseca
c67570ba85 llvmpipe: Clamp into range when writing integers. 2009-08-29 09:21:32 +01:00
José Fonseca
17aec9304c llvmpipe: Compute interpolation coeffs directly into SoA layout. 2009-08-29 09:21:32 +01:00
José Fonseca
b6f43b445b llvmpipe: Pass the interpolation factors as scalars. 2009-08-29 09:21:32 +01:00
José Fonseca
1a004142bb llvmpipe: Eliminate dependency on tgsi_exec_machine. 2009-08-29 09:21:32 +01:00
José Fonseca
73af91e938 llvmpipe: Eliminate non-LLVM fs execution paths. 2009-08-29 09:21:32 +01:00
José Fonseca
95f38dd67c llvmpipe: Code generate interpolators. 2009-08-29 09:21:32 +01:00
José Fonseca
af608e56ca llvmpipe: Factor out lp_build_select from lp_build_select_aos. 2009-08-29 09:21:31 +01:00
José Fonseca
57907e7fd9 llvmpipe: Translate approximate log2/exp2. 2009-08-29 09:21:31 +01:00
José Fonseca
ef1fddb36a llvmpipe: Handle a few more TGSI opcodes. 2009-08-29 09:21:31 +01:00
José Fonseca
844f802a70 llvmpipe: Efficient implementations of pow/exp/log/exp2/log2 2009-08-29 09:21:31 +01:00
José Fonseca
90e9a4d4f9 llvmpipe: Migrate more SSE2 codegen to LLVM IR. 2009-08-29 09:21:31 +01:00
José Fonseca
1b3c83d699 llvmpipe: Don't assume/enforce fs values are in [0,1] range. 2009-08-29 09:21:30 +01:00
José Fonseca
1709ace359 llvmpipe: Implement more arithmetic functions. 2009-08-29 09:21:30 +01:00
José Fonseca
1929057eac llvmpipe: Reuse coord/texel store. 2009-08-29 09:21:30 +01:00
José Fonseca
0b6a9b2dbe llvmpipe: Replace lp_fs_llvm.c.
Based on lp_fs_exec.c/lp_fs_sse.c and tgsi_exec.c.
2009-08-29 09:21:30 +01:00
José Fonseca
63b07618b3 llvmpipe: TGSI -> LLVM SoA IR converstion.
Based on tgsi_sse2.c.
2009-08-29 09:21:30 +01:00
José Fonseca
9033c44a62 llvmpipe: Dump only the generated function. 2009-08-29 09:21:29 +01:00
José Fonseca
4393ca7956 llvmpipe: Scalar -> vector broadcasting. 2009-08-29 09:21:29 +01:00
José Fonseca
8422f293ab llvmpipe: More arithmetic ops.
Mostly untested.
2009-08-29 09:21:29 +01:00
José Fonseca
36249348ed llvmpipe: More intrinsic helpers. 2009-08-29 09:21:29 +01:00
José Fonseca
50d77141e8 llvmpipe: Fix typo. 2009-08-29 09:21:29 +01:00
José Fonseca
81644f6315 util: Fix SCons build. 2009-08-29 09:21:28 +01:00
José Fonseca
19b31d0ac8 llvmpipe: Document the typo in llvm-c/Core.h. 2009-08-29 09:21:28 +01:00
José Fonseca
fb56786f60 util: Auto-generate u_format_table.c from SConscript. 2009-08-29 09:21:28 +01:00
José Fonseca
9285f159e0 llvmpipe: Simple description/instructions. 2009-08-29 09:21:28 +01:00
José Fonseca
8edcc8abe3 llvmpipe: Add missing include. 2009-08-29 09:21:27 +01:00
José Fonseca
2101c2941c llvmpipe: Tiles in rgba8 format. 2009-08-29 09:21:27 +01:00
José Fonseca
3ce1abf950 llvmpipe: Store tile color in SoA. 2009-08-29 09:21:27 +01:00
José Fonseca
29d94a9cbb llvmpipe: Code generate color masking. 2009-08-29 09:21:27 +01:00
José Fonseca
2d6b39f05e llvmpipe: Use the generated SoA blending code. 2009-08-29 09:21:27 +01:00
José Fonseca
e7fc21434d llvmpipe: Handle disabled blending too. 2009-08-29 09:21:27 +01:00
José Fonseca
62c91998ef xlib: Ensure one screen instance. 2009-08-29 09:21:27 +01:00
José Fonseca
0318f3e53e llvmpipe: Split the texture cache from the color/depth/stencil cache. 2009-08-29 09:21:27 +01:00
José Fonseca
b836b2593c xlib: Complete llvmpipe integration. 2009-08-29 09:21:27 +01:00
José Fonseca
2529ed5616 llvmpipe: SoA blending.
Throughput seems to be 4x higher.
2009-08-29 09:21:27 +01:00
José Fonseca
20f50b845b util: Fix blend factor dumping. 2009-08-29 09:21:26 +01:00
José Fonseca
3130b9921c llvmpipe: Update blending test. 2009-08-29 09:21:26 +01:00
José Fonseca
60584affcf llvmpipe: Handle more conversions.
Not all successfully yet though..
2009-08-29 09:21:26 +01:00
José Fonseca
145de19548 llvmpipe: Use full set of sse4 min/max intrinsics. 2009-08-29 09:21:26 +01:00
José Fonseca
a9771d2b75 llvmpipe: Fix one const generation for some signed integers. 2009-08-29 09:21:26 +01:00
José Fonseca
8244d6e5ad llvmpipe: Allow floating types without sign.
With the meaning that all values are assumed to be positive.
2009-08-29 09:21:26 +01:00
José Fonseca
9493260fdc llvmpipe: Centralize lp_build_context initialization. 2009-08-29 09:21:25 +01:00
José Fonseca
b07d19a885 llvmpipe: Normalize the cycles with the number of channel.
So that we have a comparable number for different formats.
2009-08-29 09:21:25 +01:00
José Fonseca
b874a7b807 llvmpipe: Handle ubyte -> float conversion too. 2009-08-29 09:21:25 +01:00
José Fonseca
b441a0b658 llvmpipe: Make lp_const_offset visible. 2009-08-29 09:21:24 +01:00
José Fonseca
684a47f0f6 llvmpipe: Only get the preprocessor flags from llvm-config.
Otherwise we get -O2 optimization flag, preventing proper debugging.
2009-08-29 09:21:24 +01:00
José Fonseca
8988424ee8 llvmpipe: Bootstrap type conversions. 2009-08-29 09:21:24 +01:00
José Fonseca
b19cb0080c llvmpipe: Use same type for reference vectors. 2009-08-29 09:21:24 +01:00
José Fonseca
d52dce0ffb llvmpipe: Fix floating point const scale factor. 2009-08-29 09:21:24 +01:00
José Fonseca
e6ebebc485 llvmpipe: Factor out shared test code into a separate module. 2009-08-29 09:21:24 +01:00
José Fonseca
138428bade llvmpipe: Cleanup constant helpers. 2009-08-29 09:21:23 +01:00
José Fonseca
627d6a6b04 llvmpipe: Move intrinsic helpers to a separate module. 2009-08-29 09:21:23 +01:00
José Fonseca
1165c30dc2 llvmpipe: Collect richer blend data. 2009-08-29 09:21:23 +01:00
José Fonseca
28e46458bc llvmpipe: Some notes about PSHUF. 2009-08-29 09:21:23 +01:00
José Fonseca
1dd7bb17c7 llvmpipe: Optimize blend swizzles by using bitmasks instead of shuffles for ubytes. 2009-08-29 09:21:23 +01:00
José Fonseca
a77084ea4b llvmpipe: Write data to a tsv file for posterior analysis. 2009-08-29 09:21:23 +01:00
José Fonseca
f081bacc25 llvmpipe: Move p_build_context to lp_bld_type.h
As it will be shared with more modules.
2009-08-29 09:21:23 +01:00
José Fonseca
696f7f2be5 util: New file dedicated to dump state in human/machine readable format. 2009-08-29 09:21:23 +01:00
José Fonseca
5940ba26f7 llvmpipe: Don't use llvm.readcyclecounter.
LLVM during optimization reorders the rdtsc instructions next to each
other, which makes it pretty useless.
2009-08-29 09:21:22 +01:00
José Fonseca
64611e086d llvmpipe: Separate constant building. 2009-08-29 09:21:22 +01:00
José Fonseca
c87fab0008 llvmpipe: Move type support functions into a separate file. 2009-08-29 09:21:22 +01:00
José Fonseca
b94e22e4be llvmpipe: Measure the number of cycles taken for blending. 2009-08-29 09:21:22 +01:00
José Fonseca
5778970f15 llvmpipe: Minor comments / debug mnemonics. 2009-08-29 09:21:22 +01:00
José Fonseca
02eaa32d83 llvmpipe: Optimize away min/max with equal operands. 2009-08-29 09:21:22 +01:00
José Fonseca
9e92244440 llvmpipe: Improve generated 8bit blending code. 2009-08-29 09:21:22 +01:00
José Fonseca
ede73258a7 llvmpipe: Get blending of normalized 8bit unsigned integers working. 2009-08-29 09:21:22 +01:00
José Fonseca
a6622e6c54 llvmpipe: Specialize arithmetic operations. 2009-08-29 09:21:22 +01:00
José Fonseca
272dadbe4e llvmpipe: Introduce a custom typing system.
Straightforward representation of floating-point/fixed-point/integer,
normalized/scaled, signed/unsigned SIMD vector types.
2009-08-29 09:21:22 +01:00
José Fonseca
f478b6fe76 llvmpipe: Avoid C99-isms. 2009-08-29 09:21:21 +01:00
José Fonseca
fe90e46dc9 llvmpipe: Factor out intrisic calling code into a reusable function. 2009-08-29 09:21:21 +01:00
José Fonseca
7ace0b1f4a llvmpipe: Cleanup test programs. 2009-08-29 09:21:21 +01:00
José Fonseca
7d043162c5 llvmpipe: Blending.
The code
2009-08-29 09:21:21 +01:00
José Fonseca
d2cf3e8dfd llvmpipe: Arithmetic helpers. 2009-08-29 09:21:21 +01:00
Keith Whitwell
fa3514a57e llvmpipe: fastpath for interpolated z16 less depthtesting
Because this is interpolated (ie. early) depth, we can build in an
assumption about the quads emitted by triangle setup, ie that they
are actually linear spans.  Interpolate z over those spans in z16
format to save on math & conversion.
2009-08-29 09:21:21 +01:00
Keith Whitwell
38a1479fe1 llvmpipe: cope with nr_cbufs == 0
Disable blend code when no color buffer
2009-08-29 09:21:21 +01:00
José Fonseca
4639f8aad5 llvmpipe: Translate logicops. 2009-08-29 09:21:21 +01:00
José Fonseca
833323b8d0 llvmpipe: Separate pixel packing/unpacking from loading/storing. 2009-08-29 09:21:21 +01:00
José Fonseca
c4903ee27f xlib: Integrate with llvmpipe.
Actually, the makefile/sconscript changes were already commit by mistake.
2009-08-29 09:21:21 +01:00
José Fonseca
b060771612 llvmpipe: Adjust for pixel layout changes. 2009-08-29 09:21:20 +01:00
José Fonseca
42b15b26fd util: Make pixel format layout more meaningful.
Namelly, explicitly distinguish formats coded by arithmetic manipulation,
from formats layed out in array.
2009-08-29 09:21:20 +01:00
José Fonseca
a910c7d820 util: Don't commit u_format_table.c
At least not until stabilizes, to reduce noise.
2009-08-29 09:21:20 +01:00
José Fonseca
9a519ec4d1 llvmpipe: Fix typo in copyright. 2009-08-29 09:21:20 +01:00
José Fonseca
3ef44746fe llvmpipe: Add test cases for pixels.
Actually some of this test cases need more testing...
2009-08-29 09:21:20 +01:00
José Fonseca
899bee2788 util: Fix r5g6b5 description. 2009-08-29 09:21:19 +01:00
José Fonseca
3ace63c00f llvmpipe: Update SConscript. 2009-08-29 09:21:19 +01:00
José Fonseca
b023c1dc68 llvmpipe: Simple shell script to aid port softpipe changes to llvmpipe. 2009-08-29 09:21:19 +01:00
Keith Whitwell
05bfd93c3f llvmpipe: move all depth/stencil/alpha pixel processing into one stage 2009-08-29 09:21:19 +01:00
Keith Whitwell
b8c437f20f llvmpipe: fix error in scissor state dependencies 2009-08-29 09:21:18 +01:00
Keith Whitwell
c5375da1dc llvmpipe: cleanup framebuffer state routine slightly 2009-08-29 09:21:18 +01:00
Keith Whitwell
90caf1a3f3 llvmpipe: move all color-combine code into lp_quad_blend.c
Consolidate the read-modify-write color combining code from
the blend, colormask and output stages.
2009-08-29 09:21:18 +01:00
Keith Whitwell
54c6ef144f llvmpipe: fix typo 2009-08-29 09:21:18 +01:00
Keith Whitwell
3c71a19016 llvmpipe: example fastpaths in blending 2009-08-29 09:21:18 +01:00
Keith Whitwell
80eb276630 llvmpipe: actually pass >1 quad from triangle routine
First attempt
2009-08-29 09:21:18 +01:00
Keith Whitwell
bdbb4beb21 llvmpipe: expand quad pipeline to process >1 quad at a time
This is part one -- we still only pass a single quad down, but
the code can now cope with more.  The quads must all be from the same
tile.
2009-08-29 09:21:18 +01:00
Keith Whitwell
4486012245 llvmpipe: rip out old mulithread support 2009-08-29 09:21:18 +01:00
Keith Whitwell
2a7c39a211 llvmpipe: avoid flushing depth buffer cache on swapbuffers
There's no need to push out depth buffer contents on swapbuffers.

Note that this change doesn't throw away depth buffer changes, it simply
holds them in the cache over calls to swapbuffers.  The hope is
that swapbuffers will be followed by a clear() which means in that case
we won't have to write the changes out.
2009-08-29 09:21:17 +01:00
Keith Whitwell
3adca96114 llvmpipe: also shortcircuit non-texture tile lookups 2009-08-29 09:21:17 +01:00
Keith Whitwell
2301314e7c llvmpipe: shortcircuit repeated lookups of the same tile
The lp_tile_cache is often called repeatedly to look up the same
tile.  Add a cache (to the cache) of the single tile most recently
retreived and make a quick inline check to see if this matches the
subsequent request.

Add a tile_address bitfield struct to make this check easier.
2009-08-29 09:21:17 +01:00
Keith Whitwell
df1823ec5b llvmpipe: remove unused vars in lp_setup.c 2009-08-29 09:21:17 +01:00
Keith Whitwell
08811032c2 llvmpipe: use bitwise logic to setup quad masks in lp_setup 2009-08-29 09:21:17 +01:00
Keith Whitwell
0aa24fa36f llvmpipe: simplify flush_spans
No loss of performance, but simpler code.
2009-08-29 09:21:17 +01:00
Keith Whitwell
0f55a95b2f llvmpipe: make some small steps to flush texture cache less frequently
No performance gain yet, but the code is a bit cleaner.
2009-08-29 09:21:16 +01:00
Keith Whitwell
3121484a8b llvmpipe: remove backwards dependency from tilecache to llvmpipe
The tile cache is a utility, it shouldn't know anything about the
entity which is making use of it (ie llvmpipe).

Remove llvmpipe parameter to all the tilecache function calls, and
also remove the need to keep a llvmpipe pointer in the sampler structs.
2009-08-29 09:21:16 +01:00
José Fonseca
c9a5930fe4 llvmpipe: Rename preprocessor symbols too. 2009-08-29 09:21:16 +01:00
José Fonseca
8783732c4d llvmpipe: Pixel packing/unpacking and loop code generators.
Just a small proof of concept plus a standalone test app. Not integrated
with the rest of the driver yet.
2009-08-29 09:21:16 +01:00
José Fonseca
15422b2d99 util: Pixel format database.
There are some inconsistencies in pipe_format, but above all, there
simply aren't enough bits in an enum to conveniently store all
information about a pixel format we need to be able to dynamically
generate pixel packing/unpacking code.
2009-08-29 09:21:15 +01:00
José Fonseca
946f432a08 llvmpipe: Fork softpipe for experimentation with llvm. 2009-08-29 09:21:15 +01:00
Ian Romanick
1814d6b49c Put 'extern' first on the line to silence GCC warnings. 2009-08-28 20:12:36 -07:00
Eric Anholt
00413d8742 i965: Use VBOs in the VBO module on 965, now that we have ARB_map_buffer_range.
This looks like it's a small win on blender.
2009-08-28 15:29:35 -07:00
Eric Anholt
8096aa5213 vbo: Fix array pointer calculation for MapBufferRange-mapped vertex data.
We would end up with the offset from the start of the mapping rather than
the offset from the start of the buffer.
2009-08-28 15:29:35 -07:00
Eric Anholt
2d5c74fac3 intel: Add support for GL_ARB_map_buffer_range.
Passes glean's bufferObject test, and should provide good performance in the
cases applications are expected to use.
2009-08-28 15:29:35 -07:00
Eric Anholt
446a226f9f i965: Implement ARB_oq CheckQuery in the intended way.
Previously we blocked because I hadn't added the libdrm function.  Now it's
there, so update your libdrm.
2009-08-28 15:29:34 -07:00
Pauli Nieminen
0926a5f4a1 radeon: Fix swtcl emit pediction.
Problem was to find the correct place to run prediction. Only place that is
called for every primitive is ALLOC_VERTS so we have to do prediction there
before allocation.
2009-08-29 00:46:57 +03:00
Jakob Bornecrantz
55e7abf81f i915g: Add cursor case for scanout layout 2009-08-28 22:41:53 +01:00
Jakob Bornecrantz
644060c025 i915g: Don't forget to init buffer ptrs 2009-08-28 22:41:52 +01:00
Zack Rusin
aaedd035ca st/xorg: disable composite accelration for now 2009-08-28 16:19:53 -04:00
Zack Rusin
0a26811286 st/xorg: bind samplers before composition 2009-08-28 15:43:46 -04:00
Zack Rusin
f1c0a4b2f4 st/xorg: normalize coords for the src operands in the vertex shader 2009-08-28 15:36:33 -04:00
Pauli Nieminen
4f644e58d4 radeon: Fix scissors for dri1.
DRI1 has to set scissors in framebuffer coordinates.
2009-08-28 22:05:15 +03:00
Joakim Sindholt
dbe58d7f9f r300g: pretty up the new drm code a bit
As it turns out, I made some boners. This corrects them (I hope)
2009-08-28 20:05:52 +02:00
Jakob Bornecrantz
1e9eb69f83 st/xorg: If migrating from a sw pixmap to a hw pixmap upload old contents 2009-08-28 17:10:58 +02:00
Jakob Bornecrantz
d80242c254 st/xorg: Null devPrivate.ptr when unmapping 2009-08-28 17:10:57 +02:00
Michel Dänzer
fdc8ec60eb st/xorg: Fix scons build. 2009-08-28 17:42:07 +02:00
Joakim Sindholt
6bfec14d6d r300g: support new drm_api 2009-08-28 17:23:11 +02:00
Jakob Bornecrantz
1e5014f7df drm_api: Operate on textures instead of buffers
Most use cases just got the buffer from the texture
	and then called into one of the get_handle functions.

	Also with this patch it would be easier to move to a
	generic function for getting handles from textures
	and textures from handles, that is exposed via the screen.
2009-08-28 13:38:23 +01:00
José Fonseca
9399b9a0e2 util: Reset size to zero when failed to allocate buffer. 2009-08-28 12:52:31 +01:00
Jakob Bornecrantz
7d9af52bc5 st/xorg: Fix some warnings 2009-08-28 12:46:24 +02:00
Jakob Bornecrantz
b26aee0ffe st/dri: Fix some warnings 2009-08-28 12:46:17 +02:00
Jakob Bornecrantz
6f0a1a8426 st/xorg: Pass dri driver name as driverName on screen 2009-08-28 12:36:42 +02:00
Jakob Bornecrantz
205d344e2a Revert "st/xorg/dri: Pass texture formats via the DRI2 protocol flags."
This reverts commit a33e9ea3b9.

As this change breaks both radeon and nouveau
2009-08-28 12:35:42 +02:00
Pauli Nieminen
4322181e6a r100/r200: Bring back old PolygonStripple for DRI1.
DRI1 didn't have support for command buffer emit for stripple.
2009-08-28 05:42:41 +03:00
Pauli Nieminen
bfbad4fbb7 r100/r200: Share PolygonStripple code. 2009-08-28 04:58:50 +03:00
Pauli Nieminen
e541845959 r200: Fix piglit paths test.
Polygon stipple has to go to command buffer because special ioctl is disabled.
Piglit doesn't like HyperZ warning so disable it for kms.
2009-08-28 04:13:01 +03:00
Dave Airlie
a7f8b329aa r600: fix scissor also.
I forgot about r600 being here.
2009-08-28 11:05:29 +10:00
Dave Airlie
d0cb1036aa radeon: fix scissors harder.
this makes gnome-shell work on r300 for me
2009-08-28 11:02:32 +10:00
Eric Anholt
60b072d49f intel: Add support for ARB_copy_buffer.
Passes glean's bufferObject test for this extension.
2009-08-27 17:51:29 -07:00
Pauli Nieminen
812ccacabc r300: Fix emit prediction to account scissor emitting correctly. 2009-08-28 02:05:08 +03:00
Brian Paul
e363ec1d08 Merge branch 'mesa_7_5_branch' 2009-08-27 16:54:32 -06:00
Brian Paul
0d7bed9f89 docs: fix selection/feedback culling bug 2009-08-27 16:50:44 -06:00
Brian Paul
8f4d66c5f8 swrast: fix incorrect tri culling in selection/feedback mode.
See bug 16866.
2009-08-27 16:50:03 -06:00
Eric Anholt
c2ef10803d i915: Fix undefined symbol as of eabe12df44 2009-08-27 15:33:33 -07:00
Zack Rusin
8bdce0c3a7 st/xorg: set vertex and fragment shader for the current op 2009-08-27 18:17:54 -04:00
Zack Rusin
c7e103d238 st/xorg: bind rasterizer state 2009-08-27 18:08:58 -04:00
Zack Rusin
2048182e86 st/xorg: set blend state for exa 2009-08-27 18:06:15 -04:00
Zack Rusin
f9a3fce090 st/xorg: bind framebuffer and viewport for exa 2009-08-27 17:39:45 -04:00
Zack Rusin
3f15ea866f st/xorg: create and destroy shader cache 2009-08-27 17:39:45 -04:00
Michel Dänzer
416ee3c53e st/xorg: Set shared usage of pixmaps for use via DRI2.
Also allow pixmaps to have both the shared and displayed usage flags, as is
the case for the screen pixmap now.
2009-08-27 20:29:32 +02:00
Michel Dänzer
bfbfcdd703 st/dri: Make sure the front left renderbuffer is there for texture-from-pixmap. 2009-08-27 20:27:28 +02:00
Michel Dänzer
d73d4cfcf1 st/xorg: Don't hardcode ExaPrepareCopy to fall back to software. 2009-08-27 20:27:28 +02:00
Michel Dänzer
05aa56a827 st/xorg: Flush context if necessary in ExaPrepareAccess. 2009-08-27 20:27:28 +02:00
Michel Dänzer
f3a540f6d7 st/dri: Only ask for fake front buffer for single buffer visuals by default. 2009-08-27 20:17:53 +02:00
Michel Dänzer
a33e9ea3b9 st/xorg/dri: Pass texture formats via the DRI2 protocol flags.
No need to guess.
2009-08-27 20:17:53 +02:00
Nicolai Hähnle
1160bf7c65 r300: Cleanup reported native program limits
The fragment program native limits are actually higher on R4xx
as reported by Alex Deucher, but using those requires some
bit-twiddling changes to program handling.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-08-27 18:13:48 +02:00
Nicolai Hähnle
eb6e281966 r300: Debug messages are written to stderr, so fflush that
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-08-27 18:13:48 +02:00
Pauli Nieminen
570d4e375a radeon/r200/r300: Fix swtcl prediction to work after primitie change.
Swtcl calls flush everytime primitive changes so prediction has to made again
after flushing.
2009-08-27 18:57:13 +03:00
marvin24
43a064e06d mesa: direct program debug output to stderr instead of stdout 2009-08-27 09:22:51 -06:00
Brian Paul
44e86dde6d Merge branch 'mesa_7_5_branch' 2009-08-27 09:14:09 -06:00
Brian Paul
32f95f8c17 gallium/util: added support for SRGB formats
Fixes glean/texture_srgb failure, bug #23449.
2009-08-27 09:10:38 -06:00
Brian Paul
f8ae968d28 gallium/util: added cases for SRGB formats 2009-08-27 09:09:56 -06:00
Chia-I Wu
8d0bdfa433 progs: EGL/X progs should link to libX11.
Since 5a459d58fc, libEGL no longer links
to libX11.  Add the dependency to affected progs and cleanup
prog/egl/Makefile.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-27 08:08:30 -06:00
Vinson Lee
0dd08a9e15 mesa: move decls before code 2009-08-27 07:40:48 -06:00
Cooper Yuan
ba87cbf2be r300g: Correct scissor setting, subtract 1 from window's width and height 2009-08-27 17:46:59 +08:00
Dave Airlie
82ff3190de radeon: fix scissor calcs.
For non-FBOs we need to invert, for FBOs the scissors are non-inverted.

no matter what we need to clamp them to the buffer sizes.
2009-08-27 15:38:00 +10:00
Ian Romanick
09c73c7437 i965: Increase assmebly shader program parameter limits
Increase the number of native program parameters to the same values
exposed by GLSL.
2009-08-26 22:05:53 -07:00
Ian Romanick
eabe12df44 ARB prog: Change handling of program parameter limits
Several changes are made to program parameter limits.  Several of the
non-NATIVE limits are set higher.  All of the NATIVE limits are set to
zero in the core Mesa code.  Each driver must set the actual value in
its context creation routine.  If the NATIVE value remains zero, this
indicates that hardware shaders may not be supported.

Each of the preceeding changes matches the bahavior of Apple's shader
assembler, so it seems safe.

Finally, we limit the value of MaxEnvParams to be no greater than
MaxNativeAttribs.  At least one case has been found where an
application does the wrong thing if MaxNativeAttribs < MaxEnvParams.

See also bugzilla #23490.
2009-08-26 22:05:53 -07:00
Dave Airlie
20d9204fbd radeon: fix max indx/vertex emission due to state checker 2009-08-27 14:50:42 +10:00
Younes Manton
cefe9c4f39 mesa: gitignore 2009-08-26 20:15:00 -04:00
Younes Manton
7d3b8231e1 nv04: Handle more Z formats.
Based on the patch from Luo Jinghua.
2009-08-26 20:07:51 -04:00
Nicolai Hähnle
c024f1047f r300/compiler: Fix vertex program MAD emit
Only use the macro variant of MAD when absolutely necessary.
Apparently it cannot deal with relative addressing.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-08-27 01:46:50 +02:00
Nicolai Hähnle
2114acb044 r300/compiler: Fix bug in rc_find_free_temporary
Find used temporaries even if they are only written to in dead code.
This fixes a bug in the NQSSADCE stage.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-08-27 01:46:45 +02:00
Chia-I Wu
e1d978775f egl: Remove Xdpy from EGLDisplay.
It is not used anymore.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-26 16:40:22 -06:00
Chia-I Wu
f5a06fad62 egl_glx: Make fbconfigs and visuals per display.
This is to allow a driver to drive multiple displays.  Remove the use of
_EGL_PLATFORM_X and obsolete code along the way.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-26 16:40:22 -06:00
Chia-I Wu
c06699dd12 egl_softpipe: Make winsys and pipe screen per display.
This is to allow a driver to drive multiple displays.  Remove the use of
_EGL_PLATFORM_X along the way.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-26 16:40:22 -06:00
Chia-I Wu
49f245ea6b EGL_i915: Make struct drm_device per display.
This is to allow a driver to drive multiple displays.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-26 16:40:22 -06:00
Pauli Nieminen
74b55970dc Merge branch 'fix_r300_swtcl' into push_master 2009-08-27 00:08:30 +03:00
Pauli Nieminen
47d4b9ff70 radeon: Fix loop en condition so debug output doesn't flood meaningless values. 2009-08-27 00:07:05 +03:00
Pauli Nieminen
e0e76edf97 radeon: Make RADEON_CMDBUF more fine grained. 2009-08-27 00:05:57 +03:00
Pauli Nieminen
97029c1860 radeon/r200/r300: Fix swtcl flushing not to invalidate dma region.
We were check command buffer sizes too alte so allocated dma regions
were freed before relocations so space checking failed.
2009-08-27 00:01:56 +03:00
Brian Paul
38f5641106 Merge branch 'mesa_7_5_branch' 2009-08-26 14:49:15 -06:00
Brian Paul
b2b220e622 i965: init the tex_units_used field 2009-08-26 14:47:50 -06:00
Brian Paul
a9a6399cd3 i965: fix incorrect tex unit in emit_tex() and emit_txb()
The instructions we're translating already went through the brw_wm_pass_fp()
function which does the sampler->texture unit mapping.  We were applying
the sample->unit mapping a second time in the GLSL texture emitters.
Often, this made no difference but other times it could lead to accessing
an invalid texture and could cause a GPU lockup.
2009-08-26 14:46:58 -06:00
Brian Paul
81a101b5be i965: clean-up tex target switches 2009-08-26 14:43:45 -06:00
Brian Paul
6df38e6f5a glsl: asst. clean-ups in set_program_uniform()
Remove redunant type check for samplers (assert instead).
Move some local vars.  Update comments.
2009-08-26 14:35:45 -06:00
Brian Paul
babb5ba9a9 glsl: signal that the program needs to be re-translated when samplers change 2009-08-26 14:29:50 -06:00
Brian Paul
7205221051 progs/glsl: asst. changes in shtest.c 2009-08-26 12:16:18 -06:00
Brian Paul
af7315e58b i965: added texture unit sanity check
Check that all the textures needed by the current fragment program
actually exist and are valid.
2009-08-26 12:08:23 -06:00
Brian Paul
34da6024e3 i965: keep track of which texture units the fragment shader accesses
We'll use this for debug/sanity checking.
2009-08-26 12:07:03 -06:00
Brian Paul
d09d03aa42 docs: document sampler array bug fix 2009-08-26 12:04:35 -06:00
Brian Paul
f8b344114f i965: clean up texture target switches 2009-08-26 12:02:24 -06:00
Brian Paul
f05344fcea mesa: var renaming, new assertion 2009-08-26 12:02:24 -06:00
Brian Paul
dd528f0ec1 mesa: additional instruction field size assertions 2009-08-26 12:02:24 -06:00
Brian Paul
476290946e Merge branch 'mesa_7_5_branch' 2009-08-26 12:01:23 -06:00
Brian Paul
2bcf787de1 progs/glsl: handle window resizes in texaaline.c 2009-08-26 11:56:56 -06:00
Brian Paul
488b3c4d1b progs/glsl: add special Makefile rule for samplers_array 2009-08-26 11:55:15 -06:00
Brian Paul
f6d34c2058 progs/glsl: change samplers.c to better test sampler/texture indexing
Now the left half is yellow and the right half is red, with the gradients
going in opposite directions.
2009-08-26 11:53:25 -06:00
Brian Paul
04d170794a glsl: fix bug in sampler array indexing
Need to add the 'offset' parameter when indexing the parameter array.
Before, if we were setting arrays of samplers, we were actually only
setting the 0th sampler's value.

Because of how progs/glsl/samplers.c is constructed, this wasn't showing
up as a failure in the samplers_array output.
2009-08-26 11:39:31 -06:00
Alex Deucher
7ffbe48706 r600: fix two sided stencil 2009-08-26 13:33:06 -04:00
Alex Deucher
f988c750a9 r600: add missing radeon_cs_space_set_flush call
fixes crash in etracer reported by kdekorte on IRC
2009-08-26 13:10:15 -04:00
Zack Rusin
a0966c41a9 st/xorg: create basic vertex shader 2009-08-26 12:50:47 -04:00
Zack Rusin
b324aacf13 st/xorg: create basic fragment shader 2009-08-26 12:50:47 -04:00
Alex Deucher
490f640cd5 r600: make reloc_chunk size dynamic 2009-08-26 12:17:44 -04:00
Alex Deucher
f33853e56d r600: fix memory leak 2009-08-26 11:09:59 -04:00
Alex Deucher
18e0fea55b r300: r4xx and rs4xx also have lte discard regs 2009-08-26 10:53:30 -04:00
Jakob Bornecrantz
53b3cdaee2 st/dri: Add some debug code 2009-08-26 14:30:54 +02:00
Jakob Bornecrantz
57230d96ed st/xorg: Temporary fix for none stencil visuals
Should be replaced with something looking at the proper
	glx visual for the buffers.
2009-08-26 14:27:50 +02:00
Jakob Bornecrantz
23fe960be0 st/xorg: Find out correct type for depth stencil buffers 2009-08-26 13:45:31 +02:00
Jakob Bornecrantz
aab0bedb8c st/dri: Redo config generation 2009-08-26 12:29:28 +02:00
Michel Dänzer
b2e1b25881 st/xorg: Add support for dirty framebuffer region reporting.
Add a BlockHandler which flushes the context and reports the dirty region
gathered using the X server damage layer.

In the interim, with dirty region reporting only allocate textures for the
framebuffer and shared pixmaps (e.g. DRI2 buffers) and fall back to software
for other pixmaps. This will be improved in the future.
2009-08-26 13:18:37 +02:00
Cooper Yuan
dadf138ddb r600: Update vertex fetch shader if necessary 2009-08-26 16:21:10 +08:00
Ben Skeggs
1664bc1a37 st/dri: make the GL_ARB_map_buffer_range entrypoints available 2009-08-26 16:18:39 +10:00
Dave Airlie
674835f184 radeon/r100/r200: actually init the OQ support properly 2009-08-26 14:16:54 +10:00
Dave Airlie
b6df23d8b3 radeon/r200: OQ support for r200 in theory.
this is an untested port of the r100 OQ code
2009-08-26 14:03:48 +10:00
Dave Airlie
5484428d72 radeon: add r100 OQ support with kms.
This adds OQ support for the r100 chipsets, it requires
KMS unless someone wants to make a kernel patch to add support
for OQ regs.
2009-08-26 13:56:45 +10:00
Brian Paul
42675ff0e3 progs/glsl: call ValidateShaderProgram() 2009-08-25 17:46:11 -06:00
Brian Paul
a088e5631d mesa: validate shader before drawing (for debugging, disabled) 2009-08-25 17:46:10 -06:00
Brian Paul
d8b4f8c848 glsl: update a texture/sampler comment 2009-08-25 17:46:10 -06:00
Brian Paul
c90fca3da4 glsl: implement shader sampler validation
Shader validation should fail if there are two samplers of different types
which reference the same texture unit.  For example, if a cubemap sampler
and a 2D sampler both reference texture unit 0, that's invalid.
2009-08-25 17:46:10 -06:00
Brian Paul
2050baba96 mesa: use gl_texture_index type for gl_program::SamplerTargets 2009-08-25 17:46:10 -06:00
Brian Paul
fa6299cb31 progs/util: added ValidateShaderProgram() to shaderutil.c 2009-08-25 17:46:10 -06:00
Brian Paul
b7d2023cf9 i965: add some texture unit/target assertions 2009-08-25 17:46:10 -06:00
Brian Paul
f9ce0a91dc mesa: print some program fields in binary too 2009-08-25 17:46:10 -06:00
Pauli Nieminen
dbf59de6d2 r200: Add scissor to state atom list.
Scissors are jsut one of states that we have to emit so it should be in state list
2009-08-26 01:53:17 +03:00
Pauli Nieminen
5d10890795 radeon/r600: Fix remaining warnings when building 64 bit binary. 2009-08-25 22:16:19 +03:00
Pauli Nieminen
87f83e193a r200: Addd missing parameter to debug output. 2009-08-25 21:39:58 +03:00
Pauli Nieminen
75df73838a r200: Fix commit size prediction.
Scissor are emited for every primitive so fix that in prediction.
2009-08-25 21:36:57 +03:00
Zack Rusin
7bc4744026 xorg: insert shaders into the cache 2009-08-25 14:22:26 -04:00
Zack Rusin
23b59d3b40 exa: add basic code to cache vertex and fragment shaders 2009-08-25 14:01:58 -04:00
Zack Rusin
c7653a8333 exa: check whether the op is accelerated 2009-08-25 13:23:08 -04:00
Pauli Nieminen
c3374bf97e radeon: Fix all compiler warnings. 2009-08-25 19:35:41 +03:00
Brian Paul
42ecb1287e mesa: remove -I$(TOP)/src/gallium/drivers from sources.mak
Core Mesa and the state tracker do not depend on any gallium drivers.
2009-08-25 09:42:28 -06:00
Brian Paul
a94d66e857 Revert "glapi: Fix a possible race in getting current context/dispatch."
This reverts commit 17090cf3ef.

We're reverting this because it causes ABI breakage with the X server.
Maybe re-attempt with another patch.
2009-08-25 09:37:43 -06:00
Zack Rusin
65f9d10342 xorg: revert bad merge 2009-08-25 09:58:51 -04:00
Michel Dänzer
d22bd1421c Add support for building the Xorg state tracker with scons.
scons ... statetrackers=xorg
2009-08-25 15:39:05 +02:00
Pauli Nieminen
418cdc66ec Revert "glx: Make drawables persistent untill they are changed by glXMakeCurrent"
This commit was not mean to end in to master yet. It is still queston if this
right design to fix the problem.

This reverts commit 45e3be3c07.
2009-08-25 05:07:08 +03:00
Pauli Nieminen
ce7ed63f0c Merge branch 'master' of ssh://git.freedesktop.org/git/mesa/mesa into r600_state_predict 2009-08-25 02:36:13 +03:00
Maciej Cencora
1d5a06a1f7 r300: fix condition logic
The s3tc extensions are properly enabled now, when force_s3tc_enable option is set in driconf.
2009-08-25 01:30:24 +02:00
Maciej Cencora
ff235c8ccb r300: set proper CS section size 2009-08-25 01:30:24 +02:00
Pauli Nieminen
4297f32c24 radeon/r200/r300/r600: Warn if we emit more than prediction was.
Prediction code making too small prediction may cause space check aserttion
failure later in rendering. So warning about any failure to predict correctly
should be fixed.
2009-08-25 02:23:52 +03:00
Zack Rusin
ffe8cc6cef xorg: fix compilation 2009-08-24 18:42:16 -04:00
Zack Rusin
17076d700c xorg: start on code accelerating render 2009-08-24 18:39:01 -04:00
Alex Deucher
3023328ea7 r300: add support for getting Z pipe info from drm
Needed for occulsion queries on rv530 chips

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2009-08-24 18:08:37 -04:00
Alex Deucher
8dd151b947 r600: code cleanup 2009-08-24 17:51:00 -04:00
Dave Airlie
dea1038186 radeon: fix fbo size calculation to after pitch 2009-08-25 07:21:03 +10:00
Zack Rusin
cd5c7bfd93 Merge branch 'master' of ssh://zack@git.freedesktop.org/git/mesa/mesa 2009-08-24 16:39:25 -04:00
Zack Rusin
534c133022 openvg: fix vgTransformPath with relative coords 2009-08-24 16:38:43 -04:00
Brian Paul
bf7e4b10cb ARB prog: Set error instead of falling through with incorrect value
If a fragment program only parameter was queried of a vertex program
(e.g., GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB) no error would be set and
a random value would be returned.  This caused 'glxinfo -l' to show
the same values for GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB,
GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB,
GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB,
GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB,
GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB as for
GL_MAX_PROGRAM_ENV_PARAMETERS_ARB.  This is confusing and incorrect.

(cherry picked from master, commit 4bccd693a7)
2009-08-24 13:56:01 -06:00
Ian Romanick
4bccd693a7 ARB prog: Set error instead of falling through with incorrect value
If a fragment program only parameter was queried of a vertex program
(e.g., GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB) no error would be set and
a random value would be returned.  This caused 'glxinfo -l' to show
the same values for GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB,
GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB,
GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB,
GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB,
GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB as for
GL_MAX_PROGRAM_ENV_PARAMETERS_ARB.  This is confusing and incorrect.
2009-08-24 12:51:29 -07:00
Brian Paul
1e2a71c5c2 mesa: add new program parser sources to tarball
The end user doesn't need the .y or .l or Makefile but include them anyway
in case someone wants to patch or debug things.
2009-08-24 13:12:07 -06:00
Brian Paul
b879316d4d docs: recent 7.5.1 bug fixes 2009-08-24 13:05:20 -06:00
Brian Paul
69170a4aae xlib: fix single buffer window resize bug
When a single-buffered window was resized the new window size was never
detected.  This fix that, but there's still a bug which causes window
contents corruption for certain window sizes...
2009-08-24 13:05:20 -06:00
Brian Paul
93aa0fd81c vbo: fix divide by zero exception
Fixes bug 23489.
2009-08-24 13:05:20 -06:00
Vinson Lee
0a24e50111 glsl: Silence gcc uninitialized variable warning. 2009-08-24 13:04:50 -06:00
Brian Paul
4eb7256854 st/mesa: flush bitmap cache if Z value changes
When adding a new bitmap to the cache we have to check if the Z value is
changing and flush first if it is.

This is a modified version of a patch from Justin Dou <justin.dou@intel.com>
2009-08-24 13:04:50 -06:00
Brian Paul
96f7b42242 docs: recent 7.5.1 bug fixes 2009-08-24 13:02:33 -06:00
Ian Romanick
d8a3ada7fb ARB prog parser: Regenerate parser from previous commit 2009-08-24 12:00:35 -07:00
Brian Paul
4cf27608bc ARB prog parser: use correct context limits 2009-08-24 12:00:35 -07:00
Brian Paul
b5ecbbe636 xlib: fix single buffer window resize bug
When a single-buffered window was resized the new window size was never
detected.  This fix that, but there's still a bug which causes window
contents corruption for certain window sizes...
2009-08-24 12:58:49 -06:00
Brian Paul
b9b04872d5 vbo: fix divide by zero exception
Fixes bug 23489.
2009-08-24 12:44:00 -06:00
Alex Deucher
29473d25a3 r600: fix state emit sizes 2009-08-24 14:40:40 -04:00
Chia-I Wu
58ac57c2b7 egl_xdri: Revive the driver.
egl_xdri does not compile for some time.  This commit revives the
driver.  It no longer depends on libGL.so for GLX related functions.
Instead, it uses code from src/glx/ directly.  Both DRI and DRI2 are
supported.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-24 11:49:45 -06:00
Chia-I Wu
17090cf3ef glapi: Fix a possible race in getting current context/dispatch.
There is a possbile race that _glapi_Context is reset by another thread
after it is tested in GET_CURRENT_CONTEXT but before it is returned.  We
definitely do not want a lock here to solve the race.  To have correct
results even under a race, no other threads should reset _glapi_Context
(or _glapi_Dispatch).

This patch adds a new global variable _glapi_SingleThreaded.  Since
_glapi_Context or _glapi_Dispatch are no longer reset,
_glapi_SingleThreaded is tested instead, before accessing them.

DRI drivers compiled with this patch applied will not work with existing
libGL.so because of the missing new symbol.  If this turns out to be a
real problem, this patch should be reverted.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-24 11:46:15 -06:00
Chia-I Wu
3076d1617d glapi: Static mutex does not work on WIN32_THREADS.
This re-introduces the race in _glapi_check_multithread, but avoids a
crash on windows.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-24 11:46:15 -06:00
Chia-I Wu
fc2feea685 glapi: Fix a race in accessing context/dispatch TSD.
If multiple threads set/get a TSD at roughly same time for the first
time, glthread might (wrongly) initialize it more than once.  This patch
solves the race by initializing context/dispatch TSDs early.

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-24 11:45:57 -06:00
Chia-I Wu
99939982ec glapi: Protect _glapi_check_multithread by a mutex.
Multiple threads might call _glapi_check_multithread at roughly the same
time.  It is possbile that all of them are wrongly regarded as firstCall
if there is no mutex.  This bug causes xeglthreads to crash sometimes.

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-24 11:45:57 -06:00
Vinson Lee
f785b35b47 glsl: Silence gcc uninitialized variable warning. 2009-08-24 11:43:02 -06:00
Brian Paul
53db19b57d mesa: _mesa_layout_parameters() returns a boolean value 2009-08-24 10:50:07 -06:00
Pauli Nieminen
55c0457fe9 radeon: Add debug output to radeonCountStateEmitSize. 2009-08-24 18:45:30 +03:00
Pauli Nieminen
ec61f677c3 r600: Fix indetion and add useful debug output. 2009-08-24 18:06:25 +03:00
Pauli Nieminen
75da0a6a56 Merge branch 'master' of ssh://git.freedesktop.org/git/mesa/mesa into r600_state_predict 2009-08-24 17:09:27 +03:00
Maciej Cencora
ed14a4cb7b r300: add support for EXT_framebuffer_blit 2009-08-24 14:52:33 +02:00
Cooper Yuan
a88678d3ee tgsi: Fix build error due to commit acc7da90 2009-08-24 19:50:38 +08:00
José Fonseca
02c523dfbb tgsi: Only free temp uregs.
Shorthand.
(cherry picked from commit de911220bbbe74cff0c79b260456ff36122b7b5b)
2009-08-24 12:11:24 +01:00
José Fonseca
acc7da9035 tgsi: Pass pipe_context as a parameter to ureg_create_shader.
Simplifies migration to tgsi_ureg.
(cherry picked from commit f574398c07c41cb8d31249a7186fc178ef7d552a)
2009-08-24 12:11:22 +01:00
Keith Whitwell
b570a7e6b6 tgsi: add generic instruction builder
When translating an incoming shader (rather than building one from scratch)
it's preferable to be able to call a single, generic instruction emitter
rather than figuring out which of the opcode-specific functions to call.
2009-08-24 11:33:38 +01:00
Cooper Yuan
7ee4f32dcd r300g: Set the vector address in the input memory for bypass_vs_clip_and_viewport case 2009-08-24 13:56:23 +08:00
Dave Airlie
2b29d21018 r600: scissor updates for dri2
Pulled from Dave's WIP patch.
2009-08-24 00:56:40 -04:00
Dave Airlie
f758a8bf2e r600: switch to common cs functions
needed for dri2.  Pulled from Dave's WIP patch.
2009-08-24 00:47:34 -04:00
Alex Deucher
436fb34369 r600: map 16 VS outputs
Should cover everything exported from the VS
2009-08-24 00:33:33 -04:00
Alex Deucher
d6f7ebd603 r600: fix logic copy paste error
Spotted by airlied.
2009-08-23 23:56:45 -04:00
Pauli Nieminen
fe42b4b757 r600: Improve emit prediction. 2009-08-24 02:44:27 +03:00
Pauli Nieminen
885906840d r600: Predict emit size for next rendering. 2009-08-24 02:01:15 +03:00
Pauli Nieminen
ccde276838 radeon: Fix dri1 ctx emit size. 2009-08-24 01:54:01 +03:00
Pauli Nieminen
7bb0f880db Merge branch 'master' of ssh://git.freedesktop.org/git/mesa/mesa into r600_state_predict
Conflicts:
	src/mesa/drivers/dri/r300/r300_cmdbuf.c
	src/mesa/drivers/dri/radeon/radeon_cmdbuf.h
2009-08-24 00:57:05 +03:00
Alex Deucher
4484ce9c7b radeon: add radeon_cs_write_table to the legacy path 2009-08-23 16:22:01 -04:00
Alex Deucher
becb50f84d r600: bump reloc_chunk size
This fixes openarena reloc errors.  This needs to be
made more dynamic.
2009-08-23 16:06:31 -04:00
Alex Deucher
670bd47df9 r600: fix count for CB/DB target state 2009-08-23 15:35:55 -04:00
Maciej Cencora
e1801d861a r300: fix a typo 2009-08-23 21:30:43 +02:00
Maciej Cencora
bcbe27d0ca radeon: use proper macro 2009-08-23 21:11:13 +02:00
Maciej Cencora
7e7f0f61bf radeon: use bo_is_idle interface for checking if OQ result is available 2009-08-23 21:09:55 +02:00
Maciej Cencora
4aadda5f66 r300: minor optimization
use properly implemented OUT_BATCH_TABLE where possible
2009-08-23 20:21:48 +02:00
Ian Romanick
9b70c33e73 ARB prog lexer: Fix lexer to eat both DOS and Unix line endings 2009-08-23 11:15:32 -07:00
Alex Deucher
7a05a4c65c r600: use persistent bos for shaders 2009-08-23 13:41:43 -04:00
Alex Deucher
41934be254 r600: always emit CB base
Not doing so seems to cause lock-ups or rendering problems
on some chips.  I think there is an logic issue related to
CB and VGT on some chips.  We ran into similar issues in
r600_demo IIRC.
2009-08-23 13:05:52 -04:00
Pauli Nieminen
b34695375e radeon: Fix compilation with legacy memory manager. 2009-08-23 14:02:46 +03:00
Pauli Nieminen
66bbafb6f9 radeon: Check from kernel if dma buffer is idle.
This makes sure that objects are leaving wait list only when they are processed by gpu.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-23 13:39:32 +03:00
Alex Deucher
bf6d0ae598 r600: make state emit more fine grained
Gives a nice speed boost in most apps since
we only emit what state we need.
2009-08-22 18:03:26 -04:00
Renato Caldas
08e91e0315 shader: fix compilation warnings
This patch fixes some "implicit declaration of function" compilation
errors/warnings on the new shader code.

Signed-off-by: Renato Caldas <seventhguardian@gmail.com>
2009-08-22 14:00:23 -07:00
Luo Jinghua
523cb80d0f ARB prog parser: include imports.h to kill some compiler warnings 2009-08-22 13:59:48 -07:00
Alex Deucher
180c304943 r600: move full state to radeon state atoms 2009-08-22 15:03:41 -04:00
Alex Deucher
17813931db r600: add support for RS880 2009-08-22 11:45:40 -04:00
Ian Romanick
c87ef0870a i965: Implement frag prog DPH like DP4
DPH can output to any component, not just to X.  This allows fpalu.c
to run without hitting the assertion in emit_dph.
2009-08-22 01:35:12 -07:00
Pauli Nieminen
effda2e2a7 r300: Fix debug output. 2009-08-22 04:37:24 +03:00
Jakob Bornecrantz
54fb71b863 st/dri: Remove some debug prints 2009-08-22 02:16:02 +01:00
Jakob Bornecrantz
a3e59b9d06 st/dri: Find out if the drawable is a pixmap
Part of this code is disabled since no performance gains
	where detected with it enabled.

	This code only detects if it is a pixmap that it is
	rendering to on the st/xorg DDX since it sets the fake
	front to the same handle as front.
2009-08-22 02:16:02 +01:00
Jakob Bornecrantz
6237ac2412 st/dri: Fix frontbuffer rendering with DRI2 2009-08-22 02:16:01 +01:00
Jakob Bornecrantz
29165a2fcc st/xorg: Handle fake fronts correctly for pixmaps 2009-08-22 02:10:18 +01:00
Jakob Bornecrantz
a469b4c459 i915g: Remove bad assert on fence 2009-08-22 02:09:59 +01:00
Pauli Nieminen
6c5c46f842 r300: Fix dri1 not to emit state that is not supported in old drm. 2009-08-22 02:54:34 +03:00
Pauli Nieminen
c0f4063703 radeon/r300: Code clean up and logic fix. 2009-08-22 02:43:00 +03:00
Michel Dänzer
029e643b24 glx/dri2: Always use X drawable ID for DRI2 protocol.
Fixes protocol errors in cases where the GLX ID is different.
2009-08-22 01:33:37 +02:00
Michel Dänzer
6b1f144d9b Fix r300 VBO support build on big endian. 2009-08-22 01:24:39 +02:00
Alex Deucher
bf5d6cf455 r600: better default state size.
Hopefully suokko's emit size impovements will
land soon.
2009-08-21 17:46:32 -04:00
Pauli Nieminen
bb43c5d1cb r300: Remove calls to rcommonEnsureCmdBufSpace.
All rendering is checked in r300PredictTryDrawPrimsSize which mamde these calls useless.
2009-08-21 23:48:39 +03:00
Pauli Nieminen
90647ff558 radeon: protect against buffer overflow in state atom debug code. 2009-08-21 22:37:13 +03:00
Ian Romanick
4cfb1b880b Merge branch 'asm-shader-rework-1' 2009-08-21 11:34:30 -07:00
Pauli Nieminen
b7ec2ebe33 radeon: Improve state emit code.
Trying to make understanding code easier with small refactoring and renaming.
2009-08-21 20:47:35 +03:00
Pauli Nieminen
0bf4308580 r300: Add debug output to show how much was emited in TryDrawPrims. 2009-08-21 20:26:41 +03:00
Brian Paul
ef98eed0a9 radeon: fix incorrect loop limit (warned by -O3) 2009-08-21 11:04:37 -06:00
Brian Paul
49c0825655 glx: initialize some local vars to silence warnings with -O3 2009-08-21 11:04:37 -06:00
Brian Paul
1aba1baa62 st/mesa: flush bitmap cache if Z value changes
When adding a new bitmap to the cache we have to check if the Z value is
changing and flush first if it is.

This is a modified version of a patch from Justin Dou <justin.dou@intel.com>
2009-08-21 10:24:50 -06:00
Pauli Nieminen
d6b5464aaa r300: Predict emit size for next rendering operation.
We do flush for cmd buffer in case there isn't enough space left for whole
rendering operation. This protects dma regions from getting released in middle
of state emit.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-21 19:12:31 +03:00
Pauli Nieminen
12fe319c53 r300: Handle possible fall back if space check fails. 2009-08-21 19:12:30 +03:00
Pauli Nieminen
11d3ec1f93 r300: Delay allocation of dma regions in TryDrawprims.
This makes it easier to predict size of next rendering operation so we
can do early flush.
2009-08-21 19:12:30 +03:00
Pauli Nieminen
66513ba884 r300: Clean emit code.
This fixes some state atom check functions from returing wrong emit size.

There is emit code cleanup so that emit function selection is done in init
time instead of runtime.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-21 19:12:30 +03:00
Pauli Nieminen
d1a0ece907 radeon: Port flush preventation code from r200 to r100.
- emit prediction
- fixes to emit_sizes for data
- clean up of excesive use of radeonEnsureCmdBufferSpace

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-21 19:12:30 +03:00
Pauli Nieminen
60d156f688 r200: Make swtcl use state size prediction for flush.
Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-21 19:12:30 +03:00
Pauli Nieminen
e083f53ce4 r200: Remove unnecessery Elts from r200 context.
Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-21 19:12:29 +03:00
Pauli Nieminen
9f7676c718 r200: Remove unnecessary calls to rcommonEnsureCmdBufSpace.
Calling EnsureCmdBufSpace is not required because rendering pipeline has to quarentee free space.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-21 19:12:29 +03:00
Pauli Nieminen
0f41259eff r200: Fix atom->check call to return emit size for atom.
This patch makes render emit size prediction count the corect maximum emit size
for state.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-21 19:12:29 +03:00
Pauli Nieminen
fb1d0bfd47 r200: Prevent flush in middle of rendering.
Patch adds prediction functionthat tries to predict emit size to the smallest
possible values that is quarenteed to be higher than worst case scenario in
rendering pipeline.

State emit size prediction code is in place but fix for emit sizes is included
in next patch.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-21 19:12:29 +03:00
Pauli Nieminen
7f8f486b36 radeon/r200: Add -Wall to default build flags like it is in r300/r600
Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-21 19:12:29 +03:00
Pauli Nieminen
45e3be3c07 glx: Make drawables persistent untill they are changed by glXMakeCurrent
This fixes bug that xdemos/manywin would segfault if it was run with command
./manywin 2. Demo is tring to call glXSwapBuffers while another context was
bind using glXMakeCurrent.

Fix is simple makes drawable and readable persistent untill they change or
context is destroyed.

I found a logic error when same dri context is used for multiple drawables
which caused readable and drawable to fall out of sync in special case. Fix
is simple just updating  drawables more often than in original patch.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-21 19:12:28 +03:00
Chia-I Wu
b1f156f0ec egl: Make _eglChooseDriver return the filename of the driver.
The real difference is that the driver suffix is now appended.  This
also fixes an annoying bug that EGL_DRIVER could not specify the path to
a driver because a suffix was always appended.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-21 08:34:34 -06:00
Chia-I Wu
5a459d58fc egl: Remove dependency on libX11.
libX11 is used to determine the screen number, which is in turned used
to determine the DRI driver.  However, the sysfs interface for
determining the DRI driver is gone, and no working driver depends on
this mechanism.

Display string parsing is moved to a new function,
_eglSplitDisplayString.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-21 08:34:34 -06:00
Chia-I Wu
1f871a4d15 egl_softpipe: Do not flush unlinked context.
An unlinked context is destroyed after _eglMakeCurrent.  Flushing such
context would cause segfault.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-21 08:34:34 -06:00
Chia-I Wu
408db29792 egl: Check for null display in handle checking.
The display may be NULL when checking a handle.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-21 08:34:34 -06:00
Jakob Bornecrantz
9b3e5df900 st/egl: Add support for drmModeDirtyFB command if found 2009-08-21 15:04:21 +02:00
Pauli Nieminen
0c0cea250d radeon: Add comment to explain logic for freeing dma buffers. 2009-08-21 16:40:14 +03:00
Ian Romanick
ac5551fbb9 ARB prog parser: Revert part of previous change to constant parsing
The commit "ARP prog parser: Implement the spec, not what makes sense"
broke the parsing of scalar constants.  This commit reverts that part
of that commit.  Now vp_swizzle.c passes.
2009-08-20 18:29:41 -07:00
Alex Deucher
ba48e78b1f r600: convert to using common radeon state atoms
switches more state handling to common code.  We need
should be more fine grained with the state atoms
eventually.
2009-08-20 18:55:41 -04:00
Alex Deucher
a47bb56d45 r600: improve state emission
Slowing migrating to atom based system like
the other radeon drivers.
2009-08-20 17:21:50 -04:00
Alex Deucher
ad36058e21 r600: split state emit into block specific functions
We probably want to go finer grained eventually, but
this is a good start.
2009-08-20 17:21:50 -04:00
Brian Paul
a215da5e9c progs/glsl: report compile/link times in shtest.c 2009-08-20 14:43:32 -06:00
Brian Paul
f300db379e progs/util: added GetShaderCompile/LinkTime() to get compilation/link times 2009-08-20 14:43:32 -06:00
Brian Paul
8a883d1657 progs/glsl: update multitex.shtest for new texture syntax 2009-08-20 14:43:32 -06:00
Brian Paul
0062bd68b3 progs/glsl: update shtest.c to handle 1D/3D/CUBE/RECT textures 2009-08-20 14:43:32 -06:00
Brian Paul
174054c973 progs/glsl: tweaks to shtest.c
1. Larger sphere to match cube size
2. Allow -geometry option to override window size
3. Cube samplers
2009-08-20 14:43:32 -06:00
Christoph Bumiller
d7c55555ac nv50: use VTX_ATTR_nF for constant vtxelts 2009-08-20 21:41:39 +02:00
Christoph Bumiller
6d1f63f520 nv50: set vertex buffer limits 2009-08-20 21:41:39 +02:00
Christoph Bumiller
80c5ab1586 nv50: modify vbo format to hw translation, add BGRA swizzle 2009-08-20 21:41:39 +02:00
Brian Paul
ce723d8d8b tgsi: check for SOA dependencies in SSE and PPC code generators
Fall back to interpreter for now.  This doesn't happen very often.
2009-08-20 10:34:45 -06:00
Brian Paul
4c7c294fff tgsi: handle SOA dependencies for MOV/SWZ
SOA dependencies can happen when a register is used both as a source and
destination and the source is swizzled.  For example:

MOV T, T.yxwz; would expand into:

  MOV t0, t1;
  MOV t1, t0;
  MOV t2, t3;
  MOV t3, t2;

The second instruction will produce the wrong result since we wrote to t0
in the first instruction.  We need to use an intermediate temporary to fix
this.

This will take more work to fix for all TGSI instructions.  This seems to
happen with MOV instructions more than anything else so fix that case now
and warn on others.

Fixes piglit glsl-vs-loop test (when not using SSE). See bug 23317.
2009-08-20 10:28:22 -06:00
Brian Paul
5e6d21afa4 tgsi: added tgsi_full_instruction::Flags field
Users of the parser can make use of this.
2009-08-20 10:25:55 -06:00
Jakob Bornecrantz
e93d41d24f st/egl: Open the first drm node
At least its better then hardcoded to i915
2009-08-20 17:50:30 +02:00
Brian Paul
94d14f6cd2 progs/glsl: more comments in shtest.c 2009-08-20 10:52:13 -06:00
Brian Paul
45cd9d80db tgsi: when printing/dumping programs indent loops and conditionals 2009-08-20 10:52:12 -06:00
Brian Paul
1645adc551 tgsi: check for SOA dependencies in SSE and PPC code generators
Fall back to interpreter for now.  This doesn't happen very often.
2009-08-20 10:52:12 -06:00
Brian Paul
013bd4da1a tgsi: handle SOA dependencies for MOV/SWZ
SOA dependencies can happen when a register is used both as a source and
destination and the source is swizzled.  For example:

MOV T, T.yxwz; would expand into:

  MOV t0, t1;
  MOV t1, t0;
  MOV t2, t3;
  MOV t3, t2;

The second instruction will produce the wrong result since we wrote to t0
in the first instruction.  We need to use an intermediate temporary to fix
this.

This will take more work to fix for all TGSI instructions.  This seems to
happen with MOV instructions more than anything else so fix that case now
and warn on others.

Fixes piglit glsl-vs-loop test (when not using SSE). See bug 23317.
2009-08-20 10:52:12 -06:00
Brian Paul
fffcecc4d9 tgsi: added tgsi_full_instruction::Flags field
Users of the parser can make use of this.
2009-08-20 10:51:55 -06:00
Alex Deucher
0f0a9e3ee7 r600: try and get everything in the draw in one IB
fixes corruption issues with apps like teapot and
geartrain.
2009-08-20 12:12:23 -04:00
Alex Deucher
1b1d591373 r600: move misc regs from general state
These regs don't use the SET_CONTEXT_REG packet,
so they weren't getting set correctly.
2009-08-20 12:12:23 -04:00
Brian Paul
39ec4a9253 mesa: add GL_DEPTH_STENCIL to glCopyPixels error check
Plus, add a comment about 'type' error checking.
See bug 19087.
2009-08-20 08:12:16 -06:00
Alex Deucher
525ddb1f56 r600: rework emit code
make sure we allocate enough space for relocs
2009-08-20 03:38:49 -04:00
Pauli Nieminen
ec1540052b radeon: Update regulary cs processing info from kernel.
This fixes problem that dma buffers were leaking in dri1 mode.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-20 03:38:49 -04:00
Brian Paul
8604a896a6 gallium: rename copy/fill_rect utility functions 2009-08-19 13:17:58 -06:00
Brian Paul
4522cdbfdd gallium: fix tags target in Makefile.template 2009-08-19 13:17:58 -06:00
Alex Deucher
174aeabc0f radeon: fix typo in last dma patch 2009-08-19 13:07:39 -04:00
Eric Anholt
29e51c3872 intel: Fix failure to commit -a --amend before last push. 2009-08-19 09:30:47 -07:00
Eric Anholt
a70e131584 intel: Align cubemap texture height to its padding requirements. 2009-08-19 09:19:06 -07:00
Eric Anholt
b053474378 intel: Align untiled region height to 2 according to 965 docs.
This may or may not be required pre-965, but it doesn't seem unlikely, and
I'd rather be safe.
2009-08-19 09:19:06 -07:00
Pauli Nieminen
947df2e5a8 radeon: Add debug output for dma buffer object numbers.
Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-19 11:59:47 -04:00
Pauli Nieminen
66e019c6c9 radeon: Fix dma buffer object pool to scale object sizes.
This fixes problems when application is using large vertex arrays for drawing.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-19 11:59:34 -04:00
Alex Deucher
d551b3ac88 r600: minor cleanup 2009-08-19 11:59:03 -04:00
Brian Paul
0259a2ad69 progs/xdemos: add multictx to .gitignore 2009-08-19 08:58:38 -06:00
José Fonseca
c69d9296fb tgsi: Add missing include.
(cherry picked from commit d2787c02c130b1fe20d0c032d468622f2fdaef79)
2009-08-19 12:03:34 +01:00
José Fonseca
b2f3f7dd12 tgsi: Fix typo in ureg constant creation.
(cherry picked from commit aa40c9abc7787fdf46cb661a4d0bb8bec513fc63)
2009-08-19 12:03:10 +01:00
Keith Whitwell
dd5ac3cafc st/xlib: remove a couple more 'fake' references 2009-08-19 12:02:53 +01:00
Keith Whitwell
515a820021 st/xlib: remove dead ungrab helper 2009-08-19 12:02:53 +01:00
Keith Whitwell
65079afcde tgsi: silence compiler warning 2009-08-19 12:00:24 +01:00
Keith Whitwell
7dc5527592 tgsi: remove unused function argument 2009-08-19 12:00:03 +01:00
Keith Whitwell
265e210edb tgsi: add missing functionality to support instructions with labels
Could previously emit opcodes with label arguments, but was no way to
patch them with the actual destinations of those labels.

Adds two functions:

  ureg_get_instruction_number - to get the id of the next instruction
     to be emitted

  ureg_fixup_label - to patch an emitted label to point to a given
     instruction number.

Need some more complex examples than u_simple_shader, so far this has
only been compile-tested.
2009-08-19 11:54:26 +01:00
Corbin Simpson
e327845e2b r300g: Force off ZTOP optimizations for now. 2009-08-18 21:25:53 -07:00
Corbin Simpson
0086a84e2d r300g: Utilize DONTBLOCK.
Also ALGYRHYTHMS.
2009-08-18 21:25:53 -07:00
Corbin Simpson
c0bc070ff5 radeon-gallium: Oh, look, we *do* already support DONTBLOCK.
Well, okay, the kernel doesn't, but that's no excuse for us! :3
2009-08-18 21:25:53 -07:00
Corbin Simpson
a381ee8266 r300g: Massively cleanup OQ.
Still broken, but compiles cleaner, behaves better, etc.
2009-08-18 21:25:53 -07:00
Corbin Simpson
4092f318db r300g: Add high_second_pipe cap for R3xx chipsets.
This name is totally subject to change if ever I need to separate R3xx
for some other reason.
2009-08-18 21:25:53 -07:00
Corbin Simpson
14378cbd2d radeon-gallium: Stop using outdated ioctls. 2009-08-18 21:25:53 -07:00
Corbin Simpson
c63bd15f81 Revert "r300-gallium, radeon-gallium: Nuke gb_pipes from orbit."
This reverts commit 6a40d1e9d9.

Turns out that we *do* need these for OQ after all. Go figure.

Conflicts:

	src/gallium/winsys/drm/radeon/core/radeon_r300.h
2009-08-18 21:25:53 -07:00
Brian Paul
73fc09a7bf Merge branch 'mesa_7_5_branch' 2009-08-18 17:55:27 -06:00
Brian Paul
e4aa62a6ce egl/xlib: move call to create_configs() after we set the Xdpy field 2009-08-18 17:54:44 -06:00
Brian Paul
3097d7dbf8 tgsi/ppc: we don't implement saturation modes yet 2009-08-18 17:50:52 -06:00
Brian Paul
fab17c1216 tgsi/sse: we don't implement saturation modes yet
Fixes piglit fp-generic tests/shaders/generic/lrp_sat.fp, bug 23316.
2009-08-18 17:50:00 -06:00
Brian Paul
ee0984e299 mesa: when emitting vertex program fog, set yzw=0,0,1
Fixes piglit fp-fog failure with gallium.
2009-08-18 17:39:55 -06:00
Brian Paul
b062a119ff mesa: call FLUSH_CURRENT() for GL_CURRENT_TEXTURE_COORDS query 2009-08-18 17:09:32 -06:00
Ian Romanick
a512985fd8 Merge branch 'master' into asm-shader-rework-1
Conflicts:
	src/mesa/shader/arbprogparse.c
2009-08-18 12:20:36 -07:00
Ian Romanick
0b5af41c6f ARB prog parser: Delete the old parser 2009-08-18 12:07:47 -07:00
Ian Romanick
ea8db5c332 ARB prog: Revert some changes to debug output 2009-08-18 12:07:47 -07:00
Pauli Nieminen
f9b8562f32 radeon: balance dma buffer mapping
In radeonRefillCurrentDmaRegion() make sure we
unmap the previous buffer.
2009-08-18 14:32:45 -04:00
Jakob Bornecrantz
657109bbc6 egl: Create the front texture the properly 2009-08-18 18:51:41 +01:00
Pauli Nieminen
caae3f1e8d r300: Movde debug output from stdout to stderr in copiler.
Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-18 13:44:00 -04:00
Dave Airlie
1279cdcb1f r200: make use of DMA buffers for Elts a lot better.
This allows us to return the unused portion of the dma buffer
to the allocator instead of wasting nearly 16k a pop.

Cherry picked and ported to new code by Pauli.
2009-08-18 13:19:45 -04:00
Pauli Nieminen
ae290fd93e r200: Fix missing offset from elt buffer pointer.
Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-18 13:19:34 -04:00
Pauli Nieminen
bbf2b5c4ff radeon: Optimize memory handling for dma operations.
We keep dma buffer objects in list untill they have been unused for many
draw operations. Current limit of having 100 flushes is just guess for
good performance/memory trade off.

Moving WARN_ONCE macro to common context because it is used in multiple drivers.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-18 13:19:25 -04:00
Alex Deucher
c745c87b3e r300: fix the build on big endian 2009-08-18 11:40:18 -04:00
Brian Paul
1c1ee1176d gallium: improved comments, minor whitespace changes 2009-08-18 09:31:22 -06:00
Chia-I Wu
34d8c13bff egl: Remove eglhash.c and eglhash.h.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-18 08:50:12 -06:00
Chia-I Wu
e484a92928 egl: Add back handle checking.
Handle checking was done using hash tables.  Now that they are gone, we
have to loop over the lists.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-18 08:50:06 -06:00
Chia-I Wu
e3734e4685 egl: Make lookup functions static inline.
progs/egl/demo3.c is also changed since it uses an internal function.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-18 08:50:00 -06:00
Chia-I Wu
38feefdc4e egl: Remove hash table for displays.
The hash table was used to map a display to a handle.  It is simpler to
cast directly.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-18 08:49:53 -06:00
Chia-I Wu
7a9f528009 egl: Remove hash table for surfaces.
The hash table was used to map a surface to a handle.  It is simpler to
cast directly.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-18 08:49:34 -06:00
Chia-I Wu
ccc2b0bc65 egl: _eglCloseDriver should be no-op.
Move drv->API.Terminate call to eglTerminate.  Remove
_eglReleaseDisplayResource as drivers are doing it.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-18 08:49:22 -06:00
Chia-I Wu
5a2c9372a0 egl: Some per-driver data should be per-display.
Move some fields of _EGLDriver to _EGLDisplay.  It also becomes
unnecessary to pass _EGLDisplay to drivers when _eglMain is called.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-18 08:49:09 -06:00
Chia-I Wu
0eaa02c836 egl: Change the way drivers are loaded.
Driver is chosen and preloaded when eglGetDisplay is called.  Later when
eglInitialize is called, the same driver is matched to initialize the
display.  Also, add new, but unused, hooks to EGLDriver to allow a
driver to probe a display or unload itself.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-18 08:44:44 -06:00
Chia-I Wu
2f2cf461c5 egl: Overhaul driver API.
The motivation is so that drivers do not need to look up and check for
bad display, context, and etc.  It also becomes unnecessary for drivers
to call the link functions.

This commit makes eglapi.[ch] do the lookup and check.  As a result, the
driver API is overhauled, and almost all sources and drivers need
update.  The updates are mainly find and replace with human brains.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-18 08:44:34 -06:00
Dave Airlie
521dea21d4 r600: fix build 2009-08-18 20:38:49 +10:00
Dave Airlie
771e19a861 r300: remove warning introduced with OQ 2009-08-18 20:30:15 +10:00
Dave Airlie
f74e00f4d1 radeon/r200: fix build after OQ commits 2009-08-18 20:29:02 +10:00
Dave Airlie
9ad76e9479 r300: OQ rework
Move to common code base so radeon/r200 can add support for this.
Make OQ start a state emitted like all normal state, and make no-tcl
flushing work in proper places.

Really need a generic post emit space reservation mechanism like max_state
so we can reserve some space for the emit

this code passes demos/arbocclude, piglit occlusion query and
glean occlusion query with TCL and NO-TCL on my rv530.
2009-08-18 20:10:50 +10:00
Dave Airlie
0e705c0dd3 r300: fix missing BEGIN/END batches 2009-08-18 20:10:08 +10:00
Dave Airlie
c80bc3abcd r300: fix big endian build 2009-08-18 13:55:12 +10:00
Brian Paul
3aafd22f6a gallium: memset() tgsi_exec_machine to all zeros in tgsi_exec_machine_create()
This fixes invalid values for CondStackTop, LoopStackTop, etc.
2009-08-17 17:13:17 -06:00
Brian Paul
680df529a3 demos/glsl: remove glutInitWindowPosition() calls 2009-08-17 17:13:17 -06:00
Alex Deucher
af1dc225c2 r600: fix counting error after the last commit 2009-08-17 18:16:38 -04:00
Alex Deucher
66c632b5a1 r600: make sure the number of indices is valid
make sure the number of indices is valid for the
requested prim type.  glxgears sends invalid
quad strips with only 2 indices for example.
2009-08-17 17:47:27 -04:00
Alex Deucher
c3380ded10 radeon: remove RADEON_DEBUG_BO stuff
This stuff was a vestige of the r600 bring up and
now mostly serves to periodically break the build.
2009-08-17 15:42:19 -04:00
Maarten Maathuis
caf40d5d14 nv50: remove a few cases of directly casting struct pipe_context 2009-08-17 18:48:14 +02:00
Maarten Maathuis
97cc526eb7 nv50: borrow some flushing code from the ddx
- This fixes neverball corruption.
- I'm unsure about what we're actually flushing here.
2009-08-17 18:48:14 +02:00
Maarten Maathuis
f199dbdb76 gallium: Make PIPE_TRANSFER_{READ,WRITE,READ_WRITE} bitmask friendly. 2009-08-17 18:48:14 +02:00
Maarten Maathuis
93ce4c99d4 nv50: whitespace fixes and deobfuscation 2009-08-17 18:48:13 +02:00
Brian Paul
7c4223876b cell: fix incorrect pipe_transfer tests
The value is an enum, not a bitmask.
2009-08-17 08:28:22 -06:00
Jerome Glisse
c952c1f109 r300: split vbo rendering with big drawarray case
Split vbo rendering when the number of elements requested
by drawarrays is bigger than 65536.
2009-08-17 12:50:27 +02:00
Christoph Bumiller
0204c7d8d7 nv50: fix stencil state
It's the front stencil methods that have contiguous offsets,
not the back ones.
Unfortunately the names in the header still have FRONT/BACK
reversed, so I'm using hex values until it gets updated.
2009-08-17 12:26:54 +02:00
Dave Airlie
743c4af5cd radeon: turn off bo debugging 2009-08-17 19:09:15 +10:00
Maciej Cencora
fd97f2f8b8 r300: disable ZTOP only when occlusion queries are used 2009-08-16 02:04:29 +02:00
Maciej Cencora
30e9c753b8 Merge branch 'oq' 2009-08-16 01:56:29 +02:00
Pauli Nieminen
57f55af219 mesa: Add 2 new demos to .gitignore. 2009-08-15 13:30:15 -06:00
Maarten Maathuis
a7adb85827 nv50: avoid a NULL-ptr dereference when the pipe context changes
- We cannot assume all state objects are present when the pipe context changes.
2009-08-15 16:57:00 +02:00
Christoph Bumiller
a2af40b846 nv50: align registers used with TEX to 4
The TEX instruction is passed the first index of a contiguous
range of 4 TEMP registers that contain coordinates / LOD and,
after execution, the texel values.
It seems the first index is required to be a multiple of 4 on
some (older ?) cards.
2009-08-15 16:22:27 +02:00
Maciej Cencora
60587182d4 r300: enable ARB_occlusion_query
Supported only on HW with TCL block and with proper radeon drm.
Required minimum radeon drm version is 1.30 or KMS.
2009-08-15 15:14:29 +02:00
Maciej Cencora
d2b1b9e8d5 radeon: add flag for drm OQ support 2009-08-15 15:14:25 +02:00
Maciej Cencora
f3e1d7d6f8 r300: temporary occlusion query hack 2009-08-15 15:14:24 +02:00
Maciej Cencora
8d60c0b751 r300: clear not_flushed OQ list after flush 2009-08-15 15:14:24 +02:00
Maciej Cencora
c903834d4d r300/oq: add some debugging info 2009-08-15 15:14:23 +02:00
Maciej Cencora
0d0f01e2e0 r300: add occlusion queries support
TODO:
- use proper interface for checking if bo is idle when it's available
- disable ZTOP only when needed
- make it work under KMS
2009-08-15 15:14:11 +02:00
Dave Airlie
f2daded812 radeon space: realign with drm space check code 2009-08-15 21:34:17 +10:00
Dave Airlie
a6cc45e135 r300: fixup space checks since VBO code
Hopefully this gets the ordering correct so the space checks don't fail.
2009-08-15 21:18:30 +10:00
Dave Airlie
3cc9a28b9b r300: add just in case warn I don't think this can actually happen 2009-08-15 20:30:45 +10:00
Dave Airlie
5e4e8effec radeon: enable vertex splitting for IBs
Based on Maciej's code, just fixed up the alignments for INDX_BUFFER

ut2004 runs AS-Convoy
2009-08-15 20:22:13 +10:00
Roland Scheidegger
b9789948e0 i965: disable bounds checking on arrays with stride 0
if stride is 0 we cannot use count as max index for bounds checking,
since the hardware will simply return 0 as data for indices failing
bounds check. If stride is 0 any index should be valid hence simply
disable bounds checking in this case.
This fixes bugs introduced with e643bc5fc7.
2009-08-15 03:44:43 +02:00
Brian Paul
e8957f4800 progs/demos: print more info in fbotexture.c 2009-08-14 17:30:32 -06:00
Ian Romanick
e304c65a2b i965: Add support for GL_ARB_seamless_cube_map 2009-08-14 16:28:51 -07:00
Ian Romanick
8b0b33530c demos/cubemap: Add support for GL_ARB_seamless_cube_map 2009-08-14 16:28:51 -07:00
Ian Romanick
06ae1db4a9 Regenerate files for GL_ARB_seamless_cube_map 2009-08-14 16:28:51 -07:00
Ian Romanick
9d5bb3c6f8 Infrastructure for GL_ARB_seamless_cube_map 2009-08-14 16:28:51 -07:00
Ian Romanick
970f768666 Regenerate files for GL_APPLE_flush_buffer_range 2009-08-14 16:28:50 -07:00
Maciej Cencora
a89963cec1 Merge branch 'vbo_clean'
Conflicts:
	src/mesa/drivers/dri/r300/r300_draw.c
2009-08-15 00:52:44 +02:00
Maciej Cencora
7fe0dd2e6e r300: mark VBO buffer objects as persistent 2009-08-15 00:39:19 +02:00
Maciej Cencora
cd703049db r300: unmap buffer objects after usage 2009-08-14 23:56:04 +02:00
José Fonseca
e3bc1fb6bc gallium: Always map for READ flag when DISCARD is not set.
This prevents the driver from discarding a buffer when the whole buffer
is mapped for writing, but only a portion is effectively written.

This is a temporary fix, because WRITE shouldn't imply DISCARD.

The full fix implies using PIPE_BUFFER_USAGE_DISCARD, throughout
the code, and will go only into master.
2009-08-14 20:05:51 +01:00
José Fonseca
10430f47a4 trace: Remove space next to the class attribute of the trace. 2009-08-14 20:05:51 +01:00
José Fonseca
cdf56eb68d python/retrace: Open bz2 files correctly. 2009-08-14 20:05:51 +01:00
Brian Paul
71b1610941 mesa: append uniform values to the log file the first time we use a shader
This info is essential to using/debugging a shader outside of its normal
application.
2009-08-14 12:58:21 -06:00
Brian Paul
12199ed96c mesa: also pass the GPU program to _mesa_append_uniforms_to_file()
We want the post-link program at this points.
2009-08-14 12:57:39 -06:00
Brian Paul
e3d47515f9 vbo: call _mesa_valid_to_render() 2009-08-14 11:31:00 -06:00
Brian Paul
d09a19bf6e Merge branch 'mesa_7_5_branch' 2009-08-14 11:27:51 -06:00
Brian Paul
db598b8998 mesa: new _mesa_append_uniforms_to_file() debug/logging function 2009-08-14 11:27:33 -06:00
Brian Paul
b6e5600bd4 mesa: call _mesa_valid_to_render() 2009-08-14 11:27:33 -06:00
Brian Paul
d03dde16eb vbo: call _mesa_valid_to_render() 2009-08-14 11:27:33 -06:00
Brian Paul
56c4226fcc mesa: new _mesa_valid_to_render() function
Tests if the current shader/program is valid and that the framebuffer is
complete.  To be called by glBegin, glDrawArrays, etc.
2009-08-14 11:27:33 -06:00
Brian Paul
a48b0a5ce7 mesa: minor error string changes 2009-08-14 11:27:33 -06:00
Brian Paul
1574b05189 docs: docs: document new --with-max-width/height config options 2009-08-14 11:24:20 -06:00
Brian Paul
a7ca80ff6a Add a FAQ about internal buffer sizes.
(cherry picked from master, commit 9a8781bd24)
2009-08-14 11:23:18 -06:00
Brian Paul
467b3d9a6f Add configure options for MAX_WIDTH/HEIGHT.
This adds two --with configure options for setting defines for
MAX_WIDTH and MAX_HEIGHT.  It's conceivably just as easy to define
these in CFLAGS manually, but this way users don't need to know
about internal Mesa details.

Patch updated by BrianP to set DEFINES, not CFLAGS.

(cherry picked from master, commit 7085dce750)
2009-08-14 11:23:00 -06:00
Brian Paul
e691b0e533 Allow external settings of MAX_WIDTH/HEIGHT.
Conditionalize MAX_WIDTH / MAX_HEIGHT defines so that users can
set them via CFLAGS.

(cherry picked from master, commit 66bc17e80e)
2009-08-14 11:22:37 -06:00
Keith Whitwell
51c47383f9 st/xlib: reduce the proliferation of GLX context types
Now there is just a single, struct __GLXcontextRec, which is the
GLXContext typedef has already been defined as a pointer to.  I
believe this is the intended usage, that GLX implementations should
define that struct as they require.

Merge the two previous structs into one and get rid of the
no-longer-necessary type casts and sub-classing.
2009-08-14 17:56:47 +01:00
Keith Whitwell
9616e4ad1c st/dri: remove unused dummyContext value 2009-08-14 17:42:27 +01:00
Brian Paul
3ffaa11f88 mesa: move assertions in test_attachment_completeness()
Put the assertions after the error checks.
2009-08-14 10:30:10 -06:00
Christoph Bumiller
442a5e4343 nv50: fix mipmap offsets and tiling
The hardware expects a texture's tile mode to change with
the mipmap level.
Also, only multiply by block size once to obtain size.
2009-08-14 18:23:55 +02:00
Christoph Bumiller
3506d7d3e2 nv50: make sure we don't re-emit outdated scissor state
Since we don't turn off scissors, we need to update the
stateobj when the framebuffer size changes.
2009-08-14 18:16:46 +02:00
Christoph Bumiller
74e8b1a30b nv50: make use of the y-origin switch
Now that we know how to make the hardware have y-coordinate origin
top, we can get rid of all the inversion introduced earlier.
2009-08-14 18:06:24 +02:00
Maciej Cencora
cdaf63d0ea r300: remove broken vertex splitting
Revert to previous behaviour of dropping to big render operations.
2009-08-14 17:10:21 +02:00
Maciej Cencora
9e018d8225 r300: rework index buffer setup
Copy elements directly to DMA bo to get rid of one memcpy, and prepare for using VBOs for index buffer.
2009-08-14 17:10:15 +02:00
Maciej Cencora
7c060bff13 r300: remove unused software TNL path
This doesn't remove software TCL path - so RS480 and RS690 work as before.
2009-08-14 17:06:02 +02:00
Maciej Cencora
5fb5ea97f4 r300: use VBOs for vertex attributes 2009-08-14 17:05:50 +02:00
Brian Paul
c3f9c2eb75 docs: document new --with-max-width/height config options 2009-08-14 09:00:15 -06:00
Tom Fogal
9a8781bd24 Add a FAQ about internal buffer sizes. 2009-08-14 08:58:59 -06:00
Tom Fogal
7085dce750 Add configure options for MAX_WIDTH/HEIGHT.
This adds two --with configure options for setting defines for
MAX_WIDTH and MAX_HEIGHT.  It's conceivably just as easy to define
these in CFLAGS manually, but this way users don't need to know
about internal Mesa details.

Patch updated by BrianP to set DEFINES, not CFLAGS.
2009-08-14 08:58:37 -06:00
Tom Fogal
66bc17e80e Allow external settings of MAX_WIDTH/HEIGHT.
Conditionalize MAX_WIDTH / MAX_HEIGHT defines so that users can
set them via CFLAGS.
2009-08-14 08:56:51 -06:00
Tobias Doerffel
87946d206f intel: in intel_context struct use typedef for sarea struct
Using drm_i915_sarea_t instead of struct drm_i915_sarea seems to be
a common standard now, therefore fix it also in intel_context
structure. Additionally this silences a compiler warning:

intel_swapbuffers.c: In function `intelFixupVblank':
intel_swapbuffers.c:48: warning: initialization from incompatible pointer type

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-08-14 08:50:52 -06:00
Thierry Vignaud
2674d1ba50 mesa: make sure r300/compiler/ sources are included in tarball 2009-08-14 08:16:54 -06:00
Chia-I Wu
67b639c7ab st/vega: Add more symbols defined by mesa/st.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-14 08:11:38 -06:00
Maciej Cencora
895f7c33d4 r300: add required symlinks
Reported by adamk on #radeon
2009-08-14 16:02:11 +02:00
Maciej Cencora
e029c91fd3 radeon: handle debug versions of radeon_bo_open 2009-08-14 16:02:10 +02:00
Christoph Bumiller
f1aa2a43b7 nv50: fix typo in REALLOC's 2nd argument in ctor_immd 2009-08-14 15:54:49 +02:00
Maciej Cencora
6bcbeb02d6 radeon: add VBO support (not enabled yet) 2009-08-14 15:31:11 +02:00
Maciej Cencora
2233ac61e1 radeon: export emitvec* functions 2009-08-14 15:31:06 +02:00
Maciej Cencora
d534648d90 radeon: constify some parameters 2009-08-14 15:30:55 +02:00
Alex Deucher
7069a7548f r600: emit SURFACE_BASE_UPDATE on depth base updates on rv6xx 2009-08-14 01:37:36 -04:00
Dave Airlie
ceb9459ed5 glsl: re-write Makefile after I called it bad. 2009-08-14 10:05:10 +10:00
Brian Paul
0c717bcd5d progs/glsl: added multitex.shtest config file 2009-08-13 17:03:57 -06:00
Brian Paul
08ecd863ee progs/glsl: set generic vertex attribute values 2009-08-13 17:03:56 -06:00
Brian Paul
62d1132160 progs/glsl: add type field to shtest config files
Plus, texture loading.
2009-08-13 17:03:56 -06:00
Brian Paul
823703418e mesa: added *.shtest files to demo tarball 2009-08-13 17:03:56 -06:00
Dave Airlie
25cd4dc1d6 glsl/tests: skinning.o
worst Makefile ever. not sure what is going on here, hopefully
this fixes tinderbox
2009-08-14 08:35:49 +10:00
Alex Deucher
9d96095c1e r600: move non-surface related cb state to general state 2009-08-13 17:55:42 -04:00
Alex Deucher
083b04e809 r600: move non-surface related depth state to general state 2009-08-13 17:43:03 -04:00
RALOVICH, Kristóf
0896268b97 glx: indent -br -i3 -npcs --no-tabs
Some manual intervention applied since XEXT_* and other macro magic
fooled indent. Auto generated files were also skipped.
2009-08-13 15:13:21 -06:00
Brian Paul
1e0f621b50 mesa: fix some invalid memory reads
We were passing the address of a float to functions that would deref the
pointer as an array.
2009-08-13 14:38:27 -06:00
Brian Paul
6d55fd705d progs/tests: hack a PBO/dlist test 2009-08-13 14:07:25 -06:00
Brian Paul
ecb177eaea mesa: fix warnings about locals hiding function params 2009-08-13 14:05:52 -06:00
Brian Paul
36df6a6e91 mesa: add missing PBO mapping code in unpack_image() 2009-08-13 14:00:21 -06:00
Brian Paul
ad8a6937ae main: fix some potential memory leaks
Allocate dlist images after error checking.
Record GL_OUT_OF_MEMORY when we can't make a copy of an image.
2009-08-13 13:48:36 -06:00
Brian Paul
f418d18ea6 mesa: fix some potential uninitialized memory references 2009-08-13 13:44:31 -06:00
Brian Paul
a531a5cf94 glsl: fix some uninitialized pointers 2009-08-13 13:44:01 -06:00
Brian Paul
741869d73a progs/util: ignore pre-defined uniforms in SetUniformValues() 2009-08-13 12:53:20 -06:00
Brian Paul
ae99e4c67e progs/glsl: new shtest program, a simple shader test harness app
This commit includes some sample config files (*.shtest)
2009-08-13 12:52:13 -06:00
Brian Paul
03ba461c19 glsl: fix incorrect attribute size 2009-08-13 12:50:57 -06:00
Brian Paul
53dfd5d870 tnl: if NAN_CHECK is enabled, also assert that pos.x != 0 2009-08-13 12:50:57 -06:00
Brian Paul
c10002361c mesa: s/assert/ASSERT/ in _mesa_reference_texobj()
We want the no-op ASSERT for non-debug builds.
2009-08-13 12:50:57 -06:00
Brian Paul
8a9795e5c6 mesa: rework error check in glGetTexLevelParameter(), remove tex_image_dimensions() 2009-08-13 12:50:57 -06:00
Brian Paul
423a53f635 mesa: if maxLevels==0, target is invalid 2009-08-13 12:50:56 -06:00
Brian Paul
fe988d786c mesa: add extension checks in _mesa_max_texture_levels() 2009-08-13 12:50:56 -06:00
Brian Paul
47a385b43b mesa: minor clean-ups in bumpmap functions 2009-08-13 12:50:56 -06:00
Brian Paul
6aa7a03d85 mesa: use _mesa_get_current_tex_unit() in more places 2009-08-13 12:50:56 -06:00
Brian Paul
73b150c816 mesa: refactor: move _mesa_is_color/depth/stencil_format() helpers to image.c 2009-08-13 12:50:56 -06:00
Brian Paul
ba2a55ccd6 mesa: move _mesa_Get[Compressed]TexImage() to texgetimage.c
All the glGetTexImage code is in one file now.
2009-08-13 12:50:56 -06:00
Brian Paul
b9f67df6e7 mesa: short-circuit no-change in _mesa_DepthRange() 2009-08-13 12:25:53 -06:00
Michel Dänzer
ace98f09e6 st/dri: Add support for GLX_EXT_texture_from_pixmap with direct rendering. 2009-08-13 20:24:09 +02:00
Michel Dänzer
7c08614b32 gallium/drm: Handle circular dependencies in the auxiliary libraries with make. 2009-08-13 18:46:53 +02:00
Michel Dänzer
7ef8c79a8c st/xorg: Fix DRI2 CopyRegion hook.
Use GC CopyArea op for proper translation and clipping, and throttle full
buffer swaps / frontbuffer flushes.
2009-08-13 18:46:53 +02:00
Keith Whitwell
f2fcd5822a tgsi: add simple facility for releasing and reusing temporaries 2009-08-13 17:32:25 +01:00
Keith Whitwell
b56d2ba7b2 tgsi: rename ureg src/dest converters
Also fix a typo in ureg_src().
2009-08-13 17:32:25 +01:00
José Fonseca
5c5364a0f6 draw: Remove unused variable. 2009-08-13 16:33:50 +01:00
José Fonseca
7b39194e2d scons: Handle Circular dependencies in the libraries. 2009-08-13 16:32:51 +01:00
Keith Whitwell
bf57eda0ec Merge branch 'mesa_7_5_branch' 2009-08-13 15:57:23 +01:00
Keith Whitwell
1ce3f5a806 draw: cope with more primitives in draw_pipeline_run
This previously was used only for decomposed (POINT/LINE/TRI) primitives,
but for some time a full range of primitives could end up in here.

Fixes trivial/lineloop-clip on softpipe, among others.
(cherry picked from commit 87cd8a3b8a2407b30916be418ff2f95dfea5d2ad)
2009-08-13 15:56:17 +01:00
Keith Whitwell
78918c8760 tgsi: turn off debugging 2009-08-13 14:28:01 +01:00
Keith Whitwell
749e52049d tgsi: use REALLOC for growing token pool 2009-08-13 14:27:42 +01:00
Keith Whitwell
120e76866b util: silence warnings for third REALLOC argument
Our fallback realloc path requires an old_size argument, but the posix
varient doesn't need this.  Add some code to avoid gcc unused variable
warnings for this extra argument.
2009-08-13 14:26:50 +01:00
Keith Whitwell
b1d82f1f19 util: remove unneeded includes 2009-08-13 13:43:25 +01:00
Keith Whitwell
002c76cfef util: convert u_simple_shaders to use tgsi_ureg
Much nicer now.
2009-08-13 13:02:59 +01:00
Keith Whitwell
8a7d1e7b76 tgsi: add tgsi_ureg, a simplified tgsi shader builder
This is modelled on the nice & easy-to-use facilities we had
for building shaders in mesa, eg. in texenvprogram.c and friends.

Key points include pass-by-value register structs that can be manipulated
in a functional style, eg:

   negate(swizzle(reg, X,X,X,X))

and per-opcode instruction functions, eg:

   emit_MOV( p, writemask(dst, 0x1), negate(src));

and similar.

Additionally, the interface allows mixed emit of instructions and decls,
which are sorted out internally to obey TGSI ordering.

Immediates may be emitted at any time and are scanned against existing
immediates to try and reduce redundancy.

Not all TGSI functionality is accessible through this interface, but
most or all of what mesa uses should be.
2009-08-13 13:02:47 +01:00
Xiang, Haihao
1f40ffca63 i965: fix cube map on IGDNG 2009-08-13 18:42:52 +08:00
Brian Paul
4ce73ad92c glsl: remove duplicate frag input entry 2009-08-12 20:37:34 -06:00
Brian Paul
f3b215cba2 Merge branch 'new-frag-attribs'
This branch introduces new FRAG_ATTRIB_FACE and FRAG_ATTRIB_PNTC fragment
program inputs for GLSL gl_FrontFacing and gl_PointCoord.  Before, these
attributes were packed with the FOG attribute.  That made things
complicated elsewhere.
2009-08-12 20:32:41 -06:00
Brian Paul
fdfb0d4b0e progs/glsl: change uniform_info::type field to use GLSL vector types 2009-08-12 17:28:45 -06:00
Brian Paul
af3d7f6889 demos: call SetUniformValues() 2009-08-12 17:28:45 -06:00
Brian Paul
f95b82b486 mesa: const qualifiers 2009-08-12 17:28:45 -06:00
Brian Paul
bd4c6a2e50 vbo: use _mesa_is_bufferobj() 2009-08-12 17:28:45 -06:00
Brian Paul
684049d97d demos: rename InitUniforms() to SetUniformValues()
And call new PrintUniforms() in demos.
2009-08-12 17:28:45 -06:00
Brian Paul
378bff0edd progs/util: added more shader utility functions 2009-08-12 17:28:45 -06:00
Brian Paul
434ec3ada8 mesa: use _mesa_is_bufferobj() 2009-08-12 17:28:45 -06:00
Brian Paul
604031563c mesa: use _mesa_is_bufferobj() 2009-08-12 17:28:45 -06:00
Brian Paul
abbf83551f mesa: new _mesa_is_bufferobj() function
Tests if the given buffer object is a user-created, non-default buffer object.
Use this instead of testing bufferobj->Name != 0.
2009-08-12 17:28:45 -06:00
Eric Anholt
d64649a316 i965: Make the cube mapping RCP use a writemask.
Fixes cube mapping since the scalar changes.
2009-08-12 13:50:09 -07:00
Eric Anholt
5faa0dc591 i965: Allocate destination registers for GLSL TEX instructions contiguously.
This matches brw_wm_pass*.c behavior, and fixes the norsetto shadow demo.

Bug #19489
2009-08-12 13:18:47 -07:00
Eric Anholt
63fa5fd319 i965: drop dead scalar handling in GLSL. 2009-08-12 13:05:59 -07:00
Eric Anholt
08687c8b40 i965: Correct brw_wm_nr_args for WM_DELTAXY and WM_PIXELXY. 2009-08-12 12:54:43 -07:00
Eric Anholt
863ae3a527 i965: Drop GLSL ABS code, which is translated away in brw_wm_fp. 2009-08-12 12:43:43 -07:00
Eric Anholt
4de8b8902f i965: Drop code for emitting OPCODE_SUB, since brw_wm_fp.c makes it an ADD. 2009-08-12 12:43:43 -07:00
Eric Anholt
0eb819a2d1 i965: Store the dispatch width in the WM compile struct.
I'll be using this in merging brw_wm_emit.c and brw_wm_glsl.c
2009-08-12 12:43:43 -07:00
Eric Anholt
536476f243 i965: Handle scalar result swizzling in shared GLSL/non-GLSL code.
This is preparation for merging of brw_wm_glsl.c and
brw_wm_emit.c, and glsl.c doesn't swizzle channel results around.
2009-08-12 12:43:43 -07:00
Eric Anholt
792c49968e i965: Flag ARL-using programs as requiring brw_wm_glsl.c
This doesn't fix the glean testcase, but I guess it provides hope.
2009-08-12 12:43:42 -07:00
Eric Anholt
4e477aa1ba i965: Remove some unused WM opcode args. 2009-08-12 12:43:42 -07:00
Eric Anholt
255e5be265 i965: Avoid re-uploading the index buffer when we don't need to.
No performance difference proven at 95% confidence with my GLSL demo (n=10).
2009-08-12 12:43:42 -07:00
Alex Deucher
a245c05dd3 r600: fix warning 2009-08-12 15:40:15 -04:00
Alex Deucher
b0c191acaf r600: state cleanups 2009-08-12 15:40:15 -04:00
Alex Deucher
2f6675b816 r600: clean up Create/DestroyContext 2009-08-12 15:40:15 -04:00
Pauli Nieminen
b6a4f5f1d3 r200: Prevent TexGenMatrix from leaking when destroying r200 context.
Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-12 15:40:14 -04:00
Brian Paul
855374a76a vbo: fix incorrect pointer 2009-08-12 13:16:41 -06:00
Brian Paul
8f9ee06925 glsl: add gl_Vertex, gl_Normal, etc to list of active attributes
If a vertex shader uses gl_Vertex, gl_Normal, etc, we need to include them
when the user queries the list of active attributes.  Before this we were
just including the user-defined attributes.
2009-08-12 12:35:13 -06:00
Brian Paul
fd5eda1423 glsl: move predefined shader input/output info/code to slang_builtin.c
This is a more logical place for this code.
Also add some functions for querying vertex shader input names, types, etc.
2009-08-12 12:35:12 -06:00
Eric Anholt
2708ddfb06 vbo: Avoid extra validation of DrawElements.
This saves mapping the index buffer to get a bounds on the indices that
drivers just drop on the floor in the VBO case (cache win), saves a bonus
walk of the indices in the CheckArrayBounds case, and other miscellaneous
validation.  On intel it's a particularly a large win (50-100% in my app)
because even though we let the indices stay in both CPU and GPU caches, we
still end up waiting for the GPU to be done with the buffer before reading
from it.

Drivers that want the min/max_index fields must now check index_bounds_valid
and use vbo_get_minmax_index before using them.
2009-08-12 11:28:34 -07:00
Eric Anholt
ef3ad412c7 radeon: Minor warnings cleanup. 2009-08-12 11:28:34 -07:00
Eric Anholt
e643bc5fc7 i965: Use _MaxElement instead of index-calculated min/max for VBO bounds. 2009-08-12 11:28:33 -07:00
Pauli Nieminen
29173d3d5c radeon: Add protection against recursive DRM locking.
Reference counting protects DRM lock call from recursive locking that would
cause hang. Code also adds optional debugging output for recursive call that
is compiled only if NDEBUG is not defined.

This code is not 100% thread safe because mesa doesn't include increment and
test atomic operation. There is built-in gcc functions but they are only
available from gcc 4.2.
2009-08-12 14:14:29 -04:00
Michel Dänzer
5eeb44f398 st/xorg: Acquire/drop DRM master in order to work with multiple servers. 2009-08-12 19:11:11 +02:00
Brian Paul
f21b0e9a04 gallium/glx/xlib: main/ prefix on Mesa includes, remove -I$(TOP)/src/mesa/main/ 2009-08-12 10:32:22 -06:00
Brian Paul
10eb2ca954 gallium/glx/xlib: updated comments 2009-08-12 10:32:22 -06:00
Brian Paul
80b8fbcaba gallium/glx/xlib: delete fakeglx.h 2009-08-12 10:32:22 -06:00
Brian Paul
275d0e7e92 gallium/glx/xlib: rename fakeglx.c to glx_api.c 2009-08-12 10:32:22 -06:00
Brian Paul
622d531296 gallium/glx/xlib: delete glxapi.h 2009-08-12 10:32:22 -06:00
Brian Paul
f5dd1cff94 gallium/glx/xlib: rename fakeglx_fonts.c to glx_usefont.c 2009-08-12 10:32:22 -06:00
Brian Paul
0528d6c704 gallium/glx/xlib: rename glxapi.c to glx_getproc.c 2009-08-12 10:32:22 -06:00
Brian Paul
f546fa00aa gallium/glx/xlib: don't include fakeglx.h 2009-08-12 10:32:22 -06:00
Brian Paul
4a4039e199 gallium/glx/xlib: overhaul and simplification of the Gallium Xlib-based GLX
The old GLX dispatch table stuff isn't needed (same story for the Mesa/Xlib
driver).  The intention of that code was being able to switch on the fly
between the real GLX library and the fake/Xlib-based emulation.  That hasn't
been used in a long time.

Next up: some file renaming.
2009-08-12 10:32:22 -06:00
Cooper Yuan
1e52b8b4e0 r600: A shader is bound that exports Z as a float into Red channel 2009-08-12 17:39:18 +08:00
Chia-I Wu
64e7bb3262 egl: Use _eglAddAtExitCall to free thread infos and displays.
Thread infos and displays are usually not freed by applications.  This
commit add atexit calls to free them.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-11 22:14:35 -06:00
Chia-I Wu
435c7ac24d egl: Add _eglAddAtExitCall.
Add a convenient wrapper to register atexit calls.  Add mutex to
_eglGlobal along the way.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-11 22:14:35 -06:00
Chia-I Wu
0e3687e33d egl: Make _eglGlobal initialize statically.
Now that display and surface hash tables are moved out, _eglGlobal can
be initialized statically.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-11 22:14:35 -06:00
Chia-I Wu
413969a920 egl: Implement _eglFiniDisplay.
_eglFiniDisplay is called at exit time to free allocated displays.  It
is, however, not used right now.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-11 22:14:35 -06:00
Chia-I Wu
621801abd2 egl: Make display and surface hash tables local.
Move display and surface hash tables to egldisplay.c, and have them
initialized on demand.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-11 22:14:35 -06:00
Chia-I Wu
56d2119280 egl: Initialize current thread management on demand.
Current thread management was initialized in _eglInitGlobals, which is
called only in eglGetDisplay.  Since EGL does not require eglGetDisplay
to be called first, the initialization is better to be done on demand.

_eglFiniCurrent is removed, as it is not called at all.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-11 22:14:35 -06:00
Chia-I Wu
f6c2f5e379 egl: Destroy eglThreadInfo on thread exit.
This is done through pthread TSD destructor.  It destroys all thread
infos except for main thread's.  The thread info of the main thread is
destroyed by _eglFiniCurrent.

TLS case is not supported yet.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-11 22:14:35 -06:00
Chia-I Wu
e79d21ca1f egl: Add eglmutex.h.
The implementation uses pthread mutex when available.  Otherwise, it is
no-op.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-11 22:14:35 -06:00
RALOVICH, Kristóf
50f8ca2344 glx: fix signedness warning 2009-08-11 22:14:35 -06:00
Brian Paul
fd90d8000c mesa: handle glDrawPixels images which are larger than max rect texture size 2009-08-11 20:34:22 -06:00
Brian Paul
dba6d52ba0 mesa: added _mesa_meta_draw_pixels() 2009-08-11 20:34:21 -06:00
Brian Paul
f821866360 mesa: added META_FOG and optimize some meta_begin/end() code 2009-08-11 20:34:21 -06:00
Brian Paul
9ba19b892c gallium/trace: remove stray semicolons 2009-08-11 20:34:21 -06:00
Brian Paul
b681f396e6 gallium/xlib: add missing tex_usage parameter 2009-08-11 20:34:21 -06:00
Brian Paul
6deaa6d4b1 gallium/egl: add missing tex_usage parameter 2009-08-11 20:34:21 -06:00
Brian Paul
2e8be3ab79 gallium/xlib: add missing tex_usage parameter 2009-08-11 20:34:21 -06:00
Brian Paul
26a762c2f6 gallium/identity: remove stray semicolons 2009-08-11 20:34:21 -06:00
Alex Deucher
c2b29b5df5 r600: use the drm ioctls for swap and texture upload
NOTE:  THIS REQUIRES AN UPDATED DRM!
2009-08-11 22:21:26 -04:00
Jakob Bornecrantz
164d8e8701 i915g: Reduce max relocs 2009-08-12 03:58:38 +02:00
Jakob Bornecrantz
df9f27822e i915g: Check relocs as well 2009-08-12 03:58:37 +02:00
Jakob Bornecrantz
7a60ed2015 i915g: Implement surface_buffer_create for softpipe
In order to run softpipe on st/xorg we need this function
2009-08-11 18:37:09 +01:00
Jakob Bornecrantz
a41a253ce3 gallium: Add texture usage information to surface_buffer_create
We need aditional meta data about the usage of the surface
	in softpipe because we need to be able tell the diffrence
	between PRIMARY and DISPLAY_TARGET surfaces.
2009-08-11 18:34:43 +01:00
Brian Paul
7013a4dfb8 mesa/glapi: regenerated files from gl_API.xml 2009-08-11 10:00:02 -06:00
Brian Paul
bb45e6f07b gallium: fix debug_printf() format string 2009-08-11 09:30:12 -06:00
Brian Paul
a9d37f6837 glut: fix incorrect Vista maximisation size due to WM_GETMINMAXINFO handling
See bug 23182.
2009-08-11 08:54:25 -06:00
Brian Paul
20e4421fe3 mesa: remove _mesa_set_vp_override() from _mesa_Bitmap()
This reverts part of commit 2c9812e3d3.
The calls to _mesa_set_vp_override() were causing extra state validation
and caused the gallium state tracker's bitmap cache to get flushed on
every call.
2009-08-11 08:38:51 -06:00
Michel Dänzer
e93be5132c r300g: Fix up remaining VAP_CNTL_STATUS writes for big endian. 2009-08-11 09:16:48 +02:00
Michel Dänzer
bb91368003 r300g: Emit relocations for pitch registers.
Fixes CS failures with tiling enabled kernels.
2009-08-11 09:13:12 +02:00
Cooper Yuan
2cbd3fce8f r300g: a typo of debug message 2009-08-11 14:39:58 +08:00
Cooper Yuan
2ccd66d8a0 r600: update num of interp if posizition is used 2009-08-11 14:36:01 +08:00
Eric Anholt
74504c48ad demos: Fix the VBO usage in glsl/multitex.
The fix for 965 to be noisy when apps sent pointers instead of VBO offsets
caught this app in the act of doing exactly that.

Bug #23203
2009-08-10 15:53:47 -07:00
Brian Paul
16a1f68c39 intel: use new _mesa_meta_copy_pixels() function
glCopyPixels() no longer hits a software fallback when zooming, blending, etc.
2009-08-10 15:48:02 -06:00
Brian Paul
edb991b7bc mesa: save/restore texture matrix in meta code
Also, save/restore viewport and texture state in _mesa_meta_copy_pixels()
2009-08-10 15:44:05 -06:00
Brian Paul
2ad10c966c mesa: for meta blit, check max texture size, use glCopyTexSubImage2D() when possible 2009-08-10 15:09:38 -06:00
Brian Paul
c16fa388d3 mesa: initial meta implementation of glCopyPixels() 2009-08-10 15:09:38 -06:00
Brian Paul
36a222cf04 mesa: remove debug flush call 2009-08-10 14:15:56 -06:00
Brian Paul
0109e1b9f3 intel: add missing \n to fprintf() 2009-08-10 13:58:56 -06:00
Brian Paul
8cb389ce35 intel: use new _mesa_meta_blit_framebuffer() function
The previous version of framebuffer blit was a quick hack.  The new meta
version works pretty well.
2009-08-10 13:55:32 -06:00
Brian Paul
33a838beb9 mesa: new driver meta-ops module
Implement glClear() in terms of quad rendering, implement glBlitFramebuffer()
in terms of glCopyTexImage2D + textured quad, etc.

There have been several places in the drivers where we've implemented
meta rendering similar to this.  This is an effort to do it in a more
portable and more efficient form.

The _mesa_meta_begin/end() functions act like glPush/PopAttrib() but are
lighter-weight.  Plus, _mesa_meta_begin() resets GL state back to default
values (texturing off, identity vertex transform, etc) so the meta drawing
functions don't have to worry about it.

For now only _mesa_mesa_blit_framebuffer() and _mesa_meta_clear() are
implemented.  glDrawPixels() and glCopyPixels() would be the next candidates.
2009-08-10 13:55:31 -06:00
Brian Paul
e9d9dab0cd mesa: added GLcontext::Meta field for meta rendering state 2009-08-10 13:55:31 -06:00
Dave Airlie
b4c9569715 radeon_fbo: switch short to byte for 565 2009-08-10 19:58:11 +10:00
Dave Airlie
e0c9157671 radeon: fix cut-n-paste in alphabits in fbo code 2009-08-10 10:10:13 +10:00
Pauli Nieminen
11038989c1 egl: Add depend and depend.bak to clean target
Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-09 08:42:50 -06:00
Dave Airlie
728da99737 r600: looks like a typo 2009-08-09 20:46:12 +10:00
Cooper Yuan
b2927a6204 r600: load per-pixel position into PS in order to use fragment.position.
This patch can fix /progs/fp/tri-depth, tri-depth2, tri-depthwrite,
tri-depthwrite2 and point-position.
2009-08-09 12:18:40 +08:00
Brian Paul
483a7916d1 mesa: update framebuffer status as needed in _mesa_source/dest_buffer_exists() 2009-08-08 07:30:26 -06:00
Brian Paul
101c2f907e mesa: simplify glPushAttrib() list building code 2009-08-08 07:30:26 -06:00
Brian Paul
924ba48499 mesa: remove old, prototype code 2009-08-08 07:30:26 -06:00
Brian Paul
b153340351 swrast: replace GLenum, GLint with GLbitfield for buffer vars 2009-08-08 07:30:26 -06:00
Brian Paul
4482f96c59 mesa: use _mesa_bufferobj_mapped() 2009-08-08 07:30:26 -06:00
Corbin Simpson
10b9d9f895 r300g: Knock out another fragment of invariant state.
Colorbuffer setup will always happen.
2009-08-07 20:50:42 -07:00
Corbin Simpson
847fcb645c gallium: Move minify() to u_math.
minify() is usually used in mipmap size calculation. Strangely enough,
we all defined it as MAX2(1, d >> 1); imagine that. :3
2009-08-07 20:50:42 -07:00
Corbin Simpson
c58133b81a r300g: Remove r300_constant_buffer::user_count.
Not needed with new compiler.
2009-08-07 20:50:42 -07:00
Eric Anholt
a962c07cc3 Revert "i965: Disable texture tiling by default."
This reverts commit b8e638d489.

Now that the known hangs and misrendering issues are fixed, I'm ready to
start encouraging it by default again.
2009-08-07 18:33:08 -07:00
Eric Anholt
ceb8afcca5 intel: Align region height as required for tiled regions.
Otherwise, we would address beyond the end of our buffers.  Fixes reliable
GPU segfault with texture_tiling=true and oglconform shadow.c.

Bug #22406.
2009-08-07 18:33:08 -07:00
Eric Anholt
12c6973c6e i965: Add a note justifying domain choice for the SF VP. 2009-08-07 18:33:08 -07:00
Eric Anholt
b82abaabee intel: Add some more safety asserts in the blit code. 2009-08-07 18:33:08 -07:00
Eric Anholt
9f981ec27d i965: Replace the subroutine-skipping jump in VS with a NOP if it's a NOP.
This showed a 1.9% (+/-.3%, n=3) improvement in OA performance with high
geometry settings.
2009-08-07 18:33:08 -07:00
Jakob Bornecrantz
7de5e60c18 i915g: Don't forget x/y coords in transfers
Fixes demos/ray.
2009-08-08 03:20:24 +02:00
Jakob Bornecrantz
738e02c3c8 i915g: Don't try to free a mapped buffer at shutdown 2009-08-08 03:19:01 +02:00
Alex Deucher
f7474a577d radeon: correct fix for tiling with the legacy build 2009-08-07 17:36:07 -04:00
Eric Anholt
a2a3d8d7f0 intel: Fix googleearth by avoiding GL_VIEWPORT_BIT in meta clear push/pop
I have no idea why this fixes things, but being more efficient sounds good
anyway.  Fixes regression in 99d07d0f91
where most of the lit half of the world was not drawn.
2009-08-07 14:04:11 -07:00
Alex Deucher
caf4f0ede7 radeon: fix the build with older drm headers 2009-08-07 16:20:26 -04:00
Pauli Nieminen
0d7fafa0ed dri: Fix problems with unitialized values in dri screen object.
This fixes crash in r200 KMS driver when pSAREA was set to 1 randomly because of memory wasn't cleared.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-07 13:48:26 -06:00
Brian Paul
9de26ccbcc util: fix incorrect assertion
Check that the dest surface/format is renderable.
2009-08-07 13:48:26 -06:00
Brian Paul
f36d012191 util: include u_surface.h, added comment 2009-08-07 13:48:26 -06:00
Brian Paul
513a82cb1b util: use util_same_surface() to compare surface pointers 2009-08-07 13:48:26 -06:00
Brian Paul
abb120fe5b util: added util_same_surface() helper function 2009-08-07 13:48:26 -06:00
Robert Ellison
2caec748ad tests: have getprocaddress return a return code
These minor changes allow getprocaddress to return an error code
in the case of test failure.  This allows the program to be integrated
into the piglit test suite.
2009-08-07 12:23:19 -06:00
Robert Ellison
99d5139078 mesa: improve getprocaddress test
- Allow the getprocaddress test to test extensions not supported by
  Mesa.  The original getprocaddress.py script only included OpenGL
  extension functions that were in Mesa dispatch tables.  Now all
  known extension functions (as detailed in gl_API.xml) are included.
  As the test does not link against any extension function symbols
  (i.e. it uses glXGetProcAddress() for all extension functions),
  it still compiles and links against Mesa; but now the same
  binary can be used to test extensions not yet supported by Mesa.

- Extend the list of tested extension functions.  The last revision
  of this test exercised 16 extension functions; this revision adds
  support for 95 more.
2009-08-07 12:06:17 -06:00
Pauli Nieminen
d80b36f64f dri: Fix problems with unitialized values in dri screen object.
This fixes crash in r200 KMS driver when pSAREA was set to 1 randomly because of memory wasn't cleared.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-07 11:24:47 -06:00
Brian Paul
1359d69f11 st/mesa: remove redundant calls to _mesa_set_vp_override()
Called from core Mesa now.
2009-08-07 10:49:38 -06:00
Brian Paul
c02b38d169 progs/xdemos: added multictx.c (multi-context rendering demo)
Create one window and render into it with two GLX contexts.  Setup the
rendering state differently for each context to be sure there's no state
"bleeding" between contexts.
2009-08-07 09:52:18 -06:00
Brian Paul
2c9812e3d3 mesa: use _mesa_set_vp_override() in glDraw/CopyPixels and glBitmap
We don't use the vertex program in these functions and the driver may
install its own.  This fixes the broken glCopyPixels swrast fallback in
i965 and possibly other drivers.  In particular, glCopyPixels sometimes
didn't work because the fixed-function fragment program was replacing all
fragment colors with the current raster color.
2009-08-07 09:51:50 -06:00
Brian Paul
6807d96f8e mesa: reformat code to allow setting breakpoints on the true-statement 2009-08-07 09:50:38 -06:00
Brian Paul
84e67330e1 glxgears: make functions static, update comments 2009-08-07 09:50:38 -06:00
Brian Paul
7bf6efe780 mesa: use _mesa_bufferobj_mapped() 2009-08-07 09:50:38 -06:00
Brian Paul
67153a4518 mesa: new _mesa_bufferobj_mapped() helper function 2009-08-07 09:50:38 -06:00
Brian Paul
f738b913e6 mesa: use valid_fragment_program() helper 2009-08-07 09:50:38 -06:00
Brian Paul
94504be63a mesa: test DrawBuffer, not ReadBuffer in _mesa_dest_buffer_exists()
Also, update comments.
2009-08-07 09:50:38 -06:00
Brian Paul
2dec62405f mesa: fix some incorrect error checks in _mesa_error_check_format_type()
Plus, simplify the code a bit.
2009-08-07 09:50:38 -06:00
Brian Paul
3335b847bf mesa: do error checking on glCopyPixels() type parameter
Plus, move some other error checks before state validation and update
some comments.
2009-08-07 09:50:38 -06:00
Brian Paul
28cfd37bb3 mesa: use a more logical flag in _mesa_set_vp_override() 2009-08-07 09:50:38 -06:00
Brian Paul
b28854088b mesa: new _mesa_copy_client_array() function 2009-08-07 09:50:38 -06:00
Brian Paul
692c50b388 i965: minor context comments 2009-08-07 09:50:38 -06:00
Brian Paul
922ef4a119 intel: minor context comments 2009-08-07 09:50:38 -06:00
Brian Paul
6e0be1cc34 intel: move blit call out of assert() 2009-08-07 09:50:38 -06:00
Brian Paul
4d24feddff intel: fix typo: s/softare/software/ 2009-08-07 09:50:37 -06:00
Brian Paul
3105fd760b mesa: fix comment 2009-08-07 09:50:37 -06:00
Dave Airlie
239c8bfb10 radeon: enable tiling fallbacks in 3D driver.
Only really got good testing on r500 so far, need to enable in
DDX and play some more.
2009-08-07 19:40:59 +10:00
Dave Airlie
2dc3fb7803 radeon span: add r200 depth/stencil span read/writing
this should only really affect DRI2 since we mostly have a surface in DRI1.

I don't think this is perfect yet, but it is a better start than nothing.
2009-08-07 16:16:08 +10:00
Dave Airlie
eaf87e84c3 r200: fix scissor emission for r200 under kms 2009-08-07 14:13:19 +10:00
Brian Paul
9676ed27fe util: fix incorrect assertion
Check that the dest surface/format is renderable.
2009-08-06 14:58:06 -06:00
Brian Paul
98f00e8eb9 util: include u_surface.h, added comment 2009-08-06 14:54:25 -06:00
Ian Romanick
3cb6f3bf21 GL_ARB_vertex_array_bgra is (basically) a synonym for the EXT version 2009-08-06 15:26:35 -05:00
Brian Paul
24fdf8aadb util: use util_same_surface() to compare surface pointers 2009-08-06 09:47:13 -06:00
Brian Paul
ffb1f9bded util: added util_same_surface() helper function 2009-08-06 09:47:13 -06:00
Alan Hourihane
8c223e8eb6 Ensure GL_EXT_blend_equation_separate is enabled when 2.0 is enabled. 2009-08-06 16:16:55 +01:00
Alan Hourihane
45b12edcbe Ensure GL_EXT_blend_equation_separate is enabled when 2.0 is enabled. 2009-08-06 15:56:05 +01:00
Chia-I Wu
e179ab2815 progs/egl: Add xeglbindtex, really.
Missed this file in the earlier commit.
2009-08-06 08:40:03 -06:00
Jakob Bornecrantz
8fdda95162 mesa: Ignores
Got tired of seeing these files in git status all the time
2009-08-06 13:59:48 +01:00
Jakob Bornecrantz
8662f2c542 i915g: Compile with scons 2009-08-06 13:50:46 +01:00
Jakob Bornecrantz
c818efd0b3 identity: Use the correct texture 2009-08-06 13:20:49 +01:00
Eric Anholt
f44916414e i965: Fix source depth reg setting for FSes reading and writing to depth.
For some IZ setups, we'd forget to account for the source depth register
being present, so we'd both read the wrong reg, and write output depth to
the wrong reg.

Bug #22603.
2009-08-05 20:20:02 -07:00
Jakob Bornecrantz
b6c6551686 st/xorg: If we have DRI2 we should also have some sort of hw support 2009-08-06 00:52:13 +01:00
Jakob Bornecrantz
b6c9401f13 i915g: Always run in sync with the HW 2009-08-06 00:52:13 +01:00
Jakob Bornecrantz
901b87547e i915g: The i915 seems more happier with sampler domain so lets use that 2009-08-06 00:52:13 +01:00
Jakob Bornecrantz
7a20f50c60 i915g: Dirty fix for VBO module double flush assert 2009-08-06 00:52:13 +01:00
Jakob Bornecrantz
66b00380a2 i915g: Switch to mapping the batch buffer instead of using subdata 2009-08-06 00:52:13 +01:00
Chia-I Wu
246f58d922 progs/egl: Add xeglbindtex.
This is a simple demo for eglBindTexImage.  It uses a OpenGL context,
instead of the required OpenGL ES one.  But it still suffices the demo
and test purpose.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-05 16:08:48 -06:00
Chia-I Wu
6f97a41964 egl_softpipe: Add support for pbuffer binding.
This adds support for eglBindTexImage and eglReleaseTexImage.  They rely
on the state tracker to do the real work.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-05 16:08:07 -06:00
Chia-I Wu
0153614cb0 egl_softpipe: Flush when switching current context.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-05 16:07:39 -06:00
Chia-I Wu
54a7115fc2 mesa/st: Add support for binding pipe surface to texture.
This commit adds functions to bind a pipe surface to a texture.  This
allows texturing directly from the surface.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-05 16:07:19 -06:00
Chia-I Wu
42b6b067ac mesa/main: Add functions to clear and dirty texture objects.
This commit adds a function to clear a texture object such that there is
no image data associated with it, and a function to dirty it so that it
will be re-tested for completeness.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-05 16:06:50 -06:00
Brian Paul
1f71305993 Merge branch 'mesa_7_5_branch'
Conflicts:

	src/mesa/main/state.c
2009-08-05 14:13:48 -06:00
Brian Paul
5b3428d745 docs:fix glBlitFramebuffer() for Gallium 2009-08-05 13:50:21 -06:00
Brian Paul
a59579c983 st/mesa: implement BlitFramebuffer() for depth/stencil (incomplete)
We now handle the case of blitting Z+stencil to/from combined Z/stencil
surfaces.  But Z-only or stencil-only and separate depth/stencil surfaces
are not yet implemented.
2009-08-05 13:46:47 -06:00
Brian Paul
dcebe220f4 mesa: generate GL_INVALID_OPERATION for missing z/stencil when blitting
If glBlitFramebuffer() is called with GL_DEPTH_BUFFER_BIT or
GL_STENCIL_BUFFER_BIT and the src/dst depth/stencil buffers are absent,
report an error.
2009-08-05 13:44:59 -06:00
Brian Paul
f792137593 st/mesa: fix Y inversion and optimize st_BlitFramebuffer()
Need to check for Y inversion separately for src/dest buffers.

If both the src and dest regions are upside down, make them right-side
up for a better chance at a fast path.

progs/tests/copypixrate -blit is much faster now.
2009-08-05 13:26:19 -06:00
Brian Paul
2cd33afa00 util: added comment/question about blit clipping 2009-08-05 13:22:26 -06:00
Brian Paul
727b2d747e mesa: make _mesa_clip_blit() a shared function 2009-08-05 13:21:59 -06:00
Brian Paul
4f36164024 util: added util_blit_pixels() overlap test
A comment alluded to this.  Now it's checked.
2009-08-05 13:19:03 -06:00
Brian Paul
05d393f59f util: fix util_blit_pixels() test for surface_copy() path
For the surface_copy() path require same format, no flipping and no stretching.

Fixes progs/tests/copypixrate -blit
2009-08-05 13:09:15 -06:00
Brian Paul
854ea483d4 util: reformatting and comments 2009-08-05 13:08:19 -06:00
Jakob Bornecrantz
3905119b47 st/xorg: Make it work again 2009-08-05 19:29:31 +01:00
Jakob Bornecrantz
8ccec83e63 st/egl: Create primary texture not display target 2009-08-05 19:29:30 +01:00
Jakob Bornecrantz
0500404cdf i915g: Treat primary textures as scanout buffers 2009-08-05 19:29:30 +01:00
Jakob Bornecrantz
ec269c198a i915g: Link with trace on EGL and Xorg 2009-08-05 19:29:30 +01:00
Jakob Bornecrantz
1f9ee623d1 trace: Use correct texture in drm_api wrapper 2009-08-05 19:29:29 +01:00
Jakob Bornecrantz
6160c8be57 softpipe: Also defere primary textures to backend 2009-08-05 19:29:29 +01:00
Dave Airlie
ac3de85eb6 r200: emit colorpitch 2009-08-05 11:26:29 +10:00
Eric Anholt
63d7a2f53f i965: Fix dangerous warning I let slip in. 2009-08-04 18:07:01 -07:00
Eric Anholt
78c022acd0 i965: Respect CondSwizzle in OPCODE_IF.
Fixes piglit glsl-vs-if-bool and progs/glsl/twoside, and will likely be
useful for the looping code.

Bug #18992
2009-08-04 18:06:34 -07:00
Eric Anholt
7007f8b352 i965: Emit conditional code updates as required for GLSL VS if statements.
Previously, we'd be branching based on whatever condition code happened to be
laying around.
2009-08-04 18:06:34 -07:00
Eric Anholt
011244853b i965: Don't set pop_count in the reserved MBZ area of IF statements. 2009-08-04 18:06:34 -07:00
Eric Anholt
8288ab4518 i965: Print out ELSE and ENDIF src1 arguments like IF does. 2009-08-04 18:06:34 -07:00
Roland Scheidegger
8b9a5cfce0 r200: fix off-by-one errors causing 6th texture unit to not work
both for normal and cube textures, this fixes demos/multiarb
(with 6 enabled texture units) and fixes #23142.
2009-08-05 02:33:34 +02:00
Roland Scheidegger
7c0fb3a1be r200: fix compiler warning (unused var) 2009-08-05 02:33:34 +02:00
Roland Scheidegger
15f5f839b1 radeon: fix miptree comparison breakage
another case of image never matching miptree in case of compressed textures
2009-08-05 01:13:22 +02:00
Roland Scheidegger
80cab49481 intel: implement intelCompressedTexSubImage2D
similar to the radeon code.
passes tests/texcompsub
2009-08-05 01:13:22 +02:00
Roland Scheidegger
0abc9e7565 tests: also test xoffset in texcompsub test
use glCompressedTexSubImage2DARB also with xoffset by splitting into 3 calls
in total. Dunno if the top/bottom reversal is intentional but leave as is.
2009-08-05 01:13:21 +02:00
Eric Anholt
de80eeea0e intel: Add support for EXT_provoking_vertex. 2009-08-04 15:32:18 -07:00
Eric Anholt
b010814e9c i965: Spell "conditional" correctly. 2009-08-04 15:32:18 -07:00
Eric Anholt
1d4bace9fc i965: Hook up the disassembler for INTEL_DEBUG={wm,vs}.
I was getting tired of doing the dance of INTEL_DEBUG=batch, copying it out,
and running intel-gen4disasm on it.
2009-08-04 15:32:18 -07:00
Eric Anholt
ce63e9929c i965: Initial import of disasm code from intel-gen4asm.
There's a bunch of stuff from gen4asm and gpu-tools that we probably want
to make into a library instead of cargo-culting it around.
2009-08-04 15:32:18 -07:00
Eric Anholt
def85826a0 i965: warning fix 2009-08-04 15:32:17 -07:00
Brian Paul
cd7a8225e8 tests/getteximage: test more texture sizes, including npot 2009-08-04 16:17:09 -06:00
Brian Paul
a746ef28df mesa: log the shader checksum 2009-08-04 15:36:29 -06:00
Brian Paul
f7783badb5 mesa: compute, print shader checksum 2009-08-04 15:36:29 -06:00
Brian Paul
b501263bf5 mesa: added gl_shader::SourceChecksum field (for debug purposes) 2009-08-04 15:36:28 -06:00
Brian Paul
9f8110adcc mesa: added _mesa_str_checksum() 2009-08-04 15:36:28 -06:00
Brian Paul
84c8315ae6 mesa: clean-up error debug/count code 2009-08-04 15:36:28 -06:00
Brian Paul
def77160d6 mesa: reset ErrorDebugCount to zero in glGetString() 2009-08-04 15:36:28 -06:00
Brian Paul
b98f0f2d51 mesa: better texture dump/debug code 2009-08-04 15:36:28 -06:00
Brian Paul
2b82bc93e2 mesa: more error message info for vertex pointer functions 2009-08-04 15:36:28 -06:00
Brian Paul
2465c4fa9c mesa: more glGetTexImage() error checking consolidation, new assertion 2009-08-04 15:36:28 -06:00
Eric Anholt
191e028de2 i965: Fix RECT shadow sampling by not losing the other texcoords.
Bug #20821
2009-08-04 12:43:18 -07:00
Brian Paul
3a221a9018 docs: 7.5.1 bug fixes 2009-08-04 09:27:49 -06:00
Brian Paul
61673aebb0 intel: Fix inverted test for disabling flushing of front buffer output.
The comment disagreed with the code, and nicely drew my eyes to what was
going wrong.

Bug #21774 (blender)
Bug #21788 (readpix)

(cherry picked from master, commit fd65418f60)
2009-08-04 09:23:17 -06:00
Brian Paul
f5f8be8bb2 intel: Wait on the last swapbuffers to complete before queuing a new one.
This fixes jerkiness in doom3 and other apps since the kernel change to
throttle less absurdly, which led to a thundering herd of frames.

Because this is a rather minimal fix, there is at least one downside: If
the whole scene completes in one batchbuffer, we'll end up stalling the GPU.

Thanks to Michel Dänzer for suggesting using glFlush to signal frame end
instead of going to all the effort of adding a new DRI2 extension.

(cherry picked from master, commit 0828579a65)
2009-08-04 09:22:15 -06:00
Brian Paul
2bec909c69 texenv: Use VP->Current, since _Current isn't updated at this point.
(cherry picked from master, commit a9ba1bfeb3)
2009-08-04 09:15:33 -06:00
Brian Paul
f0df08abbe texenv: Match state.c in deciding whether we'll be using a vertex shader.
(cherry picked from master, commit 40990d9dfb)
2009-08-04 09:15:09 -06:00
Brian Paul
9d3929b60c texenv: Add missing dependency on VP changes.
Funny thing is I annotated this dependency in
e5f63c403b, but didn't actually use it.

(cherry picked from master, commit 03187571b6)

Conflicts:
	src/mesa/main/state.c
2009-08-04 09:14:33 -06:00
Dan Nicholson
9185a61c8a mklib: Ensure target directory exists for library
Instead of relying on the Makefile to always generate $(TOP)/$(LIB_DIR),
just have mklib handle creating the directory. This should fix any races
when using parallel make.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
(cherry picked from commit 23671e5358)
2009-08-04 06:30:46 -07:00
Peter Hutterer
0ce73f84e9 Add missing X11_INCLUDES to egl/drivers/demo and egl/main.
Compiling mesa on a system with no X headers installed in the default
include paths fails due to missing X11 includes. The header includes are
picked up by configure but not applied.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 5358e54d1a)
2009-08-04 06:30:30 -07:00
Dan Nicholson
23671e5358 mklib: Ensure target directory exists for library
Instead of relying on the Makefile to always generate $(TOP)/$(LIB_DIR),
just have mklib handle creating the directory. This should fix any races
when using parallel make.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
2009-08-04 06:25:26 -07:00
Michel Dänzer
048f988aeb r300g: Slightly saner initialization of some texture / transfer fields. 2009-08-04 10:57:47 +02:00
Eric Anholt
d7430d942f i965: Assert that the offset in the VBO is below the VBO size.
This avoids sending a bad buffer address to the GPU due to programmer error,
and is permitted by the ARB_vbo spec.  Note that we still have the opportunity
to dereference past the end of the GPU, because we aren't clipping to a
correct _MaxElement, but that appears to be harder than it should be.  This
gets us the 90% solution.

Bug #19911.
2009-08-03 17:56:49 -07:00
Eric Anholt
e340d4f986 i965: Even if no VS inputs are set, still load some amount of URB as required.
See comment on Vertex URB Entry Read Length for VS_STATE.

This, combined with the previous three commits, fixes #22945.
2009-08-03 17:19:03 -07:00
Eric Anholt
e93848e595 i965: Make sure the VS URB size is big enough to fit a VF VUE.
This fix is just from code and docs inspection, but it may fix hangs on
some applications.
2009-08-03 17:19:03 -07:00
Eric Anholt
d1fbfd0f96 i965: Don't emit bad packets when no VBs are referenced.
It appears that sometimes Mesa (and I suppose a VS could as well) emits
a program which references no vertex data, and thus we end up with
nr_enabled == 0 even though some VBs are enabled.  We'd end up emitting
VB/VE packet headers of 0xffffffff in that case, leading to GPU hangs.

Bug #22945 (wine with an uncompiled VS)
2009-08-03 17:19:03 -07:00
Eric Anholt
9b9cb30d12 i965: Calculate enabled[] and nr_enabled once and re-use the values.
The code duplication bothered me.
2009-08-03 17:19:03 -07:00
Robert Ellison
1f1ead9947 typo fix
somehow, this change was missed on the last checkin
2009-08-03 17:09:14 -06:00
Robert Ellison
0d18e9259e mesa: fix up some GLAPI XML
- Added specifications for the extensions GL_APPLE_flush_buffer_range and
  GL_APPLE_texture_range

- EXT_framebuffer_object.xml strangely held specifications for both
  the GL_EXT_framebuffer_object extension and the GL_EXT_texture_array
  extension.  Split out the GL_EXT_texture_array data into its own
  file.
2009-08-03 17:04:50 -06:00
Roland Scheidegger
50c736589e radeon: more fixes for compressed textures
- fix not respecting required hardware stride with compressedTexImage -
  this fixes #22615.
- make sure correct stride is used in various places
- fix stored miptree never matching with a TexImage call with compressed
  texture
- don't always store data with compressedtexsubimage at offset 0,
  and actually use the supplied pixel data... (untested)
- make sure rows for compressed texture handling are rounded up not down

Note that trying to access stored compressed textures in hardware miptrees
from core mesa (get_compressed_teximage, swrast fallbacks) can't work correctly,
since RowStride isn't really set to anything useful, plus some places (at least
get_compressed_teximage) assume this data has native stride and no padding.
2009-08-04 00:21:07 +02:00
Eric Anholt
4221e81b24 radeon: Fix inverted test for disabling flushing of front buffer output.
(corresponding fix to the intel driver one)
2009-08-03 14:40:46 -07:00
Eric Anholt
fd65418f60 intel: Fix inverted test for disabling flushing of front buffer output.
The comment disagreed with the code, and nicely drew my eyes to what was
going wrong.

Bug #21774 (blender)
Bug #21788 (readpix)
2009-08-03 14:33:40 -07:00
Eric Anholt
0828579a65 intel: Wait on the last swapbuffers to complete before queuing a new one.
This fixes jerkiness in doom3 and other apps since the kernel change to
throttle less absurdly, which led to a thundering herd of frames.

Because this is a rather minimal fix, there is at least one downside: If
the whole scene completes in one batchbuffer, we'll end up stalling the GPU.

Thanks to Michel Dänzer for suggesting using glFlush to signal frame end
instead of going to all the effort of adding a new DRI2 extension.
2009-08-03 13:34:07 -07:00
Alex Deucher
e0d61fd696 r600: add some new r7xx pci ids 2009-08-03 16:10:32 -04:00
Eric Anholt
a9ba1bfeb3 texenv: Use VP->Current, since _Current isn't updated at this point. 2009-08-03 12:54:41 -07:00
Eric Anholt
40990d9dfb texenv: Match state.c in deciding whether we'll be using a vertex shader. 2009-08-03 12:54:33 -07:00
Eric Anholt
03187571b6 texenv: Add missing dependency on VP changes.
Funny thing is I annotated this dependency in
e5f63c403b, but didn't actually use it.
2009-08-03 12:54:17 -07:00
Pauli Nieminen
fb7cf731f9 xdemo/glxswapcontrol: Move get_framge_usage after the swap.
This fixes the problem that first frame would report bogus usage values.
Problem was caused because get_frame_usage returned data from previous buffer
swap.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-03 13:42:05 -06:00
Pauli Nieminen
b59eb3b8b1 xdemos/glxcontexts: Don't leak visual info when choosing visual again.
Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-03 11:55:29 -06:00
Chia-I Wu
7420e33848 egl_softpipe: Add support for pbuffer surface.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-03 11:36:08 -06:00
Chia-I Wu
8a130a65aa egl: Correct the default values of surface attributes.
EGL_TEXTURE_FORMAT and EGL_TEXTURE_TARGET should default to
EGL_NO_TEXTURE.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-03 11:35:44 -06:00
Chia-I Wu
8cdc6c66f9 egl: Make eglMakeCurrent more robust.
Now that a current surface points back to its binding context, and a
current context points back to its binding thread, make sure there is no
dangling pointers.  This commit reworks eglMakeCurrent, adds more checks
to avoid stealing context or surfaces from another thread, and correctly
destroys unlinked context and surfaces.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-03 11:35:14 -06:00
Chia-I Wu
07ee01365a egl: Replace IsBound by a pointer to the binding.
IsBound tells if a context or surface is current.  What it does not tell
is, to which thread a context is current, or to which context a surface
is current.  This commit replaces IsBound by a pointer to the binding
thread or context.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-03 11:34:37 -06:00
Brian Paul
27148ccaba gl: upgrade wglext.h to version 15 2009-08-03 11:24:09 -06:00
Brian Paul
39bf48f281 gl: upgrade glxext.h to version 23 2009-08-03 11:24:09 -06:00
Brian Paul
2d725dac40 gl: upgrade glext.h to version 54 2009-08-03 11:24:09 -06:00
Brian Paul
4f61bc135a tgsi: report opcode name in addition to the number when translation fails 2009-08-03 11:24:09 -06:00
Brian Paul
c3c90c2dd9 tgsi: added tgsi_get_opcode_name() 2009-08-03 11:24:09 -06:00
Brian Paul
2e9bf10014 gallium: comments, reformatting 2009-08-03 11:24:09 -06:00
Brian Paul
ed6125fe9b st/mesa: we don't support GL_NV_point_sprite (see comment) 2009-08-03 11:16:23 -06:00
Alex Deucher
f538d02753 r600: add some missing pci ids 2009-08-03 11:21:10 -04:00
Alex Deucher
583ed4aae5 r600: fix the build when RADEON_DEBUG_BO is set 2009-08-03 03:12:56 -04:00
Alex Deucher
282c0c411c r600: fix r600SetTexOffset
We need to properly set up a fake bo for the texture override,
so add a new function to radeon_bo_legacy.c.  This could probably
be used on radeon/r200/r300 to unify the bo handling for
texture override.

compiz now works :)
2009-08-03 02:28:22 -04:00
Corbin Simpson
30bca7a4e6 Merge commit 'nha/r300-compiler-gallium' 2009-08-02 16:56:52 -07:00
Alex Deucher
d07bf2b35c r600: handle state emit better
- move shader-related state with the rest of the shader setup/emit
- start to track dirty state better
2009-08-02 18:26:12 -04:00
vehemens
562ca49611 r600: Logic Operations Fix
fixes bug 23087
2009-08-02 18:03:58 -04:00
Alex Deucher
5e51903606 r600: fix regression in texenv
Emit shader consts with the shader program itself
2009-08-02 13:29:18 -04:00
Nicolai Hähnle
b1700b03af r300: Fix a regression on non-KMS
The regression was introduced by 9a1c336253

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-08-02 16:24:52 +02:00
Alex Deucher
86ac0ae0b0 r600: fix rectangle textures
It might be better to add an instruction to normalize the
coordinates for rectanglular textures as there are some limitations
to wrap modes on unnormalized tex coords.

fixes texrect
2009-08-01 20:55:43 -04:00
Nicolai Hähnle
9a1c336253 r300: Fix corner-case of KIL on R300
R300 hardware (but _not_ R500) hardware requires an enabled texture unit
if KIL is used in fragment programs. We now work around the CS checker
correctly when enabling such a fake texture unit.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-08-01 19:00:55 +02:00
Nicolai Hähnle
3d21e3d3a2 r300: Fix Z buffer re-emit after window resize
We used to not always correctly re-emit the Z buffer size in all cases,
in particular the clear path, and invalidated state was not always picked
up correctly.

This fixes a bug where the kernel CS checker correctly complains about
a Z buffer that is too small.

Note that this bug was probably only visible with ridiculously high
framerates, i.e. glxgears.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-08-01 17:16:50 +02:00
Patrice Mandin
fc3d564dae mesa st: Use POT texture for draw pixels operations if NPOT texture is not supported 2009-08-01 11:15:18 +02:00
Patrice Mandin
c1785c19ca mesa st: Move logbase2 function to util/u_math.h 2009-08-01 11:03:30 +02:00
Roland Scheidegger
801c3fcbca radeon: fix r100/r200 compressed texture stride
This almost fixes compressed mipmapped textures on r200, though some small
mip levels are still broken.
Leave r300 compressed texture stride as is though afaik it's different
to pre-radeon-rewrite too. Also do the fixup for rs600 uncompressed row stride
at same place.
2009-07-31 23:24:44 +02:00
Roland Scheidegger
2730ee75c7 radeon: s/r300/radeon in shared code error message 2009-07-31 23:20:22 +02:00
Brian Paul
f7618f4f37 swrast: fix incorrect texcoord attribute test 2009-07-31 13:57:03 -06:00
Brian Paul
23c0e812bc draw: fix-ups for point coord attribute
progs/glsl/pointcoord.c works again
2009-07-31 13:56:17 -06:00
Pauli Nieminen
55bc8b1390 radeon: Cliprects has to be updated before doing anything with clip rectangles
Reported to fix corruption while dragging an active window by John Bridgman.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-31 21:44:31 +02:00
Pauli Nieminen
1fcb321e2f radeon: Remove unused variable from context.
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-31 21:39:25 +02:00
Alex Deucher
95b64c0ed2 r600: make sure bos are valid before usign that 2009-07-31 15:11:41 -04:00
Alex Deucher
80d80d23b6 r600: fix reloc setup
re-use the same reloc index for bos that are referenced
multiple times.

Fixes rain demo.
2009-07-31 14:52:56 -04:00
Alex Deucher
177c33c481 r600: remove unused offset_mod stuff
this is a step in migrating to the common cs code
2009-07-31 14:52:56 -04:00
Alex Deucher
19ce428c8a r600: ensure we have enough room for full state emit
full state is roughly 4000 dwords, but will vary depending
on the rendering.
Also fix some warnings.
2009-07-31 14:52:56 -04:00
Alex Deucher
54a1641923 r600: unify state emit into one function 2009-07-31 14:52:55 -04:00
Alex Deucher
be1687a892 r600: re-arrange state setup and emit so they are not mixed 2009-07-31 14:52:55 -04:00
Michal Krol
cb90c43676 Rename TGSI LOOP instruction to better match theri usage.
The LOOP/ENDLOOP pair is renamed to BGNFOR/ENDFOR as its behaviour
is similar to a C language for-loop.

The BGNLOOP2/ENDLOOP2 pair is renamed to BGNLOOP/ENDLOOP as now
there is no name collision.
2009-07-31 18:14:40 +02:00
Chia-Wu
dc516d6e2a egl: Silence warnings on x86-64.
Casting an unsigned int to or from a pointer directly gives warnings on
x86-64.  Add wrappers to silence the warnings.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-31 07:30:13 -06:00
Alex Deucher
826f1f9c6f r600: get updated pending age from cs ioctl
REQUIRES AN UPDATED DRM
2009-07-31 02:13:43 -04:00
Alex Deucher
643d52a394 r600: warning fixes 2009-07-30 21:32:36 -04:00
Alex Deucher
e0e51ab1ea r600: split primitive draw into a separate function 2009-07-30 21:32:36 -04:00
Nicolai Hähnle
d0c398a8e2 r300g: Use radeon compiler for fragment programs
This is entirely untested on R500, and needs more testing on R300.
2009-07-30 23:55:12 +02:00
Nicolai Hähnle
fbc88a7334 r300g: Remove extraneous printf
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-30 23:45:18 +02:00
Nicolai Hähnle
188f8c6792 r300g: Use r300compiler for vertex shaders 2009-07-30 23:45:18 +02:00
Nicolai Hähnle
cab62aa28f r300/compiler: Remove inst_offset from r500_fragment_program_code
The field is not used, and in any case it would be more interesting to
manipulate from *outside* the compiler if we ever wanted to load several
fragment programs at the same time or something.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-30 23:42:59 +02:00
Ian Romanick
9f26f801dc progs/vp: Correct the PARAM array sizes in arl-*.txt 2009-07-30 14:08:53 -07:00
Ian Romanick
565a2a8f38 ARB prog parser: Add support for RGBA components to SWZ instruction in fp 2009-07-30 10:51:43 -07:00
Chia-I Wu
27fb3ff858 softpipe: Mark texture dirty when unmapped.
When a texutre transfer is mapped for writing, mark the texture dirty
when unmapped.  This was done in surface creation, and this commit moves
it to happen in texture unmapping.

This fixes subtex test in progs/tests/.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-30 10:42:46 -06:00
Ian Romanick
17534ab88c ARB prog parser: Prevent NULL ptr deref for KIL instruction
The KIL instruction doesn't have a destination register, so
dereferencing dst in asm_instruction_ctor would cause a segfault.
2009-07-30 09:41:35 -07:00
Brian Paul
9c936403de mesa: re-enable _mesa_source_buffer_exists() call
Somehow this code wound up inside a comment a while back.
2009-07-30 10:04:42 -06:00
Brian Paul
4406f79402 mesa: get_current_tex_unit() helper function 2009-07-30 09:59:52 -06:00
Brian Paul
25be043940 mesa: refactor glGetTexImage error checking code 2009-07-30 09:50:36 -06:00
Brian Paul
783a93a2c3 tests: glGetTexImage() test 2009-07-30 09:46:57 -06:00
Brian Paul
c156eeb682 mesa: simplify _mesa_select_tex_image() 2009-07-30 09:24:01 -06:00
Brian Paul
9c9a9abd7b mesa: simplify _mesa_set_tex_image() 2009-07-30 09:10:26 -06:00
Brian Paul
1e355a0cb3 Merge branch 'mesa_7_5_branch' 2009-07-30 09:03:43 -06:00
Brian Paul
35e3449ad7 mesa: move misplaced return statement
Fixes regression from commit 7d93f817c9
2009-07-30 09:02:36 -06:00
Brian Paul
288299ae12 Merge branch 'mesa_7_5_branch' 2009-07-30 08:24:10 -06:00
Brian Paul
7d93f817c9 mesa: add missing return after catching program error 2009-07-30 08:23:26 -06:00
Brian Paul
e87320b5e0 Merge branch 'mesa_7_5_branch' 2009-07-30 08:22:57 -06:00
Brian Paul
aefaeba54a docs: document new i915/945 extensions 2009-07-30 08:22:26 -06:00
Thomas Hellstrom
98ba6cfb4c mesa st: Change the preferred internal format for some RGB formats.
For GL_RGB5, GL_RGB4 and GL_R3_G3_B2, prefer
PIPE_FORMAT_R5G6B5_UNORM over PIPE_FORMAT_A1R5G5B5_UNORM, since hardware
is more likely to support the previous format for rendering.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2009-07-30 12:43:35 +02:00
Thomas Hellstrom
f583745519 mesa st: Report unsupported render-to-texture formats.
If a texture image is bound to a framebuffer for render-to-texture, but
the hardware doesn't support rendering to its internal format,
report the framebuffer as incomplete with FRAMEBUFFER_UNSUPPORTED.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2009-07-30 12:43:35 +02:00
Michal Krol
6c70285e33 tgsi: Add proper constraints to sanity. 2009-07-30 11:39:06 +02:00
Michal Krol
cf8907018e tgsi: Declare a LOOP register.
The only valid usage for LOOP/ENDLOOP instructions
is LOOP[0] as a destination register.
The only valid usage for the remaining instructions
is LOOP[0].x as an indirect register.
2009-07-30 10:34:06 +02:00
Michal Krol
65fb2c52f9 tgsi: Fix number operands for LOOP/ENDLOOP. 2009-07-30 10:33:18 +02:00
Michal Krol
1e9d3ad4e1 vbo: Fix build on windows. 2009-07-30 10:31:57 +02:00
Michal Krol
b724dd28e2 tgsi: Document LOOP/ENDLOOP instruction operation. 2009-07-30 10:14:17 +02:00
Xiang, Haihao
3e2b6a2049 i965: Postpone ff_sync message in CLIP kernel on IGDNG
In addition, it guarantees ff_sync message is issued
2009-07-30 15:40:08 +08:00
Alex Deucher
0fdac3529c r600: fix mipmaps
redbook mipmap works
2009-07-30 03:31:37 -04:00
Eric Anholt
246729162c i915: Add support for EXT_stencil_two_side and ATI_separate_stencil.
Passes tests/stencil_twoside and glean/stencil2.
2009-07-29 21:25:39 -07:00
Ian Romanick
600710907c ARP prog parser: Implement the spec, not what makes sense 2009-07-29 21:07:41 -07:00
Eric Anholt
92b9aa1646 i915: Add ARB_point_sprite since we already expose NV_point_sprite.
It's all fallbacks anyway due to the DD_POINT_ATTEN fallback.
2009-07-29 20:56:14 -07:00
Ian Romanick
48183ca8b6 ARB prog parser: Get program limits from the context
Some debug code from the older stand-alone version of the assembler
was hanging around and needed to go.
2009-07-29 20:51:38 -07:00
Ian Romanick
cbe4133109 ARB prog lexer: attenuation is not just for vp 2009-07-29 20:42:28 -07:00
Ian Romanick
333bb4f291 ARB prog parser: Finish implementing fp state.depth.range 2009-07-29 20:41:48 -07:00
Ian Romanick
e511633985 ARB prog: Fix the order of swizzle application
The swizzle used to generate the "original" value from the value
stored in the parameter array happens before the swizzle specified in
the instruction.  This fixes problems seen in progs/vp/vp-tris with arl-*.txt.
2009-07-29 20:07:59 -07:00
Brian Paul
9d0b8d72d8 mesa: add new FRAG_ATTRIB_FACE and FRAG_ATTRIB_PNTC fragment program inputs
Previously, the FOGC attribute contained the fragment fog coord, front/back-
face flag and the gl_PointCoord.xy values.  Now each of those things are
separate fragment program attributes.  This simplifies quite a few things in
Mesa and gallium.

Need to test i965 driver and fix up point coord handling in the gallium/draw
module...
2009-07-29 20:07:41 -06:00
Brian Paul
b9889517f5 gallium: fix SSE shadow texture instructions
When sampling a 2D shadow map we need 3 texcoord components, not 2.
The third component (distance from light source) is compared against
the texture sample to return the result (visible vs. occluded).

Also, enable proper handling of TGSI_TEXTURE_SHADOW targets in Mesa->TGSI
translation.  There's a possibility for breakage in gallium drivers if
they fail to handle the TGSI_TEXTURE_SHADOW1D / TGSI_TEXTURE_SHADOW2D /
TGSI_TEXTURE_SHADOWRECT texture targets for TGSI_OPCODE_TEX/TXP instructions,
but that should be easy to fix.

With these changes, progs/demos/shadowtex.c renders properly again with
softpipe.
2009-07-29 16:33:58 -06:00
Alex Deucher
9c4c9f2837 r600: remove extraneous semicolon 2009-07-29 18:12:33 -04:00
Alex Deucher
b116f57bac r600: fix texture pitch alignment
fixes texwrap
2009-07-29 18:06:20 -04:00
Alex Deucher
1e207ba9c1 r600: minor fixes
- set MAX_LOD properly
- min texel pitch is 8 texels
- emit old command buffer when re-initing base state
2009-07-29 17:25:56 -04:00
Nicolai Hähnle
0723cd1b0a r300: Cleanup r300_fragment_program_code
Configuration register values are now stored directly in that structure.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-29 21:15:00 +02:00
Nicolai Hähnle
d3a1fc62f4 r300/compiler: Adapt AllocateHwInputs interface to common usage pattern
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-29 21:15:00 +02:00
Eric Anholt
88ebf514a4 swrast: enable ARB_vertex_array_object.
It was getting enabled anyway but without the entrypoints installed.  Whoops.
2009-07-29 11:17:53 -07:00
Ian Romanick
8a430dd4da Indentation fixes. 2009-07-29 09:50:06 -07:00
Ian Romanick
4c5879ff31 ARB prog parser: Set NumAttributes based on the number of attribs read 2009-07-29 09:47:14 -07:00
Keith Whitwell
6842829539 mesa/st: short-circuit glFinish calls on WIN32 only
Windows opengl32.dll calls glFinish prior to every swapbuffers, which
makes it pretty hard to get decent performance...

Work around by mapping finish to flush on PIPE_OS_WINDOWS.  This is
conformant, though it might confuse poorly-written benchmarks which
attempt to measure a single event rather than figuring out the rate of
continuous processing.
2009-07-29 12:48:05 +01:00
Keith Whitwell
2420b283b7 mesa/st: recognize no-op scissor state when checking clear_with_quads
Some apps enable scissor but set the rectangle to the dimensions of
the window.  Don't let this force us onto a slower clear path.
2009-07-29 12:48:04 +01:00
Keith Whitwell
4d99e14535 util: _debug_printf should print even when DEBUG is not defined
The leading underscore is meaningful...  This function is used by
_warning and _error functions as well as the more common
debug_printf().

debug_printf (without underscore) gets turned off when DEBUG is
disabled, but warning/error messages still use this function to get
their message out.
(cherry picked from commit 0ac879dca7)
2009-07-29 12:48:04 +01:00
Cooper Yuan
03607708b0 r600: emit fog color in PS input map, fix fog related applications 2009-07-29 15:31:41 +08:00
Cooper Yuan
0f6d3aece7 R6xx/r7xx: VS export fog color as parameter 2009-07-29 15:23:56 +08:00
Ian Romanick
648dac4251 ARB prog parser: Set component negation mask for SWZ instruction 2009-07-28 21:57:28 -07:00
Ian Romanick
86b33b5649 ARB prog parser: Set correct register file for OUTPUT variables 2009-07-28 21:56:42 -07:00
Ben Skeggs
693f900b16 nv50: support non-blocking query_result() 2009-07-29 11:19:52 +10:00
Ben Skeggs
625bc0cfa2 nouveau: map_range returning -EBUSY isn't necessarily an error 2009-07-29 10:58:05 +10:00
Christoph Bumiller
84166a021f nv50: correct zeta formats
What was Z24S8 before is actually S8Z24, and what we had for Z16
is actually X8Z24. Now, we also have the REAL Z24S8 and I added
Z32_FLOAT as well; most of the formats need different tile_flags.
2009-07-29 09:40:35 +10:00
Christoph Bumiller
987c59c486 nv50: use new 2D surface format names 2009-07-29 09:40:35 +10:00
Christoph Bumiller
1f17b8ff59 nv50: support more vtxelt formats
NOTE: we must not try to emit buffer relocations when
vtxbuf_nr is 0 but vtxelt_nr is not
2009-07-29 09:40:35 +10:00
Christoph Bumiller
72813ba5b6 nv50: should use uint32_t ptr in draw_elements_inline_u32 2009-07-29 09:40:34 +10:00
Christoph Bumiller
df189c9efc nv50: TIC/TSC fixes and additions
Red and blue were interchanged in TIC.
Add border color and some formats.
2009-07-29 09:40:34 +10:00
Christoph Bumiller
f498ccd654 nv50: fix sx/dx typo in transfer_rect_m2mf 2009-07-29 09:40:34 +10:00
Christoph Bumiller
d1b9183e64 nv50: fix viewport transform
The translation also needs to be inverted, and in bypass mode
the state tracker incorrectly assumes that Y = 0 = TOP, so we
need inversion there to; NDC clipping has to be deactivated
explicitly.
2009-07-29 09:40:34 +10:00
Christoph Bumiller
b0341f994f nv50: use correct scissor reg 2009-07-29 09:40:33 +10:00
Alex Deucher
8c56029b1e r600: fix tex clamp modes
This makes texwrap look better.
2009-07-28 18:09:38 -04:00
Alex Deucher
e629c50e2b r600: implement texture border color 2009-07-28 17:59:54 -04:00
Alex Deucher
719abd7fc0 r600: fix flat shading
Set the flat shading bit on the appropriate PS input
depending on the type of attribute it is.  The VS output
and PS input routing should probably be made more dynamic
at some point.  We may want to use semantic ids to make
it easier.
2009-07-28 16:58:41 -04:00
Alex Deucher
dbdb3952c1 r600: don't call r700UpdateShaders twice for each render 2009-07-28 15:58:01 -04:00
Alex Deucher
b1f7c844a3 r600: move r700TranslateFragmentShader into r700UpdateShaders 2009-07-28 15:53:45 -04:00
RALOVICH, Kristóf
45f4e8842e glx: assign per screen driver configs (DRISW) 2009-07-28 10:35:56 -06:00
RALOVICH, Kristóf
d090ba9e00 glx: assign per screen driver configs (DRI) 2009-07-28 10:35:56 -06:00
RALOVICH, Kristóf
82f4dc21cc glx: assign per screen driver configs (DRI2) 2009-07-28 10:35:56 -06:00
RALOVICH, Kristóf
e32b601e7d glx: properly release DRI configs
Release per screen DRI driver configs during screen destruction.
2009-07-28 10:35:56 -06:00
RALOVICH, Kristóf
ce0ad53281 glx: cache DRI configs in __GLXscreenConfigsRec 2009-07-28 10:35:56 -06:00
Alex Deucher
4d648523aa r600: disable flat shade fix in 506bacb8e4
This breaks textures.  We need to only set this bit for
attributes that that need flat shading.
2009-07-28 11:12:36 -04:00
Brian Paul
d2f6d6ce49 Merge branch 'mesa_7_5_branch'
Conflicts:

	Makefile
	configs/default
	docs/relnotes.html
	src/mesa/main/version.h
2009-07-28 08:58:25 -06:00
Brian Paul
94726bc69e gallium: minor code/comments clean-up 2009-07-28 08:55:43 -06:00
Chia-I Wu
a744a496d5 egl: Comment out unused tables in_eglFillInConfigs
This silences a compiler warning.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-28 08:55:43 -06:00
Vinson Lee
bc60b88411 progs/trivial: add missing files to Makefile, .gitignore 2009-07-28 08:54:48 -06:00
Cooper Yuan
506bacb8e4 R6xx/r7xx: enable flat shading, this can fix quadric/accanti/accpersp 2009-07-28 13:57:07 +08:00
Ian Romanick
aafd576259 ARB prog parser: Add support for GL_MESA_texture_array
This isn't really tested yet as no drivers actually support this extension.
2009-07-27 17:22:21 -07:00
Ian Romanick
41d5696628 ARB prog parser: More robust error message for bad OPTION string 2009-07-27 17:10:01 -07:00
Ian Romanick
1edd13bf23 ARB prog parser: Add support for GL_ARB_fragment_program_shadow
Passes the piglit asmparsertest shadow-0[123].txt tests and
progs/demos/shadowtex.
2009-07-27 16:24:49 -07:00
Ian Romanick
88018e2e07 ARB prog parser: Fix handling of RECT
Require that GL_{ARB,EXT,NV}_texture_rectangle be supported before
allowing use of RECT texture target.
2009-07-27 15:47:52 -07:00
Ian Romanick
4821099429 ARB prog: Fix parameters to _mesa_calloc
So totally awesome that _mesa_calloc has a different parameter
signature than calloc.  Why do these libc wrappers still exist?!?
2009-07-27 15:46:07 -07:00
Alex Deucher
fcf317ac16 r600: fix _REV texture format component swizzles 2009-07-27 18:14:45 -04:00
Brian Paul
6c03563af7 mesa: regenerated file 2009-07-27 15:42:29 -06:00
RALOVICH, Kristóf
8363dff251 glx: remove XTHREADS support 2009-07-27 15:38:04 -06:00
RALOVICH, Kristóf
27e55588e0 docs: do not mentions xthreads any more 2009-07-27 15:38:04 -06:00
RALOVICH, Kristóf
bdb8ee5186 glapi: regenerated GL API assembly files 2009-07-27 15:38:04 -06:00
RALOVICH, Kristóf
8f397bffa8 glapi: remove XTHREADS support 2009-07-27 15:38:04 -06:00
Brian Paul
3dbaf68bdc intel: Fix leak of DRI option info due to using the wrong free routine.
(cherry picked from commit 6d66f23c50)
2009-07-27 15:33:07 -06:00
Brian Paul
722d136f7b intel: Clean up leak of driver context structure on context destroy.
(cherry picked from commit ddef7dc87b)
2009-07-27 15:33:07 -06:00
Ian Romanick
054ab5a50a ARB prog parser: Correct handling of some extensions that interact w/ARB_vp 2009-07-27 14:18:40 -07:00
Brian Paul
a7427b0f7b st/mesa: silence warning 2009-07-27 15:10:28 -06:00
Brian Paul
0ad9eba333 mesa: separate some finite/pragma Watcom stuff 2009-07-27 15:10:00 -06:00
Brian Paul
7e2f26cbbf softpipe: include sp_winsys.h to silence function prototype warning 2009-07-27 15:08:44 -06:00
Nicolai Hähnle
3ccf89d584 r300/compiler: Make calculate_inputs_outputs available to external users
In the long run, it's probably better to just get rid of InputsRead and
OutputsWritten.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 22:51:40 +02:00
Nicolai Hähnle
59fff53492 r300/compiler: Add vertex program code dumper from Gallium driver 2009-07-27 22:51:39 +02:00
Nicolai Hähnle
6bc0e1054a r300/compiler: Prepare for hookup to Gallium 2009-07-27 22:51:39 +02:00
Nicolai Hähnle
e82a50a6a1 r300/fragprog: Move wpos_attr and fog_attr where they belong
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 22:51:39 +02:00
Nicolai Hähnle
790334883a r300/fragprog: Remove hardcoded FRAG_ATTRIB_xxx constants
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 22:51:38 +02:00
Nicolai Hähnle
e034683eda r300/fragprog: No longer rely on hardcoded FRAG_RESULT_xxx constants
Also, this makes radeon_program_pair depend on the r300 fragment program
compiler. Since we now know that r600+ no longer use the same pairing
style in their ALU, we can stop pretending that program_pair is useful
for anything but r300-r500 fragment programs.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 22:51:38 +02:00
Nicolai Hähnle
836050ba5e r300/fragprog: Move some of the attribute handling out of the compiler
Attribute indices will probably be different in Gallium, so make the compiler
independent of magic values.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 22:51:38 +02:00
Nicolai Hähnle
1348a7ebc0 r300/fragprog: Finally get rid of the duplicate program copy
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 22:51:38 +02:00
Nicolai Hähnle
3f78381687 r300/vertprog: Move Mesa-dependent input/output handling out of compiler
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 22:51:37 +02:00
Nicolai Hähnle
d6a304800b r300: Remove ugly PSIZ hack
Instead of setting Sourced, we simply force writemasks to begin with.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 22:51:37 +02:00
Nicolai Hähnle
05a51f4b3d r300/vertprog: Refactor wpos rewrite using rc_program
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 22:51:37 +02:00
Nicolai Hähnle
ce0c32e3d2 r300/vertprog: Refactor fog_as_texcoord to use rc_program
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 22:51:36 +02:00
Nicolai Hähnle
a1e8992ffa r300/vertprog: Refactor addArtificialOutputs to use rc_program
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 22:51:36 +02:00
Nicolai Hähnle
273af68570 r300/fragprog: Refactor wpos rewrite to use rc_program
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 22:51:36 +02:00
Nicolai Hähnle
9dc1be4158 r300/compiler: Refactor fragment program fog rewrite to use rc_program
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 22:51:36 +02:00
Nicolai Hähnle
aab949cb9d r300/compiler: Refactor rewrite_depth_out to use rc_program
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 22:51:35 +02:00
Nicolai Hähnle
6f4608f53c r300/compiler: Refactor local transforms to use rc_program
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 22:51:14 +02:00
Brian Paul
d2f56fe687 intel: Use _mesa_warning() to report GEM warnings 2009-07-27 14:35:18 -06:00
Ian Romanick
be32fb779b ARB prog: Update generated files missed on previous two commits
The changes are, as it turns out, purely cosmetic.
2009-07-27 12:48:44 -07:00
Ian Romanick
6d3ccaf366 ARB prog: Delete comment about possibly needing to free a buffer
Valgrind doesn't complain about a leak here, so delete the comment
about possibly needing to free the state returned by yy_scan_bytes.
2009-07-27 12:38:52 -07:00
Karl Schultz
09ef339b69 windows: updated VC8 project files
See bug 22882.
2009-07-27 13:38:35 -06:00
Brian Paul
25e371fb7b docs: 7.5 tarball md5sums 2009-07-27 13:27:54 -06:00
Ian Romanick
94b4556704 ARB prog: Clean up several memory leaks
As far as I am able to determine via code inspection and using
Valgrind, that should be all of the leaks in the parser.
2009-07-27 12:21:26 -07:00
Ian Romanick
946ea82bff Add destructor for symbol_table 2009-07-27 12:19:14 -07:00
Ian Romanick
0044d3ba94 Add destructor for hash_table 2009-07-27 12:17:06 -07:00
Nicolai Hähnle
800f482586 r300: Allow compiler to add constants in a cleaner way
Adding constants is used in a number of non-native instruction
rewrites, and it required us to keep copies of modified gl_programs
around. This is a first step towards ending this.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:07 +02:00
Nicolai Hähnle
92f7a599c7 r300/compiler: Refactor nqssadce to use rc_program
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:07 +02:00
Nicolai Hähnle
a898e7d66c r300/compiler: Refactor for rc_program usage
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:07 +02:00
Nicolai Hähnle
2237d136cd r300/compiler: Add rc_print_program
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:07 +02:00
Nicolai Hähnle
8bcb6ef786 r300/compiler: Lay groundwork for better error handling
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:06 +02:00
Nicolai Hähnle
c5cb9a3378 r300: Remove dependency on GLcontext from compiler
Unfortunately, this does cause some code duplication (which we can hopefully
eliminate eventually).

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:06 +02:00
Nicolai Hähnle
d65404225d r300/vertprog: Cleanup source conflict handling
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:06 +02:00
Nicolai Hähnle
86e3334333 r300/vertprog: Massively reduce code duplication
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:06 +02:00
Nicolai Hähnle
127ca61fa3 r300/vertprog: Use generic transforms and throw away unneeded code
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:06 +02:00
Nicolai Hähnle
84445273ed r300: Move vertex program compilation to compiler
This is just the first step of refactoring. The separation is not yet
clean enough with this commit.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:05 +02:00
Nicolai Hähnle
11cd795940 r300: Cleanup vertex_program structure
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:05 +02:00
Nicolai Hähnle
927f5f1682 r300: Remove faux lazy translation of vertex programs
De facto, vertex programs were translated immediately in all situations,
so let's just stop pretending that we do lazy translation.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:05 +02:00
Nicolai Hähnle
a808b10ce8 r300: Reduce include dependencies
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:05 +02:00
Nicolai Hähnle
9198ab8bfc r300: Introduce rc_program and use it in radeon_pair
The goal is to convert both Mesa and TGSI programs into an intermediate format
that happens to be convenient for us.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:05 +02:00
Nicolai Hähnle
9cd5e3e13a r300: Add radeon_compiler as a base for compilation-related tasks
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:04 +02:00
Nicolai Hähnle
647766494f r300: Remove some unnecessary includes
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:04 +02:00
Nicolai Hähnle
77a6ae64b6 r300/compiler: Compile the compiler seperately into an archive
This is all part of untangling the compiler from the classic driver, so that
it may be used in Gallium without depending on Mesa stuff if possible

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:04 +02:00
Nicolai Hähnle
d6275ccf79 r300: Further reduce dependency between compiler and classic driver
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:04 +02:00
Nicolai Hähnle
f70d3ee371 r300: Remove some dependencies on additional fragment program copies
The copy is still needed because some program transforms add state variables
or constants.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:04 +02:00
Nicolai Hähnle
b54e083201 r300: Remove GLcontext from r300_fragment_program_compiler
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:03 +02:00
Nicolai Hähnle
e93d70e3e9 r300: Remove GLcontext requirement from radeonLocalTransform
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:03 +02:00
Nicolai Hähnle
9ceee4d3e4 r300: Remove unused enums
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:03 +02:00
Nicolai Hähnle
b4b286b980 r300: Remove GLcontext requirement from radeon_nqssadce
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:03 +02:00
Nicolai Hähnle
d29cdde569 r300: Remove GLcontext requirement from radeon_program_pair
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:03 +02:00
Nicolai Hähnle
cb8c694adb r300/program_pair: Introduce driver-specific texture instruction structure
This is to prepare more experimentation and possible internal changes in the
compiler.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:02 +02:00
Nicolai Hähnle
78f88d8b87 r300/program_pair: Dynamically allocate instructions temporarily
In preparation of using TGSI, where we cannot easily predict the number
of instructions.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:02 +02:00
Nicolai Hähnle
e5bed439be r300: Detangle fragment program compiler from driver-specific structure
This is in preparation of sharing the fragment program compiler with Gallium:
Compiler code is moved into its own directory and modified so that it no
longer depends on driver structures.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-27 20:32:02 +02:00
Pauli Nieminen
6b142866ab radeon: Add r6xx/r7xx chip family to get_chip_family_name
This fixes problem that glxinfo was reporting r600+ cards as unknown.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-07-27 11:06:18 -04:00
Patrice Mandin
1ee3bcfff0 nouveau: swizzle a single row or column, doing it one pixel at a time 2009-07-27 10:58:11 +02:00
Alex Deucher
7d3190a85b r600: fix textures
We weren't allocating enough gprs for the fragment shader
in some cases.  There are likely other issues that still need
to be sorted out for textures, but at least they now work.
2009-07-27 03:52:37 -04:00
Alex Deucher
7e6819f843 r600: don't draw when num indices is 0
fixes engine demo
2009-07-27 02:26:41 -04:00
Alex Deucher
48b2fea142 r600: set VGT NUM_INSTANCES as part of the draw command
set VGT NUM_INSTANCES as part of the draw command rather
than as state as recommended by the pm4 guide.  Also,
use the NUM_INSTANCES packet.
2009-07-27 02:26:41 -04:00
Alex Deucher
600a53a32e r600: Use R600_SCRATCH_REG_OFFSET rather than RADEON_SCRATCH_REG_OFFSET
noticed by vehemens on IRC.
2009-07-27 02:26:41 -04:00
Alex Deucher
0b3d51ee31 r600: switch vtx resource setup to use SETfield macros
For consistency
2009-07-27 02:26:41 -04:00
Alex Deucher
2c5e55d919 r600: switch tex code to use SETfield macros
for consistency with the rest of the code.
2009-07-27 02:26:41 -04:00
Corbin Simpson
7a10472f09 r300g: Fix two trivial texture size issues.
Next thing to fix: progs/tests/mipgen.
2009-07-26 22:48:20 -07:00
Corbin Simpson
725c1f004c radeon-gallium: If BO allocation fails, return NULL. 2009-07-26 22:35:26 -07:00
Corbin Simpson
2cbd5ecfb6 r300g: Add some debugging, correct little bits of math in texture setup.
Simple stuff still works, but not sure about some of the more complex things.
2009-07-26 21:38:24 -07:00
Patrice Mandin
8df35b7b57 nouveau: only swizzle square textures for copy 2009-07-26 22:30:35 +02:00
José Fonseca
5276b049b4 util: fix typo. 2009-07-26 20:31:59 +01:00
Patrice Mandin
2b8a8f75f3 nouveau: Take into account destination position for copy_swizzle, need to split copy a bit more 2009-07-26 16:18:06 +02:00
Patrice Mandin
77a8a650e6 nouveau: Recursively swizzle an NPOT sized copy 2009-07-26 12:30:12 +02:00
Ian Romanick
258f640eda ARB prog: Layout parameters from parameter type, not src type
Use the type stored in the Parameters array to determine the layout
instead of the type in the instruction register field.  Also, update
the instruction register field based on the parameter type.

This makes Google Earth work exactly like with Mesa master.
2009-07-24 18:14:47 -07:00
Ian Romanick
a7400e7364 ARB prog: _mesa_print_program output should go to same place as _mesa_printf 2009-07-24 18:03:02 -07:00
Ian Romanick
f3cba9d66a ARB prog parse: Fix cut-and-paste error for constant vectors 2009-07-24 18:01:59 -07:00
Ian Romanick
6f8214cae6 ARB prog: get frag prog texture info from the right place
This gets basic texturing working.  w00t!
2009-07-24 17:33:30 -07:00
Patrice Mandin
8c30292a6e nouveau: use nv04_surface_copy_swizzle only for POT sizes 2009-07-24 23:37:46 +02:00
Joakim Sindholt
12b183d250 radeon-gallium: remove old getparam ioctl 2009-07-24 14:54:00 +02:00
Brian Paul
c57d81ddc9 mesa: include glew headers in MesaDemos tarballs 2009-07-23 20:20:39 -06:00
Alex Deucher
3b4235d4eb r600: fix segfault in morph3d
These attributes still need work, but it shouldn't hurt to
enable them.
2009-07-23 18:26:02 -04:00
Keith Whitwell
aa99a765c1 draw: correct address for machine struct in llvm path
This changed after a recent commit.
2009-07-23 18:48:04 +01:00
Keith Whitwell
adc6f8cdfc gallivm: updates for TGSI changes
make linux-llvm succeeds, but doesn't seem to be working, at least with
llvm 2.5
2009-07-23 17:59:08 +01:00
Corbin Simpson
ca83d5a8db r300g, radeon-gallium: Fix API, cleanup.
Something called "validate" should return FALSE on failure, not TRUE.
2009-07-23 07:18:29 -07:00
Nicolai Hähnle
27b3c435ba radeon-gallium: Build fixes wrt changed libdrm_radeon space check API
Had to be hacked up a bit to apply to master. Sorry 'bout that. :3
2009-07-23 07:18:29 -07:00
Corbin Simpson
256eacbde4 r300g: PIPE_CAP_BLEND_EQUATION_SEPARATE. 2009-07-23 07:18:29 -07:00
Keith Whitwell
d0d98f3ecf gallium: clean up opcode definitions
Remove commented-out opcodes.  Remove information about API mappings
to opcodes, but add a reference to tgsi-instruction-set.txt where
that information is better presented.
2009-07-23 14:39:07 +01:00
Keith Whitwell
78379abcbf gallium: remove deprecated TGSI opcodes
Various opcodes which can be implemented trivially with other TGSI opcodes,
such as matrix multiplication and negation.  These were not used by any
state tracker or implemented by any of the drivers.
2009-07-23 14:38:26 +01:00
José Fonseca
8b78294d21 r600: Remove CRLF line endings. 2009-07-23 14:11:10 +01:00
Vinson Lee
af1163cc41 util: Add support for Mac OS. 2009-07-23 14:08:07 +01:00
Corbin Simpson
07961bb05e r300g: Actually mark shaders as translated/untranslated.
Also trust that Gallium will not give us TGSI that miscounts shader consts.

This creates a 20x speedup on glxgears, from 8 FPS to 160 FPS.
2009-07-23 00:00:28 -07:00
Brian Paul
895c435def cell: update TGSI_OPCODE_ cases 2009-07-22 21:04:07 -06:00
Ian Romanick
ef80c2012d parser: Clean up a bunch of silly compiler warnings 2009-07-22 17:13:08 -07:00
Ian Romanick
0db5ef0741 parser: Track a few more frag prog related values 2009-07-22 16:21:54 -07:00
Ian Romanick
28b13038d8 parser: Ensure that param_binding_type is set correctly 2009-07-22 16:03:32 -07:00
Michel Dänzer
d602966f89 gallium: Fix PPC build. 2009-07-23 00:47:32 +02:00
Ian Romanick
5f090bb074 GIT ignore program_parse.output 2009-07-22 15:28:31 -07:00
Ian Romanick
c2ee82d693 parser: Set NumParameters 2009-07-22 15:27:31 -07:00
Ian Romanick
44843c7533 parser: Clean up generation of error strings during assembly 2009-07-22 15:06:49 -07:00
Patrice Mandin
b7042399fd nouveau: nv30: wrong variable for format 2009-07-22 22:26:08 +02:00
Maciej Cencora
b129c55f42 r300: fix address register handling in NQSSADCE
For address register we always use X component
2009-07-22 22:10:22 +02:00
Ian Romanick
aec4291706 parser: Initialize unused instruction source registers
The 965 driver expects unused source registers (e.g., SrcReg[2] of a
DP3 instruction) to have a register file of PROGRAM_UNDEFINED.
Initializing these source registers ensures that this happens.
2009-07-22 12:29:48 -07:00
Patrice Mandin
db40bb0287 nouveau: Take into account sx,sy parameters to read from source surface 2009-07-22 21:10:20 +02:00
Ian Romanick
69d3d19b54 parser: Anonymous constants come from the PROGRAM_CONSTANT file 2009-07-22 10:51:18 -07:00
Keith Whitwell
ede9f3b52e gallium: remove multiple aliases for TGSI opcodes
This is a source of ongoing confusion.  TGSI has multiple names for
opcodes where the same semantics originate in multiple shader APIs.

For instance, TGSI includes both Mesa/GLSL and DX/SM30 names for
opcodes with the same semantics, but aliases those names to the same
underlying opcode number.

This makes it very difficult to visually inspect two sets of opcodes
(eg in state tracker & driver) and check if they implement the same
functionality.

This patch arbitarily rips out the versions of the opcodes not currently
favoured by the mesa state tracker and leaves us with a single name
for each distinct operation.
2009-07-22 12:42:09 +01:00
Keith Whitwell
fd31f92cea gallium: simplify tgsi_full_immediate struct
Remove the need to have a pointer in this struct by just including
the immediate data inline.  Having a pointer in the struct introduces
complications like needing to alloc/free the data pointed to, uncertainty
about who owns the data, etc.  There doesn't seem to be a need for it,
and it is unlikely to make much difference plus or minus to performance.

Added some asserts as we now will trip up on immediates with more
than four elements.  There were actually already quite a few such asserts,
but the >4 case could be used in the future to specify indexable immediate
ranges, such as lookup tables.
2009-07-22 12:42:09 +01:00
Richard Li
5e3c62b550 r600: fix dst reg indexing for real
This fixes segfaults in apps like teapot and tunnel
2009-07-21 17:56:06 -04:00
Alex Deucher
7edb2a9eef Revert "r600: fix dst reg indexing"
This reverts commit cc893d9a98.

Richard has the proper fix.
2009-07-21 17:44:36 -04:00
Alex Deucher
72a3d8845f r600: add stencil support 2009-07-21 17:10:54 -04:00
Alex Deucher
db0160bb9d r600: use state functions to set default state 2009-07-21 17:10:54 -04:00
Alex Deucher
bd62cd735f r600: fill in point functions 2009-07-21 17:10:54 -04:00
Alex Deucher
5a615e7e65 r600: set provoking vertex to last vertex for OGL 2009-07-21 17:10:54 -04:00
Alex Deucher
60787df1e5 r600: fill in r700UpdateViewportOffset 2009-07-21 17:10:53 -04:00
Alex Deucher
549b8e6f1a r600: first pass at polyoffset support
not working yet
2009-07-21 17:10:53 -04:00
Jerome Glisse
7247446ba8 radeon: fix colorbuffer pitch emission regarding tiling in KMS/CS case
We need to emit a relocation for pitch register so that kernel can
check and properly setup tiling on the color buffer.
2009-07-21 21:14:19 +02:00
Alex Deucher
ecead30111 R600: fix up some build problems 2009-07-21 11:09:05 -04:00
Alex Deucher
9e6d38f8a2 r600: add alpha test support 2009-07-21 10:53:20 -04:00
Michel Dänzer
cf24119d38 Track Radeon driver symlinks in Git. 2009-07-21 10:47:42 +02:00
Peter Hutterer
5358e54d1a Add missing X11_INCLUDES to egl/drivers/demo and egl/main.
Compiling mesa on a system with no X headers installed in the default
include paths fails due to missing X11 includes. The header includes are
picked up by configure but not applied.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-21 11:45:49 +10:00
Eric Anholt
81d5550684 i965: Don't clip everything if FRONT_AND_BACK culling while culling disabled.
Fixes everything-black with meta_clear_tris on quake4-mpdemo and doom3-demo.

Bug #18844, 22077.
2009-07-20 18:31:13 -07:00
Ian Romanick
770cebbc29 ARB_fp/vp: Initial import of new ARB vp/fp assembler
This still needs quite a bit of work, but a bunch of the programs in progs/vp
produce correct results.
2009-07-20 17:44:36 -07:00
Alex Deucher
6617fa6fab r600: fix typo in blend code 2009-07-20 19:33:05 -04:00
Kevin DeKorte
cc893d9a98 r600: fix dst reg indexing
This fixes segfaults in apps like teapot and tunnel
2009-07-20 19:00:57 -04:00
Alex Deucher
265d5eba65 r600: add blending support 2009-07-20 19:00:57 -04:00
Alex Deucher
a369963b18 r600: add user clip plane support 2009-07-20 19:00:57 -04:00
Alex Deucher
ce9c5a1a27 r600: add logicop support 2009-07-20 19:00:57 -04:00
Ian Romanick
480567d5c4 Add new _mesa_new_parameter_list_sized to pre-allocate a parameter list 2009-07-20 15:37:24 -07:00
Keith Whitwell
cad82cd063 tgsi: get texturing working in vertex shader sse2 path
Missing file from previous commit.
2009-07-20 19:47:38 +01:00
Michel Dänzer
cd63e35603 Merge branch 'mesa_7_5_branch' 2009-07-20 20:41:11 +02:00
Keith Whitwell
442101dad7 tgsi: get texturing working in vertex shader sse2 path 2009-07-20 19:32:28 +01:00
Keith Whitwell
27a19be8d1 tgsi: fix regression in indexed const lookups
This function was calling get_input_base() and get_output_base() to
get the names of a couple of register to use as temps.  Those
functions no longer return registers, so adjust it to get the
registers elsewhere.

This change doesn't address the issue that it's a fairly poor way to
grab a register name by calling a function with an apparently
unrelated meaning.
2009-07-20 19:32:28 +01:00
Kevin DeKorte
91512fa019 r600: Fix compilation 2009-07-20 09:27:17 -04:00
Cooper Yuan
19249a1ae7 R6xx/r7xx: Fix line stipple and width issue 2009-07-20 17:42:47 +08:00
Michel Dänzer
cf721c8137 Add common_ppc.c to MESA_GALLIUM_SOURCES. 2009-07-20 02:11:17 +02:00
Michel Dänzer
3d0009ce45 r300g: Fix SCons build. 2009-07-20 02:06:37 +02:00
Michel Dänzer
0b7a907f39 gallium/trace: Fix SCons build. 2009-07-20 02:05:38 +02:00
Michel Dänzer
3326be6c0a r300g: Guard R500 register writes by is_r500 check.
Flagged by the DRM command stream checker. This allows the driver to work on
non-R500 cards.
2009-07-20 01:53:15 +02:00
Dave Airlie
a8921d0b52 gallium: make g3dvl build again 2009-07-18 17:44:44 +10:00
Brian Paul
b96ae1b2c4 Merge branch 'mesa_7_5_branch'
Conflicts:

	Makefile
	progs/glsl/multitex.c
	src/mesa/main/enums.c
	src/mesa/main/state.c
	src/mesa/main/texenvprogram.c
	src/mesa/main/version.h
2009-07-17 22:00:47 -06:00
Alex Deucher
f81f57e25d R6xx/R7xx: add fine grained syncing support 2009-07-17 19:05:30 -04:00
Alex Deucher
b192b9dac6 R6xx/r7xx: send depth state in it's own function 2009-07-17 19:05:29 -04:00
Andrew Randrianasulu
2a6f58460a st/egl: Fix broken build after EGL thread changes 2009-07-18 00:55:12 +02:00
Alex Deucher
5008269cfe R200: fix build when RADEON_DEBUG_BO is set 2009-07-17 18:19:01 -04:00
Dave Airlie
a046beaffe radeon: disable BO debug 2009-07-18 08:00:23 +10:00
Brian Paul
40fd101919 egl: commit missing eglcurrent.[ch] files
Not sure how these got left out from earlier commit.
2009-07-17 13:36:58 -06:00
Alex Deucher
e910f6831b Merge branch 'master' of git+ssh://agd5f@git.freedesktop.org/git/mesa/mesa into r6xx-rewrite 2009-07-17 14:46:40 -04:00
Kevin DeKorte
79a170108f R6xx/r7xx: warning fixes
patch from Kevin DeKorte with some minor fixes from me.
2009-07-17 14:43:42 -04:00
Chia-I Wu
30bccf8ea9 xeglthreads: Check current context for EGL per-thread support.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-17 11:56:32 -06:00
Chia-I Wu
15fdbc8361 egl: Remove redundant DeletePending flag.
A context or surface that is neither linked to a display nor current to
a thread should be destroyed.  Therefore, an unlinked context or surface
implies a pending delete automatically.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-17 11:56:00 -06:00
Chia-I Wu
3f7e0d5302 egl: Destroy display's resources upon termination.
eglTerminate should destroy the contexts and surfaces of the display.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-17 11:54:06 -06:00
Chia-I Wu
be9d1ab171 egl: Return the same EGL Display for the same native display.
The latest revision of the spec explicitly requires the same handle to
be returned for the same native display.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-17 11:53:39 -06:00
Chia-I Wu
cca31340b5 egl: Use the link functions to manage resources.
This commit uses the newly introduced link functions to manage EGL
contexts and surfaces.  As a result of this, the API for drivers are
changed.  All drivers are updated for the change.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-17 11:53:03 -06:00
Chia-I Wu
18457cb263 egl: Add funtions to link contexts and surfaces to displays.
EGL contexts and surfaces are resources of displays.  They should be
managed by displays.  This commit adds a bunch of functions to
egldisplay.c to help establish the links between contexts/surfaces and
displays.  How links are established is considered opaque outside
display.  Functions like _eglGetSurfaceHandle or _eglLookupSurface are
therefore moved to egldisplay.c, with some small modifications.

The idea is also extended to display.  That is, displays need to link to
themselves to be looked up.

This commit only adds the functions.  A commit to use them should
follow.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-17 11:48:27 -06:00
Chia-I Wu
21b635ffa8 egl: Extend per-thread info for multiple current contexts.
EGL allows multiple current contexts, as long as they are bound to
different client APIs.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-17 11:42:04 -06:00
Chia-I Wu
75da80b295 egl: Support per-thread info.
This commit introduces a "current" system to manage per-thread info.  It
uses TLS, if GLX_USE_TLS is defined, or pthread, if PTHREADS is defined.
If none of them are defined, it uses a dummy implementation that is just
like before.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-17 11:41:02 -06:00
Chia-I Wu
8e92ec9fdd egl: Add eglcompiler.h for compiler features.
Only INLINE (from mesa/main/compiler.h) is defined now.  It may be used
to deal with symbol visibility and int/pointer conversion in the future.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
2009-07-17 11:36:45 -06:00
Alex Deucher
c4ab08a0cd R6xx/r7xx: disable depth/stencil compression for now 2009-07-17 12:21:33 -04:00
Alex Deucher
60d681f367 R6xx/r7xx: add some missing state regs 2009-07-17 12:07:15 -04:00
Eric Anholt
9cea84b6b5 texenv: Calculate whether we need to do secondary color on our own.
The _TriangleCaps bit is deprecated, not updated when we require, and
is set based on state that hasn't been updated at that point in
_mesa_update_state_locked().

Fixes incorrect clear color in glsl/twoside.c with meta_clear_tris.
2009-07-16 19:02:04 -07:00
Eric Anholt
99174e7630 i965: Add missing state dependency of sf_unit on _NEW_BUFFERS. 2009-07-16 19:00:34 -07:00
Alex Deucher
6f63698d26 R6xx: fix rendering on r6xx/rs780 chips
You always need to emit a fetch shader (fs) even if you
aren't using it.  For now, just emit the fs with the
vs address to make the kernel happy.
2009-07-16 17:35:44 -04:00
Keith Whitwell
04dd8b71b4 draw: fix ppc build regression
Found by x.org tinderbox, reported by Chris Ball.
2009-07-16 19:01:29 +01:00
Kevin DeKorte
c42a616314 Warning fixes 2009-07-16 11:57:14 -04:00
Alex Deucher
0850776f1a R6xx/r7xx: remove unused function
Spotted by kdekorte on IRC
2009-07-16 11:53:58 -04:00
Brian Paul
3e8832d24b st/mesa: add some array index bounds assertions 2009-07-16 08:44:51 -06:00
Chia-I Wu
721f80b82a egl: Add xeglthreads
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-16 08:29:57 -06:00
Richard Li
00a216fd1e Restore vp input mapping, fix vtx stream missing problem. 2009-07-16 10:28:58 -04:00
Keith Whitwell
caf5d52d48 tgsi: simplify and fix sse KIL implementation
Use sse_movmskps to extract the correct bits of the comparison result
for use in updating the killmask.  Simplify some logic around
identifying the set of necessary comparisons to make.
2009-07-16 12:49:27 +01:00
Keith Whitwell
e1ad38ad8e rtasm: export sse_movmskps 2009-07-16 12:47:11 +01:00
Keith Whitwell
3858f47994 tgsi: initial texturing support on sse path
Most obvious problem is drawpixels comes out blocky, but this may be
an existing issue of KIL on the sse path.
2009-07-16 11:37:52 +01:00
Keith Whitwell
a01383ff6a tgsi: make sse function callout mechanism more generic
Take a list of arguments rather than hardcoding TEMP_R0.
2009-07-16 10:11:46 +01:00
Keith Whitwell
ebc4a9bf2e tgsi: reduce x86 reg usage in tgsi_sse generated programs
Pass the tgsi_exec_machine struct in directly and just hold a single
pointer to this struct, rather than keeping one for each of its
internal members.
2009-07-16 09:53:08 +01:00
Keith Whitwell
4e3002b50f tgsi: no need to separately malloc input and output arrays
Can now guarantee alignment in the initial allocation of the tgsi exec machine.
2009-07-16 09:53:08 +01:00
Keith Whitwell
c202fe187c gallium: reduce recursive include of tgsi_exec.h
A lot of draw code no longer needs to see this header.
2009-07-16 09:53:07 +01:00
Keith Whitwell
7fb702705a tgsi: make function call code in tgsi_sse.c less opaque
Explictly pass src and dst arguments (previously dst argument was also
being used as a src).  Separate argument handling from the rest of
the function call emit.
2009-07-16 09:53:07 +01:00
Keith Whitwell
6175653d0b gallium: proper constructor and destructor for tgsi_exec_machine
Centralize the creation, initialization and destruction of this struct.
Use align_malloc instead of home-brew alternatives.
2009-07-16 09:53:07 +01:00
Alex Deucher
11606e873d Fix more merge fallout 2009-07-16 02:59:36 -04:00
Kevin DeKorte
92a2f0164a R6xx/r7xx: warning fixes 2009-07-15 17:13:09 -04:00
Richard Li
01b793ec7d R6xx/r7xx: fix missing vertex stream
Somehow context->radeon.tcl.aos[j].bo is not null sometimes,
but it is safe for now because it is only a pointer to
dma.current so overwriting it would not hurt anything.
2009-07-15 17:00:42 -04:00
Alex Deucher
1e8a6068ee radeon bo: Fix merge fall out 2009-07-15 15:59:04 -04:00
Alex Deucher
582838a666 R6xx/r7xx: more Makefile fixes 2009-07-15 15:40:35 -04:00
Alex Deucher
2ab328e5e4 Fix r600 makefile for lastest CS changes 2009-07-15 15:23:11 -04:00
Alex Deucher
c5c19919ce Merge branch 'master' of git+ssh://agd5f@git.freedesktop.org/git/mesa/mesa into r6xx-rewrite
This builds, but I get an assertion in radeonGetLock() due to
the drawable being null.
2009-07-15 14:17:07 -04:00
Alex Deucher
a0d4a12614 make sure ctx->Driver.Flush is valid before calling it 2009-07-15 11:31:24 -04:00
Alex Deucher
efe7ad233c Use memcpy directly in the common code
This alleviates the need for an additional symbol.
2009-07-15 11:16:41 -04:00
Dave Airlie
3a3b83e511 radeon: update span reading micro tile code
tested on r500 with zreaddraw with Z buffer in all 3 modes
2009-07-15 14:23:14 +10:00
Dave Airlie
bd4ed25222 r300: emit z depth pitch reloc in preparation for tiling 2009-07-15 14:23:14 +10:00
Dave Airlie
94d2a809f9 radeon: r300 fix span reading for macro tiled buffers.
this uses the correct formula for macro tiled buffers for readback
2009-07-15 14:23:13 +10:00
Dave Airlie
9b17f041d1 radeon: for tiling you really need to use GET/PUT VALUE not PTR.
since the surfaces aren't linear you can't just use GET_PTR
2009-07-15 14:23:13 +10:00
Xiang, Haihao
868aa16074 i965: the offset of any branch/jump instruction is in unit of 64bits on IGDNG 2009-07-15 10:48:13 +08:00
Alex Deucher
10b3e64bca R6xx/r7xx: implement memcpy buffer swaps
This allows double buffered apps to run, but perfomance
will be awful until we implement something faster.

You must update to the latest kernel modules.
2009-07-14 21:19:32 -04:00
Dave Airlie
f6f0e117a4 intel/radeon: add common metaops code.
Move all the metaops to a dri_metaops file and port radeon/intel
to use the new common meta ops code.
2009-07-15 10:30:23 +10:00
Alex Deucher
9385e4e1ff r6xx/r7xx: fix buffer aging bug
We were using sparse indexing for aos, while the common
code expected packed indexing.
2009-07-14 20:08:27 -04:00
Alex Deucher
9ae78dc0bc R6xx/R7xx: no irqs yet. 2009-07-14 20:06:29 -04:00
Dave Airlie
681ede8836 radeon: fix unsigned vs signed comparison in stencil code.
This function takes a GLint not a GLuint, passing in -1
breaks internally.
2009-07-15 08:19:34 +10:00
Eric Anholt
99d07d0f91 intel: Fix ClearDepth to not be affected by DepthRange.
Fixes new piglit depthrange-clear.c test.
2009-07-14 15:14:52 -07:00
Eric Anholt
b677c40abb intel: Set DepthRange in the metaops using RasterPos[2].
RasterPos[2] is already sent through the window transform, which includes
DepthRange handling.  So make DepthRange for the metaops a noop.

Fixes a failure in oglconform depthrange.c
2009-07-14 15:14:52 -07:00
Eric Anholt
e5f63c403b Fix state flag dependencies for fixed function fragment program updates.
I started looking into why _NEW_ARRAY punishes us, and while annotating
dependencies noticed that a bunch of dependencies were missing.
2009-07-14 15:14:52 -07:00
Eric Anholt
374110bc98 intel: Flag _NEW_ARRAY state when doing array object binding in clears.
This is just following bind_vertex_array()'s behavior.
2009-07-14 15:14:51 -07:00
Alex Deucher
a1ecbb2356 Disable shader dumps 2009-07-14 18:01:29 -04:00
Brian Paul
e786ecbfb5 mesa: regenerated enums.c file 2009-07-14 07:47:19 -06:00
Corbin Simpson
b727150b14 dri-st: Unbreak GL_EXT_blend_equation_separate.
Since it has a dispatch table entry (for BlendEquationSeparateEXT,)
can't omit it from this list. It'll still get disabled if the cap
(PIPE_CAP_BLEND_EQUATION_SEPARATE) isn't set.

Somebody that doesn't suck at GL (read: not me) should probably add
this into progs/samples/blendeq or similar so we can test it.
2009-07-14 01:16:25 -07:00
Patrice Mandin
54cf63278f gallium: Define PIPE_CAP_BLEND_EQUATION_SEPARATE, remove extension from default extension list 2009-07-14 09:44:49 +02:00
Michel Dänzer
33f56b4612 radeon: Differentiate 16 bpp destination formats.
Fixes those formats in fbo_firecube.

Only tested with r300, radeon and r200 compile tested only.
2009-07-14 08:25:27 +02:00
Michel Dänzer
60e60bb302 radeon: Invert front face winding when rendering to FBO.
Fixes fgl_glxgears and progs/demos/fbotexture after pressing 'c'.

Tested with r300, radeon and r200 compile tested only.
2009-07-14 08:00:49 +02:00
Cooper Yuan
f4646f3247 R6xx/r7xx: Fix specular lighting issue 2009-07-14 10:39:07 +08:00
Nicolai Hähnle
59155f70e7 r300g: Small compile warning fixes.
Signed-off-by: Corbin Simpson <MostAwesomeDude@gmail.com>
2009-07-13 16:26:29 -07:00
Nicolai Hähnle
b3f1d370a2 r300g, radeon: Whitespace fixes.
Signed-off-by: Corbin Simpson <MostAwesomeDude@gmail.com>
2009-07-13 16:26:29 -07:00
Corbin Simpson
ca28e591f2 r300g: Use align() instead of inline maths. 2009-07-13 16:26:29 -07:00
Maciej Cencora
9226e3d6a6 Merge branch 'shaders_cleanup' 2009-07-13 20:29:11 +02:00
Eric Anholt
0dc700850a intel: Partially fix fallback detection for glCopyTexSubImage.
Really, we should be checking that the MesaTexFormat for the read buffer
and the texture match, but the previous code wasn't even doing that, so
matching the cpp should be an improvement (and potentially fix some hangs!).
The previous code also rejected GL_RGB even though blitting the alpha
channel to the ignored channel of an x8r8g8b8 texture should be fine, which
tripped up compiz's blur plugin.
2009-07-13 10:57:12 -07:00
Maciej Cencora
582bd34665 r300: always assume all components are read by fragment program
Components of input attributes that are used by fragment program aren't part of vertex program key, and that may lead to situations when vertex program writes only TEX1.xy and fragment program reads TEX1.xyz, resulting in rendering errors.

Reported-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-13 19:28:15 +02:00
Nicolai Hähnle
f06910f6c3 r300: Fix fogcoord rewriting
We only care about the actual fogcoord itself now, reducing the rewriting
done for the vertex program.

The rewriting of source operand swizzles in the fragment program takes
care that fogcoord.yzw = 001.

This should fix fogcoord rewriting entirely, which had been horribly
broken in the face of dot-product instructions, and just broken (though
not horribly so) in the face of almost every other instruction (the W
component would be incorrect for most arithmetic instructions).

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-13 19:28:15 +02:00
Maciej Cencora
3f5382819e r300: fix swizzle masking in getUsedComponents 2009-07-13 19:28:15 +02:00
Maciej Cencora
acd3360041 r300: minor fix
Split initializations becase the vars are of different type.

Reported-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-13 19:28:15 +02:00
Maciej Cencora
1a5520fcd3 r300: move variables declarations 2009-07-13 19:28:14 +02:00
Maciej Cencora
b3716eeb61 r300: document r300_vertex_program_cont structure
Reported-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-13 19:28:14 +02:00
Maciej Cencora
a0204ce456 r300: document r300_fragment_program_cont struct 2009-07-13 19:28:14 +02:00
Maciej Cencora
ec854729d1 r300: fix indentation
Reported-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-13 19:28:13 +02:00
Maciej Cencora
48cc352a71 r300: fix StrideB == 0 case when converting data format
Reported-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-13 19:28:13 +02:00
Maciej Cencora
4eff323731 r300: hw can handle per component negations in vertex shaders
Reported-by: Nicolai Haehnle <nhaehnle@gmail.com>
2009-07-13 19:28:13 +02:00
Maciej Cencora
4efb9f053c r300: fix WPOS for SWTCL 2009-07-13 19:28:13 +02:00
Maciej Cencora
bdc8a95fc9 r300: removed unnecessary params
We don't have check which attributes are used by fragment program - it's already done by NQSSADCE.
2009-07-13 19:28:12 +02:00
Maciej Cencora
65d9f23c7c r300: use NQSSADCE for vertex programs 2009-07-13 19:28:12 +02:00
Maciej Cencora
70448b9f95 r300: operate on copy of a program when pairing instructions
We need to keep unpaired program for vertex program NQSSADCE.
2009-07-13 19:28:12 +02:00
Maciej Cencora
12a6d73c75 r300: handle relative addressing in NQSSADCE 2009-07-13 19:28:11 +02:00
Maciej Cencora
96b2eb18c5 r300: handle ARB_vertex_program specific instructions in NQSSADCE 2009-07-13 19:28:07 +02:00
Maciej Cencora
e43cc28c1b r300: move depth output rewrite out of NQSSADCE 2009-07-13 19:25:59 +02:00
Maciej Cencora
f79ef95df4 r300: rewrite FOGC and HPOS attribs handling
Rewrite vertex and fragment programs so that we don't have to do any hacks on lower level.
2009-07-13 19:25:59 +02:00
Maciej Cencora
df5fe747fa r300: bind vertex program to fragment program 2009-07-13 19:25:58 +02:00
Maciej Cencora
d1e4caa6e2 r300: recalculate used inputs and outputs after dead code removal 2009-07-13 19:25:58 +02:00
Maciej Cencora
7360f83364 r300: move fragment program selection before vertex program selection
Prepare for wpos and fogc handling rewrite.
2009-07-13 19:25:58 +02:00
Maciej Cencora
37c319f62f r300: implement proper IsProgramNative check for vertex programs 2009-07-13 19:25:57 +02:00
Maciej Cencora
bce224c1f1 r300: don't modify original vertex program
Keep the original vertex program untouched because it may be needed after some state change for generating new r300 specific vertex program.
2009-07-13 19:25:57 +02:00
Maciej Cencora
7829b7a1b8 r300: cache translated fragment programs 2009-07-13 19:25:56 +02:00
Maciej Cencora
28066ed012 r300: update state parameters only once per rendering operation 2009-07-13 19:25:56 +02:00
Maciej Cencora
21db37d432 r300: translate non native insts earlier for easier debugging 2009-07-13 19:25:55 +02:00
Maciej Cencora
0b411a72f3 r300: print vertex program after adding artificial output insts 2009-07-13 19:25:55 +02:00
Maciej Cencora
4a6899e080 r300: use mesa provided function for adding MVP code 2009-07-13 19:25:54 +02:00
Maciej Cencora
9b781ca2ce r300: simplify insert_wpos a little 2009-07-13 19:25:54 +02:00
Brian Paul
9615daa932 Merge branch 'mesa_7_5_branch' 2009-07-13 08:47:37 -06:00
Dave Airlie
bb4c703587 radeon: port more front fixes from intel.
Port fixes to read buffer from front.
2009-07-14 01:23:24 +10:00
Dave Airlie
504d01b275 radeon/r200: fix color masking under dri2
Need to retrieve the bits from the rrb not from screen struct
2009-07-14 01:23:24 +10:00
Dave Airlie
a79aefb177 radeon: Use Stencil.Enabled instead of Stencil._Enabled in DrawBuffers.
The _Enabled field isn't updated at the point that DrawBuffers is called,
and the Driver.Enable() function does the testing for stencil buffer
presence anyway.
2009-07-14 01:23:23 +10:00
Dave Airlie
d9913d7c09 radeon/fbo: stencil bits fix from Michel in intel fbo code 2009-07-14 01:23:23 +10:00
Xiang, Haihao
2995bf0d68 i965: add support for new chipsets
1. new PCI ids
2. fix some 3D commands on new chipset
3. fix send instruction on new chipset
4. new VUE vertex header
5. ff_sync message (added by Zou Nan Hai <nanhai.zou@intel.com>)
6. the offset in JMPI is in unit of 64bits on new chipset
7. new cube map layout
2009-07-13 11:01:13 +08:00
Dave Airlie
f030e2ba17 r300: move fallback warnings inside fallback debugging
random output is bad
2009-07-12 21:37:47 +10:00
Dave Airlie
dfecf217fa r300: fix clear mask to not use sw if not necessary 2009-07-12 21:37:46 +10:00
Nicolai Hähnle
b484c71036 radeon: Fix crash when rendering to incomplete texture and other formats
It is possible to bind texture images of an incomplete mipmapped texture.
Software fallbacks in this case incorrectly tried to mmap the entire texture.

Additionally, add span functions for 1555 and 4444 formats.

This fixes crashes in piglit's fbo-readpixels test; unfortunately, the test
itself still fails - this needs to be investigated.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-07-12 12:50:36 +02:00
Dave Airlie
a10244453c radeon: update clear code from Intel codebase.
This updates some of the clear code from Intel gives a 5x clearspd perf
for me here. played openarena also, not sure if the viewport changes
broke anything,
2009-07-12 17:28:14 +10:00
Dave Airlie
b06cb372bf radeon: fbo fix firecube crashes
it might still be misrendering not sure
2009-07-12 12:13:40 +10:00
Michel Dänzer
65059606e9 radeon: Fix scissor rectangle calculation when rendering to FBO.
fgl_glxgears -fbo runs, though the gears don't look right yet.
2009-07-11 20:25:09 +02:00
Dave Airlie
db618427ab radeon: enable GL_NV_texture_rectangle under dri2. 2009-07-11 03:17:13 +10:00
Dave Airlie
85957cb512 radeon: set texture in state properly.
make sure to turn off when no texture is used in hw
2009-07-11 03:17:12 +10:00
Dave Airlie
a6a11e1dc0 radeon: make swtcl emit size bigger 2009-07-11 03:17:12 +10:00
Alex Deucher
37c0cde80a R6xx/r7xx: use packet 3 for scratch emit
no need to allow packet 0 scratch regs in the drm
2009-07-10 12:04:56 -04:00
Alex Deucher
0de26dba2e R6xx/r7xx: disable CS dump
Don't fprintf to a xterm with the lock held.
2009-07-09 17:15:23 -04:00
Brian Paul
8987410ab6 Merge branch 'mesa_7_5_branch' 2009-07-09 08:05:56 -06:00
Richard Li
93ab69a0ef Fix buffer age implementaion bug. 2009-07-08 14:49:48 -04:00
Alex Deucher
f9db04878b R6xx/r7xx: remove some left over debugging 2009-07-07 15:44:44 -04:00
Alex Deucher
0396795689 R6xx/R7xx: fix texture reloc emit
Textures don't look right yet, but tex demos run.
2009-07-07 15:40:28 -04:00
Alex Deucher
f74d1c26ac r6xx/r7xx: add sw blit for tex upload
Can be used for buffer swap as well.
2009-07-07 02:12:38 -04:00
Alex Deucher
6799bc0b6b tex wip 2009-07-07 01:02:08 -04:00
Alex Deucher
1bad691a17 R6xx/r7xx: first pass at texture support
texture bo setup isn't quite working yet
2009-07-06 10:25:48 -04:00
Cooper Yuan
c6b0b46d6d R6xx/r7xx: DEPTH_CONTROL will be reset by this function 2009-07-06 16:30:43 +08:00
Jakob Bornecrantz
7ccb00b1ac Merge branch 'mesa_7_5_branch' 2009-07-05 04:14:41 +02:00
Brian Paul
f742f2c0b3 demos: indentation fix 2009-07-08 13:59:03 -06:00
Brian Paul
820436f978 demos: use glEnable/DisableClientState() for vertex arrays 2009-07-08 13:58:30 -06:00
RALOVICH, Kristóf
bf71ece171 glx: death to RCS tag 2009-07-08 13:34:57 -06:00
Corbin Simpson
67a43b2cfc r300g: Remove VAP_CNTL_STATUS from invariant state.
Seriously.
2009-07-08 11:59:56 -07:00
Corbin Simpson
c737e57357 r300g: Disable MSPOS registers for glisse's CS security checker.
These will come back in someday, when we can properly use them.
2009-07-08 11:55:27 -07:00
Corbin Simpson
746140e215 r300-gallium: Unify sampler and texture emit.
They have to cross into each other's registers.
2009-07-08 11:39:34 -07:00
Corbin Simpson
1aa38b2c2d r300-gallium: Mipmap setup.
(cherry picked from commit 88c01a15da5639dd68a6a0133724994cb66f1316)
2009-07-08 11:30:59 -07:00
Corbin Simpson
e46d12d394 r300g: Add endian fix to vertex fetcher setup.
As reported and initially tested by MrCooper.
2009-07-08 11:27:26 -07:00
Corbin Simpson
ce0f7954f8 gallium: Add endian detection to p_config. 2009-07-08 11:26:52 -07:00
Maciej Cencora
186d187ff7 r300: fix regression introduced by ca13937ef9
Stride == 0 means that we value for first vertex should be copied to every other vertices (e.g. constant color).

This fixes glean/vertProg1 and sauerbraten with enabled shaders.
2009-07-08 18:42:39 +02:00
Maciej Cencora
95df7bfc03 radeon: fix copy and paste typo 2009-07-08 18:42:39 +02:00
Maciej Cencora
afd687b0dc mesa/vbo: always recalculate min_index and max_index when splitting vertices 2009-07-08 18:42:39 +02:00
Jakob Bornecrantz
eb33c0ab8b progs/tests: Use compressed texture in mipmap_comp_tests 2009-07-04 16:01:45 +02:00
Eric Anholt
be64e66e5a intel: Fix flipped Y for glDrawPixels(GL_STENCIL_INDEX) to window system.
Even after fixing bugs in this code, it doesn't make me feel any cleaner.
Fixes piglit stencil-drawpixels.
2009-07-07 15:43:44 -07:00
Eric Anholt
bdd7506f10 intel: Fall back on glCopyPixels(GL_DEPTH) or GL_STENCIL. 2009-07-07 15:36:10 -07:00
Eric Anholt
510c3bd7a1 i965: Remove BRW_NEW_INPUT_VARYING
This state flag has been unused since the ffvertex_prog move to core.
2009-07-07 15:16:29 -07:00
Eric Anholt
058e96916b Cap array elements at 0 when passed an invalid pointer for an array object.
Otherwise, a pointer greater than the size would underflow and give a large
maximum element.

Reviewed-by: Brian Paul <brianp@vmware.com> (previous version)
2009-07-07 15:16:28 -07:00
Jakob Bornecrantz
28471cfa97 Merge branch 'mesa_7_5_branch' 2009-07-04 07:43:01 +02:00
Jakob Bornecrantz
9982821cda progs/tests: Tests more views in mipmap_comp_tests 2009-07-04 07:41:40 +02:00
Zack Rusin
edb0267170 Merge commit 'origin/openvg-1.0' 2009-07-06 21:43:26 -04:00
Zack Rusin
124a6b1958 gallium: rearrange some members to avoid memory holes/padding
plus it saves us a cacheline in the cso
2009-07-06 17:21:37 -04:00
Zack Rusin
5920b6b679 pipebuffer: handle possible null pointer dereference
reported by clang static analyzer
2009-07-06 17:21:37 -04:00
Zack Rusin
f311893bf4 cso: possible null pointer dereference
reported by clang static analyzer
2009-07-06 17:21:37 -04:00
Zack Rusin
4873031e29 util: fix possible null pointer usage
found by the clang static analyzer
2009-07-06 17:21:37 -04:00
Zack Rusin
21cce6afb0 exa: some infrastucture work for accelerating composite 2009-07-06 17:21:36 -04:00
Dave Airlie
d66de6c341 radeon: ensure cmdbuf space for state + AOS is available
The problem is if we find out later we don't have any cmdbuf space but
we've already written the arrays to the DMA buffer object, we end up
emitting the current cmdbuf which has references to the current DMA object
we then send that to the hw and we can't reference the arrays we just emitted
to the old DMA buffer. things go bad, crash boom.

This can probably be tuned further + swtcl probably needs some fixes
2009-07-06 20:39:49 +10:00
Dave Airlie
7266e33abd r200: fix makefile 2009-07-06 17:46:36 +10:00
Dave Airlie
f110c5fd6e radeon: fixup FBO depth 24 allocations to avoid assert 2009-07-06 15:50:24 +10:00
Dave Airlie
c27f21f92d radeon/r200/r300: port to new space checking code in libdrm
This moves a big chunk of the space checking code into libdrm so
it can be shared by the DDX.
2009-07-06 15:12:17 +10:00
Corbin Simpson
645bfa32c9 radeon-gallium: Compile warning fix.
Fixes flush during validation, in case a buffer is double-validated.
2009-07-05 11:56:40 -07:00
Corbin Simpson
c8e0d55ac6 radeon-gallium: Use FLINK to do proper global buffers. 2009-07-05 11:55:47 -07:00
Corbin Simpson
df04e72d25 radeon-gallium: Wait for BOs before mapping them. 2009-07-05 11:29:13 -07:00
Maciej Cencora
6fff62ee3f r300: fix vertex limits
- don't limit vertex count if we are using indices
- max indices count is 65535 not 65536
- remove some comments that don't apply anymore
- remove unreachable code
2009-07-05 15:22:37 +02:00
Jakob Bornecrantz
862488075c Merge branch 'mesa_7_5_branch'
Conflicts:
	src/mesa/main/dlist.c
	src/mesa/vbo/vbo_save_api.c
2009-07-03 18:53:58 +02:00
Michel Dänzer
060c7f2321 radeon: Wait for BO idle if necessary before mapping it.
Fixes fighting between GPU and software rendering with TTM.
2009-07-03 12:44:19 +02:00
Michel Dänzer
6b2461fec9 r300: Guard debugging output. 2009-07-03 12:44:02 +02:00
Eric Anholt
8ae02a3919 intel: Fall back on glBitmap with fog enabled.
We would have to build the program with the appropriate fog mode, and
also supply the fog coordinate if appropriate.

Bug #19413.
2009-07-02 19:31:51 -07:00
Eric Anholt
ae1bfb6427 intel: Flush when mapping buffer objects so writes don't get reordered.
While GEM covers this for execution it knows about, it doesn't know about
the batchbuffer we're preparing.  Fixes piglit vbo-map-remap.c testcase.
2009-07-02 18:53:56 -07:00
Corbin Simpson
9a0b570ab6 vbo: If MapBufferRange fails, try MapBuffer instead.
Fixes segfaults with radeon winsys.
(Probably libdrm_radeon doing something that it shouldn't.)
2009-07-02 16:32:59 -07:00
Corbin Simpson
aa5b9c050f Nuke old trace-drm integration.
AFAICT nobody will miss it.
2009-07-02 16:32:59 -07:00
Eric Anholt
6d66f23c50 intel: Fix leak of DRI option info due to using the wrong free routine. 2009-07-02 14:07:10 -07:00
Eric Anholt
ddef7dc87b intel: Clean up leak of driver context structure on context destroy. 2009-07-02 14:07:10 -07:00
Eric Anholt
cb4ef34214 intel: Init num_fences to clean up valgrind warning.
Valgrind doesn't know that a successful getparam sets the target of the
pointer, so just set the value beforehand.
2009-07-02 14:07:09 -07:00
Richard Li
bb429803e0 r6xx/r7xx: Better fix for fragment temps
This doesn't waste as many in generic cases.
2009-07-02 12:08:57 -04:00
Jakob Bornecrantz
d1c8a0a308 r300g: Readd trace driver support 2009-07-02 15:07:53 +02:00
Jakob Bornecrantz
59abfa8e42 i915g: Readd trace driver support 2009-07-02 15:05:17 +02:00
Jakob Bornecrantz
c0d7502a2c trace: Add drm api integration
This is okay since drm_api.h doesn't have any external
	dependancies, one could make it only compile on platforms
	that support drm.
2009-07-02 14:57:55 +02:00
Dave Airlie
54ee188a00 radeon/r200/r300: drop radeon renderbuffer private width/height
half stealing the code without taking the intel regions
2009-07-02 20:57:45 +10:00
Dave Airlie
2ed3eddf9a radeon/r300: use base width/height.
I suspect this might break TFP in some way but it makes firecube run here
2009-07-02 20:45:19 +10:00
Cooper Yuan
c571395e5d R6xx/r7xx: Fix line width issue, ROUND_MODE and QUANT_MODE aren't bits of LINE_CNTL 2009-07-02 16:52:11 +08:00
Cooper Yuan
da88333671 R6xx/r7xx: Correct the indeices of DRAW_INDEX_IMMD 2009-07-02 16:49:19 +08:00
Xiang, Haihao
73137997e2 i965: fixes for JMPI
1. the data type of <src1> (JMPI offset) must be D
2. execution size must be 1
3. NoMask
4. instruction compression isn't allowed.
2009-07-02 16:32:19 +08:00
Corbin Simpson
96ef7aae1d r300g: Fix recursive Draw flush.
Also just noticed that demos/copypix walks around the overlapping blit rules.

Bad, bad Mesa. :3
2009-07-01 23:25:47 -07:00
Corbin Simpson
8799a9d24d r300g: Use floats for surface_copy texcoords, use correct src and dest.
This makes demos/copypix better-looking. Horizontal dimensions are right now.
2009-07-01 23:09:18 -07:00
Corbin Simpson
338db0af61 radeon-gallium: Adapt to drm_api changes.
Note that trace debugging is temporarily gone. I'll rework it later.
2009-07-01 22:33:17 -07:00
Alex Deucher
8bda0f1f4f r6xx/r7xx: rework aos setup
In theory this should fix the stride = 0 case,
but I can't seem to reproduce that anymore
with mesa master.
2009-07-01 14:41:57 -04:00
Alex Deucher
65cdf9c561 R6xx/R7xx: Fix number of temps used in fragment program
Spotted by Cooper.  This gets hello, aargb, smooth, etc.
working.
2009-07-01 11:10:10 -04:00
Eric Anholt
5e6b593d35 intel: Avoid pointer arithmetic on void *.
Bug #22000.
2009-06-30 22:57:56 -07:00
Eric Anholt
c3499f6c66 i965: Increase G4X default VS URB allocation to actually allow 32 threads.
This improves the performance of my GLSL demo by 30%.  It also fixes the
VS deadlock that ut2004 had, for reasons I can't explain. Bug #21330.
2009-06-30 17:55:23 -07:00
Ian Romanick
f359165a82 demos: Set the depth mask correctly to get the desired blending 2009-06-30 17:29:52 -07:00
Ben Skeggs
18a1c36c2d nouveau: return some supported zeta formats 2009-07-01 09:26:57 +10:00
Ben Skeggs
55e5ac17c1 nouveau: deal with PIPE_CAP_TGSI_CONT_SUPPORTED 2009-07-01 09:26:57 +10:00
Ben Skeggs
55fc63cd7d nouveau: fix build... 2009-07-01 09:26:56 +10:00
Jakob Bornecrantz
64849d1236 drm/st: Remove drm_api struct from drivers
Remove the drm_api from the functions in the softpipe and
	i915simple drivers. Create wrapper functions in the
	backends instead.
2009-07-01 01:20:04 +02:00
Brian Paul
119eb40942 i965: first attempt at handling URB overflow when there's too many vs outputs
If we can't fit all the VS outputs into the MRF, we need to overflow into
temporary GRF registers, then use some MOVs and a second brw_urb_WRITE()
instruction to place the overflow vertex results into the URB.

This is hit when a vertex/fragment shader pair has a large number of varying
variables (12 or more).

There's still something broken here, but it seems close...
2009-06-30 17:12:44 -06:00
Brian Paul
1b6ae2e004 i965: use BRW_MAX_MRF 2009-06-30 17:12:44 -06:00
Brian Paul
76a5a5dace i965: use BRW_MAX_GRF, BRW_MAX_MRF 2009-06-30 17:12:44 -06:00
Brian Paul
0fe19bc91d i965: move BRW_MAX_GRF, define BRW_MAX_MRF 2009-06-30 17:12:44 -06:00
Brian Paul
0b7b8c8ddf i965: defined BRW_MAX_MRF 2009-06-30 17:12:44 -06:00
Brian Paul
6eb2ca500d i965: comments and a new assertion 2009-06-30 17:12:44 -06:00
Alex Deucher
d10006e67f R6xx/r7xx: fix locking for clear
this allows redbook hello to render correctly mostly.
2009-06-30 18:40:48 -04:00
Eric Anholt
57a06d3a48 i915: Fix assertion failure on remapping a non-BO-backed VBO.
Failure to set the obj->Pointer back to null tripped up the assertion.
Bug #22428.
2009-06-30 10:41:18 -07:00
Brian Paul
b40dc7e7fc Merge branch 'mesa_7_5_branch'
Conflicts:

	src/mesa/vbo/vbo_exec_draw.c
2009-06-30 08:56:53 -06:00
Brian Paul
b750b9fc3d gallium: remove the pipe_sampler_state::shadow_ambient field
This was only present for the sake of GL_ARB_shadow_ambient which we
never implemented in Gallium.  If we someday want GL_ARB_shadow_ambient
we can implement it in the state tracker by adding a MAD after the
relevant TEX instructions.
2009-06-30 08:51:32 -06:00
Jakob Bornecrantz
f7cbaae13d identity: Create a drm_api wrapper 2009-06-30 12:24:47 +02:00
Jakob Bornecrantz
303cbb45b5 drm/st: Return drm_api struct from a function 2009-06-30 12:20:39 +02:00
Brian Paul
efe9faf061 softpipe: use shadow_compare4() to compare texcoord to four texture samples 2009-06-29 22:46:55 -06:00
Brian Paul
005ee9f4e0 softpipe: pass sampler state to shadow_compare() 2009-06-29 22:46:49 -06:00
Younes Manton
0eb1b3fac1 nouveau: Expect right params to tex_transfer_destroy().
Never crashed on x86, ptx is in the same stack slot in either case.
Thanks to Bob Gleitsmann for catching this.
2009-06-29 22:22:25 -04:00
Younes Manton
78aaf2a4f1 nouveau: Turn off debug cannon. 2009-06-29 22:22:25 -04:00
Eric Anholt
1f070125e3 intel: Enable EXT_gpu_program_parameters.
There doesn't appear to be any driver impact for enabling this, and
tests/prog_parameter passes.
2009-06-29 15:14:50 -07:00
Brian Paul
b8c479d4b0 Merge branch 'mesa_7_5_branch' 2009-06-29 15:27:49 -06:00
Brian Paul
423f45d18a gallium/draw: sketch out some missing pointcoord code
The gl_PointCoord attribute is currently expected to be in the fog coord
register's z/w components.  This was never totally fleshed out though.
This is just some placeholder code.
2009-06-29 15:27:28 -06:00
Brian Paul
5c06c52116 st/mesa: enable GL_ARB_framebuffer_object
All gallium drivers should be able to support mixed-size color/depth/stencil
buffers.  If not, we'll need a new PIPE_CAP_ query.
2009-06-29 15:27:28 -06:00
Brian Paul
f44638fa61 mesa: check for ARB_framebuffer_object for GL_TEXTURE_STENCIL_SIZE_EXT query 2009-06-29 15:27:28 -06:00
Brian Paul
cb0ea416bd mesa: alphabetize lines 2009-06-29 15:27:28 -06:00
Eric Anholt
a96f86831e Revert "intel: Remove unneded pthread mutex in LOCK_HARDWARE."
This reverts commit de447afff2 but
puts the lock under DRI1-only.

From keithw:
> It's there because the DRI1 code doesn't actually achieve the mutexing
> which it looks as if it should.  For multi-threaded applications it was
> always possible to get two threads inside locked regions -- I have no
> idea how, but it certainly was and presumably still is possible.
2009-06-29 11:39:09 -07:00
Eric Anholt
94008088c1 intel: Move note_unlock() implementation to the one place it's needed. 2009-06-29 10:33:50 -07:00
Eric Anholt
de447afff2 intel: Remove unneded pthread mutex in LOCK_HARDWARE.
This would cause LOCK_HARDWARE to mutex all contexts in this process on
both DRI1 and DRI2.  On DRI1, LOCK_HARDWARE already does it for all
processes on the system.  On DRI2, LOCK_HARDWARE doesn't, but there shouldn't
be any state outside the context that needs any additional protection.
Notably, the bufmgr is protected by its own mutex and not
LOCK_HARDWARE.

This code was originally introduced with the i915tex code dump, so it's not
clear what it was there for.
2009-06-29 10:33:50 -07:00
Eric Anholt
3927874d9c intel: Make LOCK_HARDWARE recursive to avoid hand-rolling recursiveness. 2009-06-29 10:33:50 -07:00
Brian Paul
7b5373c434 Merge branch 'mesa_7_5_branch' 2009-06-29 11:20:07 -06:00
Cooper Yuan
d1bc9a29b9 Fix viewport issue 2009-06-26 17:04:53 +08:00
Cooper Yuan
eaadba6eee Fix color data can't be fetched issue 2009-06-25 19:48:43 +08:00
Cooper Yuan
5e1534f532 correct scissor and cliprect setting 2009-06-23 11:11:19 +08:00
Cooper Yuan
3a3c7fd52e functions declaration with 'extern' 2009-06-22 15:10:57 +08:00
Cooper Yuan
2f6451042d Pass viewport id to r700SendViewportState function, otherwise the radom value may beyond R700_MAX_VIEWPORTS 2009-06-22 14:33:18 +08:00
Cooper Yuan
46ca8e5782 add LINK_STATES for SPI_PS and SEMANTIC 2009-06-22 10:16:01 +08:00
Jakob Bornecrantz
2fe65e8f14 Merge branch 'mesa_7_5_branch' 2009-06-14 16:56:34 +02:00
Dave Airlie
6791576f6c Revert "r200: make use of DMA buffers for Elts a lot better."
This reverts commit 0952645fe0.

Need to revisit where this is going wrong
2009-06-29 20:15:47 +10:00
Corbin Simpson
928a568417 r300g: YCbCr and sRGB textures. 2009-06-27 12:07:59 -07:00
Corbin Simpson
f150e05afc r300g: Fix EXT_packed_depth_stencil functionality.
Allow Z24S8 to be a true texture.
2009-06-27 12:07:59 -07:00
Jakob Bornecrantz
1ac72aedb2 st/dri: Fix last depth bits logic 2009-06-27 19:55:37 +02:00
Nicolai Hähnle
dbb56687c8 radeon: Always initialize front and back renderbuffers if present
This fixes an assertion in glReadPixels from the front buffer.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-06-27 18:16:49 +02:00
Nicolai Hähnle
9fa0d25c54 radeon: Update .gitignore
Add all source files that are symlink'ed from common radeon code to the
ignore list.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-06-27 18:08:44 +02:00
Corbin Simpson
3f15acb7e8 r300g: EXT_provoking_vertex. 2009-06-26 21:48:09 -07:00
Corbin Simpson
6ebcdc7549 r300g: S3TC.
tests/texcompress2 doesn't work, but tests/texcmp does (more or less.)
2009-06-26 21:25:41 -07:00
Corbin Simpson
aac6648cd8 r300g: Use real texture formats.
What bugs me is that the YUV444 format somehow worked properly. :3
2009-06-26 21:25:41 -07:00
Corbin Simpson
7a3224c334 r300g: Definitively forbid unusable Z buffer/stencil formats. 2009-06-26 21:25:40 -07:00
Corbin Simpson
9e7d195fdc r300g: Comment out assert for now.
Will fix with better constant refactoring later.
2009-06-26 21:25:40 -07:00
Corbin Simpson
00ffc90dd2 r300g: Be more specific on surface_copy fallbacks. 2009-06-26 21:25:40 -07:00
Corbin Simpson
6a926f9997 r300g: PIPE_CAP_TGSI_CONT_SUPPORTED. 2009-06-26 21:25:40 -07:00
Corbin Simpson
f80b7f4683 r300-gallium: Ensure that no dirty state goes unemitted. 2009-06-26 21:25:40 -07:00
Brian Paul
f57280cc73 Merge branch 'arb_vertex_array_object' 2009-06-26 17:49:14 -06:00
Brian Paul
a18e209edb Merge branch 'mesa_7_5_branch'
Conflicts:

	Makefile
	src/gallium/drivers/softpipe/sp_screen.c
	src/mesa/main/version.h
2009-06-26 17:07:07 -06:00
Roland Scheidegger
4fdc6ad41b i965: fix fetching constants from constant buffer in glsl path
the driver used to overwrite grf0 then use implicit move by send instruction
to move contents of grf0 to mrf1. However, we must not overwrite grf0 since
it's still used later for fb write.
Instead, do the move directly do mrf1 (we could use implicit move from another
grf reg to mrf1 but since we need a mov to encode the data anyway it doesn't
seem to make sense).
I think the dp_READ/WRITE_16 functions may suffer from the same issue.
While here also remove unnecessary msg_reg_nr parameter from the dataport
functions since always message register 1 is used.
2009-06-26 20:39:49 +02:00
Vinson Lee
d3b46fc77f configs/darwin: Set CXX to g++. 2009-06-26 12:36:45 -06:00
Brian Paul
b2a1ca4fcf docs: document GL_ARB_vertex_array_object 2009-06-22 17:54:16 -06:00
Brian Paul
8affcd364b intel: enable GL_ARB_vertex_array_object extension 2009-06-22 17:54:00 -06:00
Brian Paul
cfb8158058 mesa: plug in glBindVertexArray, glGenVertexArrays functions 2009-06-22 17:52:08 -06:00
Brian Paul
31618f1a88 tests: update bufferobj.c to test GL_ARB_vertex_array_object 2009-06-22 17:51:30 -06:00
Brian Paul
2a795ad522 st/mesa: alphabetize lines 2009-06-22 17:01:44 -06:00
Brian Paul
32220c48ad st/mesa: enable GL_ARB_vertex_array_object 2009-06-22 17:01:00 -06:00
Brian Paul
e2b7249555 mesa: enforce the rule that arrays live in VBOs for GL_ARB_vertex_array_object 2009-06-22 16:56:35 -06:00
Brian Paul
7ebadecd87 mesa: added extension flag for ARB_vertex_array_object 2009-06-22 16:47:45 -06:00
Brian Paul
9342e6f5a9 mesa: implement _mesa_GenVertexArrays() for GL_ARB_vertex_array_object
This also involves adding a gl_array_object::VBOonly field.  For the
ARB extension, all arrays in the object must reside in a VBO.  This flag
keeps track of that requirement.
2009-06-19 18:17:25 -06:00
Brian Paul
b8000c874e mesa: implement _mesa_BindVertexArray() 2009-06-19 18:12:11 -06:00
Brian Paul
12cf98f5fc mesa: move vertex array objects from shared state to per-context
The ARB version requires VAOs to be per-context while the Apple extension
was ambiguous.
2009-06-19 18:11:52 -06:00
Brian Paul
bda551898a mesa: regenerated files related to GL_ARB_vertex_array_object 2009-06-19 18:11:29 -06:00
Brian Paul
54b03948e0 glapi: add new information for GL_ARB_vertex_array_object 2009-06-19 18:11:18 -06:00
Michel Dänzer
dd26899ca3 intel: Fixups for 'mesa: create/destroy buffer objects via driver functions'.
Initialize all driver function hooks before calling _mesa_initialize_context(),
and handle all buffer objects in intel_buffer_object().

Fixes assertion failure when running glxinfo.
2009-06-19 23:55:55 +02:00
Roland Scheidegger
4d2b392a0a radeon: fix cube maps for non-mm path
drm cmd checker would refuse cube emits
also fix an issue in the cs path which would calculate the register
offset off by one dword.
Only same testing done as original code (none except compile tested).
2009-06-19 22:56:32 +02:00
Brian Paul
fa5b81ea8b st/mesa: restore some parameter checking buffer object functions
These functions may be called from the VBO code (not just user GL calls)
so do some parameter sanity checking.
2009-06-19 14:43:55 -06:00
Roland Scheidegger
ffae82da4c r200: fix cube maps for non-mm path
drm cmd checker rightfully fell over any cube emit
2009-06-19 22:32:06 +02:00
Brian Paul
e90d6a3cbf i965: initial code for loops in vertex programs 2009-06-19 12:19:33 -06:00
Brian Paul
fd7d764514 i965: asst clean-ups, etc in brw_vs_emit() 2009-06-19 12:19:33 -06:00
Brian Paul
752204d362 i965: asst clean-ups, var renaming in brw_wm_emit_glsl() 2009-06-19 12:19:33 -06:00
Brian Paul
9d029e0e20 st/mesa: remove redundant st_buffer_object::size field and error checks
Just use the gl_buffer_object::Size field.  Remove unnecessary size/offset
error checks.  Core Mesa will have already done these checks before these
functions are called.
2009-06-19 12:19:15 -06:00
Brian Paul
1ffd074436 st/mesa: no longer special-case buffer object 0 in st_buffer_object() cast wrapper
Since commit 6629a35559 "mesa: create/destroy
buffer objects via driver functions" this is no longer needed, and actually
was causing a crash during context tear-down.
2009-06-19 12:13:15 -06:00
Roland Scheidegger
7ce814b25f radeons: use dp4 for position invariant vertex programs
Fixes #22181. R200 requires this since DP4 is used in hw tnl mode.
R300 prefers it (should be faster due to no instruction dependencies), but
both methods should be correct (when sw tcl is used though, MUL/MAD might
be faster). Probably doesn't make much difference for R100 since vertex progs
are executed in software anyway, but let's just keep it the same there too.
2009-06-19 20:01:14 +02:00
Brian Paul
a8da1feb23 mesa: make query-related driver fallback functions static
Plug them in via _mesa_init_query_object_functions().
2009-06-19 10:05:08 -06:00
Brian Paul
331eb58f68 mesa: make buffer object-related driver fallback functions static
Plug them in via _mesa_init_buffer_object_functions().
2009-06-19 10:00:03 -06:00
Brian Paul
6629a35559 mesa: create/destroy buffer objects via driver functions 2009-06-19 09:58:51 -06:00
Brian Paul
e164210f65 i965simple: use u_reduced_prim() function 2009-06-19 09:48:43 -06:00
Brian Paul
d2e4643767 draw: use u_reduced_prim() function 2009-06-19 09:45:23 -06:00
Brian Paul
09da78c235 softpipe: use u_reduced_prim() 2009-06-19 09:42:37 -06:00
Brian Paul
157d52143a gallium/util: s/boolean/unsigned/ 2009-06-19 09:39:56 -06:00
Brian Paul
b0b8832e6f softpipe: whitespace, reformatting 2009-06-19 09:38:12 -06:00
Brian Paul
9038b6c8bb Merge branch 'ext-provoking-vertex'
Conflicts:

	docs/relnotes-7.6.html
	progs/tests/Makefile
	src/gallium/drivers/softpipe/sp_prim_vbuf.c
	src/glx/x11/indirect.c
	src/mesa/glapi/Makefile
	src/mesa/glapi/dispatch.h
	src/mesa/glapi/glapioffsets.h
	src/mesa/glapi/glapitable.h
	src/mesa/glapi/glapitemp.h
	src/mesa/glapi/glprocs.h
	src/mesa/main/dlist.c
	src/mesa/main/enums.c
	src/mesa/sparc/glapi_sparc.S
	src/mesa/x86-64/glapi_x86-64.S
	src/mesa/x86/glapi_x86.S
2009-06-19 09:15:34 -06:00
Brian Paul
0ddc4dbe43 draw: use flatfirst variable 2009-06-18 23:00:37 -06:00
Brian Paul
9205a871e7 draw: remove debug code 2009-06-18 22:51:41 -06:00
Brian Paul
af5fff9c23 draw: fix first provoking vertex mode for quads, quad strips and polygons 2009-06-18 22:48:51 -06:00
Brian Paul
950171be3c draw: fix first provoking vertex mode for unfilled quads 2009-06-18 22:47:46 -06:00
Brian Paul
601065f153 mesa: fix first provoking vertex mode for unfilled tri strips 2009-06-18 22:45:57 -06:00
Brian Paul
c70a529d7c draw: clean up indentation 2009-06-18 18:33:29 -06:00
Thomas Hellstrom
0342229289 gallium dri st: Probe the driver for supported surface formats.
This is done when constructing the fbconfigs, and the result is saved
for window system framebuffer creation.

Note: For dri2 the server needs to have an identical format selection
logic. Otherwise the dri state-tracker and the xorg driver (state-tracker)
will disagree on which format to use for the attachments. Some more work
is needed in this area.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2009-06-17 03:07:01 +02:00
Thomas Hellstrom
c9f19571da mesa driconf: Add macro to specify an option with a quoted default value.
The default values true and false will expand to "1" and "0" when
gcc -std=c99, causing bool option defaults to generate runtime failures.

One solution is to specify bool option defaults quoted as "true" and "false".
Add a macro to assist this.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2009-06-17 03:07:00 +02:00
Jakob Bornecrantz
edbec6b112 progs/rbug: Add small program to add block rules 2009-06-18 14:36:19 +02:00
Eric Anholt
3addc4e307 i965: Add decode for the G4X x,y offset in surface state. 2009-06-17 21:01:48 -07:00
Eric Anholt
6c3f696891 i965: Fix up texture layout for small things with wide pitches (tiled)
We were packing according to the pitch, while the hardware appears to base
it on the base level width.

With this and the previous commit, fbo-cubemap now matches untiled behavior.
2009-06-17 21:01:48 -07:00
Eric Anholt
0f328c90db i965: Fall back or appropriately adjust offsets of drawing to tiled regions.
3D rendering to tiled textures was being done with non-tile-aligned offsets.
The G4X hardware has fields to let us support it easily and correctly, while
the pre-G4X hardware requires a path full of suffering, so we just fall back.
2009-06-17 21:01:48 -07:00
Dave Airlie
46000cecc3 r300: use vbo_split_prims to split up large vertex buffers.
This lets ut2004 avoid hitting the elt warning.
2009-06-18 13:25:38 +10:00
Eric Anholt
bd10f0e84f i965: Fix tiling for FBO depth attachments by making DEPTH_COMPONENT Y tiled.
This may hurt if miptree relayout occurs, since we can't blit Y tiled
objects.  But it corrects depth tests on FBOs using textures.
2009-06-17 20:19:19 -07:00
Dave Airlie
b165fa7d45 radeon: don't re-add BOs to validate list
if its on the list its on the list don't go readding it.

multitexturing from the same texture could cause this.
2009-06-18 13:16:06 +10:00
Brian Paul
3817a54912 glsl: call _mesa_postprocess_program(), disabled 2009-06-17 09:58:29 -06:00
Brian Paul
516d20fd26 mesa: silence warning 2009-06-17 09:58:29 -06:00
Brian Paul
ec6ad7ba3c mesa: added _mesa_postprocess_program() to aid shader debugging 2009-06-17 09:58:29 -06:00
Jerome Glisse
f806a03361 radeon: Flush command buffer on viewport change
We flush the command buffer so we don't emit mixed
state (with new and previous buffer size) command
buffer, this is especialy affecting zbuffer states.
2009-06-17 16:33:14 +02:00
Jerome Glisse
2506c4e8b1 r300: don't emit vap index offset on r5xx hw when using cs
vap index offset is programmed to 0 by the kernel, it
would add work to kernel checker to allow userspace
programming of this so it's now disallowed with CS
on KMS.
2009-06-17 13:54:09 +02:00
Dave Airlie
77506dac8e GLX: attempt to fix glean makeCurrent test cases.
Two parts to this:

One we don't keep pointers to possibly freed memory anymore once we unbind the
drawables from the context. Brian I need to figure out what the comment
you made there, can we get a glean/piglit test so we can fix it properly?

If the new gc is the same as the oldGC, we call the unbind even though
we just bound it in that function. doh.
2009-06-17 13:59:28 +10:00
Dave Airlie
856221d699 radeon: fix warnings in wrapper with libdrm 2009-06-17 11:12:57 +10:00
Brian Paul
8d48222791 Merge branch 'mesa_7_5_branch'
Conflicts:

	src/mesa/main/api_validate.c
2009-06-16 18:25:52 -06:00
Roland Scheidegger
4ef1f8e3b5 i965: handle OPCODE_SWZ in the glsl path
glsl compiler will not generate OPCODE_SWZ, and as a first step it would
be translated away to a MOV anyway (why?), but later internally this opcode is
generated (for EXT_texture_swizzling).
2009-06-16 21:40:41 +02:00
Brian Paul
1510c3cae1 docs: minor relnotes clean-up 2009-06-15 16:44:26 -06:00
Brian Paul
70d247c69b Merge branch 'arb_map_buffer_range'
Conflicts:

	docs/relnotes-7.6.html
	src/mesa/main/mtypes.h
2009-06-15 16:42:42 -06:00
Brian Paul
01f7bda44c mesa: revert some recent VBO buffer object refcounting changes
Reverts part of commit d7ea9ddf58.
We were calling _mesa_reference_buffer_object() on some heap-allocated
memory that was uninitialized and could trigger an assertion.
We can actually go back to "looser" ref counting of the Null/default
buffer object in these cases.
2009-06-15 10:58:04 -06:00
Brian Paul
b0d874bfbe mesa: regenerated gl_mange.h file 2009-06-15 10:47:07 -06:00
Roland Scheidegger
63c407db3e enable ARB_half_float_pixel for intel drivers 2009-06-15 18:31:03 +02:00
Roland Scheidegger
4ed2c0dddc intel: fix (cosmetic) typo flag used twice 2009-06-15 18:30:51 +02:00
Thomas Hellstrom
f5888d9ca5 Merge branch 'mesa_7_5_branch'
Conflicts:

	progs/util/extfuncs.h
2009-06-15 11:43:48 +02:00
Maciej Cencora
e0eafde746 r300: fix 3D textures 2009-06-15 01:07:19 +02:00
Jakob Bornecrantz
6530fabb93 Merge branch 'mesa_7_5_branch' 2009-06-14 06:32:47 +02:00
Jakob Bornecrantz
210ad58ee3 trace: Don't write state objects to file if dumping is not set 2009-06-14 06:07:50 +02:00
Keith Whitwell
0cce6d7e33 tgsi: correct handling of return value from util_vsnprintf
We were failing to deal with:
  - vsnprintf returns negative value on error.
  - vsnprintf returns the number of chars that *would* have been
    written on truncation.
2009-06-26 13:43:10 +01:00
Dave Airlie
0952645fe0 r200: make use of DMA buffers for Elts a lot better.
This allows us to return the unused portion of the dma buffer
to the allocator instead of wasting nearly 16k a pop.
2009-06-26 15:09:12 +10:00
Dave Airlie
db54579628 r200: only emit unitneeded textures 2009-06-26 15:09:11 +10:00
Joakim Sindholt
622858884f r300-gallium: organize fragment/vertex shaders
Appart from separating r3xx/r5xx fragment shaders, a more consistent
naming scheme has been applied. From now on:
r300 = all chips
r3xx = R300/R400 only
r5xx = R500 only
This way r300_fragment_shader is the master struct, and the structs
r3xx_fragment_shader and r5xx_fragment_shader inherits it.
2009-06-26 01:13:06 +02:00
Vinson Lee
450b20d1ef gallium: Add PIPE_OS_APPLE token. 2009-06-25 09:52:50 -06:00
Jakob Bornecrantz
e99d13bbc6 progs/tests: Add yet another mipmap test 2009-06-14 01:44:34 +02:00
Roland Scheidegger
43b3b745e4 radeon: fix hw texture limits
still always enable max, but the right values this time.
More work should probably be done for saner limits without mm, and/or
dri conf option allow_large_textures (which is ignored) removed.
3D limit on r100 is pretty arbitrary as still handled by swrast anyway.
Also fix r300 limits (except 3d I've no idea what the max is anyway so
keep using mesa default).
2009-06-25 15:57:33 +02:00
Dave Airlie
cdbcb051d9 radeon/r200: add some hw texture limits 2009-06-25 13:26:52 +10:00
Dave Airlie
69fd0cbaa2 radeon: fix stupidity in cs space check code.
This was already correct in the GEM code
2009-06-25 12:13:17 +10:00
Brian Paul
bc5c40d7d9 intel: fix additional merge conflicts missed in previous commit 2009-06-24 08:57:48 -06:00
Brian Paul
a04af335a4 Merge branch 'mesa_7_5_branch'
Conflicts:

	src/mesa/drivers/dri/i915/i915_tex_layout.c
	src/mesa/drivers/dri/i965/brw_wm_glsl.c
	src/mesa/drivers/dri/intel/intel_buffer_objects.c
	src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
	src/mesa/drivers/dri/intel/intel_pixel_draw.c
	src/mesa/main/enums.c
	src/mesa/main/texstate.c
	src/mesa/vbo/vbo_exec_array.c
2009-06-24 08:54:37 -06:00
Jakob Bornecrantz
d60b2c6855 identity: Add new identity driver
This driver does no transformation of the gallium calls
	going to the real driver, like the identity matrix. It is
	intended to be the basis for transforming and/or debug
	drivers like trace and rbug.

	Authors of this patch are:
		Michal Krol, orignal heavy lifting.
		José Fonesca, object wrapping code stolen from trace.
		Jakob Bornecrantz, put it all toghether and renamed a stuff.
2009-06-24 13:04:56 +02:00
Eric Anholt
b8e638d489 i965: Disable texture tiling by default.
I haven't fixed all the regressions yet, and it'll be easy to re-enable when
the known problems are fixed.
2009-06-23 19:31:43 -07:00
Eric Anholt
b72dea5441 i965: Set the max index buffer address correctly according to the docs.
It's the last addressable byte, not the byte after the end of the buffer.
2009-06-23 19:31:13 -07:00
Eric Anholt
d43599afef i965: Don't set a reserved bit in MI_FLUSH.
I noticed this when this MI_FLUSH showed up in IPEHR for the ut2004 hang.
Not setting the reserved bit didn't help, though.
2009-06-23 19:31:13 -07:00
Eric Anholt
5ca800e100 dri2: Refresh the fake front contents after glXSwapBuffers().
Bug #19177.

Reviewed by: Ian Romanick <ian.d.romanick@intel.com>
2009-06-23 19:31:12 -07:00
Eric Anholt
9c0ba017c8 i965: Fix depth-texture Y-tiling detection for sized internal formats.
Fixes assertion failure on norsetto shadow mapping demo.
2009-06-23 19:31:12 -07:00
Eric Anholt
e0a4e25f93 i965: Fix packed depth/stencil textures to be Y-tiled as well.
Fixes shadowtex.c.  And an assert is added to catch this sooner next time.
2009-06-23 19:31:12 -07:00
Eric Anholt
1593a1bb34 intel: Bail on blits with non-tile-aligned offsets. 2009-06-23 19:31:12 -07:00
Eric Anholt
8f81a6468f intel: Avoid trying to do blits to Y tiled regions.
This is somewhat nasty, but we need to do Y-tiled depth for FBO support.
May help with corruption and hangs since enabling texture tiling, and
since switching depth textures to Y tiled.

Fixes piglit depthtex.c on 965.
2009-06-23 19:31:11 -07:00
Eric Anholt
246d59c29e intel: Fix some potential writes to zero-copy PBOs when used as regions.
I was in the midst of fixing some blitting-with-Y-tiled issues when I
noticed this.  Hopefully PBO usage will be a little more robust, as a
result.
2009-06-23 19:31:11 -07:00
Eric Anholt
6a49473ab5 intel: Remove long-unused intel_region_fill and intelEmitFillBlit. 2009-06-23 19:31:10 -07:00
Eric Anholt
a9b03aaebf intel: Refuse to do texture tiling if we don't have the kernel support. 2009-06-23 19:31:10 -07:00
Pauli Nieminen
4f1e141c11 Fix crash when debug output is enabled and sarea is notset in r200Clear 2009-06-23 16:43:00 +02:00
Ian Romanick
70e72070fc mesa: From float type modifier from values to large for singles
The values 2147483648.0 and 4294967294.0 are too larget to be stored in single
precision floats.  Forcing these to be singles causes bits to be lost, which
results in errors in some pixel transfer tests.

This fixes bug #22344.
2009-06-22 18:22:51 -07:00
Brian Paul
a31118c25a st/mesa: fix setup_edgeflags() regression
stobj is now non-null for the default/null buffer object.  Update the
test to check the buffer ID to see if it's a real buffer object.
2009-06-22 17:49:22 -06:00
Jakob Bornecrantz
7a879500ac gallium-intel: Improve Xorg Makefile a bit
The real solution is to create a Makefile.template for xorg
	drivers and use that here.
2009-06-22 23:45:02 +02:00
Jakob Bornecrantz
23170ab236 st/xorg: Convert to template makefile 2009-06-22 23:34:18 +02:00
Jakob Bornecrantz
5d0a1d4241 st/dri: Fix typo when checking for depth formats 2009-06-22 23:34:18 +02:00
Eric Anholt
c80ce5ac90 i965: Fix warnings in intel_pixel_read.c. 2009-06-22 08:52:52 -07:00
Michel Dänzer
2c36ed9067 intel: Fix glReadPixels regression since changing context init order.
Fixes regression in dd26899ca3 that also
affected some PBO operations.
2009-06-22 08:45:45 -07:00
Eric Anholt
df70d3049a intel: Also get the DRI2 front buffer when doing front buffer reading. 2009-06-19 22:18:16 -07:00
Eric Anholt
afc981ee46 intel: Update Mesa state before span setup in glReadPixels.
We could have mapped the wrong set of draw buffers.  Noticed while looking
into a DRI2 glean ReadPixels issue.
2009-06-19 22:17:46 -07:00
Eric Anholt
dcfe0d66bf intel: Move intel_pixel_read.c to shared for use with i965. 2009-06-19 22:16:16 -07:00
Eric Anholt
3b08a43f32 intel: Don't map regions with drm_intel_gem_bo_map_gtt() unless they're tiled.
This fixes a regression in region read performance that came in with the
texture tiling changes.  Ideally we'd have an access flag coming in so we
could also use bo_map_gtt for writing, like we do for buffer objects.

Bug #22190
2009-06-19 17:25:20 -07:00
Eric Anholt
405300bb19 intel: Fix other metaops versus GL_COMPILE_AND_EXECUTE dlists.
Fixes oglconform zbfunc.c and pxtrans-cidraw.c, at least.
2009-06-19 16:43:45 -07:00
Eric Anholt
64edde1004 intel: Fix glClear behavior versus display lists.
The CALL_DrawArrays was leaking the clear's primitives into the display
list with GL_COMPILE_AND_EXECUTE.  Use _mesa_DrawArrays instead, which
doesn't appear to leak.  Fixes piglit dlist-clear test.
2009-06-19 16:43:45 -07:00
Eric Anholt
396b4043f0 mesa: Make VBO dlist printing use the same path as other dlist printing.
I was rather confused when mesa_print_display_list didn't show any of
my glBegin()..glEnd().  Nothing but print_list appears to call
this function, so matching its behavior seems like a good idea.
2009-06-19 16:43:45 -07:00
Chia-I Wu
cca30245bd intel: Do not access pbo's buffer directly when attaching.
pbo might be system buffer based or attached to another region.  Call
intel_bufferobj_buffer to make sure pbo has a buffer of its own.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-06-19 16:43:45 -07:00
Chia-I Wu
ed91389618 intel: Data are copied in the wrong direction when breaking COW tie.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-06-19 16:43:45 -07:00
Chia-I Wu
1a7ec317ef intel: Fix migration from sys_buffer in intel_bufferobj_buffer.
intel_bufferobj_subdata is called to migrate data from sys_buffer, and
it expects only one of buffer or sys_buffer is non-NULL.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-06-19 16:43:45 -07:00
Roland Scheidegger
402df41c1c radeon: make cubemap mipmap generation work
need to pass target parameter to radeon_teximage/radeon_subteximage functions
otherwise mipmap generation for cube maps can't work (assert/segfault in
_mesa_generate_mipmap)
2009-06-20 00:28:39 +02:00
Roland Scheidegger
7a5c5b9af3 demos: make cubemap work without EXT_fbo support
use SGIS_generate_mipmap if EXT_fbo support (for manual mipmap generation)
is not available.
2009-06-20 00:28:38 +02:00
Brian Paul
18af7c384c i965: interpolate colors with perspective correction by default
...rather than with linear interpolation.  Modern hardware should use
perspective-corrected interpolation for colors (as for texcoords).
glHint(GL_PERSPECTIVE_CORRECTION_HINT, mode) can be used to get
linear interpolation if mode = GL_FASTEST.
2009-06-12 16:21:20 -06:00
Brian Paul
05f0d90962 mesa: use larger initial refcount for NullBufferObj
Refcounting of the null/default buffer object isn't perfect yet so be
extra safe.
2009-06-12 16:01:02 -06:00
Brian Paul
0854b7e972 mesa: use _mesa_reference_buffer_object() in a few places 2009-06-12 16:01:02 -06:00
Brian Paul
d7ea9ddf58 mesa: use _mesa_reference_buffer_object() in a few places 2009-06-12 16:01:02 -06:00
Brian Paul
193177b732 tests: added persp_hint.c test
Test the effect of GL_PERSPECTIVE_CORRECTION_HINT on color interpolation.
2009-06-12 15:59:53 -06:00
Dave Airlie
c4a5754a8c add some info to relnotes on radeon 2009-06-13 07:43:04 +10:00
Maciej Cencora
4109108739 r300: add support for EXT_texture_sRGB
Tested with glean/texture_srgb and wine/d3d9 tests on RV535
2009-06-12 19:08:44 +02:00
Brian Paul
d0b0df380a set/mesa: enable GL_NV_texture_env_combine4
This is handled entirely in core Mesa where the combiner state is converted
into a fragment program.
2009-06-12 10:18:15 -06:00
Alex Deucher
1036ef2bf4 Merge master and fix conflicts 2009-06-12 12:09:34 -04:00
Brian Paul
5379f35a15 tests: added arbgpuprog, for compile-testing ARB vertex/fragment programs 2009-06-12 08:16:18 -06:00
Brian Paul
509d9eb686 st/mesa: additional debug code (disabled) 2009-06-12 08:16:18 -06:00
Jakob Bornecrantz
1cd0afffc9 progs/rbug: Add binary to bmp converter program 2009-06-12 15:07:57 +01:00
Jakob Bornecrantz
3fff84a999 Merge branch 'mesa_7_5_branch' 2009-06-12 12:31:04 +01:00
John Lee
11a4292d4e Add external/expat/lib since we need expat.h to compile. 2009-06-12 12:18:44 +08:00
Owen W. Taylor
279143c6e8 Disable SGI_swap_control extension for DRI2
We currently don't have support for SGI_swap_control for direct
contexts with DRI2, so disable reporting the extension. Reporting
the extension, and then having glXSwapIntervalSGI() "succeed"
but do nothing can confuse applications.

https://bugs.freedesktop.org/show_bug.cgi?id=22123
2009-06-12 11:41:37 +10:00
Dave Airlie
d0fab94842 radeon: fix size of mipmap texture array 2009-06-12 11:37:13 +10:00
Dave Airlie
a5d92d7ed2 radeon/r200/r300: fix max texture levels assert
use the actual value set in the context
2009-06-12 11:35:10 +10:00
Dave Airlie
7f223ff891 Merge remote branch 'main/radeon-rewrite' 2009-06-12 11:17:32 +10:00
Alex Deucher
917f8bc1a8 Add RV740 support 2009-06-11 18:24:41 -04:00
Maciej Cencora
67bbfb9c68 r300: fix VAP setup
If GL context had e.g. tex0, tex2 and fog the VAPOutputCntl1 returned 0x104 instead of 0x124 - that meaned we're sending only 8 texcoords (instead of 12) which ended up in GPU hang.
2009-06-11 23:25:54 +02:00
Maciej Cencora
234797564d r300: fix for SW TCL path
We shouldn't use i variable for SWTCL_OVM_TEX because textures doesn't have to be enabled in "packed" order.
We could have tex1,tex3 and fog which would receive 7,9,8 OVM locations instead of 6,7,8.
2009-06-11 23:25:54 +02:00
Maciej Cencora
8d728b8fe7 r300: don't send unused attributes for SW TCL path 2009-06-11 23:25:54 +02:00
Maciej Cencora
b5d49cb195 r300: send only RS_IP_* regs that we are going to use 2009-06-11 23:25:53 +02:00
Maciej Cencora
2b5f8d2b55 r300: fix RS setup when no colors and textures are sent to FP
RS_COL_FMT field is part of RS_IP_* reg not RS_INST_*
2009-06-11 23:25:53 +02:00
Maciej Cencora
34cb4b6be3 r300: r500 fragment program fixes
- when rewriting per component negate swizzle, first instruction should get not negated source
- KIL instruction ignores swizzles

TODO:
- tex instructions does not support saturation
- tex instructions cannot read from consant memory
2009-06-11 23:25:53 +02:00
Maciej Cencora
e21e82f425 radeon: increase max bo count 2009-06-11 23:25:53 +02:00
Maciej Cencora
9abc72d1fc r300: fix a GPU lock up
Sending from VAP more texture coordinates than RS expects results in GPU hang.

Fixes BumpSelfShadow from DirectX8 SDK.
2009-06-11 23:24:25 +02:00
Maciej Cencora
de19eb0b0d r300: fix vertex program bug
If the vertex program didn't write position attribute, the position invariant function would add necessary instructions, but the vertex position would be overwritten by artificial outputs insts added to satisfy fragment program requirements.

Fixes "whole screen is gray" problem for HW TCL path in sauerbraten when shaders are enabled, and whole slew of wine d3d9 tests.
2009-06-11 23:24:25 +02:00
Maciej Cencora
2611e92da5 r300: move some code for easier debugging 2009-06-11 23:24:25 +02:00
Maciej Cencora
52645c4647 r300: print vertex program when debugging is enabled 2009-06-11 23:24:25 +02:00
Maciej Cencora
28724b575d r300: fix output register allocation for vertex shaders
If the vertex program wrote secondary color without primary color, the secondary color output register index would be 0 which resulted in overwriting vertex position in some cases.
2009-06-11 23:24:25 +02:00
Maciej Cencora
b4ebd1c191 r300: hw doesn't support saturation for tex instructions 2009-06-11 23:24:25 +02:00
José Fonseca
877061141a Merge branch 'mesa_7_5_branch' 2009-06-11 19:03:54 +01:00
José Fonseca
bf89ecb6c9 Merge branch 'mesa_7_5_branch'
Conflicts:
	src/mesa/state_tracker/st_cb_fbo.c
	src/mesa/state_tracker/st_framebuffer.c
2009-06-11 16:34:56 +01:00
Jerome Glisse
b445e54868 r300: fix indexed primitive rendering when using memory manager 2009-06-11 11:06:14 +02:00
Alex Deucher
1d8d4cad6a Properly set aos_count
This is used by radeonReleaseArrays to free AOS.
2009-06-11 01:54:40 -04:00
Thomas Hellstrom
0d2ac7a10b dri st: Don't require the PIPE_TEXTURE_USAGE_RENDER_TARGET property for depth- and stencil renderbuffers.
Signed-off-by: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
2009-06-11 00:56:03 +02:00
Michel Dänzer
550a2fe1b7 scons: Indent abbreviated command line strings, so command messages stand out.
Also add ASPPCOMSTR.
2009-06-11 12:15:50 +02:00
Michel Dänzer
3885b708fd intel: intel_texture_drawpixels() can't handle GL_DEPTH_STENCIL.
Fixes glean depthStencil test.
2009-06-11 12:09:10 +02:00
Alex Deucher
7ac2f655f8 move radeon_set_screen_flags() up so CHIP_FAMILY is set before using it
fixes last commit.
2009-06-10 18:02:20 -04:00
Alex Deucher
51507b0e94 Use correct scratch reg offset for r6xx/r7xx 2009-06-10 17:56:05 -04:00
Brian Paul
7fdd64ab29 glsl: fix warnings, update comments, s/TRUE/GL_TRUE/ 2009-06-10 12:16:15 -06:00
Michal Krol
cc22620e4b glsl: Handle continuation characters in preprocessor. 2009-06-10 20:00:15 +02:00
Brian Paul
aebc08b5cc gallium: updated PIPE_CAP_x comments 2009-06-10 08:12:19 -06:00
Jerome Glisse
316598b96f r300: make sure indexed rendering doesn't try to use more than the num of vertices
When with memory manager we need to make sure the GPU won't try to access
beyond vertex buffer size, do so by enforcing that the maximun index is the
last vertex of the buffer.
2009-06-10 14:59:33 +02:00
Brian Paul
ded8eb25ef st/mesa: enable EXT_provoking_vertex 2009-06-09 22:01:55 -06:00
Brian Paul
0195cc1c0d tests: prim.c demo, modified for GL_EXT_provoking_vertex 2009-06-09 22:00:22 -06:00
Brian Paul
39fd18014c tests: need tkmap.c for prim.c 2009-06-09 21:59:36 -06:00
Brian Paul
8b45c9ce6e draw: implement flatshade_first for drawing pipeline 2009-06-09 21:53:34 -06:00
Brian Paul
5aec03aaf4 softpipe: implement flatshade_first for triangles 2009-06-09 21:52:37 -06:00
Brian Paul
6f26f8c750 softpipe: implement flatshade_first for line setup 2009-06-09 21:51:29 -06:00
Alex Deucher
530e3e389d Pull in additional state setup from the DDX 2009-06-09 18:20:57 -04:00
Jakob Bornecrantz
ee98ae5a29 Merge branch 'mesa_7_5_branch'
Conflicts:

	Makefile
	src/mesa/main/version.h
	src/mesa/shader/slang/slang_preprocess.c
	src/mesa/state_tracker/st_cb_bufferobjects.c
2009-06-09 07:53:25 +02:00
Michal Krol
d9617deb00 glsl: Fix symbol replacement handling in preprocessor. 2009-06-10 12:15:13 +02:00
Michal Krol
03760a3903 winsys/gdi: Link to ws2_32 library. 2009-06-10 12:01:13 +02:00
Michal Krol
1b334587e9 trace: __func__ --> __FUNCTION__. 2009-06-10 11:56:38 +02:00
Eric Anholt
b30dc2c66a i915: Add an option for testing the effect of early Z in classic mode.
The early Z stuff is supposed to be unsafe without some more work in the
enable/disable path (in particular, how do we want to get it disabled on
the way out to the X Server?), but at the moment is 6% in OA.
2009-06-09 16:12:43 -07:00
Eric Anholt
38eddf04ed intel: Remove an unneeded hunk that slipped in with texture tiling.
intel_miptree_pitch_align does this later on.
2009-06-09 15:21:17 -07:00
Eric Anholt
1362484840 intel: Base tri clearing depth on Y tiling, not IS_I965().
Y tiling is why the 965 check was there, but I wanted to experiment with Y
on pre-965 as well.
2009-06-09 15:21:17 -07:00
Eric Anholt
2d57e96408 intel: Fix intel_region_unmap to do unmap, not map.
Thanks to Shuang He for catching this.
2009-06-09 15:21:16 -07:00
Brian Paul
a03b349153 i965: added intelFlush() call in intel_get_tex_image()
Fixes the render-to-texture test in progs/tests/getteximage.c
2009-06-09 15:07:39 -06:00
Brian Paul
29c79a03a4 tests: check for GL_EXT/ARB_framebuffer_object 2009-06-09 15:06:41 -06:00
Brian Paul
073c20befa tests: also test glGetTexImage with render to texture
Also, adjust texture dims for the original test.
And use GLEW.
2009-06-09 15:05:36 -06:00
Brian Paul
139f2ddde4 tests: quick and dirty glGetTexImage() test program 2009-06-09 14:05:17 -06:00
Brian Paul
b38dbc5179 intel: use GLboolean, not int, for compressed parameter 2009-06-09 14:05:17 -06:00
Brian Paul
89205a8760 intel: make a bunch of glTexImage-related functions static 2009-06-09 14:05:17 -06:00
Brian Paul
4eb9e58bbb intel: whitespace clean-ups 2009-06-09 14:05:17 -06:00
Brian Paul
c55f1a6c99 vbo: more glDrawElements debug code (disabled) 2009-06-09 14:05:17 -06:00
Brian Paul
4a7fd6323a mesa: added a simple bounds checker to glMap/UnmapBuffer() (disabled) 2009-06-09 14:05:17 -06:00
Jakob Bornecrantz
41482a6461 trace/rbug: Add support for draw block rule 2009-06-09 19:24:06 +01:00
Jakob Bornecrantz
f3cf3d2fc2 rbug: Change block protocol around a bit 2009-06-09 19:22:40 +01:00
Jakob Bornecrantz
b71a254f05 trace/rbug: Return textures currently bound to context 2009-06-09 16:00:40 +01:00
Jakob Bornecrantz
f0c21c0294 rbug: Extend context info and block ops 2009-06-09 16:00:39 +01:00
Brian Paul
42e9bde0fa intel: remove extra \n from warning string 2009-06-09 08:53:56 -06:00
Brian Paul
a81097c545 mesa: reorder fields, update comments for gl_buffer_object 2009-06-09 08:52:56 -06:00
Michal Krol
ef8caec29a glsl: Expand nested preprocessor macros. 2009-06-09 12:14:40 +02:00
Dave Airlie
18b3cbcede radeon: fix mipmap_limits crasher.
This gets the correct srclvl image map when uploading images to the new mipmap.
2009-06-09 13:52:58 +10:00
Corbin Simpson
c534604800 r300-gallium: HW TCL glxgears. (Read the rest of the log.)
Um. So, yeah. Two massive WTF moments here. The first one is that, somehow,
I never actually hooked up vertex shader emission, so the only time that the
VAP gets set up is during surface_copy/surface_fill. That's why acidgears
was happening.

The second one is that, somehow, once I actually hooked it up, glxgears just
magically worked. Without any actual, real testing, I somehow accidentally
made the shader compiler work. Go figure.
2009-06-08 20:23:34 -07:00
Corbin Simpson
cb3b91f2d6 r300-gallium: Make UCP and clip work again for SW TCL.
SW TCL: tri-clip works, tri-userclip works
HW TCL: tri-clip fails, tri-userclip works

That is a 200% improvement over the previous situation. Woot.
2009-06-08 20:01:57 -07:00
Corbin Simpson
ffa1972efb r300-gallium: Don't emit UCP planes for SW TCL. 2009-06-08 19:55:33 -07:00
Brian Paul
8d0f72e8f9 st/mesa: enable GL_ARB_map_buffer_range 2009-06-08 17:07:21 -06:00
Brian Paul
e297569d65 docs: new feature: GL_ARB_map_buffer_range 2009-06-08 17:06:13 -06:00
Brian Paul
e75b283b45 mesa: implement GL_ARB_map_buffer_range
Only enabled for software drivers at this point.

Note that the gl_buffer_object::Access enum field has been replaced by
a gl_buffer_object::AccessFlags bitfield.  The new field is a mask of
the GL_MAP_x_BIT flags which is a superset of the old GL_READ_ONLY,
GL_WRITE_ONLY and GL_READ_WRITE modes.  When we query GL_BUFFER_ACCESS_ARB
we translate the bitfield into the conventional enum values.
2009-06-08 17:02:36 -06:00
Brian Paul
75cb3c3b7a mesa: regenerated files for GL_ARB_map_buffer_range 2009-06-08 17:00:12 -06:00
Brian Paul
9c4ab6f4cc glapi: hook in ARB_map_buffer_range.xml 2009-06-08 16:59:53 -06:00
Brian Paul
b6bc5f37a5 glapi: spec/xml file for GL_ARB_map_buffer_range 2009-06-08 16:58:45 -06:00
Brian Paul
462a9525c7 mesa: reorder fields, update comments for gl_buffer_object 2009-06-08 15:27:10 -06:00
Michal Krol
19a54d9f10 glsl: Fix preprocessor define argument parsing for dead sections. 2009-06-08 20:52:47 +02:00
Brian Paul
854151ba62 glsl: preprocessor debug code (disabled) 2009-06-08 10:58:04 -06:00
Brian Paul
cc26e27746 docs: document MESA_EXTENSION_OVERRIDE env var 2009-06-08 10:56:51 -06:00
Brian Paul
f9c0ce0e07 softpipe: advertise PIPE_CAP_MAX_TEXTURE_ANISOTROPY as 16.0
Note that this doesn't have any real significance since
PIPE_CAP_ANISOTROPIC_FILTER still returns 0.
2009-06-08 10:55:34 -06:00
Brian Paul
a6f2663616 mesa: new MESA_EXTENSION_OVERRIDE env var
Can be used to enable/disable extensions as reported by
glGetString(GL_EXTENSIONS).

If a name is preceeded by '-' it's disabled.  Otherwise, the named
extension is enabled.

Intended for debug/test purposes.
2009-06-08 10:52:16 -06:00
Maciej Cencora
4adb190a16 mesa: EXT_vertex_array_bgra fixes
1) Pass the correct format when calling update_array in
   _mesa_VertexAttribPointerARB.
2) glVertexAttribPointerNV accepts GL_BGRA format too.
3) raise INVALID_VALUE error when format is BGRA and normalized is
   false in glVertexAttribPointerARB
2009-06-08 07:23:56 -06:00
Jakob Bornecrantz
8d2324d355 trace/rbug: Sleep on windows when blocked 2009-06-08 15:01:48 +02:00
Dave Airlie
8064a517b2 llvm: fix compile on gcc 4.4 2009-06-08 18:26:27 +10:00
Chia-I Wu
07cc2311a8 Create Android.mk.
utils.h is soft linked to avoid conflict with libutils's header.
2009-06-08 11:51:38 +08:00
Maciej Cencora
db63f63897 r300: fix regression caused by 056bc77547c304021a0faf204897ed238a5cf424
Fixes GPU hangs in software TCL path
2009-06-08 07:21:14 +10:00
Ben Skeggs
1a7739ae26 nouveau: forgotten makefile... 2009-06-07 19:29:29 +10:00
Dave Airlie
545e574cd9 Merge remote branch 'origin/master' into radeon-rewrite 2009-06-07 16:51:32 +10:00
Michel Dänzer
e2aedfa620 r300: Endianness fixes for recent vertex path changes.
Signed-off-by: Maciej Cencora <m.cencora@gmail.com>
2009-06-07 16:40:09 +10:00
Maciej Cencora
58982f8af1 r300: vertex array stride = 0 means that data are tightly packed in the array 2009-06-07 16:40:04 +10:00
Maciej Cencora
ca13937ef9 r300: GL_(U)SHORT and GL_(U)BYTE with < 4 components can also be HW accelerated
Also when index format is GL_UBYTE, convert it to GL_USHORT not GL_UINT.
Fix license header too.

Reported by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-06-07 16:39:58 +10:00
Maciej Cencora
a8c7c96be7 r300: remove unused code 2009-06-07 16:39:54 +10:00
Maciej Cencora
72c78b9992 r300: rewrite vertex setup for software T&L path using functions from software TCL path 2009-06-07 16:39:47 +10:00
Maciej Cencora
6cd0628f9f r300: prepare for some code duplication removal 2009-06-07 16:39:43 +10:00
Maciej Cencora
365799caea r300: enable EXT_vertex_array_bgra extensions 2009-06-07 16:39:39 +10:00
Maciej Cencora
fd80128e15 r300: add hw accelerated support for different vertex data formats 2009-06-07 16:39:33 +10:00
Maciej Cencora
e98082997c r300: prepare for different vertex data type support 2009-06-07 16:39:28 +10:00
Maciej Cencora
a27b689d08 r300: fixup vertex attributes ordering
Always allocate the vertex program input registers in the same order as the vertex attributes are passed in vertex arrays.
2009-06-07 16:39:23 +10:00
Maciej Cencora
ab60a44331 r300: always pass 4 color components to RS unit
Even if we don't pass all 4 color components to vertex shader unit, the vertex program can generate the missing components.
2009-06-07 16:39:16 +10:00
Ben Skeggs
f1edfa09ea nv50: fix multi-texturing 2009-06-06 16:24:09 +10:00
Ben Skeggs
6c1627a51c nv50: support non-normalized texture coords 2009-06-06 16:24:08 +10:00
Corbin Simpson
b7aa5b1d10 r300-gallium: Use VAP_CLIP_CNTL.
Makes tri-userclip work with HW TCL.
2009-06-05 13:46:59 -07:00
Corbin Simpson
1a359d9835 r300-gallium: Emit UCP. 2009-06-05 11:21:09 -07:00
Corbin Simpson
9e4590dff7 r300-gallium: Improve vs emit. 2009-06-05 10:18:20 -07:00
Michal Krol
4c034441a8 mesa: Fix wglext.h prototypes. 2009-06-05 15:01:08 +02:00
Ben Skeggs
d06e380e02 nv50: use larger tile sizes 2009-06-05 22:53:24 +10:00
Ben Skeggs
a471497345 nv50: use nouveau_bo for query buffers 2009-06-05 22:53:24 +10:00
Ben Skeggs
1a92c71a66 nv50: create textures with nouveau_bo, for flexibility with tiling later 2009-06-05 22:53:23 +10:00
Michal Krol
b04470b0bc util: Fix winsock include. 2009-06-05 14:32:31 +02:00
Corbin Simpson
90bfff0a29 r300-gallium: Mute some debug info.
Most of it is no longer interesting.
2009-06-05 00:12:26 -07:00
Corbin Simpson
4c66c5bf92 r300-gallium: vs: Fix negation calculation.
Still doesn't draw right, but at least it's the right numbers now.
Thanks to taiu in #dri-devel.
2009-06-04 23:56:32 -07:00
Corbin Simpson
571b36831b r300-gallium: Fix pasta.
Trivial but annoying.
2009-06-04 23:56:08 -07:00
Corbin Simpson
8652ad6899 r300-gallium: Improve vs debug more.
Still not showing me why my stuff's failing, but getting there.
2009-06-04 23:27:46 -07:00
Corbin Simpson
31609acbe9 r300-gallium: vs: Add negation, SUB.
Doesn't work. WTF.
2009-06-04 23:27:46 -07:00
Corbin Simpson
fb7d1fb0f0 r300: Moar vs debug. 2009-06-04 23:27:46 -07:00
Ben Skeggs
36705ee044 nouveau: plug in our map_buffer_range and friends 2009-06-05 14:48:45 +10:00
Ben Skeggs
40ed449918 nouveau: fix build with libdrm_nouveau 0.6 2009-06-05 14:37:04 +10:00
Ben Skeggs
6b3ca672eb nouveau: remove unneeded code from ws, use pipe_buffer_ instead of ws-> 2009-06-05 14:37:03 +10:00
Ben Skeggs
80e9e1ee81 nouveau: move channel creation into pipe drivers 2009-06-05 14:37:03 +10:00
Ben Skeggs
1b207d9bb8 nouveau: call notifier/grobj etc funcs directly
libdrm_nouveau is linked with the winsys, there's no good reason to do all
this through yet another layer.
2009-06-05 14:37:03 +10:00
Ben Skeggs
d4d584b16e nv04: remove u_simple_screen usage 2009-06-05 14:37:02 +10:00
Ben Skeggs
251c47117b nv10: remove u_simple_screen usage 2009-06-05 14:37:02 +10:00
Ben Skeggs
74c45add47 nv20: remove u_simple_screen usage 2009-06-05 14:37:01 +10:00
Ben Skeggs
901d7c3057 nv30: remove u_simple_screen usage 2009-06-05 14:37:01 +10:00
Ben Skeggs
74adb150d5 nv40: remove u_simple_screen usage 2009-06-05 14:37:01 +10:00
Ben Skeggs
bc466be695 nouveau: add pipe_buffer/fence code to pipe drivers, move nv50 over 2009-06-05 14:37:01 +10:00
Ben Skeggs
072fdc1fd3 nouveau: pass nouveau_bo instead of pipe_buffer to so_ calls 2009-06-05 14:37:00 +10:00
Ben Skeggs
04cef8a037 nouveau: call nouveau_pushbuf directly rather than going through nvws 2009-06-05 14:37:00 +10:00
Dan Nicholson
4795dd5950 osmesa: Link with -ldl for dlopen code
Now that the dlopen wrappers are built into libmesa.a, we need to link
standalone libOSMesa with libdl to resolve dlopen and friends on
platforms that need it.
2009-06-04 19:45:32 -07:00
Dan Nicholson
7441dcd90b osmesa: Allow building standalone in all three channel widths
autoconf had been designating the 8 bit libOSMesa as the default
standalone osmesa, but the Makefile expected it to be linked to libGL.
Fix up the osmesa Makefile so that it allows any of the combinations of
standalone and channel width to be built.

Fixes bug #21980.
2009-06-04 19:04:36 -07:00
Jakob Bornecrantz
61ffba44fd trace/rbug: Use condvar on system that has it for blocking 2009-06-05 03:01:34 +01:00
Jakob Bornecrantz
d4c578ae41 gallium: Make pipe thread say if it has condvars or not 2009-06-05 02:57:19 +01:00
Alex Deucher
8c27d99eb8 re-arrange state structure
- split out renderbuffers
- split out shaders
- split our viewports

Only send the state needed.
2009-06-04 20:22:14 -04:00
Jakob Bornecrantz
76b3072e9b trace/rbug: Add new contexts functions to trace rbug 2009-06-04 23:45:29 +01:00
Jakob Bornecrantz
384bbe278d rbug: Update rbug protocol with new context calls 2009-06-04 23:45:29 +01:00
Alex Deucher
b591436230 Don't program VGT_OUT_DEALLOC_CNTL/VGT_VERTEX_REUSE_BLOCK_CNTL
These are chip specific and are programmed by the drm.
This should fix hangs on some chips.
2009-06-04 16:57:20 -04:00
Brian Paul
185fbcce36 mesa: call _mesa_ funcs, not gl funcs for debugging 2009-06-04 14:26:51 -06:00
Alex Deucher
4782bebe44 use the float interface for viewport updates 2009-06-04 15:30:37 -04:00
Brian Paul
9d58724c51 Merge branch 'mesa_7_5_branch'
Conflicts:

	src/mesa/main/context.c
2009-06-04 13:16:13 -06:00
Brian Paul
81a0ef3f20 mesa: update wglext.h to latest version 2009-06-04 10:30:25 -06:00
Brian Paul
d33c315d9e mesa: remove PFNGL typedefs that are in glext.h 2009-06-04 10:29:44 -06:00
Brian Paul
73a48a8af3 mesa: upgrade glext.h to version 52
A number of the PFNGL* function typedefs are now in glext.h and must be
omitted from the gl.h file.  gl.h will be pruned in the next commit.
2009-06-04 10:27:47 -06:00
Eric Anholt
1ba96651e1 intel: Add support for tiled textures.
This is about a 30% performance win in OA with high settings on my GM45,
and experiments with 915GM indicate that it'll be around a 20% win there.
Currently, 915-class hardware is seriously hurt by the fact that we use
fence regs to control the tiling even for 3D instructions that could live
without them, so we spend a bunch of time waiting on previous rendering in
order to pull fences off.  Thus, the texture_tiling driconf option defaults
off there for now.
2009-06-04 14:00:43 +00:00
Eric Anholt
165ae5e2fb i915: Don't rely on fence regs when we don't have to.
We're on the way to telling the kernel about when we need fence regs on our
objects or not, and this will cut the number of places needing them.
2009-06-04 10:34:52 +00:00
Eric Anholt
1b6f7fb7d5 i915: Remove some long-dead i830 code. 2009-06-04 10:34:52 +00:00
Brian Paul
091fcf3a27 Revert "softpipe: fix flat shading provoking vertex for PIPE_PRIM_POLYGON"
This reverts commit 5d75124db4.
2009-06-03 19:53:53 -06:00
Brian Paul
ab6508e399 mesa: fix parity error for tri strips with 1st provoking vertex 2009-06-03 19:52:32 -06:00
Brian Paul
8b875b732f tnl: fix first provoking vertex case for unfilled triangles 2009-06-03 19:03:27 -06:00
Brian Paul
086ecea179 softpipe: separate case for PIPE_PRIM_POLYGON in sp_vbuf_draw()
Because of flat shading, we can't use same code as PIPE_PRIM_TRIANGLE_FAN.
This is a follow-on to commit a59575d8fb.
2009-06-03 18:33:07 -06:00
Brian Paul
a64bbdaa3e softpipe: fix incorrect tri vertex order for PIPE_PRIM_POLYGON rendering
This fixes incorrect front/back-face orientation.
2009-06-03 18:31:55 -06:00
Brian Paul
1f1aa0c20c tnl: fix first provoking vertex bug for line loops 2009-06-03 17:28:31 -06:00
Brian Paul
f25e1007c2 swrast: always do span clipping in _swrast_write_rgba_span()
It's possible for mis-behaving vertex programs to produce vertex data
with very large/NaN values.  This doesn't get handled reliably by the
clipper code so we may try to rasterize triangles that extend beyond
the viewport/window.  Always clip spans to avoid invalid memory accesses
later.
2009-06-03 17:16:00 -06:00
Brian Paul
0b6a0b367f vbo: minor reformatting 2009-06-03 17:16:00 -06:00
Brian Paul
aa18e54ac9 vbo: move/refactor debug code 2009-06-03 17:16:00 -06:00
Brian Paul
13f6d07521 vbo: added debug code to check array data validity (disabled) 2009-06-03 17:16:00 -06:00
Brian Paul
e446ef50eb vbo: new debug/dump code (disabled) 2009-06-03 17:16:00 -06:00
Brian Paul
9200954370 mesa: added NaN checking code (disabled) 2009-06-03 17:16:00 -06:00
Brian Paul
035de6a82b mesa: check/prevent NaN for EX2/LG2 2009-06-03 17:16:00 -06:00
Brian Paul
87b2db988e tnl: updated clip debug code (disabled) 2009-06-03 17:16:00 -06:00
Brian Paul
e7927626c1 mesa: added buffer object debug code (disabled) 2009-06-03 17:16:00 -06:00
Brian Paul
4f4280b435 tnl: add some floating point sanity checks (disabled) 2009-06-03 17:16:00 -06:00
Brian Paul
ab4fd18584 vbo: tweak out-of-bounds VBO access error message
Subtract 1 from _MaxElement to be clearer.
2009-06-03 17:15:59 -06:00
Alex Deucher
e355f1d642 fill in r700ColorMask, cleanup 2009-06-03 15:52:09 -04:00
Alex Deucher
ac274b68d7 start to fill in ShadeModel() 2009-06-03 15:14:44 -04:00
Alex Deucher
ada26c4059 dump command buffer 2009-06-03 14:29:06 -04:00
Alex Deucher
f5d479d7f5 Clean up scissor and viewport code
Switch to common functions where applicable
2009-06-03 14:19:26 -04:00
Ian Romanick
1ad1576836 Thank you git for doing the right thing. 2009-06-03 17:55:42 +01:00
Ian Romanick
c428f467b6 Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined
DO NOT HAND-EDIT GLX PROTOCOL FILES.  Seriously.  How can you miss the giant
comment at the top of the file?
2009-06-03 17:53:40 +01:00
Ian Romanick
7f8000db8b Fast path when rebinding the same texture in single context environment
If there is no shared context, there is no purpose in rebinding the same
texture.  In some artificial tests this improves performance 10% - 30%.
2009-06-03 17:50:37 +01:00
Brian Paul
54576130a8 st/mesa: minor clean-ups, reformatting, etc 2009-06-02 21:46:17 -06:00
Brian Paul
5cd47e0361 docs: remove version info carried over from 7.5 2009-06-02 21:41:03 -06:00
Brian Paul
8086352fef docs: clarify GL_ARB_copy_buffer driver support 2009-06-02 21:35:11 -06:00
Brian Paul
dd174ea215 st/mesa: implement/enable GL_ARB_copy_buffer extension 2009-06-02 21:35:11 -06:00
Brian Paul
2813c08b35 mesa: fix error test mistake in _mesa_CopyBufferSubData() 2009-06-02 21:35:11 -06:00
Brian Paul
2e708fa909 docs: added GL_ARB_copy_buffer extension 2009-06-02 21:35:11 -06:00
Brian Paul
3a7399e2c4 mesa: enable GL_ARB_copy_buffer for software drivers 2009-06-02 21:35:11 -06:00
Brian Paul
08e43ebfb2 mesa: plug in new _mesa_CopyBufferSubData() functions 2009-06-02 21:35:11 -06:00
Brian Paul
dc0b71f00d mesa: _mesa_CopyBufferSubData() function, and driver fall-back 2009-06-02 21:35:11 -06:00
Brian Paul
96a30b06db mesa: new state for GL_ARB_copy_buffer 2009-06-02 21:35:10 -06:00
Brian Paul
76b438878e mesa: new CopyBufferSubData() driver hook 2009-06-02 21:35:10 -06:00
Brian Paul
751977075f glapi: regenerated files for GL_ARB_copy_buffer 2009-06-02 21:35:10 -06:00
Brian Paul
68892872ef glapi: include ARB_copy_buffer.xml 2009-06-02 21:35:09 -06:00
Brian Paul
4a1e4f9881 glapi: GL_ARB_copy_buffer xml info 2009-06-02 21:35:09 -06:00
Alex Deucher
116f40a1c4 Disable clear code for now 2009-06-02 19:23:16 -04:00
Alex Deucher
b55d0dd3ba fix an overflow in SPI_VS_OUT_CONFIG
VS must always export at least 1 param.
2009-06-02 19:20:24 -04:00
Joakim Sindholt
45b77830eb r300-gallium: strip swtcl to the bare minimum
This was originally taken from i915 and it shows.
Basically most the stuff in r300_render.c was never needed and
shouldn't have worked in the first place
2009-06-02 22:23:17 +02:00
Ian Romanick
129f311673 intel: Clip to window after calling Driver.TexImage2D
This prevents the width / height from being clipped to the window size before
the texture is allocated.  This matches intelCopyTexImage1D.

This should fix bug #21227

Signed-off-by: Ian Romanick <ian.romanick@intel.com>
2009-06-02 16:50:11 +01:00
Eric Anholt
a945e203d4 i915: Don't put VBOs in graphics memory unless required for an operation.
This saves doing swtnl from uncached memory, which is painful.  Improves
clutter test-text performance by 10% since it started using VBOs.
2009-06-02 06:55:10 -07:00
Eric Anholt
0ab8e2622e i965: Support OPCODE_TRUNC in the brw_wm_fp.c code.
This gets two more glean glsl1 tests using the non-GLSL path.
2009-06-02 06:21:54 -07:00
Brian Paul
2ecc2ece9c docs: implemented GL_EXT_provoking_vertex 2009-06-01 20:45:08 -06:00
Brian Paul
a444d245e5 mesa: enable GL_EXT_provoking_vertex for sw drivers 2009-06-01 20:43:57 -06:00
Brian Paul
82bc6e5ae3 tnl: implement GL_EXT_provoking_vertex 2009-06-01 20:43:09 -06:00
Brian Paul
9f6ec50f8c Merge branch 'mesa_7_5_branch' 2009-06-01 15:01:33 -06:00
Corbin Simpson
1fa023ae48 r300-gallium: Slightly hacky fix for glxgears-style TCL. 2009-06-01 12:04:29 -07:00
Nicolai Hähnle
c1ccc7d539 radeon: Provide a more detailled GL_RENDERER string.
Display the chip family and PCI ID. This can be parsed easily,
and essentially all information that the driver has about the chip can be
deduced from it.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-06-01 19:02:17 +02:00
Dan Nicholson
bc302b2a33 Use separate $(MINSTALL) for installing libraries
The special feature of bin/minstall to copy symlinks is only ever needed
when installing libraries which may have .so symlinks. All the headers
and directories can use a normal install program.

These two modes are separated as $(INSTALL) and $(MINSTALL) to allow the
user (or autoconf) to override installing normal files as they please.
An autoconf check for the install program has been added and will be
used in preference to minstall when available.

Fixes bug 16053.
2009-06-01 06:32:52 -07:00
Jakob Bornecrantz
85e0572756 progs/rbug: Add small remote debugging cli applications 2009-06-01 11:39:25 +01:00
Jakob Bornecrantz
01fa34cb98 trace/rbug: Add rbug integration for remote debugging 2009-06-01 11:19:56 +01:00
Jakob Bornecrantz
dfa4ebcbcc rbug: Add Gallium Remote Debugger Protocol code
This is the (de)marshalling and connection managment code
2009-06-01 11:19:39 +01:00
Jakob Bornecrantz
aee1a6f704 util: Add simple network functions 2009-06-01 02:18:15 -07:00
Cooper Yuan
8e28d64e9c R6xx/r7xx: Fix blinn's lighting shader 2009-05-31 16:51:07 +08:00
Cooper Yuan
377d8b3673 R6xx/r7xx: Fix texture perspective gradients issue 2009-05-31 16:41:19 +08:00
Brian Paul
bedf7fa49f Merge branch 'mesa_7_5_branch' 2009-05-30 20:10:04 -06:00
Brian Paul
6c3cefdda6 Revert "softpipe: fix flat shading provoking vertex for PIPE_PRIM_POLYGON"
This reverts commit 5d75124db4.

This fixed unclipped polygons, but broke clipped polygons.
A better fix from the mesa 7.5 branch will be merged next...
2009-05-30 20:09:19 -06:00
Alex Deucher
d8694cd3f6 get rid of chip_object struct 2009-05-29 15:37:04 -04:00
Alex Deucher
cb39377253 more cleanup 2009-05-29 15:04:44 -04:00
Alex Deucher
5a8b67f363 more cleanup 2009-05-29 14:55:12 -04:00
Alex Deucher
e6eb0ce6ef more cleanup 2009-05-29 14:45:07 -04:00
Alex Deucher
949c489f59 more cleanup 2009-05-29 14:23:04 -04:00
Alex Deucher
97ed5cffcb remove more old r300 bits 2009-05-29 13:56:58 -04:00
Alex Deucher
616692cac5 more cleanup 2009-05-29 13:53:57 -04:00
Alex Deucher
70a0301c5b Remove unused functions 2009-05-29 13:41:00 -04:00
Alex Deucher
37c3731819 Fix spelling in function name 2009-05-29 13:21:28 -04:00
Alex Deucher
9bcc421e68 R6xx/r7xx: remove old sw tcl bits 2009-05-29 13:16:23 -04:00
Alex Deucher
41a44ff891 R6xx/R7xx: switch to common clear with draw code 2009-05-29 13:07:05 -04:00
Alex Deucher
846b24ea82 r6xx/r7xx: switch to common dma functions for vecs 2009-05-29 12:49:45 -04:00
Brian Paul
fa0ca31586 softpipe: update comments for max texture size 2009-05-29 08:22:21 -06:00
Alex Deucher
9b10d19d4a Remove subpixel offset from viewport
remove subpixel offset inherited from r100 code.
based on 038f0bf591
2009-05-29 10:04:03 -04:00
Brian Paul
425c39058b softpipe: increase max 2D/cube texture size to 4K x 4K 2009-05-29 00:55:54 -06:00
Alex Deucher
7f022fb5cd Argh. fix last commit. clears are still broken 2009-05-28 17:18:17 -04:00
Alex Deucher
3f14745946 R6xx/r7xx: re-enable clears
flush cache and wait for idle after drawing.  Probably
just need the cache flush.  This gets redbook hello working
properly.
2009-05-28 17:09:19 -04:00
Cooper Yuan
5ff3368c1f R6xx, add edge rules for triangles 2009-05-28 16:51:49 -04:00
Brian Paul
b631d5fbf4 st: set pipe_rasterizer_state::flatshade_first according to provoking vertex state 2009-05-28 12:33:30 -06:00
Brian Paul
f2f89b01d2 mesa: glGet queries for GL_EXT_provoking_vertex 2009-05-28 12:31:56 -06:00
Brian Paul
fe86e50896 mesa: exec/dlist functions for glProvokingVertexEXT() 2009-05-28 12:31:18 -06:00
Brian Paul
89966cdb1b mesa: data structure updates for GL_EXT_provoking_vertex 2009-05-28 12:30:25 -06:00
Brian Paul
bd6c44458f mesa: regenerated enums for GL_EXT_provoking_vertex 2009-05-28 12:29:23 -06:00
Brian Paul
b9c245238c mesa: regenerated API files for GL_EXT_provoking_vertex 2009-05-28 12:28:18 -06:00
Brian Paul
8c12c9bf76 mesa: GL API changes for GL_EXT_provoking_vertex
This creates the new glProvokingVertexEXT() entrypoint.
2009-05-28 12:26:19 -06:00
Corbin Simpson
b70fcd620d r300-gallium, radeon-gallium: Make add_buffer indicate when a flush is needed.
On a side note, why is RADEON_MAX_BOS 24? Should ask airlied about that.
2009-05-28 07:46:34 -07:00
Jerome Glisse
5dcbcbfca4 r300: when using cs path emit scissor in the cmdbuffer 2009-05-28 13:48:38 +02:00
Jerome Glisse
2f9189d538 r300: rework texture offset emission. 2009-05-28 11:40:58 +02:00
Ben Skeggs
534f1e8f02 nv50: some mipmapping fixes 2009-05-28 16:06:25 +10:00
Christoph Bumiller
c11c107f7d nv50: negate sources directly where supported 2009-05-28 16:06:25 +10:00
Christoph Bumiller
87eea6e2b2 nv50: introduce emit_cvt and use it
This makes some code cleaner, and we can now easily
do CEIL and TRUNC.
2009-05-28 16:06:24 +10:00
Christoph Bumiller
3accd7ebe9 nv50: fix TXP
For TXP we need to divide texture coords by their w component, or
use the coords' 1/w in the perspective interpolation instruction.

This also tries to support 1D, 3D and CUBE textures, and lets the
instruction only load the components that are used.
2009-05-28 16:06:24 +10:00
Christoph Bumiller
94ba165dff nv50: use multiple constant buffers
Use different buffers for immds, FP params, and VP params.
One has to map constant buffer indices in shader code to buffers
defined via CB_DEF. In principle, we could use more buffers so
we'd have to change the shader code less frequently.
2009-05-28 16:06:24 +10:00
Christoph Bumiller
f9268ccd7f nv50: don't look for unfreed temps in free_nv50_pc
Since we stopped using alloc_temp to get hw indices for FP attrs
there shouldn't be any non-deallocated temps left.
2009-05-28 16:06:23 +10:00
Christoph Bumiller
7ab96f4f73 nv50: release hw TEMPs early
Since we know when we don't use a TEMP or FP ATTR register anymore,
we can release their hw resources early.
2009-05-28 16:06:23 +10:00
Christoph Bumiller
708c711f83 nv50: allow immediates for MOV, ADD and MUL
Immediates are inlined now where possible, so we need to set
pc->allow32 to FALSE in LIT where we have the conditional MOV,
since immediates swallow the predicate bits.
2009-05-28 16:06:22 +10:00
Christoph Bumiller
d015cba88f nv50: enable half insns for MOV and MUL 2009-05-28 16:06:22 +10:00
Christoph Bumiller
44b3bfaa75 nv50: make sure half-long insns are paired
I chose to just convert unpaired 32 bit length instructions
after parsing all instructions, although it might be possible
to determine beforehand whether there would be any lone ones,
and then even do some swapping to bring them together ...
2009-05-28 16:06:21 +10:00
Christoph Bumiller
de651a228f nv50: enable KIL in register 19a8 2009-05-28 16:06:21 +10:00
Christoph Bumiller
dac709d0cf nv50: don't overwrite sources before they're used
This would have happened in p.e. ADD TEMP[0], TEMP[0].xyxy, TEMP[1]
or RCP/RSQ TEMP[i], TEMP[i].
2009-05-28 16:06:21 +10:00
Christoph Bumiller
f579a99cc6 nv50: put FP outputs where they belong
Depth output in fragment programs should end up in the first
register after the color outputs.
2009-05-28 16:06:20 +10:00
Christoph Bumiller
dd9ded42b9 nv50: modified FP attribute loading
VP outputs that should be loadable in the FP are mapped to
interpolant indices by HPOS, COL0 etc.; of course HPOS is
always written, so the highest byte of 1988 is a bitmask that
selects which components of HPOS are used for interpolants,
i.e. the FP inputs in COL0 start at index POPCNT(1988[24:28]).
2009-05-28 16:06:19 +10:00
Christoph Bumiller
e88ec312df nv50: inspect decl semantic and interpolation mode
Record interpolation mode for attributes while parsing declarations,
and also remember the indices of FP color inputs and FP depth output,
which has to end up in the highest output register.
2009-05-28 16:06:19 +10:00
Christoph Bumiller
bcecb8ff66 nv50: record last access to temp and attr regs
We now inspect the TGSI instructions in tx_prep to determine where
temps and FP attrs are last accessed.
This will enable us to reclaim some temporaries early and we also
use it to omit pre-loading FP attributes that aren't used.
2009-05-28 16:06:18 +10:00
Christoph Bumiller
7e7d3a87ec nv50: save some space in immediate buffer
We could do even better (like just allocating 1 value in alloc_immd),
but that's fine for now I guess.
2009-05-28 16:06:18 +10:00
Christoph Bumiller
aad31d69ce nv50: fix SIGN_SET case in tgsi_src 2009-05-28 16:06:17 +10:00
Christoph Bumiller
4a7cf8f66f nv50: set dst.z,w to 0,1 in SCS and XPD
According to tgsi-instruction-set.txt, if they are written, z and w
should be set to 0 and 1 respectively in SCS, and w to 1.0 in XPD.
2009-05-28 16:06:17 +10:00
Christoph Bumiller
229992d281 nv50: make LRP instruction nicer 2009-05-28 16:06:17 +10:00
Christoph Bumiller
9417582f39 nv50: fix some memory leaks in shader assembler 2009-05-28 16:06:16 +10:00
Ben Skeggs
65e3fb7b46 nouveau: explicitly request mappable buffers for the moment 2009-05-28 16:06:16 +10:00
Mike Kaplinksiy
713b636a0e draw: Fix assertion failure at fetch_emit_prepare 2009-05-27 22:53:59 -07:00
Brian Paul
5be48307d5 demos: remove some old debug/test code 2009-05-27 19:37:32 -06:00
Brian Paul
b86067c610 softpipe: comments 2009-05-27 19:36:59 -06:00
Brian Paul
31deacb8d3 softpipe: include sp_winsys.h to silence warning (unprototyped function) 2009-05-27 19:30:07 -06:00
Brian Paul
5d75124db4 softpipe: fix flat shading provoking vertex for PIPE_PRIM_POLYGON
Use the first vertex, not the last.
2009-05-27 19:27:31 -06:00
Brian Paul
c13bd74885 st/mesa: init Format field of vertex arrays for feedback mode
Fixes segfault in glRasterPos()
2009-05-27 19:24:09 -06:00
Jerome Glisse
3a6dd3ebb3 radeon: emit scissor before emiting vertices 2009-05-27 21:50:03 +02:00
Jerome Glisse
6141c9ba71 radeon: emit scissor when using cs submission style. 2009-05-27 09:36:07 +02:00
Eric Anholt
8ec6e03679 i915: Fall back on NPOT textured metaops on 830-class. 2009-05-26 20:50:54 -07:00
Eric Anholt
0e83e8f51a i915: Restore the Viewport and DepthRange functions on 8xx.
Fixes failed viewport updates on glxgears (and other apps) resize since
e41780fedc.

Bug #20473.
2009-05-26 19:50:23 -07:00
Chris Wilson
9178b31546 intel: Override MaxRenderbufferSize with hardware constraints
Limit the maximum renderbuffer size to 8192 on i965 and to 2048 on
earlier hardware.
2009-05-26 15:51:33 -07:00
Alex Deucher
98bc311717 enable surface sync function
- needs to be more fine-grained
2009-05-26 14:30:26 -04:00
Alex Deucher
f3eaba017c r6xx: fix more r6xx specific cases 2009-05-26 12:21:54 -04:00
Alex Deucher
930b42693e R6xx: select proper shader format 2009-05-26 11:36:55 -04:00
Alex Deucher
17417fc8ee fix segfault when running glxinfo 2009-05-26 11:13:44 -04:00
Alex Deucher
4a28974cf5 add missing RS780 pci id 2009-05-26 10:44:44 -04:00
Alex Deucher
ced2f1b94c fix build when HAVE_LIBDRM_RADEON is defined 2009-05-26 10:33:23 -04:00
Jerome Glisse
9dee2f20a2 radeon: on update drawable don't firevertices as it might be call from GetLock
To avoid locking bug we shouldn't not call firevertices from this path
as it's call from radeon get lock.
2009-05-25 16:05:45 +02:00
Jerome Glisse
714f5e689f r200: emit scissor when dri2 is enabled
In DRI1 kernel emit scissor but in dri2 cs path we have to
explicitly program them.
2009-05-25 15:47:39 +02:00
Jerome Glisse
39ef33708c r200: fix multitexturing in dri2 path 2009-05-25 13:17:22 +02:00
Jerome Glisse
80f1ac87f2 r200: emit cliprect with indexed primitive 2009-05-25 11:29:32 +02:00
Jerome Glisse
9b1efcb87c radeon: realloc dma if needed after revalidate
Revalidate can trigger flushing and dma buffer deallocation,
so retry allocation on such case.
2009-05-24 16:24:53 +02:00
Nicolai Hähnle
7dd184dc4d radeon: Remove drawable & readable from radeon_dri_mirror
The duplication of state data caused a crash due to double-free on destruction
of context, because a variable wasn't correctly null'ed out.

Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
2009-05-24 15:41:53 +02:00
Brian Paul
2d30dafadd mesa: fix warning message in vbo_exec_DrawRangeElements() 2009-05-22 15:49:38 -06:00
Jerome Glisse
434f920042 radeon: reading back to scratch reg through status map doesn't work
For some unknown reasons the scratch reg value doesn't endup in the status
map at the scratch reg offset, this is a temporary work around until we
figure out why it doesn't work.
2009-05-22 23:44:44 +02:00
Brian Paul
68d412f31c mesa: add missing update_min() call in update_arrays() 2009-05-22 15:35:49 -06:00
Brian Paul
2ead49f98b mesa: reduce gl_array_object::VertexAttrib[] array from 32 to 16 elements
This array was mistakenly dimensioned with VERT_ATTRIB_MAX (32) but it
should really be MAX_VERTEX_GENERIC_ATTRIBS (16).

The generic vertex attributes are in addition to the conventional arrays
(except in NV vertex program mode- they alias/overlay in that case) so
the total of all conventional attributes plus generic attributes should
total 32 (not 48).
2009-05-22 14:57:51 -06:00
Brian Paul
8e3f6c0f96 mesa: use Elements() for loop limit 2009-05-22 14:42:26 -06:00
Brian Paul
842b4cd3cd mesa: use Elements() for loop limit 2009-05-22 14:32:45 -06:00
Brian Paul
ce7a049191 mesa: use Elements() for loop limit 2009-05-22 14:32:37 -06:00
Brian Paul
8091aa8633 mesa: use Elements() for loop limit 2009-05-22 14:28:24 -06:00
Brian Paul
2a3d118a8e mesa: use Elements() for loop limit 2009-05-22 14:27:42 -06:00
Brian Paul
180df4d328 mesa: simplify adjust_buffer_object_ref_counts() 2009-05-22 14:27:26 -06:00
Brian Paul
bf4dfd6563 mesa: minor code clean-up 2009-05-22 14:24:21 -06:00
Brian Paul
d30163ad42 mesa: use Elements() for loop limit 2009-05-22 14:23:02 -06:00
Brian Paul
b625fbaef2 vbo: s/32/VERT_ATTRIB_MAX/ 2009-05-22 14:22:40 -06:00
Brian Paul
ebb991ca0d mesa: use Elements() for loop bound 2009-05-22 14:16:00 -06:00
Brian Paul
a65f385b8d mesa: minor code simplification 2009-05-22 14:14:53 -06:00
Brian Paul
fac334e6d3 Merge branch 'mesa_7_5_branch' 2009-05-22 14:09:35 -06:00
Brian Paul
4b55e36952 vbo: asst. reformatting, clean-ups 2009-05-22 13:44:59 -06:00
Brian Paul
9be72f54ac Merge branch 'mesa_7_5_branch' 2009-05-22 13:21:23 -06:00
Brian Paul
891a2bdd7d demos: extend glsl/multitex.c to use a vertex buffer object 2009-05-22 13:12:28 -06:00
Brian Paul
96370113f1 demos/util: add funcs for GL_ARB_buffer_object 2009-05-22 13:12:01 -06:00
Brian Paul
1b3f5df1e0 Merge branch 'mesa_7_5_branch' 2009-05-22 09:40:50 -06:00
Brian Paul
a545f1ab6d mesa: added some assertions 2009-05-22 07:51:35 -06:00
Brian Paul
42ae2a8648 mesa: use Elements() macro to limit loops instead of constants 2009-05-22 07:51:13 -06:00
Brian Paul
882cd6c839 mesa: remove MAX_VERTEX_PROGRAM_ATTRIBS
Use MAX_VERTEX_GENERIC_ATTRIBS instead.  No need for two #defines for
the same quantity.
2009-05-22 07:30:05 -06:00
Brian Paul
4a95185c9f mesa: rename MAX_VERTEX_ATTRIBS to MAX_VERTEX_GENERIC_ATTRIBS
Be clearer that this is the number of generic vertex program/shader
attributes, not counting the legacy attributes (pos, normal, color, etc).
2009-05-22 07:26:08 -06:00
Brian Paul
4dc426c016 mesa: s/MAX_VERTEX_PROGRAM_ATTRIBS/MAX_NV_VERTEX_PROGRAM_INPUTS/ in NV funcs 2009-05-22 07:19:27 -06:00
Brian Paul
8b91778f46 vbo: fix build breakage...oops 2009-05-21 17:07:33 -06:00
Brian Paul
3bfe312d01 vbo: comments, whitespace clean-ups 2009-05-21 17:03:52 -06:00
Brian Paul
d2a74d76c9 mesa: s/MAX_VERTEX_PROGRAM_ATTRIBS/MAX_NV_VERTEX_PROGRAM_INPUTS 2009-05-21 17:03:21 -06:00
Brian Paul
7e2fb12981 Merge branch 'mesa_7_5_branch' 2009-05-21 16:57:28 -06:00
Brian Paul
54a5ffbfa1 mesa: freshen comments for update_array() 2009-05-21 16:10:45 -06:00
Brian Paul
667a4037fa mesa: minor code simplification in _mesa_GetVertexAttrib*NV() 2009-05-21 16:10:45 -06:00
Brian Paul
024de60348 mesa: comment for _mesa_GetVertexAttribfvARB() 2009-05-21 16:10:45 -06:00
Brian Paul
254845fad0 mesa: minor code simplification in _mesa_GetVertexAttribfvARB() 2009-05-21 16:10:45 -06:00
Brian Paul
6a2211f000 mesa: remove const qualifier 2009-05-21 16:10:45 -06:00
Brian Paul
a554d7c4d8 mesa: VertexAttribPointer comments 2009-05-21 16:10:45 -06:00
Brian Paul
8fe3134622 mesa: call _mesa_update_array_object_max_element() before printing array info 2009-05-21 16:10:45 -06:00
Brian Paul
8fa0cb2b42 mesa: added gl_array_object::Weight array field
We don't really implement vertex weights but in the VBO code this
fixes and odd case for the legacy_array[] setup.  Before, the
vbo->draw_prims() call was always indicating that the vertex weight
array was present/enabled when it really wasn't.
2009-05-21 16:10:45 -06:00
Brian Paul
1889890c88 mesa: check FEATURE_point_size_array for PointSize array 2009-05-21 16:10:45 -06:00
Brian Paul
aac19609bf mesa: fix some potential state-restore issues in pop_texture_group()
Call the _mesa_set_enable() functions instead of driver functions, etc.

Also, add missing code for 1D/2D texture arrays.
2009-05-21 16:10:45 -06:00
Brian Paul
de1cfc5e8a mesa: new _mesa_update_array_object_max_element() function
This will replace the code in state.c
2009-05-21 16:10:45 -06:00
Brian Paul
dda82137d2 vbo: return VP_NONE from get_program_mode() if running fixed-func vertex program
If we're running a vertex program to emulated fixed-function, we still need
to treat vertex arrays/attributes as if we're in fixed-function mode.

This should probably be back-ported to Mesa 7.5 after a bit more testing.
2009-05-21 16:10:45 -06:00
Brian Paul
a1f6f82e82 vbo: move vp_mode enum to vbo_exec.h, use enum instead of GLuint 2009-05-21 16:10:45 -06:00
Alex Deucher
b52cdb81e2 r6xx/r7xx: fix segfault in vertex shader setup 2009-05-21 17:40:27 -04:00
Alex Deucher
1b84d228d5 r6xx: fix count on START_3D packet 2009-05-21 17:38:14 -04:00
Eric Anholt
bd0861e274 i965: fix whitespace in brw_tex_layout.c
The broken indentation was driving me crazy, so fix other stuff while
I'm here.
2009-05-21 10:41:49 -07:00
Eric Anholt
3a521d84ec i956: Make state dependency of SF on drawbuffer bounds match Mesa's.
Noticed while debugging a weird 1D FBO testcase that left its existing
viewport and projection matrix in place when switching drawbuffers.  Didn't
fix the testcase, though.
2009-05-21 10:41:39 -07:00
Eric Anholt
e78a6aa2b9 intel: Fall back on any rendering to texture with no miptree.
Fixes segfault on an fbo.c negative test for FBO with texture width/height
of 0.  Previously we just tested for border != 0 to work around this
segfault.
2009-05-21 10:40:11 -07:00
Eric Anholt
8bba183b9e intel: Mark the FBO as incomplete if there's no intel_renderbuffer for it.
This happens to rendering with textures with a border, which had resulted
in a segfault on dereferencing the irb.
2009-05-21 10:40:11 -07:00
Eric Anholt
467f18f7a5 intel: Don't segfault on glGenerateMipmaps of a cube map with one face defined.
This presumably applies to SGIS_generate_mipmaps as well.
2009-05-21 10:40:11 -07:00
Eric Anholt
4da58bbab0 intel: Use _mesa_CheckFramebufferStatusEXT insteaad of glCheck...
Fixes a segfault in our oglconform fbo test.
2009-05-21 10:40:11 -07:00
Brian Paul
02f73c43b4 mesa: added debug functions for dumping color/depth/stencil buffers 2009-05-21 09:17:09 -06:00
Brian Paul
840c09fc71 i965: rename var: s/tmp/vs_inputs/ 2009-05-21 09:17:09 -06:00
Brian Paul
f7ca97f85e mesa: remove pointless null ptr check, improved some error messages 2009-05-21 09:17:09 -06:00
Brian Paul
39d7524f7b mesa: added _mesa_print_arrays() for debugging 2009-05-21 09:17:09 -06:00
Brian Paul
15f21bf357 mesa: updated comment for _MaxElement field
It's the largest array index, plus one.
2009-05-21 09:17:09 -06:00
Brian Paul
a185bcbdec mesa: move gl_array_attrib::_MaxElement to gl_array_object::_MaxElement
This value is per array object.
2009-05-21 09:17:08 -06:00
Brian Paul
899c524a49 vbo: s/8/MAX_TEXTURE_COORD_UNITS/ 2009-05-21 09:17:08 -06:00
Jonathan Adamczewski
2c007517b5 cell: perform triangle cull a little earlier
In spu_tri.c:setup_sort_vertices() triangles are culled after the
vertices are sorted.  This patch moves the check a little earlier
and performs the actual check a little faster through intrinsics and
a little trickery.

Reduced code size and less work is done before a triangle is deemed
OK to skip.
2009-05-21 08:19:00 -06:00
Jonathan Adamczewski
b4824520ec cell: unroll inner loop of spu_render.c:cmd_render()
It was taking approximately 50 cycles to extract the vertex indices,
calculate the vertex_header pointers and call tri_draw() for each
three vertices - .

Unrolled, it takes less than 100 cycles to extract, unpack,
calculate pointers and call tri_draw() eight times.  It does have a
nasty jump-tabled switch.  I'm sure that there's a better way...

Code size of spu_render.o gets larger due to the extra constants and
work in the inner loop, there are extra stack saves and loads
because there are more registers in use, and an assert.  spu_tri.o
gets a little smaller.
2009-05-21 08:18:03 -06:00
Brian Paul
5b27b4ad37 st: add support for GL_EXT_vertex_array_bgra 2009-05-21 08:15:54 -06:00
Jerome Glisse
d7cc0eb479 radeon: maxbuffer size is in bytes 2009-05-21 13:49:15 +02:00
Corbin Simpson
3af0952bc9 r300-gallium: r500-fs: POW.
I feel so unclean.
2009-05-20 23:22:16 -07:00
Corbin Simpson
cfd241e8a6 r300-gallium: r500-fs: LRP.
Goddammit. This cannot be the "easy way." :C
2009-05-20 21:52:11 -07:00
Corbin Simpson
f1f0893eba r300-gallium: r500-fs: Combine function. 2009-05-20 16:53:45 -07:00
Corbin Simpson
d67fb5ea1d r300-gallium: Prevent assert when fogcoords are present.
Seems like this file is the source of all bad logic. (Pun intended.)
2009-05-20 16:05:11 -07:00
Corbin Simpson
d04c85d01b r300-gallium: Another constantbuf shader recompile test.
Less briefly... Shaders need to be recompiled if their constantbuf
offsets have changed. However, since we only change them from shaders if
immediates need to be emitted, we shouldn't bother if the shader doesn't
use immediates.
2009-05-20 14:55:03 -07:00
Corbin Simpson
4151c0ea91 r300-gallium: Raise constantbuf limits.
Still not correct, but really I don't care.
2009-05-20 14:38:22 -07:00
Corbin Simpson
364a4a8293 r300-gallium: fs: Remove cruft from way back when. 2009-05-20 14:17:27 -07:00
Corbin Simpson
0ba7f76233 radeon-gallium: Add surface_buffer_create callback. 2009-05-20 13:21:17 -07:00
Jerome Glisse
a13e96359b r200: fix vbo array rendering 2009-05-20 22:19:40 +02:00
Corbin Simpson
9e8de1b911 r300-gallium: Make surface_copy actually load the texture in shader. 2009-05-20 12:22:24 -07:00
Corbin Simpson
b22b6f0743 r300-gallium: Add missing R481 PCI ID.
Per 74cb2aba on xf86-video-ati.
2009-05-20 12:08:00 -07:00
Corbin Simpson
65946ef081 r300-gallium: Make surface_copy work, and refactor buffer validation. 2009-05-20 11:46:26 -07:00
Michel Dänzer
01daeadf8c radeon: Increase reference count of current renderbuffers.
Fixes

glxinfo: main/renderbuffer.c:2159: _mesa_reference_renderbuffer: Assertion
`oldRb->Magic == 0xaabbccdd' failed.
2009-05-20 17:00:57 +02:00
Michel Dänzer
b9bd1abf26 Merge branch 'master' into radeon-rewrite
Conflicts:
	src/mesa/drivers/dri/r300/r300_context.c
	src/mesa/drivers/dri/r300/r300_texstate.c
2009-05-20 17:00:48 +02:00
Jerome Glisse
c696dd0f62 radeon: set max texture size
This still need some work to actually report somethings reasonable
if no memory manager is available.
2009-05-20 16:34:06 +02:00
Corbin Simpson
4550423211 radeon-gallium: Don't permit reading and writing a BO in one CS.
This fixes some silent problems in current libdrm_radeon.

surface_copy still locks up hard.
2009-05-20 07:18:08 -07:00
root
c28e0e7d97 Add missing file from local. 2009-05-20 09:16:21 -04:00
Jerome Glisse
8308bf9ee1 r200: fix indexed draw color order and cs missmatch 2009-05-20 13:21:24 +02:00
Brian Paul
0c75cb5afe st: reformatting, comments, var renaming 2009-05-19 20:05:28 -06:00
root
3149b87ac4 Makeup checkin for radeon code change paired with r6/7 code. 2009-05-19 16:47:39 -04:00
Brian Paul
d0eccc4187 Merge branch 'mesa_7_5_branch' 2009-05-19 10:07:45 -06:00
Brian Paul
43d8ace88d mesa: print more info when valid_texture_object() fails 2009-05-19 09:21:39 -06:00
Richard Li
465588cd0e Fix nop insertion bug. redbook hello can run. 2009-05-19 10:28:40 -04:00
Jakob Bornecrantz
bd59dd69ba trace: Improve shader wrapping 2009-05-18 20:54:09 +01:00
Jakob Bornecrantz
7d11a392d7 st/dri: Only create new textures if drawable has changed 2009-05-18 20:54:09 +01:00
Corbin Simpson
d0639d067e r300-gallium: Fix (another) wrong value in MSPOS.
Again, thanks to agd5f.
2009-05-18 09:51:10 -07:00
Corbin Simpson
026f4c97dc radeon-gallium: Remove BO validation debug.
It appears that that area of code "just works" much like classic Mesa's
version, so might as well not waste scrollback on it.
2009-05-18 09:51:10 -07:00
Corbin Simpson
5236ea3900 r300-gallium: Cleanup viewport state setup. 2009-05-18 09:51:09 -07:00
Corbin Simpson
301d238c1a r300-gallium: Always do VTE, never software viewport.
This makes glxgears draw properly with SW TCL.
2009-05-18 09:51:09 -07:00
Brian Paul
edfbf7dccb Merge branch 'mesa_7_5_branch'
Conflicts:

	Makefile
	src/mesa/main/version.h
2009-05-18 10:36:50 -06:00
Jerome Glisse
d039cf4574 radeon: fix DRI1 cmd stream 2009-05-18 10:13:57 +02:00
Corbin Simpson
27206add27 r300-gallium: Enable GLSL for r500.
Before you get all excited, this is *not* to be construed as actual support
for GLSL shaders. The GL version is still 1.3, and stuff still sucks. Just
flicking it on so that it can be tested and developed a bit easier.
2009-05-17 21:41:25 -07:00
Corbin Simpson
9569221563 r300-gallium: r500-fs: DDX and DDY support.
Oh, look, GLSL instructions. I wonder what I'll do next.
2009-05-17 21:40:16 -07:00
Corbin Simpson
0036f2ccba dri-gallium: Add GLSL support.
Oh, look, it's more features. :3
2009-05-17 21:39:11 -07:00
Corbin Simpson
06a7b798f2 r300-gallium: Add half-right COS and SIN.
HW trig does a premultiply by 2pi, where Mesa does another premultiply by pi.
This is a problem.
2009-05-17 21:10:07 -07:00
Corbin Simpson
572d7d1358 r300-gallium: Size mismatch. 2009-05-17 20:49:39 -07:00
Corbin Simpson
6a40d1e9d9 r300-gallium, radeon-gallium: Nuke gb_pipes from orbit.
See the previous commit for an explanation. This is just all the support code
for GB_TILE_CONFIG.
2009-05-17 17:03:15 -07:00
Corbin Simpson
d6e085bd76 r300-gallium: Don't set GB_TILE_CONFIG (in userspace.)
This accompanies kernel patches that make GB_TILE_CONFIG's various members
completely controlled in DRM.

GB_TILE_CONFIG has the following controls:
 - The number of GB (pixel) pipes enabled
 - The size and style of tiling
 - Subpixel precision (either 1/12 or 1/16)

Per airlied and glisse, userspace and kernel will now agree (always) on
a subpixel precision of 1/12, and tiling will always be kernel-controlled.
2009-05-17 16:44:39 -07:00
Corbin Simpson
60665ae627 r300-gallium: Clean up more invariant state.
GA_ENHANCE is now the kernel's problem.
2009-05-17 13:23:39 -07:00
Corbin Simpson
e5f5390f4b r300-gallium: Update XXX.
Lops work fine as long as HW TCL is off. (I think I know why.)
2009-05-17 12:51:18 -07:00
Corbin Simpson
fbcfcd9f5c r300-gallium: Correct default MSPOS.
Per agd5f.
2009-05-17 11:58:53 -07:00
Corbin Simpson
45435abcb9 r300-gallium: vs: Fix vert shader init.
Makes the last three commits suck much less. :3
2009-05-17 10:34:41 -07:00
Corbin Simpson
8dae8f28e5 r300-gallium: r500-fs: Enable depth writes, kinda.
Should work, but doesn't. Hm.
2009-05-17 10:30:59 -07:00
Corbin Simpson
7e97219ff8 r300-gallium: Comment out useless debugging code.
Those parts are nearly solid compared to the shaders.
2009-05-17 09:44:14 -07:00
Corbin Simpson
764bf9501a r300-gallium: vs: Dupe tokens, better debug, count spurious insts. 2009-05-17 09:39:06 -07:00
Corbin Simpson
08ec7e0d32 r300-gallium: Die on bad texture formats.
Odds are good that we'll die later anyway, so we might as well do it before
we start dancing on random memory.
2009-05-16 11:17:05 -07:00
Corbin Simpson
17b395638b r300-gallium: Update floating-point params too.
Even though we *can* render 10,000-pixel-wide lines, let's not advertise it.
2009-05-16 10:56:17 -07:00
Corbin Simpson
13f8e7bc9c r300-gallium: Update screen caps.
Anisotropic filtering should work, and OQ is broken.
2009-05-16 10:46:55 -07:00
Corbin Simpson
0e8c6e56e4 intel-gallium: Fix trace_drm integration.
Compile-tested only, sorry.
2009-05-16 10:07:58 -07:00
Corbin Simpson
5e39a8c450 Create common trace_drm code, add to radeon_winsys. 2009-05-16 10:07:58 -07:00
Corbin Simpson
13131adbf1 r300-gallium: Various cleanups leftover from before.
BEGIN/END_CS pair, a few asserts, and a slightly more correct VTE setup.
2009-05-16 10:07:58 -07:00
Keith Whitwell
57fd202375 gallium: remove occlusion_count flag from depth-stencil state
Drivers can just keep track of whether they are within a query
by monitoring the begin/end query callbacks.  The flag adds no
information beyond that.

Only softpipe was examining this flag -- it has been fixed up
and retested with demos/arbocclude.
2009-05-16 17:26:39 +01:00
Maciej Cencora
73d2a4a047 r300: cleanup vertex program related functions
- move vertex program related functions to r300_vertprog.c
- use _mesa_bitcount instead of self-made bit_count function
- remove duplicated field in r300_vertex_shader_fragment.body union
- rename r300_vertex_shader_fragment to r300_vertex_shader_hw_code
- rename r300_vertex_program field native to error
- remove unnecessary r300_vertex_shader_state structure
- remove unused r300_vertex_program and r300_vertex_program_cont fields
- remove disabled code
2009-05-16 11:42:03 -04:00
Maciej Cencora
1b49f1ca7f r300: minor code movement 2009-05-16 11:42:03 -04:00
Maciej Cencora
f8c30793d1 r300: more cleanup
- remove unnecessary r300TranslateFragmentShader call from r300UpdateShaderStates (it is already called in r300UpdateShaders)
- remove unnecessary null ptr checks
2009-05-16 11:42:03 -04:00
Maciej Cencora
1961caeda8 r300: move some code to common path 2009-05-16 11:42:03 -04:00
Maciej Cencora
12ed56f1dd r300: rename functions
Be consistent with function naming: use Setup/Emit names for functions that modify hardware state
2009-05-16 11:42:03 -04:00
Maciej Cencora
6f1a86ca1e r300: move forward declarations to where they belong 2009-05-16 11:42:02 -04:00
Maciej Cencora
2240c0d333 r300: software fallbacking handling rewrite
Until now falling back to software rasterizer worked only for TCL enabled cards.
For non TCL cards we used to plug our rendering functions in r300InitSwtcl, and we had never restored original functions for software rasterizer.
2009-05-16 11:42:02 -04:00
Maciej Cencora
621f65ab86 r300: r300EmitArrays should never fail 2009-05-16 11:42:02 -04:00
Maciej Cencora
d6da805c4e r300: remove unnecessary switch cases 2009-05-16 11:42:02 -04:00
Maciej Cencora
42f16aa4e0 r300: further cleanup
- move extensions init into seperate function
- move options handling into seperate function
- create new structure to hold options values
- use context->options.hw_tcl_enabled field instead of global hw_tcl_on and future_hw_tcl_on variables
2009-05-16 11:42:02 -04:00
Jakob Bornecrantz
3259f52a92 gallium-intel: Enable trace driver 2009-05-16 01:51:30 +01:00
Jakob Bornecrantz
f04c38fa1f trace: Export enabled status 2009-05-16 01:50:53 +01:00
Jakob Bornecrantz
ee05658798 trace: Unwrap buffer in texture_blanket 2009-05-16 01:50:53 +01:00
Jakob Bornecrantz
ab95f389a5 trace: If either shader is disabled don't draw 2009-05-16 01:50:53 +01:00
Jakob Bornecrantz
3b4da4e9da trace: Put shaders on a list in the context 2009-05-16 01:50:53 +01:00
Jakob Bornecrantz
c30f661189 trace: Move state dump functions to tr_dump_state.[c|h] 2009-05-16 01:50:53 +01:00
Eric Anholt
22690482e6 intel: Don't complain on falling back from PBO fastpaths.
Instead, stash the debug info under the handy debug flag.

Bug #20053
2009-05-15 17:32:21 -07:00
Richard Li
2a7a2c6b77 Fix r6 code bugs. 2009-05-15 19:49:17 -04:00
Eric Anholt
0307e609aa mesa: Mark FBOs with compressed color attachments as FBO-incomplete.
Both EXT_fbo and ARB_fbo agree on this.  Fixes a segfault in the metaops
mipmap generation in Intel for SGIS_generate_mipmap of S3TC textures in
Regnum Online.

Bug #21654.
2009-05-15 16:47:37 -07:00
Jakob Bornecrantz
97ccdee68a gallium-intel: Build with scons 2009-05-15 22:54:07 +01:00
Jakob Bornecrantz
c4538e326a st/egl: Use proper Makefile 2009-05-15 22:52:30 +01:00
Steinar H. Gunderson
b197a8ade3 i915: Fix 945 cube map layout for the small mipmaps along the bottom.
Bug #21691.
2009-05-15 12:50:11 -07:00
Eric Anholt
4c6f829899 i915: Use Stencil.Enabled instead of Stencil._Enabled in DrawBuffers.
The _Enabled field isn't updated at the point that DrawBuffers is called,
and the Driver.Enable() function does the testing for stencil buffer
presence anyway.

bug #21608 for Radeon
2009-05-15 12:45:33 -07:00
Eric Anholt
5c5a468848 i915: Only use the new 945 cube layout for compressed textures.
The docs actually explain this, but not in a terribly clear manner.
This nearly fixes the piglit cubemap testcase, except that something's
going wrong with the nearest filtering at 2x2 sizes in the testcase.
Looks good by visual inspection, though.

Bug #21692
2009-05-15 11:43:39 -07:00
Eric Anholt
dc657f3929 i965: Fix varying payload reg assignment for the non-GLSL-instructions path.
I don't have a testcase for this, but it seems clearly wrong.
2009-05-14 11:41:04 -07:00
Eric Anholt
0f5113deed i965: Fix register allocation of GLSL fp inputs.
Before, if the VP output something that is in the attributes coming into
the WM but which isn't used by the WM, then WM would end up reading subsequent
varyings from the wrong places.  This was visible with a GLSL demo
using gl_PointSize in the VS and a varying in the WM, as point size is in
the VUE but not used by the WM.  There is now a regression test in piglit,
glsl-unused-varying.
2009-05-14 11:41:04 -07:00
Eric Anholt
64980125c7 intel: Use FRONT_AND_BACK for StencilOp as well. 2009-05-14 11:41:04 -07:00
Eric Anholt
d866abeffc intel: Use GL_FRONT_AND_BACK for stencil clearing.
This comes from a radeon-rewrite fallback fix, but may also fix stencil
clear failure when the polygon winding mode is flipped.
2009-05-14 11:41:03 -07:00
Corbin Simpson
96922d1b71 r300-gallium: Correct VTE setup for surface_fill, make surface_copy emit right. 2009-05-14 09:47:07 -07:00
Robert Ellison
ab6c4fa582 i965: fix 1D texture borders with GL_CLAMP_TO_BORDER
With 1D textures, GL_TEXTURE_WRAP_T should be ignored (only
GL_TEXTURE_WRAP_S should be respected).  But the i965 hardware
seems to follow the value of GL_TEXTURE_WRAP_T even when sampling
1D textures.

This fix forces GL_TEXTURE_WRAP_T to be GL_REPEAT whenever 1D
textures are used; this allows the texture to be sampled
correctly, avoiding "imaginary" border elements in the T direction.

This bug was demonstrated in the Piglit tex1d-2dborder test.
With this fix, that test passes.
2009-05-14 10:36:33 -06:00
Robert Ellison
bc3270e99f i965: send all warnings through _mesa_warning()
One warning message:
   drm_i915_getparam: -22

was still being sent to fprintf().  This causes all Piglit tests to fail,
even with MESA_DEBUG=0.

Using _mesa_warning() to emit the message allows the general Mesa controls
for messages like this to be applied.
2009-05-14 10:36:33 -06:00
Jerome Glisse
76a64958a4 r300: don't send now forbidden register to kernel when with memory manager 2009-05-14 17:25:24 +02:00
Corbin Simpson
d3912e301f r300-gallium: Clean up outdated comments. 2009-05-13 17:24:47 -07:00
Corbin Simpson
15601e9702 r300-gallium: Space accounting for textures. 2009-05-13 17:01:03 -07:00
Alex Deucher
7cd57e35b6 R1xx/r2xx: Don't use an alpha texture format for GLX_TEXTURE_FORMAT_RGB_EXT
In r*00SetTexBuffer2(), if the passed in text glx_texture_format
is GLX_TEXTURE_FORMAT_RGB_EXT, then we should use an RGB-only
texture format, even if the DRI buffer has four channels.

https://bugs.freedesktop.org/show_bug.cgi?id=21609
2009-05-13 19:43:04 -04:00
Owen W. Taylor
ca792be42b radeon: Don't crash generating mipmaps when pixels=NULL
When a NULL value of pixels is passed to TexImage2D and
SGIS_generate_mipmap is enabled, don't try to generate the
mipmap tree: we don't have data yet for the texture and will
crash.

https://bugs.freedesktop.org/show_bug.cgi?id=21648
2009-05-13 19:06:24 -04:00
Owen W. Taylor
ea6a74abbe Don't use an alpha texture format for GLX_TEXTURE_FORMAT_RGB_EXT
In r300SetTexBuffer2(), if the passed in text glx_texture_format
is GLX_TEXTURE_FORMAT_RGB_EXT, then we should use an RGB-only
texture format, even if the DRI buffer has four channels.

https://bugs.freedesktop.org/show_bug.cgi?id=21609
2009-05-13 19:04:18 -04:00
Owen W. Taylor
34eab5dd9c Call _mesa_update_stencil() before accessing ctx->Stencil._Enabled
ctx->Stencil._Enabled is derived state and not immediately updated
when the stencil parameters are changed; we need to make sure that
it is up-to-date before accessing it.

https://bugs.freedesktop.org/show_bug.cgi?id=21608
2009-05-13 19:02:51 -04:00
Owen W. Taylor
038f0bf591 Remove subpixel offset from viewport
Remove an eigth-pixel offset of the viewport inherited from
R100 code. This seems not to be necessary and causes blurring
when sampling textures 1:1.

https://bugs.freedesktop.org/show_bug.cgi?id=20340
2009-05-13 18:57:47 -04:00
Brian Paul
ca327b1688 Merge branch 'mesa_7_5_branch' 2009-05-13 11:33:52 -06:00
Brian Paul
ac5bf63f74 docs: GL_APPLE_vertex_array_object for Gallium drivers and Intel DRI drivers 2009-05-13 11:24:11 -06:00
Brian Paul
a566b6d8ff intel: enable GL_APPLE_vertex_array_object
No special driver changes are needed for this extension.
2009-05-13 11:19:33 -06:00
Brian Paul
a892acef98 st/mesa: enable GL_APPLE_vertex_array_object for gallium drivers 2009-05-13 11:22:21 -06:00
Brian Paul
3039acfc5d Merge branch 'mesa_7_5_branch'
Conflicts:

	src/mesa/main/arrayobj.c
	src/mesa/main/arrayobj.h
	src/mesa/main/context.c
2009-05-13 10:33:21 -06:00
Brian Paul
10c4a10b97 i965: enable additional code in emit_fb_write()
Not 100% sure this is right, but the invalid assertion is fixed...
2009-05-12 15:14:34 -06:00
Brian Paul
5590798f6d i965: increase BRW_EU_MAX_INSN 2009-05-12 15:14:34 -06:00
Brian Paul
4d244fb899 i965: comment 2009-05-12 15:14:34 -06:00
Joakim Sindholt
167a6b0804 r300-gallium: add missing semicolon
Yeah, that was stupid
2009-05-12 22:01:59 +02:00
Joakim Sindholt
62c0c7d81a r300-gallium: duplicate tokens in create_fs_state
This was all phoenix64's idea. Credit goes to him
2009-05-12 21:41:48 +02:00
Joakim Sindholt
723bc9452f progs/trivial: update .gitignore with new binaries 2009-05-12 21:00:39 +02:00
Eric Anholt
d4a42b0ce6 intel: Skip the DRI2 renderbuffer update when doing Viewport on an FBO. 2009-05-12 10:21:00 -07:00
Eric Anholt
aa422b2625 intel: Map write-only buffer objects through the GTT when possible.
This looks to be a win of a few percent in cairogears with new vbo code,
thanks to not polluting caches.
2009-05-12 10:08:19 -07:00
Eric Anholt
0fc5fa85bf i915: Fix driver after HW glGenerateMipmap commit. 2009-05-12 10:08:19 -07:00
Brian Paul
6d63dec41f swrast: update/restore the opt_sample_rgb/rgba_2d() functions 2009-05-12 09:05:31 -06:00
Jerome Glisse
c514c1f994 radeon: glReadBuffer set _NEW_BUFFERS, not _NEW_PIXEL
This was broken with last merge see 62043b2757
for explanations
2009-05-12 13:05:57 +02:00
Jerome Glisse
05c19ec7f0 r300/r500: make sure we detect constant buffer changes
This was broken with last merge see f48473e425
for explanations.
2009-05-12 13:04:32 +02:00
Tormod Volden
0bfa8dfaaf radeon: avoid segfault in radeon_update_renderbuffers() if using DRI1
Basically the same as 43d9020ff1 for intel. Bug 21688.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
2009-05-12 12:43:08 +02:00
Brian Paul
e7cb125b2d Merge branch 'mesa_7_5_branch'
Conflicts:

	Makefile
	src/mesa/main/version.h
2009-05-11 16:27:50 -06:00
Joakim Sindholt
783e43064b r300-gallium: unbreak build 2009-05-11 21:44:49 +02:00
Corbin Simpson
64f60bc046 r300-gallium: Setup surface in r300_surface_copy.
I haven't tested, but this may unbreak surface copies.
2009-05-11 10:09:59 -07:00
Corbin Simpson
b315ec43ee r300-gallium: Cleanup some compile warnings. 2009-05-11 10:07:40 -07:00
Corbin Simpson
e9f8b7f1b9 r300-gallium: Cleanup PSC for HW TCL.
Still dies in assert, but at least it's not my assert anymore. :3
2009-05-11 09:57:57 -07:00
Corbin Simpson
f38a02212f radeon-gallium: Forgot a typedef. 2009-05-11 09:55:28 -07:00
Corbin Simpson
2e22bd8460 radeon-gallium: Support new info ioctls in addition to classic getparams.
This makes non-hybrid kernels like newttm from drm-next-radeon work
while avoiding breakage with Fedora/Ubuntu/etc.
2009-05-11 09:05:33 -07:00
Brian Paul
7c3d7353d7 mesa: updated comments for _mesa_generate_mipmap() 2009-05-11 10:02:27 -06:00
Brian Paul
6697311b21 i965: handle extended swizzle terms (0,1) in get_src_reg()
Fixes failed assertion in progs/glsl/twoside.c (but still wrong rendering).
2009-05-11 09:47:32 -06:00
Brian Paul
7c2fe42ded mesa: better handling/printing of driver-specific opcodes, register files
Drivers such as i965 define extra instruction opcodes and register files.
Improve the program printing code to handle those opcodes/files better.
2009-05-11 09:47:32 -06:00
Joel Bosveld
98bb5c610d radeon: add support for new dri2 interfaces & fix single buffer rendering 2009-05-10 18:26:40 +02:00
Jerome Glisse
221b30d595 Merge commit 'origin/master' into radeon-rewrite
Conflicts:
	src/mesa/drivers/dri/r200/r200_state.c
	src/mesa/drivers/dri/r300/r300_context.h
	src/mesa/drivers/dri/r300/r300_fragprog.c
	src/mesa/drivers/dri/r300/r300_state.c
	src/mesa/drivers/dri/r300/r300_texmem.c
	src/mesa/drivers/dri/r300/r300_texstate.c
	src/mesa/drivers/dri/r300/r500_fragprog.c
	src/mesa/drivers/dri/radeon/radeon_screen.c
	src/mesa/drivers/dri/radeon/radeon_state.c
2009-05-10 16:57:22 +02:00
Jerome Glisse
13e0ff0df1 radeon: don't include cs uncondionaly 2009-05-09 12:56:27 +02:00
Corbin Simpson
53c2cc8fef radeon-gallium: Clean up some of the BO counting logic. 2009-05-09 00:45:48 -07:00
Corbin Simpson
a738d2b4c2 r300-gallium: vs: Make imms work, cleanup some of the switches. 2009-05-09 00:45:48 -07:00
Corbin Simpson
c4c5bf31a7 r300-gallium: Start VS dumper. 2009-05-09 00:45:48 -07:00
Corbin Simpson
7e347a0f49 r300-gallium: vs: Add SLT, clean up MAX.
This should be all the opcodes for basic TCL.
2009-05-09 00:45:48 -07:00
Corbin Simpson
9b10777148 r300-gallium: vs: Add MAX. 2009-05-09 00:45:48 -07:00
Corbin Simpson
e669ce01d4 r300-gallium: vs: Add scalar setup, RSQ.
Icky icky icky icky. Icky icky, icky icky. Icky.
2009-05-09 00:45:48 -07:00
Corbin Simpson
c6d2b4a495 r300-gallium: vs: Add writemasks. 2009-05-09 00:45:47 -07:00
Corbin Simpson
ce758a21b9 r300-gallium: Fix bad cast. Space accounting completely works now.
Boy, is my face red. :C
2009-05-08 22:05:18 -07:00
Corbin Simpson
1b26c2bbae r300-gallium, radeon: BO handling fixes, some useful asserts. 2009-05-08 19:41:08 -07:00
Corbin Simpson
bed917641c radeon-gallium: Shut up Valgrind. 2009-05-08 19:41:08 -07:00
Corbin Simpson
cd59933d9f r300-gallium, radeon: A couple cleanups.
Trying to track down goddamn bugs. :C
2009-05-08 19:41:08 -07:00
Corbin Simpson
4816764777 r300-gallium: Finish space accounting.
Still broken...
2009-05-08 19:41:08 -07:00
Richard Li
e2dcebd2e6 R6xx/R7xx: WIP r6xx-rewrite code 2009-05-08 19:23:45 -04:00
Robert Ellison
1d11220771 i965: improve debug logging
Looking for memory leaks that were causing crashes in my environment
in a situation where valgrind would not work, I ended up improving
the i965 debug traces so I could better see where the memory was
being allocated and where it was going, in the regions and miptrees
code, and in the state caches.  These traces were specific enough
that external scripts could determine what elements were not being
released, and where the memory leaks were.

I also ended up creating my own backtrace code in intel_regions.c,
to determine exactly where regions were being allocated and for what,
since valgrind wasn't working.  Because it was useful, I left it in,
but disabled and compiled out.  It can be activated by changing a flag
at the top of the file.
2009-05-08 16:57:08 -06:00
Robert Ellison
fc6d89145d i965: fix memory leak in context/renderbuffer region management
A temporary change to the intelMakeCurrent() function to make
it work with frame buffer objects causes the static regions
associated with the context (the front_region, back_region,
and depth_region) to take on an additional reference, with
no corresponding release.  This causes a memory leak if a
program repeatedly creates and destroys contexts.

The fix is the corresponding hack, to unreference these
regions when the context is deleted, but only if the
framebuffer objects are still present and the same
regions are still referenced within.

Both sets of code have comment blocks referring to each
other.
2009-05-08 16:47:59 -06:00
Robert Ellison
44a4abfd4f i965: fix segfault on low memory conditions
When out of memory (in at least one case, triggered by a longrunning
memory leak), this code will segfault and crash.  By checking for the
out-of-memory condition, the system can continue, and will report
the out-of-memory error later, a much preferable outcome.
2009-05-08 16:32:29 -06:00
Robert Ellison
c230767d69 mesa: Fixed a texture memory leak
The current texture for any particular texture unit is given an additional
reference in update_texture_state(); but if the context is closed before
that texture can be released (which is quite frequent in normal use, unless
a program unbinds and deletes the texture and renders without it to force
a call to update_texture_state(), the memory is lost.

This affects general Mesa; but the i965 is particularly affected because
it allocates a considerable amount of additional memory for each allocated
texture.
2009-05-08 16:32:28 -06:00
Eric Anholt
1d663ae292 intel: Add a metaops version of glGenerateMipmapEXT/SGIS_generate_mipmaps.
In addition to being HW accelerated, it avoids the incorrect
(black) rendering of the mipmaps that SW was doing in fbo-generatemipmap.
Improves the performance of the mipmap generation and drawing in
fbo-generatemipmap by 30%.
2009-05-08 14:18:04 -07:00
Eric Anholt
b6e94f71c2 intel: Put the constant texcoords used in metaops into a vbo.
Make this be its own function for setup/teardown of the binding of these
texcoords.  No performance difference in the engine demo (I just felt dirty
not using a VBO for this), and I think it should be more resilient to
interference from current GL state.
2009-05-08 14:18:04 -07:00
Brian Paul
f09e5a5b63 i965: const qualifiers 2009-05-08 14:34:27 -06:00
Brian Paul
4e762395ef mesa: raise MAX_VARYING (number of shader varying vars) to 16
16 is the limit for now because of various 32-bit bitfields.
2009-05-08 14:35:48 -06:00
Brian Paul
17a354a119 mesa: assertions to check for too many vertex outputs or fragment inputs 2009-05-08 14:35:48 -06:00
Brian Paul
cc58fbcf2c glsl: check number of varying variables against the limit
Link fails if too many varying vars.
2009-05-08 14:35:48 -06:00
Brian Paul
87fbc9a14e mesa: issue warning for out of bounds array indexes 2009-05-08 12:45:08 -06:00
Brian Paul
e2cf522de0 i965: don't use GRF regs 126,127 for WM programs
They seem to be used for something else and using them for shader temps
seems to lead to GPU lock-ups.
Call _mesa_warning() when we run out of temps.
Also, clean up some debug code.
2009-05-08 12:45:08 -06:00
Brian Paul
40cba5489d glsl: set vertex/fragment program Ids to aid with debugging 2009-05-08 12:45:08 -06:00
Brian Paul
ccaa6463a7 mesa: more shader debug code (disabled) 2009-05-08 12:45:08 -06:00
Jerome Glisse
a67c29a268 radeon: IRQ always enabled in DRI2 path no need to query kernel for it 2009-05-08 16:40:21 +02:00
Keith Whitwell
d5c2ad8514 mesa/st: keep surface_copy arguments positive
The src/dest x,y, and w,h arguments of the pipe->surface_copy
function are unsigned and the drivers aren't expecting negative
(or extremly-large unsigned) values as inputs.  Trim the requests
at the state-tracker level before passing down.
2009-05-08 10:04:14 +01:00
Keith Whitwell
6826bad6a7 mesa/st: remove redundant call to st_finish in CopyTexSubImage
Rendering should already have been flushed, any synchronization will
be done by the driver or memory manager.
2009-05-08 10:04:14 +01:00
José Fonseca
626b6f37ea wgl: Export pixelformats with accumulation bits. 2009-05-08 10:04:14 +01:00
Keith Whitwell
01280cff53 mesa/st: cope with non-ibo index data in st_draw_feedback.c
Previously only non-indexed or indicies-in-a-vbo cases were handled in
this code.  This change adds the missing regular indices-in-memory
case.
2009-05-08 10:04:14 +01:00
Keith Whitwell
4a333c64fa util/upload: catch failures to map_range and return error
Caller may be able to do something about this - eg flush and retry.
2009-05-08 10:04:14 +01:00
Keith Whitwell
5f5181021e scons: mingw is broken with -O1 and higher 2009-05-08 10:04:13 +01:00
Keith Whitwell
48c7aa2648 stw: fix potential uninitialized use of curctx 2009-05-08 10:04:13 +01:00
José Fonseca
26ffd44586 wgl: Enforce a minimum 1x1 framebuffer size. 2009-05-08 10:04:13 +01:00
José Fonseca
3a43ea4946 wgl: Add assertion for missing function. 2009-05-08 10:04:13 +01:00
José Fonseca
082a086e9d wgl: Remove unused variable. 2009-05-08 10:04:13 +01:00
José Fonseca
b25168c34c mesa: Make _mesa_share_state thread safe. 2009-05-08 10:04:13 +01:00
José Fonseca
25a4156a8b wgl: Implement ShareLists. 2009-05-08 10:04:13 +01:00
Maciej Cencora
a7bb95bf14 r300: add missing texture format
Fixes piglit/texdepth
2009-05-07 20:15:45 -04:00
Maciej Cencora
dc8c717759 r300: moar cleanup
- remove unused r300UpdateClipPlanes function
- move reg definition to r300_reg.h
- remove incorrect forward definition of tnl_UpdateFixedFunctionProgram and add proper #include
- remove unreachable code
2009-05-07 20:15:40 -04:00
Maciej Cencora
14365aa0ef r300: fix compiler warnings 2009-05-07 20:15:34 -04:00
Ben Skeggs
71b1c92405 nouveau: respect GALLIUM_STATE_TRACKERS_DIRS 2009-05-08 09:33:02 +10:00
Ben Skeggs
9e02fa4532 nouveau: remove dri1 code now we're using the dri state tracker 2009-05-08 09:33:02 +10:00
Ben Skeggs
b7f2b7e936 nouveau: use dri state tracker for dri1 2009-05-08 09:32:56 +10:00
Brian Paul
fa95ecb467 mesa: make the array object save/remove functions static 2009-05-07 14:34:09 -06:00
Brian Paul
32b851c807 mesa: clean-up vertex array object VBO unbinding and delete/refcounting
Don't really delete vertex array objects until the refcount hits zero.
At that time, unbind any pointers to VBOs.
2009-05-07 14:34:09 -06:00
Brian Paul
56cfa4de91 demos: delete vertex array objects upon exit 2009-05-07 14:34:09 -06:00
Brian Paul
1030bf0ded mesa: reference counting for gl_array_object
Every kind of object that can be shared by multiple contexts should be
refcounted.
2009-05-07 14:34:09 -06:00
Brian Paul
9bb6684799 mesa: array object comments 2009-05-07 14:34:09 -06:00
Brian Paul
4f6b704f97 mesa: move the NullBufferObj from GLcontext to gl_shared_state
Since shared array objects may point to the null/default buffer object,
the null/default buffer object should be part of the shared state.
2009-05-07 14:34:09 -06:00
Brian Paul
105c8529e7 mesa: fix comments, s/texture/buffer/ 2009-05-07 14:34:09 -06:00
Brian Paul
f37cccde3c vbo: in glDraw[Range]Element() code, check for out of bounds indexes
No-op the bad drawing command rather than go out of bounds and render
garbage.  Print a warning to alert the developer to the bad drawing call.
2009-05-07 11:01:02 -06:00
Brian Paul
6359ecebec mesa: remove unused gl_buffer_object::OnCard field 2009-05-07 10:12:33 -06:00
Brian Paul
dcca97a3e3 mesa: added gl_buffer_object::Written flag (for debug purposes)
The flag is set when we data has been written into the buffer object.
2009-05-07 10:12:33 -06:00
Brian Paul
b9d0f947f2 mesa: Compute gl_client_array->_MaxElement during array validation
Used to be done in the glVertex/Normal/Color/etc/Pointer() calls but
if the VBO was reallocated the size could change.
New _NEW_BUFFER_OBJECT state flag.
2009-05-07 10:12:33 -06:00
Brian Paul
800b14cd37 mesa: GLvector4f:: flags is a GLbitfield, update comments too. 2009-05-07 10:12:33 -06:00
Brian Paul
1f75c2daea mesa: add storage_count field to GLvector4f. Useful for debugging. 2009-05-07 10:12:33 -06:00
Brian Paul
828aa76f36 mesa: use array->BufferObj instead of ctx->Array.ArrayBufferObj
No difference, but a little more understandable.
2009-05-07 10:12:33 -06:00
Brian Paul
0077c879b5 mesa: added _ElementSize field to gl_client_array
Will be handy for bounds checking later...
2009-05-07 10:12:33 -06:00
Brian Paul
a6c8e900af mesa: use local var to make code a bit more concise 2009-05-07 10:12:33 -06:00
Brian Paul
b102c1d8f9 mesa: fix/add comments 2009-05-07 10:12:33 -06:00
Brian Paul
7e3bd457e8 mesa: use _mesa_sizeof_type() in vbo split code 2009-05-07 10:12:33 -06:00
Brian Paul
3acdab82cb mesa: vbo code reformatting, clean-up, comments 2009-05-07 10:12:33 -06:00
Brian Paul
87ba2285fe mesa: add GL_DOUBLE case in _mesa_sizeof_type() 2009-05-07 10:12:32 -06:00
Brian Paul
2369f14245 mesa: in vbo split code, map buffers read-only, not write-only
And use GL_ELEMENT_ARRAY_BUFFER where appropriate.
2009-05-07 10:12:32 -06:00
Brian Paul
74bec42b45 mesa: limit number of error raised by invalid GL_TEXTURE_MAX_ANISOTROPY_EXT 2009-05-07 10:12:32 -06:00
Brian Paul
ad32489987 tnl: added some clip debug/print code (disabled) 2009-05-07 10:12:32 -06:00
Brian Paul
424507953c mesa: reformatting, updated comments, const-correctness 2009-05-07 10:12:32 -06:00
Brian Paul
134ac52dec tnl: replace 0x3f with CILP_FRUSTUM_BITS 2009-05-07 10:12:32 -06:00
Brian Paul
f56893ea17 i965: relAddr local var (to make debug/test a little easier) 2009-05-07 09:59:13 -06:00
Brian Paul
9a4890dac7 Merge branch 'mesa_7_5_branch' 2009-05-07 09:46:53 -06:00
Eric Anholt
3d048e5750 i965: Remove bad constant buffer constant-reg-already-loaded optimization.
Thanks to branching, the state of c->current_const[i].index at the point
of emitting constant loads for this instruction may not match the actual
constant currently loaded in the reg at runtime.  Fixes a regression in my
GLSL program for idr's class since b58b3a786a.
2009-05-06 21:44:13 -07:00
Eric Anholt
156a79f5bd intel: Unmap buffers if needed at DeleteBuffer time.
This fixes a crash in glean's pbo test, which tripped over the assert when a
context was destroyed while a buffer was still mapped (Mesa doesn't call
UnmapBuffer in that case).  Regression in
c6bde8873f
2009-05-06 20:44:34 -07:00
Owen W. Taylor
cfc3ac8d6e When clearing the stencil buffer, don't use a two-sided stencil
In radeon_clear_tris(), when clearing the stencil buffer,
pass GL_FRONT_AND_BACK to _mesa_StencilFuncSeparate(), to avoid
triggering a software fallback on r300 and below.

https://bugs.freedesktop.org/show_bug.cgi?id=21601
2009-05-06 17:10:06 -04:00
Brian Paul
58544a28ad mesa: remove unnecessary buffer size check 2009-05-06 12:38:35 -06:00
Brian Paul
bb1fb2a544 mesa: code consolidation in glDraw[Range]Elements() validation 2009-05-06 12:38:35 -06:00
Brian Paul
88af3f8783 mesa: new comments, minor reformatting 2009-05-06 12:38:35 -06:00
Brian Paul
a13df193c2 mesa: use elementBuf local var instead of ctx->Array.ElementArrayBufferObj
Makes no real difference, but more consistant.
2009-05-06 12:38:35 -06:00
Eric Anholt
f831d2d41b i965: Remove the forced lack of caching for renderbuffer surface state.
This snuck in with the multi-draw-buffers commit, and is a major penalty
to performance.  It doesn't appear to be required, as the only dependency
the surface BO has is on the state key (and if there's some other dependency,
it should just be in the key).

This brings openarena performance up to almost 2% faster than Mesa 7.4.
2009-05-06 10:54:32 -07:00
Eric Anholt
4cb87840ff i965: Remove _NEW_PROGRAM from brw_wm_surfaces setup dependencies.
This was a leftover from the brw_wm_constant_buffer change.
2009-05-06 10:54:32 -07:00
Brian Paul
9b678af796 mesa: be smarter about allocating vert/frag program constants
Try to re-use constants/literals more often to make best use of the
constant buffer space.

See bug 21354.
2009-05-06 08:53:41 -06:00
Eric Anholt
71fb9d62ec i965: Split WM constant buffer update from other WM surfaces.
This can avoid re-uploading constant data when it isn't necessary, and is
a step towards not updating other surfaces just because constants change.
It also brings the upload of the constant buffer next to the creation.

This brings openarena performance up another 4%, to 91% of the Mesa 7.4 branch.
2009-05-06 06:44:14 -07:00
Eric Anholt
9490d86808 i965: Disentangle VS constant surface state from WM surface state.
Also, only create VS surface state if there's a VS constant buffer to be
uploaded, and set the contents of the buffer at the same time as creation.
2009-05-06 06:44:14 -07:00
Eric Anholt
d277547dc6 i965: Don't create constant buffers if they won't be used.
Really, the creation and upload of constants should be in the same place,
since they should only happen together, and a state flag should be
triggered by them so that we don't thrash state around so much for just
updating constants.  But this still recovers openarena performance by
another 19%, leaving us 16% behind Mesa 7.4 branch.
2009-05-06 06:44:13 -07:00
Dave Airlie
7f65fea95e radeon: hopefully fixup radeon cube state emission for kms 2009-05-06 14:43:07 +10:00
Dave Airlie
d7f62e5405 r100/r200: try and allocate miptree correct for hw.
This doesn't make things worse but according to sroland it
is how the GPU hw expects things on the r100/r200
2009-05-06 14:06:13 +10:00
Dave Airlie
acf086ebfa r200: fix cubic emission.
Still doesn't fix cubemaps, I really missed the whole drmsupports
thing when testing this all originally
2009-05-06 13:34:34 +10:00
Brian Paul
51325f44d1 mesa: only use fallback texture when using shaders, not fixed-function (take two)
The semantics are a little different for shaders vs. fixed-function when
trying to use an incomplete texture.  The fallback texture returning
(0,0,0,1) should only be used with shaders.  For fixed function, the texture
unit is truly disabled/ignored.

Fixes glean fbo test regression.
2009-05-05 16:31:44 -06:00
Brian Paul
823815a485 Revert "mesa: only use fallback texture when using shaders, not fixed-function"
This reverts commit a0edbfb28f.

This patch didn't completely fix the problem.  The next patch will.
2009-05-05 16:30:30 -06:00
Brian Paul
a0edbfb28f mesa: only use fallback texture when using shaders, not fixed-function
The semantics are a little different for shaders vs. fixed-function when
trying to use an incomplete texture.  The fallback texture returning
(0,0,0,1) should only be used with shaders.

Fixes glean fbo test regression.
2009-05-05 16:29:04 -06:00
Brian Paul
01e16befd4 mesa: only use fallback texture when using shaders, not fixed-function
The semantics are a little different for shaders vs. fixed-function when
trying to use an incomplete texture.  The fallback texture returning
(0,0,0,1) should only be used with shaders.

Fixes glean fbo test regression.
2009-05-05 16:21:20 -06:00
Brian Paul
c0d3761c16 mesa: minor simplification in enable_texture(), updated comments 2009-05-05 16:17:55 -06:00
Roland Scheidegger
5f8381724e r200: fix some cube map issues
remove the r100-ism of swapping cube faces which doesn't apply to r200,
and also use precalculated offsets.
Note that cube textures will still not work on r100 and r200 since mipmap
layout is level-first order (for r300) whereas r100/r200 require
face-first (and possibly also 2k alignment for face at least with tiling).
2009-05-05 21:01:36 +02:00
Roland Scheidegger
3503af07c4 r200: fix another section size mismatch 2009-05-05 20:17:37 +02:00
Brian Paul
b3fc832ac7 Merge branch 'mesa_7_5_branch' 2009-05-05 10:13:13 -06:00
Brian Paul
95b7771ea7 gallium: remove redundant cube face #defines 2009-05-05 10:13:11 -06:00
Roland Scheidegger
b2577937b6 r200: fix CS section size mismatch (bug 21565) 2009-05-05 17:45:50 +02:00
Keith Whitwell
077c904b76 progs/trivial: add test for vertex program invarient transform 2009-05-05 13:14:54 +01:00
Keith Whitwell
113403ef51 mesa: more complete fix for transform_invarient glitches
Add a new flag mvp_with_dp4 in the context, and use that to switch
both ffvertex.c and programopt.c vertex transformation code to
either DP4 or MUL/MAD implementations.
2009-05-05 13:14:53 +01:00
Keith Whitwell
22b417b75c mesa/main: set PREFER_DP4 to match position_invarient code
This is a quick fix for z fighting in quake4 caused by the mismatch
between vertex transformation here and in the position_invarient code.
Full fix would be to make this driver-tunable and adjust both
position_invarient and ffvertex_prog.c code to respect driver
preferences.
2009-05-05 13:14:52 +01:00
José Fonseca
c6bfb4c559 wgl: Implemente SwapLayerBuffers. 2009-05-05 13:14:51 +01:00
José Fonseca
e9fb90ab88 scons: Don't use deprecated Options. 2009-05-05 13:14:51 +01:00
José Fonseca
3537c3420d util: Limit the stack walk to avoid referencing undefined memory. 2009-05-05 13:14:50 +01:00
Keith Whitwell
b865501bda gallium/tgsi: hack around linker/archiver breakage
Add a dummy function which exists only so that tgsi_text_translate()
doesn't get magic-ed out of the libtgsi.a archive by the build system.
Don't remove unless you know this has been fixed - check on
mingw/scons builds as well.
2009-05-05 13:14:49 +01:00
Keith Whitwell
5f2569a1b9 progs/trivial: add vbo-noninterleaved test 2009-05-05 13:14:48 +01:00
José Fonseca
6b89c35c9f wgl: Include alpha bits in pixel format's cColorBits field. 2009-05-05 13:14:47 +01:00
Keith Whitwell
c6b3c2f34b gallium/draw: cope with unused vertex_elements 2009-05-05 13:14:46 +01:00
Keith Whitwell
4d548bd069 trivial: add line-flat.c 2009-05-05 13:14:45 +01:00
José Fonseca
ccec9f76d5 wgl: UINT_PTR null value is an integral type, so return 0 instead of NULL. 2009-05-05 13:14:44 +01:00
José Fonseca
a47f15ba1d pb: Save the stack backtrace when creating/mapping a debug buffer. 2009-05-05 13:14:42 +01:00
José Fonseca
4fd6f296f8 pb: Dump the fenced buffer sizes. 2009-05-05 13:14:38 +01:00
Stephane Marchesin
8edb50ff1e nv04: small fix again 2009-05-05 12:03:38 +02:00
Stephane Marchesin
39ebeead56 Fix an nv04 bug (thanks Mhopf). 2009-05-05 11:29:58 +02:00
Dave Airlie
f616995e5e radeon/r200: enable all the optional drm support bits 2009-05-05 10:51:44 +10:00
Brian Paul
f95c0c06c0 mesa: also print program params/constants when dumping shaders to disk 2009-05-04 11:14:35 -06:00
Brian Paul
27dbdb1684 mesa: remove some unfinished/devel code 2009-05-04 11:13:35 -06:00
Maciej Cencora
0b22615c2c r300: set proper texture row alignment for IGP chips
Looks like r400 based IGP chips require 64 byte alignment
2009-05-04 12:09:36 -04:00
Brian Paul
986d4a9ec6 draw: added some inf/nan debug code (disabled) 2009-05-01 18:35:59 -06:00
Brian Paul
08bc3d1750 gallium/glx: say we're direct rendering 2009-05-01 18:35:59 -06:00
Brian Paul
62043b2757 mesa: in glReadBufer() set _NEW_BUFFERS, not _NEW_PIXEL
Since GL_READ_BUFFER is historically part of the gl_pixel_attrib group
it made sense to signal changes with _NEW_PIXEL.  But now with FBOs it's
also part of the framebuffer state.

Now _NEW_PIXEL strictly indicates pixels transfer state changes.

This change avoids framebuffer state validation when any random bit of
pixel-transfer state is set.

DRI drivers updated too:  don't check _NEW_COLOR when updating framebuffer
state.  I think that was just copied from the Xlib driver because we care
about dither enable/disable state there.
2009-05-01 18:31:04 -06:00
Brian Paul
a7ef5b76d6 Merge branch 'mesa_7_5_branch' 2009-05-01 18:21:02 -06:00
Zack Rusin
54324d9e0c vg: remove a silly demo and add a bit better one 2009-05-01 19:08:32 -04:00
Brian Paul
602833b107 st: if st_swapbuffers() is called for single-buffered visual don't crash
Furthermore, return pointer(s) to the front color buffer(s).
2009-05-01 16:44:04 -06:00
Brian Paul
b57b6c2d2c xlib winsys: use new st_swapbuffers() function
The front/back buffer pointers are truly swapped (when there is an actual
front buffer).

This fixes some issues seen with apps/tests that draw to both the front
and back color buffers.  The true swap allows us to avoid the (potentially)
slow surface_copy() call in update_framebuffer_state() and is cleaner
overall.
2009-05-01 12:54:20 -06:00
Brian Paul
3f52a853f7 st: when creating an on-demand front color buffer, init to back buffer image
When we create a new front color buffer (user called glDrawBuffer(GL_FRONT))
initialize it to the contents of the back buffer.  Any previous call to
SwapBuffers() would have done that in effect, so make it reality.
2009-05-01 12:54:16 -06:00
Brian Paul
b85b315ebb st: added st_renderbuffer::defined flag
Indicates whether there's defined image contents, or garbage/don't care.
This is set when we draw into a renderbuffer and cleared when we resize/
reallocate a renderbuffer or do a buffer swap (back buffer becomes undefined).

We use this to determine whether the front color buffer has been drawn to,
and whether to display its contents upon glFlush/Finish(), when the new
st_swapbuffers() function is used.
2009-05-01 12:25:42 -06:00
Brian Paul
30b3d80091 mesa: fix comment 2009-05-01 12:12:43 -06:00
Brian Paul
06cd826fcb Merge branch 'mesa_7_5_branch' 2009-05-01 11:57:00 -06:00
Brian Paul
d6318ba8a8 docs: asst updates to openvg.html 2009-05-01 11:37:09 -06:00
Brian Paul
3534539557 set: new st_swapbuffers() which does a true front/back buffer swap
The pointers to the front/back renderbuffers are exchanged.
This new function isn't actually used yet...
2009-05-01 11:24:08 -06:00
Zack Rusin
544dd4b11f OpenVG 1.0 State Tracker
Import of the OpenVG 1.0 state tracker for Gallium.
2009-05-01 12:51:59 -04:00
Zack Rusin
fbceedd2de actually add debug to the debug config 2009-05-01 12:51:01 -04:00
José Fonseca
293f576db7 egl_xlib: Pass RTLD_LAZY to dlopen.
dlopen manpage mandates that either RTLD_LAZY or RTLD_NOW flags must be
passed. Not doing so was causing a NULL return on debian unstable x86-64.
2009-05-01 12:51:01 -04:00
Ian Romanick
2085cf2462 Test either GL_FRONT_LEFT or GL_FRONT for front-buffer rendering
For non-stereo visuals, which is all we support, we treat
GL_FRONT_LEFT as GL_FRONT.  However, they are technically different,
and they have different enum values.  Test for either one to determine
if we're in front-buffer rendering mode.

This fix was suggested by Pierre Willenbrock.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2009-05-01 09:49:06 -07:00
Brian Paul
cd6734288d st: when double buffered, only create front color buffer on demand
Before we always created the front color buffer, even if was never used.
This can save some memory.
2009-05-01 10:19:00 -06:00
Brian Paul
b9196c1fa3 Merge branch 'const-buffer-changes'
Conflicts:

	src/mesa/drivers/dri/i965/brw_curbe.c
	src/mesa/drivers/dri/i965/brw_vs_emit.c
	src/mesa/drivers/dri/i965/brw_wm_glsl.c
2009-05-01 09:37:14 -06:00
Brian Paul
3f25219c7b mesa: create/use a fallback texture when bound texture is incomplete
When a GLSL sampler reads from an incomplete texture it should
return (0,0,0,1).  Instead of jumping through hoops in all the drivers
to make this happen, just create/install a fallback texture with those
texel values.

Fixes piglit/fp-incomplete-tex on i965 and more importantly, fixes some
GPU lockups when trying to sample from missing surfaces.  If a binding
table entry is NULL, it seems that sampling sometimes works, but not
always (lockup).

Todo: create a fallback texture for each type of texture target?
2009-05-01 09:30:32 -06:00
Brian Paul
7ca0427338 docs: initial 7.6 release notes page 2009-05-01 09:24:19 -06:00
Brian Paul
666e5bf4a6 mesa: bump version to 7.6 (devel) 2009-05-01 09:22:20 -06:00
Brian Paul
dca190e943 mesa: added _mesa_check_soa_dependencies() function
This function will check an instruction to see if there's data dependencies
between the dst and src registers if executed in an SOA manner.
2009-04-29 13:04:42 -06:00
Alex Deucher
55db6ce537 R300: add quadpipe overrides
RV410 SE chips only have 1 quadpipe.
Also, handle other R300 chip with quadpipe override.
2009-04-28 12:50:38 -04:00
Dave Airlie
5ca4f3c5da radeno: cleanup the startup path further 2009-04-28 15:44:10 +10:00
Dave Airlie
a9d64873d7 radeon: further cleanup dri1 screen init 2009-04-28 15:35:52 +10:00
Dave Airlie
7731d93165 r300: remove unused debugging in set tex buffer paths 2009-04-28 15:27:31 +10:00
Dave Airlie
4e7d603fae radeon: remove kernel mm, dri2 path takes care of it 2009-04-28 15:26:24 +10:00
Maciej Cencora
ce0d10dd6c r300: fix fragment program limits 2009-04-27 14:33:24 -04:00
Maciej Cencora
3c6bffa761 r300: fallback only if stencil test is enabled 2009-04-27 14:33:24 -04:00
Maciej Cencora
e33e28f52a r300: do front/back color selection in HW for software TCL path 2009-04-27 14:33:23 -04:00
Maciej Cencora
3d83a709b9 r300: fix valgrind warnings 2009-04-27 14:33:23 -04:00
Maciej Cencora
78c0e6aefc r300: fix point size clamping when point is not attenuated 2009-04-27 14:33:23 -04:00
Brian Paul
dd4802176f i965: #include prog_print.h to silence warning 2009-04-27 10:46:30 -06:00
Brian Paul
777b9ff43e i965: only upload constant buffer data when we actually need the const buffer
Make the use_const_buffer field per-program and only call the code which
updates the constant buffer's data if the flag is set.

This should undo the perf regression from 20f3497e4b

(cherry picked from master, commit dc9705d12d)
2009-04-27 10:45:41 -06:00
Maciej Cencora
033d1365e6 r300: fix performance regression
This performance regression on non TCL hw was introduced by ed4c6cbe01.
This patch depends on "r300: always route 4 texcoord components to RS" and "r300: add point attenuation stage for TCL fallbacks".
2009-04-27 19:08:41 +10:00
Maciej Cencora
7f6b13be86 r300: add point attenuation stage for TCL fallbacks 2009-04-27 19:08:12 +10:00
Maciej Cencora
d014d7d1bb r300: always route 4 texcoord components to RS
Routing <4 components may lead to lock up.

Thanks to Alex Deucher for suggestion.
2009-04-27 19:07:50 +10:00
Maciej Cencora
22c0652c38 r300: flush stdout to get consistent debugging info 2009-04-27 19:07:16 +10:00
Maciej Cencora
7ff2dcbbdc r300: add atom print function for kernel mm path 2009-04-27 19:06:38 +10:00
Maciej Cencora
25dd867c58 r300: handle texcoords properly
add 1D texture case and setup default Q value to 1.0
2009-04-27 19:06:00 +10:00
Maciej Cencora
199710914a r300: remove unnecessary function calls
ae_create_context is called by vbo_CreateContext
ae_invalidate_state is called by vbo_InvalidateState
2009-04-27 19:05:37 +10:00
Maciej Cencora
607c6cf188 r300: rename state
According to r300_reg.h from radeon drm module 0x4f30 is ZB_ZMASK_OFFSET.
Also cleanup as trailing whitespaces.
2009-04-27 19:04:52 +10:00
Maciej Cencora
931c89f6f6 r300: remove unnecessary function calls
r300SetEarlyZState is called during r300UpdateShaderStates which is called for every rendering operation.
2009-04-27 19:04:21 +10:00
Brian Paul
b58b3a786a i965: rework GLSL/WM register allocation
Use a bitvector of used/free flags.

If we run out of temps, examine the live intervals of the temp regs in
the program and free those which are no longer alive.

Also, enable the new WM const buffer code.
2009-04-24 16:33:46 -06:00
Brian Paul
7da3f9403b mesa: refactor code and make _mesa_find_temp_intervals() public 2009-04-24 16:28:36 -06:00
Jerome Glisse
32d185eb60 r300: fix cliprect values 2009-04-24 19:54:01 +02:00
Brian Paul
027ed1b505 mesa: signal _NEW_PROGRAM_CONSTANTS instead of _NEW_PROGRAM
Use _NEW_PROGRAM_CONSTANTS when changing constant/uniform buffer values.
Binding a new program/shader sets both _NEW_PROGRAM and _NEW_PROGRAM_CONSTANTS.
2009-04-24 09:43:44 -06:00
Jerome Glisse
5dec94696e r300: emit cliprect when in dri2 mode 2009-04-24 15:03:23 +02:00
Brian Paul
ebfbd8c4fe i965: disable debug printf 2009-04-22 13:46:58 -06:00
Brian Paul
ac22178eb0 i965: enable VS constant buffers
In the VS constants can now be handled in two different ways:
1. If there's room in the GRF, put constants there.  They're preloaded from
   the CURBE prior to VS execution.  This is the historical approach.  The
   problem is the GRF may not have room for all the shader's constants and
   temps and misc registers.  Hence...
2. Use a separate constant buffer which is read from using a READ message.
   This allows a very large number of constants and frees up GRF regs for
   shader temporaries.  This is the new approach.  May be a little slower
   than 1.

1 vs. 2 is chosen according to how many constants and temps the shader needs.
2009-04-22 11:52:16 -06:00
Brian Paul
5c8fb6acc1 i965: define BRW_MAX_GRF 2009-04-22 11:47:59 -06:00
Brian Paul
21a422d97e i965: remove old code to init surface-related cache IDs
These types are only found in the new surface state cache now.
2009-04-22 11:29:49 -06:00
Brian Paul
c0c58cf5cf i965: comments, reformatting 2009-04-22 11:28:24 -06:00
Brian Paul
4843e54fc6 i965: actually use the new, second surface state cache 2009-04-22 11:12:07 -06:00
Brian Paul
f9af97c7a5 i965: checkpoint commit: use two state caches instead of one
The new, second cache will only be used for surface-related items.
Since we can create many surfaces the original, single cache could get
filled quickly.  When we cleared it, we had to regenerate shaders, etc.
With two caches, we can avoid doing that.
2009-04-22 11:08:46 -06:00
Brian Paul
a071a8d2e7 i965: remove unused state atom entries 2009-04-22 10:44:36 -06:00
Brian Paul
f428255bde i965: the brw_constant_buffer state atom is no longer dynamic
No more dynamic atoms so we can simplify the state validation code a little.
2009-04-22 09:23:15 -06:00
Brian Paul
e5681fc176 i965: add _NEW_PROGRAM_CONSTANTS to mesa_bits[] list 2009-04-22 09:16:21 -06:00
Brian Paul
a36dd5d54e i915: check the new _NEW_PROGRAM_CONSTANT flag 2009-04-22 09:14:53 -06:00
Brian Paul
1dbab84e21 i965: use _NEW_PROGRAM_CONSTANTS and always create new const buffers
When program constants change we create a new VS constant buffer
instead of re-using the old one.  This allows us to have several
const buffers in flight with vertex rendering.
2009-04-22 09:14:16 -06:00
Brian Paul
6b6a23c0f7 i965: updates to some debug code 2009-04-22 09:07:46 -06:00
Brian Paul
817dcdd280 i965: use new _NEW_PROGRAM_CONSTANTS flag instead of dynamic flags 2009-04-22 09:07:02 -06:00
Brian Paul
f48473e425 r200/r300/r500: add _NEW_PROGRAM_CONSTANTS flag
Make sure we detect constant buffer changes indicated by the new flag.
Should be able to remove _NEW_PROGRAM (and _NEW_MODELVIEW, _NEW_LIGHT, etc)
from several places (someday.
2009-04-22 08:59:47 -06:00
Dave Airlie
466c78c935 Merge remote branch 'origin/master' into radeon-rewrite 2009-04-22 21:41:57 +10:00
Richard Li
604dd37f66 R6xx/R7xx: remove unused files 2009-04-21 15:04:54 -04:00
Richard Li
581093d27c R6xx/R7xx: add updated reg file 2009-04-21 14:30:52 -04:00
Richard Li
27c07b6b28 Initial pull of code from r6xx-r7xx-support branch
Not functional yet.
2009-04-21 12:54:20 -04:00
Maciej Cencora
65fe0c86ff r300: fix missing function declaration 2009-04-19 15:04:54 -04:00
Maciej Cencora
bcef4b63eb r300: revert part of cb4bef7ae0
Some debugging code got there by accident
2009-04-19 15:04:44 -04:00
Maciej Cencora
78878a13fe r300: cleanup includes 2009-04-19 22:15:05 +10:00
Maciej Cencora
a2d49eeaeb r300: move common fp functions to seperate file 2009-04-19 22:15:01 +10:00
Maciej Cencora
300661d12a r300: more r300/r500 unification
reuse insert_WPOS_trailer function
2009-04-19 22:14:56 +10:00
Maciej Cencora
155cc1647f r300: more prepare for merge 2009-04-19 22:14:53 +10:00
Maciej Cencora
97104c2559 r300: further r300/r500 merge preparation 2009-04-19 22:14:50 +10:00
Maciej Cencora
33af54af0d r300: merge r300/r500 fragment program compiler structure 2009-04-19 22:14:46 +10:00
Maciej Cencora
aa04e7d475 r300: merge r300/r500 fragment program structures 2009-04-19 22:14:42 +10:00
Maciej Cencora
27d4546f60 r300: r300/r500 fp shader merge WIP 2009-04-19 22:14:39 +10:00
Maciej Cencora
cb4bef7ae0 r300: general cleanup
- remove unused fields
- remove unused defines and macros
- flatten one structure
2009-04-19 22:14:36 +10:00
Maciej Cencora
b552446b95 r300: remove unnecessary forward function declaration 2009-04-19 22:13:06 +10:00
Maciej Cencora
3fd0084154 r300: context creation cleanup
- move constant values initialization to seperate function
- remove obvious comments
2009-04-19 22:12:31 +10:00
Dave Airlie
3230cb5f53 radeon: update clear state with latest intel code 2009-04-19 22:04:42 +10:00
Maciej Cencora
9028335371 r300: we always want non NDC coords format for swtcl 2009-04-17 11:27:36 +10:00
Maciej Cencora
d7d5c97a21 r300: cleanup frag prog setup a little
Use proper fields for marking if fp is translated, and if is translated succesfully.
Now if fp gets translated (even unsuccesfully) fp->translated is true. If the translation failed (i.e. because we exceeded limit of
maximum texture indirections) the fp->error is set. With a little updated fallback function it prevents non native fragment programs
from beeing translated with every frame (the translation would fail anyway so there's no point to try again).

Also implement IsProgramNative function for GL_FRAGMENT_PROGRAM_ARB (it should give some performance boost in apps that checks if
program is native and falls back to simpler shader to meet hw limits if necessary) and cleanup indentation (remove whitespaces on empty
lines).
2009-04-17 11:27:31 +10:00
Maciej Cencora
a92bc56e24 r300: update r500 path for reordered WPOS and FOG fp attributes
Report and regression testing by Fabio Pedretti.
2009-04-17 11:27:27 +10:00
Dave Airlie
3264352c57 dri: attempt to actually refcount the __DRIDrawable
valgrind was showing a race between the drawable getting destroyed
by the X resource freeing code, and the context getting destroyed
later and freeing the drawable.

However I've no idea if some other combination of things could cause
this code to leak.
2009-04-16 13:06:24 +10:00
Dave Airlie
143b416af6 radeon: take a bo reference when adding to validate list 2009-04-16 13:06:08 +10:00
Jerome Glisse
1fd76ae930 r200: fix texture level for compiz case 2009-04-12 15:51:31 +02:00
Jerome Glisse
02b130fd4b r200: validate vertex buffer 2009-04-12 14:25:36 +02:00
Jerome Glisse
8181f8fbf9 radeon: emit scissor when using cs path 2009-04-12 13:11:06 +02:00
Alex Deucher
9b162cdda7 Fix build errors from merge 2009-04-10 17:36:31 -04:00
Alex Deucher
04f335fd16 Merge branch 'radeon-rewrite' of git+ssh://agd5f@git.freedesktop.org/git/mesa/mesa into r6xx-rewrite 2009-04-10 17:16:08 -04:00
Alex Deucher
c0419f190c Remove r500 stuff 2009-04-10 16:36:18 -04:00
Alex Deucher
69edb8a156 R600/r700: add new cmdbuf macros 2009-04-09 16:05:50 -04:00
Alex Deucher
e24e4ae2e8 R6xx/R7xx: r300 -> r600 symbols 2009-04-09 10:55:41 -04:00
Dave Airlie
5e361c47ab r300: fix color tiling 2009-04-09 10:51:10 +10:00
Maciej Cencora
1ec0efa7d3 r300: reorder fog coordinate and WPOS fp attributes
HW TCL path currently assumed fog, WPOS order. The order was inverted for SW TCL path.

This hopefully fixes rest of fog and WPOS related bugs.
Additionally fix some indentation, don't route unnecessary components of fog coordinates for performance reasons and simplify vertex
attribute emitting for SW TCL path.
2009-04-09 10:31:51 +10:00
Maciej Cencora
3b1d544001 r300: fix regression from swtcl rewrite
Fix wrong attribute emit and revert to previous behaviour of calculating VAP_OUT_VTX_FMT_1 register value.

We can't use r300VAPOutputCntl1 function because it assumes that all texture coords have 4 components and that is the case for HW TCL
path, but not for SW TCL.
2009-04-09 10:31:36 +10:00
Dave Airlie
d1a9b1f513 Merge remote branch 'origin/master' into radeon-rewrite
Conflicts:
	src/mesa/drivers/dri/r200/r200_tex.c
	src/mesa/drivers/dri/r300/r300_cmdbuf.c
	src/mesa/drivers/dri/r300/r300_context.h
	src/mesa/drivers/dri/r300/r300_swtcl.c
	src/mesa/drivers/dri/r300/r300_tex.c
	src/mesa/drivers/dri/r300/r300_texmem.c
	src/mesa/drivers/dri/r300/r300_texstate.c
	src/mesa/drivers/dri/radeon/radeon_tex.c
2009-04-09 10:31:08 +10:00
Alex Deucher
4138bdb3b1 R600: initial copy of r300 code 2009-04-08 15:16:35 -04:00
Alex Deucher
90ffce4973 radeon: fix compiler warning 2009-04-07 12:37:10 -04:00
Maciej Cencora
e2ce1d80d1 r300: swtcl rewrite and cleanup
- remove unused variables
- silence compiler warnings
- fix twosided lighting
- fix point attenuation
- unify indentation
2009-04-07 21:08:40 +10:00
Dave Airlie
86556f8bda radeon/r200/r300: fix missing dma buffer validation
this make gnome shell run
2009-04-07 15:08:56 +10:00
Dave Airlie
23478f1c03 radeon: fix bocs wrapper 2009-04-07 15:08:56 +10:00
Jerome Glisse
741aaaa288 radeon: add support for new ttm 2009-04-06 11:58:08 +02:00
Dave Airlie
05304d41f2 radeon/r200/r300: fix up the whole buffer space checking.
This fixes up the buffer validation scheme, so that we keep a list
of buffers to validate so cmdbuf flushes during a pipeline get
all the buffers revalidated on the next emit.

This also fixes radeonFlush to not flush unless we have something
useful to send to the GPU, like a DMA buffer or something not state
2009-04-02 18:58:49 +10:00
Dave Airlie
4170216009 radeon/common: use glCtx not ctx 2009-04-02 14:47:51 +10:00
Dave Airlie
e00ef43d79 radeon/r200/r300: collapse context destruction down to a common path.
Context destruction was nearly the same over all the drivers,
so collapse it down.
2009-04-02 14:44:29 +10:00
Dave Airlie
104d542205 radeon: tiling support 2009-04-02 14:44:08 +10:00
Dave Airlie
617c5262c6 r300: fix qtdemo qt4 startup 2009-04-02 11:30:03 +11:00
Dave Airlie
f9d272fa41 radeon: go back and repick texture formats.
This might trip up some serious FBO users, will have to see, but
it avoids the slow paths for all the demos I have.
2009-04-01 16:13:30 +10:00
Dave Airlie
6e30fe4873 radeon: fixup render buffer cleanups
this fixes qtdemo-qt4 starting and a leak in glxgears exit
2009-04-01 15:41:58 +10:00
Dave Airlie
d81a48757a radeon/dri2: if the depth buffer is 16-bit force cpp == 2
This is because the DDX always allocates using the drawable sizes.
which gives me twice the depth buffer I asked for, dumb.
2009-03-31 15:50:19 +10:00
Dave Airlie
2f3be8ab14 radeon: fix pixel readback for RGB8 tests 2009-03-31 14:43:14 +10:00
Dave Airlie
5ad32cfd21 r200: fix glean pixelFormats regression 2009-03-31 13:39:57 +10:00
Dave Airlie
5c7fc1cb8e r300: fix stencil clears 2009-03-31 20:10:48 +10:00
Dave Airlie
226c876a52 r200: only set all dirty on kernel clears 2009-03-31 10:46:27 +10:00
Dave Airlie
e1d1657493 radeon/r200: fix glean failures on readPixSanity since EXT_DEPTH_STENCIL support 2009-03-31 10:36:06 +10:00
Dave Airlie
1570bde279 r200: fix veclinear emission 2009-03-31 10:35:16 +10:00
Dave Airlie
3b09f6544a radeon: fix readback problem for piglit tests 2009-03-30 12:28:55 +10:00
Dave Airlie
8ed405cd37 radeon/r200/r300: set correct row stride for rbs 2009-03-26 13:24:21 +10:00
Dave Airlie
e757bf964f r300: check buffer sizes in non-tcl case + set correct VRAM limits 2009-03-26 13:24:21 +10:00
Dave Airlie
258686a973 radeon: fixup map/unmap texture to work with override BOs
if you hit this you've already failed but we shouldn't crash
2009-03-26 13:24:21 +10:00
Dave Airlie
4d36a19c90 r200: add fbo files to the compile 2009-03-26 11:15:07 +10:00
Dave Airlie
f577c8e462 radeon/r200/r300: fix warnings 2009-03-24 18:32:46 +10:00
Dave Airlie
5021b47dd3 r300: remove lock.h link 2009-03-24 15:21:49 +10:00
Dave Airlie
20981c0a0b radeon: fixup some issue with fbos and sw fallbacks 2009-03-24 15:06:19 +10:00
Dave Airlie
0a725db10c radeon/r200/r300: set the texture depth correctly for DRI2 2009-03-24 11:19:09 +10:00
Dave Airlie
ccd18f462c radeon: actual format is rgba8 2009-03-24 09:45:26 +10:00
Dave Airlie
2aa097f963 radeon: fix typo 2009-03-24 09:45:18 +10:00
Dave Airlie
28e082197d radeon: setup pipes for r300 2009-03-24 09:28:52 +10:00
Dave Airlie
9f11b3311e radeon: stupid mesa extension fail 2009-03-24 09:26:31 +10:00
Dave Airlie
f9d3de06bd radeon: fixup wrapper bo name 2009-03-23 19:32:10 +10:00
Dave Airlie
cb68588c93 Merge branch 'radeon-fbo-hacking' into radeon-rewrite 2009-03-23 18:56:34 +10:00
Dave Airlie
8c7e30fb95 raedon/r200/r300: mega-FBO commits.
Re work depth issues.
Do a lot more FBO abstactions
fixup depth/stencil buffer interactions
2009-03-23 18:54:06 +10:00
Dave Airlie
c607a664dd radeon fbo: add draw offset calcs 2009-03-22 19:11:46 +10:00
Dave Airlie
4a2cb696cc radeon/r200/r300: add support for new tfp interface
also fixup old interface, gets rid of white boxes in compiz
2009-03-22 12:03:24 +10:00
Dave Airlie
2d26d4ac66 Merge remote branch 'origin/master' into HEAD 2009-03-22 12:01:21 +10:00
Dave Airlie
06cb6f7aa7 radeon: use mipmap fns in FBO code 2009-03-22 11:57:03 +10:00
Dave Airlie
0968512f8f radeon: add miptree offset functions 2009-03-22 11:56:41 +10:00
Dave Airlie
c73f4fdb65 r200: fix for sure 2009-03-21 22:41:42 +10:00
Dave Airlie
4bd5ee2d97 radeon/r200: oops make correct fbo init calls 2009-03-21 22:35:01 +10:00
Dave Airlie
9f7a03d945 radeon: add xRGB span functions
same as ARGB need to add a parameter to get ptr32
2009-03-21 21:42:54 +10:00
Dave Airlie
218083c542 radeon: dri2 is hooked up elsewhere now 2009-03-21 22:38:28 +11:00
Dave Airlie
98f1b1e6f9 radeon/r200: add fbo init 2009-03-21 22:38:11 +11:00
Dave Airlie
6c48c93a53 radeon/r200: add fbo state changes 2009-03-21 22:36:18 +11:00
Dave Airlie
712478cfdd r300: fix viewport inversion for FBOs 2009-03-21 22:27:01 +11:00
Dave Airlie
8ab7c77dc2 radeon: align FBO pitch 2009-03-21 18:16:21 +10:00
Dave Airlie
56c5df33de radeon: fixup last missing x_off/y_off 2009-03-21 18:16:02 +10:00
Dave Airlie
8a60083676 radeon: add cpp/pitch to rrb 2009-03-21 18:07:33 +10:00
Dave Airlie
e795bd3c90 radeon/fbo: add x_off and y_off in correct places 2009-03-21 18:05:54 +10:00
Dave Airlie
86dcbb5457 radeon: dPriv handling is now in cliprects code 2009-03-21 16:51:46 +10:00
Dave Airlie
9368dcb426 radeon: fixup span code for FBOs 2009-03-21 16:08:20 +10:00
Dave Airlie
fbda2ad445 r300: hw clear buffer 0 hopefully 2009-03-21 15:05:34 +10:00
Dave Airlie
ffde891a03 radeon: fix up span function setting 2009-03-21 14:31:14 +10:00
Dave Airlie
22443d5cc0 r300: init fbos 2009-03-20 22:34:30 +10:00
Dave Airlie
ba890ad35b more fbo fillin 2009-03-20 22:29:15 +10:00
Dave Airlie
e3faf5b51d r300: enable FBO for a test 2009-03-20 22:15:22 +10:00
Dave Airlie
230abc06f8 radeon: some more fbo work 2009-03-20 22:07:05 +10:00
Dave Airlie
fabce837f9 radeon: initial couch code copy from radeon 2009-03-20 18:23:38 +10:00
Dave Airlie
407e8ae5b1 Merge remote branch 'main/master' into radeon-rewrite
Conflicts:
	src/mesa/drivers/dri/r300/r300_cmdbuf.c
	src/mesa/drivers/dri/r300/r300_state.c
	src/mesa/drivers/dri/r300/r300_swtcl.c
	src/mesa/drivers/dri/r300/radeon_ioctl.c
	src/mesa/drivers/dri/radeon/radeon_screen.c
2009-03-20 10:52:17 +10:00
Dave Airlie
bdaa0341ca radeon/r200/r300: cleanup some of the renderbuffer code 2009-03-19 15:31:03 +10:00
Dave Airlie
c0c06803fe radeon: fix up locking like the intel driver for pageflip/swaps 2009-03-19 14:46:52 +10:00
Michel Dänzer
aa85973f95 Fixup previous commit.
radeonScheduleSwap() already takes the lock in the SwapBuffers case, only
the CopySubBuffer case was missing it.
2009-03-16 12:51:50 +01:00
Michel Dänzer
9c591c52c7 radeon: Take the hardware lock for swaps and flips.
Otherwise they fail with AIGLX at least.
2009-03-16 11:33:14 +01:00
Dave Airlie
0fc6c2644c radeon: remove unused lines 2009-03-10 11:00:14 +10:00
Dave Airlie
14c3bddbac r200: enable hw clears 2009-03-10 19:03:07 +10:00
Dave Airlie
c122cc4097 r300: emit texture in GTT or VRAM 2009-03-09 13:44:03 +10:00
Dave Airlie
778cf80d9e r300: move firevertices out into the main place its needed.
This fixes a hang on context destruction on rs690
2009-03-09 13:06:10 +11:00
Dave Airlie
1386e8a6ba radeon: fix cut-n-paste typo 2009-03-08 02:41:30 +10:00
Dave Airlie
f881035fd8 rs690: fix r300 swtcl bug in DMA code.
When we finish emitting swtcl objects, we request space in the cmdbuf,
and flush if no space exists. However in this case we also flush
the DMA buffer we just put the vertices we wanted to send in.

This checks in advance if we have space in the buffer.
2009-03-07 17:23:40 +11:00
Dave Airlie
760068cc8d r300: fix uninit variable warning 2009-03-06 23:42:35 +11:00
Dave Airlie
e0313ef061 r300: fix swtcl codepaths 2009-03-06 23:42:17 +11:00
Dave Airlie
c6ac53bc40 radeon: implement userspace clears
This is pretty much Eric Anholts implementation of clear using the GL state machine
from the Intel drivers.

It works quite well for now for us, probably could do with trying to use Z engine for
clears.
2009-03-06 16:07:23 +10:00
Dave Airlie
b074aacdb2 r200: cs emit state fixups 2009-03-06 05:42:37 +10:00
Dave Airlie
a03a4dd524 r200: remove depth check for dri2 2009-03-06 04:48:20 +10:00
Dave Airlie
7ba9eb1e85 r200: temporary sw clear code 2009-03-06 04:48:20 +10:00
Kristian Høgsberg
8567d003d5 Add a DRI CopyBuffer extension to expose 2d blits. 2009-03-05 07:46:44 -05:00
Dave Airlie
9d72a75917 radeon: use t->bo to figure out of settexbuffer override is in action 2009-03-05 19:00:17 +10:00
Dave Airlie
eba8008916 r200: port over state emits for kms from radeon
this needs testing on real hw
2009-03-05 18:58:48 +10:00
Dave Airlie
5c80eb7ec1 r200: add set tex buffer support 2009-03-06 02:37:10 +10:00
Dave Airlie
31f1298807 radeon: r100 clean up CS packet size calc 2009-03-04 22:26:44 +10:00
Dave Airlie
924bf0d8d3 radeon: settexbuffer support
This gets DRI2 compiz going
2009-03-04 22:26:20 +10:00
Dave Airlie
26d0172a5b radeon: fix texturing for r100 2009-03-04 20:24:08 +10:00
Dave Airlie
940d47de08 radeon: use swrast clear - fail on depth
need to write real hw user clear
2009-03-04 18:36:46 +10:00
Dave Airlie
e0de73e8a5 radeon: fixup some segfaults/exit at startup 2009-03-04 18:36:13 +10:00
Dave Airlie
54b42c0a4a radeon: remove debugging 2009-03-03 03:37:23 +10:00
Dave Airlie
2b85fccae5 radeon: refactor framebuffer code like intel
this is a step towards fbos and should fix pageflipping, but
I think the first flip seems broken.
2009-03-03 03:29:37 +10:00
Alex Deucher
863c76a7bb R300: add support for RS600 chips 2009-02-27 14:48:24 -05:00
Alex Deucher
5a34ace3e6 R300: set the number of GB pipes on all r3xx-r5xx chips 2009-02-27 14:31:14 -05:00
Dave Airlie
0dba8883e3 r300: make ste text buffer work with > 2048 on r500 2009-02-27 14:04:03 +10:00
Dave Airlie
26c1b0af02 radeon: add more fbconfigs
this makes glxgears get its background back when running under DRI2
2009-02-27 14:04:03 +10:00
Dave Airlie
7f44b62a4a r300: remove depth offset exits in favour of rrb depth changes 2009-02-27 14:04:03 +10:00
Dave Airlie
294aab9b71 r200: fixup emit sizes for kms 2009-02-27 03:37:30 +10:00
Dave Airlie
e267a090ab r200: port over cs emit changes from radeon 2009-02-27 03:05:42 +10:00
Dave Airlie
2972d06526 radeon: fixup old packets emission for CS case 2009-02-26 18:26:22 +10:00
Dave Airlie
6d7164705b r100: fixup kms state emissions 2009-02-26 15:32:34 +10:00
Dave Airlie
6415e64cbc radeon: avoid page flip code in DRI2 2009-02-26 15:32:34 +10:00
Dave Airlie
3ec7137a75 radeon: enable DRI2 for r100 2009-02-26 15:32:33 +10:00
Dave Airlie
925ea2d9a5 radeon: move CB/ZB state init into emit code
This removes the use of the sarea for this stuff so makes DRI2 easier
and emits the CB/ZB info in the correct place
2009-02-26 15:32:27 +10:00
Dave Airlie
158ede35d5 r300: fixup texture state emission for kms path 2009-02-26 11:09:32 +10:00
Dave Airlie
2c033f3893 r300: don't call page flip on DRI2 2009-02-26 11:09:16 +10:00
Dave Airlie
bc5f94c1e1 r300: don't flush VAP too often.
Flush the VAP the first time for each state atom we upload new
VAP data
2009-02-26 11:08:14 +10:00
Dave Airlie
199867bd45 r300: drop r300Flush for the generic one 2009-02-25 18:06:44 +10:00
Dave Airlie
2ebf9b9521 r300: fix bo ref/unref, plugs DRI handle leaks 2009-02-24 12:04:49 +10:00
Dave Airlie
c32a28d86e r300: fixup old setTexOffset DRI1 extension 2009-02-23 15:41:30 +10:00
Dave Airlie
f4502f0f8c radeon: add more debug info to the flush debug 2009-02-23 14:04:22 +10:00
Dave Airlie
018f5f92cc r300: revert back autostate change on cacheflush emit 2009-02-23 14:04:22 +10:00
Dave Airlie
13ed7985b2 r300: use OUT_BATCH_REGVAL in a few more places 2009-02-23 14:04:20 +10:00
Dave Airlie
6ffd472b0e r300: set u to 0 so debug logs are easier to read 2009-02-23 14:04:19 +10:00
Dave Airlie
8c23970479 radeon: stabilise r300 driver like the F10 mesa bufmgr
For some reason flushs caused by this CS needs flush hook,
caused the chip to lockup on r300 under compiz, whereas
the F10 driver was rock solid.
2009-02-23 14:04:18 +10:00
Dave Airlie
77161c5ff5 radeon: add some debugging for flush ioctls 2009-02-23 14:04:18 +10:00
Dave Airlie
d4bfe34cb9 radeon: make state atom print like old r300 code 2009-02-23 14:04:17 +10:00
Dave Airlie
b4a90c6213 radeon: fixup legacy bo/cs out of VRAM waiting.
This is similiar to the code from the F10 r300 bufmgr
2009-02-23 14:04:17 +10:00
Dave Airlie
da17b36412 r300: make DRI2 not crash on compiz start 2009-02-18 10:47:17 +10:00
Dave Airlie
e9d6beaab4 radeon: move device param id check ifndef 2009-02-18 10:47:17 +10:00
Dave Airlie
745c787338 radeon: initialise swapped objects pointer 2009-02-17 16:01:16 +10:00
Dave Airlie
9c040745fe radeon: legacy texMem interface fixups.
The texmem.c interface is wildly messed up it really wants to own the objects
so let it, pain in the ass but this code should work a lot better now
2009-02-17 14:48:49 +10:00
Dave Airlie
7ce6af25e5 Revert "dri/radeon: export a function to cleanup a texture object."
This reverts commit 5325f86240.
2009-02-17 14:46:12 +10:00
Dave Airlie
2ba4fc3d60 radeon/r200: drop legacy texture heap code 2009-02-17 14:00:24 +10:00
Dave Airlie
48e7b940eb radeon/r200: fixup texturing aging calls 2009-02-17 13:39:38 +10:00
Dave Airlie
7c7ff659ce radeon: fixup destroy texture object exit path and update LRU
the destroy path was doing bad things with structure names, make it do less
bad things, use container_of instead
2009-02-17 11:17:22 +10:00
Dave Airlie
43c71a2d40 radeon: remove leftover debug 2009-02-17 10:42:51 +10:00
Dave Airlie
62d504d818 radeon/r200: drop dirty state from texture object + pp_txoffset
this is just more code cleanup for old dead code
2009-02-17 10:41:21 +10:00
Dave Airlie
a365f9b78b r200: align with r100 code 2009-02-17 10:28:43 +10:00
Dave Airlie
646325a5ef radeon: fix not emitting texture state correctly
this is whole texture dirty bit is probably not needed with the current
codebase, need to revisit
2009-02-17 10:27:45 +10:00
Dave Airlie
0a8cba9a65 radeon: steal miptree optimisation from intel codebase
This replaces a miptree if it won't distrub anything else.
2009-02-17 10:26:58 +10:00
Dave Airlie
7a1dbcabf3 radeon: move YUV on first texunit check after hw state is setup 2009-02-17 10:26:33 +10:00
Dave Airlie
5325f86240 dri/radeon: export a function to cleanup a texture object.
The radeon legacy code want to cleanup not free the texture obj,
so export a function to do that and wrap it.
2009-02-17 10:25:34 +10:00
Dave Airlie
ecf0a3eac1 radeon: fix texcompress2 test.
this makes compressed subimages work properly.
2009-02-16 09:51:08 +10:00
Dave Airlie
f069bc4a8e radeon: fix compressed tex subimage unpack parameter 2009-02-16 17:16:28 +10:00
Dave Airlie
b0e8ac8fd2 radeon: add cflags to decide whether to link libdrm_radeon or not.
You don't need libdrm_radeon for the legacy driver to build,
only for the experimental mm/cs paths.
2009-02-15 17:03:47 +10:00
Nicolai Haehnle
7d19d27684 radeon-common: Fix crash in glGetTexImage
Since texture images are now stored in miptrees, we cannot usually
access them directly via the Data pointer.

So we wrap Mesa's implementation by map/unmap calls.

This crash was triggered by Sauerbraten, Piglit now contains a
regression test.

Signed-off-by: Nicolai Haehnle <nhaehnle@gmail.com>
2009-02-14 21:46:44 +01:00
Nicolai Haehnle
2d9471b281 r300: Fix crash in cubemap tree creation
The mip tree creation would crash if the first baselevel image to be uploaded
was not the positive-x image.

Found with Sauerbraten, also added a regression test to Piglit.

Signed-off-by: Nicolai Haehnle <nhaehnle@gmail.com>
2009-02-14 20:47:08 +01:00
Nicolai Haehnle
9a26164f35 r300: Redirect constant TEX coordinates
R3xx/R5xx fragment program texture constants must come from a hardware
register instead of the constant file, so we redirect if necessary during
the native rewrite phase.

The symptoms of this bug started appearing when the Mesa fixed function
texenvprogram code started using STATE_CURRENT_ATTRIB constants for
texture coordinates when the corresponding attributes were constant across
all vertices.

Signed-off-by: Nicolai Haehnle <nhaehnle@gmail.com>
2009-02-14 17:09:54 +01:00
Michel Dänzer
5f3ab230ea r300: Fix R300_CMD_SCRATCH on big endian. 2009-02-14 20:40:48 +10:00
Dave Airlie
b1b7bc66a4 radeon: remove unused radeon_compat.c 2009-02-14 20:34:20 +10:00
Dave Airlie
f8c2beccd4 r200: fixup cube emit debug 2009-02-14 20:13:55 +10:00
Dave Airlie
fd81835dc7 r200: fix another cmdbuf sizing issue 2009-02-14 20:13:55 +10:00
Dave Airlie
f3a1f321cf radeon: check for valid bo in release arrays 2009-02-14 12:05:36 +10:00
Dave Airlie
fcc7a691dc radeon: remove old cube code 2009-02-14 12:05:36 +10:00
Dave Airlie
c0ae4d3c55 radeon/r300: fix warnings 2009-02-14 07:49:15 +10:00
Dave Airlie
cd4e37c8fb radeon: add initial cubemap support appears to work 2009-02-14 05:57:52 +10:00
Dave Airlie
2753dd42fd radeon/r200: make setTexOffset work again 2009-02-13 23:34:53 +10:00
Dave Airlie
f363a97d25 radeon/r200: fix set tex offset functions 2009-02-13 23:29:27 +10:00
Dave Airlie
ed8340192e radeon: revert unneeded change to texturing code 2009-02-13 23:02:12 +10:00
Dave Airlie
9fd8da299b radeon: fix compressed texture upload on all radeons
tested on r200, texcmp works. May need more verification
2009-02-13 22:49:06 +10:00
Dave Airlie
8123897615 r200: update with changes from r100 driver for texture state 2009-02-13 19:39:21 +10:00
Dave Airlie
695ca1e2be r200: port over state emit fix from r100 2009-02-13 18:50:57 +10:00
Dave Airlie
ade3660942 r200: fixup some CS emission sizes 2009-02-13 01:27:21 +10:00
Dave Airlie
393c699e21 r200: use correct finish interface 2009-02-13 00:04:11 +10:00
Dave Airlie
5ee1dd2133 radeon: fixup include ordering 2009-02-13 01:21:37 +10:00
Dave Airlie
53116910b1 Merge remote branch 'origin/master' into radeon-rewrite
Conflicts:
	configure.ac
	src/mesa/drivers/dri/r200/r200_context.c
	src/mesa/drivers/dri/r300/r300_render.c
2009-02-13 01:11:25 +10:00
Dave Airlie
7e104f9cde r300: fix warning about mesa_lock_context_texture 2009-02-13 01:04:18 +10:00
Dave Airlie
dc531ba406 radeon: add stdint include 2009-02-12 14:44:20 +10:00
Dave Airlie
899b91b1fb radeon: add mminfo struct to wrapper 2009-02-12 14:43:25 +10:00
Dave Airlie
ec0939b013 radeon: add defines for future bits 2009-02-12 14:41:16 +10:00
Dave Airlie
1e77f7b55c r200: make build complete 2009-02-12 14:39:33 +10:00
Dave Airlie
56a13a7ca9 r300: make r300 work with latest changes 2009-02-12 14:36:12 +10:00
Dave Airlie
c83d0bfe06 radeon: make build without libdrm_radeon better 2009-02-12 14:16:24 +10:00
Dave Airlie
d513915d27 radeon/r200/r300: make build again with tracker changes 2009-02-13 00:05:39 +10:00
Dave Airlie
9314d936e8 radeon: remove depends on libdrm_radeon for now.
will fixup makefiles later to detect and use libdrm_Radeon in proper
places
2009-02-12 23:53:41 +10:00
Dave Airlie
dc8a707c67 radeon/r200/r300: make build with out libdrm_radeon installed for now 2009-02-12 23:52:51 +10:00
Dave Airlie
8cb16e6daf r200/r300: get up to speed on renamed files 2009-02-12 22:48:18 +10:00
Dave Airlie
23d3559bd4 radeon: renaming and headers cleanup 2009-02-12 22:38:10 +10:00
Dave Airlie
df4a1348b1 r100/r200: fix front rendering issue. 2009-02-12 21:44:34 +10:00
Dave Airlie
1090d206de radeon/r200/r300: another big merge upheavel.
This merges lots of the hw state atom emission and firevertices code.

it also removes a lot of the extra radeon crap from r300

and merge scissor
2009-02-12 21:16:39 +10:00
Dave Airlie
f3f1f7dc20 r300: disable assert that fires 2009-02-11 19:04:39 +10:00
Dave Airlie
3713a7accf radeon: unmap in case of two dma regions being used for one cmdbuf 2009-02-11 19:03:56 +10:00
Dave Airlie
7e98907eb8 radeon: cleanup cmdbuffer 2009-02-11 16:52:56 +10:00
Dave Airlie
832446c892 r300: fix front buffer rendering properly fixes tests in glean 2009-02-11 16:50:19 +10:00
Dave Airlie
c5d9a7ab30 r200: fix build 2009-02-11 20:10:59 +10:00
Dave Airlie
edbe1fac6a radeon: fix span init needs more work 2009-02-11 07:02:18 +10:00
Dave Airlie
45496122b7 radeon/r200/r300: merge span code into single shared file 2009-02-11 05:47:55 +10:00
Dave Airlie
7394c429c0 radeon/r200: flush vertices when data in cmdbuf.
This fixes a whole bunch of regressions in piglit
2009-02-11 05:07:31 +10:00
Dave Airlie
18aca218a2 radeon: r100 can't use some of the texture formats.
this fixes the texrect-many test
2009-02-11 02:41:39 +10:00
Dave Airlie
4c36282ef9 radeon/r200/r300: fix span code for depth reading.
makes the maskedClear test work
2009-02-11 02:41:11 +10:00
Dave Airlie
3e4d0c2a5d r100: remove debug code 2009-02-10 23:39:13 +10:00
Dave Airlie
639b5fca0c r100: fix 3D texture fallback 2009-02-10 23:38:51 +10:00
Dave Airlie
c3ca94bc91 radeon: fix fallback case where t->mt is valid NULL 2009-02-10 23:36:28 +10:00
Dave Airlie
b1df5ed6db radeon: put back state emission lastcmd 2009-02-10 04:57:37 +10:00
Dave Airlie
d2fa89140e r200: invalidate texture paths in some more places 2009-02-10 04:56:16 +10:00
Dave Airlie
ccf7814a31 radeon: major cleanups removing old dead codepaths.
This should be working gears on radeon state
2009-02-10 04:54:24 +10:00
Dave Airlie
9df844b109 radeon: fix alignment issues in ELT code 2009-02-09 23:19:42 +10:00
Dave Airlie
3fafaf8959 radeon: make more r100 work 2009-02-09 03:50:38 +10:00
Dave Airlie
abdf1f65d2 r200: cleanup some bits that aren't used 2009-02-09 03:50:07 +10:00
Dave Airlie
e223b7c312 radeon: port over arrays code even though not in use yet 2009-02-06 20:30:03 +10:00
Dave Airlie
36d3f3e74a r100: fixup radeon so gears seems to work 2009-02-06 20:04:42 +10:00
Dave Airlie
16f4b10170 radeon: remove unused texmem 2009-02-06 19:36:39 +10:00
Dave Airlie
0a43603c1c r300: fix some autostate batch setups 2009-02-06 09:18:15 +10:00
Dave Airlie
8fe61fc5ba radeon/r200 remove more unused code 2009-02-04 16:01:41 +10:00
Dave Airlie
b584b0728d radeon: make compile again.
Not tested but ripped out lots of stuff unneeded anymore time to test later
2009-02-04 15:58:08 +10:00
Dave Airlie
88a409fa8e r300: fix up CS for modesetting - gears under kms works 2009-02-04 15:12:16 +10:00
Dave Airlie
c370776b02 radeon: make generate_mipmap static 2009-02-04 13:41:05 +10:00
Dave Airlie
0bcac04100 r300: fix swtcl 2009-02-04 13:40:48 +10:00
Dave Airlie
c1a42f5cdc r200: fixup DMA region stuff 2009-02-04 23:40:41 +10:00
Dave Airlie
e44effcfcb radeon: call getpagesize once and store in a static 2009-02-04 13:16:41 +10:00
Dave Airlie
711cbf30a1 r300: make dma buffer reuse much more sensible 2009-02-04 13:16:03 +10:00
Dave Airlie
55c8a79a33 radeon: add support for stencil buffers + misc debug changes
this adds the stencil rb setup, along with misc changes to formatting
and debug
2009-02-04 11:19:26 +10:00
Dave Airlie
3f59bee438 r200: move to new mipmap interface 2009-02-04 11:17:37 +10:00
Dave Airlie
c85a3851b6 radeon: only do the fb read if we are mapping a VRAM object
this makes writing the DMA buffers got a lot better
2009-02-04 11:14:38 +10:00
Dave Airlie
e8f575d657 radeon_cs: move to inline cs_write_dword
this gets back some of the CPU this was wasting
2009-02-04 11:13:54 +10:00
Dave Airlie
4c078cfbad radeon: add a reference to the static buffers so they don't get deleted 2009-02-03 12:38:31 +10:00
Dave Airlie
d9cf131925 r300: fixup mipmap + texsubimage issues
This fixes a few regression in piglit, and adds some debug to the mipmap code
2009-02-03 09:49:45 +10:00
Dave Airlie
dbf72bdd3d radeon_bo: align size of bo to page size.
This is really required for the VRAM allocator upload function.
2009-02-03 09:48:27 +10:00
Dave Airlie
75762a8219 radeon: this code forgot to add dPriv x/y back to spans 2009-02-02 12:26:22 +10:00
Dave Airlie
f4dfafd50a r300: rename validate textures to validate buffers 2009-02-02 12:26:04 +10:00
Dave Airlie
f68a61d883 r200/r300: swtcl fixups to use old dma buffers on top of BOs 2009-01-31 02:00:12 +10:00
Dave Airlie
e45213d89b r200/r300: add aperture space checks 2009-01-31 01:59:57 +10:00
Dave Airlie
08bb7eedfb r200: fix swtcl - slow but works 2009-01-30 20:03:17 +10:00
Dave Airlie
70661f678e WIP comit 2009-01-29 20:46:31 +10:00
Dave Airlie
c9bb5cd20e r200: bring back single dma flush 2009-01-29 20:33:07 +10:00
Dave Airlie
59b183ce0f radeon: remove even more common code 2009-01-29 19:11:31 +10:00
Dave Airlie
5ba92a5b05 radeon/r200/r300: bring back old style DMA buffer on top of BOs.
this gets back a lot of the lots speed in gears on r500 at least

I also fixed the legacy bufmgr to deal when the dma space fills up
2009-01-29 16:47:37 +10:00
Dave Airlie
682ebc79d5 r200: start work on userspace clear for r200 2009-01-29 23:03:47 +10:00
Dave Airlie
5fbb00a11e r200: unref swtcl buffer correctly 2009-01-29 23:03:34 +10:00
Dave Airlie
b13746b558 r300: fix some whitespace 2009-01-29 23:03:21 +10:00
Dave Airlie
474d282a1d r200: re-write state handlers for new CS mechanism 2009-01-29 23:02:43 +10:00
Dave Airlie
31a112e6e8 r200: avoid setting variable on kernel mm setup 2009-01-29 23:01:41 +10:00
Dave Airlie
ab6edc9dce radeon: add repeated register packet one 2009-01-29 23:01:21 +10:00
Dave Airlie
f69e2f42d5 r200: fix up swtcl/tcl flushes 2009-01-22 22:50:36 +10:00
Dave Airlie
d93dc43382 radeon: plug memory leak running gears 2009-01-23 08:08:34 +10:00
Dave Airlie
9780127449 radeon: remove some debugging 2009-01-23 08:03:03 +10:00
Dave Airlie
8b56a86385 radeon: better free of array 2009-01-22 21:49:58 +10:00
Dave Airlie
860d0cc656 radeon: free all relocs in array 2009-01-22 21:47:38 +10:00
Dave Airlie
02952a41eb radeon: check relocs before deref 2009-01-22 21:38:35 +10:00
Dave Airlie
2c8b55b351 radeon: fix relocs even more 2009-01-22 21:35:58 +10:00
Dave Airlie
c66e38d24f radeon: fix reloc free harder 2009-01-22 21:31:06 +10:00
Dave Airlie
bb7756eaed radeon: free indices caught with valgrind 2009-01-22 21:29:22 +10:00
Dave Airlie
a5b54eb3c9 radeon: cleanup bo unref codepath in pending code
assert for bad case hopefully
2009-01-22 21:19:56 +10:00
Dave Airlie
11995807f1 radeon: fix counting for cfree handles in an inline 2009-01-22 21:12:54 +10:00
Dave Airlie
014c52eb6b radeon: add r100/r200 workarounds for legacy aging 2009-01-23 02:47:15 +10:00
Dave Airlie
4ca76586c2 r200: disable some debug 2009-01-23 00:23:10 +10:00
Dave Airlie
7d01cb37d9 r200: emit elts into a separate ELT bo 2009-01-23 00:17:38 +10:00
Dave Airlie
eda2284961 r200r300: start merging span code 2009-01-22 04:14:40 +10:00
Dave Airlie
0788e42471 r200: remove indexed verts 2009-01-22 02:38:00 +10:00
Dave Airlie
909aeb005f radeon: fix 1D textures 2009-01-22 01:24:50 +10:00
Dave Airlie
674b204ba7 r200: fix cubemaps 2009-01-22 01:17:31 +10:00
Dave Airlie
61bb82636f r200/r300: port r200 texture handling to common code
we now get texrect + trivial textures working
2009-01-22 01:05:43 +10:00
Dave Airlie
2bf31b7ffd r300/radeon: move face_for_target 2009-01-21 18:41:11 +10:00
Dave Airlie
e0ec3243e8 r300: start migrating common functions into common code 2009-01-21 02:21:45 +10:00
Dave Airlie
ddbd6ed326 r300: move to common texture_image object 2009-01-21 02:15:28 +10:00
Dave Airlie
33dc14c707 radeon/r200/r300: start to move to common miptree/texobj 2009-01-21 02:10:56 +10:00
Dave Airlie
d9c4a01bad r200: make tri render on my r200. 2009-01-21 01:40:33 +10:00
Dave Airlie
04029e5ddb r200: tri runs without crashing - doesn't draw anything 2009-01-20 22:59:34 +10:00
Dave Airlie
ed3a1cce73 r200: clear is working at least - not much else 2009-01-20 22:51:04 +10:00
Dave Airlie
08d90fe8a5 r300: move some more function to generic 2009-01-15 16:56:50 +10:00
Dave Airlie
1a51b76343 radeon/r200/r300: start to make cmd buf useful 2009-01-15 16:45:39 +10:00
Dave Airlie
0c0a55a211 r100/r200: move to new atom style emission 2009-01-15 16:38:59 +10:00
Dave Airlie
47e3a7d794 radeon: get ctx right in copybuffer 2009-01-14 15:54:28 +10:00
Dave Airlie
4aa874c636 r200: add missing symbols 2009-01-14 15:48:02 +10:00
Dave Airlie
8c6a7d0174 radeon/r200/r300: make legacy emit non-r300 specific 2009-01-14 15:45:29 +10:00
Dave Airlie
e7d06a55c5 radeon: move debug symbol add DRI2 2009-01-14 15:21:45 +10:00
Dave Airlie
61da612a4f r300: start moving new r300 cmdbuf into common code 2009-01-14 15:14:09 +10:00
Dave Airlie
23295cf8e8 radeon/r200/r300: consolidate swap buffers 2009-01-14 13:38:12 +10:00
Dave Airlie
44b916b2c0 radeon: remove old lock code 2009-01-14 13:38:03 +10:00
Dave Airlie
7e5e327cea radeon/r200/r300: consolidate the buffer copy/flip code into one place 2009-01-14 13:23:24 +10:00
Dave Airlie
d29e96bf33 radeon/r200/r300: attempt to move lock to common code 2009-01-14 12:04:00 +10:00
Dave Airlie
4637235183 radeon/r200/r300: initial attempt to convert to common context code 2009-01-14 10:54:52 +10:00
Dave Airlie
0217ed2cf9 radeon/r200: move more stuff closer together in context 2009-01-14 08:40:15 +10:00
Dave Airlie
b6e4869069 radeon/r200: move state atom to common header 2009-01-14 06:28:43 +10:00
Dave Airlie
692ca82116 radeon/r200: start splitting out commonalities into separate headers 2009-01-13 22:55:27 +10:00
Dave Airlie
4b9a09e9f6 radeon: use bo_wait to wait for all buffers to be rendered to
Not 100% sure this is correct, but its what Intel does and its better than
CP_IDLE.
2009-01-13 16:50:15 +10:00
Kristian Høgsberg
d67987b0d1 Bump dri2proto requirement to 1.99.3, drop CopyRegion bitmask from protocol.
(cherry picked from commit 154a9e5317)
2009-01-11 09:45:04 +10:00
Dave Airlie
efe68930dc radeon/r300: add code to setup r300 vs r500 using pci device from kernel 2009-01-11 09:47:38 +10:00
Dave Airlie
2a287ddd32 r300: disable settexoffset extension on r300 2008-12-22 17:04:39 +10:00
Dave Airlie
d9b325f77e radeon: fix library name for consistency 2008-12-22 12:28:16 +10:00
Dave Airlie
e14ffb1fa1 radeon: remove start/end offset + cleanup some whitespace 2008-12-22 12:11:21 +10:00
Dave Airlie
a42000bd6b radeon: fixup r500 FP emission for new CS 2008-12-22 11:41:23 +10:00
Dave Airlie
9f2732d312 radeno: hopefully make r200/radeon build 2008-12-21 09:54:35 +10:00
Dave Airlie
72cd2c8c0c radeon: make DRI1 one work with new CS mechanism 2008-12-01 16:39:58 +10:00
Jerome Glisse
9770bb32f5 radeon: cs add print cs callback 2008-11-16 17:59:46 +01:00
Jerome Glisse
f1d98e5127 radeon: fix pointer dangling 2008-11-16 17:58:43 +01:00
Jerome Glisse
56c458e0f2 radeon: update to libdrm-radeon API changes 2008-11-15 10:40:32 +01:00
Jerome Glisse
5b79c18c83 radeon: dri2 don't forget to free buffer 2008-11-14 11:26:17 +01:00
Jerome Glisse
93a9d2f18d r300: release bo from pixmap 2008-11-14 11:26:17 +01:00
Jerome Glisse
c26ec97b13 r300: convert to new relocations format (see libdrm-radeon) 2008-11-14 11:26:17 +01:00
Jerome Glisse
d07d137931 r300: SetTex extension support 2008-11-14 11:26:17 +01:00
Jerome Glisse
3b43c28195 r300: cs + DRI2 support
If DRI2 is enabled then switch cmd assembly to directly build
hw packet.
2008-11-14 11:26:17 +01:00
Jerome Glisse
e5d5dab8c0 r300: bo and cs abstraction.
This abstract memory management and command stream building so we
can use different backend either legacy one which use old pathway
or a new one like with a new memory manager. This works was done by :

Nicolai Haehnle
Dave Airlie
Jerome Glisse
2008-11-14 11:26:17 +01:00
1538 changed files with 221705 additions and 64716 deletions

1
Android.mk Normal file
View File

@@ -0,0 +1 @@
include $(call all-subdir-makefiles)

View File

@@ -105,6 +105,8 @@ irix6-n32-static \
irix6-o32 \
irix6-o32-static \
linux \
mine \
mine-dri \
linux-alpha \
linux-alpha-static \
linux-cell \
@@ -182,7 +184,7 @@ ultrix-gcc:
# Rules for making release tarballs
VERSION=7.5.1
VERSION=7.7-devel
DIRECTORY = Mesa-$(VERSION)
LIB_NAME = MesaLib-$(VERSION)
DEMO_NAME = MesaDemos-$(VERSION)
@@ -237,7 +239,8 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/glapi/*.[chS] \
$(DIRECTORY)/src/mesa/math/*.[ch] \
$(DIRECTORY)/src/mesa/math/descrip.mms \
$(DIRECTORY)/src/mesa/shader/*.[ch] \
$(DIRECTORY)/src/mesa/shader/*.[chly] \
$(DIRECTORY)/src/mesa/shader/Makefile \
$(DIRECTORY)/src/mesa/shader/descrip.mms \
$(DIRECTORY)/src/mesa/shader/grammar/*.[ch] \
$(DIRECTORY)/src/mesa/shader/slang/*.[ch] \
@@ -302,10 +305,25 @@ MAIN_FILES = \
$(DIRECTORY)/progs/util/sampleMakefile \
$(DIRECTORY)/windows/VC8/
EGL_FILES = \
$(DIRECTORY)/include/EGL/*.h \
ES_FILES = \
$(DIRECTORY)/include/GLES/*.h \
$(DIRECTORY)/include/GLES2/*.h \
$(DIRECTORY)/src/mesa/glapi/*.xml \
$(DIRECTORY)/src/mesa/glapi/*.py \
$(DIRECTORY)/src/mesa/glapi/*.dtd \
$(DIRECTORY)/src/mesa/es/glapi/Makefile \
$(DIRECTORY)/src/mesa/es/glapi/*.xml \
$(DIRECTORY)/src/mesa/es/glapi/*.py \
$(DIRECTORY)/src/mesa/es/state_tracker/*.[ch] \
$(DIRECTORY)/src/mesa/es/main/*.[ch] \
$(DIRECTORY)/src/mesa/es/main/*.py \
$(DIRECTORY)/src/mesa/es/main/*.txt \
$(DIRECTORY)/src/mesa/es/main/es*_special \
$(DIRECTORY)/src/mesa/es/Makefile \
$(DIRECTORY)/src/mesa/es/sources.mak \
EGL_FILES = \
$(DIRECTORY)/include/EGL/*.h \
$(DIRECTORY)/src/egl/Makefile \
$(DIRECTORY)/src/egl/*/Makefile \
$(DIRECTORY)/src/egl/*/*.[ch] \
@@ -324,6 +342,7 @@ GALLIUM_FILES = \
$(DIRECTORY)/src/gallium/*/*/SConscript \
$(DIRECTORY)/src/gallium/*/*/*.[ch] \
$(DIRECTORY)/src/gallium/*/*/*.py \
$(DIRECTORY)/src/gallium/*/*/*.csv \
$(DIRECTORY)/src/gallium/*/*/*/Makefile \
$(DIRECTORY)/src/gallium/*/*/*/SConscript \
$(DIRECTORY)/src/gallium/*/*/*/*.[ch] \
@@ -345,7 +364,9 @@ DRI_FILES = \
$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po \
$(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS] \
$(DIRECTORY)/src/mesa/drivers/dri/*/*/*.[chS] \
$(DIRECTORY)/src/mesa/drivers/dri/*/Makefile \
$(DIRECTORY)/src/mesa/drivers/dri/*/*/Makefile \
$(DIRECTORY)/src/mesa/drivers/dri/*/Doxyfile \
$(DIRECTORY)/src/mesa/drivers/dri/*/server/*.[ch]
@@ -389,6 +410,9 @@ GLW_FILES = \
$(DIRECTORY)/src/glw/depend
GLEW_FILES = \
$(DIRECTORY)/include/GL/glew.h \
$(DIRECTORY)/include/GL/glxew.h \
$(DIRECTORY)/include/GL/wglew.h \
$(DIRECTORY)/src/glew/*.c \
$(DIRECTORY)/src/glew/Makefile \
$(DIRECTORY)/src/glew/SConscript \
@@ -422,6 +446,7 @@ DEMO_FILES = \
$(DIRECTORY)/progs/glsl/*.c \
$(DIRECTORY)/progs/glsl/*.frag \
$(DIRECTORY)/progs/glsl/*.vert \
$(DIRECTORY)/progs/glsl/*.shtest \
$(DIRECTORY)/progs/windml/Makefile.ugl \
$(DIRECTORY)/progs/windml/*.c \
$(DIRECTORY)/progs/windml/*.bmp \
@@ -463,6 +488,7 @@ DEPEND_FILES = \
LIB_FILES = \
$(MAIN_FILES) \
$(ES_FILES) \
$(EGL_FILES) \
$(GALLIUM_FILES) \
$(DRI_FILES) \

View File

@@ -32,10 +32,10 @@ import common
default_statetrackers = 'mesa'
if common.default_platform in ('linux', 'freebsd', 'darwin'):
default_drivers = 'softpipe,failover,i915simple,trace'
default_drivers = 'softpipe,failover,i915simple,trace,identity,llvmpipe'
default_winsys = 'xlib'
elif common.default_platform in ('winddk',):
default_drivers = 'softpipe,i915simple,trace'
default_drivers = 'softpipe,i915simple,trace,identity'
default_winsys = 'all'
else:
default_drivers = 'all'
@@ -44,9 +44,9 @@ else:
opts = Variables('config.py')
common.AddOptions(opts)
opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers,
['mesa', 'python']))
['mesa', 'python', 'xorg']))
opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
['softpipe', 'failover', 'i915simple', 'i965simple', 'cell', 'trace', 'r300']))
['softpipe', 'failover', 'i915simple', 'i965simple', 'cell', 'trace', 'r300', 'identity', 'llvmpipe']))
opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
['xlib', 'intel', 'gdi', 'radeon']))

View File

@@ -971,5 +971,6 @@ esac
#
if [ ${INSTALLDIR} != "." ] ; then
echo "mklib: Installing" ${FINAL_LIBS} "in" ${INSTALLDIR}
test -d ${INSTALLDIR} || mkdir -p ${INSTALLDIR}
mv ${FINAL_LIBS} ${INSTALLDIR}/
fi

View File

@@ -33,9 +33,9 @@ else:
default_machine = _platform.machine()
default_machine = _machine_map.get(default_machine, 'generic')
if default_platform in ('linux', 'freebsd', 'darwin'):
if default_platform in ('linux', 'freebsd'):
default_dri = 'yes'
elif default_platform in ('winddk', 'windows', 'wince'):
elif default_platform in ('winddk', 'windows', 'wince', 'darwin'):
default_dri = 'no'
else:
default_dri = 'no'
@@ -59,7 +59,7 @@ def AddOptions(opts):
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
opts.Add(EnumOption('platform', 'target platform', default_platform,
allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince')))
allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin')))
opts.Add(EnumOption('toolchain', 'compiler toolchain', 'default',
allowed_values=('default', 'crossmingw', 'winsdk', 'winddk')))
opts.Add(BoolOption('llvm', 'use LLVM', 'no'))

View File

@@ -20,6 +20,8 @@ CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ \
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
LDFLAGS = @LDFLAGS@
EXTRA_LIB_PATH = @EXTRA_LIB_PATH@
RADEON_CFLAGS = @RADEON_CFLAGS@
RADEON_LDFLAGS = @RADEON_LDFLAGS@
# Assembler
MESA_ASM_SOURCES = @MESA_ASM_SOURCES@
@@ -31,6 +33,7 @@ SHELL = @SHELL@
MKLIB_OPTIONS = @MKLIB_OPTIONS@
MKDEP = @MKDEP@
MKDEP_OPTIONS = @MKDEP_OPTIONS@
INSTALL = @INSTALL@
# Python and flags (generally only needed by the developers)
PYTHON2 = python

View File

@@ -10,7 +10,7 @@ X11_DIR = $(INSTALL_DIR)
# Compiler and flags
CC = gcc
CXX = gcc
CXX = g++
PIC_FLAGS = -fPIC
DEFINES = -D_DARWIN_C_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L \
-D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS \

View File

@@ -9,8 +9,8 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=7
MESA_MINOR=5
MESA_TINY=1
MESA_MINOR=7
MESA_TINY=0
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
# external projects. This should be useless now that we use libdrm.
@@ -36,7 +36,10 @@ MKLIB_OPTIONS =
MKDEP = makedepend
MKDEP_OPTIONS = -fdepend
MAKE = make
INSTALL = $(SHELL) $(TOP)/bin/minstall
# Use MINSTALL for installing libraries, INSTALL for everything else
MINSTALL = $(SHELL) $(TOP)/bin/minstall
INSTALL = $(MINSTALL)
# Tools for regenerating glapi (generally only needed by the developers)
PYTHON2 = python
@@ -90,9 +93,9 @@ EGL_DRIVERS_DIRS = demo
# Gallium directories and
GALLIUM_DIRS = auxiliary drivers state_trackers
GALLIUM_AUXILIARY_DIRS = draw translate cso_cache pipebuffer tgsi sct rtasm util indices
GALLIUM_AUXILIARY_DIRS = rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices
GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a)
GALLIUM_DRIVERS_DIRS = softpipe i915simple failover trace
GALLIUM_DRIVERS_DIRS = softpipe i915simple failover trace identity
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
GALLIUM_WINSYS_DIRS = xlib egl_xlib
GALLIUM_WINSYS_DRM_DIRS =
@@ -102,7 +105,7 @@ GALLIUM_STATE_TRACKERS_DIRS = glx
# Library dependencies
#EXTRA_LIB_PATH ?=
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread
EGL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -ldl
EGL_LIB_DEPS = $(EXTRA_LIB_PATH) -ldl -lpthread
OSMESA_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
GLU_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
GLUT_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXi -lm

View File

@@ -1,14 +1,21 @@
# -*-makefile-*-
# Configuration for Linux and LLVM with debugging info
# Builds the llvmpipe gallium driver
include $(TOP)/configs/linux
CONFIG_NAME = linux-llvm
GALLIUM_AUXILIARY_DIRS += gallivm
#GALLIUM_AUXILIARY_DIRS += gallivm
# Add llvmpipe driver
GALLIUM_DRIVERS_DIRS += llvmpipe
OPT_FLAGS = -g -ansi -pedantic
DEFINES += -DDEBUG -DDEBUG_MATH -DMESA_LLVM=1
DEFINES += -DDEBUG -DDEBUG_MATH -DGALLIUM_LLVMPIPE -DHAVE_UDIS86
# override -std=c99
CFLAGS += -std=gnu99
LLVM_VERSION := $(shell llvm-config --version)
@@ -17,14 +24,14 @@ ifeq ($(LLVM_VERSION),)
MESA_LLVM=0
else
MESA_LLVM=1
$(info Using LLVM version: $(LLVM_VERSION))
# $(info Using LLVM version: $(LLVM_VERSION))
endif
ifeq ($(MESA_LLVM),1)
# LLVM_CFLAGS=`llvm-config --cflags`
LLVM_CXXFLAGS=`llvm-config --cxxflags backend bitreader engine ipo interpreter instrumentation` -Wno-long-long
LLVM_LDFLAGS=`llvm-config --ldflags backend bitreader engine ipo interpreter instrumentation`
LLVM_LIBS=`llvm-config --libs backend bitreader engine ipo interpreter instrumentation`
LLVM_LDFLAGS = $(shell llvm-config --ldflags backend bitreader engine ipo interpreter instrumentation)
LLVM_LIBS = $(shell llvm-config --libs backend bitreader engine ipo interpreter instrumentation)
MKLIB_OPTIONS=-cplusplus
else
LLVM_CFLAGS=
@@ -32,4 +39,4 @@ else
endif
LD = g++
GL_LIB_DEPS = $(LLVM_LDFLAGS) $(LLVM_LIBS) $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread -lstdc++
GL_LIB_DEPS = $(LLVM_LDFLAGS) $(LLVM_LIBS) $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread -lstdc++ -ludis86

View File

@@ -4,4 +4,5 @@ include $(TOP)/configs/linux-x86-64
CONFIG_NAME = linux-x86-64-debug
OPT_FLAGS = -g
DEFINES += -DDEBUG -DDEBUG_MATH

82
configs/mine Normal file
View File

@@ -0,0 +1,82 @@
# -*-makefile-*-
# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others
include $(TOP)/configs/default
CONFIG_NAME = mine
# Compiler and flags
CC = ccache gcc
CXX = ccache g++
#MKDEP = /usr/X11R6/bin/makedepend
#MKDEP = gcc -M
#MKDEP_OPTIONS = -MF depend
OPT_FLAGS = -O0 -g
PIC_FLAGS = -fPIC
# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
ARCH_FLAGS ?=
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
-D_BSD_SOURCE -D_GNU_SOURCE \
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 \
-DGLX_DIRECT_RENDERING \
-DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN
X11_INCLUDES = -I/usr/X11R6/include
CFLAGS = -Wall -Wmissing-prototypes -std=c99 -ffast-math \
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS)
CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
GLUT_CFLAGS = -fexceptions
# Work around aliasing bugs - developers should comment this out
CFLAGS += -fno-strict-aliasing
CXXFLAGS += -fno-strict-aliasing
MESA_ASM_SOURCES =
# Library/program dependencies
EXTRA_LIB_PATH=-L/usr/X11R6/lib
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-lm -lpthread -ldl $(LIBDRM_LIB)
# Directories
SRC_DIRS = egl mesa gallium gallium/winsys
PROGRAM_DIRS := egl openvg/demos demos xdemos
# EGL directories
EGL_DRIVERS_DIRS = glx xdri
ifeq ($(USE_DRI),yes)
DEFINES += -DIN_DRI_DRIVER -DGLX_INDIRECT_RENDERING
LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm)
LIBDRM_LIB = $(shell pkg-config --libs libdrm)
SRC_DIRS := glx/x11 $(SRC_DIRS)
DRIVER_DIRS = dri
WINDOW_SYSTEM = dri
DRI_DIRS = i915
GALLIUM_WINSYS_DIRS = drm egl_xlib
GALLIUM_WINSYS_DRM_DIRS = intel
GALLIUM_STATE_TRACKERS_DIRS = egl glx vega
else
DRIVER_DIRS =
WINDOW_SYSTEM =
DRI_DIRS =
GALLIUM_WINSYS_DIRS = egl_xlib xlib
GALLIUM_STATE_TRACKERS_DIRS = glx vega
endif

5
configs/mine-dri Normal file
View File

@@ -0,0 +1,5 @@
# -*-makefile-*-
# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others
USE_DRI = yes
include $(TOP)/configs/mine

View File

@@ -29,6 +29,11 @@ AC_CHECK_PROGS([MAKE], [gmake make])
AC_PATH_PROG([MKDEP], [makedepend])
AC_PATH_PROG([SED], [sed])
dnl Our fallback install-sh is a symlink to minstall. Use the existing
dnl configuration in that case.
AC_PROG_INSTALL
test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
dnl We need a POSIX shell for parts of the build. Assume we have one
dnl in most cases.
case "$host_os" in
@@ -121,6 +126,7 @@ AC_ARG_ENABLE([32-bit],
if test "x$enable_32bit" = xyes; then
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -m32"
ARCH_FLAGS="$ARCH_FLAGS -m32"
fi
if test "x$GXX" = xyes; then
CXXFLAGS="$CXXFLAGS -m32"
@@ -411,8 +417,8 @@ WINDOW_SYSTEM=""
GALLIUM_DIRS="auxiliary drivers state_trackers"
GALLIUM_WINSYS_DIRS=""
GALLIUM_WINSYS_DRM_DIRS=""
GALLIUM_AUXILIARY_DIRS="draw translate cso_cache pipebuffer tgsi sct rtasm util indices"
GALLIUM_DRIVERS_DIRS="softpipe failover trace"
GALLIUM_AUXILIARY_DIRS="rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices"
GALLIUM_DRIVERS_DIRS="softpipe failover trace identity"
GALLIUM_STATE_TRACKERS_DIRS=""
case "$mesa_driver" in
@@ -440,6 +446,8 @@ AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])
AC_SUBST([GALLIUM_DRIVERS_DIRS])
AC_SUBST([GALLIUM_AUXILIARY_DIRS])
AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
AC_SUBST([RADEON_CFLAGS])
AC_SUBST([RADEON_LDFLAGS])
dnl
dnl User supplied program configuration
@@ -567,6 +575,13 @@ dri)
GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
PKG_CHECK_MODULES([LIBDRM_RADEON], [libdrm_radeon], HAVE_LIBDRM_RADEON=yes, HAVE_LIBDRM_RADEON=no)
if test "$HAVE_LIBDRM_RADEON" = yes; then
RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
fi
# find the DRI deps for libGL
if test "$x11_pkgconfig" = yes; then
# add xcb modules if necessary
@@ -699,7 +714,7 @@ if test "$mesa_driver" = dri; then
# because there is no x86-64 system where they could *ever*
# be used.
if test "x$DRI_DIRS" = "xyes"; then
DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
savage tdfx unichrome swrast"
fi
;;
@@ -707,13 +722,13 @@ if test "$mesa_driver" = dri; then
# Build only the drivers for cards that exist on PowerPC.
# At some point MGA will be added, but not yet.
if test "x$DRI_DIRS" = "xyes"; then
DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast"
DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
fi
;;
sparc*)
# Build only the drivers for cards that exist on sparc`
if test "x$DRI_DIRS" = "xyes"; then
DRI_DIRS="mach64 r128 r200 r300 radeon ffb swrast"
DRI_DIRS="mach64 r128 r200 r300 r600 radeon ffb swrast"
fi
;;
esac
@@ -732,7 +747,7 @@ if test "$mesa_driver" = dri; then
# ffb and gamma are missing because they have not been converted
# to use the new interface.
if test "x$DRI_DIRS" = "xyes"; then
DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
unichrome savage sis swrast"
fi
;;
@@ -751,7 +766,7 @@ if test "$mesa_driver" = dri; then
# default drivers
if test "x$DRI_DIRS" = "xyes"; then
DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon s3v \
savage sis tdfx trident unichrome ffb swrast"
fi
@@ -1145,6 +1160,21 @@ AC_ARG_WITH([xorg-driver-dir],
[XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
AC_SUBST([XORG_DRIVER_INSTALL_DIR])
AC_ARG_WITH([max-width],
[AS_HELP_STRING([--with-max-width=N],
[Maximum framebuffer width (4096)])],
[DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
AS_IF([test "${withval}" -gt "4096"],
[AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
)
AC_ARG_WITH([max-height],
[AS_HELP_STRING([--with-max-height=N],
[Maximum framebuffer height (4096)])],
[DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
AS_IF([test "${withval}" -gt "4096"],
[AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
)
dnl
dnl Gallium Intel configuration
dnl
@@ -1181,7 +1211,7 @@ AC_ARG_ENABLE([gallium-nouveau],
[enable_gallium_nouveau=no])
if test "x$enable_gallium_nouveau" = xyes; then
GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nv04 nv10 nv20 nv30 nv40 nv50"
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv04 nv10 nv20 nv30 nv40 nv50"
fi

View File

@@ -39,7 +39,6 @@ a:visited {
<ul>
<li><a href="download.html" target="MainFrame">Downloading / Unpacking</a>
<li><a href="install.html" target="MainFrame">Compiling / Installing</a>
<li><a href="glu.html" target="MainFrame">SGI's GLU</a>
<li><a href="precompiled.html" target="MainFrame">Precompiled Libraries</a>
</ul>
@@ -68,6 +67,7 @@ a:visited {
<li><a href="repository.html" target="MainFrame">Source Code Repository</a>
<li><a href="memory.html" target="MainFrame">DRI Memory Management</a>
<li><a href="shading.html" target="MainFrame">Shading Language</a>
<li><a href="glu.html" target="MainFrame">SGI's GLU</a>
<li><a href="utilities.html" target="MainFrame">Utilities</a>
<li><a href="helpwanted.html" target="MainFrame">Help Wanted</a>
<li><a href="devinfo.html" target="MainFrame">Development Notes</a>

View File

@@ -198,7 +198,7 @@ few preprocessor defines.</p>
<ul>
<li>If <tt>GLX_USE_TLS</tt> is defined, method #4 is used.</li>
<li>If <tt>PTHREADS</tt> is defined, method #3 is used.</li>
<li>If any of <tt>PTHREADS</tt>, <tt>USE_XTHREADS</tt>,
<li>If any of <tt>PTHREADS</tt>,
<tt>SOLARIS_THREADS</tt>, <tt>WIN32_THREADS</tt>, or <tt>BEOS_THREADS</tt>
is defined, method #2 is used.</li>
<li>If none of the preceeding are defined, method #1 is used.</li>

View File

@@ -9,14 +9,14 @@
<H1>Downloading</H1>
<p>
Primary download site:
<a href="http://sourceforge.net/project/showfiles.php?group_id=3"
target="_parent">SourceForge</a>
Primary Mesa download site:
<a href="ftp://ftp.freedesktop.org/pub/mesa/"
target="_parent">freedesktop.org</a> (FTP)
</p>
<p>
When a new release is coming, release candidates (betas) can be found
<a href="http://www.mesa3d.org/beta/">here</a>.
When a new release is coming, release candidates (betas) may be found
<a href="ftp://ftp.freedesktop.org/pub/mesa/beta/" target="_parent">here</a>.
</p>

View File

@@ -25,6 +25,9 @@ fragment programs (intended for developers only)
<li>MESA_TNL_PROG - if set, implement conventional vertex transformation
operations with vertex programs (intended for developers only).
Setting this variable automatically sets the MESA_TEX_PROG variable as well.
<li>MESA_EXTENSION_OVERRIDE - can be used to enable/disable extensions.
A value such as "GL_EXT_foo -GL_EXT_bar" will enable the GL_EXT_foo extension
and disable the GL_EXT_bar extension.
</ul>
<p>

View File

@@ -316,6 +316,19 @@ Basically, applying a translation of (0.375, 0.375, 0.0) to your coordinates
will fix the problem.
</p>
<h2>3.6 How can I change the maximum framebuffer size in Mesa's
<tt>swrast</tt> backend?</h2>
<p>
These can be overridden by using the <tt>--with-max-width</tt> and
<tt>--with-max-height</tt> options. The two need not be equal.
</p><p>
Do note that Mesa uses these values to size some internal buffers,
so increasing these sizes will cause Mesa to require additional
memory. Furthermore, increasing these limits beyond <tt>4096</tt>
may introduce rasterization artifacts; see the leading comments in
<tt>src/mesa/swrast/s_tritemp.h</tt>.
</p>
<br>
<br>

View File

@@ -11,6 +11,13 @@
<H1>News</H1>
<h2>September 3, 2009</h2>
<p>
<a href="relnotes-7.5.1.html">Mesa 7.5.1</a> is released.
This is a bug-fix release which fixes bugs found in version 7.5.
</p>
<h2>July 17, 2009</h2>
<p>
<a href="relnotes-7.5.html">Mesa 7.5</a> is released.

68
docs/openvg.html Normal file
View File

@@ -0,0 +1,68 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>OpenVG State Tracker</H1>
<p>
The current version of the OpenVG state tracker implements OpenVG 1.0.
</p>
<p>
More informations about OpenVG can be found at
<a href="http://www.khronos.org/openvg/" target="_parent">
http://www.khronos.org/openvg/</a> .
</p>
<p>
The OpenVG state tracker depends on the Gallium architecture and a working EGL implementation.
</p>
<h2>Building the library</h2>
<ol>
<li>Build Mesa3D with Gallium3D. Any build that builds Gallium3D libraries and EGL will suffice</li>
<li>cd src/gallium/state_trackers/vega; make</li>
<li>The last step will build libOpenVG library. You can add the libdir to LD_LIBRARY_PATH or install libOpenVG</li>
</ol>
<h3>Sample build</h3>
A sample build looks as follows:
<pre>
make linux-x86-64-debug
cd src/gallium/state_trackers/vega
make
cd ../../../..
export LD_LIBRARY_PATH=$PWD/lib64
export EGL_DRIVER="egl_softpipe"
</pre>
<h2>OpenVG Demos</h2>
<p>
To build the OpenVG demos:
</p>
<pre>
cd progs/openvg
make
</pre>
<p>
To run a demo:
</p>
<pre>
cd openvg/demos
./lion
</pre>
<h2>Notes</h2>
<ul>
<li>EGL_DRIVER environmental variable: forces usage of a specific EGL driver. Unless you force egl_softpipe the implementation will look for a DRI hardware accelerate driver and unless you have a Gallium driver that supports it, you'll see crashes</li>
</ul>
</body>
</html>

View File

@@ -9,17 +9,11 @@
<H1>Precompiled Libraries</H1>
<p>
In general, precompiled libraries are not available.
However, people occasionally prepare packages of precompiled libraries
for some systems.
In general, precompiled Mesa libraries are not available.
</p>
<H2>Mesa-6.0 for Solaris</H2>
<p>
Steve Christensen has submitted precompiled Mesa-6.0 libraries for
Solaris at <a href="http://sunfreeware.com/" target="_parent">
sunfreeware.com</a>.
However, some Linux distros (such as Ubuntu) seem to closely track
Mesa and often have the latest Mesa release available as an update.
</p>
</BODY>

View File

@@ -8,7 +8,7 @@
<body bgcolor="#eeeeee">
<H1>Mesa 7.5.1 Release Notes / (date TBD)</H1>
<H1>Mesa 7.5.1 Release Notes, 3 September 2009</H1>
<p>
Mesa 7.5.1 is a bug-fix release fixing issues found since the 7.5 release.
@@ -31,24 +31,42 @@ for DRI hardware acceleration.
<h2>MD5 checksums</h2>
<pre>
tbd
d7269e93bc7484430637d54ced250876 MesaLib-7.5.1.tar.gz
877d6a4b24efc2b1d02aa553f262cba8 MesaLib-7.5.1.tar.bz2
23f4fb757a05c8396425681234ae20e5 MesaLib-7.5.1.zip
5af4bd113652108f5cec5113dad813f2 MesaDemos-7.5.1.tar.gz
785402e3b9f0e335538fcc6bf19f6987 MesaDemos-7.5.1.tar.bz2
950058cc6d6106e9c7d5876a03789fe9 MesaDemos-7.5.1.zip
cb52ce2c93389c2711cbe8d857ec5303 MesaGLUT-7.5.1.tar.gz
e3a9892e056d625c5353617a7c5b7e9c MesaGLUT-7.5.1.tar.bz2
da1de364df148c94b4994006191a1e69 MesaGLUT-7.5.1.zip
</pre>
<h2>New features</h2>
<ul>
<li>Added configure --with-max-width=W, --with-max-height=H options to specify
max framebuffer, viewport size.
</ul>
<h2>Bug fixes</h2>
<ul>
<li>Added missing GLEW library to MesaDemos tarballs.
<li>Fixed swapbuffers jerkiness in Doom3/etc in Intel drivers.
<li>Fixed front buffer rendering bug in Intel drivers.
<li>Fixed minor GLX memory leaks.
<li>Fixed some texture env / fragment program state bugs.
<li>Fixed some Gallium glBlitFramebuffer() bugs
<li>Empty glBegin/glEnd() pair could cause divide by zero (bug 23489)
<li>Fixed Gallium glBitmap() Z position bug
<li>Setting arrays of sampler uniforms did not work
<li>Selection/Feedback mode didn't handle polygon culling correctly (bug 16866)
<li>Fixed 32/64-bit cross compilation issue in gen_matypes.c
<li>Fixed glXCreateGLXPixmap() for direct rendering.
<li>Fixed Gallium glCopyPixels(GL_STENCIL_INDEX) mispositioned image bug.
</ul>
<h2>Changes</h2>
<ul>
</ul>
</body>
</html>

52
docs/relnotes-7.5.2.html Normal file
View File

@@ -0,0 +1,52 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.5.2 Release Notes, (date tbd)</H1>
<p>
Mesa 7.5.2 is a bug-fix release fixing issues found since the 7.5.1 release.
</p>
<p>
The main new feature of Mesa 7.5.x is the
<a href="http://wiki.freedesktop.org/wiki/Software/gallium"
target="_parent">Gallium3D</a> infrastructure.
</p>
<p>
Mesa 7.5.2 implements the OpenGL 2.1 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
tbd
</pre>
<h2>New features</h2>
<ul>
<li>Detect B43 chipset in Intel driver
</ul>
<h2>Bug fixes</h2>
<ul>
<li>Assorted bug fixes for i965/i945 drivers
<li>Fixed Gallium glDrawPixels(GL_STENCIL_INDEX) failure.
</ul>
</body>
</html>

View File

@@ -40,7 +40,15 @@ If you're especially concerned with stability you should probably look for
<h2>MD5 checksums</h2>
<pre>
tbd
553fd956e544727f30fbe249619b6286 MesaLib-7.5.tar.gz
459f332551f6ebb86f384d21dd15e1f0 MesaLib-7.5.tar.bz2
8c02c0e17a9025250d20424ae32f5163 MesaLib-7.5.zip
a188da2886fa5496ea0c2cda602b2eeb MesaDemos-7.5.tar.gz
398ee8801814a00e47f6c2314e3dfddc MesaDemos-7.5.tar.bz2
15a0c8ae013c54335a26335e1a98d609 MesaDemos-7.5.zip
81010147def5a644ba14f9bbb7a49a2a MesaGLUT-7.5.tar.gz
baa7a1e850b6e39bae58868fd0684004 MesaGLUT-7.5.tar.bz2
265228418e4423fa328f2f5b7970cf08 MesaGLUT-7.5.zip
</pre>

75
docs/relnotes-7.6.html Normal file
View File

@@ -0,0 +1,75 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.6 Release Notes / date TBD</H1>
<p>
Mesa 7.6 is a new development release.
People who are concerned with stability and reliability should stick
with a previous release or wait for Mesa 7.6.1.
</p>
<p>
Mesa 7.6 implements the OpenGL 2.1 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
tbd
</pre>
<h2>New features</h2>
<ul>
<li><a href="openvg.html">OpenVG</a> front-end (state tracker for Gallium).
This was written by Zack Rusin at Tungsten Graphics.
<li>GL_ARB_vertex_array_object and GL_APPLE_vertex_array_object extensions
(supported in Gallium drivers, Intel DRI drivers, and software drivers)</li>
<li>GL_ARB_copy_buffer extension
(supported in Gallium drivers, Intel DRI drivers, and software drivers)</li>
<li>GL_ARB_map_buffer_range extension
(supported in Gallium drivers, Intel DRI drivers, and software drivers)</li>
<li>GL_ARB_seamless_cube_map extension
(supported in software drivers and i965 drivers)</li>
<li>GL_ARB_vertex_array_bgra (ARB synonym for GL_EXT_vertex_array_bgra)</li>
<li>GL_ARB_sync (supported in software drivers and Intel DRI drivers)</li>
<li>GL_EXT_provoking_vertex extension (supported in Gallium, i915, i965, and software drivers)
<li>Rewritten radeon/r200/r300 driver using a buffer manager
<li>radeon/r200/r300 GL_EXT_framebuffer_object support when used with
kernel memory manager
<li>r300 driver support for GL_EXT_vertex_array_bgra, GL_EXT_texture_sRGB
<li>i915/945 driver support for GL_ARB_point_sprite, GL_EXT_stencil_two_side
and GL_ATI_separate_stencil extensions
<li>Rewritten assembler for GL_ARB_vertex_program /
GL_ARB_fragment_program.</li>
<li>Added configure --with-max-width=W, --with-max-height=H options to specify
max framebuffer, viewport size.
</ul>
<h2>Bug fixes</h2>
<ul>
<li>i965 DRI driver fixes, including support for "unlimited" size constant
buffers (GLSL uniforms)
</ul>
<h2>Changes</h2>
<ul>
</ul>
</body>
</html>

53
docs/relnotes-7.7.html Normal file
View File

@@ -0,0 +1,53 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.7 Release Notes / date TBD</H1>
<p>
Mesa 7.7 is a new development release.
People who are concerned with stability and reliability should stick
with a previous release or wait for Mesa 7.7.1.
</p>
<p>
Mesa 7.7 implements the OpenGL 2.1 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
tbd
</pre>
<h2>New features</h2>
<ul>
<li>GL_ARB_draw_elements_base_vertex (supported in Intel i965 and software drivers)</li>
<li>GL_ARB_depth_clamp (supported in Intel i965 DRI and software drivers)</li>
<li>GL_NV_depth_clamp (supported in Intel i965 DRI and software drivers)</li>
</ul>
<h2>Bug fixes</h2>
<ul>
</ul>
<h2>Changes</h2>
<ul>
</ul>
</body>
</html>

View File

@@ -13,6 +13,9 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<UL>
<LI><A HREF="relnotes-7.7.html">7.7 release notes</A>
<LI><A HREF="relnotes-7.6.html">7.6 release notes</A>
<LI><A HREF="relnotes-7.5.2.html">7.5.2 release notes</A>
<LI><A HREF="relnotes-7.5.1.html">7.5.1 release notes</A>
<LI><A HREF="relnotes-7.5.html">7.5 release notes</A>
<LI><A HREF="relnotes-7.4.4.html">7.4.4 release notes</A>

View File

@@ -6,7 +6,7 @@ extern "C" {
#endif
/*
** Copyright (c) 2007 The Khronos Group Inc.
** Copyright (c) 2007-2009 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
@@ -33,9 +33,9 @@ extern "C" {
/*************************************************************/
/* Header file version number */
/* eglext.h last updated 2007/11/20 */
/* Current version at http://www.khronos.org/registry/egl/ */
#define EGL_EGLEXT_VERSION 1
/* $Revision: 7244 $ on $Date: 2009-01-20 17:06:59 -0800 (Tue, 20 Jan 2009) $ */
#define EGL_EGLEXT_VERSION 3
#ifndef EGL_KHR_config_attribs
#define EGL_KHR_config_attribs 1
@@ -79,12 +79,12 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display
#define EGL_KHR_image 1
#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
typedef void *EGLImageKHR;
extern const EGLImageKHR EGL_NO_IMAGE_KHR;
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, EGLint *attr_list);
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, EGLint *attr_list);
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
#endif
@@ -179,6 +179,17 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOPYCONTEXTMESA) (EGLDisplay dpy, EGLCont
#endif /* EGL_MESA_copy_context */
#ifndef EGL_KHR_image_base
#define EGL_KHR_image_base 1
/* Most interfaces defined by EGL_KHR_image_pixmap above */
#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */
#endif
#ifndef EGL_KHR_image_pixmap
#define EGL_KHR_image_pixmap 1
/* Interfaces defined by EGL_KHR_image above */
#endif
#ifdef __cplusplus
}
#endif

View File

@@ -69,7 +69,8 @@ typedef HWND NativeWindowType;
typedef HBITMAP NativePixmapType;
/** END Added for Windows **/
#elif defined(__gnu_linux__) || defined(__FreeBSD__) || defined(__sun)
#elif defined(__gnu_linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__APPLE__)
/** BEGIN Added for X (Mesa) **/
#ifndef EGLAPI

View File

@@ -0,0 +1,27 @@
#ifndef EGLIMAGE_DRI_INCLUDED
#define EGLIMAGE_DRI_INCLUDED
#include "GL/internal/dri_interface.h"
#define __DRI_EGL_IMAGE_MAGIC \
(('D' << 24) | \
('R' << 16) | \
('I' << 8) | \
('0'))
typedef void *__DRIEGLImageHandle;
typedef struct __DRIEGLImageRec __DRIEGLImage;
struct __DRIEGLImageRec {
GLint magic;
__DRIdrawable *drawable;
GLboolean texture_format_rgba;
GLint level;
GLint __pad[4];
};
extern __DRIEGLImage *_eglClientGetImageData(__DRIEGLImageHandle handle);
#endif /* EGLIMAGE_DRI_INCLUDED */

View File

@@ -1,8 +1,9 @@
/*
* Mesa 3-D graphics library
* Version: 7.5
* Version: 7.6
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -1739,41 +1740,6 @@ GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target,
GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format,
GLenum type, GLvoid *row, GLvoid *column, GLvoid *span );
typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table);
typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params);
typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params);
typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image);
typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink);
typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target);
typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target);
/*
@@ -1978,53 +1944,6 @@ GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] );
GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert );
typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);
typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s);
typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s);
typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s);
typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t);
typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);
typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t);
typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t);
typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r);
typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v);
typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m);
typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m);
typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m);
typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m);
typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img);
/*
* GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1)

View File

@@ -53,6 +53,7 @@
#define glBeginFragmentShaderATI MANGLE(BeginFragmentShaderATI)
#define glBegin MANGLE(Begin)
#define glBeginOcclusionQueryNV MANGLE(BeginOcclusionQueryNV)
#define glBeginPerfMonitorAMD MANGLE(BeginPerfMonitorAMD)
#define glBeginQueryARB MANGLE(BeginQueryARB)
#define glBeginQuery MANGLE(BeginQuery)
#define glBeginTransformFeedbackEXT MANGLE(BeginTransformFeedbackEXT)
@@ -257,6 +258,7 @@
#define glConvolutionParameteri MANGLE(ConvolutionParameteri)
#define glConvolutionParameterivEXT MANGLE(ConvolutionParameterivEXT)
#define glConvolutionParameteriv MANGLE(ConvolutionParameteriv)
#define glCopyBufferSubData MANGLE(CopyBufferSubData)
#define glCopyColorSubTableEXT MANGLE(CopyColorSubTableEXT)
#define glCopyColorSubTable MANGLE(CopyColorSubTable)
#define glCopyColorTable MANGLE(CopyColorTable)
@@ -309,6 +311,7 @@
#define glDeleteLists MANGLE(DeleteLists)
#define glDeleteObjectARB MANGLE(DeleteObjectARB)
#define glDeleteOcclusionQueriesNV MANGLE(DeleteOcclusionQueriesNV)
#define glDeletePerfMonitorsAMD MANGLE(DeletePerfMonitorsAMD)
#define glDeleteProgram MANGLE(DeleteProgram)
#define glDeleteProgramsARB MANGLE(DeleteProgramsARB)
#define glDeleteProgramsNV MANGLE(DeleteProgramsNV)
@@ -343,6 +346,7 @@
#define glDrawArraysEXT MANGLE(DrawArraysEXT)
#define glDrawArraysInstancedARB MANGLE(DrawArraysInstancedARB)
#define glDrawArraysInstancedEXT MANGLE(DrawArraysInstancedEXT)
#define glDrawArraysInstanced MANGLE(DrawArraysInstanced)
#define glDrawArrays MANGLE(DrawArrays)
#define glDrawBuffer MANGLE(DrawBuffer)
#define glDrawBuffersARB MANGLE(DrawBuffersARB)
@@ -352,6 +356,7 @@
#define glDrawElementArrayATI MANGLE(DrawElementArrayATI)
#define glDrawElementsInstancedARB MANGLE(DrawElementsInstancedARB)
#define glDrawElementsInstancedEXT MANGLE(DrawElementsInstancedEXT)
#define glDrawElementsInstanced MANGLE(DrawElementsInstanced)
#define glDrawElements MANGLE(DrawElements)
#define glDrawMeshArraysSUN MANGLE(DrawMeshArraysSUN)
#define glDrawPixels MANGLE(DrawPixels)
@@ -381,6 +386,7 @@
#define glEndList MANGLE(EndList)
#define glEnd MANGLE(End)
#define glEndOcclusionQueryNV MANGLE(EndOcclusionQueryNV)
#define glEndPerfMonitorAMD MANGLE(EndPerfMonitorAMD)
#define glEndQueryARB MANGLE(EndQueryARB)
#define glEndQuery MANGLE(EndQuery)
#define glEndTransformFeedbackEXT MANGLE(EndTransformFeedbackEXT)
@@ -485,6 +491,7 @@
#define glGenFramebuffers MANGLE(GenFramebuffers)
#define glGenLists MANGLE(GenLists)
#define glGenOcclusionQueriesNV MANGLE(GenOcclusionQueriesNV)
#define glGenPerfMonitorsAMD MANGLE(GenPerfMonitorsAMD)
#define glGenProgramsARB MANGLE(GenProgramsARB)
#define glGenProgramsNV MANGLE(GenProgramsNV)
#define glGenQueriesARB MANGLE(GenQueriesARB)
@@ -501,7 +508,11 @@
#define glGetActiveAttribARB MANGLE(GetActiveAttribARB)
#define glGetActiveAttrib MANGLE(GetActiveAttrib)
#define glGetActiveUniformARB MANGLE(GetActiveUniformARB)
#define glGetActiveUniformBlockiv MANGLE(GetActiveUniformBlockiv)
#define glGetActiveUniformBlockName MANGLE(GetActiveUniformBlockName)
#define glGetActiveUniform MANGLE(GetActiveUniform)
#define glGetActiveUniformName MANGLE(GetActiveUniformName)
#define glGetActiveUniformsiv MANGLE(GetActiveUniformsiv)
#define glGetActiveVaryingNV MANGLE(GetActiveVaryingNV)
#define glGetArrayObjectfvATI MANGLE(GetArrayObjectfvATI)
#define glGetArrayObjectivATI MANGLE(GetArrayObjectivATI)
@@ -634,6 +645,12 @@
#define glGetObjectParameterivARB MANGLE(GetObjectParameterivARB)
#define glGetOcclusionQueryivNV MANGLE(GetOcclusionQueryivNV)
#define glGetOcclusionQueryuivNV MANGLE(GetOcclusionQueryuivNV)
#define glGetPerfMonitorCounterDataAMD MANGLE(GetPerfMonitorCounterDataAMD)
#define glGetPerfMonitorCounterInfoAMD MANGLE(GetPerfMonitorCounterInfoAMD)
#define glGetPerfMonitorCountersAMD MANGLE(GetPerfMonitorCountersAMD)
#define glGetPerfMonitorCounterStringAMD MANGLE(GetPerfMonitorCounterStringAMD)
#define glGetPerfMonitorGroupsAMD MANGLE(GetPerfMonitorGroupsAMD)
#define glGetPerfMonitorGroupStringAMD MANGLE(GetPerfMonitorGroupStringAMD)
#define glGetPixelMapfv MANGLE(GetPixelMapfv)
#define glGetPixelMapuiv MANGLE(GetPixelMapuiv)
#define glGetPixelMapusv MANGLE(GetPixelMapusv)
@@ -709,9 +726,11 @@
#define glGetTransformFeedbackVaryingEXT MANGLE(GetTransformFeedbackVaryingEXT)
#define glGetTransformFeedbackVarying MANGLE(GetTransformFeedbackVarying)
#define glGetTransformFeedbackVaryingNV MANGLE(GetTransformFeedbackVaryingNV)
#define glGetUniformBlockIndex MANGLE(GetUniformBlockIndex)
#define glGetUniformBufferSizeEXT MANGLE(GetUniformBufferSizeEXT)
#define glGetUniformfvARB MANGLE(GetUniformfvARB)
#define glGetUniformfv MANGLE(GetUniformfv)
#define glGetUniformIndices MANGLE(GetUniformIndices)
#define glGetUniformivARB MANGLE(GetUniformivARB)
#define glGetUniformiv MANGLE(GetUniformiv)
#define glGetUniformLocationARB MANGLE(GetUniformLocationARB)
@@ -744,6 +763,10 @@
#define glGetVertexAttribPointervARB MANGLE(GetVertexAttribPointervARB)
#define glGetVertexAttribPointerv MANGLE(GetVertexAttribPointerv)
#define glGetVertexAttribPointervNV MANGLE(GetVertexAttribPointervNV)
#define glGetVideoi64vNV MANGLE(GetVideoi64vNV)
#define glGetVideoivNV MANGLE(GetVideoivNV)
#define glGetVideoui64vNV MANGLE(GetVideoui64vNV)
#define glGetVideouivNV MANGLE(GetVideouivNV)
#define glGlobalAlphaFactorbSUN MANGLE(GlobalAlphaFactorbSUN)
#define glGlobalAlphaFactordSUN MANGLE(GlobalAlphaFactordSUN)
#define glGlobalAlphaFactorfSUN MANGLE(GlobalAlphaFactorfSUN)
@@ -1096,6 +1119,9 @@
#define glPopClientAttrib MANGLE(PopClientAttrib)
#define glPopMatrix MANGLE(PopMatrix)
#define glPopName MANGLE(PopName)
#define glPresentFrameDualFillNV MANGLE(PresentFrameDualFillNV)
#define glPresentFrameKeyedNV MANGLE(PresentFrameKeyedNV)
#define glPrimitiveRestartIndex MANGLE(PrimitiveRestartIndex)
#define glPrimitiveRestartIndexNV MANGLE(PrimitiveRestartIndexNV)
#define glPrimitiveRestartNV MANGLE(PrimitiveRestartNV)
#define glPrioritizeTexturesEXT MANGLE(PrioritizeTexturesEXT)
@@ -1173,6 +1199,7 @@
#define glProgramUniformMatrix4x2fvEXT MANGLE(ProgramUniformMatrix4x2fvEXT)
#define glProgramUniformMatrix4x3fvEXT MANGLE(ProgramUniformMatrix4x3fvEXT)
#define glProgramVertexLimitNV MANGLE(ProgramVertexLimitNV)
#define glProvokingVertexEXT MANGLE(ProvokingVertexEXT)
#define glPushAttrib MANGLE(PushAttrib)
#define glPushClientAttribDefaultEXT MANGLE(PushClientAttribDefaultEXT)
#define glPushClientAttrib MANGLE(PushClientAttrib)
@@ -1301,6 +1328,7 @@
#define glSecondaryColorPointerListIBM MANGLE(SecondaryColorPointerListIBM)
#define glSecondaryColorPointer MANGLE(SecondaryColorPointer)
#define glSelectBuffer MANGLE(SelectBuffer)
#define glSelectPerfMonitorCountersAMD MANGLE(SelectPerfMonitorCountersAMD)
#define glSeparableFilter2DEXT MANGLE(SeparableFilter2DEXT)
#define glSeparableFilter2D MANGLE(SeparableFilter2D)
#define glSetFenceAPPLE MANGLE(SetFenceAPPLE)
@@ -1345,11 +1373,14 @@
#define glTangent3svEXT MANGLE(Tangent3svEXT)
#define glTangentPointerEXT MANGLE(TangentPointerEXT)
#define glTbufferMask3DFX MANGLE(TbufferMask3DFX)
#define glTessellationFactorAMD MANGLE(TessellationFactorAMD)
#define glTessellationModeAMD MANGLE(TessellationModeAMD)
#define glTestFenceAPPLE MANGLE(TestFenceAPPLE)
#define glTestFenceNV MANGLE(TestFenceNV)
#define glTestObjectAPPLE MANGLE(TestObjectAPPLE)
#define glTexBufferARB MANGLE(TexBufferARB)
#define glTexBufferEXT MANGLE(TexBufferEXT)
#define glTexBuffer MANGLE(TexBuffer)
#define glTexBumpParameterfvATI MANGLE(TexBumpParameterfvATI)
#define glTexBumpParameterivATI MANGLE(TexBumpParameterivATI)
#define glTexCoord1d MANGLE(TexCoord1d)
@@ -1515,6 +1546,7 @@
#define glUniform4ui MANGLE(Uniform4ui)
#define glUniform4uivEXT MANGLE(Uniform4uivEXT)
#define glUniform4uiv MANGLE(Uniform4uiv)
#define glUniformBlockBinding MANGLE(UniformBlockBinding)
#define glUniformBufferEXT MANGLE(UniformBufferEXT)
#define glUniformMatrix2fvARB MANGLE(UniformMatrix2fvARB)
#define glUniformMatrix2fv MANGLE(UniformMatrix2fv)
@@ -1688,7 +1720,7 @@
#define glVertexAttrib4usvARB MANGLE(VertexAttrib4usvARB)
#define glVertexAttrib4usv MANGLE(VertexAttrib4usv)
#define glVertexAttribArrayObjectATI MANGLE(VertexAttribArrayObjectATI)
#define glVertexAttribDivisor MANGLE(VertexAttribDivisor)
#define glVertexAttribDivisorARB MANGLE(VertexAttribDivisorARB)
#define glVertexAttribI1iEXT MANGLE(VertexAttribI1iEXT)
#define glVertexAttribI1i MANGLE(VertexAttribI1i)
#define glVertexAttribI1ivEXT MANGLE(VertexAttribI1ivEXT)

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@ extern "C" {
#endif
/*
** Copyright (c) 2007 The Khronos Group Inc.
** Copyright (c) 2007-2009 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
@@ -28,6 +28,8 @@ extern "C" {
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/* Function declaration macros - to move into glplatform.h */
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
@@ -46,9 +48,9 @@ extern "C" {
/*************************************************************/
/* Header file version number, required by OpenGL ABI for Linux */
/* glxext.h last updated 2008/10/22 */
/* glxext.h last updated 2009/08/03 */
/* Current version at http://www.opengl.org/registry/ */
#define GLX_GLXEXT_VERSION 21
#define GLX_GLXEXT_VERSION 23
#ifndef GLX_VERSION_1_3
#define GLX_WINDOW_BIT 0x00000001
@@ -135,6 +137,12 @@ extern "C" {
#define GLX_CONTEXT_FLAGS_ARB 0x2094
#endif
#ifndef GLX_ARB_create_context_profile
#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
#endif
#ifndef GLX_SGIS_multisample
#define GLX_SAMPLE_BUFFERS_SGIS 100000
#define GLX_SAMPLES_SGIS 100001
@@ -518,6 +526,10 @@ extern GLXContext glXCreateContextAttribsARB (Display *, GLXFBConfig, GLXContext
typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
#endif
#ifndef GLX_ARB_create_context_profile
#define GLX_ARB_create_context_profile 1
#endif
#ifndef GLX_SGIS_multisample
#define GLX_SGIS_multisample 1
#endif

View File

@@ -708,6 +708,19 @@ struct __DRIdri2LoaderExtensionRec {
int *out_count, void *loaderPrivate);
};
#define __DRI_COPY_BUFFER "DRI_CopyBuffer"
#define __DRI_COPY_BUFFER_VERSION 1
typedef struct __DRIcopyBufferExtensionRec __DRIcopyBufferExtension;
struct __DRIcopyBufferExtensionRec {
__DRIextension base;
int (*copyBuffer)(__DRIcontext *context,
__DRIbuffer *dst, int dst_x, int dst_y,
__DRIdrawable *src, unsigned int src_attachment,
int x, int y, int width, int height);
};
/**
* This extension provides alternative screen, drawable and context
* constructors for DRI2.

View File

@@ -6,7 +6,7 @@ extern "C" {
#endif
/*
** Copyright (c) 2007 The Khronos Group Inc.
** Copyright (c) 2007-2009 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
@@ -28,6 +28,8 @@ extern "C" {
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/* Function declaration macros - to move into glplatform.h */
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
@@ -46,9 +48,9 @@ extern "C" {
/*************************************************************/
/* Header file version number */
/* wglext.h last updated 2009/03/03 */
/* wglext.h last updated 2009/08/03 */
/* Current version at http://www.opengl.org/registry/ */
#define WGL_WGLEXT_VERSION 12
#define WGL_WGLEXT_VERSION 15
#ifndef WGL_ARB_buffer_region
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
@@ -174,8 +176,8 @@ extern "C" {
#endif
#ifndef WGL_ARB_create_context
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
@@ -183,6 +185,13 @@ extern "C" {
#define ERROR_INVALID_VERSION_ARB 0x2095
#endif
#ifndef WGL_ARB_create_context_profile
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
#define ERROR_INVALID_PROFILE_ARB 0x2096
#endif
#ifndef WGL_EXT_make_current_read
#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
#endif
@@ -495,6 +504,10 @@ extern HGLRC WINAPI wglCreateContextAttribsARB (HDC, HGLRC, const int *);
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
#endif
#ifndef WGL_ARB_create_context_profile
#define WGL_ARB_create_context_profile 1
#endif
#ifndef WGL_EXT_display_color_table
#define WGL_EXT_display_color_table 1
#ifdef WGL_WGLEXT_PROTOTYPES
@@ -709,6 +722,14 @@ typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWO
#define WGL_NV_float_buffer 1
#endif
#ifndef WGL_3DL_stereo_control
#define WGL_3DL_stereo_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglSetStereoEmitterState3DL (HDC, UINT);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
#endif
#ifndef WGL_EXT_pixel_format_packed_float
#define WGL_EXT_pixel_format_packed_float 1
#endif

686
include/VG/openvg.h Normal file
View File

@@ -0,0 +1,686 @@
/* $Revision: 6822 $ on $Date:: 2008-10-30 05:14:19 -0400 #$ */
/*------------------------------------------------------------------------
*
* OpenVG 1.0.1 Reference Implementation
* -------------------------------------
*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and /or associated documentation files
* (the "Materials "), to deal in the Materials without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Materials,
* and to permit persons to whom the Materials are furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
* THE USE OR OTHER DEALINGS IN THE MATERIALS.
*
*//**
* \file
* \brief OpenVG 1.0.1 API.
*//*-------------------------------------------------------------------*/
#ifndef _OPENVG_H
#define _OPENVG_H
#include <VG/vgplatform.h>
#ifdef __cplusplus
extern "C" {
#endif
#define OPENVG_VERSION_1_0 1
#define OPENVG_VERSION_1_0_1 1
#ifndef VG_MAXSHORT
#define VG_MAXSHORT 0x7FFF
#endif
#ifndef VG_MAXINT
#define VG_MAXINT 0x7FFFFFFF
#endif
#ifndef VG_MAX_ENUM
#define VG_MAX_ENUM 0x7FFFFFFF
#endif
typedef long VGHandle;
typedef VGHandle VGPath;
typedef VGHandle VGImage;
typedef VGHandle VGPaint;
#define VG_INVALID_HANDLE ((VGHandle)0)
typedef enum {
VG_FALSE = 0,
VG_TRUE = 1,
VG_BOOLEAN_FORCE_SIZE = VG_MAX_ENUM
} VGboolean;
typedef enum {
VG_NO_ERROR = 0,
VG_BAD_HANDLE_ERROR = 0x1000,
VG_ILLEGAL_ARGUMENT_ERROR = 0x1001,
VG_OUT_OF_MEMORY_ERROR = 0x1002,
VG_PATH_CAPABILITY_ERROR = 0x1003,
VG_UNSUPPORTED_IMAGE_FORMAT_ERROR = 0x1004,
VG_UNSUPPORTED_PATH_FORMAT_ERROR = 0x1005,
VG_IMAGE_IN_USE_ERROR = 0x1006,
VG_NO_CONTEXT_ERROR = 0x1007,
VG_ERROR_CODE_FORCE_SIZE = VG_MAX_ENUM
} VGErrorCode;
typedef enum {
/* Mode settings */
VG_MATRIX_MODE = 0x1100,
VG_FILL_RULE = 0x1101,
VG_IMAGE_QUALITY = 0x1102,
VG_RENDERING_QUALITY = 0x1103,
VG_BLEND_MODE = 0x1104,
VG_IMAGE_MODE = 0x1105,
/* Scissoring rectangles */
VG_SCISSOR_RECTS = 0x1106,
/* Stroke parameters */
VG_STROKE_LINE_WIDTH = 0x1110,
VG_STROKE_CAP_STYLE = 0x1111,
VG_STROKE_JOIN_STYLE = 0x1112,
VG_STROKE_MITER_LIMIT = 0x1113,
VG_STROKE_DASH_PATTERN = 0x1114,
VG_STROKE_DASH_PHASE = 0x1115,
VG_STROKE_DASH_PHASE_RESET = 0x1116,
/* Edge fill color for VG_TILE_FILL tiling mode */
VG_TILE_FILL_COLOR = 0x1120,
/* Color for vgClear */
VG_CLEAR_COLOR = 0x1121,
/* Enable/disable alpha masking and scissoring */
VG_MASKING = 0x1130,
VG_SCISSORING = 0x1131,
/* Pixel layout information */
VG_PIXEL_LAYOUT = 0x1140,
VG_SCREEN_LAYOUT = 0x1141,
/* Source format selection for image filters */
VG_FILTER_FORMAT_LINEAR = 0x1150,
VG_FILTER_FORMAT_PREMULTIPLIED = 0x1151,
/* Destination write enable mask for image filters */
VG_FILTER_CHANNEL_MASK = 0x1152,
/* Implementation limits (read-only) */
VG_MAX_SCISSOR_RECTS = 0x1160,
VG_MAX_DASH_COUNT = 0x1161,
VG_MAX_KERNEL_SIZE = 0x1162,
VG_MAX_SEPARABLE_KERNEL_SIZE = 0x1163,
VG_MAX_COLOR_RAMP_STOPS = 0x1164,
VG_MAX_IMAGE_WIDTH = 0x1165,
VG_MAX_IMAGE_HEIGHT = 0x1166,
VG_MAX_IMAGE_PIXELS = 0x1167,
VG_MAX_IMAGE_BYTES = 0x1168,
VG_MAX_FLOAT = 0x1169,
VG_MAX_GAUSSIAN_STD_DEVIATION = 0x116A,
VG_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGParamType;
typedef enum {
VG_RENDERING_QUALITY_NONANTIALIASED = 0x1200,
VG_RENDERING_QUALITY_FASTER = 0x1201,
VG_RENDERING_QUALITY_BETTER = 0x1202, /* Default */
VG_RENDERING_QUALITY_FORCE_SIZE = VG_MAX_ENUM
} VGRenderingQuality;
typedef enum {
VG_PIXEL_LAYOUT_UNKNOWN = 0x1300,
VG_PIXEL_LAYOUT_RGB_VERTICAL = 0x1301,
VG_PIXEL_LAYOUT_BGR_VERTICAL = 0x1302,
VG_PIXEL_LAYOUT_RGB_HORIZONTAL = 0x1303,
VG_PIXEL_LAYOUT_BGR_HORIZONTAL = 0x1304,
VG_PIXEL_LAYOUT_FORCE_SIZE = VG_MAX_ENUM
} VGPixelLayout;
typedef enum {
VG_MATRIX_PATH_USER_TO_SURFACE = 0x1400,
VG_MATRIX_IMAGE_USER_TO_SURFACE = 0x1401,
VG_MATRIX_FILL_PAINT_TO_USER = 0x1402,
VG_MATRIX_STROKE_PAINT_TO_USER = 0x1403,
VG_MATRIX_MODE_FORCE_SIZE = VG_MAX_ENUM
} VGMatrixMode;
typedef enum {
VG_CLEAR_MASK = 0x1500,
VG_FILL_MASK = 0x1501,
VG_SET_MASK = 0x1502,
VG_UNION_MASK = 0x1503,
VG_INTERSECT_MASK = 0x1504,
VG_SUBTRACT_MASK = 0x1505,
VG_MASK_OPERATION_FORCE_SIZE = VG_MAX_ENUM
} VGMaskOperation;
#define VG_PATH_FORMAT_STANDARD 0
typedef enum {
VG_PATH_DATATYPE_S_8 = 0,
VG_PATH_DATATYPE_S_16 = 1,
VG_PATH_DATATYPE_S_32 = 2,
VG_PATH_DATATYPE_F = 3,
VG_PATH_DATATYPE_FORCE_SIZE = VG_MAX_ENUM
} VGPathDatatype;
typedef enum {
VG_ABSOLUTE = 0,
VG_RELATIVE = 1,
VG_PATH_ABS_REL_FORCE_SIZE = VG_MAX_ENUM
} VGPathAbsRel;
typedef enum {
VG_CLOSE_PATH = ( 0 << 1),
VG_MOVE_TO = ( 1 << 1),
VG_LINE_TO = ( 2 << 1),
VG_HLINE_TO = ( 3 << 1),
VG_VLINE_TO = ( 4 << 1),
VG_QUAD_TO = ( 5 << 1),
VG_CUBIC_TO = ( 6 << 1),
VG_SQUAD_TO = ( 7 << 1),
VG_SCUBIC_TO = ( 8 << 1),
VG_SCCWARC_TO = ( 9 << 1),
VG_SCWARC_TO = (10 << 1),
VG_LCCWARC_TO = (11 << 1),
VG_LCWARC_TO = (12 << 1),
VG_PATH_SEGMENT_FORCE_SIZE = VG_MAX_ENUM
} VGPathSegment;
typedef enum {
VG_MOVE_TO_ABS = VG_MOVE_TO | VG_ABSOLUTE,
VG_MOVE_TO_REL = VG_MOVE_TO | VG_RELATIVE,
VG_LINE_TO_ABS = VG_LINE_TO | VG_ABSOLUTE,
VG_LINE_TO_REL = VG_LINE_TO | VG_RELATIVE,
VG_HLINE_TO_ABS = VG_HLINE_TO | VG_ABSOLUTE,
VG_HLINE_TO_REL = VG_HLINE_TO | VG_RELATIVE,
VG_VLINE_TO_ABS = VG_VLINE_TO | VG_ABSOLUTE,
VG_VLINE_TO_REL = VG_VLINE_TO | VG_RELATIVE,
VG_QUAD_TO_ABS = VG_QUAD_TO | VG_ABSOLUTE,
VG_QUAD_TO_REL = VG_QUAD_TO | VG_RELATIVE,
VG_CUBIC_TO_ABS = VG_CUBIC_TO | VG_ABSOLUTE,
VG_CUBIC_TO_REL = VG_CUBIC_TO | VG_RELATIVE,
VG_SQUAD_TO_ABS = VG_SQUAD_TO | VG_ABSOLUTE,
VG_SQUAD_TO_REL = VG_SQUAD_TO | VG_RELATIVE,
VG_SCUBIC_TO_ABS = VG_SCUBIC_TO | VG_ABSOLUTE,
VG_SCUBIC_TO_REL = VG_SCUBIC_TO | VG_RELATIVE,
VG_SCCWARC_TO_ABS = VG_SCCWARC_TO | VG_ABSOLUTE,
VG_SCCWARC_TO_REL = VG_SCCWARC_TO | VG_RELATIVE,
VG_SCWARC_TO_ABS = VG_SCWARC_TO | VG_ABSOLUTE,
VG_SCWARC_TO_REL = VG_SCWARC_TO | VG_RELATIVE,
VG_LCCWARC_TO_ABS = VG_LCCWARC_TO | VG_ABSOLUTE,
VG_LCCWARC_TO_REL = VG_LCCWARC_TO | VG_RELATIVE,
VG_LCWARC_TO_ABS = VG_LCWARC_TO | VG_ABSOLUTE,
VG_LCWARC_TO_REL = VG_LCWARC_TO | VG_RELATIVE,
VG_PATH_COMMAND_FORCE_SIZE = VG_MAX_ENUM
} VGPathCommand;
typedef enum {
VG_PATH_CAPABILITY_APPEND_FROM = (1 << 0),
VG_PATH_CAPABILITY_APPEND_TO = (1 << 1),
VG_PATH_CAPABILITY_MODIFY = (1 << 2),
VG_PATH_CAPABILITY_TRANSFORM_FROM = (1 << 3),
VG_PATH_CAPABILITY_TRANSFORM_TO = (1 << 4),
VG_PATH_CAPABILITY_INTERPOLATE_FROM = (1 << 5),
VG_PATH_CAPABILITY_INTERPOLATE_TO = (1 << 6),
VG_PATH_CAPABILITY_PATH_LENGTH = (1 << 7),
VG_PATH_CAPABILITY_POINT_ALONG_PATH = (1 << 8),
VG_PATH_CAPABILITY_TANGENT_ALONG_PATH = (1 << 9),
VG_PATH_CAPABILITY_PATH_BOUNDS = (1 << 10),
VG_PATH_CAPABILITY_PATH_TRANSFORMED_BOUNDS = (1 << 11),
VG_PATH_CAPABILITY_ALL = (1 << 12) - 1,
VG_PATH_CAPABILITIES_FORCE_SIZE = VG_MAX_ENUM
} VGPathCapabilities;
typedef enum {
VG_PATH_FORMAT = 0x1600,
VG_PATH_DATATYPE = 0x1601,
VG_PATH_SCALE = 0x1602,
VG_PATH_BIAS = 0x1603,
VG_PATH_NUM_SEGMENTS = 0x1604,
VG_PATH_NUM_COORDS = 0x1605,
VG_PATH_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGPathParamType;
typedef enum {
VG_CAP_BUTT = 0x1700,
VG_CAP_ROUND = 0x1701,
VG_CAP_SQUARE = 0x1702,
VG_CAP_STYLE_FORCE_SIZE = VG_MAX_ENUM
} VGCapStyle;
typedef enum {
VG_JOIN_MITER = 0x1800,
VG_JOIN_ROUND = 0x1801,
VG_JOIN_BEVEL = 0x1802,
VG_JOIN_STYLE_FORCE_SIZE = VG_MAX_ENUM
} VGJoinStyle;
typedef enum {
VG_EVEN_ODD = 0x1900,
VG_NON_ZERO = 0x1901,
VG_FILL_RULE_FORCE_SIZE = VG_MAX_ENUM
} VGFillRule;
typedef enum {
VG_STROKE_PATH = (1 << 0),
VG_FILL_PATH = (1 << 1),
VG_PAINT_MODE_FORCE_SIZE = VG_MAX_ENUM
} VGPaintMode;
typedef enum {
/* Color paint parameters */
VG_PAINT_TYPE = 0x1A00,
VG_PAINT_COLOR = 0x1A01,
VG_PAINT_COLOR_RAMP_SPREAD_MODE = 0x1A02,
VG_PAINT_COLOR_RAMP_PREMULTIPLIED = 0x1A07,
VG_PAINT_COLOR_RAMP_STOPS = 0x1A03,
/* Linear gradient paint parameters */
VG_PAINT_LINEAR_GRADIENT = 0x1A04,
/* Radial gradient paint parameters */
VG_PAINT_RADIAL_GRADIENT = 0x1A05,
/* Pattern paint parameters */
VG_PAINT_PATTERN_TILING_MODE = 0x1A06,
VG_PAINT_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGPaintParamType;
typedef enum {
VG_PAINT_TYPE_COLOR = 0x1B00,
VG_PAINT_TYPE_LINEAR_GRADIENT = 0x1B01,
VG_PAINT_TYPE_RADIAL_GRADIENT = 0x1B02,
VG_PAINT_TYPE_PATTERN = 0x1B03,
VG_PAINT_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGPaintType;
typedef enum {
VG_COLOR_RAMP_SPREAD_PAD = 0x1C00,
VG_COLOR_RAMP_SPREAD_REPEAT = 0x1C01,
VG_COLOR_RAMP_SPREAD_REFLECT = 0x1C02,
VG_COLOR_RAMP_SPREAD_MODE_FORCE_SIZE = VG_MAX_ENUM
} VGColorRampSpreadMode;
typedef enum {
VG_TILE_FILL = 0x1D00,
VG_TILE_PAD = 0x1D01,
VG_TILE_REPEAT = 0x1D02,
VG_TILE_REFLECT = 0x1D03,
VG_TILING_MODE_FORCE_SIZE = VG_MAX_ENUM
} VGTilingMode;
typedef enum {
/* RGB{A,X} channel ordering */
VG_sRGBX_8888 = 0,
VG_sRGBA_8888 = 1,
VG_sRGBA_8888_PRE = 2,
VG_sRGB_565 = 3,
VG_sRGBA_5551 = 4,
VG_sRGBA_4444 = 5,
VG_sL_8 = 6,
VG_lRGBX_8888 = 7,
VG_lRGBA_8888 = 8,
VG_lRGBA_8888_PRE = 9,
VG_lL_8 = 10,
VG_A_8 = 11,
VG_BW_1 = 12,
/* {A,X}RGB channel ordering */
VG_sXRGB_8888 = 0 | (1 << 6),
VG_sARGB_8888 = 1 | (1 << 6),
VG_sARGB_8888_PRE = 2 | (1 << 6),
VG_sARGB_1555 = 4 | (1 << 6),
VG_sARGB_4444 = 5 | (1 << 6),
VG_lXRGB_8888 = 7 | (1 << 6),
VG_lARGB_8888 = 8 | (1 << 6),
VG_lARGB_8888_PRE = 9 | (1 << 6),
/* BGR{A,X} channel ordering */
VG_sBGRX_8888 = 0 | (1 << 7),
VG_sBGRA_8888 = 1 | (1 << 7),
VG_sBGRA_8888_PRE = 2 | (1 << 7),
VG_sBGR_565 = 3 | (1 << 7),
VG_sBGRA_5551 = 4 | (1 << 7),
VG_sBGRA_4444 = 5 | (1 << 7),
VG_lBGRX_8888 = 7 | (1 << 7),
VG_lBGRA_8888 = 8 | (1 << 7),
VG_lBGRA_8888_PRE = 9 | (1 << 7),
/* {A,X}BGR channel ordering */
VG_sXBGR_8888 = 0 | (1 << 6) | (1 << 7),
VG_sABGR_8888 = 1 | (1 << 6) | (1 << 7),
VG_sABGR_8888_PRE = 2 | (1 << 6) | (1 << 7),
VG_sABGR_1555 = 4 | (1 << 6) | (1 << 7),
VG_sABGR_4444 = 5 | (1 << 6) | (1 << 7),
VG_lXBGR_8888 = 7 | (1 << 6) | (1 << 7),
VG_lABGR_8888 = 8 | (1 << 6) | (1 << 7),
VG_lABGR_8888_PRE = 9 | (1 << 6) | (1 << 7),
VG_IMAGE_FORMAT_FORCE_SIZE = VG_MAX_ENUM
} VGImageFormat;
typedef enum {
VG_IMAGE_QUALITY_NONANTIALIASED = (1 << 0),
VG_IMAGE_QUALITY_FASTER = (1 << 1),
VG_IMAGE_QUALITY_BETTER = (1 << 2),
VG_IMAGE_QUALITY_FORCE_SIZE = VG_MAX_ENUM
} VGImageQuality;
typedef enum {
VG_IMAGE_FORMAT = 0x1E00,
VG_IMAGE_WIDTH = 0x1E01,
VG_IMAGE_HEIGHT = 0x1E02,
VG_IMAGE_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGImageParamType;
typedef enum {
VG_DRAW_IMAGE_NORMAL = 0x1F00,
VG_DRAW_IMAGE_MULTIPLY = 0x1F01,
VG_DRAW_IMAGE_STENCIL = 0x1F02,
VG_IMAGE_MODE_FORCE_SIZE = VG_MAX_ENUM
} VGImageMode;
typedef enum {
VG_RED = (1 << 3),
VG_GREEN = (1 << 2),
VG_BLUE = (1 << 1),
VG_ALPHA = (1 << 0),
VG_IMAGE_CHANNEL_FORCE_SIZE = VG_MAX_ENUM
} VGImageChannel;
typedef enum {
VG_BLEND_SRC = 0x2000,
VG_BLEND_SRC_OVER = 0x2001,
VG_BLEND_DST_OVER = 0x2002,
VG_BLEND_SRC_IN = 0x2003,
VG_BLEND_DST_IN = 0x2004,
VG_BLEND_MULTIPLY = 0x2005,
VG_BLEND_SCREEN = 0x2006,
VG_BLEND_DARKEN = 0x2007,
VG_BLEND_LIGHTEN = 0x2008,
VG_BLEND_ADDITIVE = 0x2009,
VG_BLEND_MODE_FORCE_SIZE = VG_MAX_ENUM
} VGBlendMode;
typedef enum {
VG_IMAGE_FORMAT_QUERY = 0x2100,
VG_PATH_DATATYPE_QUERY = 0x2101,
VG_HARDWARE_QUERY_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGHardwareQueryType;
typedef enum {
VG_HARDWARE_ACCELERATED = 0x2200,
VG_HARDWARE_UNACCELERATED = 0x2201,
VG_HARDWARE_QUERY_RESULT_FORCE_SIZE = VG_MAX_ENUM
} VGHardwareQueryResult;
typedef enum {
VG_VENDOR = 0x2300,
VG_RENDERER = 0x2301,
VG_VERSION = 0x2302,
VG_EXTENSIONS = 0x2303,
VG_STRING_ID_FORCE_SIZE = VG_MAX_ENUM
} VGStringID;
/* Function Prototypes */
#ifndef VG_API_CALL
# error VG_API_CALL must be defined
#endif
#ifndef VG_API_ENTRY
# error VG_API_ENTRY must be defined
#endif
#ifndef VG_API_EXIT
# error VG_API_EXIT must be defined
#endif
VG_API_CALL VGErrorCode VG_API_ENTRY vgGetError(void) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgFlush(void) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgFinish(void) VG_API_EXIT;
/* Getters and Setters */
VG_API_CALL void VG_API_ENTRY vgSetf (VGParamType type, VGfloat value) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSeti (VGParamType type, VGint value) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetfv(VGParamType type, VGint count,
const VGfloat * values) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetiv(VGParamType type, VGint count,
const VGint * values) VG_API_EXIT;
VG_API_CALL VGfloat VG_API_ENTRY vgGetf(VGParamType type) VG_API_EXIT;
VG_API_CALL VGint VG_API_ENTRY vgGeti(VGParamType type) VG_API_EXIT;
VG_API_CALL VGint VG_API_ENTRY vgGetVectorSize(VGParamType type) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGetfv(VGParamType type, VGint count, VGfloat * values) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGetiv(VGParamType type, VGint count, VGint * values) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetParameterf(VGHandle object,
VGint paramType,
VGfloat value) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetParameteri(VGHandle object,
VGint paramType,
VGint value) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetParameterfv(VGHandle object,
VGint paramType,
VGint count, const VGfloat * values) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetParameteriv(VGHandle object,
VGint paramType,
VGint count, const VGint * values) VG_API_EXIT;
VG_API_CALL VGfloat VG_API_ENTRY vgGetParameterf(VGHandle object,
VGint paramType) VG_API_EXIT;
VG_API_CALL VGint VG_API_ENTRY vgGetParameteri(VGHandle object,
VGint paramType);
VG_API_CALL VGint VG_API_ENTRY vgGetParameterVectorSize(VGHandle object,
VGint paramType) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGetParameterfv(VGHandle object,
VGint paramType,
VGint count, VGfloat * values) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGetParameteriv(VGHandle object,
VGint paramType,
VGint count, VGint * values) VG_API_EXIT;
/* Matrix Manipulation */
VG_API_CALL void VG_API_ENTRY vgLoadIdentity(void) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgLoadMatrix(const VGfloat * m) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGetMatrix(VGfloat * m) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgMultMatrix(const VGfloat * m) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgTranslate(VGfloat tx, VGfloat ty) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgScale(VGfloat sx, VGfloat sy) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgShear(VGfloat shx, VGfloat shy) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgRotate(VGfloat angle) VG_API_EXIT;
/* Masking and Clearing */
VG_API_CALL void VG_API_ENTRY vgMask(VGImage mask, VGMaskOperation operation,
VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgClear(VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
/* Paths */
VG_API_CALL VGPath VG_API_ENTRY vgCreatePath(VGint pathFormat,
VGPathDatatype datatype,
VGfloat scale, VGfloat bias,
VGint segmentCapacityHint,
VGint coordCapacityHint,
VGbitfield capabilities) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgClearPath(VGPath path, VGbitfield capabilities) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgDestroyPath(VGPath path) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgRemovePathCapabilities(VGPath path,
VGbitfield capabilities) VG_API_EXIT;
VG_API_CALL VGbitfield VG_API_ENTRY vgGetPathCapabilities(VGPath path) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgAppendPath(VGPath dstPath, VGPath srcPath) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgAppendPathData(VGPath dstPath,
VGint numSegments,
const VGubyte * pathSegments,
const void * pathData) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgModifyPathCoords(VGPath dstPath, VGint startIndex,
VGint numSegments,
const void * pathData) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgTransformPath(VGPath dstPath, VGPath srcPath) VG_API_EXIT;
VG_API_CALL VGboolean VG_API_ENTRY vgInterpolatePath(VGPath dstPath,
VGPath startPath,
VGPath endPath,
VGfloat amount) VG_API_EXIT;
VG_API_CALL VGfloat VG_API_ENTRY vgPathLength(VGPath path,
VGint startSegment, VGint numSegments) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgPointAlongPath(VGPath path,
VGint startSegment, VGint numSegments,
VGfloat distance,
VGfloat * x, VGfloat * y,
VGfloat * tangentX, VGfloat * tangentY) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgPathBounds(VGPath path,
VGfloat * minX, VGfloat * minY,
VGfloat * width, VGfloat * height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgPathTransformedBounds(VGPath path,
VGfloat * minX, VGfloat * minY,
VGfloat * width, VGfloat * height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgDrawPath(VGPath path, VGbitfield paintModes) VG_API_EXIT;
/* Paint */
VG_API_CALL VGPaint VG_API_ENTRY vgCreatePaint(void) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgDestroyPaint(VGPaint paint) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetPaint(VGPaint paint, VGbitfield paintModes) VG_API_EXIT;
VG_API_CALL VGPaint VG_API_ENTRY vgGetPaint(VGPaintMode paintMode) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetColor(VGPaint paint, VGuint rgba) VG_API_EXIT;
VG_API_CALL VGuint VG_API_ENTRY vgGetColor(VGPaint paint) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgPaintPattern(VGPaint paint, VGImage pattern) VG_API_EXIT;
/* Images */
VG_API_CALL VGImage VG_API_ENTRY vgCreateImage(VGImageFormat format,
VGint width, VGint height,
VGbitfield allowedQuality) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgDestroyImage(VGImage image) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgClearImage(VGImage image,
VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgImageSubData(VGImage image,
const void * data, VGint dataStride,
VGImageFormat dataFormat,
VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGetImageSubData(VGImage image,
void * data, VGint dataStride,
VGImageFormat dataFormat,
VGint x, VGint y,
VGint width, VGint height) VG_API_EXIT;
VG_API_CALL VGImage VG_API_ENTRY vgChildImage(VGImage parent,
VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
VG_API_CALL VGImage VG_API_ENTRY vgGetParent(VGImage image) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgCopyImage(VGImage dst, VGint dx, VGint dy,
VGImage src, VGint sx, VGint sy,
VGint width, VGint height,
VGboolean dither) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgDrawImage(VGImage image) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetPixels(VGint dx, VGint dy,
VGImage src, VGint sx, VGint sy,
VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgWritePixels(const void * data, VGint dataStride,
VGImageFormat dataFormat,
VGint dx, VGint dy,
VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGetPixels(VGImage dst, VGint dx, VGint dy,
VGint sx, VGint sy,
VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgReadPixels(void * data, VGint dataStride,
VGImageFormat dataFormat,
VGint sx, VGint sy,
VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgCopyPixels(VGint dx, VGint dy,
VGint sx, VGint sy,
VGint width, VGint height) VG_API_EXIT;
/* Image Filters */
VG_API_CALL void VG_API_ENTRY vgColorMatrix(VGImage dst, VGImage src,
const VGfloat * matrix) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgConvolve(VGImage dst, VGImage src,
VGint kernelWidth, VGint kernelHeight,
VGint shiftX, VGint shiftY,
const VGshort * kernel,
VGfloat scale,
VGfloat bias,
VGTilingMode tilingMode) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSeparableConvolve(VGImage dst, VGImage src,
VGint kernelWidth,
VGint kernelHeight,
VGint shiftX, VGint shiftY,
const VGshort * kernelX,
const VGshort * kernelY,
VGfloat scale,
VGfloat bias,
VGTilingMode tilingMode) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGaussianBlur(VGImage dst, VGImage src,
VGfloat stdDeviationX,
VGfloat stdDeviationY,
VGTilingMode tilingMode) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgLookup(VGImage dst, VGImage src,
const VGubyte * redLUT,
const VGubyte * greenLUT,
const VGubyte * blueLUT,
const VGubyte * alphaLUT,
VGboolean outputLinear,
VGboolean outputPremultiplied) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgLookupSingle(VGImage dst, VGImage src,
const VGuint * lookupTable,
VGImageChannel sourceChannel,
VGboolean outputLinear,
VGboolean outputPremultiplied) VG_API_EXIT;
/* Hardware Queries */
VG_API_CALL VGHardwareQueryResult VG_API_ENTRY vgHardwareQuery(VGHardwareQueryType key,
VGint setting) VG_API_EXIT;
/* Renderer and Extension Information */
VG_API_CALL const VGubyte * VG_API_ENTRY vgGetString(VGStringID name) VG_API_EXIT;
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _OPENVG_H */

233
include/VG/vgext.h Normal file
View File

@@ -0,0 +1,233 @@
/* $Revision: 6810 $ on $Date:: 2008-10-29 10:31:37 -0400 #$ */
/*------------------------------------------------------------------------
*
* VG extensions Reference Implementation
* -------------------------------------
*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and /or associated documentation files
* (the "Materials "), to deal in the Materials without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Materials,
* and to permit persons to whom the Materials are furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
* THE USE OR OTHER DEALINGS IN THE MATERIALS.
*
*//**
* \file
* \brief VG extensions
*//*-------------------------------------------------------------------*/
#ifndef _VGEXT_H
#define _VGEXT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <VG/openvg.h>
#include <VG/vgu.h>
#ifndef VG_API_ENTRYP
# define VG_API_ENTRYP VG_API_ENTRY*
#endif
#ifndef VGU_API_ENTRYP
# define VGU_API_ENTRYP VGU_API_ENTRY*
#endif
/*-------------------------------------------------------------------------------
* KHR extensions
*------------------------------------------------------------------------------*/
typedef enum {
#ifndef VG_KHR_iterative_average_blur
VG_MAX_AVERAGE_BLUR_DIMENSION_KHR = 0x116B,
VG_AVERAGE_BLUR_DIMENSION_RESOLUTION_KHR = 0x116C,
VG_MAX_AVERAGE_BLUR_ITERATIONS_KHR = 0x116D,
#endif
VG_PARAM_TYPE_KHR_FORCE_SIZE = VG_MAX_ENUM
} VGParamTypeKHR;
#ifndef VG_KHR_EGL_image
#define VG_KHR_EGL_image 1
/* VGEGLImageKHR is an opaque handle to an EGLImage */
typedef void* VGeglImageKHR;
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL VGImage VG_API_ENTRY vgCreateEGLImageTargetKHR(VGeglImageKHR image);
#endif
typedef VGImage (VG_API_ENTRYP PFNVGCREATEEGLIMAGETARGETKHRPROC) (VGeglImageKHR image);
#endif
#ifndef VG_KHR_iterative_average_blur
#define VG_KHR_iterative_average_blur 1
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL void vgIterativeAverageBlurKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode);
#endif
typedef void (VG_API_ENTRYP PFNVGITERATIVEAVERAGEBLURKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode);
#endif
#ifndef VG_KHR_advanced_blending
#define VG_KHR_advanced_blending 1
typedef enum {
VG_BLEND_OVERLAY_KHR = 0x2010,
VG_BLEND_HARDLIGHT_KHR = 0x2011,
VG_BLEND_SOFTLIGHT_SVG_KHR = 0x2012,
VG_BLEND_SOFTLIGHT_KHR = 0x2013,
VG_BLEND_COLORDODGE_KHR = 0x2014,
VG_BLEND_COLORBURN_KHR = 0x2015,
VG_BLEND_DIFFERENCE_KHR = 0x2016,
VG_BLEND_SUBTRACT_KHR = 0x2017,
VG_BLEND_INVERT_KHR = 0x2018,
VG_BLEND_EXCLUSION_KHR = 0x2019,
VG_BLEND_LINEARDODGE_KHR = 0x201a,
VG_BLEND_LINEARBURN_KHR = 0x201b,
VG_BLEND_VIVIDLIGHT_KHR = 0x201c,
VG_BLEND_LINEARLIGHT_KHR = 0x201d,
VG_BLEND_PINLIGHT_KHR = 0x201e,
VG_BLEND_HARDMIX_KHR = 0x201f,
VG_BLEND_CLEAR_KHR = 0x2020,
VG_BLEND_DST_KHR = 0x2021,
VG_BLEND_SRC_OUT_KHR = 0x2022,
VG_BLEND_DST_OUT_KHR = 0x2023,
VG_BLEND_SRC_ATOP_KHR = 0x2024,
VG_BLEND_DST_ATOP_KHR = 0x2025,
VG_BLEND_XOR_KHR = 0x2026,
VG_BLEND_MODE_KHR_FORCE_SIZE= VG_MAX_ENUM
} VGBlendModeKHR;
#endif
#ifndef VG_KHR_parametric_filter
#define VG_KHR_parametric_filter 1
typedef enum {
VG_PF_OBJECT_VISIBLE_FLAG_KHR = (1 << 0),
VG_PF_KNOCKOUT_FLAG_KHR = (1 << 1),
VG_PF_OUTER_FLAG_KHR = (1 << 2),
VG_PF_INNER_FLAG_KHR = (1 << 3),
VG_PF_TYPE_KHR_FORCE_SIZE = VG_MAX_ENUM
} VGPfTypeKHR;
typedef enum {
VGU_IMAGE_IN_USE_ERROR = 0xF010,
VGU_ERROR_CODE_KHR_FORCE_SIZE = VG_MAX_ENUM
} VGUErrorCodeKHR;
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL void VG_API_ENTRY vgParametricFilterKHR(VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguDropShadowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA) ;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops);
#endif
typedef void (VG_API_ENTRYP PFNVGPARAMETRICFILTERKHRPROC) (VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUDROPSHADOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops);
#endif
/*-------------------------------------------------------------------------------
* NDS extensions
*------------------------------------------------------------------------------*/
#ifndef VG_NDS_paint_generation
#define VG_NDS_paint_generation 1
typedef enum {
VG_PAINT_COLOR_RAMP_LINEAR_NDS = 0x1A10,
VG_COLOR_MATRIX_NDS = 0x1A11,
VG_PAINT_COLOR_TRANSFORM_LINEAR_NDS = 0x1A12,
VG_PAINT_PARAM_TYPE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGPaintParamTypeNds;
typedef enum {
VG_DRAW_IMAGE_COLOR_MATRIX_NDS = 0x1F10,
VG_IMAGE_MODE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGImageModeNds;
#endif
#ifndef VG_NDS_projective_geometry
#define VG_NDS_projective_geometry 1
typedef enum {
VG_CLIP_MODE_NDS = 0x1180,
VG_CLIP_LINES_NDS = 0x1181,
VG_MAX_CLIP_LINES_NDS = 0x1182,
VG_PARAM_TYPE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGParamTypeNds;
typedef enum {
VG_CLIPMODE_NONE_NDS = 0x3000,
VG_CLIPMODE_CLIP_CLOSED_NDS = 0x3001,
VG_CLIPMODE_CLIP_OPEN_NDS = 0x3002,
VG_CLIPMODE_CULL_NDS = 0x3003,
VG_CLIPMODE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGClipModeNds;
typedef enum {
VG_RQUAD_TO_NDS = ( 13 << 1 ),
VG_RCUBIC_TO_NDS = ( 14 << 1 ),
VG_PATH_SEGMENT_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGPathSegmentNds;
typedef enum {
VG_RQUAD_TO_ABS_NDS = (VG_RQUAD_TO_NDS | VG_ABSOLUTE),
VG_RQUAD_TO_REL_NDS = (VG_RQUAD_TO_NDS | VG_RELATIVE),
VG_RCUBIC_TO_ABS_NDS = (VG_RCUBIC_TO_NDS | VG_ABSOLUTE),
VG_RCUBIC_TO_REL_NDS = (VG_RCUBIC_TO_NDS | VG_RELATIVE),
VG_PATH_COMMAND_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGPathCommandNds;
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL void VG_API_ENTRY vgProjectiveMatrixNDS(VGboolean enable) ;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguTransformClipLineNDS(const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout);
#endif
typedef void (VG_API_ENTRYP PFNVGPROJECTIVEMATRIXNDSPROC) (VGboolean enable) ;
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUTRANSFORMCLIPLINENDSPROC) (const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout);
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _VGEXT_H */

106
include/VG/vgplatform.h Normal file
View File

@@ -0,0 +1,106 @@
/* $Revision: 6810 $ on $Date:: 2008-10-29 10:31:37 -0400 #$ */
/*------------------------------------------------------------------------
*
* VG platform specific header Reference Implementation
* ----------------------------------------------------
*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and /or associated documentation files
* (the "Materials "), to deal in the Materials without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Materials,
* and to permit persons to whom the Materials are furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
* THE USE OR OTHER DEALINGS IN THE MATERIALS.
*
*//**
* \file
* \brief VG platform specific header
*//*-------------------------------------------------------------------*/
#ifndef _VGPLATFORM_H
#define _VGPLATFORM_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef VG_API_CALL
#if defined(OPENVG_STATIC_LIBRARY)
# define VG_API_CALL
#else
# if defined(_WIN32) || defined(__VC32__) /* Win32 */
# if defined (OPENVG_DLL_EXPORTS)
# define VG_API_CALL __declspec(dllexport)
# else
# define VG_API_CALL __declspec(dllimport)
# endif
# else
# define VG_API_CALL extern
# endif /* defined(_WIN32) ||... */
#endif /* defined OPENVG_STATIC_LIBRARY */
#endif /* ifndef VG_API_CALL */
#ifndef VGU_API_CALL
#if defined(OPENVG_STATIC_LIBRARY)
# define VGU_API_CALL
#else
# if defined(_WIN32) || defined(__VC32__) /* Win32 */
# if defined (OPENVG_DLL_EXPORTS)
# define VGU_API_CALL __declspec(dllexport)
# else
# define VGU_API_CALL __declspec(dllimport)
# endif
# else
# define VGU_API_CALL extern
# endif /* defined(_WIN32) ||... */
#endif /* defined OPENVG_STATIC_LIBRARY */
#endif /* ifndef VGU_API_CALL */
#ifndef VG_API_ENTRY
#define VG_API_ENTRY
#endif
#ifndef VG_API_EXIT
#define VG_API_EXIT
#endif
#ifndef VGU_API_ENTRY
#define VGU_API_ENTRY
#endif
#ifndef VGU_API_EXIT
#define VGU_API_EXIT
#endif
typedef float VGfloat;
typedef signed char VGbyte;
typedef unsigned char VGubyte;
typedef signed short VGshort;
typedef signed int VGint;
typedef unsigned int VGuint;
typedef unsigned int VGbitfield;
#ifndef VG_VGEXT_PROTOTYPES
#define VG_VGEXT_PROTOTYPES
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _VGPLATFORM_H */

130
include/VG/vgu.h Normal file
View File

@@ -0,0 +1,130 @@
/* $Revision: 6810 $ on $Date:: 2008-10-29 10:31:37 -0400 #$ */
/*------------------------------------------------------------------------
*
* VGU 1.0.1 Reference Implementation
* -------------------------------------
*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and /or associated documentation files
* (the "Materials "), to deal in the Materials without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Materials,
* and to permit persons to whom the Materials are furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
* THE USE OR OTHER DEALINGS IN THE MATERIALS.
*
*//**
* \file
* \brief VGU 1.0.1 API.
*//*-------------------------------------------------------------------*/
#ifndef _VGU_H
#define _VGU_H
#ifdef __cplusplus
extern "C" {
#endif
#include <VG/openvg.h>
#define VGU_VERSION_1_0 1
#ifndef VGU_API_CALL
# error VGU_API_CALL must be defined
#endif
#ifndef VGU_API_ENTRY
# error VGU_API_ENTRY must be defined
#endif
#ifndef VGU_API_EXIT
# error VGU_API_EXIT must be defined
#endif
typedef enum {
VGU_NO_ERROR = 0,
VGU_BAD_HANDLE_ERROR = 0xF000,
VGU_ILLEGAL_ARGUMENT_ERROR = 0xF001,
VGU_OUT_OF_MEMORY_ERROR = 0xF002,
VGU_PATH_CAPABILITY_ERROR = 0xF003,
VGU_BAD_WARP_ERROR = 0xF004,
VGU_ERROR_CODE_FORCE_SIZE = VG_MAX_ENUM
} VGUErrorCode;
typedef enum {
VGU_ARC_OPEN = 0xF100,
VGU_ARC_CHORD = 0xF101,
VGU_ARC_PIE = 0xF102,
VGU_ARC_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGUArcType;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguLine(VGPath path,
VGfloat x0, VGfloat y0,
VGfloat x1, VGfloat y1) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguPolygon(VGPath path,
const VGfloat * points, VGint count,
VGboolean closed) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRect(VGPath path,
VGfloat x, VGfloat y,
VGfloat width, VGfloat height) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRoundRect(VGPath path,
VGfloat x, VGfloat y,
VGfloat width, VGfloat height,
VGfloat arcWidth, VGfloat arcHeight) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguEllipse(VGPath path,
VGfloat cx, VGfloat cy,
VGfloat width, VGfloat height) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguArc(VGPath path,
VGfloat x, VGfloat y,
VGfloat width, VGfloat height,
VGfloat startAngle, VGfloat angleExtent,
VGUArcType arcType) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToSquare(VGfloat sx0, VGfloat sy0,
VGfloat sx1, VGfloat sy1,
VGfloat sx2, VGfloat sy2,
VGfloat sx3, VGfloat sy3,
VGfloat * matrix) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpSquareToQuad(VGfloat dx0, VGfloat dy0,
VGfloat dx1, VGfloat dy1,
VGfloat dx2, VGfloat dy2,
VGfloat dx3, VGfloat dy3,
VGfloat * matrix) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToQuad(VGfloat dx0, VGfloat dy0,
VGfloat dx1, VGfloat dy1,
VGfloat dx2, VGfloat dy2,
VGfloat dx3, VGfloat dy3,
VGfloat sx0, VGfloat sy0,
VGfloat sx1, VGfloat sy1,
VGfloat sx2, VGfloat sy2,
VGfloat sx3, VGfloat sy3,
VGfloat * matrix) VGU_API_EXIT;
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* #ifndef _VGU_H */

View File

@@ -63,3 +63,4 @@ tunnel2
vao_demo
Windows
winpos
*.rgb

View File

@@ -26,6 +26,7 @@ static int Scissor = 0;
static float Xzoom, Yzoom;
static GLboolean DrawFront = GL_FALSE;
static GLboolean Dither = GL_TRUE;
static GLboolean Invert = GL_FALSE;
static void Reset( void )
@@ -59,6 +60,15 @@ static void Display( void )
if (Scissor)
glEnable(GL_SCISSOR_TEST);
if (Invert) {
glPixelTransferf(GL_RED_SCALE, -1.0);
glPixelTransferf(GL_GREEN_SCALE, -1.0);
glPixelTransferf(GL_BLUE_SCALE, -1.0);
glPixelTransferf(GL_RED_BIAS, 1.0);
glPixelTransferf(GL_GREEN_BIAS, 1.0);
glPixelTransferf(GL_BLUE_BIAS, 1.0);
}
/* draw copy */
glPixelZoom(Xzoom, Yzoom);
glWindowPos2iARB(Xpos, Ypos);
@@ -67,6 +77,15 @@ static void Display( void )
glDisable(GL_SCISSOR_TEST);
if (Invert) {
glPixelTransferf(GL_RED_SCALE, 1.0);
glPixelTransferf(GL_GREEN_SCALE, 1.0);
glPixelTransferf(GL_BLUE_SCALE, 1.0);
glPixelTransferf(GL_RED_BIAS, 0.0);
glPixelTransferf(GL_GREEN_BIAS, 0.0);
glPixelTransferf(GL_BLUE_BIAS, 0.0);
}
if (DrawFront)
glFinish();
else
@@ -105,6 +124,9 @@ static void Key( unsigned char key, int x, int y )
else
glDisable(GL_DITHER);
break;
case 'i':
Invert = !Invert;
break;
case 's':
Scissor = !Scissor;
break;

View File

@@ -43,6 +43,9 @@
#include "GL/glut.h"
#include "readtex.h"
#ifndef GL_TEXTURE_CUBE_MAP_SEAMLESS
#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
#endif
static GLfloat Xrot = 0, Yrot = 0;
static GLfloat EyeDist = 10;
@@ -52,6 +55,9 @@ static GLboolean NoClear = GL_FALSE;
static GLint FrameParity = 0;
static GLenum FilterIndex = 0;
static GLint ClampIndex = 0;
static GLboolean supportFBO = GL_FALSE;
static GLboolean supportSeamless = GL_FALSE;
static GLboolean seamless = GL_FALSE;
static struct {
@@ -90,7 +96,9 @@ static struct {
#define eps1 0.99
/* The effects of GL_ARB_seamless_cube_map don't show up unless eps1 is 1.0.
*/
#define eps1 1.0 /*0.99*/
#define br 20.0 /* box radius */
static const GLfloat tex_coords[] = {
@@ -230,6 +238,13 @@ static void draw( void )
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER,
FilterModes[FilterIndex].mag_mode);
if (supportSeamless) {
if (seamless) {
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
} else {
glDisable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
}
}
wrap = ClampModes[ClampIndex].mode;
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, wrap);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, wrap);
@@ -320,6 +335,11 @@ static void key(unsigned char k, int x, int y)
mode = !mode;
set_mode(mode);
break;
case 's':
seamless = ! seamless;
printf("Seamless cube map filtering is %sabled\n",
(seamless) ? "en" : "dis" );
break;
case 'v':
use_vertex_arrays = ! use_vertex_arrays;
printf( "Vertex arrays are %sabled\n",
@@ -403,6 +423,10 @@ static void init_checkers( void )
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if (!supportFBO)
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
/* make colored checkerboard cube faces */
for (f = 0; f < 6; f++) {
for (i = 0; i < CUBE_TEX_SIZE; i++) {
@@ -426,7 +450,8 @@ static void init_checkers( void )
GL_BGRA, GL_UNSIGNED_BYTE, image);
}
glGenerateMipmapEXT(GL_TEXTURE_CUBE_MAP_ARB);
if (supportFBO)
glGenerateMipmapEXT(GL_TEXTURE_CUBE_MAP_ARB);
}
@@ -496,20 +521,26 @@ static void load_envmaps(void)
static void init( GLboolean useImageFiles )
{
/* check for extensions */
{
char *exten = (char *) glGetString(GL_EXTENSIONS);
if (!strstr(exten, "GL_ARB_texture_cube_map")) {
printf("Sorry, this demo requires GL_ARB_texture_cube_map\n");
exit(0);
}
/* Needed for glGenerateMipmapEXT
*/
if (!strstr(exten, "GL_EXT_framebuffer_object")) {
printf("Sorry, this demo requires GL_EXT_framebuffer_object\n");
exit(0);
}
if (!GLEW_ARB_texture_cube_map) {
printf("Sorry, this demo requires GL_ARB_texture_cube_map\n");
exit(0);
}
/* Needed for glGenerateMipmapEXT / auto mipmapping
*/
supportFBO = GLEW_EXT_framebuffer_object;
if (!supportFBO && !GLEW_SGIS_generate_mipmap) {
printf("Sorry, this demo requires GL_EXT_framebuffer_object or "
"GL_SGIS_generate_mipmap\n");
exit(0);
}
/* GLEW doesn't know about this extension yet, so use the old GLUT function
* to check for availability.
*/
supportSeamless = glutExtensionSupported("GL_ARB_seamless_cube_map");
printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
if (useImageFiles) {

View File

@@ -498,7 +498,7 @@ SetupFunctionPointers(void)
* Make FBO to render into given texture.
*/
static GLuint
MakeFBO_RenderTexture(GLuint TexObj)
MakeFBO_RenderTexture(GLuint texObj)
{
GLuint fb;
GLint sizeFudge = 0;
@@ -507,7 +507,7 @@ MakeFBO_RenderTexture(GLuint TexObj)
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, fb);
/* Render color to texture */
glFramebufferTexture2D_func(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
TexTarget, TexObj, TextureLevel);
TexTarget, texObj, TextureLevel);
if (Use_ARB_fbo) {
/* use a smaller depth buffer to see what happens */
@@ -541,7 +541,7 @@ MakeFBO_RenderTexture(GLuint TexObj)
/* queries */
{
GLint bits, w, h;
GLint bits, w, h, name;
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, DepthRB);
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
@@ -559,8 +559,28 @@ MakeFBO_RenderTexture(GLuint TexObj)
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_STENCIL_SIZE_EXT, &bits);
printf("Stencil renderbuffer size = %d bits\n", bits);
}
glGetFramebufferAttachmentParameteriv_func(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0,
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
&name);
printf("Render to texture name: %d\n", texObj);
printf("Color attachment[0] name: %d\n", name);
assert(texObj == name);
glGetFramebufferAttachmentParameteriv_func(GL_FRAMEBUFFER_EXT,
GL_STENCIL_ATTACHMENT,
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
&name);
printf("Stencil attachment name: %d\n", name);
glGetFramebufferAttachmentParameteriv_func(GL_FRAMEBUFFER_EXT,
GL_DEPTH_ATTACHMENT,
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
&name);
printf("Depth attachment name: %d\n", name);
}
/* bind the regular framebuffer */
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, 0);

View File

@@ -847,8 +847,8 @@ static void Init(int argc, char *argv[])
glClearColor(0.0, 0.0, 1.0, 0.0);
glEnable( GL_DEPTH_TEST );
glEnable( GL_VERTEX_ARRAY_EXT );
glEnable( GL_NORMAL_ARRAY_EXT );
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_NORMAL_ARRAY );
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

View File

@@ -194,11 +194,11 @@ redraw(void)
{
int i;
glDepthMask(GL_TRUE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (newModel)
recalcModelView();
glDepthMask(GL_FALSE);
/* Draw the floor. */
/* glEnable(GL_TEXTURE_2D);*/
@@ -215,7 +215,7 @@ redraw(void)
glEnd();
/* Allow particles to blend with each other. */
glDepthMask(GL_TRUE);
glDepthMask(GL_FALSE);
if (blend)
glEnable(GL_BLEND);

View File

@@ -209,13 +209,13 @@ redraw(void)
{
int i;
glDepthMask(GL_TRUE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(15.0, 1.0, 0.0, 0.0);
glRotatef(angle, 0.0, 1.0, 0.0);
glDepthMask(GL_FALSE);
/* Draw the floor. */
/* glEnable(GL_TEXTURE_2D);*/
@@ -232,7 +232,7 @@ redraw(void)
glEnd();
/* Allow particles to blend with each other. */
glDepthMask(GL_TRUE);
glDepthMask(GL_FALSE);
if (blend)
glEnable(GL_BLEND);

View File

@@ -260,6 +260,8 @@ static void Key( unsigned char key, int x, int y )
(void) y;
switch (key) {
case 27:
(*delete_vertex_arrays)( 1, & cube_array_obj );
(*delete_vertex_arrays)( 1, & oct_array_obj );
glutDestroyWindow(Win);
exit(0);
break;

View File

@@ -6,5 +6,7 @@ eglinfo
eglscreen
egltri
peglgears
xeglbindtex
xeglgears
xeglthreads
xegl_tri

View File

@@ -7,6 +7,9 @@ include $(TOP)/configs/current
INCLUDE_DIRS = -I$(TOP)/include
HEADERS = $(TOP)/include/GLES/egl.h
LIB_DEP = $(TOP)/$(LIB_DIR)/libEGL.so
LIBS = -L$(TOP)/$(LIB_DIR) -lEGL -lGL
PROGRAMS = \
demo1 \
@@ -17,7 +20,9 @@ PROGRAMS = \
eglgears \
eglscreen \
peglgears \
xeglbindtex \
xeglgears \
xeglthreads \
xegl_tri
@@ -28,77 +33,42 @@ PROGRAMS = \
default: $(PROGRAMS)
demo1: demo1.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
demo1: demo1.o $(TOP)/$(LIB_DIR)/libEGL.so
$(CC) $(CFLAGS) $(LDFLAGS) demo1.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) -o $@
demo2: demo2.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
demo1.o: demo1.c $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include demo1.c
demo3: demo3.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
egltri: egltri.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
demo2: demo2.o $(TOP)/$(LIB_DIR)/libEGL.so
$(CC) $(CFLAGS) $(LDFLAGS) demo2.o -L$(TOP)/$(LIB_DIR) -lEGL -lGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
eglinfo: eglinfo.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
demo2.o: demo2.c $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include demo2.c
eglgears: eglgears.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
eglscreen: eglscreen.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
demo3: demo3.o $(TOP)/$(LIB_DIR)/libEGL.so
$(CC) $(CFLAGS) $(LDFLAGS) demo3.o -L$(TOP)/$(LIB_DIR) -lEGL -lGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
peglgears: peglgears.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
demo3.o: demo3.c $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include demo3.c
xeglbindtex: xeglbindtex.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11
xeglgears: xeglgears.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11
egltri: egltri.o $(TOP)/$(LIB_DIR)/libEGL.so
$(CC) $(CFLAGS) egltri.o -L$(TOP)/$(LIB_DIR) -lEGL -lGL $(LIBDRM_LIB) -o $@
egltri.o: egltri.c $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include egltri.c
eglinfo: eglinfo.o $(TOP)/$(LIB_DIR)/libEGL.so
$(CC) $(CFLAGS) $(LDFLAGS) eglinfo.o -L$(TOP)/$(LIB_DIR) -lEGL -lGL $(LIBDRM_LIB) -o $@
eglinfo.o: eglinfo.c $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include eglinfo.c
eglgears: eglgears.o $(TOP)/$(LIB_DIR)/libEGL.so
$(CC) $(CFLAGS) $(LDFLAGS) eglgears.o -L$(TOP)/$(LIB_DIR) -lEGL -lGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
eglgears.o: eglgears.c $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include eglgears.c
eglscreen: eglscreen.o $(TOP)/$(LIB_DIR)/libEGL.so
$(CC) $(CFLAGS) $(LDFLAGS) eglscreen.o -L$(TOP)/$(LIB_DIR) -lEGL -lGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
eglscreen.o: eglscreen.c $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include eglscreen.c
peglgears: peglgears.o $(TOP)/$(LIB_DIR)/libEGL.so
$(CC) $(CFLAGS) peglgears.o -L$(TOP)/$(LIB_DIR) -lEGL -lGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
peglgears.o: peglgears.c $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include peglgears.c
xeglgears: xeglgears.o $(TOP)/$(LIB_DIR)/libEGL.so
$(CC) $(CFLAGS) xeglgears.o -L$(TOP)/$(LIB_DIR) -lEGL -lGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
xeglgears.o: xeglgears.c $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include xeglgears.c
xegl_tri: xegl_tri.o $(TOP)/$(LIB_DIR)/libEGL.so
$(CC) $(CFLAGS) xegl_tri.o -L$(TOP)/$(LIB_DIR) -lEGL -lGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
xegl_tri.o: xegl_tri.c $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include xegl_tri.c
xeglthreads: xeglthreads.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11
xegl_tri: xegl_tri.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11
clean:
-rm -f *.o *~
-rm -f *.so
-rm -f $(PROGRAMS)

View File

@@ -551,7 +551,7 @@ write_ppm(const char *filename, const GLubyte *buffer, int width, int height)
}
}
#include "../src/egl/main/egldisplay.h"
#include "../../src/egl/main/egldisplay.h"
typedef struct fb_display
{

474
progs/egl/xeglbindtex.c Normal file
View File

@@ -0,0 +1,474 @@
/*
* Simple demo for eglBindTexImage. Based on xegl_tri.c by
*
* Copyright (C) 2008 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* The spec says that eglBindTexImage supports only OpenGL ES context, but this
* demo uses OpenGL context. Keep in mind that this is non-standard.
*/
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GL/gl.h>
#include <EGL/egl.h>
static EGLDisplay dpy;
static EGLContext ctx_win, ctx_pbuf;
static EGLSurface surf_win, surf_pbuf;
static GLuint tex_pbuf;
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
static GLboolean blend = GL_TRUE;
static GLuint color_flow;
static void
make_pbuffer(int width, int height)
{
static const EGLint config_attribs[] = {
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE,
EGL_NONE
};
EGLint pbuf_attribs[] = {
EGL_WIDTH, width,
EGL_HEIGHT, height,
EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB,
EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,
EGL_NONE
};
EGLConfig config;
EGLint num_configs;
if (!eglChooseConfig(dpy, config_attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config for pbuffer\n");
exit(1);
}
eglBindAPI(EGL_OPENGL_API);
ctx_pbuf = eglCreateContext(dpy, config, EGL_NO_CONTEXT, NULL );
surf_pbuf = eglCreatePbufferSurface(dpy, config, pbuf_attribs);
if (surf_pbuf == EGL_NO_SURFACE) {
printf("failed to allocate pbuffer\n");
exit(1);
}
glGenTextures(1, &tex_pbuf);
}
static void
use_pbuffer(void)
{
static int initialized;
eglMakeCurrent(dpy, surf_pbuf, surf_pbuf, ctx_pbuf);
if (!initialized) {
EGLint width, height;
GLfloat ar;
initialized = 1;
eglQuerySurface(dpy, surf_pbuf, EGL_WIDTH, &width);
eglQuerySurface(dpy, surf_pbuf, EGL_WIDTH, &height);
ar = (GLfloat) width / (GLfloat) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1, 1, 1.0, 10.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
/* y-inverted */
glScalef(1.0, -1.0, 1.0);
glTranslatef(0.0, 0.0, -5.0);
glClearColor(0.2, 0.2, 0.2, 0.0);
}
}
static void
make_window(Display *x_dpy, const char *name,
int x, int y, int width, int height,
Window *winRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 8,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLConfig config;
EGLint num_configs, vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig(dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
if (!eglGetConfigAttrib(dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
attr.override_redirect = 0;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENGL_API);
ctx_win = eglCreateContext(dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx_win) {
printf("Error: glXCreateContext failed\n");
exit(1);
}
surf_win = eglCreateWindowSurface(dpy, config, win, NULL);
XFree(visInfo);
*winRet = win;
}
static void
use_window(void)
{
static int initialized;
eglMakeCurrent(dpy, surf_win, surf_win, ctx_win);
if (!initialized) {
initialized = 1;
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tex_pbuf);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
}
static void
draw_triangle(void)
{
static const GLfloat verts[3][2] = {
{ -3, -3 },
{ 3, -3 },
{ 0, 3 }
};
GLfloat colors[3][3] = {
{ 1, 0, 0 },
{ 0, 1, 0 },
{ 0, 0, 1 }
};
GLint i;
/* flow the color */
for (i = 0; i < 3; i++) {
GLint first = (i + color_flow / 256) % 3;
GLint second = (first + 1) % 3;
GLint third = (second + 1) % 3;
GLfloat c = (color_flow % 256) / 256.0f;
c = c * c * c;
colors[i][first] = 1.0f - c;
colors[i][second] = c;
colors[i][third] = 0.0f;
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glVertexPointer(2, GL_FLOAT, 0, verts);
glColorPointer(3, GL_FLOAT, 0, colors);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
static void
draw_textured_cube(void)
{
static const GLfloat verts[][2] = {
{ -4, -4 },
{ 4, -4 },
{ 4, 4 },
{ -4, 4 }
};
static const GLfloat colors[][4] = {
{ 1, 1, 1, 0.5 },
{ 1, 1, 1, 0.5 },
{ 1, 1, 1, 0.5 },
{ 1, 1, 1, 0.5 }
};
static const GLfloat texs[][2] = {
{ 0, 0 },
{ 1, 0 },
{ 1, 1 },
{ 0, 1 }
};
static const GLfloat xforms[6][4] = {
{ 0, 0, 1, 0 },
{ 90, 0, 1, 0 },
{ 180, 0, 1, 0 },
{ 270, 0, 1, 0 },
{ 90, 1, 0, 0 },
{ -90, 1, 0, 0 }
};
GLint i;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (blend) {
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
} else {
glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
}
glVertexPointer(2, GL_FLOAT, 0, verts);
glColorPointer(4, GL_FLOAT, 0, colors);
glTexCoordPointer(2, GL_FLOAT, 0, texs);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
for (i = 0; i < 6; i++) {
glPushMatrix();
glRotatef(xforms[i][0], xforms[i][1], xforms[i][2], xforms[i][3]);
glTranslatef(0, 0, 4.1);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glPopMatrix();
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
static void
draw(void)
{
use_pbuffer();
draw_triangle();
use_window();
eglBindTexImage(dpy, surf_pbuf, EGL_BACK_BUFFER);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_roty, 0, 1, 0);
glRotatef(view_rotz, 0, 0, 1);
draw_textured_cube();
glPopMatrix();
eglReleaseTexImage(dpy, surf_pbuf, EGL_BACK_BUFFER);
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ar = (GLfloat) width / (GLfloat) height;
use_window();
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
}
static void
event_loop(Display *x_dpy, Window win)
{
while (1) {
int redraw = 1;
if (XPending(x_dpy) > 0) {
XEvent event;
XNextEvent(x_dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else if (code == XK_b) {
blend = !blend;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
}
if (redraw) {
view_rotx += 1.0;
view_roty += 2.0;
view_rotz += 1.5;
color_flow += 20;
draw();
eglSwapBuffers(dpy, surf_win);
}
}
}
int
main(int argc, char *argv[])
{
const int winWidth = 300, winHeight = 300;
Display *x_dpy;
Window win;
char *dpyName = NULL;
EGLint egl_major, egl_minor;
const char *s;
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
dpy = eglGetDisplay(x_dpy);
if (!dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
make_window(x_dpy, "color flow", 0, 0, winWidth, winHeight, &win);
make_pbuffer(winWidth, winHeight);
XMapWindow(x_dpy, win);
reshape(winWidth, winHeight);
event_loop(x_dpy, win);
glDeleteTextures(1, &tex_pbuf);
eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglTerminate(dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

773
progs/egl/xeglthreads.c Normal file
View File

@@ -0,0 +1,773 @@
/*
* Copyright (C) 2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Ported to EGL by Chia-I Wu <olvaffe@gmail.com>
*/
/*
* This program tests EGL thread safety.
* Command line options:
* -p Open a display connection for each thread
* -l Enable application-side locking
* -n <num threads> Number of threads to create (default is 2)
* -display <display name> Specify X display (default is $DISPLAY)
* -t Use texture mapping
*
* Brian Paul 20 July 2000
*/
/*
* Notes:
* - Each thread gets its own EGL context.
*
* - The EGL contexts share texture objects.
*
* - When 't' is pressed to update the texture image, the window/thread which
* has input focus is signalled to change the texture. The other threads
* should see the updated texture the next time they call glBindTexture.
*/
#if defined(PTHREADS) /* defined by Mesa on Linux and other platforms */
#include <assert.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <GL/gl.h>
#include <EGL/egl.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
/*
* Each window/thread/context:
*/
struct winthread {
Display *Dpy;
int Index;
pthread_t Thread;
Window Win;
EGLDisplay Display;
EGLContext Context;
EGLSurface Surface;
float Angle;
int WinWidth, WinHeight;
GLboolean NewSize;
GLboolean Initialized;
GLboolean MakeNewTexture;
};
#define MAX_WINTHREADS 100
static struct winthread WinThreads[MAX_WINTHREADS];
static int NumWinThreads = 0;
static volatile GLboolean ExitFlag = GL_FALSE;
static GLboolean MultiDisplays = 0;
static GLboolean Locking = 0;
static GLboolean Texture = GL_FALSE;
static GLuint TexObj = 12;
static GLboolean Animate = GL_TRUE;
static pthread_mutex_t Mutex;
static pthread_cond_t CondVar;
static pthread_mutex_t CondMutex;
static void
Error(const char *msg)
{
fprintf(stderr, "Error: %s\n", msg);
exit(1);
}
static void
signal_redraw(void)
{
pthread_mutex_lock(&CondMutex);
pthread_cond_broadcast(&CondVar);
pthread_mutex_unlock(&CondMutex);
}
static void
MakeNewTexture(struct winthread *wt)
{
#define TEX_SIZE 128
static float step = 0.0;
GLfloat image[TEX_SIZE][TEX_SIZE][4];
GLint width;
int i, j;
for (j = 0; j < TEX_SIZE; j++) {
for (i = 0; i < TEX_SIZE; i++) {
float dt = 5.0 * (j - 0.5 * TEX_SIZE) / TEX_SIZE;
float ds = 5.0 * (i - 0.5 * TEX_SIZE) / TEX_SIZE;
float r = dt * dt + ds * ds + step;
image[j][i][0] =
image[j][i][1] =
image[j][i][2] = 0.75 + 0.25 * cos(r);
image[j][i][3] = 1.0;
}
}
step += 0.5;
glBindTexture(GL_TEXTURE_2D, TexObj);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width);
if (width) {
assert(width == TEX_SIZE);
/* sub-tex replace */
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TEX_SIZE, TEX_SIZE,
GL_RGBA, GL_FLOAT, image);
}
else {
/* create new */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TEX_SIZE, TEX_SIZE, 0,
GL_RGBA, GL_FLOAT, image);
}
}
/* draw a colored cube */
static void
draw_object(void)
{
glPushMatrix();
glScalef(0.75, 0.75, 0.75);
glColor3f(1, 0, 0);
if (Texture) {
glBindTexture(GL_TEXTURE_2D, TexObj);
glEnable(GL_TEXTURE_2D);
}
else {
glDisable(GL_TEXTURE_2D);
}
glBegin(GL_QUADS);
/* -X */
glColor3f(0, 1, 1);
glTexCoord2f(0, 0); glVertex3f(-1, -1, -1);
glTexCoord2f(1, 0); glVertex3f(-1, 1, -1);
glTexCoord2f(1, 1); glVertex3f(-1, 1, 1);
glTexCoord2f(0, 1); glVertex3f(-1, -1, 1);
/* +X */
glColor3f(1, 0, 0);
glTexCoord2f(0, 0); glVertex3f(1, -1, -1);
glTexCoord2f(1, 0); glVertex3f(1, 1, -1);
glTexCoord2f(1, 1); glVertex3f(1, 1, 1);
glTexCoord2f(0, 1); glVertex3f(1, -1, 1);
/* -Y */
glColor3f(1, 0, 1);
glTexCoord2f(0, 0); glVertex3f(-1, -1, -1);
glTexCoord2f(1, 0); glVertex3f( 1, -1, -1);
glTexCoord2f(1, 1); glVertex3f( 1, -1, 1);
glTexCoord2f(0, 1); glVertex3f(-1, -1, 1);
/* +Y */
glColor3f(0, 1, 0);
glTexCoord2f(0, 0); glVertex3f(-1, 1, -1);
glTexCoord2f(1, 0); glVertex3f( 1, 1, -1);
glTexCoord2f(1, 1); glVertex3f( 1, 1, 1);
glTexCoord2f(0, 1); glVertex3f(-1, 1, 1);
/* -Z */
glColor3f(1, 1, 0);
glTexCoord2f(0, 0); glVertex3f(-1, -1, -1);
glTexCoord2f(1, 0); glVertex3f( 1, -1, -1);
glTexCoord2f(1, 1); glVertex3f( 1, 1, -1);
glTexCoord2f(0, 1); glVertex3f(-1, 1, -1);
/* +Y */
glColor3f(0, 0, 1);
glTexCoord2f(0, 0); glVertex3f(-1, -1, 1);
glTexCoord2f(1, 0); glVertex3f( 1, -1, 1);
glTexCoord2f(1, 1); glVertex3f( 1, 1, 1);
glTexCoord2f(0, 1); glVertex3f(-1, 1, 1);
glEnd();
glPopMatrix();
}
/* signal resize of given window */
static void
resize(struct winthread *wt, int w, int h)
{
wt->NewSize = GL_TRUE;
wt->WinWidth = w;
wt->WinHeight = h;
if (!Animate)
signal_redraw();
}
/*
* We have an instance of this for each thread.
*/
static void
draw_loop(struct winthread *wt)
{
while (!ExitFlag) {
if (Locking)
pthread_mutex_lock(&Mutex);
if (!wt->Initialized) {
eglMakeCurrent(wt->Display, wt->Surface, wt->Surface, wt->Context);
printf("xeglthreads: %d: GL_RENDERER = %s\n", wt->Index,
(char *) glGetString(GL_RENDERER));
if (Texture /*&& wt->Index == 0*/) {
MakeNewTexture(wt);
}
wt->Initialized = GL_TRUE;
}
if (Locking)
pthread_mutex_unlock(&Mutex);
eglBindAPI(EGL_OPENGL_API);
if (eglGetCurrentContext() != wt->Context) {
printf("xeglthreads: current context %p != %p\n",
eglGetCurrentContext(), wt->Context);
}
glEnable(GL_DEPTH_TEST);
if (wt->NewSize) {
GLfloat w = (float) wt->WinWidth / (float) wt->WinHeight;
glViewport(0, 0, wt->WinWidth, wt->WinHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-w, w, -1.0, 1.0, 1.5, 10);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0, 0, -2.5);
wt->NewSize = GL_FALSE;
}
if (wt->MakeNewTexture) {
MakeNewTexture(wt);
wt->MakeNewTexture = GL_FALSE;
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(wt->Angle, 0, 1, 0);
glRotatef(wt->Angle, 1, 0, 0);
glScalef(0.7, 0.7, 0.7);
draw_object();
glPopMatrix();
if (Locking)
pthread_mutex_lock(&Mutex);
eglSwapBuffers(wt->Display, wt->Surface);
if (Locking)
pthread_mutex_unlock(&Mutex);
if (Animate) {
usleep(5000);
}
else {
/* wait for signal to draw */
pthread_mutex_lock(&CondMutex);
pthread_cond_wait(&CondVar, &CondMutex);
pthread_mutex_unlock(&CondMutex);
}
wt->Angle += 1.0;
}
eglMakeCurrent(wt->Display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
}
static void
keypress(XEvent *event, struct winthread *wt)
{
char buf[100];
KeySym keySym;
XComposeStatus stat;
XLookupString(&event->xkey, buf, sizeof(buf), &keySym, &stat);
switch (keySym) {
case XK_Escape:
/* tell all threads to exit */
if (!Animate) {
signal_redraw();
}
ExitFlag = GL_TRUE;
/*printf("exit draw_loop %d\n", wt->Index);*/
return;
case XK_t:
case XK_T:
if (Texture) {
wt->MakeNewTexture = GL_TRUE;
if (!Animate)
signal_redraw();
}
break;
case XK_a:
case XK_A:
Animate = !Animate;
if (Animate) /* yes, prev Animate state! */
signal_redraw();
break;
case XK_s:
case XK_S:
if (!Animate)
signal_redraw();
break;
default:
; /* nop */
}
}
/*
* The main process thread runs this loop.
* Single display connection for all threads.
*/
static void
event_loop(Display *dpy)
{
XEvent event;
int i;
assert(!MultiDisplays);
while (!ExitFlag) {
if (Locking) {
while (1) {
int k;
pthread_mutex_lock(&Mutex);
k = XPending(dpy);
if (k) {
XNextEvent(dpy, &event);
pthread_mutex_unlock(&Mutex);
break;
}
pthread_mutex_unlock(&Mutex);
usleep(5000);
}
}
else {
XNextEvent(dpy, &event);
}
switch (event.type) {
case ConfigureNotify:
/* Find winthread for this event's window */
for (i = 0; i < NumWinThreads; i++) {
struct winthread *wt = &WinThreads[i];
if (event.xconfigure.window == wt->Win) {
resize(wt, event.xconfigure.width,
event.xconfigure.height);
break;
}
}
break;
case KeyPress:
for (i = 0; i < NumWinThreads; i++) {
struct winthread *wt = &WinThreads[i];
if (event.xkey.window == wt->Win) {
keypress(&event, wt);
break;
}
}
break;
default:
/*no-op*/ ;
}
}
}
/*
* Separate display connection for each thread.
*/
static void
event_loop_multi(void)
{
XEvent event;
int w = 0;
assert(MultiDisplays);
while (!ExitFlag) {
struct winthread *wt = &WinThreads[w];
if (XPending(wt->Dpy)) {
XNextEvent(wt->Dpy, &event);
switch (event.type) {
case ConfigureNotify:
resize(wt, event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
keypress(&event, wt);
break;
default:
; /* nop */
}
}
w = (w + 1) % NumWinThreads;
usleep(5000);
}
}
/*
* we'll call this once for each thread, before the threads are created.
*/
static void
create_window(struct winthread *wt, EGLContext shareCtx)
{
Window win;
EGLContext ctx;
EGLSurface surf;
EGLint attribs[] = { EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE };
EGLConfig config;
EGLint num_configs;
EGLint vid;
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
XVisualInfo *visinfo, visTemplate;
int num_visuals;
int width = 160, height = 160;
int xpos = (wt->Index % 8) * (width + 10);
int ypos = (wt->Index / 8) * (width + 20);
scrnum = DefaultScreen(wt->Dpy);
root = RootWindow(wt->Dpy, scrnum);
if (!eglChooseConfig(wt->Display, attribs, &config, 1, &num_configs)) {
Error("Unable to choose an EGL config");
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(wt->Display, config, EGL_NATIVE_VISUAL_ID, &vid)) {
Error("Unable to get visual id of EGL config\n");
}
visTemplate.visualid = vid;
visinfo = XGetVisualInfo(wt->Dpy, VisualIDMask,
&visTemplate, &num_visuals);
if (!visinfo) {
Error("Unable to find RGB, Z, double-buffered visual");
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap(wt->Dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow(wt->Dpy, root, xpos, ypos, width, height,
0, visinfo->depth, InputOutput,
visinfo->visual, mask, &attr);
if (!win) {
Error("Couldn't create window");
}
XFree(visinfo);
{
XSizeHints sizehints;
sizehints.x = xpos;
sizehints.y = ypos;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(wt->Dpy, win, &sizehints);
XSetStandardProperties(wt->Dpy, win, "xeglthreads", "xeglthreads",
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENGL_API);
ctx = eglCreateContext(wt->Display, config, shareCtx, NULL);
if (!ctx) {
Error("Couldn't create EGL context");
}
surf = eglCreateWindowSurface(wt->Display, config, win, NULL);
if (!surf) {
Error("Couldn't create EGL surface");
}
XMapWindow(wt->Dpy, win);
XSync(wt->Dpy, 0);
/* save the info for this window/context */
wt->Win = win;
wt->Context = ctx;
wt->Surface = surf;
wt->Angle = 0.0;
wt->WinWidth = width;
wt->WinHeight = height;
wt->NewSize = GL_TRUE;
}
/*
* Called by pthread_create()
*/
static void *
thread_function(void *p)
{
struct winthread *wt = (struct winthread *) p;
draw_loop(wt);
return NULL;
}
/*
* called before exit to wait for all threads to finish
*/
static void
clean_up(void)
{
int i;
/* wait for threads to finish */
for (i = 0; i < NumWinThreads; i++) {
pthread_join(WinThreads[i].Thread, NULL);
}
for (i = 0; i < NumWinThreads; i++) {
eglDestroyContext(WinThreads[i].Display, WinThreads[i].Context);
XDestroyWindow(WinThreads[i].Dpy, WinThreads[i].Win);
}
}
static void
usage(void)
{
printf("xeglthreads: test of EGL/GL thread safety (any key = exit)\n");
printf("Usage:\n");
printf(" xeglthreads [options]\n");
printf("Options:\n");
printf(" -display DISPLAYNAME Specify display string\n");
printf(" -n NUMTHREADS Number of threads to create\n");
printf(" -p Use a separate display connection for each thread\n");
printf(" -l Use application-side locking\n");
printf(" -t Enable texturing\n");
printf("Keyboard:\n");
printf(" Esc Exit\n");
printf(" t Change texture image (requires -t option)\n");
printf(" a Toggle animation\n");
printf(" s Step rotation (when not animating)\n");
}
int
main(int argc, char *argv[])
{
char *displayName = NULL;
int numThreads = 2;
Display *dpy = NULL;
EGLDisplay *egl_dpy = NULL;
int i;
Status threadStat;
if (argc == 1) {
usage();
}
else {
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0 && i + 1 < argc) {
displayName = argv[i + 1];
i++;
}
else if (strcmp(argv[i], "-p") == 0) {
MultiDisplays = 1;
}
else if (strcmp(argv[i], "-l") == 0) {
Locking = 1;
}
else if (strcmp(argv[i], "-t") == 0) {
Texture = 1;
}
else if (strcmp(argv[i], "-n") == 0 && i + 1 < argc) {
numThreads = atoi(argv[i + 1]);
if (numThreads < 1)
numThreads = 1;
else if (numThreads > MAX_WINTHREADS)
numThreads = MAX_WINTHREADS;
i++;
}
else {
usage();
exit(1);
}
}
}
if (Locking)
printf("xeglthreads: Using explicit locks around Xlib calls.\n");
else
printf("xeglthreads: No explict locking.\n");
if (MultiDisplays)
printf("xeglthreads: Per-thread display connections.\n");
else
printf("xeglthreads: Single display connection.\n");
/*
* VERY IMPORTANT: call XInitThreads() before any other Xlib functions.
*/
if (!MultiDisplays) {
if (!Locking) {
threadStat = XInitThreads();
if (threadStat) {
printf("XInitThreads() returned %d (success)\n",
(int) threadStat);
}
else {
printf("XInitThreads() returned 0 "
"(failure- this program may fail)\n");
}
}
dpy = XOpenDisplay(displayName);
if (!dpy) {
fprintf(stderr, "Unable to open display %s\n",
XDisplayName(displayName));
return -1;
}
egl_dpy = eglGetDisplay(dpy);
if (!egl_dpy) {
fprintf(stderr, "Unable to get EGL display\n");
XCloseDisplay(dpy);
return -1;
}
if (!eglInitialize(egl_dpy, NULL, NULL)) {
fprintf(stderr, "Unable to initialize EGL display\n");
return -1;
}
}
pthread_mutex_init(&Mutex, NULL);
pthread_mutex_init(&CondMutex, NULL);
pthread_cond_init(&CondVar, NULL);
printf("xeglthreads: creating windows\n");
NumWinThreads = numThreads;
/* Create the EGL windows and contexts */
for (i = 0; i < numThreads; i++) {
EGLContext share;
if (MultiDisplays) {
WinThreads[i].Dpy = XOpenDisplay(displayName);
assert(WinThreads[i].Dpy);
WinThreads[i].Display = eglGetDisplay(WinThreads[i].Dpy);
assert(eglInitialize(WinThreads[i].Display, NULL, NULL));
}
else {
WinThreads[i].Dpy = dpy;
WinThreads[i].Display = egl_dpy;
}
WinThreads[i].Index = i;
WinThreads[i].Initialized = GL_FALSE;
share = (Texture && i > 0) ? WinThreads[0].Context : 0;
create_window(&WinThreads[i], share);
}
printf("xeglthreads: creating threads\n");
/* Create the threads */
for (i = 0; i < numThreads; i++) {
pthread_create(&WinThreads[i].Thread, NULL, thread_function,
(void*) &WinThreads[i]);
printf("xeglthreads: Created thread %p\n",
(void *) WinThreads[i].Thread);
}
if (MultiDisplays)
event_loop_multi();
else
event_loop(dpy);
clean_up();
if (MultiDisplays) {
for (i = 0; i < numThreads; i++) {
eglTerminate(WinThreads[i].Display);
XCloseDisplay(WinThreads[i].Dpy);
}
}
else {
eglTerminate(egl_dpy);
XCloseDisplay(dpy);
}
return 0;
}
#else /* PTHREADS */
#include <stdio.h>
int
main(int argc, char *argv[])
{
printf("Sorry, this program wasn't compiled with PTHREADS defined.\n");
return 0;
}
#endif /* PTHREADS */

77
progs/es1/xegl/Makefile Normal file
View File

@@ -0,0 +1,77 @@
# progs/es1/xegl/Makefile
TOP = ../../..
include $(TOP)/configs/current
INCLUDE_DIRS = \
-I$(TOP)/include \
HEADERS = $(TOP)/include/GLES/egl.h
ES1_LIB_DEPS = \
$(TOP)/$(LIB_DIR)/libEGL.so \
$(TOP)/$(LIB_DIR)/libGLESv1_CM.so
ES1_LIBS = \
-L$(TOP)/$(LIB_DIR) -lEGL \
-L$(TOP)/$(LIB_DIR) -lGLESv1_CM $(LIBDRM_LIB) -lX11
PROGRAMS = \
drawtex \
es1_info \
msaa \
pbuffer \
render_tex \
torus \
tri \
two_win
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
default: $(PROGRAMS)
drawtex: drawtex.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) drawtex.o $(ES1_LIBS) -o $@
es1_info: es1_info.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) es1_info.o $(ES1_LIBS) -o $@
msaa: msaa.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) msaa.o $(ES1_LIBS) -o $@
pbuffer: pbuffer.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) pbuffer.o $(ES1_LIBS) -o $@
render_tex: render_tex.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) render_tex.o $(ES1_LIBS) -o $@
torus: torus.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) torus.o $(ES1_LIBS) -o $@
two_win: two_win.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) two_win.o $(ES1_LIBS) -o $@
tri: tri.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) tri.o $(ES1_LIBS) -o $@
clean:
rm -f *.o *~
rm -f $(PROGRAMS)

427
progs/es1/xegl/drawtex.c Normal file
View File

@@ -0,0 +1,427 @@
/*
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
*/
/*
* Test GL_OES_draw_texture
* Brian Paul
* August 2008
*/
#define GL_GLEXT_PROTOTYPES
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <EGL/egl.h>
static GLfloat view_posx = 10.0, view_posy = 20.0;
static GLfloat width = 200, height = 200;
static void
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glDrawTexfOES(view_posx, view_posy, 0.0, width, height);
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ar = (GLfloat) width / (GLfloat) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef GL_VERSION_ES_CM_1_0
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
#else
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
#endif
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -15.0);
}
static float
dist(GLuint i, GLuint j, float x, float y)
{
return sqrt((i-x) * (i-x) + (j-y) * (j-y));
}
static void
make_smile_texture(void)
{
#define SZ 128
GLenum Filter = GL_LINEAR;
GLubyte image[SZ][SZ][4];
GLuint i, j;
GLint cropRect[4];
for (i = 0; i < SZ; i++) {
for (j = 0; j < SZ; j++) {
GLfloat d_mouth = dist(i, j, SZ/2, SZ/2);
GLfloat d_rt_eye = dist(i, j, SZ*3/4, SZ*3/4);
GLfloat d_lt_eye = dist(i, j, SZ*3/4, SZ*1/4);
if (d_rt_eye < SZ / 8 || d_lt_eye < SZ / 8) {
image[i][j][0] = 20;
image[i][j][1] = 50;
image[i][j][2] = 255;
image[i][j][3] = 255;
}
else if (i < SZ/2 && d_mouth < SZ/3) {
image[i][j][0] = 255;
image[i][j][1] = 20;
image[i][j][2] = 20;
image[i][j][3] = 255;
}
else {
image[i][j][0] = 200;
image[i][j][1] = 200;
image[i][j][2] = 200;
image[i][j][3] = 255;
}
}
}
glActiveTexture(GL_TEXTURE0); /* unit 0 */
glBindTexture(GL_TEXTURE_2D, 42);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SZ, SZ, 0,
GL_RGBA, GL_UNSIGNED_BYTE, image);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
cropRect[0] = 0;
cropRect[1] = 0;
cropRect[2] = SZ;
cropRect[3] = SZ;
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect);
#undef SZ
}
static void
init(void)
{
const char *ext = (char *) glGetString(GL_EXTENSIONS);
if (!strstr(ext, "GL_OES_draw_texture")) {
fprintf(stderr, "Sorry, this program requires GL_OES_draw_texture");
exit(1);
}
glClearColor(0.4, 0.4, 0.4, 0.0);
make_smile_texture();
glEnable(GL_TEXTURE_2D);
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENGL_ES_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
int anim = 0;
while (1) {
int redraw = 0;
if (!anim || XPending(dpy)) {
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_posx -= 1.0;
}
else if (code == XK_Right) {
view_posx += 1.0;
}
else if (code == XK_Up) {
view_posy += 1.0;
}
else if (code == XK_Down) {
view_posy -= 1.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == ' ') {
anim = !anim;
}
else if (buffer[0] == 'w') {
width -= 1.0f;
}
else if (buffer[0] == 'W') {
width += 1.0f;
}
else if (buffer[0] == 'h') {
height -= 1.0f;
}
else if (buffer[0] == 'H') {
height += 1.0f;
}
else if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
}
if (anim) {
view_posx += 1.0;
view_posy += 2.0;
redraw = 1;
}
if (redraw) {
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 400, winHeight = 300;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"drawtex", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

274
progs/es1/xegl/es1_info.c Normal file
View File

@@ -0,0 +1,274 @@
/*
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
*/
/*
* List OpenGL ES extensions.
* Print ES 1 or ES 2 extensions depending on which library we're
* linked with: libGLESv1_CM.so vs libGLESv2.so
*/
#define GL_GLEXT_PROTOTYPES
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <EGL/egl.h>
/*
* Print a list of extensions, with word-wrapping.
*/
static void
print_extension_list(const char *ext)
{
const char *indentString = " ";
const int indent = 4;
const int max = 79;
int width, i, j;
if (!ext || !ext[0])
return;
width = indent;
printf(indentString);
i = j = 0;
while (1) {
if (ext[j] == ' ' || ext[j] == 0) {
/* found end of an extension name */
const int len = j - i;
if (width + len > max) {
/* start a new line */
printf("\n");
width = indent;
printf(indentString);
}
/* print the extension name between ext[i] and ext[j] */
while (i < j) {
printf("%c", ext[i]);
i++;
}
/* either we're all done, or we'll continue with next extension */
width += len + 1;
if (ext[j] == 0) {
break;
}
else {
i++;
j++;
if (ext[j] == 0)
break;
printf(", ");
width += 2;
}
}
j++;
}
printf("\n");
}
static void
info(EGLDisplay egl_dpy)
{
const char *s;
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION));
printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_EXTENSIONS:\n");
print_extension_list((char *) glGetString(GL_EXTENSIONS));
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENGL_ES_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 400, winHeight = 300;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
EGLint egl_major, egl_minor;
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
make_x_window(x_dpy, egl_dpy,
"ES info", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
/*XMapWindow(x_dpy, win);*/
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
info(egl_dpy);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

442
progs/es1/xegl/msaa.c Normal file
View File

@@ -0,0 +1,442 @@
/*
* Copyright (C) 2008 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Test MSAA with X/EGL and OpenGL ES 1.x
* Brian Paul
* 15 September 2008
*/
#define USE_FULL_GL 0
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#if USE_FULL_GL
#include <GL/gl.h> /* use full OpenGL */
#else
#include <GLES/gl.h> /* use OpenGL ES 1.x */
#include <GLES/glext.h>
#endif
#include <EGL/egl.h>
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
static GLboolean AA = 0*GL_TRUE;
static void
draw(void)
{
float a;
static const GLfloat verts[4][2] = {
{ -1, -.1 },
{ 1, -.1 },
{ -1, .1 },
{ 1, .1 }
};
static const GLfloat colors[4][4] = {
{ 1, 0, 0, 1 },
{ 0, 1, 0, 1 },
{ 0, 0, 1, 1 },
{ 1, 0, 1, 1 }
};
if (AA) {
printf("MSAA enabled\n");
glEnable(GL_MULTISAMPLE);
}
else {
printf("MSAA disabled\n");
glDisable(GL_MULTISAMPLE);
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_roty, 0, 1, 0);
glRotatef(view_rotz, 0, 0, 1);
{
glVertexPointer(2, GL_FLOAT, 0, verts);
glColorPointer(4, GL_FLOAT, 0, colors);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
for (a = 0; a < 360; a += 20.0) {
glPushMatrix();
glRotatef(a, 0, 0, 1);
glTranslatef(1.5, 0, 0);
/* draw triangle */
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glPopMatrix();
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
glPopMatrix();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ary = 3.0;
GLfloat arx = ary * (GLfloat) width / (GLfloat) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef GL_VERSION_ES_CM_1_0
glOrthof(-arx, arx, -ary, ary, -1.0, 1.0);
#else
glOrtho(-arx, arx, -ary, ary, -1.0, 1.0);
#endif
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static void
init(void)
{
printf("Press 'a' to toggle multisample antialiasing\n");
printf("Press 'Esc' to exit\n");
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_SAMPLES, 1,
EGL_SAMPLE_BUFFERS, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
if (num_configs < 1) {
printf("Error: Unable to find multisample pixel format.\n");
printf("Try running glxinfo to see if your server supports MSAA.\n");
exit(1);
}
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
#if USE_FULL_GL
eglBindAPI(EGL_OPENGL_API);
#else
eglBindAPI(EGL_OPENGL_ES_API);
#endif
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
while (1) {
int redraw = 0;
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 'a') {
AA = !AA;
redraw = 1;
}
else if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
if (redraw) {
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 600, winHeight = 600;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
static struct {
char *name;
GLenum value;
enum {GetString, GetInteger} type;
} info_items[] = {
{"GL_RENDERER", GL_RENDERER, GetString},
{"GL_VERSION", GL_VERSION, GetString},
{"GL_VENDOR", GL_VENDOR, GetString},
{"GL_EXTENSIONS", GL_EXTENSIONS, GetString},
{"GL_MAX_PALETTE_MATRICES_OES", GL_MAX_PALETTE_MATRICES_OES, GetInteger},
{"GL_MAX_VERTEX_UNITS_OES", GL_MAX_VERTEX_UNITS_OES, GetInteger},
};
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"msaa", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
for (i = 0; i < sizeof(info_items)/sizeof(info_items[0]); i++) {
switch (info_items[i].type) {
case GetString:
printf("%s = %s\n", info_items[i].name, (char *)glGetString(info_items[i].value));
break;
case GetInteger: {
GLint rv = -1;
glGetIntegerv(info_items[i].value, &rv);
printf("%s = %d\n", info_items[i].name, rv);
break;
}
}
}
};
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

607
progs/es1/xegl/pbuffer.c Normal file
View File

@@ -0,0 +1,607 @@
/*
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
*/
/*
* Test EGL Pbuffers
* Brian Paul
* August 2008
*/
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <EGL/egl.h>
static int WinWidth = 300, WinHeight = 300;
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
static void
Normal(GLfloat *n, GLfloat nx, GLfloat ny, GLfloat nz)
{
n[0] = nx;
n[1] = ny;
n[2] = nz;
}
static void
Vertex(GLfloat *v, GLfloat vx, GLfloat vy, GLfloat vz)
{
v[0] = vx;
v[1] = vy;
v[2] = vz;
}
static void
Texcoord(GLfloat *v, GLfloat s, GLfloat t)
{
v[0] = s;
v[1] = t;
}
/* Borrowed from glut, adapted */
static void
draw_torus(GLfloat r, GLfloat R, GLint nsides, GLint rings)
{
int i, j;
GLfloat theta, phi, theta1;
GLfloat cosTheta, sinTheta;
GLfloat cosTheta1, sinTheta1;
GLfloat ringDelta, sideDelta;
GLfloat varray[100][3], narray[100][3], tarray[100][2];
int vcount;
glVertexPointer(3, GL_FLOAT, 0, varray);
glNormalPointer(GL_FLOAT, 0, narray);
glTexCoordPointer(2, GL_FLOAT, 0, tarray);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
ringDelta = 2.0 * M_PI / rings;
sideDelta = 2.0 * M_PI / nsides;
theta = 0.0;
cosTheta = 1.0;
sinTheta = 0.0;
for (i = rings - 1; i >= 0; i--) {
theta1 = theta + ringDelta;
cosTheta1 = cos(theta1);
sinTheta1 = sin(theta1);
vcount = 0; /* glBegin(GL_QUAD_STRIP); */
phi = 0.0;
for (j = nsides; j >= 0; j--) {
GLfloat s0, s1, t;
GLfloat cosPhi, sinPhi, dist;
phi += sideDelta;
cosPhi = cos(phi);
sinPhi = sin(phi);
dist = R + r * cosPhi;
s0 = 20.0 * theta / (2.0 * M_PI);
s1 = 20.0 * theta1 / (2.0 * M_PI);
t = 8.0 * phi / (2.0 * M_PI);
Normal(narray[vcount], cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
Texcoord(tarray[vcount], s1, t);
Vertex(varray[vcount], cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
vcount++;
Normal(narray[vcount], cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
Texcoord(tarray[vcount], s0, t);
Vertex(varray[vcount], cosTheta * dist, -sinTheta * dist, r * sinPhi);
vcount++;
}
/*glEnd();*/
assert(vcount <= 100);
glDrawArrays(GL_TRIANGLE_STRIP, 0, vcount);
theta = theta1;
cosTheta = cosTheta1;
sinTheta = sinTheta1;
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
static void
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_roty, 0, 1, 0);
glRotatef(view_rotz, 0, 0, 1);
glScalef(0.5, 0.5, 0.5);
draw_torus(1.0, 3.0, 30, 60);
glPopMatrix();
glFinish();
}
/**
* Draw to both the window and pbuffer and compare results.
*/
static void
draw_both(EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
EGLContext egl_ctx)
{
unsigned *wbuf, *pbuf;
int x = 100, y = 110;
int i, dif;
wbuf = (unsigned *) malloc(WinWidth * WinHeight * 4);
pbuf = (unsigned *) malloc(WinWidth * WinHeight * 4);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
/* first draw to window */
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent(window) failed\n");
return;
}
draw();
glReadPixels(0, 0, WinWidth, WinHeight, GL_RGBA, GL_UNSIGNED_BYTE, wbuf);
printf("Window[%d,%d] = 0x%08x\n", x, y, wbuf[y*WinWidth+x]);
/* then draw to pbuffer */
if (!eglMakeCurrent(egl_dpy, egl_pbuf, egl_pbuf, egl_ctx)) {
printf("Error: eglMakeCurrent(pbuffer) failed\n");
return;
}
draw();
glReadPixels(0, 0, WinWidth, WinHeight, GL_RGBA, GL_UNSIGNED_BYTE, pbuf);
printf("Pbuffer[%d,%d] = 0x%08x\n", x, y, pbuf[y*WinWidth+x]);
eglSwapBuffers(egl_dpy, egl_surf);
/* compare renderings */
for (dif = i = 0; i < WinWidth * WinHeight; i++) {
if (wbuf[i] != pbuf[i]) {
dif = 1;
break;
}
}
if (dif)
printf("Difference at %d: 0x%08x vs. 0x%08x\n", i, wbuf[i], pbuf[i]);
else
printf("Window rendering matches Pbuffer rendering!\n");
free(wbuf);
free(pbuf);
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ar = (GLfloat) width / (GLfloat) height;
WinWidth = width;
WinHeight = height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef GL_VERSION_ES_CM_1_0
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
#else
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
#endif
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -15.0);
}
static void
make_texture(void)
{
#define SZ 64
GLenum Filter = GL_LINEAR;
GLubyte image[SZ][SZ][4];
GLuint i, j;
for (i = 0; i < SZ; i++) {
for (j = 0; j < SZ; j++) {
GLfloat d = (i - SZ/2) * (i - SZ/2) + (j - SZ/2) * (j - SZ/2);
d = sqrt(d);
if (d < SZ/3) {
image[i][j][0] = 255;
image[i][j][1] = 255;
image[i][j][2] = 255;
image[i][j][3] = 255;
}
else {
image[i][j][0] = 127;
image[i][j][1] = 127;
image[i][j][2] = 127;
image[i][j][3] = 255;
}
}
}
glActiveTexture(GL_TEXTURE0); /* unit 0 */
glBindTexture(GL_TEXTURE_2D, 42);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SZ, SZ, 0,
GL_RGBA, GL_UNSIGNED_BYTE, image);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
#undef SZ
}
static void
init(void)
{
static const GLfloat red[4] = {1, 0, 0, 0};
static const GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
static const GLfloat diffuse[4] = {0.7, 0.7, 0.7, 1.0};
static const GLfloat specular[4] = {0.001, 0.001, 0.001, 1.0};
static const GLfloat pos[4] = {20, 20, 50, 1};
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 9.0);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
glClearColor(0.4, 0.4, 0.4, 0.0);
glEnable(GL_DEPTH_TEST);
make_texture();
glEnable(GL_TEXTURE_2D);
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENGL_ES_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static EGLSurface
make_pbuffer(Display *x_dpy, EGLDisplay egl_dpy, int width, int height)
{
static const EGLint config_attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
EGLConfig config;
EGLSurface pbuf;
EGLint num_configs;
EGLint pbuf_attribs[5];
pbuf_attribs[0] = EGL_WIDTH;
pbuf_attribs[1] = width;
pbuf_attribs[2] = EGL_HEIGHT;
pbuf_attribs[3] = height;
pbuf_attribs[4] = EGL_NONE;
if (!eglChooseConfig( egl_dpy, config_attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL config for pbuffer\n");
exit(1);
}
pbuf = eglCreatePbufferSurface(egl_dpy, config, pbuf_attribs);
return pbuf;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
EGLContext egl_ctx)
{
int anim = 0;
while (1) {
int redraw = 0;
if (!anim || XPending(dpy)) {
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
if (event.xconfigure.window == win)
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == ' ') {
anim = !anim;
}
else if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
}
if (anim) {
view_rotx += 1.0;
view_roty += 2.0;
redraw = 1;
}
if (redraw) {
draw_both(egl_dpy, egl_surf, egl_pbuf, egl_ctx);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
Display *x_dpy;
Window win;
EGLSurface egl_surf, egl_pbuf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"pbuffer", 0, 0, WinWidth, WinHeight,
&win, &egl_ctx, &egl_surf);
egl_pbuf = make_pbuffer(x_dpy, egl_dpy, WinWidth, WinHeight);
if (!egl_pbuf) {
printf("Error: eglCreatePBufferSurface() failed\n");
return -1;
}
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(WinWidth, WinHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf, egl_pbuf, egl_ctx);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

657
progs/es1/xegl/render_tex.c Normal file
View File

@@ -0,0 +1,657 @@
/*
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
*/
/*
* Test EGL render to texture.
* Brian Paul
* August 2008
*/
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <EGL/egl.h>
static int TexWidth = 256, TexHeight = 256;
static int WinWidth = 300, WinHeight = 300;
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
static GLuint DotTexture, RenderTexture;
static void
Normal(GLfloat *n, GLfloat nx, GLfloat ny, GLfloat nz)
{
n[0] = nx;
n[1] = ny;
n[2] = nz;
}
static void
Vertex(GLfloat *v, GLfloat vx, GLfloat vy, GLfloat vz)
{
v[0] = vx;
v[1] = vy;
v[2] = vz;
}
static void
Texcoord(GLfloat *v, GLfloat s, GLfloat t)
{
v[0] = s;
v[1] = t;
}
/* Borrowed from glut, adapted */
static void
draw_torus(GLfloat r, GLfloat R, GLint nsides, GLint rings)
{
int i, j;
GLfloat theta, phi, theta1;
GLfloat cosTheta, sinTheta;
GLfloat cosTheta1, sinTheta1;
GLfloat ringDelta, sideDelta;
GLfloat varray[100][3], narray[100][3], tarray[100][2];
int vcount;
glVertexPointer(3, GL_FLOAT, 0, varray);
glNormalPointer(GL_FLOAT, 0, narray);
glTexCoordPointer(2, GL_FLOAT, 0, tarray);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
ringDelta = 2.0 * M_PI / rings;
sideDelta = 2.0 * M_PI / nsides;
theta = 0.0;
cosTheta = 1.0;
sinTheta = 0.0;
for (i = rings - 1; i >= 0; i--) {
theta1 = theta + ringDelta;
cosTheta1 = cos(theta1);
sinTheta1 = sin(theta1);
vcount = 0; /* glBegin(GL_QUAD_STRIP); */
phi = 0.0;
for (j = nsides; j >= 0; j--) {
GLfloat s0, s1, t;
GLfloat cosPhi, sinPhi, dist;
phi += sideDelta;
cosPhi = cos(phi);
sinPhi = sin(phi);
dist = R + r * cosPhi;
s0 = 20.0 * theta / (2.0 * M_PI);
s1 = 20.0 * theta1 / (2.0 * M_PI);
t = 8.0 * phi / (2.0 * M_PI);
Normal(narray[vcount], cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
Texcoord(tarray[vcount], s1, t);
Vertex(varray[vcount], cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
vcount++;
Normal(narray[vcount], cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
Texcoord(tarray[vcount], s0, t);
Vertex(varray[vcount], cosTheta * dist, -sinTheta * dist, r * sinPhi);
vcount++;
}
/*glEnd();*/
assert(vcount <= 100);
glDrawArrays(GL_TRIANGLE_STRIP, 0, vcount);
theta = theta1;
cosTheta = cosTheta1;
sinTheta = sinTheta1;
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
static void
draw_torus_to_texture(void)
{
glViewport(0, 0, TexWidth, TexHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustumf(-1, 1, -1, 1, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -15.0);
glClearColor(0.4, 0.4, 0.4, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBindTexture(GL_TEXTURE_2D, DotTexture);
glEnable(GL_LIGHTING);
glPushMatrix();
glRotatef(view_roty, 0, 1, 0);
glScalef(0.5, 0.5, 0.5);
draw_torus(1.0, 3.0, 30, 60);
glPopMatrix();
glDisable(GL_LIGHTING);
#if 0
glBindTexture(GL_TEXTURE_2D, RenderTexture);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, TexWidth, TexHeight);
#endif
glFinish();
}
static void
draw_textured_quad(void)
{
GLfloat ar = (GLfloat) WinWidth / (GLfloat) WinHeight;
glViewport(0, 0, WinWidth, WinHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -8.0);
glClearColor(0.4, 0.4, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBindTexture(GL_TEXTURE_2D, RenderTexture);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_rotz, 0, 0, 1);
{
static const GLfloat texcoord[4][2] = {
{ 0, 0 }, { 1, 0 }, { 0, 1 }, { 1, 1 }
};
static const GLfloat vertex[4][2] = {
{ -1, -1 }, { 1, -1 }, { -1, 1 }, { 1, 1 }
};
glVertexPointer(2, GL_FLOAT, 0, vertex);
glTexCoordPointer(2, GL_FLOAT, 0, texcoord);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
glPopMatrix();
}
static void
draw(EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
EGLContext egl_ctx)
{
/*printf("Begin draw\n");*/
/* first draw torus to pbuffer /texture */
#if 01
if (!eglMakeCurrent(egl_dpy, egl_pbuf, egl_pbuf, egl_ctx)) {
#else
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
#endif
printf("Error: eglMakeCurrent(pbuf) failed\n");
return;
}
glBindTexture(GL_TEXTURE_2D, RenderTexture);
eglBindTexImage(egl_dpy, egl_pbuf, EGL_BACK_BUFFER);
draw_torus_to_texture();
eglReleaseTexImage(egl_dpy, egl_pbuf, EGL_BACK_BUFFER);
/* draw textured quad to window */
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent(pbuffer) failed\n");
return;
}
draw_textured_quad();
eglSwapBuffers(egl_dpy, egl_surf);
/*printf("End draw\n");*/
}
static void
make_dot_texture(void)
{
#define SZ 64
GLenum Filter = GL_LINEAR;
GLubyte image[SZ][SZ][4];
GLuint i, j;
for (i = 0; i < SZ; i++) {
for (j = 0; j < SZ; j++) {
GLfloat d = (i - SZ/2) * (i - SZ/2) + (j - SZ/2) * (j - SZ/2);
d = sqrt(d);
if (d < SZ/3) {
image[i][j][0] = 255;
image[i][j][1] = 255;
image[i][j][2] = 255;
image[i][j][3] = 255;
}
else {
image[i][j][0] = 127;
image[i][j][1] = 127;
image[i][j][2] = 127;
image[i][j][3] = 255;
}
}
}
glGenTextures(1, &DotTexture);
glBindTexture(GL_TEXTURE_2D, DotTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SZ, SZ, 0,
GL_RGBA, GL_UNSIGNED_BYTE, image);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
#undef SZ
}
static void
make_render_texture(void)
{
GLenum Filter = GL_LINEAR;
glGenTextures(1, &RenderTexture);
glBindTexture(GL_TEXTURE_2D, RenderTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TexWidth, TexHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
static void
init(void)
{
static const GLfloat red[4] = {1, 0, 0, 0};
static const GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
static const GLfloat diffuse[4] = {0.7, 0.7, 0.7, 1.0};
static const GLfloat specular[4] = {0.001, 0.001, 0.001, 1.0};
static const GLfloat pos[4] = {20, 20, 50, 1};
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 9.0);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
glEnable(GL_DEPTH_TEST);
make_dot_texture();
make_render_texture();
printf("DotTexture=%u RenderTexture=%u\n", DotTexture, RenderTexture);
glEnable(GL_TEXTURE_2D);
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENGL_ES_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static EGLSurface
make_pbuffer(Display *x_dpy, EGLDisplay egl_dpy, int width, int height)
{
static const EGLint config_attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
EGLConfig config;
EGLSurface pbuf;
EGLint num_configs;
EGLint pbuf_attribs[15];
int i = 0;
pbuf_attribs[i++] = EGL_WIDTH;
pbuf_attribs[i++] = width;
pbuf_attribs[i++] = EGL_HEIGHT;
pbuf_attribs[i++] = height;
pbuf_attribs[i++] = EGL_TEXTURE_FORMAT;
pbuf_attribs[i++] = EGL_TEXTURE_RGBA;
pbuf_attribs[i++] = EGL_TEXTURE_TARGET;
pbuf_attribs[i++] = EGL_TEXTURE_2D;
pbuf_attribs[i++] = EGL_MIPMAP_TEXTURE;
pbuf_attribs[i++] = EGL_FALSE;
pbuf_attribs[i++] = EGL_NONE;
assert(i <= 15);
if (!eglChooseConfig( egl_dpy, config_attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL config for pbuffer\n");
exit(1);
}
pbuf = eglCreatePbufferSurface(egl_dpy, config, pbuf_attribs);
return pbuf;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
EGLContext egl_ctx)
{
int anim = 0;
while (1) {
int redraw = 0;
if (!anim || XPending(dpy)) {
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
if (event.xconfigure.window == win) {
WinWidth = event.xconfigure.width;
WinHeight = event.xconfigure.height;
}
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == ' ') {
anim = !anim;
}
else if (buffer[0] == 'z') {
view_rotz += 5.0;
}
else if (buffer[0] == 'Z') {
view_rotz -= 5.0;
}
else if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
}
if (anim) {
view_rotx += 1.0;
view_roty += 2.0;
redraw = 1;
}
if (redraw) {
draw(egl_dpy, egl_surf, egl_pbuf, egl_ctx);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
Display *x_dpy;
Window win;
EGLSurface egl_surf, egl_pbuf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"render_tex", 0, 0, WinWidth, WinHeight,
&win, &egl_ctx, &egl_surf);
egl_pbuf = make_pbuffer(x_dpy, egl_dpy, TexWidth, TexHeight);
if (!egl_pbuf) {
printf("Error: eglCreatePBufferSurface() failed\n");
return -1;
}
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
init();
event_loop(x_dpy, win, egl_dpy, egl_surf, egl_pbuf, egl_ctx);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

509
progs/es1/xegl/torus.c Normal file
View File

@@ -0,0 +1,509 @@
/*
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
*/
/*
* Draw a lit, textured torus with X/EGL and OpenGL ES 1.x
* Brian Paul
* July 2008
*/
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <EGL/egl.h>
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
static void
Normal(GLfloat *n, GLfloat nx, GLfloat ny, GLfloat nz)
{
n[0] = nx;
n[1] = ny;
n[2] = nz;
}
static void
Vertex(GLfloat *v, GLfloat vx, GLfloat vy, GLfloat vz)
{
v[0] = vx;
v[1] = vy;
v[2] = vz;
}
static void
Texcoord(GLfloat *v, GLfloat s, GLfloat t)
{
v[0] = s;
v[1] = t;
}
/* Borrowed from glut, adapted */
static void
draw_torus(GLfloat r, GLfloat R, GLint nsides, GLint rings)
{
int i, j;
GLfloat theta, phi, theta1;
GLfloat cosTheta, sinTheta;
GLfloat cosTheta1, sinTheta1;
GLfloat ringDelta, sideDelta;
GLfloat varray[100][3], narray[100][3], tarray[100][2];
int vcount;
glVertexPointer(3, GL_FLOAT, 0, varray);
glNormalPointer(GL_FLOAT, 0, narray);
glTexCoordPointer(2, GL_FLOAT, 0, tarray);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
ringDelta = 2.0 * M_PI / rings;
sideDelta = 2.0 * M_PI / nsides;
theta = 0.0;
cosTheta = 1.0;
sinTheta = 0.0;
for (i = rings - 1; i >= 0; i--) {
theta1 = theta + ringDelta;
cosTheta1 = cos(theta1);
sinTheta1 = sin(theta1);
vcount = 0; /* glBegin(GL_QUAD_STRIP); */
phi = 0.0;
for (j = nsides; j >= 0; j--) {
GLfloat s0, s1, t;
GLfloat cosPhi, sinPhi, dist;
phi += sideDelta;
cosPhi = cos(phi);
sinPhi = sin(phi);
dist = R + r * cosPhi;
s0 = 20.0 * theta / (2.0 * M_PI);
s1 = 20.0 * theta1 / (2.0 * M_PI);
t = 8.0 * phi / (2.0 * M_PI);
Normal(narray[vcount], cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
Texcoord(tarray[vcount], s1, t);
Vertex(varray[vcount], cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
vcount++;
Normal(narray[vcount], cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
Texcoord(tarray[vcount], s0, t);
Vertex(varray[vcount], cosTheta * dist, -sinTheta * dist, r * sinPhi);
vcount++;
}
/*glEnd();*/
assert(vcount <= 100);
glDrawArrays(GL_TRIANGLE_STRIP, 0, vcount);
theta = theta1;
cosTheta = cosTheta1;
sinTheta = sinTheta1;
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
static void
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_roty, 0, 1, 0);
glRotatef(view_rotz, 0, 0, 1);
glScalef(0.5, 0.5, 0.5);
draw_torus(1.0, 3.0, 30, 60);
glPopMatrix();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ar = (GLfloat) width / (GLfloat) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef GL_VERSION_ES_CM_1_0
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
#else
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
#endif
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -15.0);
}
static void
make_texture(void)
{
#define SZ 64
GLenum Filter = GL_LINEAR;
GLubyte image[SZ][SZ][4];
GLuint i, j;
for (i = 0; i < SZ; i++) {
for (j = 0; j < SZ; j++) {
GLfloat d = (i - SZ/2) * (i - SZ/2) + (j - SZ/2) * (j - SZ/2);
d = sqrt(d);
if (d < SZ/3) {
image[i][j][0] = 255;
image[i][j][1] = 255;
image[i][j][2] = 255;
image[i][j][3] = 255;
}
else {
image[i][j][0] = 127;
image[i][j][1] = 127;
image[i][j][2] = 127;
image[i][j][3] = 255;
}
}
}
glActiveTexture(GL_TEXTURE0); /* unit 0 */
glBindTexture(GL_TEXTURE_2D, 42);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SZ, SZ, 0,
GL_RGBA, GL_UNSIGNED_BYTE, image);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
#undef SZ
}
static void
init(void)
{
static const GLfloat red[4] = {1, 0, 0, 0};
static const GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
static const GLfloat diffuse[4] = {0.7, 0.7, 0.7, 1.0};
static const GLfloat specular[4] = {0.001, 0.001, 0.001, 1.0};
static const GLfloat pos[4] = {20, 20, 50, 1};
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 9.0);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
glClearColor(0.4, 0.4, 0.4, 0.0);
glEnable(GL_DEPTH_TEST);
make_texture();
glEnable(GL_TEXTURE_2D);
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENGL_ES_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
int anim = 1;
while (1) {
int redraw = 0;
if (!anim || XPending(dpy)) {
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == ' ') {
anim = !anim;
}
else if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
}
if (anim) {
view_rotx += 1.0;
view_roty += 2.0;
redraw = 1;
}
if (redraw) {
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 300, winHeight = 300;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"torus", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

473
progs/es1/xegl/tri.c Normal file
View File

@@ -0,0 +1,473 @@
/*
* Copyright (C) 2008 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Draw a triangle with X/EGL and OpenGL ES 1.x
* Brian Paul
* 5 June 2008
*/
#define USE_FULL_GL 0
#define USE_FIXED_POINT 0
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#if USE_FULL_GL
#include <GL/gl.h> /* use full OpenGL */
#else
#include <GLES/gl.h> /* use OpenGL ES 1.x */
#include <GLES/glext.h>
#endif
#include <EGL/egl.h>
#define FLOAT_TO_FIXED(X) ((X) * 65535.0)
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
static void
draw(void)
{
#if USE_FIXED_POINT
static const GLfixed verts[3][2] = {
{ -65536, -65536 },
{ 65536, -65536 },
{ 0, 65536 }
};
static const GLfixed colors[3][4] = {
{ 65536, 0, 0, 65536 },
{ 0, 65536, 0 , 65536},
{ 0, 0, 65536 , 65536}
};
#else
static const GLfloat verts[3][2] = {
{ -1, -1 },
{ 1, -1 },
{ 0, 1 }
};
static const GLfloat colors[3][4] = {
{ 1, 0, 0, 1 },
{ 0, 1, 0, 1 },
{ 0, 0, 1, 1 }
};
#endif
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_roty, 0, 1, 0);
glRotatef(view_rotz, 0, 0, 1);
{
#if USE_FIXED_POINT
glVertexPointer(2, GL_FIXED, 0, verts);
glColorPointer(4, GL_FIXED, 0, colors);
#else
glVertexPointer(2, GL_FLOAT, 0, verts);
glColorPointer(4, GL_FLOAT, 0, colors);
#endif
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
/* draw triangle */
glDrawArrays(GL_TRIANGLES, 0, 3);
/* draw some points */
glPointSizex(FLOAT_TO_FIXED(15.5));
glDrawArrays(GL_POINTS, 0, 3);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
if (0) {
/* test code */
GLfixed size;
glGetFixedv(GL_POINT_SIZE, &size);
printf("GL_POINT_SIZE = 0x%x %f\n", size, size / 65536.0);
}
glPopMatrix();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ar = (GLfloat) width / (GLfloat) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef GL_VERSION_ES_CM_1_0
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
#else
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
#endif
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -10.0);
}
static void
test_query_matrix(void)
{
PFNGLQUERYMATRIXXOESPROC procQueryMatrixx;
typedef void (*voidproc)();
GLfixed mantissa[16];
GLint exponent[16];
GLbitfield rv;
int i;
voidproc p = eglGetProcAddress("eglCreateContext");
assert(p);
procQueryMatrixx = (PFNGLQUERYMATRIXXOESPROC) eglGetProcAddress("glQueryMatrixxOES");
assert(procQueryMatrixx);
/* Actually try out this one */
rv = (*procQueryMatrixx)(mantissa, exponent);
for (i = 0; i < 16; i++) {
if (rv & (1<<i)) {
printf("matrix[%d] invalid\n", i);
}
else {
printf("matrix[%d] = %f * 2^(%d)\n", i, mantissa[i]/65536.0, exponent[i]);
}
}
p = eglGetProcAddress("glFoo");
assert(!p);
}
static void
init(void)
{
glClearColor(0.4, 0.4, 0.4, 0.0);
if (0)
test_query_matrix();
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
#if USE_FULL_GL
eglBindAPI(EGL_OPENGL_API);
#else
eglBindAPI(EGL_OPENGL_ES_API);
#endif
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
while (1) {
int redraw = 0;
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
if (redraw) {
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 300, winHeight = 300;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
static struct {
char *name;
GLenum value;
enum {GetString, GetInteger} type;
} info_items[] = {
{"GL_RENDERER", GL_RENDERER, GetString},
{"GL_VERSION", GL_VERSION, GetString},
{"GL_VENDOR", GL_VENDOR, GetString},
{"GL_EXTENSIONS", GL_EXTENSIONS, GetString},
{"GL_MAX_PALETTE_MATRICES_OES", GL_MAX_PALETTE_MATRICES_OES, GetInteger},
{"GL_MAX_VERTEX_UNITS_OES", GL_MAX_VERTEX_UNITS_OES, GetInteger},
};
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"OpenGL ES 1.x tri", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
for (i = 0; i < sizeof(info_items)/sizeof(info_items[0]); i++) {
switch (info_items[i].type) {
case GetString:
printf("%s = %s\n", info_items[i].name, (char *)glGetString(info_items[i].value));
break;
case GetInteger: {
GLint rv = -1;
glGetIntegerv(info_items[i].value, &rv);
printf("%s = %d\n", info_items[i].name, rv);
break;
}
}
}
};
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

433
progs/es1/xegl/two_win.c Normal file
View File

@@ -0,0 +1,433 @@
/*
* Copyright (C) 2008 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Test drawing to two windows.
* Brian Paul
* August 2008
*/
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <EGL/egl.h>
static int WinWidth[2] = {150, 300}, WinHeight[2] = {150, 300};
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ar = (GLfloat) width / (GLfloat) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef GL_VERSION_ES_CM_1_0
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
#else
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
#endif
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -10.0);
}
static void
draw(int win)
{
static const GLfloat verts[3][2] = {
{ -1, -1 },
{ 1, -1 },
{ 0, 1 }
};
static const GLfloat colors[3][4] = {
{ 1, 0, 0, 1 },
{ 0, 1, 0, 1 },
{ 0, 0, 1, 1 }
};
assert(win == 0 || win == 1);
reshape(WinWidth[win], WinHeight[win]);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_roty, 0, 1, 0);
glRotatef(view_rotz, 0, 0, 1);
/* draw triangle */
{
glVertexPointer(2, GL_FLOAT, 0, verts);
glColorPointer(4, GL_FLOAT, 0, colors);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
glPopMatrix();
}
static void
init(void)
{
glClearColor(0.4, 0.4, 0.4, 0.0);
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, x, y, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
#if USE_FULL_GL
eglBindAPI(EGL_OPENGL_API);
#else
eglBindAPI(EGL_OPENGL_ES_API);
#endif
if (ctxRet) {
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*ctxRet = ctx;
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
}
static void
event_loop(Display *dpy, Window win1, Window win2,
EGLDisplay egl_dpy, EGLSurface egl_surf1, EGLSurface egl_surf2,
EGLContext egl_ctx)
{
while (1) {
int redraw = 0;
int win;
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
if (event.xconfigure.window == win1)
win = 0;
else
win = 1;
WinWidth[win] = event.xconfigure.width;
WinHeight[win] = event.xconfigure.height;
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
if (redraw) {
/* win 1 */
if (!eglMakeCurrent(egl_dpy, egl_surf1, egl_surf1, egl_ctx)) {
printf("Error: eglMakeCurrent(1) failed\n");
return;
}
draw(0);
eglSwapBuffers(egl_dpy, egl_surf1);
/* win 2 */
if (!eglMakeCurrent(egl_dpy, egl_surf2, egl_surf2, egl_ctx)) {
printf("Error: eglMakeCurrent(2) failed\n");
return;
}
draw(1);
eglSwapBuffers(egl_dpy, egl_surf2);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
Display *x_dpy;
Window win1, win2;
EGLSurface egl_surf1, egl_surf2;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
static struct {
char *name;
GLenum value;
enum {GetString, GetInteger} type;
} info_items[] = {
{"GL_RENDERER", GL_RENDERER, GetString},
{"GL_VERSION", GL_VERSION, GetString},
{"GL_VENDOR", GL_VENDOR, GetString},
{"GL_EXTENSIONS", GL_EXTENSIONS, GetString},
{"GL_MAX_PALETTE_MATRICES_OES", GL_MAX_PALETTE_MATRICES_OES, GetInteger},
{"GL_MAX_VERTEX_UNITS_OES", GL_MAX_VERTEX_UNITS_OES, GetInteger},
};
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"xegl_two_win #1", 0, 0, WinWidth[0], WinHeight[0],
&win1, &egl_ctx, &egl_surf1);
make_x_window(x_dpy, egl_dpy,
"xegl_two_win #2", WinWidth[0] + 50, 0,
WinWidth[1], WinHeight[1],
&win2, NULL, &egl_surf2);
XMapWindow(x_dpy, win1);
XMapWindow(x_dpy, win2);
if (!eglMakeCurrent(egl_dpy, egl_surf1, egl_surf1, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
for (i = 0; i < sizeof(info_items)/sizeof(info_items[0]); i++) {
switch (info_items[i].type) {
case GetString:
printf("%s = %s\n", info_items[i].name, (char *)glGetString(info_items[i].value));
break;
case GetInteger: {
GLint rv = -1;
glGetIntegerv(info_items[i].value, &rv);
printf("%s = %d\n", info_items[i].name, rv);
break;
}
}
}
};
init();
event_loop(x_dpy, win1, win2, egl_dpy, egl_surf1, egl_surf2, egl_ctx);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf1);
eglDestroySurface(egl_dpy, egl_surf2);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win1);
XDestroyWindow(x_dpy, win2);
XCloseDisplay(x_dpy);
return 0;
}

51
progs/es2/xegl/Makefile Normal file
View File

@@ -0,0 +1,51 @@
# progs/es2/xegl/Makefile
TOP = ../../..
include $(TOP)/configs/current
INCLUDE_DIRS = \
-I$(TOP)/include \
HEADERS = $(TOP)/include/GLES/egl.h
ES2_LIB_DEPS = \
$(TOP)/$(LIB_DIR)/libEGL.so \
$(TOP)/$(LIB_DIR)/libGLESv2.so
ES2_LIBS = \
-L$(TOP)/$(LIB_DIR) -lEGL \
-L$(TOP)/$(LIB_DIR) -lGLESv2 $(LIBDRM_LIB) -lX11
PROGRAMS = \
es2_info \
tri
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
default: $(PROGRAMS)
es2_info.c:
cp ../../es1/xegl/es1_info.c es2_info.c
es2_info: es2_info.o $(ES2_LIB_DEPS)
$(CC) $(CFLAGS) es2_info.o $(ES2_LIBS) -o $@
tri: tri.o $(ES2_LIB_DEPS)
$(CC) $(CFLAGS) tri.o $(ES2_LIBS) -o $@
clean:
rm -f *.o *~
rm -f $(PROGRAMS)
rm -f es2_info.c

516
progs/es2/xegl/tri.c Normal file
View File

@@ -0,0 +1,516 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
**************************************************************************/
/*
* Draw a triangle with X/EGL and OpenGL ES 2.x
*/
#define USE_FULL_GL 0
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#if USE_FULL_GL
#include <GL/gl.h> /* use full OpenGL */
#else
#include <GLES2/gl2.h> /* use OpenGL ES 2.x */
#endif
#include <EGL/egl.h>
#define FLOAT_TO_FIXED(X) ((X) * 65535.0)
static GLfloat view_rotx = 0.0, view_roty = 0.0;
static GLint u_matrix = -1;
static GLint attr_pos = 0, attr_color = 1;
static void
make_z_rot_matrix(GLfloat angle, GLfloat *m)
{
float c = cos(angle * M_PI / 180.0);
float s = sin(angle * M_PI / 180.0);
int i;
for (i = 0; i < 16; i++)
m[i] = 0.0;
m[0] = m[5] = m[10] = m[15] = 1.0;
m[0] = c;
m[1] = s;
m[4] = -s;
m[5] = c;
}
static void
make_scale_matrix(GLfloat xs, GLfloat ys, GLfloat zs, GLfloat *m)
{
int i;
for (i = 0; i < 16; i++)
m[i] = 0.0;
m[0] = xs;
m[5] = ys;
m[10] = zs;
m[15] = 1.0;
}
static void
mul_matrix(GLfloat *prod, const GLfloat *a, const GLfloat *b)
{
#define A(row,col) a[(col<<2)+row]
#define B(row,col) b[(col<<2)+row]
#define P(row,col) p[(col<<2)+row]
GLfloat p[16];
GLint i;
for (i = 0; i < 4; i++) {
const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3);
P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0);
P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1);
P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2);
P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3);
}
memcpy(prod, p, sizeof(p));
#undef A
#undef B
#undef PROD
}
static void
draw(void)
{
static const GLfloat verts[3][2] = {
{ -1, -1 },
{ 1, -1 },
{ 0, 1 }
};
static const GLfloat colors[3][3] = {
{ 1, 0, 0 },
{ 0, 1, 0 },
{ 0, 0, 1 }
};
GLfloat mat[16], rot[16], scale[16];
/* Set modelview/projection matrix */
make_z_rot_matrix(view_rotx, rot);
make_scale_matrix(0.5, 0.5, 0.5, scale);
mul_matrix(mat, rot, scale);
glUniformMatrix4fv(u_matrix, 1, GL_FALSE, mat);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
{
glVertexAttribPointer(attr_pos, 2, GL_FLOAT, GL_FALSE, 0, verts);
glVertexAttribPointer(attr_color, 3, GL_FLOAT, GL_FALSE, 0, colors);
glEnableVertexAttribArray(attr_pos);
glEnableVertexAttribArray(attr_color);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableVertexAttribArray(attr_pos);
glDisableVertexAttribArray(attr_color);
}
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
glViewport(0, 0, (GLint) width, (GLint) height);
}
static void
create_shaders(void)
{
static const char *fragShaderText =
"varying vec4 v_color;\n"
"void main() {\n"
" gl_FragColor = v_color;\n"
"}\n";
static const char *vertShaderText =
"uniform mat4 modelviewProjection;\n"
"attribute vec4 pos;\n"
"attribute vec4 color;\n"
"varying vec4 v_color;\n"
"void main() {\n"
" gl_Position = modelviewProjection * pos;\n"
" v_color = color;\n"
"}\n";
GLuint fragShader, vertShader, program;
GLint stat;
fragShader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragShader, 1, (const char **) &fragShaderText, NULL);
glCompileShader(fragShader);
glGetShaderiv(fragShader, GL_COMPILE_STATUS, &stat);
if (!stat) {
printf("Error: fragment shader did not compile!\n");
exit(1);
}
vertShader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertShader, 1, (const char **) &vertShaderText, NULL);
glCompileShader(vertShader);
glGetShaderiv(vertShader, GL_COMPILE_STATUS, &stat);
if (!stat) {
printf("Error: vertex shader did not compile!\n");
exit(1);
}
program = glCreateProgram();
glAttachShader(program, fragShader);
glAttachShader(program, vertShader);
glLinkProgram(program);
glGetProgramiv(program, GL_LINK_STATUS, &stat);
if (!stat) {
char log[1000];
GLsizei len;
glGetProgramInfoLog(program, 1000, &len, log);
printf("Error: linking:\n%s\n", log);
exit(1);
}
glUseProgram(program);
if (1) {
/* test setting attrib locations */
glBindAttribLocation(program, attr_pos, "pos");
glBindAttribLocation(program, attr_color, "color");
glLinkProgram(program); /* needed to put attribs into effect */
}
else {
/* test automatic attrib locations */
attr_pos = glGetAttribLocation(program, "pos");
attr_color = glGetAttribLocation(program, "color");
}
u_matrix = glGetUniformLocation(program, "modelviewProjection");
printf("Uniform modelviewProjection at %d\n", u_matrix);
printf("Attrib pos at %d\n", attr_pos);
printf("Attrib color at %d\n", attr_color);
}
static void
init(void)
{
typedef void (*proc)();
#if 1 /* test code */
proc p = eglGetProcAddress("eglCreateContext");
assert(p);
p = eglGetProcAddress("glMapBufferOES");
assert(p);
#endif
glClearColor(0.4, 0.4, 0.4, 0.0);
create_shaders();
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
static const EGLint ctx_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
#if USE_FULL_GL /* XXX fix this when eglBindAPI() works */
eglBindAPI(EGL_OPENGL_API);
#else
eglBindAPI(EGL_OPENGL_ES_API);
#endif
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, ctx_attribs );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
/* test eglQueryContext() */
{
EGLint val;
eglQueryContext(egl_dpy, ctx, EGL_CONTEXT_CLIENT_VERSION, &val);
assert(val == 2);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
{
EGLint val;
eglQuerySurface(egl_dpy, *surfRet, EGL_WIDTH, &val);
assert(val == width);
eglQuerySurface(egl_dpy, *surfRet, EGL_HEIGHT, &val);
assert(val == height);
eglQuerySurface(egl_dpy, *surfRet, EGL_SURFACE_TYPE, &val);
assert(val == EGL_WINDOW_BIT);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
while (1) {
int redraw = 0;
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
if (redraw) {
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 300, winHeight = 300;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"OpenGL ES 2.x tri", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

View File

@@ -22,6 +22,7 @@ samplers_array
shaderutil.c
shaderutil.h
shadow_sampler
shtest
skinning
texaaline
texdemo1

View File

@@ -14,6 +14,11 @@ LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB)
INCLUDE_DIRS = -I$(TOP)/progs/util
# using : to avoid APP_CC pointing to CC loop
CC:=$(APP_CC)
CFLAGS += -I$(INCDIR)
LDLIBS=$(LIBS)
DEMO_SOURCES = \
array.c \
bitmap.c \
@@ -32,7 +37,9 @@ DEMO_SOURCES = \
pointcoord.c \
points.c \
samplers.c \
samplers_array.c \
shadow_sampler.c \
shtest.c \
skinning.c \
texaaline.c \
texdemo1.c \
@@ -52,28 +59,16 @@ UTIL_SOURCES = \
readtex.c
UTIL_OBJS = $(UTIL_SOURCES:.c=.o)
PROG_OBJS = $(DEMO_SOURCES:.c=.o)
PROGS = $(DEMO_SOURCES:%.c=%)
##### RULES #####
# make .o file from .c file:
.c.o:
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) $< -o $@
# make executable from .o files
.o:
$(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(UTIL_OBJS) $(LIBS) -o $@
##### TARGETS #####
default: $(PROGS)
$(PROG_OBJS): $(UTIL_HEADERS)
$(PROGS): $(UTIL_OBJS)
clean:
-rm -f $(PROGS)
@@ -83,9 +78,11 @@ clean:
-rm -f readtex.*
##### Extra dependencies
samplers_array.o: samplers.c
$(APP_CC) $(CFLAGS) -DSAMPLERS_ARRAY $< -c -o $@
extfuncs.h: $(TOP)/progs/util/extfuncs.h
cp $< .
@@ -101,138 +98,3 @@ shaderutil.c: $(TOP)/progs/util/shaderutil.c
shaderutil.h: $(TOP)/progs/util/shaderutil.h
cp $< .
array.o: $(UTIL_HEADERS)
array: array.o $(UTIL_OBJS)
bitmap.o: $(UTIL_HEADERS)
bitmap: bitmap.o $(UTIL_OBJS)
brick.o: $(UTIL_HEADERS)
brick: brick.o $(UTIL_OBJS)
bump.o: $(UTIL_HEADERS)
bump: bump.o $(UTIL_OBJS)
convolutions.o: $(UTIL_HEADERS)
convolutions: convolutions.o $(UTIL_OBJS)
deriv.o: deriv.c $(UTIL_HEADERS)
deriv: deriv.o $(UTIL_OBJS)
identity.o: $(UTIL_HEADERS)
identity: identity.o $(UTIL_OBJS)
fragcoord.o: $(UTIL_HEADERS)
fragcoord: fragcoord.o $(UTIL_OBJS)
linktest.o: $(UTIL_HEADERS)
linktest: linktest.o $(UTIL_OBJS)
mandelbrot.o: $(UTIL_HEADERS)
mandelbrot: mandelbrot.o $(UTIL_OBJS)
multinoise.o: $(UTIL_HEADERS)
multinoise: multinoise.o $(UTIL_OBJS)
multitex.o: $(UTIL_HEADERS)
multitex: multitex.o $(UTIL_OBJS)
noise.o: $(UTIL_HEADERS)
noise: noise.o $(UTIL_OBJS)
noise2.o: $(UTIL_HEADERS)
noise2: noise2.o $(UTIL_OBJS)
points.o: $(UTIL_HEADERS)
points: points.o $(UTIL_OBJS)
pointcoord.o: $(UTIL_HEADERS)
pointcoord: pointcoord.o $(UTIL_OBJS)
samplers.o: $(UTIL_HEADERS)
samplers: samplers.o $(UTIL_OBJS)
samplers_array.o: $(UTIL_HEADERS)
samplers_array: samplers_array.o $(UTIL_OBJS)
shadow_sampler.o: $(UTIL_HEADERS)
shadow_sampler: shadow_sampler.o $(UTIL_OBJS)
skinning.o: $(UTIL_HEADERS)
skinning: skinning.o $(UTIL_OBJS)
texaaline.o: $(UTIL_HEADERS)
texaaline: texaaline.o $(UTIL_OBJS)
texdemo1.o: $(UTIL_HEADERS)
texdemo1: texdemo1.o $(UTIL_OBJS)
toyball.o: $(UTIL_HEADERS)
toyball: toyball.o $(UTIL_OBJS)
twoside.o: $(UTIL_HEADERS)
twoside: twoside.o $(UTIL_OBJS)
trirast.o: $(UTIL_HEADERS)
trirast: trirast.o $(UTIL_OBJS)
vert-or-frag-only.o: $(UTIL_HEADERS)
vert-or-frag-only: vert-or-frag-only.o $(UTIL_OBJS)
vert-tex.o: $(UTIL_HEADERS)
vert-tex: vert-tex.o $(UTIL_OBJS)

View File

@@ -24,12 +24,12 @@ static GLuint program;
static struct uniform_info Uniforms[] = {
/* vert */
{ "LightPosition", 3, GL_FLOAT, { 0.1, 0.1, 9.0, 0}, -1 },
{ "LightPosition", 1, GL_FLOAT_VEC3, { 0.1, 0.1, 9.0, 0}, -1 },
/* frag */
{ "BrickColor", 3, GL_FLOAT, { 0.8, 0.2, 0.2, 0 }, -1 },
{ "MortarColor", 3, GL_FLOAT, { 0.6, 0.6, 0.6, 0 }, -1 },
{ "BrickSize", 2, GL_FLOAT, { 1.0, 0.3, 0, 0 }, -1 },
{ "BrickPct", 2, GL_FLOAT, { 0.9, 0.8, 0, 0 }, -1 },
{ "BrickColor", 1, GL_FLOAT_VEC3, { 0.8, 0.2, 0.2, 0 }, -1 },
{ "MortarColor", 1, GL_FLOAT_VEC3, { 0.6, 0.6, 0.6, 0 }, -1 },
{ "BrickSize", 1, GL_FLOAT_VEC2, { 1.0, 0.3, 0, 0 }, -1 },
{ "BrickPct", 1, GL_FLOAT_VEC2, { 0.9, 0.8, 0, 0 }, -1 },
END_OF_UNIFORMS
};
@@ -148,7 +148,8 @@ Init(void)
glUseProgram(program);
InitUniforms(program, Uniforms);
SetUniformValues(program, Uniforms);
PrintUniforms(Uniforms);
assert(glGetError() == 0);
@@ -183,7 +184,6 @@ int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);

8
progs/glsl/brick.shtest Normal file
View File

@@ -0,0 +1,8 @@
vs CH06-brick.vert
fs CH06-brick.frag
uniform LightPosition GL_FLOAT_VEC3 0.1 0.1 9.0
uniform BrickColor GL_FLOAT_VEC3 0.8 0.2 0.2
uniform MortarColor GL_FLOAT_VEC3 0.6 0.6 0.6
uniform BrickSize GL_FLOAT_VEC2 1.0 0.3
uniform BrickPct GL_FLOAT_VEC2 0.9 0.8

View File

@@ -24,11 +24,11 @@ static GLuint program;
static struct uniform_info Uniforms[] = {
{ "LightPosition", 3, GL_FLOAT, { 0.57737, 0.57735, 0.57735, 0.0 }, -1 },
{ "SurfaceColor", 3, GL_FLOAT, { 0.8, 0.8, 0.2, 0 }, -1 },
{ "BumpDensity", 1, GL_FLOAT, { 10.0, 0, 0, 0 }, -1 },
{ "BumpSize", 1, GL_FLOAT, { 0.125, 0, 0, 0 }, -1 },
{ "SpecularFactor", 1, GL_FLOAT, { 0.5, 0, 0, 0 }, -1 },
{ "LightPosition", 1, GL_FLOAT_VEC3, { 0.57737, 0.57735, 0.57735, 0.0 }, -1 },
{ "SurfaceColor", 1, GL_FLOAT_VEC3, { 0.8, 0.8, 0.2, 0 }, -1 },
{ "BumpDensity", 1, GL_FLOAT, { 10.0, 0, 0, 0 }, -1 },
{ "BumpSize", 1, GL_FLOAT, { 0.125, 0, 0, 0 }, -1 },
{ "SpecularFactor", 1, GL_FLOAT, { 0.5, 0, 0, 0 }, -1 },
END_OF_UNIFORMS
};
@@ -242,7 +242,8 @@ Init(void)
CheckError(__LINE__);
InitUniforms(program, Uniforms);
SetUniformValues(program, Uniforms);
PrintUniforms(Uniforms);
CheckError(__LINE__);
@@ -280,7 +281,6 @@ int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);

View File

@@ -448,7 +448,6 @@ int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitWindowPosition(0, 0);
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE);

View File

@@ -220,7 +220,6 @@ int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(200, 200);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);

View File

@@ -166,7 +166,6 @@ int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);

View File

@@ -187,7 +187,6 @@ int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(200, 200);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);

View File

@@ -25,7 +25,7 @@ static GLuint program;
static struct uniform_info Uniforms[] = {
/* vert */
{ "LightPosition", 3, GL_FLOAT, { 0.1, 0.1, 9.0, 0}, -1 },
{ "LightPosition", 1, GL_FLOAT_VEC3, { 0.1, 0.1, 9.0, 0}, -1 },
{ "SpecularContribution", 1, GL_FLOAT, { 0.5, 0, 0, 0 }, -1 },
{ "DiffuseContribution", 1, GL_FLOAT, { 0.5, 0, 0, 0 }, -1 },
{ "Shininess", 1, GL_FLOAT, { 20.0, 0, 0, 0 }, -1 },
@@ -34,9 +34,9 @@ static struct uniform_info Uniforms[] = {
{ "Zoom", 1, GL_FLOAT, { 0.125, 0, 0, 0 }, -1 },
{ "Xcenter", 1, GL_FLOAT, { -1.5, 0, 0, 0 }, -1 },
{ "Ycenter", 1, GL_FLOAT, { .005, 0, 0, 0 }, -1 },
{ "InnerColor", 3, GL_FLOAT, { 1, 0, 0, 0 }, -1 },
{ "OuterColor1", 3, GL_FLOAT, { 0, 1, 0, 0 }, -1 },
{ "OuterColor2", 3, GL_FLOAT, { 0, 0, 1, 0 }, -1 },
{ "InnerColor", 1, GL_FLOAT_VEC3, { 1, 0, 0, 0 }, -1 },
{ "OuterColor1", 1, GL_FLOAT_VEC3, { 0, 1, 0, 0 }, -1 },
{ "OuterColor2", 1, GL_FLOAT_VEC3, { 0, 0, 1, 0 }, -1 },
END_OF_UNIFORMS
};
@@ -159,7 +159,8 @@ Init(void)
glUseProgram(program);
InitUniforms(program, Uniforms);
SetUniformValues(program, Uniforms);
PrintUniforms(Uniforms);
uZoom = glGetUniformLocation(program, "Zoom");
uXcenter = glGetUniformLocation(program, "Xcenter");
@@ -198,7 +199,6 @@ int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);

View File

@@ -0,0 +1,13 @@
vs CH18-mandel.vert
fs CH18-mandel.frag
uniform LightPosition GL_FLOAT_VEC3 0.1 0.1 9.0
uniform SpecularContribution GL_FLOAT 0.5
uniform DiffuseContribution GL_FLOAT 0.5
uniform Shininess GL_FLOAT 20.0
uniform Iterations GL_FLOAT 12
uniform Zoom GL_FLOAT 0.125
uniform Xcenter GL_FLOAT -1.5
uniform Ycenter GL_FLOAT .005
uniform InnerColor GL_FLOAT_VEC3 1 0 0
uniform OuterColor1 GL_FLOAT_VEC3 0 1 0
uniform OuterColor2 GL_FLOAT_VEC3 0 0 1

View File

@@ -262,7 +262,6 @@ int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);

View File

@@ -51,14 +51,16 @@ static GLfloat Xrot = 0.0, Yrot = .0, Zrot = 0.0;
static GLfloat EyeDist = 10;
static GLboolean Anim = GL_TRUE;
static GLboolean UseArrays = GL_TRUE;
static GLboolean UseVBO = GL_TRUE;
static GLuint VBO = 0;
static GLint VertCoord_attr = -1, TexCoord0_attr = -1, TexCoord1_attr = -1;
/* value[0] = tex unit */
static struct uniform_info Uniforms[] = {
{ "tex1", 1, GL_INT, { 0, 0, 0, 0 }, -1 },
{ "tex2", 1, GL_INT, { 1, 0, 0, 0 }, -1 },
{ "tex1", 1, GL_SAMPLER_2D, { 0, 0, 0, 0 }, -1 },
{ "tex2", 1, GL_SAMPLER_2D, { 1, 0, 0, 0 }, -1 },
END_OF_UNIFORMS
};
@@ -76,28 +78,81 @@ static const GLfloat VertCoords[4][2] = {
};
static void
SetupVertexBuffer(void)
{
glGenBuffersARB(1, &VBO);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBO);
glBufferDataARB(GL_ARRAY_BUFFER_ARB,
sizeof(VertCoords) +
sizeof(Tex0Coords) +
sizeof(Tex1Coords),
NULL,
GL_STATIC_DRAW_ARB);
/* non-interleaved vertex arrays */
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB,
0, /* offset */
sizeof(VertCoords), /* size */
VertCoords); /* data */
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB,
sizeof(VertCoords), /* offset */
sizeof(Tex0Coords), /* size */
Tex0Coords); /* data */
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB,
sizeof(VertCoords) +
sizeof(Tex0Coords), /* offset */
sizeof(Tex1Coords), /* size */
Tex1Coords); /* data */
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
}
static void
DrawPolygonArray(void)
{
void *vertPtr, *tex0Ptr, *tex1Ptr;
if (UseVBO) {
glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBO);
vertPtr = (void *) 0;
tex0Ptr = (void *) sizeof(VertCoords);
tex1Ptr = (void *) (sizeof(VertCoords) + sizeof(Tex0Coords));
}
else {
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
vertPtr = VertCoords;
tex0Ptr = Tex0Coords;
tex1Ptr = Tex1Coords;
}
if (VertCoord_attr >= 0) {
glVertexAttribPointer(VertCoord_attr, 2, GL_FLOAT, GL_FALSE,
0, VertCoords);
0, vertPtr);
glEnableVertexAttribArray(VertCoord_attr);
}
else {
glVertexPointer(2, GL_FLOAT, 0, VertCoords);
glEnable(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, vertPtr);
glEnableClientState(GL_VERTEX_ARRAY);
}
glVertexAttribPointer(TexCoord0_attr, 2, GL_FLOAT, GL_FALSE,
0, Tex0Coords);
0, tex0Ptr);
glEnableVertexAttribArray(TexCoord0_attr);
glVertexAttribPointer(TexCoord1_attr, 2, GL_FLOAT, GL_FALSE,
0, Tex1Coords);
0, tex1Ptr);
glEnableVertexAttribArray(TexCoord1_attr);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
}
@@ -163,6 +218,10 @@ key(unsigned char k, int x, int y)
UseArrays = !UseArrays;
printf("Arrays: %d\n", UseArrays);
break;
case 'v':
UseVBO = !UseVBO;
printf("Use VBO: %d\n", UseVBO);
break;
case ' ':
Anim = !Anim;
if (Anim)
@@ -269,7 +328,10 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile,
glUseProgram(program);
InitUniforms(program, uniforms);
SetUniformValues(program, uniforms);
PrintUniforms(Uniforms);
assert(ValidateShaderProgram(program));
VertCoord_attr = glGetAttribLocation(program, "VertCoord");
if (VertCoord_attr > 0) {
@@ -314,10 +376,18 @@ InitGL(void)
/*exit(1);*/
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
printf("Usage:\n");
printf(" a - toggle arrays vs. immediate mode rendering\n");
printf(" v - toggle VBO usage for array rendering\n");
printf(" z/Z - change viewing distance\n");
printf(" SPACE - toggle animation\n");
printf(" Esc - exit\n");
InitTextures();
InitPrograms();
SetupVertexBuffer();
glEnable(GL_DEPTH_TEST);
glClearColor(.6, .6, .9, 0);

View File

@@ -0,0 +1,6 @@
vs multitex.vert
fs multitex.frag
texture 0 2D ../images/tile.rgb
texture 1 2D ../images/tree2.rgba
uniform tex1 GL_SAMPLER_2D 0
uniform tex2 GL_SAMPLER_2D 1

View File

@@ -35,8 +35,8 @@ static const char *FragShaderText =
static struct uniform_info Uniforms[] = {
{ "Scale", 4, GL_FLOAT, { 0.5, 0.4, 0.0, 0}, -1 },
{ "Bias", 4, GL_FLOAT, { 0.5, 0.3, 0.0, 0}, -1 },
{ "Scale", 1, GL_FLOAT_VEC4, { 0.5, 0.4, 0.0, 0}, -1 },
{ "Bias", 1, GL_FLOAT_VEC4, { 0.5, 0.3, 0.0, 0}, -1 },
{ "Slice", 1, GL_FLOAT, { 0.5, 0, 0, 0}, -1 },
END_OF_UNIFORMS
};
@@ -179,7 +179,8 @@ Init(void)
glUseProgram(program);
InitUniforms(program, Uniforms);
SetUniformValues(program, Uniforms);
PrintUniforms(Uniforms);
assert(glGetError() == 0);
@@ -199,7 +200,6 @@ int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);

View File

@@ -186,7 +186,6 @@ static void Init (void)
int main (int argc, char *argv[])
{
glutInit (&argc, argv);
glutInitWindowPosition ( 0, 0);
glutInitWindowSize (200, 200);
glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow (argv[0]);

View File

@@ -187,7 +187,6 @@ int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);

View File

@@ -211,10 +211,18 @@ InitTextures(void)
for (y = 0; y < stripeSize; y++) {
for (x = 0; x < size; x++) {
GLint k = 4 * ((ypos + y) * size + x);
texImage[k + 0] = intensity;
texImage[k + 1] = intensity;
texImage[k + 2] = 0;
texImage[k + 3] = 255;
if (x < size / 2) {
texImage[k + 0] = intensity;
texImage[k + 1] = intensity;
texImage[k + 2] = 0;
texImage[k + 3] = 255;
}
else {
texImage[k + 0] = 255 - intensity;
texImage[k + 1] = 0;
texImage[k + 2] = 0;
texImage[k + 3] = 255;
}
}
}

View File

@@ -321,7 +321,6 @@ int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(400, 300);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);

709
progs/glsl/shtest.c Normal file
View File

@@ -0,0 +1,709 @@
/*
* Simple shader test harness.
* Brian Paul
* 13 Aug 2009
*
* Usage:
* shtest --vs vertShaderFile --fs fragShaderFile
*
* In this case the given vertex/frag shaders are read and compiled.
* Random values are assigned to the uniforms.
*
* or:
* shtest configFile
*
* In this case a config file is read that specifies the file names
* of the shaders plus initial values for uniforms.
*
* Example config file:
*
* vs shader.vert
* fs shader.frag
* uniform pi 3.14159
* uniform v1 1.0 0.5 0.2 0.3
* texture 0 2D texture0.rgb
* texture 1 CUBE texture1.rgb
* texture 2 RECT texture2.rgb
*
*/
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include "shaderutil.h"
#include "readtex.h"
typedef enum
{
SPHERE,
CUBE,
NUM_SHAPES
} shape;
static char *FragShaderFile = NULL;
static char *VertShaderFile = NULL;
static char *ConfigFile = NULL;
/* program/shader objects */
static GLuint fragShader;
static GLuint vertShader;
static GLuint Program;
#define MAX_UNIFORMS 100
static struct uniform_info Uniforms[MAX_UNIFORMS];
static GLuint NumUniforms = 0;
#define MAX_ATTRIBS 100
static struct attrib_info Attribs[MAX_ATTRIBS];
static GLuint NumAttribs = 0;
/**
* Config file info.
*/
struct config_file
{
struct name_value
{
char name[100];
float value[4];
int type;
} uniforms[100];
int num_uniforms;
};
static GLint win = 0;
static GLboolean Anim = GL_FALSE;
static GLfloat TexRot = 0.0;
static GLfloat xRot = 0.0f, yRot = 0.0f, zRot = 0.0f;
static shape Object = SPHERE;
static float
RandomFloat(float min, float max)
{
int k = rand() % 10000;
float x = min + (max - min) * k / 10000.0;
return x;
}
/** Set new random values for uniforms */
static void
RandomUniformValues(void)
{
GLuint i;
for (i = 0; i < NumUniforms; i++) {
switch (Uniforms[i].type) {
case GL_FLOAT:
Uniforms[i].value[0] = RandomFloat(0.0, 1.0);
break;
case GL_SAMPLER_1D:
case GL_SAMPLER_2D:
case GL_SAMPLER_3D:
case GL_SAMPLER_CUBE:
case GL_SAMPLER_2D_RECT_ARB:
/* don't change sampler values - random values are bad */
break;
default:
Uniforms[i].value[0] = RandomFloat(-1.0, 2.0);
Uniforms[i].value[1] = RandomFloat(-1.0, 2.0);
Uniforms[i].value[2] = RandomFloat(-1.0, 2.0);
Uniforms[i].value[3] = RandomFloat(-1.0, 2.0);
}
}
}
static void
Idle(void)
{
yRot += 2.0;
if (yRot > 360.0)
yRot -= 360.0;
glutPostRedisplay();
}
static void
SquareVertex(GLfloat s, GLfloat t, GLfloat size)
{
GLfloat x = -size + s * 2.0 * size;
GLfloat y = -size + t * 2.0 * size;
GLuint i;
glMultiTexCoord2f(GL_TEXTURE0, s, t);
glMultiTexCoord2f(GL_TEXTURE1, s, t);
glMultiTexCoord2f(GL_TEXTURE2, s, t);
glMultiTexCoord2f(GL_TEXTURE3, s, t);
/* assign (s,t) to the generic attributes */
for (i = 0; i < NumAttribs; i++) {
if (Attribs[i].location >= 0) {
glVertexAttrib2f(Attribs[i].location, s, t);
}
}
glVertex2f(x, y);
}
/*
* Draw a square, specifying normal and tangent vectors.
*/
static void
Square(GLfloat size)
{
GLint tangentAttrib = 1;
glNormal3f(0, 0, 1);
glVertexAttrib3f(tangentAttrib, 1, 0, 0);
glBegin(GL_POLYGON);
#if 1
SquareVertex(0, 0, size);
SquareVertex(1, 0, size);
SquareVertex(1, 1, size);
SquareVertex(0, 1, size);
#else
glTexCoord2f(0, 0); glVertex2f(-size, -size);
glTexCoord2f(1, 0); glVertex2f( size, -size);
glTexCoord2f(1, 1); glVertex2f( size, size);
glTexCoord2f(0, 1); glVertex2f(-size, size);
#endif
glEnd();
}
static void
Cube(GLfloat size)
{
/* +X */
glPushMatrix();
glRotatef(90, 0, 1, 0);
glTranslatef(0, 0, size);
Square(size);
glPopMatrix();
/* -X */
glPushMatrix();
glRotatef(-90, 0, 1, 0);
glTranslatef(0, 0, size);
Square(size);
glPopMatrix();
/* +Y */
glPushMatrix();
glRotatef(90, 1, 0, 0);
glTranslatef(0, 0, size);
Square(size);
glPopMatrix();
/* -Y */
glPushMatrix();
glRotatef(-90, 1, 0, 0);
glTranslatef(0, 0, size);
Square(size);
glPopMatrix();
/* +Z */
glPushMatrix();
glTranslatef(0, 0, size);
Square(size);
glPopMatrix();
/* -Z */
glPushMatrix();
glRotatef(180, 0, 1, 0);
glTranslatef(0, 0, size);
Square(size);
glPopMatrix();
}
static void
Sphere(GLfloat radius, GLint slices, GLint stacks)
{
static GLUquadricObj *q = NULL;
if (!q) {
q = gluNewQuadric();
gluQuadricDrawStyle(q, GLU_FILL);
gluQuadricNormals(q, GLU_SMOOTH);
gluQuadricTexture(q, GL_TRUE);
}
gluSphere(q, radius, slices, stacks);
}
static void
Redisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
glRotatef(yRot, 0.0f, 1.0f, 0.0f);
glRotatef(zRot, 0.0f, 0.0f, 1.0f);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glRotatef(TexRot, 0.0f, 1.0f, 0.0f);
glMatrixMode(GL_MODELVIEW);
if (Object == SPHERE) {
Sphere(2.5, 20, 10);
}
else if (Object == CUBE) {
Cube(2.0);
}
glPopMatrix();
glutSwapBuffers();
}
static void
Reshape(int width, int height)
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -15.0f);
}
static void
CleanUp(void)
{
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(Program);
glutDestroyWindow(win);
}
static void
Key(unsigned char key, int x, int y)
{
const GLfloat step = 2.0;
(void) x;
(void) y;
switch(key) {
case 'a':
Anim = !Anim;
if (Anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
case 'z':
zRot += step;
break;
case 'Z':
zRot -= step;
break;
case 'o':
Object = (Object + 1) % NUM_SHAPES;
break;
case 'r':
RandomUniformValues();
SetUniformValues(Program, Uniforms);
PrintUniforms(Uniforms);
break;
case 27:
CleanUp();
exit(0);
break;
}
glutPostRedisplay();
}
static void
SpecialKey(int key, int x, int y)
{
const GLfloat step = 2.0;
(void) x;
(void) y;
switch(key) {
case GLUT_KEY_UP:
xRot += step;
break;
case GLUT_KEY_DOWN:
xRot -= step;
break;
case GLUT_KEY_LEFT:
yRot -= step;
break;
case GLUT_KEY_RIGHT:
yRot += step;
break;
}
glutPostRedisplay();
}
static void
InitUniforms(const struct config_file *conf,
struct uniform_info uniforms[])
{
int i;
for (i = 0; i < conf->num_uniforms; i++) {
int j;
for (j = 0; uniforms[j].name; j++) {
if (strcmp(uniforms[j].name, conf->uniforms[i].name) == 0) {
uniforms[j].type = conf->uniforms[i].type;
uniforms[j].value[0] = conf->uniforms[i].value[0];
uniforms[j].value[1] = conf->uniforms[i].value[1];
uniforms[j].value[2] = conf->uniforms[i].value[2];
uniforms[j].value[3] = conf->uniforms[i].value[3];
}
}
}
}
static void
LoadTexture(GLint unit, GLenum target, const char *texFileName)
{
GLint imgWidth, imgHeight;
GLenum imgFormat;
GLubyte *image = NULL;
GLuint tex;
GLenum filter = GL_LINEAR;
GLenum objTarget;
image = LoadRGBImage(texFileName, &imgWidth, &imgHeight, &imgFormat);
if (!image) {
printf("Couldn't read %s\n", texFileName);
exit(1);
}
printf("Load Texture: unit %d, target 0x%x: %s %d x %d\n",
unit, target, texFileName, imgWidth, imgHeight);
if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) {
objTarget = GL_TEXTURE_CUBE_MAP;
}
else {
objTarget = target;
}
glActiveTexture(GL_TEXTURE0 + unit);
glGenTextures(1, &tex);
glBindTexture(objTarget, tex);
if (target == GL_TEXTURE_3D) {
/* depth=1 */
gluBuild3DMipmaps(target, 4, imgWidth, imgHeight, 1,
imgFormat, GL_UNSIGNED_BYTE, image);
}
else if (target == GL_TEXTURE_1D) {
gluBuild1DMipmaps(target, 4, imgWidth,
imgFormat, GL_UNSIGNED_BYTE, image);
}
else {
gluBuild2DMipmaps(target, 4, imgWidth, imgHeight,
imgFormat, GL_UNSIGNED_BYTE, image);
}
free(image);
glTexParameteri(objTarget, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(objTarget, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(objTarget, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(objTarget, GL_TEXTURE_MAG_FILTER, filter);
}
static GLenum
TypeFromName(const char *n)
{
static const struct {
const char *name;
GLenum type;
} types[] = {
{ "GL_FLOAT", GL_FLOAT },
{ "GL_FLOAT_VEC2", GL_FLOAT_VEC2 },
{ "GL_FLOAT_VEC3", GL_FLOAT_VEC3 },
{ "GL_FLOAT_VEC4", GL_FLOAT_VEC4 },
{ "GL_INT", GL_INT },
{ "GL_INT_VEC2", GL_INT_VEC2 },
{ "GL_INT_VEC3", GL_INT_VEC3 },
{ "GL_INT_VEC4", GL_INT_VEC4 },
{ "GL_SAMPLER_1D", GL_SAMPLER_1D },
{ "GL_SAMPLER_2D", GL_SAMPLER_2D },
{ "GL_SAMPLER_3D", GL_SAMPLER_3D },
{ "GL_SAMPLER_CUBE", GL_SAMPLER_CUBE },
{ "GL_SAMPLER_2D_RECT", GL_SAMPLER_2D_RECT_ARB },
{ NULL, 0 }
};
GLuint i;
for (i = 0; types[i].name; i++) {
if (strcmp(types[i].name, n) == 0)
return types[i].type;
}
abort();
return GL_NONE;
}
/**
* Read a config file.
*/
static void
ReadConfigFile(const char *filename, struct config_file *conf)
{
char line[1000];
FILE *f;
f = fopen(filename, "r");
if (!f) {
fprintf(stderr, "Unable to open config file %s\n", filename);
exit(1);
}
conf->num_uniforms = 0;
/* ugly but functional parser */
while (!feof(f)) {
fgets(line, sizeof(line), f);
if (!feof(f) && line[0]) {
if (strncmp(line, "vs ", 3) == 0) {
VertShaderFile = strdup(line + 3);
VertShaderFile[strlen(VertShaderFile) - 1] = 0;
}
else if (strncmp(line, "fs ", 3) == 0) {
FragShaderFile = strdup(line + 3);
FragShaderFile[strlen(FragShaderFile) - 1] = 0;
}
else if (strncmp(line, "texture ", 8) == 0) {
char target[100], texFileName[100];
int unit, k;
k = sscanf(line + 8, "%d %s %s", &unit, target, texFileName);
assert(k == 3 || k == 8);
if (strcmp(target, "CUBE") == 0) {
char texFileNames[6][100];
k = sscanf(line + 8, "%d %s %s %s %s %s %s %s",
&unit, target,
texFileNames[0],
texFileNames[1],
texFileNames[2],
texFileNames[3],
texFileNames[4],
texFileNames[5]);
LoadTexture(unit, GL_TEXTURE_CUBE_MAP_POSITIVE_X, texFileNames[0]);
LoadTexture(unit, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, texFileNames[1]);
LoadTexture(unit, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, texFileNames[2]);
LoadTexture(unit, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, texFileNames[3]);
LoadTexture(unit, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, texFileNames[4]);
LoadTexture(unit, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, texFileNames[5]);
}
else if (!strcmp(target, "2D")) {
LoadTexture(unit, GL_TEXTURE_2D, texFileName);
}
else if (!strcmp(target, "3D")) {
LoadTexture(unit, GL_TEXTURE_3D, texFileName);
}
else if (!strcmp(target, "RECT")) {
LoadTexture(unit, GL_TEXTURE_RECTANGLE_ARB, texFileName);
}
else {
printf("Bad texture target: %s\n", target);
exit(1);
}
}
else if (strncmp(line, "uniform ", 8) == 0) {
char name[1000], typeName[100];
int k;
float v1 = 0.0F, v2 = 0.0F, v3 = 0.0F, v4 = 0.0F;
GLenum type;
k = sscanf(line + 8, "%s %s %f %f %f %f", name, typeName,
&v1, &v2, &v3, &v4);
type = TypeFromName(typeName);
strcpy(conf->uniforms[conf->num_uniforms].name, name);
conf->uniforms[conf->num_uniforms].value[0] = v1;
conf->uniforms[conf->num_uniforms].value[1] = v2;
conf->uniforms[conf->num_uniforms].value[2] = v3;
conf->uniforms[conf->num_uniforms].value[3] = v4;
conf->uniforms[conf->num_uniforms].type = type;
conf->num_uniforms++;
}
else {
if (strlen(line) > 1) {
fprintf(stderr, "syntax error in: %s\n", line);
break;
}
}
}
}
fclose(f);
}
static void
Init(void)
{
GLdouble vertTime, fragTime, linkTime;
struct config_file config;
memset(&config, 0, sizeof(config));
if (ConfigFile)
ReadConfigFile(ConfigFile, &config);
if (!VertShaderFile) {
fprintf(stderr, "Error: no vertex shader\n");
exit(1);
}
if (!FragShaderFile) {
fprintf(stderr, "Error: no fragment shader\n");
exit(1);
}
if (!ShadersSupported())
exit(1);
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertShaderFile);
vertTime = GetShaderCompileTime();
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragShaderFile);
fragTime = GetShaderCompileTime();
Program = LinkShaders(vertShader, fragShader);
linkTime = GetShaderLinkTime();
printf("Read vert shader %s\n", VertShaderFile);
printf("Read frag shader %s\n", FragShaderFile);
printf("Time to compile vertex shader: %fs\n", vertTime);
printf("Time to compile fragment shader: %fs\n", fragTime);
printf("Time to link shaders: %fs\n", linkTime);
assert(ValidateShaderProgram(Program));
glUseProgram(Program);
NumUniforms = GetUniforms(Program, Uniforms);
if (config.num_uniforms) {
InitUniforms(&config, Uniforms);
}
else {
RandomUniformValues();
}
SetUniformValues(Program, Uniforms);
PrintUniforms(Uniforms);
NumAttribs = GetAttribs(Program, Attribs);
PrintAttribs(Attribs);
//assert(glGetError() == 0);
glClearColor(0.4f, 0.4f, 0.8f, 0.0f);
glEnable(GL_DEPTH_TEST);
glColor3f(1, 0, 0);
}
static void
Keys(void)
{
printf("Keyboard:\n");
printf(" a Animation toggle\n");
printf(" r Randomize uniform values\n");
printf(" o Change object\n");
printf(" arrows Rotate object\n");
printf(" ESC Exit\n");
}
static void
Usage(void)
{
printf("Usage:\n");
printf(" shtest config.shtest\n");
printf(" Run w/ given config file.\n");
printf(" shtest --vs vertShader --fs fragShader\n");
printf(" Load/compile given shaders.\n");
}
static void
ParseOptions(int argc, char *argv[])
{
int i;
if (argc == 1) {
Usage();
exit(1);
}
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "--fs") == 0) {
FragShaderFile = argv[i+1];
i++;
}
else if (strcmp(argv[i], "--vs") == 0) {
VertShaderFile = argv[i+1];
i++;
}
else {
/* assume the arg is a config file */
ConfigFile = argv[i];
break;
}
}
}
int
main(int argc, char *argv[])
{
glutInitWindowSize(400, 400);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
glutDisplayFunc(Redisplay);
ParseOptions(argc, argv);
Init();
Keys();
glutMainLoop();
return 0;
}

View File

@@ -103,6 +103,8 @@ static float Sin(float a)
static void
Redisplay(void)
{
float cx = 0.5 * WinWidth, cy = 0.5 * WinHeight;
float len = 0.5 * WinWidth - 20.0;
int i;
glClear(GL_COLOR_BUFFER_BIT);
@@ -114,20 +116,20 @@ Redisplay(void)
for (i = 0; i < 360; i+=5) {
float v0[2], v1[2];
v0[0] = 150 + 40 * Cos(i);
v0[1] = 150 + 40 * Sin(i);
v1[0] = 150 + 130 * Cos(i);
v1[1] = 150 + 130 * Sin(i);
v0[0] = cx + 40 * Cos(i);
v0[1] = cy + 40 * Sin(i);
v1[0] = cx + len * Cos(i);
v1[1] = cy + len * Sin(i);
QuadLine(v0, v1, Width);
}
{
float v0[2], v1[2], x;
for (x = 0; x < 1.0; x += 0.2) {
v0[0] = 150 + x;
v0[1] = 150 + x * 40 - 20;
v1[0] = 150 + x + 5.0;
v1[1] = 150 + x * 40 - 20;
v0[0] = cx + x;
v0[1] = cy + x * 40 - 20;
v1[0] = cx + x + 5.0;
v1[1] = cy + x * 40 - 20;
QuadLine(v0, v1, Width);
}
}
@@ -142,6 +144,8 @@ Redisplay(void)
static void
Reshape(int width, int height)
{
WinWidth = width;
WinHeight = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -351,7 +355,6 @@ int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);

View File

@@ -53,14 +53,14 @@ static int win = 0;
static struct uniform_info ReflectUniforms[] = {
{ "cubeTex", 1, GL_INT, { 0, 0, 0, 0 }, -1 },
{ "lightPos", 3, GL_FLOAT, { 10, 10, 20, 0 }, -1 },
{ "cubeTex", 1, GL_SAMPLER_CUBE, { 0, 0, 0, 0 }, -1 },
{ "lightPos", 1, GL_FLOAT_VEC3, { 10, 10, 20, 0 }, -1 },
END_OF_UNIFORMS
};
static struct uniform_info SimpleUniforms[] = {
{ "tex2d", 1, GL_INT, { 1, 0, 0, 0 }, -1 },
{ "lightPos", 3, GL_FLOAT, { 10, 10, 20, 0 }, -1 },
{ "tex2d", 1, GL_SAMPLER_2D, { 1, 0, 0, 0 }, -1 },
{ "lightPos", 1, GL_FLOAT_VEC3, { 10, 10, 20, 0 }, -1 },
END_OF_UNIFORMS
};
@@ -382,7 +382,8 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile,
glUseProgram(program);
InitUniforms(program, uniforms);
SetUniformValues(program, uniforms);
PrintUniforms(uniforms);
return program;
}

View File

@@ -24,18 +24,18 @@ static GLuint program;
static struct uniform_info Uniforms[] = {
{ "LightDir", 4, GL_FLOAT, { 0.57737, 0.57735, 0.57735, 0.0 }, -1 },
{ "HVector", 4, GL_FLOAT, { 0.32506, 0.32506, 0.88808, 0.0 }, -1 },
{ "BallCenter", 4, GL_FLOAT, { 0.0, 0.0, 0.0, 1.0 }, -1 },
{ "SpecularColor", 4, GL_FLOAT, { 0.4, 0.4, 0.4, 60.0 }, -1 },
{ "Red", 4, GL_FLOAT, { 0.6, 0.0, 0.0, 1.0 }, -1 },
{ "Blue", 4, GL_FLOAT, { 0.0, 0.3, 0.6, 1.0 }, -1 },
{ "Yellow", 4, GL_FLOAT, { 0.6, 0.5, 0.0, 1.0 }, -1 },
{ "HalfSpace0", 4, GL_FLOAT, { 1.0, 0.0, 0.0, 0.2 }, -1 },
{ "HalfSpace1", 4, GL_FLOAT, { 0.309016994, 0.951056516, 0.0, 0.2 }, -1 },
{ "HalfSpace2", 4, GL_FLOAT, { -0.809016994, 0.587785252, 0.0, 0.2 }, -1 },
{ "HalfSpace3", 4, GL_FLOAT, { -0.809016994, -0.587785252, 0.0, 0.2 }, -1 },
{ "HalfSpace4", 4, GL_FLOAT, { 0.309116994, -0.951056516, 0.0, 0.2 }, -1 },
{ "LightDir", 1, GL_FLOAT_VEC4, { 0.57737, 0.57735, 0.57735, 0.0 }, -1 },
{ "HVector", 1, GL_FLOAT_VEC4, { 0.32506, 0.32506, 0.88808, 0.0 }, -1 },
{ "BallCenter", 1, GL_FLOAT_VEC4, { 0.0, 0.0, 0.0, 1.0 }, -1 },
{ "SpecularColor", 1, GL_FLOAT_VEC4, { 0.4, 0.4, 0.4, 60.0 }, -1 },
{ "Red", 1, GL_FLOAT_VEC4, { 0.6, 0.0, 0.0, 1.0 }, -1 },
{ "Blue", 1, GL_FLOAT_VEC4, { 0.0, 0.3, 0.6, 1.0 }, -1 },
{ "Yellow", 1, GL_FLOAT_VEC4, { 0.6, 0.5, 0.0, 1.0 }, -1 },
{ "HalfSpace0", 1, GL_FLOAT_VEC4, { 1.0, 0.0, 0.0, 0.2 }, -1 },
{ "HalfSpace1", 1, GL_FLOAT_VEC4, { 0.309016994, 0.951056516, 0.0, 0.2 }, -1 },
{ "HalfSpace2", 1, GL_FLOAT_VEC4, { -0.809016994, 0.587785252, 0.0, 0.2 }, -1 },
{ "HalfSpace3", 1, GL_FLOAT_VEC4, { -0.809016994, -0.587785252, 0.0, 0.2 }, -1 },
{ "HalfSpace4", 1, GL_FLOAT_VEC4, { 0.309116994, -0.951056516, 0.0, 0.2 }, -1 },
{ "InOrOutInit", 1, GL_FLOAT, { -3.0, 0, 0, 0 }, -1 },
{ "StripeWidth", 1, GL_FLOAT, { 0.3, 0, 0, 0 }, -1 },
{ "FWidth", 1, GL_FLOAT, { 0.005, 0, 0, 0 }, -1 },
@@ -173,7 +173,8 @@ Init(void)
glUseProgram(program);
InitUniforms(program, Uniforms);
SetUniformValues(program, Uniforms);
PrintUniforms(Uniforms);
assert(glGetError() == 0);
@@ -204,7 +205,6 @@ int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);

17
progs/glsl/toyball.shtest Normal file
View File

@@ -0,0 +1,17 @@
vs CH11-toyball.vert
fs CH11-toyball.frag
uniform LightDir GL_FLOAT_VEC4 0.57737 0.57735 0.57735 0.0
uniform HVector GL_FLOAT_VEC4 0.32506 0.32506 0.88808 0.0
uniform BallCenter GL_FLOAT_VEC4 0.0 0.0 0.0 1.0
uniform SpecularColor GL_FLOAT_VEC4 0.4 0.4 0.4 60.0
uniform Red GL_FLOAT_VEC4 0.6 0.0 0.0 1.0
uniform Blue GL_FLOAT_VEC4 0.0 0.3 0.6 1.0
uniform Yellow GL_FLOAT_VEC4 0.6 0.5 0.0 1.0
uniform HalfSpace0 GL_FLOAT_VEC4 1.0 0.0 0.0 0.2
uniform HalfSpace1 GL_FLOAT_VEC4 .309016994 0.951056516 0.0 0.2
uniform HalfSpace2 GL_FLOAT_VEC4 -0.809016994 0.587785252 0.0 0.2
uniform HalfSpace3 GL_FLOAT_VEC4 -0.809016994 -0.587785252 0.0 0.2
uniform HalfSpace4 GL_FLOAT_VEC4 .309116994 -0.951056516 0.0 0.2
uniform InOrOutInit GL_FLOAT -3.0
uniform StripeWidth GL_FLOAT 0.3
uniform FWidth GL_FLOAT .005

View File

@@ -239,7 +239,6 @@ int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);

View File

@@ -285,7 +285,6 @@ int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);

View File

@@ -173,7 +173,6 @@ int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition( 0, 0);
glutInitWindowSize(400, 200);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
Win = glutCreateWindow(argv[0]);

View File

@@ -43,7 +43,7 @@ static GLfloat xRot = -70.0f, yRot = 0.0f, zRot = 0.0f;
/* value[0] = tex unit */
static struct uniform_info Uniforms[] = {
{ "tex1", 1, GL_INT, { 0, 0, 0, 0 }, -1 },
{ "tex1", 1, GL_SAMPLER_2D, { 0, 0, 0, 0 }, -1 },
END_OF_UNIFORMS
};

View File

@@ -0,0 +1,39 @@
# progs/vg/Makefile
TOP = ../../..
include $(TOP)/configs/current
VG_LIBS=-lm -pthread -lX11 -lEGL -lOpenVG
INCLUDE_DIRS = -I$(TOP)/include
PROGRAMS = \
lion \
sp
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
default: $(PROGRAMS)
lion: lion.o lion-render.o
$(CC) $(CFLAGS) lion.o lion-render.o -L$(TOP)/$(LIB_DIR) $(VG_LIBS) -o $@
lion.o: lion.c lion-render.h $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include lion.c
lion-render.o: lion-render.c lion-render.h $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include lion-render.c
sp: sp.c eglcommon.o
$(CC) $(INCLUDE_DIRS) $(CFLAGS) $^ -L$(TOP)/$(LIB_DIR) $(LIBS) $(VG_LIBS) $(APP_LIB_DEPS) -o $@
eglcommon.o: eglcommon.c $(HEADERS)
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) eglcommon.c
clean:
rm -f *.o *~
rm -f *.so
rm -f $(PROGRAMS)

View File

@@ -0,0 +1,288 @@
#include "eglcommon.h"
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <VG/openvg.h> /* using full OpenGL for now */
#include <GLES/egl.h>
static init_func init = 0;
static draw_func draw = 0;
static reshape_func reshape = 0;
static key_func keyPress = 0;
static VGint width = 300, height = 300;
void set_window_size(int w, int h)
{
width = w;
height = h;
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENVG_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
while (1) {
int redraw = 0;
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
if (reshape) {
width = event.xconfigure.width;
height = event.xconfigure.height;
reshape(event.xconfigure.width, event.xconfigure.height);
}
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (!keyPress || !keyPress(code)) {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
if (redraw) {
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
}
int window_width(void)
{
return width;
}
int window_height(void)
{
return height;
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int run(int argc, char **argv,
init_func init_f,
reshape_func resh_f,
draw_func draw_f,
key_func key_f)
{
const int winWidth = width, winHeight = height;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
init = init_f;
draw = draw_f;
reshape = resh_f;
keyPress = key_f;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"OpenVG Example", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("VG_RENDERER = %s\n", (char *) vgGetString(VG_RENDERER));
printf("VG_VERSION = %s\n", (char *) vgGetString(VG_VERSION));
printf("VG_VENDOR = %s\n", (char *) vgGetString(VG_VENDOR));
}
if (init)
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
if (reshape)
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglMakeCurrent(egl_dpy, 0, 0, 0);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

View File

@@ -0,0 +1,20 @@
#ifndef EGLCOMMON_H
#define EGLCOMMON_H
typedef void (*init_func)();
typedef void (*reshape_func)(int, int);
typedef void (*draw_func)();
typedef int (*key_func)(unsigned key);
void set_window_size(int width, int height);
int window_width(void);
int window_height(void);
int run(int argc, char **argv,
init_func init,
reshape_func resh,
draw_func draw,
key_func key);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,16 @@
#ifndef LION_RENDER_H
#define LION_RENDER_H
#include <VG/openvg.h>
#define LION_SIZE 132
struct lion {
VGPath paths[LION_SIZE];
VGPaint fills[LION_SIZE];
};
struct lion *lion_create(void);
void lion_render(struct lion *l);
void lion_destroy(struct lion *l);
#endif

288
progs/openvg/demos/lion.c Normal file
View File

@@ -0,0 +1,288 @@
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <VG/openvg.h>
#include <GLES/egl.h>
#include "lion-render.h"
static VGint width, height;
struct lion *lion = 0;
VGfloat angle = 0;
static void
draw(void)
{
vgClear(0, 0, width, height);
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
vgLoadIdentity();
vgTranslate(width/2, height/2);
vgRotate(angle);
vgTranslate(-width/2, -height/2);
lion_render(lion);
++angle;
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
width = w;
height = h;
}
static void
init(void)
{
float clear_color[4] = {1.0, 1.0, 1.0, 1.0};
vgSetfv(VG_CLEAR_COLOR, 4, clear_color);
lion = lion_create();
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENVG_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
while (1) {
XEvent event;
while (XPending(dpy) > 0) {
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
break;
default:
; /*no-op*/
}
}
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 350, winHeight = 450;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"Lion Example", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("VG_RENDERER = %s\n", (char *) vgGetString(VG_RENDERER));
printf("VG_VERSION = %s\n", (char *) vgGetString(VG_VERSION));
printf("VG_VENDOR = %s\n", (char *) vgGetString(VG_VENDOR));
}
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

537
progs/openvg/demos/sp.c Normal file
View File

@@ -0,0 +1,537 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <VG/vgu.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <X11/keysym.h>
#define ELEMENTS(x) (sizeof(x)/sizeof((x)[0]))
struct object {
VGPath path;
VGPaint fill;
VGPaint stroke;
VGint draw_mode;
VGfloat matrix[9];
VGfloat stroke_width;
};
struct character {
struct object objects[32];
VGint num_objects;
};
VGfloat identity_matrix[] = {1, 0, 0, 0, 1, 0, 0, 0, 1};
struct character cartman;
static void add_object_fill(const VGubyte *segments, VGint num_segments,
const VGfloat *coords,
VGuint color)
{
struct object object;
object.path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
1, 0, 0, 0, VG_PATH_CAPABILITY_ALL);
vgAppendPathData(object.path, num_segments, segments, coords);
object.fill = vgCreatePaint();
vgSetColor(object.fill, color);
memcpy(object.matrix, identity_matrix, 9 * sizeof(VGfloat));
object.draw_mode = VG_FILL_PATH;
cartman.objects[cartman.num_objects] = object;
++cartman.num_objects;
}
static void add_object_stroke(const VGubyte *segments, VGint num_segments,
const VGfloat *coords,
VGuint color, VGfloat width)
{
struct object object;
object.path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
1, 0, 0, 0, VG_PATH_CAPABILITY_ALL);
vgAppendPathData(object.path, num_segments, segments, coords);
object.stroke = vgCreatePaint();
vgSetColor(object.stroke, color);
memcpy(object.matrix, identity_matrix, 9 * sizeof(VGfloat));
object.draw_mode = VG_STROKE_PATH;
object.stroke_width = width;
cartman.objects[cartman.num_objects] = object;
++cartman.num_objects;
}
static void add_object_fillm(const VGubyte *segments, VGint num_segments,
const VGfloat *coords,
VGuint color,
VGfloat *matrix)
{
struct object object;
object.path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
1, 0, 0, 0, VG_PATH_CAPABILITY_ALL);
vgAppendPathData(object.path, num_segments, segments, coords);
object.fill = vgCreatePaint();
vgSetColor(object.fill, color);
memcpy(object.matrix, matrix, 9 * sizeof(VGfloat));
object.draw_mode = VG_FILL_PATH;
cartman.objects[cartman.num_objects] = object;
++cartman.num_objects;
}
static void add_object_m(const VGubyte *segments, VGint num_segments,
const VGfloat *coords,
VGuint fill_color,
VGuint stroke_color, VGfloat stroke_width,
VGfloat *matrix)
{
struct object object;
object.path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
1, 0, 0, 0, VG_PATH_CAPABILITY_ALL);
vgAppendPathData(object.path, num_segments, segments, coords);
memcpy(object.matrix, matrix, 9 * sizeof(VGfloat));
object.fill = vgCreatePaint();
vgSetColor(object.fill, fill_color);
object.draw_mode = VG_FILL_PATH | VG_STROKE_PATH;
object.stroke = vgCreatePaint();
vgSetColor(object.stroke, stroke_color);
object.stroke_width = stroke_width;
cartman.objects[cartman.num_objects] = object;
++cartman.num_objects;
}
static void init_character()
{
{
const VGubyte segments[] = {VG_MOVE_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CLOSE_PATH};
const VGfloat coords[] = {181.83267, 102.60408,
181.83267,102.60408, 185.53793,114.5749, 186.5355,115.00243,
187.53306,115.42996, 286.0073,115.00243, 286.0073,115.00243,
286.0073,115.00243, 292.70526,103.45914, 290.85263,101.03648,
289.00001,98.61381, 181.54765,102.31906, 181.83267,102.60408
};
VGuint color = 0x7c4e32ff;
add_object_fill(segments, ELEMENTS(segments),
coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_LINE_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CLOSE_PATH
};
const VGfloat coords[] = {188.62208,50.604156,
188.62208,50.604156, 176.73127,60.479579, 170.68509,69.548844,
164.63892,78.618109, 175.11895,79.827344, 175.11895,79.827344,
176.52973,98.368952,
176.52973,98.368952, 189.83131,110.05823, 208.97754,110.25976,
228.12377,110.46131, 244.24691,111.67054, 247.06846,110.25976,
249.89,108.849, 258.95927,106.8336, 260.16851,105.01975,
261.37774,103.2059, 296.84865,106.43053, 297.05019,91.919698,
297.25172,77.408874, 306.11945,64.308824, 282.13628,51.611853,
258.15311,38.914882, 189.2267,49.999539, 188.62208,50.604156
};
VGuint color = 0xe30000ff;
add_object_fill(segments, ELEMENTS(segments),
coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CLOSE_PATH
};
const VGfloat coords[] = {
68.25, 78.875,
68.25,93.296, 54.642,105, 37.875,105,
21.108,105, 7.5,93.296, 7.5,78.875,
7.5,64.454, 21.108,52.75, 37.875,52.75,
54.642,52.75, 68.25,64.454, 68.25,78.875
};
VGuint color = 0xffe1c4ff;
VGfloat matrix[] = {
1.6529, 0, 0,
0, 1.582037, 0,
172.9649,-90.0116, 1
};
add_object_fillm(segments, ELEMENTS(segments),
coords, color, matrix);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
170.14687,71.536958,
173.53626,68.814326, 176.70232,68.971782, 180.55009,71.679467,
184.39785,74.387153, 199.19294,80.036105, 191.52334,86.500482,
189.02942,88.6025, 183.97032,85.787933, 180.26507,86.928011,
178.8737,87.356121, 174.71827,89.783259, 171.8028,87.494856,
166.95426,83.689139, 163.51779,76.861986, 170.14687,71.536958
};
VGuint color = 0xfff200ff;
add_object_fill(segments, ELEMENTS(segments),
coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
299.83075,66.834136,
299.83075,66.834136, 287.85993,64.69649, 284.15467,72.962055,
280.44942,81.227621, 280.1644,78.234916, 280.1644,79.374994,
280.1644,80.515072, 278.16927,84.077816, 284.86722,83.792796,
291.56518,83.507777, 291.99271,86.785501, 294.84291,86.642991,
297.6931,86.500482, 303.536,85.645423, 303.67851,80.657582,
303.82102,75.66974, 302.68094,65.551548, 299.83075,66.834136
};
VGuint color = 0xfff200ff;
add_object_fill(segments, ELEMENTS(segments),
coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS
};
const VGfloat coords[] = {
240.83171,75.81225,
240.83171,75.81225, 241.54426,88.495618, 242.25681,91.488323,
242.96936,94.481028, 240.6892,108.01945, 240.83171,110.01459,
240.97422,112.00973, 240.97422,111.01216, 240.97422,111.01216
};
VGuint color = 0x000000ff;
VGfloat swidth = 1.14007807;
add_object_stroke(segments, ELEMENTS(segments), coords, color, swidth);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
83.375, 95.5,
83.375,96.121, 83.067,96.625, 82.6875,96.625,
82.308,96.625, 82,96.121, 82,95.5,
82,94.879, 82.308,94.375, 82.6875,94.375,
83.066677,94.375, 83.374492,94.878024, 83.374999,95.498494,
82.6875,95.5,
83.375,95.5
};
VGuint fill_color = 0x000000ff;
VGuint stroke_color = 0x000000ff;
VGfloat swidth = 0.60000002;
VGfloat matrix1[] = {
1.140078, 0, 0,
0, 1.140078, 0,
145.4927, -15.10897, 1
};
VGfloat matrix2[] = {
1.140078,0, 0,
0,1.140078, 0,
144.2814,-27.93485, 1
};
VGfloat matrix3[] = {
1.140078,0, 0,
0,1.140078, 0,
144.1388,-3.70819, 1
};
add_object_m(segments, ELEMENTS(segments), coords,
fill_color, stroke_color, swidth, matrix1);
add_object_m(segments, ELEMENTS(segments), coords,
fill_color, stroke_color, swidth, matrix2);
add_object_m(segments, ELEMENTS(segments), coords,
fill_color, stroke_color, swidth, matrix3);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_LINE_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
179.41001,115.28745,
179.41001,115.28745, 207.48443,109.30204, 236.84144,115.14494,
236.84144,115.14494, 274.74903,109.87208, 291.8502,115.42996,
179.41001,115.28745
};
VGuint color = 0x000000ff;
add_object_fill(segments, ELEMENTS(segments),
coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
83.792156,68.157364,
83.792156,69.669865, 82.72301,70.897403, 81.40567,70.897403,
80.08833,70.897403, 79.019185,69.669865, 79.019185,68.157364,
79.019185,66.644862, 80.08833,65.417325, 81.40567,65.417325,
82.721887,65.417325, 83.790391,66.642485, 83.792153,68.153696,
81.40567,68.157364,
83.792156,68.157364
};
VGuint fill_color = 0x000000ff;
VGuint stroke_color = 0x000000ff;
VGfloat swidth = 0.52891117;
VGfloat matrix1[] = {
1.140078,0, 0,
0,1.140078, 0,
145.2489,-15.58714, 1
};
add_object_m(segments, ELEMENTS(segments), coords,
fill_color, stroke_color, swidth, matrix1);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS
};
const VGfloat coords[] = {
232.28113,66.976646,
232.28113,66.976646, 237.98152,70.539389, 245.39202,66.549116
};
VGuint color = 0x000000ff;
VGfloat swidth = 0.60299999;
add_object_stroke(segments, ELEMENTS(segments), coords, color, swidth);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
185.96908,30.061986,
185.96908,30.061986, 187.76995,14.508377, 203.23909,3.7427917,
209.95028,-0.92779696, 219.37764,-4.9841866, 232.1078,-6.00046,
246.13578,-7.1203411, 256.92106,-2.8560739, 264.81774,1.9451947,
280.60485,11.543934, 284.31582,25.937274, 284.08015,26.526452,
283.7266,27.410336, 240.83461,1.9346323, 185.96908,30.061986
};
VGuint color = 0x8ed8f8ff;
add_object_fill(segments, ELEMENTS(segments), coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_CUBIC_TO_ABS,
VG_LINE_TO_ABS, VG_CUBIC_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
185.39542,32.061757,
185.82295,29.211562,
185.82295,29.211562, 234.70379,2.277219, 284.01217,25.078779,
284.86722,27.643954,
284.86722,27.643954, 236.69893,4.5573746, 185.39542,32.061757
};
VGuint color = 0xfff200ff;
add_object_fill(segments, ELEMENTS(segments), coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
219.74027,-5.917093,
220.49206,-8.44929, 225.15564,-10.904934, 230.21473,-11.189954,
235.27383,-11.474973, 243.27521,-13.287236, 249.21385,-5.724198,
249.89961,-4.850868, 249.28247,-4.332166, 248.62298,-3.971398,
247.79117,-3.516361, 247.13703,-3.392737, 246.16222,-3.408047,
243.63973,-3.447664, 242.54183,-3.850701, 242.54183,-3.850701,
242.54183,-3.850701, 238.78367,-1.737343, 236.20014,-3.565682,
233.88436,-5.204544, 234.27626,-4.56325, 234.27626,-4.56325,
234.27626,-4.56325, 232.33303,-2.975658, 230.85603,-2.995643,
228.59433,-3.025282, 227.73672,-4.501857, 227.21966,-4.93027,
226.76318,-4.932008, 226.50948,-4.491995, 226.50948,-4.491995,
226.50948,-4.491995, 224.53199,-2.085883, 222.51431,-2.467064,
221.48814,-2.66093, 218.91968,-3.15318, 219.74027,-5.917093
};
VGuint color = 0xfff200ff;
add_object_fill(segments, ELEMENTS(segments), coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
178.97347,166.06432,
178.97347,181.2154, 168.0245,193.51193, 154.53381,193.51193,
141.04312,193.51193, 130.09416,181.2154, 130.09416,166.06432,
130.09416,150.91323, 141.04312,138.6167, 154.53381,138.6167,
168.0245,138.6167, 178.97347,150.91323, 178.97347,166.06432
};
VGuint color = 0xffffffff;
VGfloat matrix1[] = {
0.466614,-0.23492, 0,
0.108683,0.436638, 0,
134.5504,-0.901632, 1
};
VGfloat matrix2[] = {
-0.466614,-0.23492, 0,
-0.108683,0.436638, 0,
338.4496,-0.512182, 1
};
add_object_fillm(segments, ELEMENTS(segments), coords, color, matrix1);
add_object_fillm(segments, ELEMENTS(segments), coords, color, matrix2);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
123.82758,165.06168,
123.82758,166.79125, 122.59232,168.19497, 121.07029,168.19497,
119.54826,168.19497, 118.313,166.79125, 118.313,165.06168,
118.313,163.3321, 119.54826,161.92839, 121.07029,161.92839,
122.59232,161.92839, 123.82758,163.3321, 123.82758,165.06168
};
VGuint color = 0x000000ff;
VGfloat matrix1[] = {
0.525719,0, 0,
0,0.479931, 0,
178.9702,-43.3532, 1
};
VGfloat matrix2[] = {
0.525719,0, 0,
0,0.479931, 0,
165.258,-43.46162, 1
};
add_object_fillm(segments, ELEMENTS(segments), coords, color, matrix1);
add_object_fillm(segments, ELEMENTS(segments), coords, color, matrix2);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS
};
const VGfloat coords[] = {
197.25,54.5,
197.25,54.5, 211.75,71.5, 229.25,71.5,
246.75,71.5, 261.74147,71.132714, 277.75,50.75
};
VGuint color = 0x000000ff;
VGfloat swidth = 0.60299999;
add_object_stroke(segments, ELEMENTS(segments), coords, color, swidth);
}
}
static void
init(void)
{
float clear_color[4] = {1.0, 1.0, 1.0, 1.0};
vgSetfv(VG_CLEAR_COLOR, 4, clear_color);
init_character();
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
}
static int
key_press(unsigned key)
{
switch(key) {
case XK_Right:
break;
case XK_Left:
break;
case XK_Up:
break;
case XK_Down:
break;
case 'a':
break;
case 's':
break;
default:
break;
}
return VG_FALSE;
}
static void
draw(void)
{
VGint i;
VGfloat save_matrix[9];
vgClear(0, 0, window_width(), window_height());
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
vgLoadIdentity();
vgScale(2, 2);
vgTranslate(160, 60);
vgRotate(180);
vgTranslate(-160, -100);
vgGetMatrix(save_matrix);
for (i = 0; i < cartman.num_objects; ++i) {
struct object object = cartman.objects[i];
if ((object.draw_mode & VG_STROKE_PATH)) {
vgSetf(VG_STROKE_LINE_WIDTH, object.stroke_width);
vgSetPaint(object.stroke, VG_STROKE_PATH);
}
if ((object.draw_mode & VG_FILL_PATH))
vgSetPaint(object.fill, VG_FILL_PATH);
vgMultMatrix(object.matrix);
vgDrawPath(object.path, object.draw_mode);
vgLoadMatrix(save_matrix);
}
vgFlush();
}
int main(int argc, char **argv)
{
set_window_size(400, 400);
return run(argc, argv, init, reshape, draw, key_press);
}

View File

@@ -0,0 +1,127 @@
# These programs aren't intended to be included with the normal distro.
# They're not too interesting but they're good for testing.
TOP = ../../../
include $(TOP)/configs/current
INCLUDES = -I. -I$(TOP)/include
LIBS=-L$(TOP)/$(LIB_DIR) -lm -lX11 -lEGL -lOpenVG -lpthread
CFLAGS += $(INCLUDES)
HEADERS=eglcommon.h
PROGRAMS = \
arc \
cap \
clear \
coord \
dash \
ellipse \
filter \
gradorigin \
lineto \
lingrad \
lookup \
mask4 \
mask \
path3 \
radialgrad \
readpixels \
roundedrect \
star-nonzero \
star-oddeven \
stroke2 \
stroke \
vguarc
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
default: $(PROGRAMS)
arc: arc.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
cap: cap.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
clear: clear.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
coord: coord.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
dash: dash.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
ellipse: ellipse.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
filter: filter.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
gradorigin: gradorigin.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
image: image.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
lineto: lineto.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
lingrad: lingrad.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
lookup: lookup.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
mask: mask.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
mask4: mask4.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
path3: path3.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
pattern: pattern.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
radialgrad: radialgrad.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
readpixels: readpixels.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
roundedrect: roundedrect.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
star-nonzero: star-nonzero.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
star-oddeven: star-oddeven.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
stroke: stroke.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
stroke2: stroke2.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
vguarc: vguarc.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
eglcommon.o: eglcommon.c $(HEADERS)
$(CC) -c $(CFLAGS) eglcommon.c
clean:
rm -f *.o *~
rm -f *.so
rm -f $(PROGRAMS)

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