Compare commits

...

235 Commits

Author SHA1 Message Date
Brian Paul
ea4fe661d7 merge from texman branch 2006-03-26 05:22:17 +00:00
Brian Paul
4cbd16ed3f fix some PFNGL* typedefs 2006-03-26 05:09:03 +00:00
Brian Paul
06049e2416 remove carriage returns 2006-03-25 22:52:39 +00:00
Brian Paul
753af3a206 fix issue in _mesa_free_framebuffer_data() 2006-03-25 17:57:52 +00:00
Brian Paul
70207b70c5 check for incomplete FBO in _mesa_Clear() 2006-03-25 16:16:37 +00:00
Brian Paul
1bbc203c6e Clean up the recent code related to texture_override(). Pass params in a
more logical order.
Remove a mess of stray ^M chars.
Fix a bug when checking if the texture object's format is GL_COLOR_INDEX
or GL_DEPTH_COMPONENT.  This fixes a segfault when GL_TEXTURE_BASE_LEVEL!=0.
2006-03-24 23:53:50 +00:00
Brian Paul
6494541eaa lots of debug options, some code movement, etc 2006-03-24 23:17:06 +00:00
Brian Paul
590cd26006 added some missing formats in _mesa_source/dest_buffer_exists() 2006-03-24 22:53:00 +00:00
Aapo Tahkola
ed4ab13cef Make ARB_vp backends happy with nv arl 2006-03-24 16:35:08 +00:00
Aapo Tahkola
af8d39861d secondary color fixes. 2006-03-24 16:33:34 +00:00
Brian Paul
c4f2710f9d Added -l option for explicit locking around Xlib and GLX calls in
threaded code.  Seems to improve reliability quite a bit.
2006-03-23 17:17:23 +00:00
Brian Paul
436d72e994 Added -p option to create a display connection per thread.
This seems more stabile than using one display connection for all threads.
Still get an occasional Xlib: unexpected async reply error, unfortunately.
2006-03-23 16:58:22 +00:00
Dave Airlie
d76ef5867d make solo build complete 2006-03-23 04:20:37 +00:00
Dave Airlie
0a6040dc2d fix coverity 1107: use after free 2006-03-23 04:15:29 +00:00
Dave Airlie
eab896cc21 fix coverity 926: use before NULL check 2006-03-23 04:13:37 +00:00
Brian Paul
f756924fa5 Need to check for new state and do readpixels/drawpixels clipping after
we call RENDER_START since that may involve validating the drawable and
updating its dimensions.
2006-03-22 22:02:07 +00:00
Aapo Tahkola
4fafe6390b implement arl and enable hw nv_vp. 2006-03-22 21:29:27 +00:00
Aapo Tahkola
6fc864b9e6 ARL dst idx was undefined. 2006-03-22 21:29:15 +00:00
Brian Paul
daffbe99dc GL_EXT_packed_depth_stencil should be off by default 2006-03-21 21:57:00 +00:00
Michal Krol
8995544bc9 Silencium gcc warnings. 2006-03-21 10:59:14 +00:00
Michal Krol
071357096e GLSL fixes:
- generate error on NULL pointers in glShaderSourceARB;
- reinstall program object, if current, in glLinkProgramARB;
- vertex and fragment shaders are optional in program object;
- floor asm was wrongly computed for x86 back-end;
- allow for (void) idiom in function prototypes;
- all fixed-state uniforms are updated;
- local variable initializers are working;
- implement texture* and shadow* functions for vertex processor;
- generate error if too many arguments in general constructor;
- trim unused data in general constructor;
- struct r-value field select was badly relocated;

Changes:
- add derived state gl_fog_attrib::_Scale;
- add derived state gl_light::_CosCutoffNeg;
2006-03-21 10:37:40 +00:00
Brian Paul
519b23b21f Lots of changes/fixes for rendering to framebuffer objects.
- When deleting texture objects, unbind from FBOs if necessary.
- Changed driver hooks for starting/ending render to texture.
- Now properly handle case where gl[Copy]TexImage() is called after
  glFramebufferTexture[123]D().  That didn't work before.
2006-03-20 18:51:57 +00:00
Brian Paul
4991888fa0 additional assertions and debug code for testing FBO completeness 2006-03-20 15:27:55 +00:00
Brian Paul
34bd1233a9 additional error checking to be sure source renderbuffer exists for glCopyTex[Sub]Image() 2006-03-20 15:27:33 +00:00
Brian Paul
457fb0e128 use new _mesa_sourc/dest_buffer_exists() functions 2006-03-20 15:26:20 +00:00
Brian Paul
7275d4d097 added _mesa_source/dest_buffer_exists() function to easily test if particular renderbuffers are present 2006-03-20 15:25:18 +00:00
Brian Paul
f1038f81e4 fix some buffer binding tests in _mesa_make_current() 2006-03-20 15:20:57 +00:00
Brian Paul
c27c382acc slightly improved error message 2006-03-20 15:20:30 +00:00
Aapo Tahkola
5319ed0e53 Fix texrect upload conflicts. 2006-03-20 13:37:28 +00:00
Aapo Tahkola
070f280895 Disable tnl programs when doing software vertex programs. compiz with its texrect and lighting needs was broken because of this. 2006-03-19 21:17:14 +00:00
Brian Paul
096dd541bd minor clean-ups 2006-03-19 19:07:12 +00:00
Aapo Tahkola
77174f0072 -fix texrect fallback when using vtxfmt_a (glitz, xgl, etc.)
-struct vertex_buffer to struct radeon_vertex_buffer conversion
-vertex attrib arrays did not supersede conventinal arrays when enabled
2006-03-19 18:04:12 +00:00
Brian Paul
21a4fb4137 Queries of GL_READ_BUFFER and GL_DRAW_BUFFER were still returning the
pre-GL_EXT_framebuffer_object state.  Now return the read/draw state stored
in the framebuffer objects.
2006-03-19 00:10:22 +00:00
Brian Paul
19b05d5009 Don't call Driver->Bitmap() if no image to render 2006-03-18 21:46:17 +00:00
Jouk Jansen
2d2af2dcf7 Committing in .
Mesa/src/mesa/main/imports.h : removed <CR>
 Mesa/src/mesa/shader/slang/descrip.mms : added new sources

 Modified Files:
 	Mesa/src/mesa/main/imports.h
 	Mesa/src/mesa/shader/slang/descrip.mms
 ----------------------------------------------------------------------
2006-03-17 14:38:41 +00:00
Brian Paul
eec33cc310 Init FogCoordFuncs[0..5] too, remove some unneeded #includes 2006-03-17 04:13:29 +00:00
Brian Paul
0f1d98c422 remove another test for IN_DRI_DRIVER 2006-03-17 04:10:03 +00:00
Kristian Høgsberg
724df02073 Don't use glx_ansic.h functions (__glXMemset). 2006-03-17 00:03:20 +00:00
Brian Paul
2b17741e1b added #undef GET_DISPATCH 2006-03-16 18:06:34 +00:00
Brian Paul
c6c0f94714 Moved _glapi_check_multithread() call into drivers, instead of in
_mesa_make_current().
This removes an ugly #if !defined(IN_DRI_DRIVER) from core Mesa.
2006-03-16 18:05:25 +00:00
Brian Paul
ef8653a838 finish up some loose ends in _mesa_texstore_z24_s8() 2006-03-16 04:44:00 +00:00
Brian Paul
514a15cea1 assorted code clean-ups, comments, etc. 2006-03-15 20:56:22 +00:00
Brian Paul
ac8b07b3ae remove invalid assertion in _glapi_get_dispatch(), fixes additional thread safety problem 2006-03-15 20:42:00 +00:00
Brian Paul
e660690985 Need to include glthread.h in glapi.h, not glapi.c so that GET_CURRENT_CONTEXT
is properly defined.  Fixes long-standing, but unnoticed thread safety failure.
Also, updated comments.
2006-03-15 20:31:50 +00:00
Brian Paul
30655c211c updated some printfs, added comment about sched_yield 2006-03-15 20:30:17 +00:00
Brian Paul
59e0faaa5c sync with texmem branch 2006-03-15 17:48:00 +00:00
Brian Paul
eccb6a0698 rename enums, fixes compilation breakage (Michal Krol) 2006-03-15 14:09:08 +00:00
Brian Paul
10f08cc202 use 'p' key to toggle use of GL_EXT_packed_depth_stencil 2006-03-15 01:44:03 +00:00
Brian Paul
b7e3e0d64e s/GLuint/GLushort/ in read_depth_stencil_image() 2006-03-15 01:36:52 +00:00
Brian Paul
19b8322169 init Red/Green/EtcBits = 0 in soft_renderbuffer_storage() 2006-03-14 22:39:43 +00:00
Brian Paul
2a0d441ebb Set always_array=true for glGenProgramsNV (Dave Reveman) 2006-03-14 15:41:53 +00:00
Brian Paul
15e74a6441 replace dprintf() with _glu_dprintf() (bug 6244) 2006-03-14 15:08:52 +00:00
Michal Krol
0f618b7eb7 Add slang_analyse.c and slang_library_texsample.c. 2006-03-14 11:39:58 +00:00
Michal Krol
8af48fc4d6 More GLSL code:
- add texture sampling support;
- fix assembly codegen bugs;
2006-03-14 11:23:16 +00:00
Aapo Tahkola
e9484e4085 Clean build. 2006-03-13 20:40:46 +00:00
Aapo Tahkola
a0cf4ceb36 Fix broken max mipmap leveling that was horribly wrong. 2006-03-13 18:23:19 +00:00
Aapo Tahkola
5042778449 Option to init vp temps(for testing) 2006-03-10 05:30:33 +00:00
Brian Paul
9c32af5bb2 Add prototypes for GLX_MESA_swap_frame_usage, GLX_MESA_swap_control, and
GLX_EXT_texture_from_pixmap to silence warnings while compiling glxcmds.c
XXX: Need to add the new tokens for GLX_EXT_texture_from_pixmap!!!
2006-03-09 16:27:35 +00:00
Brian Paul
841a823d6d s/GLint/int/, to fit GLX conventions 2006-03-09 16:25:46 +00:00
Brian Paul
0d57301ba2 Instead of adding extra flags to DEFINES with +=, define EXTRA_DEFINES instead.
This eliminates a bunch of duplication in the compilation commmands.
2006-03-09 16:24:46 +00:00
Aapo Tahkola
12d51beb7e Kick VBOs out of GART if nothing else helps. 2006-03-09 06:21:17 +00:00
Aapo Tahkola
e294d938f2 Use the force Luke, use the force. 2006-03-09 04:42:45 +00:00
Dave Airlie
f1b431b265 coverity check bug fix going over end of array 2006-03-08 05:44:07 +00:00
Dave Airlie
9fc897af7a coverity checker bug: Pointer dereferenced after NULL check 2006-03-08 05:37:58 +00:00
Aapo Tahkola
d97ab9a7bd Fix broken DrawElements & DrawRangeElements. 2006-03-07 22:46:52 +00:00
Jouk Jansen
d9894e0d72 Committing in .
Update OpenVMS makefiles

 Modified Files:
 	Mesa/src/mesa/shader/slang/descrip.mms
 	Mesa/src/mesa/swrast/descrip.mms
 ----------------------------------------------------------------------
2006-03-07 07:47:37 +00:00
Aapo Tahkola
dba9c0bafd Enable HW VBOs and other things needed by it. 2006-03-07 05:31:36 +00:00
Aapo Tahkola
ba7ea2e697 Convert to work with current DRM. + tag 2006-03-07 05:15:24 +00:00
Aapo Tahkola
50f319242b Various fallbacks, checks and tags. 2006-03-07 05:09:48 +00:00
Brian Paul
ca007cb449 just a comment for check_compatible() 2006-03-07 03:01:26 +00:00
Brian Paul
d75963d258 disable double-buffer test in check_compatible(), fixes pbuffer/visual problem 2006-03-07 02:57:04 +00:00
Brian Paul
8ee311d36d print newline in _mesa_warning() 2006-03-07 01:46:26 +00:00
Brian Paul
2e01918b55 call _mesa_update_framebuffer_visual() in _mesa_FramebufferRenderbufferEXT() to fix some minor glitches 2006-03-07 01:43:52 +00:00
Brian Paul
168a7516b1 FreeBSD updates (Pedro Giffuni) 2006-03-07 01:11:05 +00:00
Aapo Tahkola
c107058e7e Port r200 tex tiling code to run on r300 but keep it disabled. 2006-03-06 19:28:10 +00:00
Ian Romanick
3bca4f679a Later versions of Python handle formats like '% 5u' differently. For
whatever reason, a space is always inserted.  That is not the desired
behavior.
2006-03-06 18:31:50 +00:00
Ian Romanick
9d881ea718 Generate server-side GLX protocol decode functions using the 'make server'
target.  The environment variable XORG_BASE must be set to point to the base
of the X.org server sources where the files are to be placed.

The 7.0.0 server release already contains files generated by these scripts.
The scripts should have been committed months ago.  Sorry for the lag. :(
2006-03-06 18:30:17 +00:00
Ian Romanick
448d23331d Display the correct bug number in the information text. 2006-03-06 16:42:12 +00:00
Ian Romanick
66df1731e6 Don't try to bind to proxy texture target. This is defined by the spec to be
an error.  Since we're working with a proxy target, don't bother using real
texture data.

Add a missing new-line in an error printf.
2006-03-06 16:31:50 +00:00
Ian Romanick
5820f7998a Build test for bugzilla #3050 2006-03-04 04:46:10 +00:00
Ian Romanick
780d270312 Test case for bugzilla #3050. 2006-03-04 04:44:47 +00:00
Roland Scheidegger
e1e03b32ab Use standard ARB names instead of vendor-specific NV names for the ARB/NV_vertex_program enums in common state handling code, and update comments accordingly. Change some slightly confusing code which gave the impression GL_VERTEX_PROGRAM_ARB and GL_VERTEX_PROGRAM_NV enums were different. 2006-03-03 15:03:04 +00:00
Roland Scheidegger
f8ba07a77d fix up the emit_func list in the experimental arbprogram sse code. 2006-03-03 14:11:19 +00:00
Roland Scheidegger
5e01f9a114 Fix bogus span mask in s_atifragshader.c leading to trouble when the pixel was later discarded by z test (this fixes doom3 r200 renderpath with swrast). Fix calling _swrast_alpha_test potentially leading to bogus results when Alpha Test might not be enabled. While here, don't disable deferred_texture (early z) when ATI_fragment_shader is active, as it is not necessary (for the record, this boosts doom3 swrast performance by roughly a factor of 2 (4 seconds per frame now...) with the r200 render path, might be a worthwile optimization for fragment programs which don't write z). 2006-03-03 02:46:03 +00:00
Keith Whitwell
f4ab5654d0 Add position_invarient support 2006-03-02 20:16:34 +00:00
Roland Scheidegger
da16813f43 Fix more enums defined not only by one extension when queried by glGet (GL_COLOR_SUM_EXT, GL_POINT_SPRITE_NV, GL_POINT_SPRITE_COORD_ORIGIN, GL_TRANSPOSE_CURRENT_MATRIX_ARB). Fix similar bugs (also those previously overseen dependant on NV/ARB_vertex_program) in glIsEnabled. Add missing GL_COLOR_SUM_EXT enum to glIsEnabled. 2006-03-02 12:06:57 +00:00
Brian Paul
9227bca103 added GL_EXT_framebuffer_blit, etc 2006-03-02 04:12:34 +00:00
Brian Paul
81b8aa9ecd test glBlitFramebufferEXT w/ -blit flag 2006-03-02 03:54:14 +00:00
Brian Paul
14d3ab9662 improved error msg 2006-03-02 03:51:04 +00:00
Brian Paul
904ab0c22c check FEATURE_EXT_framebuffer_blit 2006-03-02 03:46:33 +00:00
Brian Paul
afa1df5871 plug in BlitFramebuffer function 2006-03-02 03:45:28 +00:00
Brian Paul
c241d3b06a implementation of _swrast_BlitFramebuffer() 2006-03-02 03:37:18 +00:00
Roland Scheidegger
93da673904 Fix glGet with enums which are used not only in NV_vertex_program, but other extensions too (ARB_vertex_program, ARB_fragment_program, NV_fragment_program), if no support for NV_vertex_program is present. While here, fix return value if enum is used which is not supported by the exposed extensions (GL_INVALID_ENUM instead of GL_INVALID_VALUE). Fix some compile-time #ifs depending on NV_vertex/fragment_program which should also be dependant on ARB_vertex/fragment_program. See bug #6070 2006-03-01 23:11:14 +00:00
Brian Paul
cf6be2d5bd No need for _mesa_save_error() to be public.
glVertexAttrib() w/ bad index should generate GL_INVALID_VALUE, not
GL_INVALID_ENUM.
Misc clean-ups.
2006-03-01 15:44:20 +00:00
Brian Paul
dbfd246db8 added BlitFramebuffer() support 2006-03-01 15:36:34 +00:00
Brian Paul
190e5595bc New comments. Use tuples () instead of lists [] in a few places. 2006-03-01 15:33:56 +00:00
Brian Paul
68edf28df6 added Flush in glXCopyContext() 2006-03-01 15:32:38 +00:00
Brian Paul
9b8059e536 updated comment 2006-03-01 02:09:40 +00:00
Brian Paul
6d4284e2bf Added glBlitFramebufferEXT function. 2006-03-01 02:07:50 +00:00
Brian Paul
9974540c73 remove temporary tokens, more error checks for blit function 2006-03-01 02:02:43 +00:00
Brian Paul
2c61fdafd6 added s_blit.c 2006-03-01 02:00:58 +00:00
Brian Paul
1eca891dbe _swrast_blit_framebuffer() function 2006-03-01 01:57:30 +00:00
Brian Paul
a231097609 GL_EXT_framebuffer_blit tokens/functions 2006-03-01 01:54:59 +00:00
Aapo Tahkola
fbe48ef01f Free temps when possible 2006-02-28 23:39:32 +00:00
Aapo Tahkola
71932ef85c Dont let (possibly) undefined z component reach hw as its unused 2006-02-28 23:22:48 +00:00
Aapo Tahkola
6754e17138 No need to call *_FIREVERTICES twice. 2006-02-28 23:17:00 +00:00
Aapo Tahkola
f71fd439f5 Fix aliasing bug (Benjamin Herrenschmidt) 2006-02-28 23:08:28 +00:00
Brian Paul
147f5091a1 Allow error checking to look for presence of either of two extensions.
See bug 6070.
2006-02-28 21:45:09 +00:00
Brian Paul
176dac684a only run shader on active fragments in the span 2006-02-28 15:48:43 +00:00
Brian Paul
34b60b001d check if active fragment shader for deferred texturing/shading 2006-02-28 15:48:19 +00:00
Brian Paul
3073cf21d2 check for active shader, set FRAGPROG_BIT in raster mask 2006-02-28 15:44:33 +00:00
Brian Paul
d1d4121682 silence a bunch of warnings 2006-02-27 15:45:38 +00:00
Michal Krol
9ac9605de1 More GLSL code:
- add x86 code generator;
- add full support for uniforms in ARB_shader_objects;
- add assembly instruction: global_addr;
- reorganize #includes;
- built-in uniforms accessed by index, rather than by name;
- add some entries to x86sse rtasm;
- add configurations to VC6 projects: 'Release x86' and 'Debug x86';
- #define SLANG_X86 active only on VC6 x86 builds;
- introduce code export table for a shader;
- remove GNU license from the noise library;
2006-02-27 14:41:41 +00:00
Brian Paul
c56f2c49a5 re-formated with indent. 2006-02-26 18:18:12 +00:00
Brian Paul
be42f53020 Remove need to initialize the InstSize[] array elements by just storing
the instruction size in _mesa_alloc_instruction().
2006-02-26 18:02:13 +00:00
Brian Paul
a764b7eae0 display list clean-ups 2006-02-26 17:16:37 +00:00
Roland Scheidegger
4e77669926 Add all pci ids known by ddx to radeon dri driver. Remove the entries not known by ddx (probably secondary ids, non-existant cards and similar). Add rs400 to the family enum, and configure the rv410 like a 2 quad chip (?) 2006-02-25 02:03:12 +00:00
Brian Paul
2aabdc743f fix broken _mesa_copy_context() for GL_LIGHTING_BIT 2006-02-24 18:19:11 +00:00
Brian Paul
ee2339f673 need to check for _NEW_BUFFERS in xmesa_update_state() 2006-02-24 17:58:48 +00:00
Brian Paul
228d4a6de7 Fix _mesa_copy_texture_state() so that we copy texture object bindings,
not the actual contents of texture objects.  This makes glXCopyContext()
work properly.
2006-02-24 17:16:57 +00:00
Brian Paul
1aad408b5a EXT_framebuffer_object (Dave Reveman) 2006-02-24 15:36:24 +00:00
Brian Paul
44a2e96729 include inttypes.h if __osf__ defined (Randall Hand) 2006-02-23 15:36:39 +00:00
Brian Paul
5b2ee9c1e9 update Blender link 2006-02-23 14:29:03 +00:00
Brian Paul
956fff6345 add some #includes, fix some prototypes (bug 5992) 2006-02-22 16:54:05 +00:00
Brian Paul
7b6fd8a0c6 include proper header file, remove local extern declarations 2006-02-22 16:44:04 +00:00
Brian Paul
cebad151a1 add missing prototypes, use _slang_ prefix on non-static functions 2006-02-22 16:43:26 +00:00
Brian Paul
4f8b59d59b silence a variety of compiler warnings 2006-02-22 16:35:34 +00:00
Brian Paul
49ad2d4ed1 updated GLUT link 2006-02-22 15:50:57 +00:00
Michal Krol
cc1591667d More GLSL code:
- uniforms (only GetLocation, Uniform1f and Uniform4fv for now for demos);
- fix bugs and optimize array size handling;
- 2D texture sampling (needs Enable(TEXTURE_2D) to work);
- decrease built-in library assembly size by 30%.
2006-02-21 12:35:06 +00:00
Jouk Jansen
8986e36f36 Committing in .
Update OpenVMS makefiles

 Modified Files:
 	Mesa/src/mesa/shader/slang/descrip.mms
 	Mesa/src/mesa/swrast/descrip.mms Mesa/src/mesa/tnl/descrip.mms
 ----------------------------------------------------------------------
2006-02-21 12:28:34 +00:00
Jeremy Kolb
fcbbdf9991 Added xcb dri config file. 2006-02-19 22:31:26 +00:00
Jeremy Kolb
97a3023c9f Remove old linux-x86-xcb (didn't do anything).
Removed reference to linux-x86-xcb and added linux-dri-xcb in Makefile.
2006-02-19 22:30:46 +00:00
Michal Krol
3654193a4d More GLSL code.
- general constructors allowed;
- implement noise functions (from Stefan Gustavson - thanks!)
- cosmetic stuff.
2006-02-18 15:11:18 +00:00
Keith Whitwell
e94be8d5c0 Fix STENCIL_WRITE_MASK defn for bug 5902 2006-02-17 17:03:14 +00:00
Aapo Tahkola
8da9f448f4 Skip ARL while we dont implement it. Fix broken nv vps but do it with software for now. 2006-02-16 19:50:40 +00:00
Roland Scheidegger
555b5fac4f Reinstate vertex format after a rasterization fallback for both r200 and radeon driver when a tcl fallback is active, fixes a blender issue with non-tcl hw (bug #5601) 2006-02-16 17:16:33 +00:00
Eric Anholt
a176bc6c17 Include dix-config.h if HAVE_DIX_CONFIG_H is defined. This will be used by the
X Server to get things like _XSERVER64 (for X headers) and NO_LIBCWRAPPER
defined consistently when its builds Mesa internally.
2006-02-15 21:03:34 +00:00
Brian Paul
ee40c4fb34 Set NumInstructions (bug 5864) 2006-02-15 15:59:37 +00:00
Brian Paul
a584e846d4 Fix a few warnings:
- nested comments (use #if 0 / #endif instead)
 - missing default clause in switch statements
 - use of possibly undefined variables
2006-02-15 15:51:01 +00:00
Michal Krol
dd02edf381 Add support for forward function declarations. 2006-02-15 11:15:16 +00:00
Michal Krol
88d994c3b2 Add fragment shader execute entry. 2006-02-15 11:12:47 +00:00
Michal Krol
50092f8f33 Add s_arbshader.c, s_arbshader.h. 2006-02-15 11:09:26 +00:00
Michal Krol
870ebefb3b Add swrast/s_arbshader.c. 2006-02-15 11:07:56 +00:00
Michal Krol
a663931204 Add arbshader stage. 2006-02-15 11:06:00 +00:00
Michal Krol
5bc35a823a Enable texcoords when program object in use. 2006-02-15 11:03:57 +00:00
Michal Krol
dc3a922cf3 Get arbfslight demo running. 2006-02-15 11:02:07 +00:00
Michal Krol
0c8e578a38 Enable GL_ARB_fragment_shader extension. 2006-02-15 11:00:15 +00:00
Michal Krol
3699751b0b Demonstrate GLSL fragment and vertex shaders. 2006-02-15 10:58:52 +00:00
Brian Paul
d5aca8bf0c remove stray 'foo' line 2006-02-15 04:10:55 +00:00
Brian Paul
0c1438d331 replace size_t * w/ unsigned int * (Jurg Billeter) 2006-02-14 15:04:45 +00:00
Brian Paul
a5033a0421 fix AIX issues (bug 5874) 2006-02-14 14:57:04 +00:00
Jouk Jansen
2189d9c96e Update OpenVMS compile support 2006-02-13 12:00:29 +00:00
Michal Krol
e7ffe4619f More glsl code. 2006-02-13 11:47:41 +00:00
Michal Krol
8a54fad6cd REVISION 3.
Remove illegal operators for overloading.
2006-02-13 11:45:57 +00:00
Michal Krol
ebcbf2f853 Cosmetic changes. 2006-02-13 11:42:48 +00:00
Michal Krol
41eeae5fb1 Delete most of the comments.
Minor tweaks with the functions.
Add experimental print functions.
2006-02-13 11:40:32 +00:00
Michal Krol
02eb9acc5e Get it running for ARB_vertex_shader.
Add experimental print functions to builtin library.
Some functionality missing:
- automatic arrays;
- general constructors;
- local variable initialization;
- texture sampling and noise;
- semantic error checking;
- function prototypes.
2006-02-13 11:38:37 +00:00
Michal Krol
44e9ccc708 Rename current_program to CurrentProgram.
Temporary vertex_shader execution code.
2006-02-13 11:31:16 +00:00
Michal Krol
adef42c88d Add tnl\t_vb_arbshader.c. 2006-02-13 11:27:33 +00:00
Michal Krol
7d376c76c9 Add tnl/t_vb_arbshader.c. 2006-02-13 11:25:43 +00:00
Michal Krol
a2ea606377 Add ARB_vertex_shader stage just before render stage.
If enabled, all other stages, except render, are disabled.
2006-02-13 11:23:36 +00:00
Michal Krol
2363fff347 Enable GL_ARB_shader_objects, GL_ARB_shading_language_100 and
GL_ARB_vertex_shader extensions.
2006-02-13 11:04:27 +00:00
Michal Krol
c92e688e15 Rename current glsl program variable. 2006-02-13 10:56:54 +00:00
Michal Krol
170f08d4b1 Add _mesa_atanf and _mesa_asinf functions. 2006-02-13 10:55:14 +00:00
Eric Anholt
91c30771b6 Add the ability to define NO_LIBCWRAPPER to avoid libcwrapper brain damage.
If it's true that libcwrapper usage isn't necessary ever in the DllLoader world,
then this code should probbaly all go away.
2006-02-11 02:59:38 +00:00
Dave Airlie
f236300e3a commit to fixup MGL namespacing for XGL 2006-02-10 21:46:17 +00:00
Aapo Tahkola
a73094cc6a Workaround problems with NWN. (Tilman Sauerbeck) 2006-02-10 17:26:44 +00:00
Brian Paul
42447365b2 remove the test for XFree86Server from prev patch (bug 5835) 2006-02-09 14:28:40 +00:00
Alan Hourihane
b77a225250 Check DDX for 1.5.0 2006-02-08 22:05:42 +00:00
Brian Paul
d93615fc1e include dix-config.h (Mike Harris) (bug 5835) 2006-02-08 14:52:06 +00:00
Brian Paul
42725d6f54 David Reveman's GLX_EXT_texture_from_pixmap extension patch 2006-02-07 00:39:56 +00:00
Dave Airlie
4cd0e24f86 add vblank support to i915 driver 2006-02-06 00:09:58 +00:00
Brian Paul
640ef7f890 EGL 1.2 tokens/functions/etc. 2006-02-05 16:39:19 +00:00
Brian Paul
63b852f4f9 fix typo 2006-02-05 16:38:33 +00:00
Brian Paul
ea970da0b6 bring in changes from 6.4 branch 2006-02-03 17:21:54 +00:00
Roland Scheidegger
e7276b7fa5 replace the texture level hack used in radeon/r200 to allow larger textures with different methods to calculate the announced maximum texture sizes. Default is still the same (that is, radeon/r200 default to not announce anything which might not fit, i830/i915 default to 1 texture must fit). Bug #5785. 2006-02-03 13:29:11 +00:00
Brian Paul
16a14510c4 use calloc instead of malloc so try_codegen field is initialized to zero (bug 5791) 2006-02-02 17:33:26 +00:00
Brian Paul
725740c7c8 add some assertions to check emit_func[] table validity 2006-02-02 14:30:16 +00:00
Roland Scheidegger
5951aab823 fix texcoord unit assertion, the right one (bug 5780) 2006-02-01 23:14:42 +00:00
Brian Paul
865ad82bb8 fix texcoord unit assertion (bug 5780) 2006-02-01 16:50:16 +00:00
Roland Scheidegger
3b6f62fc73 fix test for valid texunit in _mesa_ClientActiveTextureARB 2006-02-01 01:05:40 +00:00
Brian Paul
111281f1fc s/malloc/calloc/, fix mem leak 2006-01-31 03:00:14 +00:00
Roland Scheidegger
663138a951 fix broken assertions so dri drivers compile with -DDEBUG (replace GL_STENCIL_INDEX8 with GL_STENCIL_INDEX8_EXT). Fix potential problem with drivers which use 32bit z buffers. 2006-01-30 23:49:31 +00:00
Roland Scheidegger
a45f23bed1 fix broken assertion to make radeon driver compile with -DDEBUG... 2006-01-30 23:36:42 +00:00
Brian Paul
4b4cc650e1 updated comment 2006-01-30 17:13:19 +00:00
Brian Paul
781c54a5b8 silence warning about duplicate M_PI definition 2006-01-30 17:12:10 +00:00
Brian Paul
6a36407a00 added more tests (Pedro Maia) 2006-01-30 17:11:47 +00:00
Brian Paul
7905b19ec9 use fmod() when incrementing CubeRot 2006-01-30 15:35:35 +00:00
Michal Krol
bd8c742762 Add shader/slang/slang_compile_*.* files. 2006-01-30 14:50:01 +00:00
Michal Krol
9dc8bce88e Split slang_compile.c into several smaller files - it was just too big.
Minor fixes and cosmetic changes.
2006-01-30 14:48:42 +00:00
Brian Paul
b2006a40eb some initial EGL 1.2 work 2006-01-30 00:10:55 +00:00
Brian Paul
daf3093f28 Test glCopyTexSubImage2D by drawing gears as texture on sides of a box. 2006-01-28 00:30:07 +00:00
Brian Paul
5e9d73153c misc updates 2006-01-27 20:12:06 +00:00
Brian Paul
0b3c2a9a24 Don't do swapbuffers if -nodraw specified. Get t0 after setup code. 2006-01-27 15:44:40 +00:00
Aapo Tahkola
5594ddbcfe remove broken non arb fp path 2006-01-27 14:35:24 +00:00
Aapo Tahkola
58e4aa0ec9 missing link in the fallback chain 2006-01-27 14:09:05 +00:00
Aapo Tahkola
0fcfa1c5b0 enable hw vertex programs by default 2006-01-27 14:03:22 +00:00
Aapo Tahkola
e797bc8bbe per vp sw fallbacks 2006-01-27 13:21:47 +00:00
Aapo Tahkola
7d82d284e3 radeon driver doesnt have this so i assume we shouldnt either. 2006-01-27 13:09:59 +00:00
Aapo Tahkola
a7bd2563c3 drop all that (slow) locking stuff and make u_list per context. 2006-01-27 13:05:56 +00:00
Aapo Tahkola
875df252a7 R300_PFS_NODE_LAST_NODE -> R300_PFS_NODE_OUTPUT_COLOR 2006-01-27 12:38:20 +00:00
Aapo Tahkola
e804370014 Work around problems with t_vp_build.c 2006-01-27 12:23:26 +00:00
Aapo Tahkola
32551222bc r300UpdateTextureEnv shouldnt be called. 2006-01-27 12:18:58 +00:00
Brian Paul
77667266a7 Test glTexSubImage and glCopyTexSubImage rate.
Run with -nodraw to skip rendering of test quad to get "pure" sub-tex rate.
2006-01-26 17:35:31 +00:00
Brian Paul
32a6468014 copypixrate.c - measure the speed of glCopyPixels. 2006-01-26 16:37:47 +00:00
Aapo Tahkola
e65ad47a8f remove some testing code 2006-01-26 16:28:54 +00:00
Aapo Tahkola
edc98df891 Fix a problem where offsets from disabled tmus reach drm 2006-01-26 15:53:18 +00:00
Alan Hourihane
fbcb37cac5 remove i830 2006-01-26 08:53:32 +00:00
Brian Paul
3a5bb1729d New comments, clean-up of fields related to point/line/triangle validation. 2006-01-26 01:32:47 +00:00
Brian Paul
2219a15b06 remove unneeded init of swrast->invalidate_line/triangle 2006-01-26 01:28:00 +00:00
Brian Paul
74235b1cf1 remove the GL_HP_occlusion_test code 2006-01-26 01:27:17 +00:00
Brian Paul
f3cf636e57 WGL_ARB_extensions_string extension 2006-01-25 17:33:13 +00:00
Brian Paul
166b0ff973 added wglGetExtensionsStringARB 2006-01-25 15:05:36 +00:00
Karl Schultz
7f1274fa8b add wglGetExtensionsStringARB 2006-01-25 06:02:55 +00:00
Jerome Glisse
99da2d30eb fix using a tmp without asking for one 2006-01-24 23:04:51 +00:00
Alan Hourihane
8b1dc68662 pull in fix from 6.4 branch for XFree86Server definition 2006-01-24 21:40:53 +00:00
Aapo Tahkola
4dd8a8907e fix broken get_half & get_zero 2006-01-24 20:24:06 +00:00
Alan Hourihane
65573edd1b remove very old i830 code 2006-01-24 19:59:54 +00:00
Alan Hourihane
f3134ca7ad use front.size instead of sPriv->fbSize 2006-01-24 19:40:26 +00:00
Alan Hourihane
f7360cd42d use screen->front.map instead of pFB from libdri 2006-01-24 19:28:49 +00:00
Alan Hourihane
39c492bb14 Add Intel 945GM support
Add rotation support
(Tungsten Graphics)
2006-01-23 10:10:48 +00:00
Jerome Glisse
acd1f16b35 Do individual negetation in swizzling, thus we can
save one instruction in some case.
2006-01-21 15:16:53 +00:00
Jerome Glisse
c6f35dd8db Indent & wrap around 80 2006-01-21 13:08:46 +00:00
Aapo Tahkola
f087d60f18 Doesnt apply anymore 2006-01-21 12:48:09 +00:00
Jerome Glisse
41a874f486 Add individual component negation. 2006-01-21 11:43:37 +00:00
Aapo Tahkola
ef073b7a75 Try to tackle bug #5148 2006-01-20 21:56:52 +00:00
Aapo Tahkola
c90b569238 Sync from drm. 2006-01-20 21:16:28 +00:00
Aapo Tahkola
93a7605b1d Fix ARGB1555 component swizzling. 2006-01-20 20:48:05 +00:00
Jerome Glisse
b42d5bcaff Fix swizzling table & add struct. 2006-01-20 18:24:44 +00:00
Adam Jackson
37e86254c1 Avoid a crash when the user has enabled glVertex{,Attrib}Pointer but hasn't
filled in a valid pointer for that attribute or vertex array.
2006-01-19 18:00:38 +00:00
Adam Jackson
216f729a95 Search for makedepend in the PATH rather than hardcoding /usr/X11R6/bin 2006-01-18 20:57:02 +00:00
Adam Jackson
38da697546 Nuke the old attempt at software DRI, it's broken and awful 2006-01-18 00:29:35 +00:00
Adam Jackson
f93a228c38 Start a software-only DRI driver for use in the new accelerated indirect
world.
2006-01-18 00:22:21 +00:00
Brian Paul
1096eae18d properly free ATI fragment shaders (Tilman Sauerbeck) 2006-01-16 16:35:13 +00:00
Brian Paul
361bccb4ec Free visinfo object (Tilman Sauerbeck) 2006-01-16 16:17:18 +00:00
356 changed files with 31962 additions and 28870 deletions

View File

@@ -89,6 +89,7 @@ linux-dri \
linux-dri-x86 \
linux-dri-x86-64 \
linux-dri-ppc \
linux-dri-xcb \
linux-indirect \
linux-fbdev \
linux-glide \
@@ -113,7 +114,6 @@ linux-x86-32 \
linux-x86-64 \
linux-x86-64-debug \
linux-x86-64-static \
linux-x86-xcb \
linux-x86-glide \
linux-x86-static \
netbsd \

View File

@@ -53,6 +53,8 @@ if [ `uname` = "FreeBSD" ] ; then
CP_FLAGS="-f"
elif [ `uname` = "Darwin" ] ; then
CP_FLAGS="-f"
elif [ `uname` = "AIX" ] ; then
CP_FLAGS="-fh"
else
CP_FLAGS="-fd"
fi

View File

@@ -14,6 +14,6 @@ CXXFLAGS = -O2 -DAIXV3
MKLIB_OPTIONS = -arch aix-gcc
GL_LIB_DEPS = -lX11 -lXext -lm
GLU_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -lm
GLUT_LIB_DEPS = -L$(LIB_DIR -l$(GLU_LIB) -l$(GL_LIB) -lXi -lXmu
GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lXi -lXmu
APP_LIB_DEPS = -L$(LIB_DIR) -Wl,-brtl -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lX11 -lXext -lXmu -lXi

View File

@@ -5,13 +5,22 @@ include $(TOP)/configs/default
CONFIG_NAME = FreeBSD
# Compiler and flags
CC = gcc
CXX = g++
CC = cc
CXX = c++
MAKE = gmake
CFLAGS = -O2 -fPIC -pedantic -I/usr/X11R6/include -DUSE_XSHM -DHZ=100 \
$(ASM_FLAGS)
CXXFLAGS = -O2 -fPIC -pedantic
OPT_FLAGS = -O2
PIC_FLAGS = -fPIC
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -DUSE_XSHM -DHZ=100
X11_INCLUDES = -I/usr/X11R6/include
CFLAGS += $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) $(X11_INCLUDES) -ffast-math -pedantic
CXXFLAGS += $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) $(X11_INCLUDES)
GLUT_CFLAGS = -fexceptions
APP_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lXext -lXmu -lXi -lX11 -lm
EXTRA_LIB_PATH = -L/usr/X11R6/lib
APP_LIB_DEPS = -L$(LIB_DIR) $(EXTRA_LIB_PATH) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lXext -lXmu -lXi -lX11 -lm

View File

@@ -40,6 +40,6 @@ DRM_SOURCE_PATH=$(TOP)/../drm
# ffb and gamma are missing because they have not been converted to use the new
# interface.
DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 r300 radeon tdfx \
DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon tdfx \
unichrome savage sis

View File

@@ -9,7 +9,7 @@ CONFIG_NAME = linux-dri
CC = gcc
CXX = g++
MKDEP = /usr/X11R6/bin/makedepend
#MKDEP = /usr/X11R6/bin/makedepend
#MKDEP = gcc -M
#MKDEP_OPTIONS = -MF depend
@@ -63,5 +63,5 @@ WINDOW_SYSTEM=dri
# gamma are missing because they have not been converted to use the new
# interface.
DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 r300 radeon s3v \
DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon s3v \
savage sis tdfx trident unichrome ffb

View File

@@ -17,7 +17,7 @@ LIB_DIR = $(TOP)/lib64
EXTRA_LIB_PATH=-L/usr/X11R6/lib64
# ffb, gamma, and sis are missing because they have not be converted to use
# the new interface. i810 and i830 are missing because there is no x86-64
# the new interface. i810 are missing because there is no x86-64
# system where they could *ever* be used.
#
DRI_DIRS = i915 mach64 mga r128 r200 radeon tdfx unichrome savage r300

67
configs/linux-dri-xcb Normal file
View File

@@ -0,0 +1,67 @@
# -*-makefile-*-
# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others
include $(TOP)/configs/default
CONFIG_NAME = linux-dri-xcb
# Compiler and flags
CC = gcc
CXX = g++
#MKDEP = /usr/X11R6/bin/makedepend
#MKDEP = gcc -M
#MKDEP_OPTIONS = -MF depend
OPT_FLAGS = -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 -DIN_DRI_DRIVER \
-DGLX_DIRECT_RENDERING -DHAVE_ALIAS -DUSE_XCB
X11_INCLUDES = `pkg-config --cflags-only-I x11` `pkg-config --cflags-only-I xcb`
CFLAGS = -Wall -Wmissing-prototypes $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
$(DEFINES) $(ASM_FLAGS) -std=c99 -ffast-math
CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
ASM_SOURCES =
# Library/program dependencies
EXTRA_LIB_PATH=`pkg-config --libs-only-L x11`
LIBDRM_LIB = `pkg-config --libs libdrm` -ldrm
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl \
$(LIBDRM_LIB) `pkg-config --libs xcb`
# This is now 0 by default since it seems to confuse the hell out of people
# and generate a lot of extra noise on bugzilla. If you need to build with
# EGL, do 'make linux-dri USING_EGL=1'
USING_EGL=0
# Directories
ifeq ($(USING_EGL), 1)
SRC_DIRS = egl glx/x11 mesa glu glut/glx glw
PROGRAM_DIRS = egl
else
SRC_DIRS = glx/x11 mesa glu glut/glx glw
PROGRAM_DIRS =
endif
DRIVER_DIRS = dri
WINDOW_SYSTEM=dri
# gamma are missing because they have not been converted to use the new
# interface.
DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon s3v \
savage sis tdfx trident unichrome ffb

View File

@@ -10,7 +10,7 @@ CONFIG_NAME = linux-dri
CC = gcc
CXX = g++
MKDEP = /usr/X11R6/bin/makedepend
#MKDEP = /usr/X11R6/bin/makedepend
#MKDEP = gcc -M
#MKDEP_OPTIONS = -MF depend

View File

@@ -40,4 +40,4 @@ DRIVER_DIRS = dri
PROGRAM_DIRS = miniglx
#DRI_DIRS = ffb gamma sis savage
DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 radeon tdfx unichrome fb
DRI_DIRS = i810 i915 mach64 mga r128 r200 radeon tdfx unichrome fb

View File

@@ -1,25 +0,0 @@
# Configuration for Linux with x86 optimizations
include $(TOP)/configs/default
CONFIG_NAME = linux-x86-xcb
# Compiler and flags
CC = gcc
CXX = g++
CFLAGS = -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DPTHREADS -DUSE_XCB -I/usr/X11R6/include
CXXFLAGS = -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XCB
GLUT_CFLAGS = -fexceptions
ASM_SOURCES = $(X86_SOURCES)
ASM_API = $(X86_API)
# Library/program dependencies
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread -lXCB
GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm
GLW_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -L/usr/X11R6/lib -lXt -lX11
APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm

47
docs/RELNOTES-6.4.1 Normal file
View File

@@ -0,0 +1,47 @@
Mesa 6.4.1 Release Notes
Introduction
------------
Mesa uses an even/odd version number scheme like the Linux kernel.
Odd numbered versions (such as 6.3) designate new developmental releases.
Even numbered versions (such as 6.4) designate stable releases.
6.4.1 is a bug-fix release. See the VERSIONS file for details.
GLUT tarball
------------
Starting with 6.4, the GLUT library sources are distributed in a separate
tarball. This was done at the request of Linux distro vendors who prefer
to use freeglut.
Driver Status
---------------------- ----------------------
DRI drivers varies with the driver
XMesa (Xlib) implements OpenGL 1.5
OSMesa (off-screen) implements OpenGL 1.5
Windows/Win32 implements OpenGL 1.5
Glide (3dfx Voodoo1/2) requires updates
SVGA requires updates
DJGPP requires updates
GGI requires updates
BeOS requires updates
Allegro requires updates
D3D requires updates
The drivers which require updates mostly need to be updated to work
with the new gl_renderbuffer / gl_framebuffer infrastructure introduced
in Mesa 6.3.
----------------------------------------------------------------------
$Id: RELNOTES-6.4.1,v 3.1 2006/02/03 17:21:54 brianp Exp $

47
docs/RELNOTES-6.4.2 Normal file
View File

@@ -0,0 +1,47 @@
Mesa 6.4.2 Release Notes
Introduction
------------
Mesa uses an even/odd version number scheme like the Linux kernel.
Odd numbered versions (such as 6.3) designate new developmental releases.
Even numbered versions (such as 6.4) designate stable releases.
6.4.2 is a minor bug-fix release. See the VERSIONS file for details.
GLUT tarball
------------
Starting with 6.4, the GLUT library sources are distributed in a separate
tarball. This was done at the request of Linux distro vendors who prefer
to use freeglut.
Driver Status
---------------------- ----------------------
DRI drivers varies with the driver
XMesa (Xlib) implements OpenGL 1.5
OSMesa (off-screen) implements OpenGL 1.5
Windows/Win32 implements OpenGL 1.5
Glide (3dfx Voodoo1/2) requires updates
SVGA requires updates
DJGPP requires updates
GGI requires updates
BeOS requires updates
Allegro requires updates
D3D requires updates
The drivers which require updates mostly need to be updated to work
with the new gl_renderbuffer / gl_framebuffer infrastructure introduced
in Mesa 6.3.
----------------------------------------------------------------------
$Id: RELNOTES-6.4.2,v 3.1 2006/02/03 17:21:54 brianp Exp $

View File

@@ -1,7 +1,5 @@
Mesa 6.5 Release Notes
month, day, 2005
Mesa 6.5 Release Notes
@@ -19,6 +17,9 @@ New Features
GL_EXT_timer_query - used to get elapsed time information from the renderer.
GL_EXT_packed_depth_stencil - defines a new GL_DEPTH_STENCIL_EXT pixel format.
GL_EXT_framebuffer_blit extension - simplified glCopyPixels-like feature
Driver Interface Changes
@@ -71,4 +72,4 @@ D3D needs updating
----------------------------------------------------------------------
$Id: RELNOTES-6.5,v 3.1 2005/09/14 14:34:54 brianp Exp $
$Id: RELNOTES-6.5,v 3.2 2006/03/02 04:12:34 brianp Exp $

View File

@@ -1407,10 +1407,38 @@ Mesa Version History
- fragment programs that wrote result.depth.z didn't work
6.4.1 November 30, 2005
Bug fixes:
- redefining a vertex program string didn't take effect in TNL module
- fixed occasional segfault upon vertex/fragment parsing error
- vertex program LIT instruction didn't handle 0^0=1 correctly
- fragment program fog option didn't work with glDrawPixels, glBitmap
- USE_MGL_NAMESPACE didn't work for x86-64
- OSMesa demos were missing from previous release tarballs
- fixed problem with float->ushort conversion in glClear (bug 4992)
- popping of GL_EYE_PLANE texgen state was broken (bug 4996)
- popping of GL_SPOT_DIRECTION light state was broken (bug 5005)
- fixed occasional triangle color interpolation problem on VMS
- work around invalid free() call (bug 5131)
- fixed BSD X server compilation problem by including stdint.h
6.4.2 February 2, 2006
New:
- added OSMesaColorClamp() function/feature
- added wglGetExtensionStringARB() function
Bug fixes:
- fixed some problems when building on Windows
- GLw header files weren't installed by installmesa script (bug 5396)
- GL/glfbdev.h file was missing from tarballs
- fixed TNL initialization bug which could lead to crash (bug 5791)
6.5 month, day, 2005
New:
- GL_EXT_packed_depth_stencil extension
- GL_EXT_timer_query extension
- GL_EXT_framebuffer_blit extension
- reflect demo improved to support multiple windows
- singlebuffer demo (shows no/little-flicker single-buffered rendering)
- r200: enable GL_ARB_texture_env_crossbar, separate the texture
@@ -1420,6 +1448,8 @@ Mesa Version History
- radeon: add support for all 3 tmus, GL_ARB_texture_cube_map
and GL_EXT_fog_coord
- MESA_GLX_ALPHA_BITS env var for xlib driver
- many DRI driver updates (including screen rotation support
for the Intel DRI driver)
Changes:
- removed GL_HP_occlusion_test (use GL_ARB_occlusion_query instead)
- removed GL_SGIX/SGIS_pixel_texture extensions

View File

@@ -23,16 +23,17 @@ generate exceptions.
</ul>
<p>
The following environment variables are only applicable to the Xlib/X11
software driver:
The following are only applicable to the Xlib software driver.
See <A HREF="README.X11">README.X11</A> for details.
</p>
<ul>
<li>MESA_RGB_VISUAL - specifies the X visual and depth for RGB mode (X only)
<li>MESA_CI_VISUAL - specifies the X visual and depth for CI mode (X only)
<li>MESA_BACK_BUFFER - specifies how to implement the back color buffer (X only)
<li>MESA_GAMMA - gamma correction coefficients (X only)
<li>MESA_XSYNC - enable synchronous X behavior (for X debugging only)
<li>MESA_GLX_FORCE_CI - if set, force GLX to treak 8bpp visuals as CI visuals
<li>MESA_RGB_VISUAL - specifies the X visual and depth for RGB mode
<li>MESA_CI_VISUAL - specifies the X visual and depth for CI mode
<li>MESA_BACK_BUFFER - specifies how to implement the back color buffer,
either "pixmap" or "ximage"
<li>MESA_GAMMA - gamma correction coefficients for red, green, blue channels
<li>MESA_XSYNC - enable synchronous X behavior (for debugging only)
<li>MESA_GLX_FORCE_CI - if set, force GLX to treat 8bpp visuals as CI visuals
<li>MESA_GLX_FX - set to either "fullscreen" for full-screen rendering,
"window" to render into a window, or "disable" to disable the Glide driver.
<li>MESA_GLX_FORCE_ALPHA - if set, forces RGB windows to have an alpha channel.

View File

@@ -21,7 +21,7 @@
<li><a href="http://math.nist.gov/f90gl" target="_parent">Fortran77/90 bindings for OpenGL and Mesa</a> - by William Mitchell
<li><a href="http://glow.sourceforge.net/" target="_parent">GLOW</a> - a GUI toolkit for GLUT and OpenGL
<li><a href="http://www.nigels.com/glt/">Glt</a> - an OpenGL C++ toolkit
<li><a href="http://www.opengl.org/developers/documentation/glut/" target="_parent">GLUT (GL Utility Toolkit)</a> - by Mark Kilgard
<li><a href="http://www.opengl.org/resources/libraries/glut.html" target="_parent">GLUT (GL Utility Toolkit)</a> - by Mark Kilgard
<li><a href="http://atrey.karlin.mff.cuni.cz/%7E0rfelyus/guileGL/" target="_parent">GuileGL</a> - OpenGL and GtkGLArea language bindings for Guile
<li><a href="http://www.rsinc.com/" target="_parent">IDL</a> - Interactive Data Language
<li><a href="http://www.newplanetsoftware.com/jx/" target="_parent">JX</a> - C++ application framework and GUI library

View File

@@ -14,7 +14,7 @@
</li><li><a href="http://mesa3d.sourceforge.net/notfound.html">ARCAD</a> - CAD program
</li><li><a href="http://www.mediascape.com/" target="_parent">Artstream</a> - provides
functionality like Corel Draw and Illustrator
</li><li><a href="http://www.blender.nl/" target="_parent">Blender</a> - 3-D animation
</li><li><a href="http://www.blender.org/" target="_parent">Blender</a> - 3-D animation
software
</li><li><a href="http://www.arq.net/%7Ekasten/demtools/" target="_parent">Demtools</a>
- Map viewer

View File

@@ -11,6 +11,72 @@
<H1>News</H1>
<h2>February 2, 2006</h2>
<p>
Mesa 6.4.2 has been released. This is primarily a bug-fix release.
</p>
<pre>
New items:
- added OSMesaColorClamp() function/feature
- added wglGetExtensionStringARB() function
Bug fixes:
- fixed some problems when building on Windows
- GLw header files weren't installed by installmesa script (bug 5396)
- GL/glfbdev.h file was missing from tarballs
</pre>
<p>
The MD5 checksums are:
</p>
<pre>
cb0d745d520fa7c2bb9178058b763544 MesaLib-6.4.2.tar.gz
7674d2c603b5834259e4e5a820cefd5b MesaLib-6.4.2.tar.bz2
d224e1325b33ff71a0f3893fc6b4d594 MesaLib-6.4.2.zip
d4b345d4588fc750cd3d34f3ac26673e MesaDemos-6.4.2.tar.gz
9cae1ab874af533ce356bd7dfe2e0bb0 MesaDemos-6.4.2.tar.bz2
2da6e1d1245e441d27813595c6ba50de MesaDemos-6.4.2.zip
84427d18c3453f0ea52388eeba7169b5 MesaGLUT-6.4.2.tar.gz
b157ba8ad1ea63260cf5339132e7aac6 MesaGLUT-6.4.2.tar.bz2
fe1523744fc05edc3811dfc6a1bf4181 MesaGLUT-6.4.2.zip
</pre>
<h2>November 29, 2005</h2>
<p>
Mesa 6.4.1 has been released. This is a stable, bug-fix release.
</p>
<pre>
Bug fixes:
- redefining a vertex program string didn't take effect in TNL module
- fixed occasional segfault upon vertex/fragment parsing error
- vertex program LIT instruction didn't handle 0^0=1 correctly
- fragment program fog option didn't work with glDrawPixels, glBitmap
- USE_MGL_NAMESPACE didn't work for x86-64
- OSMesa demos were missing from previous release tarballs
- fixed problem with float->ushort conversion in glClear (bug 4992)
- popping of GL_EYE_PLANE texgen state was broken (bug 4996)
- popping of GL_SPOT_DIRECTION light state was broken (bug 5005)
- fixed occasional triangle color interpolation problem on VMS
- work around invalid free() call (bug 5131)
- fixed BSD X server compilation problem by including stdint.h
</pre>
<p>
The MD5 checksums are:
</p>
<pre>
698ceb574cf882b0226761f5913c0da9 MesaLib-6.4.1.tar.gz
ea148c828ec6f645526451db1b8556f1 MesaLib-6.4.1.tar.bz2
42e93279468975ed2bf3111b8721e5d9 MesaLib-6.4.1.zip
e3b0d50807fd2bdcd1a95aaddd786f13 MesaDemos-6.4.1.tar.gz
99df1fdcb98d391666b476ca6f1dda8a MesaDemos-6.4.1.tar.bz2
b999d2c6d92fb4b7740a3dbd889348e3 MesaDemos-6.4.1.zip
eadfe01fe5ddfb1eb8227dd567b31635 MesaGLUT-6.4.1.tar.gz
bd003bb4f981a4f91dee4c38644d4f3f MesaGLUT-6.4.1.tar.bz2
71c401c037088bf688a88afdaeb3420f MesaGLUT-6.4.1.zip
</pre>
<h2>October 24, 2005</h2>
<p>
Mesa 6.4 has been released. This is a stable, bug-fix release.
@@ -1102,6 +1168,6 @@ source code</a>.</p>
<hr>
$Id: news.html,v 3.25 2005/10/24 23:33:27 brianp Exp $
$Id: news.html,v 3.26 2006/02/03 17:21:54 brianp Exp $
</body>
</html>

View File

@@ -13,6 +13,8 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<UL>
<LI><A HREF="RELNOTES-6.4.2">RELNOTES-6.4.2</A>
<LI><A HREF="RELNOTES-6.4.1">RELNOTES-6.4.1</A>
<LI><A HREF="RELNOTES-6.4">RELNOTES-6.4</A>
<LI><A HREF="RELNOTES-6.3.2">RELNOTES-6.3.2</A>
<LI><A HREF="RELNOTES-6.3">RELNOTES-6.3</A>

View File

@@ -2260,6 +2260,28 @@ typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pnam
#ifndef GL_EXT_framebuffer_blit
#define GL_EXT_framebuffer_blit 1
#define GL_READ_FRAMEBUFFER_EXT 0x8CA8
#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9
#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6
#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA
GLAPI void GLAPIENTRY
glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter);
typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC)
(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter);
#endif /* GL_EXT_framebuffer_blit */
#ifndef GL_EXT_packed_depth_stencil
#define GL_EXT_packed_depth_stencil 1

View File

@@ -379,6 +379,60 @@ extern Bool glXDrawableAttribARB(Display *dpy, GLXDrawable draw, const int *attr
#endif /* GLX_NV_float_buffer */
/*
* #?. GLX_MESA_swap_frame_usage
*/
#ifndef GLX_MESA_swap_frame_usage
#define GLX_MESA_swap_frame_usage 1
extern int glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable, float *usage);
extern int glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable);
extern int glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable);
extern int glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage);
typedef int (*PFNGLXGETFRAMEUSAGEMESAPROC) (Display *dpy, GLXDrawable drawable, float *usage);
typedef int (*PFNGLXBEGINFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable);
typedef int (*PFNGLXENDFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable);
typedef int (*PFNGLXQUERYFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage);
#endif /* GLX_MESA_swap_frame_usage */
/*
* #?. GLX_MESA_swap_control
*/
#ifndef GLX_MESA_swap_control
#define GLX_MESA_swap_control 1
extern int glXSwapIntervalMESA(unsigned int interval);
extern int glXGetSwapIntervalMESA(void);
typedef int (*PFNGLXSWAPINTERVALMESAPROC)(unsigned int interval);
typedef int (*PFNGLXGETSWAPINTERVALMESAPROC)(void);
#endif /* GLX_MESA_swap_control */
/*
* #?. GLX_EXT_texture_from_pixmap
* XXX not finished?
*/
#ifndef GLX_EXT_texture_from_pixmap
#define GLX_EXT_texture_from_pixmap 1
/* XXX need enums/tokens! */
extern Bool glXBindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer);
extern Bool glXReleaseTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer);
#endif /* GLX_EXT_texture_from_pixmap */
/*** Should these go here, or in another header? */
/*
** GLX Events

View File

@@ -331,7 +331,7 @@ typedef struct {
} GLXBufferClobberEventSGIX;
#endif
#if defined(__sun__)
#if defined(__sun__) || defined(__osf__)
#include <inttypes.h>
#if defined(__STDC__)
#if defined(__arch64__)

View File

@@ -111,6 +111,15 @@ WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDE
WGLAPI int GLAPIENTRY GetPixelFormat(HDC);
WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
#ifndef WGL_ARB_extensions_string
#define WGL_ARB_extensions_string 1
WGLAPI const char * GLAPIENTRY wglGetExtensionsStringARB(HDC hdc);
#endif /* WGL_ARB_extensions_string */
#ifdef _MSC_VER
# pragma warning( pop )
#endif

View File

@@ -64,9 +64,7 @@
** Versioning and extensions
*/
#define EGL_VERSION_1_0 1
#if 0
#define EGL_VERSION_1_1 1
#endif
/*
** Boolean
@@ -269,6 +267,56 @@ GLAPI EGLBoolean APIENTRY eglCopyContextMESA(EGLDisplay dpy, EGLContext source,
#endif /* EGL_MESA_copy_context */
/* XXX this is preliminary! */
#ifndef EGL_VERSION_1_2
#define EGL_VERSION_1_2 1
typedef int EGLenum;
typedef int EGLClientBuffer;
#define EGL_DISPLAY_SCALING 10000
#define EGL_UNKNOWN ((EGLint)-1)
#define EGL_OPENGL_ES_BIT 0x1
#define EGL_OPENVG_BIT 0x2
#define EGL_OPENGL_ES_API 0x30A0
#define EGL_OPENVG_API 0x30A1
#define EGL_LUMINANCE_SIZE 0x303D
#define EGL_ALPHA_MASK_SIZE 0x303E
#define EGL_COLOR_BUFFER_TYPE 0x303F
#define EGL_RENDERABLE_TYPE 0x3040
#define EGL_SINGLE_BUFFER 0x3085
#define EGL_RENDER_BUFFER 0x3086
#define EGL_COLORSPACE 0x3087
#define EGL_ALPHA_FORMAT 0x3088
#define EGL_COLORSPACE_sRGB 0x3089
#define EGL_COLORSPACE_LINEAR 0x308A
#define EGL_ALPHA_FORMAT_NONPRE 0x308B
#define EGL_ALPHA_FORMAT_PRE 0x308C
#define EGL_CLIENT_APIS 0x308D
#define EGL_RGB_BUFFER 0x308E
#define EGL_LUMINANCE_BUFFER 0x308F
#define EGL_HORIZONTAL_RESOLUTION 0x3090
#define EGL_VERTICAL_RESOLUTION 0x3091
#define EGL_PIXEL_ASPECT_RATIO 0x3092
#define EGL_SWAP_BEHAVIOR 0x3093
#define EGL_BUFFER_PRESERVED 0x3094
#define EGL_BUFFER_DESTROYED 0x3095
#define EGL_OPENVG_IMAGE 0x3096
#define EGL_CONTEXT_CLIENT_TYPE 0x3097
GLAPI EGLBoolean APIENTRY eglBindAPI(EGLenum api);
GLAPI EGLenum APIENTRY eglQueryAPI(void);
GLAPI EGLBoolean APIENTRY eglWaitClient(void);
GLAPI EGLBoolean APIENTRY eglReleaseThread(void);
GLAPI EGLSurface APIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
#endif /* EGL_VERSION_1_2 */
#ifdef __cplusplus
}
#endif

View File

@@ -15,6 +15,7 @@ LIB_DEP = $(LIB_DIR)/$(GL_LIB_NAME) $(LIB_DIR)/$(GLU_LIB_NAME) $(LIB_DIR)/$(GLUT
PROGS = \
arbfplight \
arbfslight \
arbocclude \
bounce \
clearspd \
@@ -24,10 +25,12 @@ PROGS = \
fogcoord \
fplight \
gamma \
gearbox \
gears \
geartrain \
glinfo \
gloss \
glslnoise.c \
gltestperf \
glutfx \
isosurf \

289
progs/demos/arbfslight.c Normal file
View File

@@ -0,0 +1,289 @@
/*
* Use GL_ARB_fragment_shader and GL_ARB_vertex_shader to implement
* simple per-pixel lighting.
*
* Michal Krol
* 20 February 2006
*
* Based on the original demo by:
* Brian Paul
* 17 April 2003
*/
#ifdef WIN32
#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#ifdef WIN32
#define GETPROCADDRESS wglGetProcAddress
#else
#define GETPROCADDRESS glutGetProcAddress
#endif
static GLfloat diffuse[4] = { 0.5f, 0.5f, 1.0f, 1.0f };
static GLfloat specular[4] = { 0.8f, 0.8f, 0.8f, 1.0f };
static GLfloat lightPos[4] = { 0.0f, 10.0f, 20.0f, 1.0f };
static GLfloat delta = 1.0f;
static GLhandleARB fragShader;
static GLhandleARB vertShader;
static GLhandleARB program;
static GLint uLightPos;
static GLint uDiffuse;
static GLint uSpecular;
static GLboolean anim = GL_TRUE;
static GLboolean wire = GL_FALSE;
static GLboolean pixelLight = GL_TRUE;
static GLint t0 = 0;
static GLint frames = 0;
static GLfloat xRot = 0.0f, yRot = 0.0f;
static PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL;
static PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL;
static PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL;
static PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL;
static PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL;
static PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL;
static PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL;
static PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL;
static PFNGLUNIFORM4FVARBPROC glUniform4fvARB = NULL;
static void Redisplay (void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (pixelLight)
{
glUseProgramObjectARB (program);
glUniform4fvARB (uLightPos, 1, lightPos);
glDisable(GL_LIGHTING);
}
else
{
glUseProgramObjectARB (0);
glLightfv (GL_LIGHT0, GL_POSITION, lightPos);
glEnable(GL_LIGHTING);
}
glPushMatrix ();
glRotatef (xRot, 1.0f, 0.0f, 0.0f);
glRotatef (yRot, 0.0f, 1.0f, 0.0f);
glutSolidSphere (2.0, 10, 5);
glPopMatrix ();
glutSwapBuffers();
frames++;
if (anim)
{
GLint t = glutGet (GLUT_ELAPSED_TIME);
if (t - t0 >= 5000)
{
GLfloat seconds = (GLfloat) (t - t0) / 1000.0f;
GLfloat fps = frames / seconds;
printf ("%d frames in %6.3f seconds = %6.3f FPS\n", frames, seconds, fps);
t0 = t;
frames = 0;
}
}
}
static void Idle (void)
{
lightPos[0] += delta;
if (lightPos[0] > 25.0f || lightPos[0] < -25.0f)
delta = -delta;
glutPostRedisplay ();
}
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 Key (unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch (key)
{
case ' ':
case 'a':
anim = !anim;
if (anim)
glutIdleFunc (Idle);
else
glutIdleFunc (NULL);
break;
case 'x':
lightPos[0] -= 1.0f;
break;
case 'X':
lightPos[0] += 1.0f;
break;
case 'w':
wire = !wire;
if (wire)
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
else
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
break;
case 'p':
pixelLight = !pixelLight;
if (pixelLight)
printf ("Per-pixel lighting\n");
else
printf ("Conventional lighting\n");
break;
case 27:
exit(0);
break;
}
glutPostRedisplay ();
}
static void SpecialKey (int key, int x, int y)
{
const GLfloat step = 3.0f;
(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 Init (void)
{
static const char *fragShaderText =
"uniform vec4 lightPos;\n"
"uniform vec4 diffuse;\n"
"uniform vec4 specular;\n"
"void main () {\n"
" // Compute dot product of light direction and normal vector\n"
" float dotProd;\n"
" dotProd = clamp (dot (normalize (lightPos).xyz, normalize (gl_TexCoord[0]).xyz), 0.0, 1.0);\n"
" // Compute diffuse and specular contributions\n"
" gl_FragColor = diffuse * dotProd + specular * pow (dotProd, 20.0);\n"
"}\n"
;
static const char *vertShaderText =
"void main () {\n"
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
" gl_TexCoord[0] = vec4 (gl_NormalMatrix * gl_Normal, 1.0);\n"
"}\n"
;
if (!glutExtensionSupported ("GL_ARB_fragment_shader"))
{
printf ("Sorry, this demo requires GL_ARB_fragment_shader\n");
exit(1);
}
if (!glutExtensionSupported ("GL_ARB_shader_objects"))
{
printf ("Sorry, this demo requires GL_ARB_shader_objects\n");
exit(1);
}
if (!glutExtensionSupported ("GL_ARB_shading_language_100"))
{
printf ("Sorry, this demo requires GL_ARB_shading_language_100\n");
exit(1);
}
if (!glutExtensionSupported ("GL_ARB_vertex_shader"))
{
printf ("Sorry, this demo requires GL_ARB_vertex_shader\n");
exit(1);
}
glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) GETPROCADDRESS ("glCreateShaderObjectARB");
glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) GETPROCADDRESS ("glShaderSourceARB");
glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) GETPROCADDRESS ("glCompileShaderARB");
glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) GETPROCADDRESS ("glCreateProgramObjectARB");
glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) GETPROCADDRESS ("glAttachObjectARB");
glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) GETPROCADDRESS ("glLinkProgramARB");
glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) GETPROCADDRESS ("glUseProgramObjectARB");
glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) GETPROCADDRESS ("glGetUniformLocationARB");
glUniform4fvARB = (PFNGLUNIFORM4FVARBPROC) GETPROCADDRESS ("glUniform4fvARB");
fragShader = glCreateShaderObjectARB (GL_FRAGMENT_SHADER_ARB);
glShaderSourceARB (fragShader, 1, &fragShaderText, NULL);
glCompileShaderARB (fragShader);
vertShader = glCreateShaderObjectARB (GL_VERTEX_SHADER_ARB);
glShaderSourceARB (vertShader, 1, &vertShaderText, NULL);
glCompileShaderARB (vertShader);
program = glCreateProgramObjectARB ();
glAttachObjectARB (program, fragShader);
glAttachObjectARB (program, vertShader);
glLinkProgramARB (program);
glUseProgramObjectARB (program);
uLightPos = glGetUniformLocationARB (program, "lightPos");
uDiffuse = glGetUniformLocationARB (program, "diffuse");
uSpecular = glGetUniformLocationARB (program, "specular");
glUniform4fvARB (uDiffuse, 1, diffuse);
glUniform4fvARB (uSpecular, 1, specular);
glClearColor (0.3f, 0.3f, 0.3f, 0.0f);
glEnable (GL_DEPTH_TEST);
glEnable (GL_LIGHT0);
glEnable (GL_LIGHTING);
glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse);
glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, specular);
glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 20.0f);
printf ("GL_RENDERER = %s\n", (const char *) glGetString (GL_RENDERER));
printf ("Press p to toggle between per-pixel and per-vertex lighting\n");
}
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]);
glutReshapeFunc (Reshape);
glutKeyboardFunc (Key);
glutSpecialFunc (SpecialKey);
glutDisplayFunc (Redisplay);
if (anim)
glutIdleFunc (Idle);
Init ();
glutMainLoop ();
return 0;
}

485
progs/demos/gearbox.c Normal file
View File

@@ -0,0 +1,485 @@
/*
* Use glCopyTexSubImage2D to draw animated gears on the sides of a box.
*
* Brian Paul
* 27 January 2006
*/
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <GL/glut.h>
#ifndef M_PI
#define M_PI 3.14159265
#endif
static GLint WinWidth = 800, WinHeight = 500;
static GLint TexWidth, TexHeight;
static GLuint TexObj = 1;
static GLenum IntFormat = GL_RGB;
static GLboolean WireFrame = GL_FALSE;
static GLint T0 = 0;
static GLint Frames = 0;
static GLint Win = 0;
static GLfloat ViewRotX = 20.0, ViewRotY = 30.0, ViewRotZ = 0.0;
static GLint Gear1, Gear2, Gear3;
static GLfloat GearRot = 0.0;
static GLfloat CubeRot = 0.0;
/**
Draw a gear wheel. You'll probably want to call this function when
building a display list since we do a lot of trig here.
Input: inner_radius - radius of hole at center
outer_radius - radius at center of teeth
width - width of gear
teeth - number of teeth
tooth_depth - depth of tooth
**/
static void
gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
GLint teeth, GLfloat tooth_depth)
{
GLint i;
GLfloat r0, r1, r2;
GLfloat angle, da;
GLfloat u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0;
r2 = outer_radius + tooth_depth / 2.0;
da = 2.0 * M_PI / teeth / 4.0;
glShadeModel(GL_FLAT);
glNormal3f(0.0, 0.0, 1.0);
/* draw front face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
if (i < teeth) {
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
}
}
glEnd();
/* draw front sides of teeth */
glBegin(GL_QUADS);
da = 2.0 * M_PI / teeth / 4.0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
}
glEnd();
glNormal3f(0.0, 0.0, -1.0);
/* draw back face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
if (i < teeth) {
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
}
}
glEnd();
/* draw back sides of teeth */
glBegin(GL_QUADS);
da = 2.0 * M_PI / teeth / 4.0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
}
glEnd();
/* draw outward faces of teeth */
glBegin(GL_QUAD_STRIP);
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
u = r2 * cos(angle + da) - r1 * cos(angle);
v = r2 * sin(angle + da) - r1 * sin(angle);
len = sqrt(u * u + v * v);
u /= len;
v /= len;
glNormal3f(v, -u, 0.0);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glNormal3f(cos(angle), sin(angle), 0.0);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
glNormal3f(v, -u, 0.0);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
glNormal3f(cos(angle), sin(angle), 0.0);
}
glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
glEnd();
glShadeModel(GL_SMOOTH);
/* draw inside radius cylinder */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glNormal3f(-cos(angle), -sin(angle), 0.0);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
}
glEnd();
}
static void
cleanup(void)
{
glDeleteTextures(1, &TexObj);
glDeleteLists(Gear1, 1);
glDeleteLists(Gear2, 1);
glDeleteLists(Gear3, 1);
glutDestroyWindow(Win);
}
static void
DrawGears(void)
{
if (WireFrame) {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
glPushMatrix();
glRotatef(20/*ViewRotX*/, 1.0, 0.0, 0.0);
glRotatef(ViewRotY, 0.0, 1.0, 0.0);
glRotatef(ViewRotZ, 0.0, 0.0, 1.0);
glPushMatrix();
glTranslatef(-3.0, -2.0, 0.0);
glRotatef(GearRot, 0.0, 0.0, 1.0);
glCallList(Gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1, -2.0, 0.0);
glRotatef(-2.0 * GearRot - 9.0, 0.0, 0.0, 1.0);
glCallList(Gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1, 4.2, 0.0);
glRotatef(-2.0 * GearRot - 25.0, 0.0, 0.0, 1.0);
glCallList(Gear3);
glPopMatrix();
glPopMatrix();
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
static void
DrawCube(void)
{
static const GLfloat texcoords[4][2] = {
{ 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1 }
};
static const GLfloat vertices[4][2] = {
{ -1, -1 }, { 1, -1 }, { 1, 1 }, { -1, 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 }
};
static const GLfloat mat[4] = { 1.0, 1.0, 0.5, 1.0 };
GLint i, j;
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat);
glEnable(GL_TEXTURE_2D);
glPushMatrix();
glRotatef(ViewRotX, 1.0, 0.0, 0.0);
glRotatef(15, 1, 0, 0);
glRotatef(CubeRot, 0, 1, 0);
glScalef(4, 4, 4);
for (i = 0; i < 6; i++) {
glPushMatrix();
glRotatef(xforms[i][0], xforms[i][1], xforms[i][2], xforms[i][3]);
glTranslatef(0, 0, 1.1);
glBegin(GL_POLYGON);
glNormal3f(0, 0, 1);
for (j = 0; j < 4; j++) {
glTexCoord2fv(texcoords[j]);
glVertex2fv(vertices[j]);
}
glEnd();
glPopMatrix();
}
glPopMatrix();
glDisable(GL_TEXTURE_2D);
}
static void
draw(void)
{
float ar;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
glDisable(GL_SCISSOR_TEST);
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_SCISSOR_TEST);
/* draw gears */
glViewport(0, 0, TexWidth, TexHeight);
glScissor(0, 0, TexWidth, TexHeight);
glClearColor(0.5, 0.5, 0.8, 0.0);
glClearColor(1, 1, 1, 0);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
DrawGears();
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, TexWidth, TexHeight);
/* draw textured cube */
glViewport(TexWidth, 0, WinWidth - TexWidth, WinHeight);
glScissor(TexWidth, 0, WinWidth - TexWidth, WinHeight);
glClearColor(0.5, 0.5, 0.8, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
ar = (float) (WinWidth - TexWidth) / WinHeight;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1.0, 1.0, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
DrawCube();
/* finish up */
glutSwapBuffers();
Frames++;
{
GLint t = glutGet(GLUT_ELAPSED_TIME);
if (t - T0 >= 5000) {
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
T0 = t;
Frames = 0;
}
}
}
static void
idle(void)
{
static double t0 = -1.;
double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
/* fmod to prevent overflow */
GearRot = fmod(GearRot + 70.0 * dt, 360.0); /* 70 deg/sec */
CubeRot = fmod(CubeRot + 15.0 * dt, 360.0); /* 15 deg/sec */
glutPostRedisplay();
}
/* change view angle, exit upon ESC */
static void
key(unsigned char k, int x, int y)
{
(void) x;
(void) y;
switch (k) {
case 'w':
WireFrame = !WireFrame;
break;
case 'z':
ViewRotZ += 5.0;
break;
case 'Z':
ViewRotZ -= 5.0;
break;
case 27: /* Escape */
cleanup();
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* change view angle */
static void
special(int k, int x, int y)
{
(void) x;
(void) y;
switch (k) {
case GLUT_KEY_UP:
ViewRotX += 5.0;
break;
case GLUT_KEY_DOWN:
ViewRotX -= 5.0;
break;
case GLUT_KEY_LEFT:
ViewRotY += 5.0;
break;
case GLUT_KEY_RIGHT:
ViewRotY -= 5.0;
break;
default:
return;
}
glutPostRedisplay();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
WinWidth = width;
WinHeight = height;
}
static void
init(int argc, char *argv[])
{
static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0};
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0};
GLint i;
glLightfv(GL_LIGHT0, GL_POSITION, pos);
#if 0
glEnable(GL_CULL_FACE);
#endif
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
/* make the gears */
Gear1 = glGenLists(1);
glNewList(Gear1, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
gear(1.0, 4.0, 1.0, 20, 0.7);
glEndList();
Gear2 = glGenLists(1);
glNewList(Gear2, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
gear(0.5, 2.0, 2.0, 10, 0.7);
glEndList();
Gear3 = glGenLists(1);
glNewList(Gear3, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
gear(1.3, 2.0, 0.5, 10, 0.7);
glEndList();
glEnable(GL_NORMALIZE);
/* xxx make size dynamic */
TexWidth = 256;
TexHeight = 256;
glBindTexture(GL_TEXTURE_2D, TexObj);
glTexImage2D(GL_TEXTURE_2D, 0, IntFormat, TexWidth, TexHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
for ( i=1; i<argc; i++ ) {
if (strcmp(argv[i], "-info")==0) {
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));
}
}
}
static void
visible(int vis)
{
if (vis == GLUT_VISIBLE)
glutIdleFunc(idle);
else
glutIdleFunc(NULL);
}
int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutInitWindowSize(WinWidth, WinHeight);
Win = glutCreateWindow("gearbox");
init(argc, argv);
glutDisplayFunc(draw);
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutVisibilityFunc(visible);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

175
progs/demos/glslnoise.c Executable file
View File

@@ -0,0 +1,175 @@
/*
* GLSL noise demo.
*
* Michal Krol
* 20 February 2006
*
* Based on the original demo by:
* Stefan Gustavson (stegu@itn.liu.se) 2004, 2005
*/
#ifdef WIN32
#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#ifdef WIN32
#define GETPROCADDRESS wglGetProcAddress
#else
#define GETPROCADDRESS glutGetProcAddress
#endif
static GLhandleARB fragShader;
static GLhandleARB vertShader;
static GLhandleARB program;
static GLint uTime;
static GLfloat u_time = 0.0f;
static PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL;
static PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL;
static PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL;
static PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL;
static PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL;
static PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL;
static PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL;
static PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL;
static PFNGLUNIFORM1FARBPROC glUniform1fARB = NULL;
static void Redisplay (void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUniform1fARB (uTime, u_time);
glPushMatrix ();
glutSolidSphere (2.0, 20, 10);
glPopMatrix ();
glutSwapBuffers();
}
static void Idle (void)
{
u_time += 0.1f;
glutPostRedisplay ();
}
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 Key (unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch (key)
{
case 27:
exit(0);
break;
}
glutPostRedisplay ();
}
static void Init (void)
{
static const char *fragShaderText =
"uniform float time;\n"
"void main () {\n"
" gl_FragColor = gl_Color * vec4 ((0.5 + 0.5 * vec3 (noise1 (\n"
" vec4 (4.0 * gl_TexCoord[0].xyz, 0.5 * time)))), 1.0);\n"
"}\n"
;
static const char *vertShaderText =
"void main () {\n"
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
" gl_TexCoord[0] = gl_Vertex;\n"
" gl_FrontColor = gl_Color;\n"
"}\n"
;
if (!glutExtensionSupported ("GL_ARB_fragment_shader"))
{
printf ("Sorry, this demo requires GL_ARB_fragment_shader\n");
exit(1);
}
if (!glutExtensionSupported ("GL_ARB_shader_objects"))
{
printf ("Sorry, this demo requires GL_ARB_shader_objects\n");
exit(1);
}
if (!glutExtensionSupported ("GL_ARB_shading_language_100"))
{
printf ("Sorry, this demo requires GL_ARB_shading_language_100\n");
exit(1);
}
if (!glutExtensionSupported ("GL_ARB_vertex_shader"))
{
printf ("Sorry, this demo requires GL_ARB_vertex_shader\n");
exit(1);
}
glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) wglGetProcAddress ("glCreateShaderObjectARB");
glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) wglGetProcAddress ("glShaderSourceARB");
glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) wglGetProcAddress ("glCompileShaderARB");
glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) wglGetProcAddress ("glCreateProgramObjectARB");
glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) wglGetProcAddress ("glAttachObjectARB");
glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) wglGetProcAddress ("glLinkProgramARB");
glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) wglGetProcAddress ("glUseProgramObjectARB");
glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) GETPROCADDRESS ("glGetUniformLocationARB");
glUniform1fARB = (PFNGLUNIFORM1FARBPROC) GETPROCADDRESS ("glUniform1fARB");
fragShader = glCreateShaderObjectARB (GL_FRAGMENT_SHADER_ARB);
glShaderSourceARB (fragShader, 1, &fragShaderText, NULL);
glCompileShaderARB (fragShader);
vertShader = glCreateShaderObjectARB (GL_VERTEX_SHADER_ARB);
glShaderSourceARB (vertShader, 1, &vertShaderText, NULL);
glCompileShaderARB (vertShader);
program = glCreateProgramObjectARB ();
glAttachObjectARB (program, fragShader);
glAttachObjectARB (program, vertShader);
glLinkProgramARB (program);
glUseProgramObjectARB (program);
uTime = glGetUniformLocationARB (program, "time");
glClearColor (0.0f, 0.1f, 0.3f, 1.0f);
glEnable (GL_CULL_FACE);
glEnable (GL_DEPTH_TEST);
printf ("GL_RENDERER = %s\n", (const char *) glGetString (GL_RENDERER));
}
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]);
glutReshapeFunc (Reshape);
glutKeyboardFunc (Key);
glutDisplayFunc (Redisplay);
glutIdleFunc (Idle);
Init ();
glutMainLoop ();
return 0;
}

View File

@@ -41,7 +41,6 @@
#undef GL_ARB_shadow_ambient
#endif
#define DEG_TO_RAD (3.14159 / 180.0)
static GLint WindowWidth = 450, WindowHeight = 300;
@@ -67,6 +66,7 @@ static GLfloat Bias = -0.06;
static GLboolean Anim = GL_TRUE;
static GLboolean UsePackedDepthStencil = GL_FALSE;
static GLboolean HaveEXTshadowFuncs = GL_FALSE;
static GLint Operator = 0;
static const GLenum OperatorFunc[8] = {
@@ -266,7 +266,7 @@ Display(void)
0, 1, 0); /* up */
glViewport(0, 0, ShadowTexWidth, ShadowTexHeight);
glClear(GL_DEPTH_BUFFER_BIT);
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
DrawScene();
/*
@@ -274,9 +274,21 @@ Display(void)
*/
if (DisplayMode == SHOW_DEPTH_MAPPING) {
/* load depth image as gray-scale luminance texture */
GLfloat *depth = (GLfloat *) malloc(ShadowTexWidth * ShadowTexHeight
* sizeof(GLfloat));
if (depth) {
if (UsePackedDepthStencil) {
GLuint *depth = (GLuint *) malloc(ShadowTexWidth * ShadowTexHeight
* sizeof(GLuint));
assert(depth);
glReadPixels(0, 0, ShadowTexWidth, ShadowTexHeight,
GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, depth);
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE,
ShadowTexWidth, ShadowTexHeight, 0,
GL_LUMINANCE, GL_UNSIGNED_INT, depth);
free(depth);
}
else {
GLfloat *depth = (GLfloat *) malloc(ShadowTexWidth * ShadowTexHeight
* sizeof(GLfloat));
assert(depth);
glReadPixels(0, 0, ShadowTexWidth, ShadowTexHeight,
GL_DEPTH_COMPONENT, GL_FLOAT, depth);
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE,
@@ -287,8 +299,18 @@ Display(void)
}
else {
/* The normal shadow case */
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
0, 0, ShadowTexWidth, ShadowTexHeight, 0);
if (UsePackedDepthStencil) {
GLint intFormat;
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL_EXT,
0, 0, ShadowTexWidth, ShadowTexHeight, 0);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
GL_TEXTURE_INTERNAL_FORMAT, &intFormat);
assert(intFormat == GL_DEPTH_STENCIL_EXT);
}
else {
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
0, 0, ShadowTexWidth, ShadowTexHeight, 0);
}
}
/*
@@ -447,6 +469,17 @@ Key(unsigned char key, int x, int y)
OperatorFunc[Operator]);
}
break;
case 'p':
UsePackedDepthStencil = !UsePackedDepthStencil;
if (UsePackedDepthStencil
&& !glutExtensionSupported("GL_EXT_packed_depth_stencil")) {
printf("Sorry, GL_EXT_packed_depth_stencil not supported\n");
UsePackedDepthStencil = GL_FALSE;
}
else {
printf("Use GL_DEPTH_STENCIL_EXT: %d\n", UsePackedDepthStencil);
}
break;
case 'z':
Zrot -= step;
break;
@@ -572,6 +605,7 @@ PrintHelp(void)
printf(" n = show normal, shadowed image\n");
printf(" f = toggle nearest/bilinear texture filtering\n");
printf(" b/B = decrease/increase shadow map Z bias\n");
printf(" p = toggle use of packed depth/stencil\n");
printf(" cursor keys = rotate scene\n");
printf(" <shift> + cursor keys = rotate light source\n");
if (HaveEXTshadowFuncs)
@@ -585,7 +619,7 @@ main(int argc, char *argv[])
glutInit(&argc, argv);
glutInitWindowPosition(0, 0);
glutInitWindowSize(WindowWidth, WindowHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL);
glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);

View File

@@ -82,60 +82,12 @@ static void render_image( void )
glutSolidCone(1.0, 2.0, 16, 1);
glPopMatrix();
#ifdef GL_HP_occlusion_test
if (perf == 0) {
GLboolean bRet;
glDepthMask(GL_FALSE);
glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
glEnable(GL_OCCLUSION_TEST_HP);
glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet);
glPushMatrix();
glTranslatef(0.75, 0.0, -1.0);
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue_mat );
glutSolidSphere(1.0, 20, 20);
glPopMatrix();
glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet);
printf("Occlusion test 1 (result should be 1): %d\n",bRet);
glDepthMask(GL_TRUE);
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
glDisable(GL_OCCLUSION_TEST_HP);
}
#endif
glPushMatrix();
glTranslatef(0.75, 0.0, -1.0);
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue_mat );
glutSolidSphere(1.0, 20, 20);
glPopMatrix();
#ifdef GL_HP_occlusion_test
if (perf == 0){
GLboolean bRet;
glDepthMask(GL_FALSE);
glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
glEnable(GL_OCCLUSION_TEST_HP);
glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet);
/* draw a sphere inside the previous sphere */
glPushMatrix();
glTranslatef(0.75, 0.0, -1.0);
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue_mat );
glutSolidSphere(0.5, 20, 20);
glPopMatrix();
glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet);
printf("Occlusion test 2 (result should be 0): %d\n",bRet);
glDepthMask(GL_TRUE);
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
glDisable(GL_OCCLUSION_TEST_HP);
}
#endif
glPopMatrix();
/* This is very important!!!

View File

@@ -10,11 +10,14 @@ include $(TOP)/configs/current
LIBS = $(APP_LIB_DEPS)
SOURCES = antialias.c \
SOURCES = \
afsmultiarb.c \
antialias.c \
arbfpspec.c \
arbfptest1.c \
arbfptexture.c \
arbfptrig.c \
arbnpot.c \
arbvptest1.c \
arbvptest3.c \
arbvptorus.c \
@@ -22,8 +25,10 @@ SOURCES = antialias.c \
blendminmax.c \
blendsquare.c \
bufferobj.c \
bug_3050.c \
bug_3101.c \
bug_3195.c \
copypixrate.c \
crossbar.c \
cva.c \
dinoshade.c \
@@ -37,6 +42,7 @@ SOURCES = antialias.c \
getprocaddress.c \
interleave.c \
invert.c \
jkrahntest.c \
manytex.c \
multipal.c \
no_s3tc.c \
@@ -47,6 +53,7 @@ SOURCES = antialias.c \
sharedtex.c \
stencilwrap.c \
stencil_wrap.c \
subtexrate.c \
tex1d.c \
texfilt.c \
texline.c \

View File

@@ -1,13 +1,9 @@
/*
* GL_ARB_multitexture demo
* GL_ATI_fragment_shader test
* Roland Scheidegger
*
* Command line options:
* -info print GL implementation information
*
*
* Brian Paul November 1998 This program is in the public domain.
* Modified on 12 Feb 2002 for > 2 texture units.
*/

162
progs/tests/bug_3050.c Normal file
View File

@@ -0,0 +1,162 @@
/*
* (C) Copyright IBM Corporation 2006
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file bug_3050.c
*
* Simple regression test for bug #3050. Create a texture and make a few
* calls to \c glGetTexLevelParameteriv. If the bug still exists, trying
* to get \c GL_TEXTURE_WITDH will cause a protocol error.
*
* This test \b only applies to indirect-rendering. This may mean that the
* test needs to be run with the environment variable \c LIBGL_ALWAYS_INDIRECT
* set to a non-zero value.
*
* \author Ian Romanick <idr@us.ibm.com>
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glut.h>
static int Width = 400;
static int Height = 200;
static const GLfloat Near = 5.0, Far = 25.0;
static void Display( void )
{
}
static void Reshape( int width, int height )
{
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void Init( void )
{
unsigned i;
static const GLenum pnames[] = {
GL_TEXTURE_RED_SIZE,
GL_TEXTURE_GREEN_SIZE,
GL_TEXTURE_BLUE_SIZE,
GL_TEXTURE_ALPHA_SIZE,
GL_TEXTURE_LUMINANCE_SIZE,
GL_TEXTURE_INTENSITY_SIZE,
GL_TEXTURE_BORDER,
GL_TEXTURE_INTERNAL_FORMAT,
GL_TEXTURE_WIDTH,
GL_TEXTURE_HEIGHT,
GL_TEXTURE_DEPTH,
~0
};
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("\nThis program should log some data about a texture and exit.\n");
printf("This is a regression test for bug #3050. If the bug still\n");
printf("exists, a GLX protocol error will be generated.\n");
printf("https://bugs.freedesktop.org/show_bug.cgi?id=3050\n\n");
if ( ! glutExtensionSupported( "GL_NV_texture_rectangle" )
&& ! glutExtensionSupported( "GL_EXT_texture_rectangle" )
&& ! glutExtensionSupported( "GL_ARB_texture_rectangle" ) ) {
printf( "This test requires one of GL_ARB_texture_rectangle, GL_EXT_texture_rectangle,\n"
"or GL_NV_texture_rectangle be supported\n." );
exit( 1 );
}
glBindTexture( GL_TEXTURE_RECTANGLE_NV, 1 );
glTexImage2D( GL_PROXY_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, 8, 8, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL );
for ( i = 0 ; pnames[i] != ~0 ; i++ ) {
GLint param_i;
GLfloat param_f;
GLenum err;
glGetTexLevelParameteriv( GL_PROXY_TEXTURE_RECTANGLE_NV, 0, pnames[i], & param_i );
err = glGetError();
if ( err ) {
printf("glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) generated a GL\n"
"error of 0x%04x!",
pnames[i], err );
exit( 1 );
}
else {
printf("glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) = 0x%04x\n",
pnames[i], param_i );
}
glGetTexLevelParameterfv( GL_PROXY_TEXTURE_RECTANGLE_NV, 0, pnames[i], & param_f );
err = glGetError();
if ( err ) {
printf("glGetTexLevelParameterfv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) generated a GL\n"
"error of 0x%04x!\n",
pnames[i], err );
exit( 1 );
}
else {
printf("glGetTexLevelParameterfv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) = %.1f (0x%04x)\n",
pnames[i], param_f, (GLint) param_f );
}
}
}
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( Width, Height );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
glutCreateWindow( "Bug #3050 Test" );
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
Init();
return 0;
}

View File

@@ -185,8 +185,8 @@ static void Init( void )
printf("\nThis program should function nearly identically to Mesa's lodbias demo.\n"
"It should cycle through the complet LOD bias range once and exit. If bug\n"
"#3195 still exists, the demo should crash almost immediatly.\n");
printf("This is a regression test for bug #3101.\n");
printf("https://bugs.freedesktop.org/show_bug.cgi?id=3101\n");
printf("This is a regression test for bug #3195.\n");
printf("https://bugs.freedesktop.org/show_bug.cgi?id=3195\n");
if (!glutExtensionSupported("GL_EXT_texture_lod_bias")) {
printf("Sorry, GL_EXT_texture_lod_bias not supported by this renderer.\n");

259
progs/tests/copypixrate.c Normal file
View File

@@ -0,0 +1,259 @@
/*
* Measure glCopyPixels speed
*
* Brian Paul
* 26 Jan 2006
*/
#define GL_GLEXT_PROTOTYPES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <GL/glut.h>
static GLint WinWidth = 1000, WinHeight = 800;
static GLint ImgWidth, ImgHeight;
static GLenum Buffer = GL_FRONT;
static GLenum AlphaTest = GL_FALSE;
static GLboolean UseBlit = GL_FALSE;
static PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT_func = NULL;
/**
* draw teapot in lower-left corner of window
*/
static void
DrawTestImage(void)
{
GLfloat ar;
ImgWidth = WinWidth / 3;
ImgHeight = WinHeight / 3;
glViewport(0, 0, ImgWidth, ImgHeight);
glScissor(0, 0, ImgWidth, ImgHeight);
glEnable(GL_SCISSOR_TEST);
glClearColor(0.5, 0.5, 0.5, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
ar = (float) WinWidth / WinHeight;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0);
glMatrixMode(GL_MODELVIEW);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glFrontFace(GL_CW);
glPushMatrix();
glRotatef(45, 1, 0, 0);
glutSolidTeapot(2.0);
glPopMatrix();
glFrontFace(GL_CCW);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glDisable(GL_SCISSOR_TEST);
glViewport(0, 0, WinWidth, WinHeight);
glFinish();
}
static int
Rand(int max)
{
return ((int) random()) % max;
}
/**
* Measure glCopyPixels rate
*/
static void
RunTest(void)
{
double t1, t0 = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
int iters = 0;
float copyRate, mbRate;
int r, g, b, a, bpp;
if (AlphaTest) {
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.0);
}
glGetIntegerv(GL_RED_BITS, &r);
glGetIntegerv(GL_GREEN_BITS, &g);
glGetIntegerv(GL_BLUE_BITS, &b);
glGetIntegerv(GL_ALPHA_BITS, &a);
bpp = (r + g + b + a) / 8;
do {
int x, y;
x = Rand(WinWidth);
y = Rand(WinHeight);
if (x > ImgWidth || y > ImgHeight) {
#ifdef GL_EXT_framebuffer_blit
if (UseBlit)
{
glBlitFramebufferEXT_func(0, 0, ImgWidth, ImgHeight,
x, y, x + ImgWidth, y + ImgHeight,
GL_COLOR_BUFFER_BIT, GL_LINEAR);
}
else
#endif
{
glWindowPos2iARB(x, y);
glCopyPixels(0, 0, ImgWidth, ImgHeight, GL_COLOR);
}
glFinish(); /* XXX OK? */
iters++;
t1 = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
}
} while (t1 - t0 < 5.0);
glDisable(GL_ALPHA_TEST);
copyRate = iters / (t1 - t0);
mbRate = ImgWidth * ImgHeight * bpp * copyRate / (1024 * 1024);
printf("Image size: %d x %d, %d Bpp\n", ImgWidth, ImgHeight, bpp);
printf("%d copies in %.2f = %.2f copies/sec, %.2f MB/s\n",
iters, t1-t0, copyRate, mbRate);
}
static void
Draw(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glClearColor(0.2, 0.2, 0.8, 0);
glReadBuffer(Buffer);
glDrawBuffer(Buffer);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
DrawTestImage();
RunTest();
if (Buffer == GL_FRONT)
glFinish();
else
glutSwapBuffers();
printf("exiting\n");
exit(0);
}
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.0, 0.0, -15.0);
}
static void
Key(unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void
SpecialKey(int key, int x, int y)
{
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
break;
case GLUT_KEY_DOWN:
break;
case GLUT_KEY_LEFT:
break;
case GLUT_KEY_RIGHT:
break;
}
glutPostRedisplay();
}
static void
ParseArgs(int argc, char *argv[])
{
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-back") == 0)
Buffer = GL_BACK;
else if (strcmp(argv[i], "-alpha") == 0)
AlphaTest = GL_TRUE;
else if (strcmp(argv[i], "-blit") == 0)
UseBlit = GL_TRUE;
}
}
static void
Init(void)
{
if (glutExtensionSupported("GL_EXT_framebuffer_blit")) {
glBlitFramebufferEXT_func = (PFNGLBLITFRAMEBUFFEREXTPROC)
glutGetProcAddress("glBlitFramebufferEXT");
}
else if (UseBlit) {
printf("Warning: GL_EXT_framebuffer_blit not supported.\n");
UseBlit = GL_FALSE;
}
}
int
main(int argc, char *argv[])
{
GLint mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE | GLUT_DEPTH;
glutInit(&argc, argv);
ParseArgs(argc, argv);
if (AlphaTest)
mode |= GLUT_ALPHA;
glutInitWindowPosition(0, 0);
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(mode);
glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
glutDisplayFunc(Draw);
printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
printf("Draw Buffer: %s\n", (Buffer == GL_BACK) ? "Back" : "Front");
Init();
glutMainLoop();
return 0;
}

View File

@@ -17,15 +17,26 @@
#include <string.h>
#include <math.h>
/* For debug */
#define DEPTH 1
#define STENCIL 1
#define DRAW 1
static int Width = 400, Height = 400;
static GLenum TexTarget = GL_TEXTURE_2D; /*GL_TEXTURE_RECTANGLE_ARB;*/
static int TexWidth = 512, TexHeight = 512;
/*static int TexWidth = 600, TexHeight = 600;*/
static GLuint MyFB;
static GLuint TexObj;
static GLuint DepthRB, StencilRB;
static GLboolean Anim = GL_FALSE;
static GLfloat Rot = 0.0;
static GLboolean UsePackedDepthStencil = GL_FALSE;
static GLuint TextureLevel = 1; /* which texture level to render to */
static GLenum TexIntFormat = GL_RGB; /* either GL_RGB or GL_RGBA */
static void
@@ -41,7 +52,7 @@ CheckError(int line)
static void
Idle(void)
{
Rot = glutGet(GLUT_ELAPSED_TIME) * 0.05;
Rot = glutGet(GLUT_ELAPSED_TIME) * 0.1;
glutPostRedisplay();
}
@@ -49,7 +60,6 @@ Idle(void)
static void
RenderTexture(void)
{
GLint level = 0;
GLenum status;
glMatrixMode(GL_PROJECTION);
@@ -60,10 +70,7 @@ RenderTexture(void)
glTranslatef(0.0, 0.0, -15.0);
/* draw to texture image */
glBindTexture(GL_TEXTURE_2D, 0);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D, TexObj, level);
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
@@ -76,13 +83,19 @@ RenderTexture(void)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
CheckError(__LINE__);
#if DEPTH
glEnable(GL_DEPTH_TEST);
#endif
#if STENCIL
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_NEVER, 1, ~0);
glStencilOp(GL_REPLACE, GL_KEEP, GL_REPLACE);
#endif
CheckError(__LINE__);
#if DEPTH || STENCIL
/* draw diamond-shaped stencil pattern */
glColor3f(0, 1, 0);
glBegin(GL_POLYGON);
@@ -91,10 +104,13 @@ RenderTexture(void)
glVertex2f( 0.2, 0.0);
glVertex2f( 0.0, 0.2);
glEnd();
#endif
/* draw teapot where stencil != 1 */
#if STENCIL
glStencilFunc(GL_NOTEQUAL, 1, ~0);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
#endif
CheckError(__LINE__);
@@ -115,12 +131,18 @@ RenderTexture(void)
glutSolidTeapot(0.5);
glPopMatrix();
glDisable(GL_LIGHTING);
/*
PrintStencilHistogram(TexWidth, TexHeight);
*/
#endif
glDisable(GL_DEPTH_TEST);
glDisable(GL_STENCIL_TEST);
#if DRAW
/* Bind normal framebuffer */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
#endif
CheckError(__LINE__);
}
@@ -135,7 +157,7 @@ Display(void)
RenderTexture();
/* draw textured quad in the window */
#if DRAW
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0);
@@ -150,23 +172,38 @@ Display(void)
glPushMatrix();
glRotatef(Rot, 0, 1, 0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, TexObj);
glEnable(TexTarget);
glBindTexture(TexTarget, TexObj);
glBegin(GL_POLYGON);
glColor3f(0.25, 0.25, 0.25);
glTexCoord2f(0, 0);
glVertex2f(-1, -1);
glTexCoord2f(1, 0);
glVertex2f(1, -1);
glColor3f(1.0, 1.0, 1.0);
glTexCoord2f(1, 1);
glVertex2f(1, 1);
glTexCoord2f(0, 1);
glVertex2f(-1, 1);
if (TexTarget == GL_TEXTURE_2D) {
glTexCoord2f(0, 0);
glVertex2f(-1, -1);
glTexCoord2f(1, 0);
glVertex2f(1, -1);
glColor3f(1.0, 1.0, 1.0);
glTexCoord2f(1, 1);
glVertex2f(1, 1);
glTexCoord2f(0, 1);
glVertex2f(-1, 1);
}
else {
assert(TexTarget == GL_TEXTURE_RECTANGLE_ARB);
glTexCoord2f(0, 0);
glVertex2f(-1, -1);
glTexCoord2f(TexWidth, 0);
glVertex2f(1, -1);
glColor3f(1.0, 1.0, 1.0);
glTexCoord2f(TexWidth, TexHeight);
glVertex2f(1, 1);
glTexCoord2f(0, TexHeight);
glVertex2f(-1, 1);
}
glEnd();
glPopMatrix();
glDisable(GL_TEXTURE_2D);
glDisable(TexTarget);
#endif
glutSwapBuffers();
CheckError(__LINE__);
}
@@ -184,9 +221,13 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
#if DEPTH
glDeleteRenderbuffersEXT(1, &DepthRB);
#endif
#if STENCIL
if (!UsePackedDepthStencil)
glDeleteRenderbuffersEXT(1, &StencilRB);
#endif
glDeleteFramebuffersEXT(1, &MyFB);
glDeleteTextures(1, &TexObj);
@@ -222,6 +263,7 @@ Key(unsigned char key, int x, int y)
static void
Init(int argc, char *argv[])
{
static const GLfloat mat[4] = { 1.0, 0.5, 0.5, 1.0 };
GLint i;
if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
@@ -253,6 +295,31 @@ Init(int argc, char *argv[])
glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &i);
assert(i == MyFB);
/* Make texture object/image */
glGenTextures(1, &TexObj);
glBindTexture(TexTarget, TexObj);
/* make two image levels */
glTexImage2D(TexTarget, 0, TexIntFormat, TexWidth, TexHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexImage2D(TexTarget, 1, TexIntFormat, TexWidth/2, TexHeight/2, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
TexWidth = TexWidth >> TextureLevel;
TexHeight = TexHeight >> TextureLevel;
glTexParameteri(TexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(TexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(TexTarget, GL_TEXTURE_BASE_LEVEL, TextureLevel);
glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, TextureLevel);
CheckError(__LINE__);
/* Render color to texture */
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
TexTarget, TexObj, TextureLevel);
#if DEPTH
/* make depth renderbuffer */
glGenRenderbuffersEXT(1, &DepthRB);
assert(DepthRB);
@@ -275,9 +342,11 @@ Init(int argc, char *argv[])
/* attach DepthRB to MyFB */
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, DepthRB);
#endif
CheckError(__LINE__);
#if STENCIL
if (UsePackedDepthStencil) {
/* DepthRb is a combined depth/stencil renderbuffer */
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
@@ -303,23 +372,16 @@ Init(int argc, char *argv[])
CheckError(__LINE__);
printf("Stencil renderbuffer size = %d bits\n", i);
assert(i > 0);
#endif
CheckError(__LINE__);
/* bind regular framebuffer */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
CheckError(__LINE__);
/* Make texture object/image */
glGenTextures(1, &TexObj);
glBindTexture(GL_TEXTURE_2D, TexObj);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TexWidth, TexHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
CheckError(__LINE__);
/* lighting */
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat);
}

View File

@@ -1,4 +1,4 @@
/* $Id: jkrahntest.c,v 1.1 2002/06/16 03:57:48 brianp Exp $ */
/* $Id: jkrahntest.c,v 1.2 2006/01/30 17:12:10 brianp Exp $ */
/* This is a good test for glXSwapBuffers on non-current windows,
* and the glXCopyContext function. Fixed several Mesa/DRI bugs with
@@ -25,7 +25,11 @@
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#ifndef M_PI
#define M_PI 3.14159
#endif
#define DEGTOR (M_PI/180.0)
static int AttributeList[] = { GLX_RGBA, GLX_DOUBLEBUFFER, None };

350
progs/tests/subtexrate.c Normal file
View File

@@ -0,0 +1,350 @@
/*
* Measure glTexSubImage and glCopyTexSubImage speed
*
* Brian Paul
* 26 Jan 2006
*/
#define GL_GLEXT_PROTOTYPES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <GL/glut.h>
static GLint WinWidth = 1024, WinHeight = 512;
static GLint TexWidth = 512, TexHeight = 512;
static GLuint TexObj = 1;
static GLenum IntFormat = GL_RGBA8;
static GLenum ReadFormat = GL_RGBA; /* for glReadPixels */
static GLboolean DrawQuad = GL_TRUE;
/**
* draw teapot image, size TexWidth by TexHeight
*/
static void
DrawTestImage(void)
{
GLfloat ar;
glViewport(0, 0, TexWidth, TexHeight);
glScissor(0, 0, TexWidth, TexHeight);
glEnable(GL_SCISSOR_TEST);
glClearColor(0.5, 0.5, 0.5, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
ar = (float) TexWidth / TexHeight;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0);
glMatrixMode(GL_MODELVIEW);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glFrontFace(GL_CW);
glPushMatrix();
glRotatef(45, 1, 0, 0);
glRotatef(45, 0, 1, 0);
glutSolidTeapot(2.3);
glPopMatrix();
glFrontFace(GL_CCW);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glDisable(GL_SCISSOR_TEST);
glViewport(0, 0, WinWidth, WinHeight);
glFinish();
}
/**
* Do glCopyTexSubImage2D call (update texture with framebuffer data)
* If doSubRect is true, do the copy in four pieces instead of all at once.
*/
static void
DoCopyTex(GLboolean doSubRect)
{
if (doSubRect) {
/* copy in four parts */
int w = TexWidth / 2, h = TexHeight / 2;
int x0 = 0, y0 = 0;
int x1 = w, y1 = h;
#if 1
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, x0, y0, w, h);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y0, x1, y0, w, h);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y1, x0, y1, w, h);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y1, x1, y1, w, h);
#else
/* scramble */
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, x1, y1, w, h);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y0, x0, y1, w, h);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y1, x1, y0, w, h);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y1, x0, y0, w, h);
#endif
}
else {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, TexWidth, TexHeight);
}
}
/**
* Do glTexSubImage2D (update texture w/ user data)
* If doSubRect, do update in four pieces, else all at once.
*/
static void
SubTex(GLboolean doSubRect, const GLubyte *image)
{
if (doSubRect) {
/* four pieces */
int w = TexWidth / 2, h = TexHeight / 2;
int x0 = 0, y0 = 0;
int x1 = w, y1 = h;
glPixelStorei(GL_UNPACK_ROW_LENGTH, TexWidth);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_SKIP_ROWS, y0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, x0);
glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, w, h,
ReadFormat, GL_UNSIGNED_BYTE, image);
glPixelStorei(GL_UNPACK_SKIP_ROWS, y0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1);
glTexSubImage2D(GL_TEXTURE_2D, 0, x1, y0, w, h,
ReadFormat, GL_UNSIGNED_BYTE, image);
glPixelStorei(GL_UNPACK_SKIP_ROWS, y1);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, x0);
glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y1, w, h,
ReadFormat, GL_UNSIGNED_BYTE, image);
glPixelStorei(GL_UNPACK_SKIP_ROWS, y1);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1);
glTexSubImage2D(GL_TEXTURE_2D, 0, x1, y1, w, h,
ReadFormat, GL_UNSIGNED_BYTE, image);
}
else {
/* all at once */
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TexWidth, TexHeight,
ReadFormat, GL_UNSIGNED_BYTE, image);
}
}
/**
* Measure gl[Copy]TexSubImage rate.
* This actually also includes time to render a quad and SwapBuffers.
*/
static void
RunTest(GLboolean copyTex, GLboolean doSubRect)
{
double t0, t1;
int iters = 0;
float copyRate, mbRate;
float rot = 0.0;
int bpp, r, g, b, a;
int w, h;
GLubyte *image = NULL;
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &r);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &g);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &b);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &a);
bpp = (r + g + b + a) / 8;
if (!copyTex) {
/* read image from frame buffer */
image = (GLubyte *) malloc(TexWidth * TexHeight * bpp);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, TexWidth, TexHeight,
ReadFormat, GL_UNSIGNED_BYTE, image);
}
glEnable(GL_TEXTURE_2D);
glViewport(WinWidth / 2, 0, WinWidth / 2, WinHeight);
t0 = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
do {
if (copyTex)
/* Framebuffer -> Texture */
DoCopyTex(doSubRect);
else {
/* Main Mem -> Texture */
SubTex(doSubRect, image);
}
/* draw textured quad */
if (DrawQuad) {
glPushMatrix();
glRotatef(rot, 0, 0, 1);
glTranslatef(1, 0, 0);
glBegin(GL_POLYGON);
glTexCoord2f(0, 0); glVertex2f(-1, -1);
glTexCoord2f(1, 0); glVertex2f( 1, -1);
glTexCoord2f(1, 1); glVertex2f( 1, 1);
glTexCoord2f(0, 1); glVertex2f(-1, 1);
glEnd();
glPopMatrix();
}
iters++;
rot += 2.0;
t1 = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (DrawQuad) {
glutSwapBuffers();
}
} while (t1 - t0 < 5.0);
glDisable(GL_TEXTURE_2D);
if (image)
free(image);
if (doSubRect) {
w = TexWidth / 2;
h = TexHeight / 2;
iters *= 4;
}
else {
w = TexWidth;
h = TexHeight;
}
copyRate = iters / (t1 - t0);
mbRate = w * h * bpp * copyRate / (1024 * 1024);
if (copyTex)
printf("glCopyTexSubImage: %d x %d, %d Bpp:\n", w, h, bpp);
else
printf("glTexSubImage: %d x %d, %d Bpp:\n", w, h, bpp);
printf(" %d calls in %.2f = %.2f calls/sec, %.2f MB/s\n",
iters, t1-t0, copyRate, mbRate);
}
static void
Draw(void)
{
glClearColor(0.2, 0.2, 0.8, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
DrawTestImage();
if (!DrawQuad) {
glutSwapBuffers();
}
RunTest(GL_FALSE, GL_FALSE);
RunTest(GL_FALSE, GL_TRUE);
RunTest(GL_TRUE, GL_FALSE);
RunTest(GL_TRUE, GL_TRUE);
glutSwapBuffers();
printf("exiting\n");
exit(0);
}
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.0, 0.0, -15.0);
}
static void
Key(unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void
SpecialKey(int key, int x, int y)
{
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
break;
case GLUT_KEY_DOWN:
break;
case GLUT_KEY_LEFT:
break;
case GLUT_KEY_RIGHT:
break;
}
glutPostRedisplay();
}
static void
Init(void)
{
/* create initial, empty teximage */
glBindTexture(GL_TEXTURE_2D, TexObj);
glTexImage2D(GL_TEXTURE_2D, 0, IntFormat, TexWidth, TexHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
}
static void
ParseArgs(int argc, char *argv[])
{
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-nodraw") == 0)
DrawQuad = GL_FALSE;
}
}
int
main(int argc, char *argv[])
{
GLint mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE | GLUT_DEPTH;
glutInit(&argc, argv);
ParseArgs(argc, argv);
glutInitWindowPosition(0, 0);
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(mode);
glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
glutDisplayFunc(Draw);
printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
Init();
glutMainLoop();
return 0;
}

View File

@@ -97,7 +97,7 @@ static rawImageRec *RawImageOpen(const char *fileName)
swapFlag = GL_FALSE;
}
raw = (rawImageRec *)malloc(sizeof(rawImageRec));
raw = (rawImageRec *)calloc(1, sizeof(rawImageRec));
if (raw == NULL) {
fprintf(stderr, "Out of memory!\n");
return NULL;
@@ -148,12 +148,15 @@ static rawImageRec *RawImageOpen(const char *fileName)
static void RawImageClose(rawImageRec *raw)
{
fclose(raw->file);
free(raw->tmp);
free(raw->tmpR);
free(raw->tmpG);
free(raw->tmpB);
if (raw->rowStart)
free(raw->rowStart);
if (raw->rowSize)
free(raw->rowSize);
if (raw->sizeZ>3) {
free(raw->tmpA);
}

View File

@@ -23,6 +23,7 @@
/*
* This program tests GLX thread safety.
* Command line options:
* -p Open a display connection for each thread
* -n <num threads> Number of threads to create (default is 2)
* -display <display name> Specify X display (default is :0.0)
*
@@ -32,6 +33,7 @@
#if defined(PTHREADS) /* defined by Mesa on Linux and other platforms */
#include <assert.h>
#include <GL/gl.h>
#include <GL/glx.h>
#include <stdio.h>
@@ -61,6 +63,10 @@ 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 pthread_mutex_t Mutex;
static void
@@ -145,9 +151,22 @@ resize(struct winthread *wt, int w, int h)
static void
draw_loop(struct winthread *wt)
{
GLboolean firstIter = GL_TRUE;
while (!ExitFlag) {
if (Locking)
pthread_mutex_lock(&Mutex);
glXMakeCurrent(wt->Dpy, wt->Win, wt->Context);
if (firstIter) {
printf("glthreads: %d: GL_RENDERER = %s\n", wt->Index,
(char *) glGetString(GL_RENDERER));
firstIter = GL_FALSE;
}
if (Locking)
pthread_mutex_unlock(&Mutex);
glEnable(GL_DEPTH_TEST);
@@ -172,8 +191,15 @@ draw_loop(struct winthread *wt)
draw_object();
glPopMatrix();
if (Locking)
pthread_mutex_lock(&Mutex);
glXSwapBuffers(wt->Dpy, wt->Win);
if (Locking)
pthread_mutex_unlock(&Mutex);
usleep(5000);
wt->Angle += 1.0;
}
}
@@ -181,6 +207,7 @@ draw_loop(struct winthread *wt)
/*
* The main process thread runs this loop.
* Single display connection for all threads.
*/
static void
event_loop(Display *dpy)
@@ -188,8 +215,28 @@ event_loop(Display *dpy)
XEvent event;
int i;
assert(!MultiDisplays);
while (!ExitFlag) {
XNextEvent(dpy, &event);
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 */
@@ -214,6 +261,41 @@ event_loop(Display *dpy)
}
/*
* 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:
/* tell all threads to exit */
ExitFlag = GL_TRUE;
/*printf("exit draw_loop %d\n", wt->Index);*/
return;
default:
/*no-op*/ ;
}
}
w = (w + 1) % NumWinThreads;
usleep(5000);
}
}
/*
* we'll call this once for each thread, before the threads are created.
*/
@@ -329,14 +411,14 @@ main(int argc, char *argv[])
{
char *displayName = ":0.0";
int numThreads = 2;
Display *dpy;
Display *dpy = NULL;
int i;
Status threadStat;
if (argc == 1) {
printf("threadgl: test of GL thread safety (any key = exit)\n");
printf("glthreads: test of GL thread safety (any key = exit)\n");
printf("Usage:\n");
printf(" threadgl [-display dpyName] [-n numthreads]\n");
printf(" glthreads [-display dpyName] [-n numthreads]\n");
}
else {
int i;
@@ -345,6 +427,12 @@ main(int argc, char *argv[])
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], "-n") == 0 && i + 1 < argc) {
numThreads = atoi(argv[i + 1]);
if (numThreads < 1)
@@ -353,48 +441,88 @@ main(int argc, char *argv[])
numThreads = MAX_WINTHREADS;
i++;
}
else {
fprintf(stderr, "glthreads: unexpected flag: %s\n", argv[i]);
}
}
}
if (Locking)
printf("glthreads: Using explict locks around Xlib calls.\n");
else
printf("glthreads: No explict locking.\n");
if (MultiDisplays)
printf("glthreads: Per-thread display connections.\n");
else
printf("glthreads: Single display connection.\n");
/*
* VERY IMPORTANT: call XInitThreads() before any other Xlib functions.
*/
threadStat = XInitThreads();
if (threadStat) {
printf("XInitThreads() returned %d (success)\n", (int) threadStat);
}
else {
printf("XInitThreads() returned 0 (failure- this program may fail)\n");
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", displayName);
return -1;
}
}
dpy = XOpenDisplay(displayName);
if (!dpy) {
fprintf(stderr, "Unable to open display %s\n", displayName);
return -1;
if (Locking) {
pthread_mutex_init(&Mutex, NULL);
}
printf("glthreads: creating windows\n");
NumWinThreads = numThreads;
/* Create the GLX windows and contexts */
for (i = 0; i < numThreads; i++) {
WinThreads[i].Dpy = dpy;
if (MultiDisplays) {
WinThreads[i].Dpy = XOpenDisplay(displayName);
assert(WinThreads[i].Dpy);
}
else {
WinThreads[i].Dpy = dpy;
}
WinThreads[i].Index = i;
create_window(&WinThreads[i]);
}
printf("glthreads: creating threads\n");
/* Create the threads */
for (i = 0; i < numThreads; i++) {
pthread_create(&WinThreads[i].Thread, NULL, thread_function,
(void*) &WinThreads[i]);
printf("Created Thread %d\n", (int) WinThreads[i].Thread);
printf("glthreads: Created thread %u\n", (unsigned int) WinThreads[i].Thread);
}
event_loop(dpy);
if (MultiDisplays)
event_loop_multi();
else
event_loop(dpy);
clean_up();
XCloseDisplay(dpy);
if (MultiDisplays) {
for (i = 0; i < numThreads; i++) {
XCloseDisplay(WinThreads[i].Dpy);
}
}
else {
XCloseDisplay(dpy);
}
return 0;
}

View File

@@ -262,6 +262,7 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits)
ctx = glXCreateContext( dpy, visinfo, NULL, allowDirect );
if (!ctx) {
fprintf(stderr, "Error: glXCreateContext failed\n");
XFree(visinfo);
XDestroyWindow(dpy, win);
return;
}
@@ -336,6 +337,7 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits)
}
glXDestroyContext(dpy, ctx);
XFree(visinfo);
XDestroyWindow(dpy, win);
}

View File

@@ -31,6 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "eglcontext.h"
#include "egldisplay.h"
@@ -346,6 +347,7 @@ void (* APIENTRY eglGetProcAddress(const char *procname))()
{ "eglWaitGL", (_EGLProc) eglWaitGL },
{ "eglWaitNative", (_EGLProc) eglWaitNative },
/* Extensions */
#ifdef EGL_MESA_screen_surface
{ "eglChooseModeMESA", (_EGLProc) eglChooseModeMESA },
{ "eglGetModesMESA", (_EGLProc) eglGetModesMESA },
{ "eglGetModeAttribMESA", (_EGLProc) eglGetModeAttribMESA },
@@ -358,6 +360,14 @@ void (* APIENTRY eglGetProcAddress(const char *procname))()
{ "eglQueryScreenSurfaceMESA", (_EGLProc) eglQueryScreenSurfaceMESA },
{ "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA },
{ "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA },
#endif /* EGL_MESA_screen_surface */
#ifdef EGL_VERSION_1_2
{ "eglBindAPI", (_EGLProc) eglBindAPI },
{ "eglCreatePbufferFromClientBuffer", (_EGLProc) eglCreatePbufferFromClientBuffer },
{ "eglQueryAPI", (_EGLProc) eglQueryAPI },
{ "eglReleaseThread", (_EGLProc) eglReleaseThread },
{ "eglWaitClient", (_EGLProc) eglWaitClient },
#endif /* EGL_VERSION_1_2 */
{ NULL, NULL }
};
EGLint i;
@@ -492,6 +502,85 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
}
/**
** EGL 1.2
**/
#ifdef EGL_VERSION_1_2
EGLBoolean
eglBindAPI(EGLenum api)
{
_EGLThreadInfo *t = _eglGetCurrentThread();
switch (api) {
case EGL_OPENGL_ES_API:
if (_eglGlobal.OpenGLESAPISupported) {
t->CurrentAPI = api;
return EGL_TRUE;
}
_eglError(EGL_BAD_PARAMETER, "eglBindAPI");
return EGL_FALSE;
case EGL_OPENVG_API:
if (_eglGlobal.OpenVGAPISupported) {
t->CurrentAPI = api;
return EGL_TRUE;
}
_eglError(EGL_BAD_PARAMETER, "eglBindAPI");
return EGL_FALSE;
default:
return EGL_FALSE;
}
return EGL_TRUE;
}
EGLSurface
eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
EGLClientBuffer buffer, EGLConfig config,
const EGLint *attrib_list)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->API.CreatePbufferFromClientBuffer(drv, dpy, buftype, buffer,
config, attrib_list);
}
EGLenum
eglQueryAPI(void)
{
/* returns one of EGL_OPENGL_ES_API or EGL_OPENVG_API */
_EGLThreadInfo *t = _eglGetCurrentThread();
return t->CurrentAPI;
}
EGLBoolean
eglReleaseThread(void)
{
_EGLThreadInfo *t = _eglGetCurrentThread();
EGLDisplay dpy = eglGetCurrentDisplay();
if (dpy) {
_EGLDriver *drv = _eglLookupDriver(dpy);
/* unbind context */
(void) drv->API.MakeCurrent(drv, dpy, EGL_NO_SURFACE,
EGL_NO_SURFACE, EGL_NO_CONTEXT);
}
_eglDeleteThreadData(t);
return EGL_TRUE;
}
EGLBoolean
eglWaitClient(void)
{
EGLDisplay dpy = eglGetCurrentDisplay();
if (dpy != EGL_NO_DISPLAY) {
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->API.WaitClient(drv, dpy);
}
else
return EGL_FALSE;
}
#endif /* EGL_VERSION_1_2 */

View File

@@ -40,7 +40,7 @@ typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, EGLDisplay dpy);
typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint engine);
/* EGL_MESA_screen extension */
#ifdef EGL_MESA_screen_surface
typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
typedef EGLBoolean (*GetModesMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode);
typedef EGLBoolean (*GetModeAttribMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
@@ -53,6 +53,14 @@ typedef EGLBoolean (*QueryScreenMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScre
typedef EGLBoolean (*QueryScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
typedef EGLBoolean (*QueryScreenModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode);
#endif /* EGL_MESA_screen_surface */
#ifdef EGL_VERSION_1_2
typedef EGLBoolean (*WaitClient_t)(_EGLDriver *drv, EGLDisplay dpy);
typedef EGLSurface (*CreatePbufferFromClientBuffer_t)(_EGLDriver *drv, EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
#endif /* EGL_VERSION_1_2 */
/**
@@ -101,6 +109,11 @@ struct _egl_api
QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
QueryScreenModeMESA_t QueryScreenModeMESA;
QueryModeStringMESA_t QueryModeStringMESA;
#ifdef EGL_VERSION_1_2
WaitClient_t WaitClient;
CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer;
#endif
};
#endif /* EGLAPI_INCLUDED */

View File

@@ -92,6 +92,10 @@ _eglInitConfig(_EGLConfig *config, EGLint id)
_eglSetConfigAttrib(config, EGL_TRANSPARENT_RED_VALUE, EGL_DONT_CARE);
_eglSetConfigAttrib(config, EGL_TRANSPARENT_GREEN_VALUE, EGL_DONT_CARE);
_eglSetConfigAttrib(config, EGL_TRANSPARENT_BLUE_VALUE, EGL_DONT_CARE);
#ifdef EGL_VERSION_1_2
_eglSetConfigAttrib(config, EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
_eglSetConfigAttrib(config, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT);
#endif /* EGL_VERSION_1_2 */
}
@@ -153,13 +157,37 @@ _eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list)
}
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
if (attrib_list[i] >= EGL_BUFFER_SIZE &&
attrib_list[i] <= EGL_MAX_SWAP_INTERVAL) {
EGLint k = attrib_list[i] - FIRST_ATTRIB;
const EGLint attr = attrib_list[i];
if (attr >= EGL_BUFFER_SIZE &&
attr <= EGL_MAX_SWAP_INTERVAL) {
EGLint k = attr - FIRST_ATTRIB;
assert(k >= 0);
assert(k < MAX_ATTRIBS);
config->Attrib[k] = attrib_list[++i];
}
#ifdef EGL_VERSION_1_2
else if (attr == EGL_COLOR_BUFFER_TYPE) {
EGLint bufType = attrib_list[++i];
if (bufType != EGL_RGB_BUFFER && bufType != EGL_LUMINANCE_BUFFER) {
_eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
return EGL_FALSE;
}
_eglSetConfigAttrib(config, EGL_COLOR_BUFFER_TYPE, bufType);
}
else if (attr == EGL_RENDERABLE_TYPE) {
EGLint renType = attrib_list[++i];
if (renType & ~(EGL_OPENGL_ES_BIT | EGL_OPENVG_BIT)) {
_eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
return EGL_FALSE;
}
_eglSetConfigAttrib(config, EGL_RENDERABLE_TYPE, renType);
}
else if (attr == EGL_ALPHA_MASK_SIZE ||
attr == EGL_LUMINANCE_SIZE) {
EGLint value = attrib_list[++i];
_eglSetConfigAttrib(config, attr, value);
}
#endif /* EGL_VERSION_1_2 */
else {
_eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
return EGL_FALSE;
@@ -184,6 +212,8 @@ struct sort_info {
/* This encodes the info from Table 3.5 of the EGL spec, ordered by
* Sort Priority.
*
* XXX To do: EGL 1.2 attribs
*/
static struct sort_info SortInfo[] = {
{ EGL_CONFIG_CAVEAT, EXACT, SPECIAL },

View File

@@ -160,6 +160,11 @@ _eglQueryContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx,
case EGL_CONFIG_ID:
*value = GET_CONFIG_ATTRIB(c->Config, EGL_CONFIG_ID);
return EGL_TRUE;
#ifdef EGL_VERSION_1_2
case EGL_CONTEXT_CLIENT_TYPE:
*value = c->ClientAPI;
return EGL_FALSE;
#endif /* EGL_VERSION_1_2 */
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
return EGL_FALSE;

View File

@@ -22,6 +22,9 @@ struct _egl_context
EGLBoolean IsBound;
EGLBoolean DeletePending;
#ifdef EGL_VERSION_1_2
EGLint ClientAPI; /* Either EGL_OPENGL_ES_API or EGL_OPENVG_API */
#endif /* EGL_VERSION_1_2 */
};

View File

@@ -181,7 +181,7 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
drv->API.WaitGL = _eglWaitGL;
drv->API.WaitNative = _eglWaitNative;
/* EGL_MESA_screen */
#ifdef EGL_MESA_screen_surface
drv->API.ChooseModeMESA = _eglChooseModeMESA;
drv->API.GetModesMESA = _eglGetModesMESA;
drv->API.GetModeAttribMESA = _eglGetModeAttribMESA;
@@ -193,6 +193,11 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
drv->API.QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA;
drv->API.QueryScreenModeMESA = _eglQueryScreenModeMESA;
drv->API.QueryModeStringMESA = _eglQueryModeStringMESA;
#endif /* EGL_MESA_screen_surface */
#ifdef EGL_VERSION_1_2
drv->API.CreatePbufferFromClientBuffer = _eglCreatePbufferFromClientBuffer;
#endif /* EGL_VERSION_1_2 */
}
@@ -227,6 +232,11 @@ _eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name)
case EGL_EXTENSIONS:
_eglUpdateExtensionsString(drv);
return drv->Extensions.String;
#ifdef EGL_VERSION_1_2
case EGL_CLIENT_APIS:
/* XXX need to initialize somewhere */
return drv->ClientAPIs;
#endif
default:
_eglError(EGL_BAD_PARAMETER, "eglQueryString");
return NULL;
@@ -250,6 +260,13 @@ _eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine)
/* just a placeholder */
(void) drv;
(void) dpy;
(void) engine;
switch (engine) {
case EGL_CORE_NATIVE_ENGINE:
break;
default:
_eglError(EGL_BAD_PARAMETER, "eglWaitNative(engine)");
return EGL_FALSE;
}
return EGL_TRUE;
}

View File

@@ -34,6 +34,7 @@ struct _egl_driver
int ABIversion;
int APImajor, APIminor; /* returned through eglInitialize */
const char *ClientAPIs;
_EGLAPI API;

View File

@@ -1,4 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
#include "eglglobals.h"
@@ -18,9 +19,12 @@ _eglInitGlobals(void)
_eglGlobal.Surfaces = _eglNewHashTable();
_eglGlobal.FreeScreenHandle = 1;
_eglGlobal.Initialized = EGL_TRUE;
_eglGlobal.OpenGLESAPISupported = EGL_TRUE;
_eglGlobal.OpenVGAPISupported = EGL_FALSE;
/* XXX temporary */
_eglGlobal.ThreadInfo.CurrentContext = EGL_NO_CONTEXT;
_eglGlobal.ThreadInfo.LastError = EGL_SUCCESS;
_eglGlobal.ThreadInfo = _eglNewThreadInfo();
}
}
@@ -38,6 +42,33 @@ _eglDestroyGlobals(void)
}
/**
* Allocate and init a new _EGLThreadInfo object.
*/
_EGLThreadInfo *
_eglNewThreadInfo(void)
{
_EGLThreadInfo *t = (_EGLThreadInfo *) calloc(1, sizeof(_EGLThreadInfo));
if (t) {
t->CurrentContext = EGL_NO_CONTEXT;
t->LastError = EGL_SUCCESS;
t->CurrentAPI = EGL_NONE;
}
return t;
}
/**
* Delete/free a _EGLThreadInfo object.
*/
void
_eglDeleteThreadData(_EGLThreadInfo *t)
{
free(t);
}
/**
* Return pointer to calling thread's _EGLThreadInfo object.
* Create a new one if needed.
@@ -46,8 +77,10 @@ _eglDestroyGlobals(void)
_EGLThreadInfo *
_eglGetCurrentThread(void)
{
_eglInitGlobals();
/* XXX temporary */
return &_eglGlobal.ThreadInfo;
return _eglGlobal.ThreadInfo;
}

View File

@@ -12,6 +12,7 @@ struct _egl_thread_info
{
EGLint LastError;
_EGLContext *CurrentContext;
EGLenum CurrentAPI;
};
@@ -28,8 +29,12 @@ struct _egl_global
EGLScreenMESA FreeScreenHandle;
/* XXX temporary */
_EGLThreadInfo ThreadInfo;
/* XXX these may be temporary */
EGLBoolean OpenGLESAPISupported;
EGLBoolean OpenVGAPISupported;
/* XXX temporary - should be thread-specific data (TSD) */
_EGLThreadInfo *ThreadInfo;
};
@@ -44,6 +49,14 @@ extern void
_eglDestroyGlobals(void);
extern _EGLThreadInfo *
_eglNewThreadInfo(void);
extern void
_eglDeleteThreadData(_EGLThreadInfo *t);
extern _EGLThreadInfo *
_eglGetCurrentThread(void);

View File

@@ -27,6 +27,11 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
_EGLConfig *conf;
EGLint width = 0, height = 0, largest = 0;
EGLint texFormat = 0, texTarget = 0, mipmapTex = 0;
EGLint renderBuffer = EGL_BACK_BUFFER;
#ifdef EGL_VERSION_1_2
EGLint colorspace = EGL_COLORSPACE_sRGB;
EGLint alphaFormat = EGL_ALPHA_FORMAT_NONPRE;
#endif
EGLint i;
switch (type) {
@@ -35,12 +40,14 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
break;
case EGL_PIXMAP_BIT:
func = "eglCreatePixmapSurface";
renderBuffer = EGL_SINGLE_BUFFER;
break;
case EGL_PBUFFER_BIT:
func = "eglCreatePBufferSurface";
break;
case EGL_SCREEN_BIT_MESA:
func = "eglCreateScreenSurface";
renderBuffer = EGL_SINGLE_BUFFER; /* XXX correct? */
break;
default:
_eglLog(_EGL_WARNING, "Bad type in _eglInitSurface");
@@ -113,6 +120,55 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
return EGL_FALSE;
}
break;
#ifdef EGL_VERSION_1_2
case EGL_RENDER_BUFFER:
if (type == EGL_WINDOW_BIT) {
renderBuffer = attrib_list[++i];
if (renderBuffer != EGL_BACK_BUFFER &&
renderBuffer != EGL_SINGLE_BUFFER) {
_eglError(EGL_BAD_ATTRIBUTE, func);
return EGL_FALSE;
}
}
else {
_eglError(EGL_BAD_ATTRIBUTE, func);
return EGL_FALSE;
}
break;
case EGL_COLORSPACE:
if (type == EGL_WINDOW_BIT ||
type == EGL_PBUFFER_BIT ||
type == EGL_PIXMAP_BIT) {
colorspace = attrib_list[++i];
if (colorspace != EGL_COLORSPACE_sRGB &&
colorspace != EGL_COLORSPACE_LINEAR) {
_eglError(EGL_BAD_ATTRIBUTE, func);
return EGL_FALSE;
}
}
else {
_eglError(EGL_BAD_ATTRIBUTE, func);
return EGL_FALSE;
}
break;
case EGL_ALPHA_FORMAT:
if (type == EGL_WINDOW_BIT ||
type == EGL_PBUFFER_BIT ||
type == EGL_PIXMAP_BIT) {
alphaFormat = attrib_list[++i];
if (alphaFormat != EGL_ALPHA_FORMAT_NONPRE &&
alphaFormat != EGL_ALPHA_FORMAT_PRE) {
_eglError(EGL_BAD_ATTRIBUTE, func);
return EGL_FALSE;
}
}
else {
_eglError(EGL_BAD_ATTRIBUTE, func);
return EGL_FALSE;
}
break;
#endif /* EGL_VERSION_1_2 */
default:
_eglError(EGL_BAD_ATTRIBUTE, func);
return EGL_FALSE;
@@ -134,6 +190,15 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
surf->MipmapTexture = mipmapTex;
surf->MipmapLevel = 0;
surf->SwapInterval = 0;
#ifdef EGL_VERSION_1_2
surf->SwapBehavior = EGL_BUFFER_DESTROYED; /* XXX ok? */
surf->HorizontalResolution = EGL_UNKNOWN; /* set by caller */
surf->VerticalResolution = EGL_UNKNOWN; /* set by caller */
surf->AspectRatio = EGL_UNKNOWN; /* set by caller */
surf->RenderBuffer = renderBuffer;
surf->AlphaFormat = alphaFormat;
surf->Colorspace = colorspace;
#endif
return EGL_TRUE;
}
@@ -232,6 +297,11 @@ _eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf,
case EGL_CONFIG_ID:
*value = GET_CONFIG_ATTRIB(surface->Config, EGL_CONFIG_ID);
return EGL_TRUE;
/*XXX case EGL_LARGEST_PBUFFER:*/
case EGL_SURFACE_TYPE:
*value = surface->Type;
return EGL_TRUE;
#ifdef EGL_VERSION_1_1
case EGL_TEXTURE_FORMAT:
/* texture attributes: only for pbuffers, no error otherwise */
if (surface->Type == EGL_PBUFFER_BIT)
@@ -249,9 +319,30 @@ _eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf,
if (surface->Type == EGL_PBUFFER_BIT)
*value = surface->MipmapLevel;
return EGL_TRUE;
case EGL_SURFACE_TYPE:
*value = surface->Type;
#endif /* EGL_VERSION_1_1 */
#ifdef EGL_VERSION_1_2
case EGL_SWAP_BEHAVIOR:
*value = surface->SwapBehavior;
return EGL_TRUE;
case EGL_RENDER_BUFFER:
*value = surface->RenderBuffer;
return EGL_TRUE;
case EGL_PIXEL_ASPECT_RATIO:
*value = surface->AspectRatio;
return EGL_TRUE;
case EGL_HORIZONTAL_RESOLUTION:
*value = surface->HorizontalResolution;
return EGL_TRUE;
case EGL_VERTICAL_RESOLUTION:
*value = surface->VerticalResolution;
return EGL_TRUE;
case EGL_ALPHA_FORMAT:
*value = surface->AlphaFormat;
return EGL_TRUE;
case EGL_COLORSPACE:
*value = surface->Colorspace;
return EGL_TRUE;
#endif /* EGL_VERSION_1_2 */
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
return EGL_FALSE;
@@ -416,3 +507,24 @@ _eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval)
surf->SwapInterval = interval;
return EGL_TRUE;
}
#ifdef EGL_VERSION_1_2
/**
* Example function - drivers should do a proper implementation.
*/
EGLSurface
_eglCreatePbufferFromClientBuffer(_EGLDriver *drv, EGLDisplay dpy,
EGLenum buftype, EGLClientBuffer buffer,
EGLConfig config, const EGLint *attrib_list)
{
if (buftype != EGL_OPENVG_IMAGE) {
_eglError(EGL_BAD_PARAMETER, "eglCreatePbufferFromClientBuffer");
return EGL_NO_SURFACE;
}
return EGL_NO_SURFACE;
}
#endif /* EGL_VERSION_1_2 */

View File

@@ -25,6 +25,15 @@ struct _egl_surface
/* If type == EGL_SCREEN_BIT: */
EGLint VisibleRefCount; /* number of screens I'm displayed on */
#ifdef EGL_VERSION_1_2
EGLint SwapBehavior; /* one of EGL_BUFFER_PRESERVED/DESTROYED */
EGLint HorizontalResolution, VerticalResolution;
EGLint AspectRatio;
EGLint RenderBuffer; /* EGL_BACK_BUFFER or EGL_SINGLE_BUFFER */
EGLint AlphaFormat; /* EGL_ALPHA_FORMAT_NONPRE or EGL_ALPHA_FORMAT_PRE */
EGLint Colorspace; /* EGL_COLORSPACE_sRGB or EGL_COLORSPACE_LINEAR */
#endif /* EGL_VERSION_1_2 */
};
@@ -94,4 +103,15 @@ extern EGLBoolean
_eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval);
#ifdef EGL_VERSION_1_2
extern EGLSurface
_eglCreatePbufferFromClientBuffer(_EGLDriver *drv, EGLDisplay dpy,
EGLenum buftype, EGLClientBuffer buffer,
EGLConfig config, const EGLint *attrib_list);
#endif /* EGL_VERSION_1_2 */
#endif /* EGLSURFACE_INCLUDED */

View File

@@ -35,28 +35,28 @@
/*
* mystdio.h
*
* $Date: 2001/03/19 17:52:02 $ $Revision: 1.3 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/mystdio.h,v 1.3 2001/03/19 17:52:02 pesco Exp $
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.4 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/mystdio.h,v 1.4 2006/03/14 15:08:52 brianp Exp $
*/
#ifndef __glumystdio_h_
#define __glumystdio_h_
#ifdef STANDALONE
inline void dprintf( char *, ... ) { }
inline void _glu_dprintf( char *, ... ) { }
#endif
#ifdef LIBRARYBUILD
#ifndef NDEBUG
#include <stdio.h>
#define dprintf printf
#define _glu_dprintf printf
#else
inline void dprintf( char *, ... ) { }
inline void _glu_dprintf( char *, ... ) { }
#endif
#endif
#ifdef GLBUILD
inline void dprintf( char *, ... ) { }
inline void _glu_dprintf( char *, ... ) { }
#endif
#ifndef NULL

View File

@@ -156,9 +156,9 @@ void
Arc::show()
{
#ifndef NDEBUG
dprintf( "\tPWLARC NP: %d FL: 1\n", pwlArc->npts );
_glu_dprintf( "\tPWLARC NP: %d FL: 1\n", pwlArc->npts );
for( int i = 0; i < pwlArc->npts; i++ ) {
dprintf( "\t\tVERTEX %f %f\n", pwlArc->pts[i].param[0],
_glu_dprintf( "\t\tVERTEX %f %f\n", pwlArc->pts[i].param[0],
pwlArc->pts[i].param[1] );
}
#endif
@@ -175,14 +175,14 @@ Arc::print( void )
Arc_ptr jarc = this;
#ifndef NDEBUG
dprintf( "BGNTRIM\n" );
_glu_dprintf( "BGNTRIM\n" );
#endif
do {
jarc->show( );
jarc = jarc->next;
} while (jarc != this);
#ifndef NDEBUG
dprintf("ENDTRIM\n" );
_glu_dprintf("ENDTRIM\n" );
#endif
}
@@ -203,8 +203,8 @@ Arc::isDisconnected( void )
if( ((p0[0] - p1[0]) > ZERO) || ((p1[0] - p0[0]) > ZERO) ||
((p0[1] - p1[1]) > ZERO) || ((p1[1] - p0[1]) > ZERO) ) {
#ifndef NDEBUG
dprintf( "x coord = %f %f %f\n", p0[0], p1[0], p0[0] - p1[0] );
dprintf( "y coord = %f %f %f\n", p0[1], p1[1], p0[1] - p1[1] );
_glu_dprintf( "x coord = %f %f %f\n", p0[0], p1[0], p0[0] - p1[0] );
_glu_dprintf( "y coord = %f %f %f\n", p0[1], p1[1], p0[1] - p1[1] );
#endif
return 1;
} else {
@@ -244,7 +244,7 @@ Arc::check( void )
if (jarc->prev == 0 || jarc->next == 0) {
#ifndef NDEBUG
dprintf( "checkjarc:null next/prev pointer\n");
_glu_dprintf( "checkjarc:null next/prev pointer\n");
jarc->print( );
#endif
return 0;
@@ -252,7 +252,7 @@ Arc::check( void )
if (jarc->next->prev != jarc) {
#ifndef NDEBUG
dprintf( "checkjarc: pointer linkage screwed up\n");
_glu_dprintf( "checkjarc: pointer linkage screwed up\n");
jarc->print( );
#endif
return 0;
@@ -271,7 +271,7 @@ Arc::check( void )
if( jarc->prev->pwlArc ) {
if( jarc->tail()[1] != jarc->prev->rhead()[1] ) {
#ifndef NDEBUG
dprintf( "checkjarc: geometric linkage screwed up 1\n");
_glu_dprintf( "checkjarc: geometric linkage screwed up 1\n");
jarc->prev->show();
jarc->show();
#endif
@@ -280,7 +280,7 @@ Arc::check( void )
if( jarc->tail()[0] != jarc->prev->rhead()[0] ) {
#ifndef NDEBUG
dprintf( "checkjarc: geometric linkage screwed up 2\n");
_glu_dprintf( "checkjarc: geometric linkage screwed up 2\n");
jarc->prev->show();
jarc->show();
#endif
@@ -290,7 +290,7 @@ Arc::check( void )
if( jarc->next->pwlArc ) {
if( jarc->next->tail()[0] != jarc->rhead()[0] ) {
#ifndef NDEBUG
dprintf( "checkjarc: geometric linkage screwed up 3\n");
_glu_dprintf( "checkjarc: geometric linkage screwed up 3\n");
jarc->show();
jarc->next->show();
#endif
@@ -298,7 +298,7 @@ Arc::check( void )
}
if( jarc->next->tail()[1] != jarc->rhead()[1] ) {
#ifndef NDEBUG
dprintf( "checkjarc: geometric linkage screwed up 4\n");
_glu_dprintf( "checkjarc: geometric linkage screwed up 4\n");
jarc->show();
jarc->next->show();
#endif

View File

@@ -35,8 +35,8 @@
/*
* arcsorter.c++
*
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arcsorter.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arcsorter.cc,v 1.2 2006/03/14 15:08:52 brianp Exp $
*/
#ifndef __gluarcsorter_c_
@@ -54,7 +54,7 @@ ArcSorter::ArcSorter(Subdivider &s) : Sorter( sizeof( Arc ** ) ), subdivider(s)
int
ArcSorter::qscmp( char *, char * )
{
dprintf( "ArcSorter::qscmp: pure virtual called\n" );
_glu_dprintf( "ArcSorter::qscmp: pure virtual called\n" );
return 0;
}

View File

@@ -45,7 +45,7 @@ void
BasicCurveEvaluator::domain1f( REAL, REAL )
{
#ifndef NDEBUG
dprintf( "domain1f\n" );
_glu_dprintf( "domain1f\n" );
#endif
}
@@ -53,7 +53,7 @@ void
BasicCurveEvaluator::range1f( long , REAL *, REAL * )
{
#ifndef NDEBUG
dprintf( "range1f\n" );
_glu_dprintf( "range1f\n" );
#endif
}
@@ -61,7 +61,7 @@ void
BasicCurveEvaluator::enable( long )
{
#ifndef NDEBUG
dprintf( "enable\n" );
_glu_dprintf( "enable\n" );
#endif
}
@@ -69,7 +69,7 @@ void
BasicCurveEvaluator::disable( long )
{
#ifndef NDEBUG
dprintf( "disable\n" );
_glu_dprintf( "disable\n" );
#endif
}
@@ -77,7 +77,7 @@ void
BasicCurveEvaluator::bgnmap1f( long )
{
#ifndef NDEBUG
dprintf( "bgnmap1f\n" );
_glu_dprintf( "bgnmap1f\n" );
#endif
}
@@ -85,7 +85,7 @@ void
BasicCurveEvaluator::map1f( long, REAL, REAL, long, long, REAL * )
{
#ifndef NDEBUG
dprintf( "map1f\n" );
_glu_dprintf( "map1f\n" );
#endif
}
@@ -93,7 +93,7 @@ void
BasicCurveEvaluator::mapgrid1f( long, REAL, REAL )
{
#ifndef NDEBUG
dprintf( "mapgrid1f\n" );
_glu_dprintf( "mapgrid1f\n" );
#endif
}
@@ -101,7 +101,7 @@ void
BasicCurveEvaluator::mapmesh1f( long, long, long )
{
#ifndef NDEBUG
dprintf( "mapmesh1f\n" );
_glu_dprintf( "mapmesh1f\n" );
#endif
}
@@ -109,7 +109,7 @@ void
BasicCurveEvaluator::evalcoord1f( long, REAL )
{
#ifndef NDEBUG
dprintf( "evalcoord1f\n" );
_glu_dprintf( "evalcoord1f\n" );
#endif
}
@@ -117,7 +117,7 @@ void
BasicCurveEvaluator::endmap1f( void )
{
#ifndef NDEBUG
dprintf( "endmap1f\n" );
_glu_dprintf( "endmap1f\n" );
#endif
}
@@ -125,7 +125,7 @@ void
BasicCurveEvaluator::bgnline( void )
{
#ifndef NDEBUG
dprintf( "bgnline\n" );
_glu_dprintf( "bgnline\n" );
#endif
}
@@ -133,6 +133,6 @@ void
BasicCurveEvaluator::endline( void )
{
#ifndef NDEBUG
dprintf( "endline\n" );
_glu_dprintf( "endline\n" );
#endif
}

View File

@@ -49,7 +49,7 @@ void
BasicSurfaceEvaluator::domain2f( REAL, REAL, REAL, REAL )
{
#ifndef NDEBUG
dprintf( "domain2f\n" );
_glu_dprintf( "domain2f\n" );
#endif
}
@@ -57,7 +57,7 @@ void
BasicSurfaceEvaluator::polymode( long )
{
#ifndef NDEBUG
dprintf( "polymode\n" );
_glu_dprintf( "polymode\n" );
#endif
}
@@ -65,7 +65,7 @@ void
BasicSurfaceEvaluator::range2f( long type, REAL *from, REAL *to )
{
#ifndef NDEBUG
dprintf( "range2f type %ld, from (%g,%g), to (%g,%g)\n",
_glu_dprintf( "range2f type %ld, from (%g,%g), to (%g,%g)\n",
type, from[0], from[1], to[0], to[1] );
#endif
}
@@ -74,7 +74,7 @@ void
BasicSurfaceEvaluator::enable( long )
{
#ifndef NDEBUG
dprintf( "enable\n" );
_glu_dprintf( "enable\n" );
#endif
}
@@ -82,7 +82,7 @@ void
BasicSurfaceEvaluator::disable( long )
{
#ifndef NDEBUG
dprintf( "disable\n" );
_glu_dprintf( "disable\n" );
#endif
}
@@ -90,7 +90,7 @@ void
BasicSurfaceEvaluator::bgnmap2f( long )
{
#ifndef NDEBUG
dprintf( "bgnmap2f\n" );
_glu_dprintf( "bgnmap2f\n" );
#endif
}
@@ -98,7 +98,7 @@ void
BasicSurfaceEvaluator::endmap2f( void )
{
#ifndef NDEBUG
dprintf( "endmap2f\n" );
_glu_dprintf( "endmap2f\n" );
#endif
}
@@ -108,7 +108,7 @@ BasicSurfaceEvaluator::map2f( long, REAL, REAL, long, long,
REAL * )
{
#ifndef NDEBUG
dprintf( "map2f\n" );
_glu_dprintf( "map2f\n" );
#endif
}
@@ -116,7 +116,7 @@ void
BasicSurfaceEvaluator::mapgrid2f( long, REAL, REAL, long, REAL, REAL )
{
#ifndef NDEBUG
dprintf( "mapgrid2f\n" );
_glu_dprintf( "mapgrid2f\n" );
#endif
}
@@ -124,7 +124,7 @@ void
BasicSurfaceEvaluator::mapmesh2f( long, long, long, long, long )
{
#ifndef NDEBUG
dprintf( "mapmesh2f\n" );
_glu_dprintf( "mapmesh2f\n" );
#endif
}
@@ -132,7 +132,7 @@ void
BasicSurfaceEvaluator::evalcoord2f( long, REAL, REAL )
{
#ifndef NDEBUG
dprintf( "evalcoord2f\n" );
_glu_dprintf( "evalcoord2f\n" );
#endif
}
@@ -140,7 +140,7 @@ void
BasicSurfaceEvaluator::evalpoint2i( long, long )
{
#ifndef NDEBUG
dprintf( "evalpoint2i\n" );
_glu_dprintf( "evalpoint2i\n" );
#endif
}
@@ -148,7 +148,7 @@ void
BasicSurfaceEvaluator::bgnline( void )
{
#ifndef NDEBUG
dprintf( "bgnline\n" );
_glu_dprintf( "bgnline\n" );
#endif
}
@@ -156,7 +156,7 @@ void
BasicSurfaceEvaluator::endline( void )
{
#ifndef NDEBUG
dprintf( "endline\n" );
_glu_dprintf( "endline\n" );
#endif
}
@@ -164,7 +164,7 @@ void
BasicSurfaceEvaluator::bgnclosedline( void )
{
#ifndef NDEBUG
dprintf( "bgnclosedline\n" );
_glu_dprintf( "bgnclosedline\n" );
#endif
}
@@ -172,7 +172,7 @@ void
BasicSurfaceEvaluator::endclosedline( void )
{
#ifndef NDEBUG
dprintf( "endclosedline\n" );
_glu_dprintf( "endclosedline\n" );
#endif
}
@@ -180,7 +180,7 @@ void
BasicSurfaceEvaluator::bgntfan( void )
{
#ifndef NDEBUG
dprintf( "bgntfan\n" );
_glu_dprintf( "bgntfan\n" );
#endif
}
@@ -194,7 +194,7 @@ void
BasicSurfaceEvaluator::bgntmesh( void )
{
#ifndef NDEBUG
dprintf( "bgntmesh\n" );
_glu_dprintf( "bgntmesh\n" );
#endif
}
@@ -202,7 +202,7 @@ void
BasicSurfaceEvaluator::swaptmesh( void )
{
#ifndef NDEBUG
dprintf( "swaptmesh\n" );
_glu_dprintf( "swaptmesh\n" );
#endif
}
@@ -210,7 +210,7 @@ void
BasicSurfaceEvaluator::endtmesh( void )
{
#ifndef NDEBUG
dprintf( "endtmesh\n" );
_glu_dprintf( "endtmesh\n" );
#endif
}
@@ -218,7 +218,7 @@ void
BasicSurfaceEvaluator::bgnqstrip( void )
{
#ifndef NDEBUG
dprintf( "bgnqstrip\n" );
_glu_dprintf( "bgnqstrip\n" );
#endif
}
@@ -226,7 +226,7 @@ void
BasicSurfaceEvaluator::endqstrip( void )
{
#ifndef NDEBUG
dprintf( "endqstrip\n" );
_glu_dprintf( "endqstrip\n" );
#endif
}

View File

@@ -35,8 +35,8 @@
/*
* bin.c++
*
* $Date: 2004/05/12 15:29:36 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/bin.cc,v 1.2 2004/05/12 15:29:36 brianp Exp $
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.3 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/bin.cc,v 1.3 2006/03/14 15:08:52 brianp Exp $
*/
#include "glimports.h"
@@ -123,7 +123,7 @@ void
Bin::show( char *name )
{
#ifndef NDEBUG
dprintf( "%s\n", name );
_glu_dprintf( "%s\n", name );
for( Arc_ptr jarc = firstarc(); jarc; jarc = nextarc() )
jarc->show( );
#endif
@@ -160,7 +160,7 @@ Bin::listBezier( void )
REAL t1 = pts[0].param[1];
REAL s2 = pts[1].param[0];
REAL t2 = pts[1].param[1];
dprintf( "arc (%g,%g) (%g,%g)\n", s1, t1, s2, t2 );
_glu_dprintf( "arc (%g,%g) (%g,%g)\n", s1, t1, s2, t2 );
#endif
}
}

View File

@@ -35,8 +35,8 @@
/*
* ccw.c++
*
* $Date: 2002/11/01 23:35:07 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/ccw.cc,v 1.2 2002/11/01 23:35:07 brianp Exp $
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.3 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/ccw.cc,v 1.3 2006/03/14 15:08:52 brianp Exp $
*/
#include "glimports.h"
@@ -70,7 +70,7 @@ Subdivider::ccwTurn_sr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
assert( v2 != v2last );
#ifndef NDEBUG
dprintf( "arc_ccw_turn, p = %d\n", 0 );
_glu_dprintf( "arc_ccw_turn, p = %d\n", 0 );
#endif
// the arcs lie on the line (0 == v1->param[0])
@@ -88,7 +88,7 @@ Subdivider::ccwTurn_sr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
while( 1 ) {
if( v1next->param[0] < v2next->param[0] ) {
#ifndef NDEBUG
dprintf( "case a\n" );
_glu_dprintf( "case a\n" );
#endif
assert( v1->param[0] <= v1next->param[0] );
assert( v2->param[0] <= v1next->param[0] );
@@ -101,12 +101,12 @@ Subdivider::ccwTurn_sr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
return sgn;
} else {
#ifdef DEBUG
dprintf( "decr\n" );
_glu_dprintf( "decr\n" );
#endif
v1 = v1next--;
if( v1 == v1last ) {
#ifdef DEBUG
dprintf( "no good results\n" );
_glu_dprintf( "no good results\n" );
#endif
return 0; // ill-conditioned, guess answer
}
@@ -117,7 +117,7 @@ Subdivider::ccwTurn_sr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
}
} else if( v1next->param[0] > v2next->param[0] ) {
#ifndef NDEBUG
dprintf( "case b\n" );
_glu_dprintf( "case b\n" );
#endif
assert( v1->param[0] <= v2next->param[0] );
assert( v2->param[0] <= v2next->param[0] );
@@ -130,12 +130,12 @@ Subdivider::ccwTurn_sr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
return sgn;
} else {
#ifdef DEBUG
dprintf( "incr\n" );
_glu_dprintf( "incr\n" );
#endif
v2 = v2next++;
if( v2 == v2last ) {
#ifdef DEBUG
dprintf( "no good results\n" );
_glu_dprintf( "no good results\n" );
#endif
return 0; // ill-conditioned, guess answer
}
@@ -146,7 +146,7 @@ Subdivider::ccwTurn_sr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
}
} else {
#ifndef NDEBUG
dprintf( "case ab\n" );
_glu_dprintf( "case ab\n" );
#endif
if( v1next->param[1] < v2next->param[1] )
return 0;
@@ -154,12 +154,12 @@ Subdivider::ccwTurn_sr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
return 1;
else {
#ifdef DEBUG
dprintf( "incr\n" );
_glu_dprintf( "incr\n" );
#endif
v2 = v2next++;
if( v2 == v2last ) {
#ifdef DEBUG
dprintf( "no good results\n" );
_glu_dprintf( "no good results\n" );
#endif
return 0; // ill-conditioned, guess answer
}
@@ -183,7 +183,7 @@ Subdivider::ccwTurn_sl( Arc_ptr j1, Arc_ptr j2 ) // dir = 0
assert( v2 != v2last );
#ifndef NDEBUG
dprintf( "arc_ccw_turn, p = %d\n", 0 );
_glu_dprintf( "arc_ccw_turn, p = %d\n", 0 );
#endif
// the arcs lie on the line (0 == v1->param[0])
@@ -201,7 +201,7 @@ Subdivider::ccwTurn_sl( Arc_ptr j1, Arc_ptr j2 ) // dir = 0
while( 1 ) {
if( v1next->param[0] > v2next->param[0] ) {
#ifndef NDEBUG
dprintf( "case c\n" );
_glu_dprintf( "case c\n" );
#endif
assert( v1->param[0] >= v1next->param[0] );
assert( v2->param[0] >= v1next->param[0] );
@@ -215,11 +215,11 @@ Subdivider::ccwTurn_sl( Arc_ptr j1, Arc_ptr j2 ) // dir = 0
else {
v1 = v1next--;
#ifdef DEBUG
dprintf( "decr\n" );
_glu_dprintf( "decr\n" );
#endif
if( v1 == v1last ) {
#ifdef DEBUG
dprintf( "no good results\n" );
_glu_dprintf( "no good results\n" );
#endif
return 0; // ill-conditioned, guess answer
}
@@ -230,7 +230,7 @@ Subdivider::ccwTurn_sl( Arc_ptr j1, Arc_ptr j2 ) // dir = 0
}
} else if( v1next->param[0] < v2next->param[0] ) {
#ifndef NDEBUG
dprintf( "case d\n" );
_glu_dprintf( "case d\n" );
#endif
assert( v1->param[0] >= v2next->param[0] );
assert( v2->param[0] >= v2next->param[0] );
@@ -244,11 +244,11 @@ Subdivider::ccwTurn_sl( Arc_ptr j1, Arc_ptr j2 ) // dir = 0
else {
v2 = v2next++;
#ifdef DEBUG
dprintf( "incr\n" );
_glu_dprintf( "incr\n" );
#endif
if( v2 == v2last ) {
#ifdef DEBUG
dprintf( "no good results\n" );
_glu_dprintf( "no good results\n" );
#endif
return 0; // ill-conditioned, guess answer
}
@@ -259,7 +259,7 @@ Subdivider::ccwTurn_sl( Arc_ptr j1, Arc_ptr j2 ) // dir = 0
}
} else {
#ifdef DEBUG
dprintf( "case cd\n" );
_glu_dprintf( "case cd\n" );
#endif
if( v1next->param[1] < v2next->param[1] )
return 1;
@@ -268,11 +268,11 @@ Subdivider::ccwTurn_sl( Arc_ptr j1, Arc_ptr j2 ) // dir = 0
else {
v2 = v2next++;
#ifdef DEBUG
dprintf( "incr\n" );
_glu_dprintf( "incr\n" );
#endif
if( v2 == v2last ) {
#ifdef DEBUG
dprintf( "no good results\n" );
_glu_dprintf( "no good results\n" );
#endif
return 0; // ill-conditioned, guess answer
}
@@ -296,7 +296,7 @@ Subdivider::ccwTurn_tr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
assert( v2 != v2last );
#ifndef NDEBUG
dprintf( "arc_ccw_turn, p = %d\n", 1 );
_glu_dprintf( "arc_ccw_turn, p = %d\n", 1 );
#endif
// the arcs lie on the line (1 == v1->param[1])
@@ -314,7 +314,7 @@ Subdivider::ccwTurn_tr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
while( 1 ) {
if( v1next->param[1] < v2next->param[1] ) {
#ifndef NDEBUG
dprintf( "case a\n" );
_glu_dprintf( "case a\n" );
#endif
assert( v1->param[1] <= v1next->param[1] );
assert( v2->param[1] <= v1next->param[1] );
@@ -327,12 +327,12 @@ Subdivider::ccwTurn_tr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
return sgn;
} else {
#ifdef DEBUG
dprintf( "decr\n" );
_glu_dprintf( "decr\n" );
#endif
v1 = v1next--;
if( v1 == v1last ) {
#ifdef DEBUG
dprintf( "no good results\n" );
_glu_dprintf( "no good results\n" );
#endif
return 0; // ill-conditioned, guess answer
}
@@ -343,7 +343,7 @@ Subdivider::ccwTurn_tr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
}
} else if( v1next->param[1] > v2next->param[1] ) {
#ifndef NDEBUG
dprintf( "case b\n" );
_glu_dprintf( "case b\n" );
#endif
assert( v1->param[1] <= v2next->param[1] );
assert( v2->param[1] <= v2next->param[1] );
@@ -356,12 +356,12 @@ Subdivider::ccwTurn_tr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
return sgn;
} else {
#ifdef DEBUG
dprintf( "incr\n" );
_glu_dprintf( "incr\n" );
#endif
v2 = v2next++;
if( v2 == v2last ) {
#ifdef DEBUG
dprintf( "no good results\n" );
_glu_dprintf( "no good results\n" );
#endif
return 0; // ill-conditioned, guess answer
}
@@ -372,7 +372,7 @@ Subdivider::ccwTurn_tr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
}
} else {
#ifdef DEBUG
dprintf( "case ab\n" );
_glu_dprintf( "case ab\n" );
#endif
if( v1next->param[0] < v2next->param[0] )
return 1;
@@ -380,12 +380,12 @@ Subdivider::ccwTurn_tr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
return 0;
else {
#ifdef DEBUG
dprintf( "incr\n" );
_glu_dprintf( "incr\n" );
#endif
v2 = v2next++;
if( v2 == v2last ) {
#ifdef DEBUG
dprintf( "no good results\n" );
_glu_dprintf( "no good results\n" );
#endif
return 0; // ill-conditioned, guess answer
}
@@ -409,7 +409,7 @@ Subdivider::ccwTurn_tl( Arc_ptr j1, Arc_ptr j2 )
assert( v2 != v2last );
#ifndef NDEBUG
dprintf( "arc_ccw_turn, p = %d\n", 1 );
_glu_dprintf( "arc_ccw_turn, p = %d\n", 1 );
#endif
// the arcs lie on the line (1 == v1->param[1])
@@ -427,7 +427,7 @@ Subdivider::ccwTurn_tl( Arc_ptr j1, Arc_ptr j2 )
while( 1 ) {
if( v1next->param[1] > v2next->param[1] ) {
#ifndef NDEBUG
dprintf( "case c\n" );
_glu_dprintf( "case c\n" );
#endif
assert( v1->param[1] >= v1next->param[1] );
assert( v2->param[1] >= v1next->param[1] );
@@ -441,11 +441,11 @@ Subdivider::ccwTurn_tl( Arc_ptr j1, Arc_ptr j2 )
else {
v1 = v1next--;
#ifdef DEBUG
dprintf( "decr\n" );
_glu_dprintf( "decr\n" );
#endif
if( v1 == v1last ) {
#ifdef DEBUG
dprintf( "no good results\n" );
_glu_dprintf( "no good results\n" );
#endif
return 0; // ill-conditioned, guess answer
}
@@ -456,7 +456,7 @@ Subdivider::ccwTurn_tl( Arc_ptr j1, Arc_ptr j2 )
}
} else if( v1next->param[1] < v2next->param[1] ) {
#ifndef NDEBUG
dprintf( "case d\n" );
_glu_dprintf( "case d\n" );
assert( v1->param[1] >= v2next->param[1] );
assert( v2->param[1] >= v2next->param[1] );
#endif
@@ -470,11 +470,11 @@ Subdivider::ccwTurn_tl( Arc_ptr j1, Arc_ptr j2 )
else {
v2 = v2next++;
#ifdef DEBUG
dprintf( "incr\n" );
_glu_dprintf( "incr\n" );
#endif
if( v2 == v2last ) {
#ifdef DEBUG
dprintf( "no good results\n" );
_glu_dprintf( "no good results\n" );
#endif
return 0; // ill-conditioned, guess answer
}
@@ -485,7 +485,7 @@ Subdivider::ccwTurn_tl( Arc_ptr j1, Arc_ptr j2 )
}
} else {
#ifdef DEBUG
dprintf( "case cd\n" );
_glu_dprintf( "case cd\n" );
#endif
if( v1next->param[0] < v2next->param[0] )
return 0;
@@ -494,11 +494,11 @@ Subdivider::ccwTurn_tl( Arc_ptr j1, Arc_ptr j2 )
else {
v2 = v2next++;
#ifdef DEBUG
dprintf( "incr\n" );
_glu_dprintf( "incr\n" );
#endif
if( v2 == v2last ) {
#ifdef DEBUG
dprintf( "no good results\n" );
_glu_dprintf( "no good results\n" );
#endif
return 0; // ill-conditioned, guess answer
}

View File

@@ -129,11 +129,11 @@ int Knotvector::validate( void )
void Knotvector::show( char *msg )
{
#ifndef NDEBUG
dprintf( "%s\n", msg );
dprintf( "order = %ld, count = %ld\n", order, knotcount );
_glu_dprintf( "%s\n", msg );
_glu_dprintf( "order = %ld, count = %ld\n", order, knotcount );
for( int i=0; i<knotcount; i++ )
dprintf( "knot[%d] = %g\n", i, knotlist[i] );
_glu_dprintf( "knot[%d] = %g\n", i, knotlist[i] );
#endif
}

View File

@@ -232,7 +232,7 @@ NurbsTessellator::pwlcurve( long count, INREAL array[], long byte_stride, long t
}
if( i != count ) {
do_nurbserror( 37 );
dprintf( "point %d (%f,%f)\n", i, x, y );
_glu_dprintf( "point %d (%f,%f)\n", i, x, y );
isDataValid = 0;
return;
}
@@ -247,7 +247,7 @@ NurbsTessellator::pwlcurve( long count, INREAL array[], long byte_stride, long t
}
if( i != count ) {
do_nurbserror( 37 );
dprintf( "point %d (%f,%f)\n", i, x, y );
_glu_dprintf( "point %d (%f,%f)\n", i, x, y );
isDataValid = 0;
return;
}
@@ -460,7 +460,7 @@ NurbsTessellator::setnurbsproperty( long type, long purpose, INREAL *mat )
mapdesc->setBboxsize( mat );
} else {
#ifndef NDEBUG
dprintf( "ERRORRORRORR!!!\n");
_glu_dprintf( "ERRORRORRORR!!!\n");
#endif
}
}
@@ -488,7 +488,7 @@ NurbsTessellator::setnurbsproperty( long type, long purpose, INREAL *mat,
mapdesc->setBmat( mat, rstride, cstride );
} else {
#ifndef NDEBUG
dprintf( "ERRORRORRORR!!!\n");
_glu_dprintf( "ERRORRORRORR!!!\n");
#endif
}
}

View File

@@ -35,8 +35,8 @@
/*
* nurbstess.c++
*
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/nurbstess.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/nurbstess.cc,v 1.2 2006/03/14 15:08:52 brianp Exp $
*/
#include "glimports.h"
@@ -79,7 +79,7 @@ void
NurbsTessellator::makeobj( int )
{
#ifndef NDEBUG
dprintf( "makeobj\n" );
_glu_dprintf( "makeobj\n" );
#endif
}
@@ -87,7 +87,7 @@ void
NurbsTessellator::closeobj( void )
{
#ifndef NDEBUG
dprintf( "closeobj\n" );
_glu_dprintf( "closeobj\n" );
#endif
}
@@ -95,7 +95,7 @@ void
NurbsTessellator::bgnrender( void )
{
#ifndef NDEBUG
dprintf( "bgnrender\n" );
_glu_dprintf( "bgnrender\n" );
#endif
}
@@ -103,7 +103,7 @@ void
NurbsTessellator::endrender( void )
{
#ifndef NDEBUG
dprintf( "endrender\n" );
_glu_dprintf( "endrender\n" );
#endif
}

View File

@@ -35,8 +35,8 @@
/*
* patch.c++
*
* $Date: 2002/11/01 23:35:07 $ $Revision: 1.3 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/patch.cc,v 1.3 2002/11/01 23:35:07 brianp Exp $
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.4 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/patch.cc,v 1.4 2006/03/14 15:08:52 brianp Exp $
*/
#include <stdio.h>
@@ -439,7 +439,7 @@ Patch::getstepsize( void )
}
#ifdef DEBUG
dprintf( "sidesteps %g %g %g %g, stepsize %g %g\n",
_glu_dprintf( "sidesteps %g %g %g %g, stepsize %g %g\n",
pspec[0].sidestep[0], pspec[0].sidestep[1],
pspec[1].sidestep[0], pspec[1].sidestep[1],
pspec[0].stepsize, pspec[1].stepsize );

View File

@@ -35,8 +35,8 @@
/*
* quilt.c++
*
* $Date: 2002/11/01 23:35:07 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/quilt.cc,v 1.2 2002/11/01 23:35:07 brianp Exp $
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.3 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/quilt.cc,v 1.3 2006/03/14 15:08:52 brianp Exp $
*/
#include "glimports.h"
@@ -91,12 +91,12 @@ Quilt::show( void )
for( int i=0; i!= qspec[0].order * qspec[0].width; i++ ) {
for( int j = 0; j!= qspec[1].order * qspec[1].width; j++ ) {
for( int k=0; k < nc; k++ )
dprintf( "%g ", ps[i*qspec[0].stride + j*qspec[1].stride + k] );
dprintf( "\n" );
_glu_dprintf( "%g ", ps[i*qspec[0].stride + j*qspec[1].stride + k] );
_glu_dprintf( "\n" );
}
dprintf( "\n" );
_glu_dprintf( "\n" );
}
dprintf( "\n" );
_glu_dprintf( "\n" );
#endif
}

View File

@@ -35,8 +35,8 @@
/*
* sorter.c++
*
* $Date: 2001/11/29 16:16:55 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/sorter.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.3 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/sorter.cc,v 1.3 2006/03/14 15:08:52 brianp Exp $
*/
#include "glimports.h"
@@ -57,7 +57,7 @@ Sorter::qsort( void *a, int n )
int
Sorter::qscmp( char *, char * )
{
dprintf( "Sorter::qscmp: pure virtual called\n" );
_glu_dprintf( "Sorter::qscmp: pure virtual called\n" );
return 0;
}
@@ -65,14 +65,14 @@ Sorter::qscmp( char *, char * )
void
Sorter::qsexc( char *, char * )
{
dprintf( "Sorter::qsexc: pure virtual called\n" );
_glu_dprintf( "Sorter::qsexc: pure virtual called\n" );
}
void
Sorter::qstexc( char *, char *, char * )
{
dprintf( "Sorter::qstexc: pure virtual called\n" );
_glu_dprintf( "Sorter::qstexc: pure virtual called\n" );
}
void

View File

@@ -35,8 +35,8 @@
/*
* splitarcs.c++
*
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/splitarcs.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/splitarcs.cc,v 1.2 2006/03/14 15:08:52 brianp Exp $
*/
#include "glimports.h"
@@ -133,14 +133,14 @@ Subdivider::check_s( Arc_ptr jarc1, Arc_ptr jarc2 )
undersampling */
if( ! ( jarc1->tail()[0] < (jarc1)->head()[0] ) ) {
#ifndef NDEBUG
dprintf( "s difference %f\n", (jarc1)->tail()[0] - (jarc1)->head()[0] );
_glu_dprintf( "s difference %f\n", (jarc1)->tail()[0] - (jarc1)->head()[0] );
#endif
::mylongjmp( jumpbuffer, 28 );
}
if( ! ( jarc2->tail()[0] > (jarc2)->head()[0] ) ) {
#ifndef NDEBUG
dprintf( "s difference %f\n", (jarc2)->tail()[0] - (jarc2)->head()[0] );
_glu_dprintf( "s difference %f\n", (jarc2)->tail()[0] - (jarc2)->head()[0] );
#endif
::mylongjmp( jumpbuffer, 28 );
}
@@ -232,14 +232,14 @@ Subdivider::check_t( Arc_ptr jarc1, Arc_ptr jarc2 )
undersampling */
if( ! ( jarc1->tail()[1] < (jarc1)->head()[1] ) ) {
#ifndef NDEBUG
dprintf( "t difference %f\n", jarc1->tail()[1] - (jarc1)->head()[1] );
_glu_dprintf( "t difference %f\n", jarc1->tail()[1] - (jarc1)->head()[1] );
#endif
::mylongjmp( jumpbuffer, 28 );
}
if( ! ( jarc2->tail()[1] > (jarc2)->head()[1] ) ) {
#ifndef NDEBUG
dprintf( "t difference %f\n", jarc2->tail()[1] - (jarc2)->head()[1] );
_glu_dprintf( "t difference %f\n", jarc2->tail()[1] - (jarc2)->head()[1] );
#endif
::mylongjmp( jumpbuffer, 28 );
}

View File

@@ -35,8 +35,8 @@
/*
* tobezier.c++
*
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/tobezier.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/tobezier.cc,v 1.2 2006/03/14 15:08:52 brianp Exp $
*/
#include "glimports.h"
@@ -360,7 +360,7 @@ Knotspec::showpts( REAL *outpt )
next->showpts( outpt );
} else {
for( REAL *lpt=outpt+prewidth; outpt != lpt; outpt += poststride )
dprintf( "show %g %g %g\n", outpt[0], outpt[1], outpt[2] );
_glu_dprintf( "show %g %g %g\n", outpt[0], outpt[1], outpt[2] );
}
}

View File

@@ -35,28 +35,28 @@
/*
* mystdio.h
*
* $Date: 2001/03/19 17:52:03 $ $Revision: 1.3 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/mystdio.h,v 1.3 2001/03/19 17:52:03 pesco Exp $
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.4 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/mystdio.h,v 1.4 2006/03/14 15:08:52 brianp Exp $
*/
#ifndef __glumystdio_h_
#define __glumystdio_h_
#ifdef STANDALONE
inline void dprintf( char *, ... ) { }
inline void _glu_dprintf( char *, ... ) { }
#endif
#ifdef LIBRARYBUILD
#ifndef NDEBUG
#include <stdio.h>
#define dprintf printf
#define _glu_dprintf printf
#else
inline void dprintf( char *, ... ) { }
inline void _glu_dprintf( char *, ... ) { }
#endif
#endif
#ifdef GLBUILD
inline void dprintf( char *, ... ) { }
inline void _glu_dprintf( char *, ... ) { }
#endif
#ifndef NULL

View File

@@ -1,7 +1,7 @@
TOP = ../../..
include $(TOP)/configs/current
DEFINES += -DXF86VIDMODE -D_REENTRANT -UIN_DRI_DRIVER
EXTRA_DEFINES = -DXF86VIDMODE -D_REENTRANT -UIN_DRI_DRIVER
SOURCES = \
glcontextmodes.c \
@@ -53,10 +53,10 @@ INCLUDES = -I. \
##### RULES #####
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
$(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@
.S.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
$(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@
##### TARGETS #####

View File

@@ -200,6 +200,7 @@ GetDrawableAttribute( Display *dpy, GLXDrawable drawable,
GLboolean use_glx_1_3 = ((priv->majorVersion > 1)
|| (priv->minorVersion >= 3));
*value = 0;
if ( (dpy == NULL) || (drawable == 0) ) {
return 0;
@@ -230,33 +231,41 @@ GetDrawableAttribute( Display *dpy, GLXDrawable drawable,
_XReply(dpy, (xReply*) &reply, 0, False);
if (reply.type == X_Error)
{
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
length = reply.length;
num_attributes = (use_glx_1_3) ? reply.numAttribs : length / 2;
data = (CARD32 *) Xmalloc( length * sizeof(CARD32) );
if ( data == NULL ) {
/* Throw data on the floor */
_XEatData(dpy, length);
} else {
_XRead(dpy, (char *)data, length * sizeof(CARD32) );
if (length)
{
num_attributes = (use_glx_1_3) ? reply.numAttribs : length / 2;
data = (CARD32 *) Xmalloc( length * sizeof(CARD32) );
if ( data == NULL ) {
/* Throw data on the floor */
_XEatData(dpy, length);
} else {
_XRead(dpy, (char *)data, length * sizeof(CARD32) );
/* Search the set of returned attributes for the attribute requested by
* the caller.
*/
for ( i = 0 ; i < num_attributes ; i++ ) {
if ( data[i*2] == attribute ) {
*value = data[ (i*2) + 1 ];
break;
}
}
Xfree( data );
}
}
UnlockDisplay(dpy);
SyncHandle();
/* Search the set of returned attributes for the attribute requested by
* the caller.
*/
for ( i = 0 ; i < num_attributes ; i++ ) {
if ( data[i*2] == attribute ) {
*value = data[ (i*2) + 1 ];
break;
}
}
Xfree( data );
return 0;
}

View File

@@ -1722,7 +1722,7 @@ PUBLIC int glXSwapIntervalSGI(int interval)
/*
** GLX_MESA_swap_control
*/
PUBLIC GLint glXSwapIntervalMESA(unsigned interval)
PUBLIC int glXSwapIntervalMESA(unsigned int interval)
{
#ifdef GLX_DIRECT_RENDERING
GLXContext gc = __glXGetCurrentContext();
@@ -1754,7 +1754,8 @@ PUBLIC GLint glXSwapIntervalMESA(unsigned interval)
return GLX_BAD_CONTEXT;
}
PUBLIC GLint glXGetSwapIntervalMESA( void )
PUBLIC int glXGetSwapIntervalMESA(void)
{
#ifdef GLX_DIRECT_RENDERING
GLXContext gc = __glXGetCurrentContext();
@@ -2589,7 +2590,87 @@ PUBLIC Bool glXSet3DfxModeMESA( int mode )
}
/*@}*/
PUBLIC Bool glXBindTexImageEXT(Display *dpy,
GLXDrawable drawable,
int buffer)
{
xGLXVendorPrivateReq *req;
GLXContext gc = __glXGetCurrentContext();
CARD32 *drawable_ptr;
INT32 *buffer_ptr;
CARD8 opcode;
if (gc == NULL)
return False;
#ifdef GLX_DIRECT_RENDERING
if (gc->isDirect)
return False;
#endif
opcode = __glXSetupForCommand(dpy);
if (!opcode)
return False;
LockDisplay(dpy);
GetReqExtra(GLXVendorPrivate, sizeof(CARD32)+sizeof(INT32),req);
req->reqType = opcode;
req->glxCode = X_GLXVendorPrivate;
req->vendorCode = X_GLXvop_BindTexImageEXT;
req->contextTag = gc->currentContextTag;
drawable_ptr = (CARD32 *) (req + 1);
buffer_ptr = (INT32 *) (drawable_ptr + 1);
*drawable_ptr = drawable;
*buffer_ptr = buffer;
UnlockDisplay(dpy);
SyncHandle();
return True;
}
PUBLIC Bool glXReleaseTexImageEXT(Display *dpy,
GLXDrawable drawable,
int buffer)
{
xGLXVendorPrivateReq *req;
GLXContext gc = __glXGetCurrentContext();
CARD32 *drawable_ptr;
INT32 *buffer_ptr;
CARD8 opcode;
if (gc == NULL)
return False;
#ifdef GLX_DIRECT_RENDERING
if (gc->isDirect)
return False;
#endif
opcode = __glXSetupForCommand(dpy);
if (!opcode)
return False;
LockDisplay(dpy);
GetReqExtra(GLXVendorPrivate, sizeof(CARD32)+sizeof(INT32),req);
req->reqType = opcode;
req->glxCode = X_GLXVendorPrivate;
req->vendorCode = X_GLXvop_ReleaseTexImageEXT;
req->contextTag = gc->currentContextTag;
drawable_ptr = (CARD32 *) (req + 1);
buffer_ptr = (INT32 *) (drawable_ptr + 1);
*drawable_ptr = drawable;
*buffer_ptr = buffer;
UnlockDisplay(dpy);
SyncHandle();
return True;
}
/**
* \c strdup is actually not a standard ANSI C or POSIX routine.
@@ -2771,6 +2852,10 @@ static const struct name_address_pair GLX_functions[] = {
GLX_FUNCTION( glXGetMscRateOML ),
GLX_FUNCTION( glXGetSyncValuesOML ),
/*** GLX_EXT_texture_from_pixmap ***/
GLX_FUNCTION( glXBindTexImageEXT ),
GLX_FUNCTION( glXReleaseTexImageEXT ),
#ifdef GLX_DIRECT_RENDERING
/*** DRI configuration ***/
GLX_FUNCTION( glXGetScreenDriver ),

View File

@@ -107,6 +107,7 @@ static const struct extension_info known_glx_extensions[] = {
{ GLX(SGIX_video_source), VER(0,0), N, N, N, N },
{ GLX(SGIX_visual_select_group), VER(0,0), Y, Y, N, N },
{ GLX(SUN_get_transparent_index), VER(0,0), N, N, N, N },
{ GLX(EXT_texture_from_pixmap), VER(0,0), Y, N, N, N },
{ NULL }
};
@@ -153,6 +154,7 @@ static const struct extension_info known_gl_extensions[] = {
{ GL(EXT_depth_bounds_test), VER(0,0), N, N, N, N },
{ GL(EXT_draw_range_elements), VER(1,2), Y, N, Y, N },
{ GL(EXT_fog_coord), VER(1,4), Y, N, N, N },
{ GL(EXT_framebuffer_object), VER(0,0), Y, N, N, N },
{ GL(EXT_multi_draw_arrays), VER(1,4), Y, N, Y, N },
{ GL(EXT_packed_pixels), VER(1,2), Y, N, N, N },
{ GL(EXT_paletted_texture), VER(0,0), Y, N, N, N },

View File

@@ -69,7 +69,8 @@ enum {
SGIX_video_resize_bit,
SGIX_video_source_bit,
SGIX_visual_select_group_bit,
SUN_get_transparent_index_bit
SUN_get_transparent_index_bit,
EXT_texture_from_pixmap_bit
};
enum {
@@ -115,6 +116,7 @@ enum {
GL_EXT_depth_bounds_test_bit,
GL_EXT_draw_range_elements_bit,
GL_EXT_fog_coord_bit,
GL_EXT_framebuffer_object_bit,
GL_EXT_multi_draw_arrays_bit,
GL_EXT_packed_pixels_bit,
GL_EXT_paletted_texture_bit,

View File

@@ -6321,7 +6321,7 @@ __indirect_glGenProgramsNV(GLsizei n, GLuint * programs)
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
GLubyte const * pc = __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply, X_GLvop_GenProgramsNV, cmdlen);
(void) memcpy((void *)(pc + 0), (void *)(&n), 4);
(void) __glXReadReply(dpy, 4, programs, GL_FALSE);
(void) __glXReadReply(dpy, 4, programs, GL_TRUE);
UnlockDisplay(dpy); SyncHandle();
}
return;

View File

@@ -420,7 +420,6 @@ fill_array_info_cache( struct array_state_vector * arrays )
}
}
if ( arrays->new_DrawArrays_possible ) {
assert( ! arrays->new_DrawArrays_possible );
}
@@ -530,7 +529,7 @@ static GLubyte *
emit_DrawArrays_header_old( __GLXcontext * gc,
struct array_state_vector * arrays,
size_t * elements_per_request,
size_t * total_requests,
unsigned int * total_requests,
GLenum mode, GLsizei count )
{
size_t command_size;

View File

@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 6.1
* Version: 6.5
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -501,7 +501,7 @@ _ac_import_texcoord( GLcontext *ctx,
{
ACcontext *ac = AC_CONTEXT(ctx);
ASSERT(unit < ctx->Const.MaxTextureCoordUnits);
ASSERT(unit < MAX_TEXTURE_COORD_UNITS);
/* Can we keep the existing version?
*/

View File

@@ -206,10 +206,15 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
#if FEATURE_EXT_framebuffer_object
driver->NewFramebuffer = _mesa_new_framebuffer;
driver->NewRenderbuffer = _mesa_new_soft_renderbuffer;
driver->RenderbufferTexture = _mesa_renderbuffer_texture;
driver->RenderTexture = _mesa_render_texture;
driver->FinishRenderTexture = _mesa_finish_render_texture;
driver->FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer;
#endif
#if FEATURE_EXT_framebuffer_blit
driver->BlitFramebuffer = _swrast_BlitFramebuffer;
#endif
/* query objects */
driver->NewQueryObject = _mesa_new_query_object;
driver->BeginQuery = NULL;

View File

@@ -868,8 +868,8 @@ dmesa_register_swrast_functions (GLcontext *ctx)
swrast->choose_line = dmesa_choose_line;
swrast->choose_triangle = dmesa_choose_tri;
swrast->invalidate_line |= DMESA_NEW_LINE;
swrast->invalidate_triangle |= DMESA_NEW_TRIANGLE;
swrast->InvalidateLineMask |= DMESA_NEW_LINE;
swrast->InvalidateTriangleMask |= DMESA_NEW_TRIANGLE;
}

View File

@@ -89,7 +89,7 @@ $(LIB_DIR)/$(LIBNAME): $(LIBNAME)
depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
touch depend
$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDES) $(C_SOURCES) $(ASM_SOURCES) \
> /dev/null
>& /dev/null
# Emacs tags

View File

@@ -659,10 +659,12 @@ static void
driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate)
{
__DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *) drawablePrivate;
__DRIscreenPrivate *psp = pdp->driScreenPriv;
int scrn = psp->myNum;
__DRIscreenPrivate *psp;
int scrn;
if (pdp) {
psp = pdp->driScreenPriv;
scrn = psp->myNum;
(*psp->DriverAPI.DestroyBuffer)(pdp);
if ((*dri_interface->windowExists)(dpy, pdp->draw))
(void)(*dri_interface->destroyDrawable)(dpy, scrn, pdp->draw);
@@ -829,7 +831,7 @@ static void driDestroyScreen(__DRInativeDisplay *dpy, int scrn, void *screenPriv
(void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX);
(void)drmUnmap((drmAddress)psp->pFB, psp->fbSize);
_mesa_free(psp->pDevPriv);
(void)drmClose(psp->fd);
(void)drmCloseOnce(psp->fd);
if ( psp->modes != NULL ) {
(*dri_interface->destroyContextModes)( psp->modes );
}

View File

@@ -56,6 +56,8 @@ driNewRenderbuffer(GLenum format, GLvoid *addr,
driRenderbuffer *drb;
assert(format == GL_RGBA ||
format == GL_RGB5 ||
format == GL_RGBA8 ||
format == GL_DEPTH_COMPONENT16 ||
format == GL_DEPTH_COMPONENT24 ||
format == GL_DEPTH_COMPONENT32 ||
@@ -75,7 +77,7 @@ driNewRenderbuffer(GLenum format, GLvoid *addr,
drb->Base.InternalFormat = format;
if (format == GL_RGBA) {
if (format == GL_RGBA || format == GL_RGB5 || format == GL_RGBA8) {
/* Color */
drb->Base._BaseFormat = GL_RGBA;
drb->Base.DataType = GL_UNSIGNED_BYTE;
@@ -92,9 +94,15 @@ driNewRenderbuffer(GLenum format, GLvoid *addr,
/* we always Get/Put 32-bit Z values */
drb->Base.DataType = GL_UNSIGNED_INT;
}
else if (format == GL_DEPTH_COMPONENT32) {
/* Depth */
drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
/* we always Get/Put 32-bit Z values */
drb->Base.DataType = GL_UNSIGNED_INT;
}
else {
/* Stencil */
ASSERT(format == GL_STENCIL_INDEX8);
ASSERT(format == GL_STENCIL_INDEX8_EXT);
drb->Base._BaseFormat = GL_STENCIL_INDEX;
drb->Base.DataType = GL_UNSIGNED_BYTE;
}

View File

@@ -118,6 +118,13 @@ static const char ActiveTextureARB_names[] =
"";
#endif
#if defined(need_GL_EXT_framebuffer_blit)
static const char BlitFramebufferEXT_names[] =
"iiiiiiiiii\0" /* Parameter signature */
"glBlitFramebufferEXT\0"
"";
#endif
#if defined(need_GL_NV_vertex_program)
static const char VertexAttrib4ubvNV_names[] =
"ip\0" /* Parameter signature */
@@ -5015,6 +5022,13 @@ static const struct dri_extension_function GL_EXT_fog_coord_functions[] = {
};
#endif
#if defined(need_GL_EXT_framebuffer_blit)
static const struct dri_extension_function GL_EXT_framebuffer_blit_functions[] = {
{ BlitFramebufferEXT_names, BlitFramebufferEXT_remap_index, 818 },
{ NULL, 0, 0 }
};
#endif
#if defined(need_GL_EXT_framebuffer_object)
static const struct dri_extension_function GL_EXT_framebuffer_object_functions[] = {
{ GenerateMipmapEXT_names, GenerateMipmapEXT_remap_index, 812 },

View File

@@ -37,21 +37,24 @@
# include <GL/gl.h>
# include "GL/internal/dri_interface.h"
# include "imports.h"
# define __glXMemset memset
# define _mesa_memset memset
#else
# if defined(HAVE_DIX_CONFIG_H)
# include <dix-config.h>
# endif
# include <X11/X.h>
# include <GL/glx.h>
# include "GL/glxint.h"
# ifdef XFree86Server
# include "GL/glx_ansic.h"
extern void * __glXMalloc( size_t size );
extern void __glXFree( void * ptr );
# define _mesa_malloc(b) __glXMalloc(b)
# define _mesa_free(m) __glXFree(m)
# include <os.h>
# include <string.h>
# define _mesa_malloc(b) xalloc(b)
# define _mesa_free(m) xfree(m)
# define _mesa_memset memset
# else
# include <X11/Xlibint.h>
# define __glXMemset memset
# define _mesa_memset memset
# define _mesa_malloc(b) Xmalloc(b)
# define _mesa_free(m) Xfree(m)
# endif /* XFree86Server */
@@ -126,7 +129,7 @@ _gl_copy_visual_to_context_mode( __GLcontextModes * mode,
{
__GLcontextModes * const next = mode->next;
(void) __glXMemset( mode, 0, sizeof( __GLcontextModes ) );
(void) _mesa_memset( mode, 0, sizeof( __GLcontextModes ) );
mode->next = next;
mode->visualID = config->vid;
@@ -367,7 +370,7 @@ _gl_context_modes_create( unsigned count, size_t minimum_size )
break;
}
(void) __glXMemset( *next, 0, size );
(void) _mesa_memset( *next, 0, size );
(*next)->visualID = GLX_DONT_CARE;
(*next)->visualType = GLX_DONT_CARE;
(*next)->visualRating = GLX_NONE;

View File

@@ -971,19 +971,22 @@ get_max_size( unsigned nr_heaps,
* For hardware that does not support mipmapping, this will be 1.
* \param all_textures_one_heap True if the hardware requires that all
* textures be in a single texture heap for multitexturing.
* \param allow_larger_textures 0 conservative, 1 calculate limits
* so at least one worst-case texture can fit, 2 just use hw limits.
*/
void
driCalculateMaxTextureLevels( driTexHeap * const * heaps,
unsigned nr_heaps,
struct gl_constants * limits,
unsigned max_bytes_per_texel,
unsigned max_bytes_per_texel,
unsigned max_2D_size,
unsigned max_3D_size,
unsigned max_cube_size,
unsigned max_rect_size,
unsigned mipmaps_at_once,
int all_textures_one_heap )
int all_textures_one_heap,
int allow_larger_textures )
{
struct maps_per_heap max_textures[8];
unsigned i;
@@ -1012,18 +1015,22 @@ driCalculateMaxTextureLevels( driTexHeap * const * heaps,
*/
for ( i = 0 ; i < 4 ; i++ ) {
if ( max_sizes[ i ] != 0 ) {
fill_in_maximums( heaps, nr_heaps, max_bytes_per_texel,
if ( (allow_larger_textures != 2) && (max_sizes[ i ] != 0) ) {
fill_in_maximums( heaps, nr_heaps, max_bytes_per_texel,
max_sizes[ i ], mipmaps[ i ],
dimensions[ i ], faces[ i ],
max_textures );
max_sizes[ i ] = get_max_size( nr_heaps,
limits->MaxTextureUnits,
max_sizes[ i ] = get_max_size( nr_heaps,
allow_larger_textures == 1 ?
1 : limits->MaxTextureUnits,
max_sizes[ i ],
all_textures_one_heap,
max_textures );
}
else if (max_sizes[ i ] != 0) {
max_sizes[ i ] += 1;
}
}
SET_MAX( MaxTextureLevels, 0 );

View File

@@ -291,13 +291,14 @@ void
driCalculateMaxTextureLevels( driTexHeap * const * heaps,
unsigned nr_heaps,
struct gl_constants * limits,
unsigned max_bytes_per_texel,
unsigned max_bytes_per_texel,
unsigned max_2D_size,
unsigned max_3D_size,
unsigned max_cube_size,
unsigned max_rect_size,
unsigned mipmaps_at_once,
int all_textures_one_heap );
int all_textures_one_heap,
int allow_larger_textures );
void
driSetTextureSwapCounterLocation( driTexHeap * heap, unsigned * counter );

View File

@@ -178,8 +178,8 @@ msgid ""
"Always synchronize with vertical refresh, application chooses the minimum "
"swap interval"
msgstr ""
"Immer mit der Bildwiederholung synchronisieren, Anwendung wählt das minmale "
"Bildinterval"
"Immer mit der Bildwiederholung synchronisieren, Anwendung wählt das minimale "
"Bildintervall"
#: t_options.h:186
msgid "Use HyperZ to boost performance"
@@ -190,42 +190,51 @@ msgid "Number of texture units used"
msgstr "Anzahl der benutzten Textureinheiten"
#: t_options.h:196
msgid ""
"Enable hack to allow larger textures with texture compression on radeon/r200"
msgstr ""
"Hack aktivieren, der mit Texturkompression auf radeon/r200 größere Texturen "
"erlaubt"
msgid "Support larger textures not guaranteed to fit into graphics memory"
msgstr "Unterstütze grosse Texturen die evtl. nicht in den Grafikspeicher passen"
#: t_options.h:201
#: t_options.h:197
msgid "No"
msgstr "Nein"
#: t_options.h:198
msgid "At least 1 texture must fit under worst-case assumptions"
msgstr "Mindestens 1 Textur muss auch im schlechtesten Fall Platz haben"
#: t_options.h:199
msgid "Announce hardware limits"
msgstr "Benutze Hardware-Limits"
#: t_options.h:205
msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering"
msgstr ""
"Texturfilterqualität versus -geschwindigkeit, auch bekannt als „brilineare“ "
"Texturfilterung"
#: t_options.h:209
#: t_options.h:213
msgid "Used types of texture memory"
msgstr "Benutzte Arten von Texturspeicher"
#: t_options.h:210
#: t_options.h:214
msgid "All available memory"
msgstr "Aller verfügbarer Speicher"
#: t_options.h:211
#: t_options.h:215
msgid "Only card memory (if available)"
msgstr "Nur Grafikspeicher (falls verfügbar)"
#: t_options.h:212
#: t_options.h:216
msgid "Only GART (AGP/PCIE) memory (if available)"
msgstr "Nur GART-Speicher (AGP/PCIE) (falls verfügbar)"
#: t_options.h:220
#: t_options.h:224
msgid "Features that are not hardware-accelerated"
msgstr "Funktionalität, die nicht hardwarebeschleunigt ist"
#: t_options.h:224
#: t_options.h:228
msgid "Enable extension GL_ARB_vertex_program"
msgstr "Erweiterung GL_ARB_vertex_program aktivieren"
#: t_options.h:229
#: t_options.h:233
msgid "Enable extension GL_NV_vertex_program"
msgstr "Erweiterung GL_NV_vertex_program aktivieren"

View File

@@ -341,7 +341,7 @@ DRI_CONF_OPT_BEGIN_V(vblank_mode,enum,def,"0:3") \
DRI_CONF_ENUM(0,"Niemals mit der Bildwiederholung synchronisieren, Anweisungen der Anwendung ignorieren") \
DRI_CONF_ENUM(1,"Initiales Bildinterval 0, Anweisungen der Anwendung gehorchen") \
DRI_CONF_ENUM(2,"Initiales Bildinterval 1, Anweisungen der Anwendung gehorchen") \
DRI_CONF_ENUM(3,"Immer mit der Bildwiederholung synchronisieren, Anwendung wählt das minmale Bildinterval") \
DRI_CONF_ENUM(3,"Immer mit der Bildwiederholung synchronisieren, Anwendung wählt das minimale Bildintervall") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(es,"Sincronización con el refresco vertical (intervalos de intercambio)") \
DRI_CONF_ENUM(0,"No sincronizar nunca con el refresco vertical, ignorar la elección de la aplicación") \
@@ -383,13 +383,33 @@ DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min ":" # max ) \
DRI_CONF_DESC(fr,"Nombre d'unités de texture") \
DRI_CONF_OPT_END
#define DRI_CONF_TEXTURE_LEVEL_HACK(def) \
DRI_CONF_OPT_BEGIN(texture_level_hack,bool,def) \
DRI_CONF_DESC(en,"Enable hack to allow larger textures with texture compression on radeon/r200") \
DRI_CONF_DESC(de,"Hack aktivieren, der mit Texturkompression auf radeon/r200 größere Texturen erlaubt") \
DRI_CONF_DESC(es,"Activar ”hack“ para permitir texturas más grandes con compresión de textura activada en la Radeon/r200") \
DRI_CONF_DESC(nl,"Schakel hack in om met textuurcompressie grotere texturen toe te staan op een radeon/r200") \
DRI_CONF_DESC(fr,"Activer le hack permettant l'utilisation de textures de grande taille avec la compression de textures sur radeon/r200") \
#define DRI_CONF_ALLOW_LARGE_TEXTURES(def) \
DRI_CONF_OPT_BEGIN_V(allow_large_textures,enum,def,"0:2") \
DRI_CONF_DESC_BEGIN(en,"Support larger textures not guaranteed to fit into graphics memory") \
DRI_CONF_ENUM(0,"No") \
DRI_CONF_ENUM(1,"At least 1 texture must fit under worst-case assumptions") \
DRI_CONF_ENUM(2,"Announce hardware limits") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Unterstütze grosse Texturen die evtl. nicht in den Grafikspeicher passen") \
DRI_CONF_ENUM(0,"Nein") \
DRI_CONF_ENUM(1,"Mindestens 1 Textur muss auch im schlechtesten Fall Platz haben") \
DRI_CONF_ENUM(2,"Benutze Hardware-Limits") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(es,"Support larger textures not guaranteed to fit into graphics memory") \
DRI_CONF_ENUM(0,"No") \
DRI_CONF_ENUM(1,"At least 1 texture must fit under worst-case assumptions") \
DRI_CONF_ENUM(2,"Announce hardware limits") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(nl,"Support larger textures not guaranteed to fit into graphics memory") \
DRI_CONF_ENUM(0,"No") \
DRI_CONF_ENUM(1,"At least 1 texture must fit under worst-case assumptions") \
DRI_CONF_ENUM(2,"Announce hardware limits") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(fr,"Support larger textures not guaranteed to fit into graphics memory") \
DRI_CONF_ENUM(0,"No") \
DRI_CONF_ENUM(1,"At least 1 texture must fit under worst-case assumptions") \
DRI_CONF_ENUM(2,"Announce hardware limits") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_TEXTURE_BLEND_QUALITY(def,range) \

View File

@@ -191,9 +191,13 @@ DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min ":" # max ) \
DRI_CONF_DESC(en,gettext("Number of texture units used")) \
DRI_CONF_OPT_END
#define DRI_CONF_TEXTURE_LEVEL_HACK(def) \
DRI_CONF_OPT_BEGIN(texture_level_hack,bool,def) \
DRI_CONF_DESC(en,gettext("Enable hack to allow larger textures with texture compression on radeon/r200")) \
#define DRI_CONF_ALLOW_LARGE_TEXTURES(def) \
DRI_CONF_OPT_BEGIN_V(allow_large_textures,enum,def,"0:2") \
DRI_CONF_DESC_BEGIN(en,gettext("Support larger textures not guaranteed to fit into graphics memory")) \
DRI_CONF_ENUM(0,gettext("No")) \
DRI_CONF_ENUM(1,gettext("At least 1 texture must fit under worst-case assumptions")) \
DRI_CONF_ENUM(2,gettext("Announce hardware limits")) \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_TEXTURE_BLEND_QUALITY(def,range) \

View File

@@ -1,18 +1,13 @@
# src/mesa/drivers/dri/x11/Makefile
# src/mesa/drivers/dri/glcore/Makefile
TOP = ../../../../..
include $(TOP)/configs/current
LIBNAME = x11_dri.so
LIBNAME = glcore_dri.so
DRIVER_SOURCES = x11_dri.c \
DRIVER_SOURCES = glcore_driver.c \
$(TOP)/src/mesa/drivers/common/driverfuncs.c \
../common/dri_util.c \
../../x11/xm_api.c \
../../x11/xm_dd.c \
../../x11/xm_line.c \
../../x11/xm_span.c \
../../x11/xm_tri.c
../common/dri_util.c
C_SOURCES = \
$(DRIVER_SOURCES) \
@@ -23,7 +18,6 @@ C_SOURCES = \
INCLUDE_DIRS = \
-I. \
-I../common \
-I../../x11 \
-I../dri_client \
-I../dri_client/imports \
-Iserver \

View File

@@ -0,0 +1,128 @@
/*
* Copyright 2006 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* This implements a software-only "DRI" driver. It doesn't actually speak
* any DRI protocol or talk to the DRM, it just looks enough like a DRI driver
* that libglx in the server can load it for software rendering in the
* unaccelerated case.
*/
static GLboolean
glcoreInitDriver(__DRIscreenPrivate *driScreenPriv)
{
}
static void
glcoreDestroyScreen(__DRIScreenPrivate *driScreenPriv)
{
}
static GLboolean
glcoreCreateContext(const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
void *shared_context)
{
}
static void
glcoreDestroyContext(__DRIcontextPrivate *driContextPriv)
{
}
static GLboolean
glcoreCreateBuffer(__DRIscreenPrivate *driScreenPriv,
__DRIdrawablePrivate *driDrawablePriv,
const __GLcontextModes *mesaVisual,
GLboolean isPixmap)
{
}
static void
glcoreDestroyBuffer(__DRIdrawablePrivate *driDrawablePriv)
{
}
static void
glcoreSwapBuffers(__DRIdrawablePrivate *driDrawablePriv)
{
}
static GLboolean
glcoreMakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawablePriv,
__DRIdrawablePrivate *driReadablePriv)
{
}
static GLboolean
glcoreUnbindContext(__DRIcontextPrivate *driContextPriv)
{
}
static struct __DriverAPIRec glcore_api = {
.InitDriver = glcoreInitDriver,
.DestroyScreen = glcoreDestroyScreen,
.CreateContext = glcoreCreateContext,
.DestroyContext = glcoreDestroyContext,
.CreateBuffer = glcoreCreateBuffer,
.DestroyBuffer = glcoreDestroyBuffer,
.SwapBuffers = glcoreSwapBuffers,
.MakeCurrent = glcoreMakeCurrent,
.UnbindContext = glcoreUnbindContext,
};
static __GLcontextModes *
glcoreFillInModes(unsigned pixel_bits)
{
}
PUBLIC void *
__driCreateNewScreen_20050727(__DRInativeDisplay *dpy, int scrn,
__DRIscreen *psc, const __GLcontextModes *modes,
const __DRIversion *ddx_version,
const __DRIversion *dri_version,
const __DRIversion *drm_version,
const __DRIframebuffer *fb, drmAddress pSarea,
int fd, int internal_api_version,
const ___DRIinterfaceMethods *interface,
__GLcontextModes **driver_modes)
{
__DRIscreenPrivate *driScreenPriv;
glcoreDriverPrivate *glcoreDriverPriv;
/* would normally check ddx/dri/drm versions here */
driScreenPriv = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, ddx_version,
dri_version, drm_version, fb,
internal_api_version, &glcore_api);
if (!driScreenPriv)
return NULL;
glcoreDriverPriv = driScreenPriv->pDrvPriv;
*driver_modes = glcoreFillInModes(glcoreDriverPriv->bpp);
driInitExtensions(NULL, NULL, GL_FALSE);
return driScreenPriv;
}

View File

@@ -260,7 +260,8 @@ i810CreateContext( const __GLcontextModes *mesaVis,
0, /* cube textures unsupported. */
0, /* texture rectangles unsupported. */
12,
GL_FALSE );
GL_FALSE,
0 );
ctx->Const.MinLineWidth = 1.0;
ctx->Const.MinLineWidthAA = 1.0;

View File

@@ -302,9 +302,9 @@ i810InitDriver(__DRIscreenPrivate *sPriv)
i810Screen->tex.handle,
i810Screen->tex.size,
(drmAddress *)&i810Screen->tex.map) != 0) {
FREE(i810Screen);
drmUnmap(i810Screen->back.map, i810Screen->back.size);
drmUnmap(i810Screen->depth.map, i810Screen->depth.size);
FREE(i810Screen);
sPriv->private = NULL;
__driUtilMessage("i810InitDriver: drmMap (3) failed");
return GL_FALSE;

View File

@@ -1,31 +0,0 @@
TOP = ../../../../..
include $(TOP)/configs/current
LIBNAME = i830_dri.so
DRIVER_SOURCES = \
i830_context.c \
i830_debug.c \
i830_ioctl.c \
i830_render.c \
i830_screen.c \
i830_span.c \
i830_state.c \
i830_tex.c \
i830_texmem.c \
i830_texstate.c \
i830_tris.c
C_SOURCES = \
$(COMMON_SOURCES) \
$(MINIGLX_SOURCES) \
$(DRIVER_SOURCES)
ASM_SOURCES =
include ../Makefile.template
symlinks:

View File

@@ -1,677 +0,0 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_3d_reg.h,v 1.4 2002/12/10 01:26:53 dawes Exp $ */
#define I830_SET_FIELD( var, mask, value ) (var &= ~(mask), var |= value)
#define CMD_3D (0x3<<29)
/* 3DPRIMITIVE, p104 */
#define PRIM3D_INLINE (CMD_3D | (0x1f<<24))
#define PRIM3D_INDIRECT_SEQ ((1<<23) | PRIM3D_INLINE)
#define PRIM3D_INDICES ((1<<23) | PRIM3D_INLINE | (1<<17))
#define PRIM3D_INLINE_CNT(used) ((used / 4) - 2)
#define PRIM3D_INDICES_CNT(num_indices) ((num_indices + 1) / 2)
#define PRIM3D_INDIRECT_CNT(verts) (verts)
#define PRIM3D_TRILIST 0
#define PRIM3D_TRISTRIP (0x1<<18)
#define PRIM3D_TRISTRIP_RVRSE (0x2<<18)
#define PRIM3D_TRIFAN (0x3<<18)
#define PRIM3D_POLY (0x4<<18)
#define PRIM3D_LINELIST (0x5<<18)
#define PRIM3D_LINESTRIP (0x6<<18)
#define PRIM3D_RECTLIST (0x7<<18)
#define PRIM3D_POINTLIST (0x8<<18)
#define PRIM3D_DIB (0x9<<18)
/* STATE3D_ANTI_ALIASING, p 123 */
#define STATE3D_AA_CMD (CMD_3D | (0x06<<24))
#define AA_LINE_ECAAR_WIDTH_ENABLE (1<<16)
#define AA_LINE_ECAAR_WIDTH_0_5 0
#define AA_LINE_ECAAR_WIDTH_1_0 (1<<14)
#define AA_LINE_ECAAR_WIDTH_2_0 (2<<14)
#define AA_LINE_ECAAR_WIDTH_4_0 (3<<14)
#define AA_LINE_REGION_WIDTH_ENABLE (1<<8)
#define AA_LINE_REGION_WIDTH_0_5 0
#define AA_LINE_REGION_WIDTH_1_0 (1<<6)
#define AA_LINE_REGION_WIDTH_2_0 (2<<6)
#define AA_LINE_REGION_WIDTH_4_0 (3<<6)
#define AA_LINE_ENABLE ((1<<1) | 1)
#define AA_LINE_DISABLE (1<<1)
/* STATE3D_BUFFER_INFO, p 124 */
#define STATE3D_BUF_INFO_CMD (CMD_3D | (0x1d<<24) | (0x8e<<16) | 1)
/* Dword 1 */
#define BUF_3D_ID_COLOR_BACK (0x3<<24)
#define BUF_3D_ID_DEPTH (0x7<<24)
#define BUF_3D_USE_FENCE (1<<23)
#define BUF_3D_TILED_SURFACE (1<<22)
#define BUF_3D_TILE_WALK_X 0
#define BUF_3D_TILE_WALK_Y (1<<21)
#define BUF_3D_PITCH(x) ((x)<<2)
/* Dword 2 */
#define BUF_3D_ADDR(x) ((x) & ~0x3)
/* STATE3D_COLOR_FACTOR_0, p127 */
#define STATE3D_COLOR_FACTOR_CMD(stage) (CMD_3D | (0x1d<<24) | ((0x90 + (stage))<<16))
/* STATE3D_CONSTANT_BLEND_COLOR, p128 */
#define STATE3D_CONST_BLEND_COLOR_CMD (CMD_3D | (0x1d<<24) | (0x88<<16))
/* STATE3D_DEFAULT_DIFFUSE, p128 */
#define STATE3D_DFLT_DIFFUSE_CMD (CMD_3D | (0x1d<<24) | (0x99<<16))
/* STATE3D_DEFAULT_SPECULAR, p129 */
#define STATE3D_DFLT_SPEC_CMD (CMD_3D | (0x1d<<24) | (0x9a<<16))
/* STATE3D_DEFAULT_Z, p129 */
#define STATE3D_DFLT_Z_CMD (CMD_3D | (0x1d<<24) | (0x98<<16))
/* STATE3D_DEST_BUFFER_VARIABLES, p130 */
#define STATE3D_DST_BUF_VARS_CMD (CMD_3D | (0x1d<<24) | (0x85<<16))
/* Dword 1 */
#define DSTORG_HORT_BIAS(x) ((x)<<20)
#define DSTORG_VERT_BIAS(x) ((x)<<16)
#define COLOR_4_2_2_CHNL_WRT_ALL 0
#define COLOR_4_2_2_CHNL_WRT_Y (1<<12)
#define COLOR_4_2_2_CHNL_WRT_CR (2<<12)
#define COLOR_4_2_2_CHNL_WRT_CB (3<<12)
#define COLOR_4_2_2_CHNL_WRT_CRCB (4<<12)
#define COLR_BUF_8BIT 0
#define COLR_BUF_RGB555 (1<<8)
#define COLR_BUF_RGB565 (2<<8)
#define COLR_BUF_ARGB8888 (3<<8)
#define DEPTH_IS_Z 0
#define DEPTH_IS_W (1<<6)
#define DEPTH_FRMT_16_FIXED 0
#define DEPTH_FRMT_16_FLOAT (1<<2)
#define DEPTH_FRMT_24_FIXED_8_OTHER (2<<2)
#define DEPTH_FRMT_24_FLOAT_8_OTHER (3<<2)
#define VERT_LINE_STRIDE_1 (1<<1)
#define VERT_LINE_STRIDE_0 0
#define VERT_LINE_STRIDE_OFS_1 1
#define VERT_LINE_STRIDE_OFS_0 0
/* STATE3D_DRAWING_RECTANGLE, p133 */
#define STATE3D_DRAW_RECT_CMD (CMD_3D|(0x1d<<24)|(0x80<<16)|3)
/* Dword 1 */
#define DRAW_RECT_DIS_DEPTH_OFS (1<<30)
#define DRAW_DITHER_OFS_X(x) ((x)<<26)
#define DRAW_DITHER_OFS_Y(x) ((x)<<24)
/* Dword 2 */
#define DRAW_YMIN(x) ((x)<<16)
#define DRAW_XMIN(x) (x)
/* Dword 3 */
#define DRAW_YMAX(x) ((x)<<16)
#define DRAW_XMAX(x) (x)
/* Dword 4 */
#define DRAW_YORG(x) ((x)<<16)
#define DRAW_XORG(x) (x)
/* STATE3D_ENABLES_1, p136 */
#define STATE3D_ENABLES_1_CMD (CMD_3D|(0x3<<24))
#define ENABLE_LOGIC_OP_MASK ((1<<23)|(1<<22))
#define ENABLE_LOGIC_OP ((1<<23)|(1<<22))
#define DISABLE_LOGIC_OP (1<<23)
#define ENABLE_STENCIL_TEST ((1<<21)|(1<<20))
#define DISABLE_STENCIL_TEST (1<<21)
#define ENABLE_DEPTH_BIAS ((1<<11)|(1<<10))
#define DISABLE_DEPTH_BIAS (1<<11)
#define ENABLE_SPEC_ADD_MASK ((1<<9)|(1<<8))
#define ENABLE_SPEC_ADD ((1<<9)|(1<<8))
#define DISABLE_SPEC_ADD (1<<9)
#define ENABLE_DIS_FOG_MASK ((1<<7)|(1<<6))
/* prefixed I830 because ENABLE_FOG defined elsewhere */
#define I830_ENABLE_FOG ((1<<7)|(1<<6))
#define I830_DISABLE_FOG (1<<7)
#define ENABLE_DIS_ALPHA_TEST_MASK ((1<<5)|(1<<4))
#define ENABLE_ALPHA_TEST ((1<<5)|(1<<4))
#define DISABLE_ALPHA_TEST (1<<5)
#define ENABLE_DIS_CBLEND_MASK ((1<<3)|(1<<2))
#define ENABLE_COLOR_BLEND ((1<<3)|(1<<2))
#define DISABLE_COLOR_BLEND (1<<3)
#define ENABLE_DIS_DEPTH_TEST_MASK ((1<<1)|1)
#define ENABLE_DEPTH_TEST ((1<<1)|1)
#define DISABLE_DEPTH_TEST (1<<1)
/* STATE3D_ENABLES_2, p138 */
#define STATE3D_ENABLES_2_CMD (CMD_3D|(0x4<<24))
#define ENABLE_STENCIL_WRITE ((1<<21)|(1<<20))
#define DISABLE_STENCIL_WRITE (1<<21)
#define ENABLE_TEX_CACHE ((1<<17)|(1<<16))
#define DISABLE_TEX_CACHE (1<<17)
#define ENABLE_DITHER ((1<<9)|(1<<8))
#define DISABLE_DITHER (1<<9)
#define ENABLE_COLOR_MASK (1<<10)
#define WRITEMASK_ALPHA (1<<7)
#define WRITEMASK_ALPHA_SHIFT 7
#define WRITEMASK_RED (1<<6)
#define WRITEMASK_RED_SHIFT 6
#define WRITEMASK_GREEN (1<<5)
#define WRITEMASK_GREEN_SHIFT 5
#define WRITEMASK_BLUE (1<<4)
#define WRITEMASK_BLUE_SHIFT 4
#define WRITEMASK_MASK ((1<<4)|(1<<5)|(1<<6)|(1<<7))
#define ENABLE_COLOR_WRITE ((1<<3)|(1<<2))
#define DISABLE_COLOR_WRITE (1<<3)
#define ENABLE_DIS_DEPTH_WRITE_MASK 0x3
#define ENABLE_DEPTH_WRITE ((1<<1)|1)
#define DISABLE_DEPTH_WRITE (1<<1)
/* STATE3D_FOG_COLOR, p139 */
#define STATE3D_FOG_COLOR_CMD (CMD_3D|(0x15<<24))
#define FOG_COLOR_RED(x) ((x)<<16)
#define FOG_COLOR_GREEN(x) ((x)<<8)
#define FOG_COLOR_BLUE(x) (x)
/* STATE3D_FOG_MODE, p140 */
#define STATE3D_FOG_MODE_CMD (CMD_3D|(0x1d<<24)|(0x89<<16)|2)
/* Dword 1 */
#define FOGFUNC_ENABLE (1<<31)
#define FOGFUNC_VERTEX 0
#define FOGFUNC_PIXEL_EXP (1<<28)
#define FOGFUNC_PIXEL_EXP2 (2<<28)
#define FOGFUNC_PIXEL_LINEAR (3<<28)
#define FOGSRC_INDEX_Z (1<<27)
#define FOGSRC_INDEX_W ((1<<27)|(1<<25))
#define FOG_LINEAR_CONST (1<<24)
#define FOG_CONST_1(x) ((x)<<4)
#define ENABLE_FOG_DENSITY (1<<23)
/* Dword 2 */
#define FOG_CONST_2(x) (x)
/* Dword 3 */
#define FOG_DENSITY(x) (x)
/* STATE3D_INDEPENDENT_ALPHA_BLEND, p142 */
#define STATE3D_INDPT_ALPHA_BLEND_CMD (CMD_3D|(0x0b<<24))
#define ENABLE_INDPT_ALPHA_BLEND ((1<<23)|(1<<22))
#define DISABLE_INDPT_ALPHA_BLEND (1<<23)
#define ALPHA_BLENDFUNC_MASK 0x3f0000
#define ENABLE_ALPHA_BLENDFUNC (1<<21)
#define ABLENDFUNC_ADD 0
#define ABLENDFUNC_SUB (1<<16)
#define ABLENDFUNC_RVSE_SUB (2<<16)
#define ABLENDFUNC_MIN (3<<16)
#define ABLENDFUNC_MAX (4<<16)
#define SRC_DST_ABLEND_MASK 0xfff
#define ENABLE_SRC_ABLEND_FACTOR (1<<11)
#define SRC_ABLEND_FACT(x) ((x)<<6)
#define ENABLE_DST_ABLEND_FACTOR (1<<5)
#define DST_ABLEND_FACT(x) (x)
#define BLEND_STATE_MASK (ALPHA_BLENDFUNC_MASK | SRC_DST_ABLEND_MASK)
#define BLENDFACT_ZERO 0x01
#define BLENDFACT_ONE 0x02
#define BLENDFACT_SRC_COLR 0x03
#define BLENDFACT_INV_SRC_COLR 0x04
#define BLENDFACT_SRC_ALPHA 0x05
#define BLENDFACT_INV_SRC_ALPHA 0x06
#define BLENDFACT_DST_ALPHA 0x07
#define BLENDFACT_INV_DST_ALPHA 0x08
#define BLENDFACT_DST_COLR 0x09
#define BLENDFACT_INV_DST_COLR 0x0a
#define BLENDFACT_SRC_ALPHA_SATURATE 0x0b
#define BLENDFACT_CONST_COLOR 0x0c
#define BLENDFACT_INV_CONST_COLOR 0x0d
#define BLENDFACT_CONST_ALPHA 0x0e
#define BLENDFACT_INV_CONST_ALPHA 0x0f
/* STATE3D_MAP_BLEND_ARG, p152 */
#define STATE3D_MAP_BLEND_ARG_CMD(stage) (CMD_3D|(0x0e<<24)|((stage)<<20))
#define TEXPIPE_COLOR 0
#define TEXPIPE_ALPHA (1<<18)
#define TEXPIPE_KILL (2<<18)
#define TEXBLEND_ARG0 0
#define TEXBLEND_ARG1 (1<<15)
#define TEXBLEND_ARG2 (2<<15)
#define TEXBLEND_ARG3 (3<<15)
#define TEXBLENDARG_MODIFY_PARMS (1<<6)
#define TEXBLENDARG_REPLICATE_ALPHA (1<<5)
#define TEXBLENDARG_INV_ARG (1<<4)
#define TEXBLENDARG_ONE 0
#define TEXBLENDARG_FACTOR 0x01
#define TEXBLENDARG_ACCUM 0x02
#define TEXBLENDARG_DIFFUSE 0x03
#define TEXBLENDARG_SPEC 0x04
#define TEXBLENDARG_CURRENT 0x05
#define TEXBLENDARG_TEXEL0 0x06
#define TEXBLENDARG_TEXEL1 0x07
#define TEXBLENDARG_TEXEL2 0x08
#define TEXBLENDARG_TEXEL3 0x09
#define TEXBLENDARG_FACTOR_N 0x0e
/* STATE3D_MAP_BLEND_OP, p155 */
#define STATE3D_MAP_BLEND_OP_CMD(stage) (CMD_3D|(0x0d<<24)|((stage)<<20))
#if 0
#define TEXPIPE_COLOR 0
#define TEXPIPE_ALPHA (1<<18)
#define TEXPIPE_KILL (2<<18)
#endif
#define ENABLE_TEXOUTPUT_WRT_SEL (1<<17)
#define TEXOP_OUTPUT_CURRENT 0
#define TEXOP_OUTPUT_ACCUM (1<<15)
#define ENABLE_TEX_CNTRL_STAGE ((1<<12)|(1<<11))
#define DISABLE_TEX_CNTRL_STAGE (1<<12)
#define TEXOP_SCALE_SHIFT 9
#define TEXOP_SCALE_1X (0 << TEXOP_SCALE_SHIFT)
#define TEXOP_SCALE_2X (1 << TEXOP_SCALE_SHIFT)
#define TEXOP_SCALE_4X (2 << TEXOP_SCALE_SHIFT)
#define TEXOP_MODIFY_PARMS (1<<8)
#define TEXOP_LAST_STAGE (1<<7)
#define TEXBLENDOP_KILLPIXEL 0x02
#define TEXBLENDOP_ARG1 0x01
#define TEXBLENDOP_ARG2 0x02
#define TEXBLENDOP_MODULATE 0x03
#define TEXBLENDOP_ADD 0x06
#define TEXBLENDOP_ADDSIGNED 0x07
#define TEXBLENDOP_BLEND 0x08
#define TEXBLENDOP_BLEND_AND_ADD 0x09
#define TEXBLENDOP_SUBTRACT 0x0a
#define TEXBLENDOP_DOT3 0x0b
#define TEXBLENDOP_DOT4 0x0c
#define TEXBLENDOP_MODULATE_AND_ADD 0x0d
#define TEXBLENDOP_MODULATE_2X_AND_ADD 0x0e
#define TEXBLENDOP_MODULATE_4X_AND_ADD 0x0f
/* STATE3D_MAP_BUMP_TABLE, p160 TODO */
/* STATE3D_MAP_COLOR_CHROMA_KEY, p161 TODO */
/* STATE3D_MAP_COORD_SET_BINDINGS, p162 */
#define STATE3D_MAP_COORD_SETBIND_CMD (CMD_3D|(0x1d<<24)|(0x02<<16))
#define TEXBIND_MASK3 ((1<<15)|(1<<14)|(1<<13)|(1<<12))
#define TEXBIND_MASK2 ((1<<11)|(1<<10)|(1<<9)|(1<<8))
#define TEXBIND_MASK1 ((1<<7)|(1<<6)|(1<<5)|(1<<4))
#define TEXBIND_MASK0 ((1<<3)|(1<<2)|(1<<1)|1)
#define TEXBIND_SET3(x) ((x)<<12)
#define TEXBIND_SET2(x) ((x)<<8)
#define TEXBIND_SET1(x) ((x)<<4)
#define TEXBIND_SET0(x) (x)
#define TEXCOORDSRC_KEEP 0
#define TEXCOORDSRC_DEFAULT 0x01
#define TEXCOORDSRC_VTXSET_0 0x08
#define TEXCOORDSRC_VTXSET_1 0x09
#define TEXCOORDSRC_VTXSET_2 0x0a
#define TEXCOORDSRC_VTXSET_3 0x0b
#define TEXCOORDSRC_VTXSET_4 0x0c
#define TEXCOORDSRC_VTXSET_5 0x0d
#define TEXCOORDSRC_VTXSET_6 0x0e
#define TEXCOORDSRC_VTXSET_7 0x0f
#define MAP_UNIT(unit) ((unit)<<16)
#define MAP_UNIT_MASK (3<<16)
/* STATE3D_MAP_COORD_SETS, p164 */
#define STATE3D_MAP_COORD_SET_CMD (CMD_3D|(0x1c<<24)|(0x01<<19))
#define ENABLE_TEXCOORD_PARAMS (1<<15)
#define TEXCOORDS_ARE_NORMAL (1<<14)
#define TEXCOORDS_ARE_IN_TEXELUNITS 0
#define TEXCOORDTYPE_CARTESIAN 0
#define TEXCOORDTYPE_HOMOGENEOUS (1<<11)
#define TEXCOORDTYPE_VECTOR (2<<11)
#define ENABLE_ADDR_V_CNTL (1<<7)
#define ENABLE_ADDR_U_CNTL (1<<3)
#define TEXCOORD_ADDR_V_MODE(x) ((x)<<4)
#define TEXCOORD_ADDR_U_MODE(x) (x)
#define TEXCOORDMODE_WRAP 0
#define TEXCOORDMODE_MIRROR 1
#define TEXCOORDMODE_CLAMP 2
#define TEXCOORDMODE_WRAP_SHORTEST 3
#define TEXCOORDMODE_CLAMP_BORDER 4
#define TEXCOORD_ADDR_V_MASK 0x70
#define TEXCOORD_ADDR_U_MASK 0x7
/* STATE3D_MAP_CUBE, p168 TODO */
#define STATE3D_MAP_CUBE (CMD_3D|(0x1c<<24)|(0x0a<<19))
#define CUBE_NEGX_ENABLE (1<<5)
#define CUBE_POSX_ENABLE (1<<4)
#define CUBE_NEGY_ENABLE (1<<3)
#define CUBE_POSY_ENABLE (1<<2)
#define CUBE_NEGZ_ENABLE (1<<1)
#define CUBE_POSZ_ENABLE (1<<0)
/* STATE3D_MODES_1, p190 */
#define STATE3D_MODES_1_CMD (CMD_3D|(0x08<<24))
#define BLENDFUNC_MASK 0x3f0000
#define ENABLE_COLR_BLND_FUNC (1<<21)
#define BLENDFUNC_ADD 0
#define BLENDFUNC_SUB (1<<16)
#define BLENDFUNC_RVRSE_SUB (2<<16)
#define BLENDFUNC_MIN (3<<16)
#define BLENDFUNC_MAX (4<<16)
#define SRC_DST_BLND_MASK 0xfff
#define ENABLE_SRC_BLND_FACTOR (1<<11)
#define ENABLE_DST_BLND_FACTOR (1<<5)
#define SRC_BLND_FACT(x) ((x)<<6)
#define DST_BLND_FACT(x) (x)
/* Use the blendfact defines for BLND_FACTOR macros */
#if 0
#define BLENDFACT_ZERO 0x01
#define BLENDFACT_ONE 0x02
#define BLENDFACT_SRC_COLR 0x03
#define BLENDFACT_INV_SRC_COLR 0x04
#define BLENDFACT_SRC_ALPHA 0x05
#define BLENDFACT_INV_SRC_ALPHA 0x06
#define BLENDFACT_DST_ALPHA 0x07
#define BLENDFACT_INV_DST_ALPHA 0x08
#define BLENDFACT_CONST_ALPHA 0x0e
#define BLENDFACT_INV_CONST_ALPHA 0x0f
#endif
/* STATE3D_MODES_2, p192 */
#define STATE3D_MODES_2_CMD (CMD_3D|(0x0f<<24))
#define ENABLE_GLOBAL_DEPTH_BIAS (1<<22)
#define GLOBAL_DEPTH_BIAS(x) ((x)<<14)
#define ENABLE_ALPHA_TEST_FUNC (1<<13)
#define ENABLE_ALPHA_REF_VALUE (1<<8)
#define ALPHA_TEST_FUNC(x) ((x)<<9)
#define ALPHA_REF_VALUE(x) (x)
#define ALPHA_TEST_REF_MASK 0x3fff
#define COMPAREFUNC_ALWAYS 0
#define COMPAREFUNC_NEVER 0x1
#define COMPAREFUNC_LESS 0x2
#define COMPAREFUNC_EQUAL 0x3
#define COMPAREFUNC_LEQUAL 0x4
#define COMPAREFUNC_GREATER 0x5
#define COMPAREFUNC_NOTEQUAL 0x6
#define COMPAREFUNC_GEQUAL 0x7
/* STATE3D_MODES_3, p193 */
#define STATE3D_MODES_3_CMD (CMD_3D|(0x02<<24))
#define DEPTH_TEST_FUNC_MASK 0x1f0000
#define ENABLE_DEPTH_TEST_FUNC (1<<20)
/* Uses COMPAREFUNC */
#define DEPTH_TEST_FUNC(x) ((x)<<16)
#define ENABLE_ALPHA_SHADE_MODE (1<<11)
#define ENABLE_FOG_SHADE_MODE (1<<9)
#define ENABLE_SPEC_SHADE_MODE (1<<7)
#define ENABLE_COLOR_SHADE_MODE (1<<5)
#define ALPHA_SHADE_MODE(x) ((x)<<10)
#define FOG_SHADE_MODE(x) ((x)<<8)
#define SPEC_SHADE_MODE(x) ((x)<<6)
#define COLOR_SHADE_MODE(x) ((x)<<4)
#define CULLMODE_MASK 0xf
#define ENABLE_CULL_MODE (1<<3)
#define CULLMODE_BOTH 0
#define CULLMODE_NONE 1
#define CULLMODE_CW 2
#define CULLMODE_CCW 3
#define SHADE_MODE_LINEAR 0
#define SHADE_MODE_FLAT 0x1
/* STATE3D_MODES_4, p195 */
#define STATE3D_MODES_4_CMD (CMD_3D|(0x16<<24))
#define ENABLE_LOGIC_OP_FUNC (1<<23)
#define LOGIC_OP_FUNC(x) ((x)<<18)
#define LOGICOP_MASK ((1<<18)|(1<<19)|(1<<20)|(1<<21))
#define LOGICOP_CLEAR 0
#define LOGICOP_NOR 0x1
#define LOGICOP_AND_INV 0x2
#define LOGICOP_COPY_INV 0x3
#define LOGICOP_AND_RVRSE 0x4
#define LOGICOP_INV 0x5
#define LOGICOP_XOR 0x6
#define LOGICOP_NAND 0x7
#define LOGICOP_AND 0x8
#define LOGICOP_EQUIV 0x9
#define LOGICOP_NOOP 0xa
#define LOGICOP_OR_INV 0xb
#define LOGICOP_COPY 0xc
#define LOGICOP_OR_RVRSE 0xd
#define LOGICOP_OR 0xe
#define LOGICOP_SET 0xf
#define MODE4_ENABLE_STENCIL_TEST_MASK ((1<<17)|(0xff00))
#define ENABLE_STENCIL_TEST_MASK (1<<17)
#define STENCIL_TEST_MASK(x) ((x)<<8)
#define MODE4_ENABLE_STENCIL_WRITE_MASK ((1<<16)|(0x00ff))
#define ENABLE_STENCIL_WRITE_MASK (1<<16)
#define STENCIL_WRITE_MASK(x) (x)
/* STATE3D_MODES_5, p196 */
#define STATE3D_MODES_5_CMD (CMD_3D|(0x0c<<24))
#define ENABLE_SPRITE_POINT_TEX (1<<23)
#define SPRITE_POINT_TEX_ON (1<<22)
#define SPRITE_POINT_TEX_OFF 0
#define FLUSH_RENDER_CACHE (1<<18)
#define FLUSH_TEXTURE_CACHE (1<<16)
#define FIXED_LINE_WIDTH_MASK 0xfc00
#define ENABLE_FIXED_LINE_WIDTH (1<<15)
#define FIXED_LINE_WIDTH(x) ((x)<<10)
#define FIXED_POINT_WIDTH_MASK 0x3ff
#define ENABLE_FIXED_POINT_WIDTH (1<<9)
#define FIXED_POINT_WIDTH(x) (x)
/* STATE3D_RASTERIZATION_RULES, p198 */
#define STATE3D_RASTER_RULES_CMD (CMD_3D|(0x07<<24))
#define ENABLE_POINT_RASTER_RULE (1<<15)
#define OGL_POINT_RASTER_RULE (1<<13)
#define ENABLE_LINE_STRIP_PROVOKE_VRTX (1<<8)
#define ENABLE_TRI_FAN_PROVOKE_VRTX (1<<5)
#define ENABLE_TRI_STRIP_PROVOKE_VRTX (1<<2)
#define LINE_STRIP_PROVOKE_VRTX(x) ((x)<<6)
#define TRI_FAN_PROVOKE_VRTX(x) ((x)<<3)
#define TRI_STRIP_PROVOKE_VRTX(x) (x)
/* STATE3D_SCISSOR_ENABLE, p200 */
#define STATE3D_SCISSOR_ENABLE_CMD (CMD_3D|(0x1c<<24)|(0x10<<19))
#define ENABLE_SCISSOR_RECT ((1<<1) | 1)
#define DISABLE_SCISSOR_RECT (1<<1)
/* STATE3D_SCISSOR_RECTANGLE_0, p201 */
#define STATE3D_SCISSOR_RECT_0_CMD (CMD_3D|(0x1d<<24)|(0x81<<16)|1)
/* Dword 1 */
#define SCISSOR_RECT_0_YMIN(x) ((x)<<16)
#define SCISSOR_RECT_0_XMIN(x) (x)
/* Dword 2 */
#define SCISSOR_RECT_0_YMAX(x) ((x)<<16)
#define SCISSOR_RECT_0_XMAX(x) (x)
/* STATE3D_STENCIL_TEST, p202 */
#define STATE3D_STENCIL_TEST_CMD (CMD_3D|(0x09<<24))
#define ENABLE_STENCIL_PARMS (1<<23)
#define STENCIL_OPS_MASK (0xffc000)
#define STENCIL_FAIL_OP(x) ((x)<<20)
#define STENCIL_PASS_DEPTH_FAIL_OP(x) ((x)<<17)
#define STENCIL_PASS_DEPTH_PASS_OP(x) ((x)<<14)
#define STENCILOP_KEEP 0
#define STENCILOP_ZERO 0x1
#define STENCILOP_REPLACE 0x2
#define STENCILOP_INCRSAT 0x3
#define STENCILOP_DECRSAT 0x4
#define STENCILOP_INCR 0x5
#define STENCILOP_DECR 0x6
#define STENCILOP_INVERT 0x7
#define ENABLE_STENCIL_TEST_FUNC_MASK ((1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9))
#define ENABLE_STENCIL_TEST_FUNC (1<<13)
/* Uses COMPAREFUNC */
#define STENCIL_TEST_FUNC(x) ((x)<<9)
#define STENCIL_REF_VALUE_MASK ((1<<8)|0xff)
#define ENABLE_STENCIL_REF_VALUE (1<<8)
#define STENCIL_REF_VALUE(x) (x)
/* STATE3D_VERTEX_FORMAT, p204 */
#define STATE3D_VERTEX_FORMAT_CMD (CMD_3D|(0x05<<24))
#define VRTX_HAS_POINT_WIDTH (1<<12)
#define VRTX_TEX_COORD_COUNT(x) ((x)<<8)
#define VRTX_HAS_SPEC (1<<7)
#define VRTX_HAS_DIFFUSE (1<<6)
#define VRTX_HAS_DEPTH_OFS (1<<5)
#define VRTX_HAS_XYZ (1<<1)
#define VRTX_HAS_XYZW (2<<1)
#define VRTX_HAS_XY (3<<1)
#define VRTX_HAS_XYW (4<<1)
/* STATE3D_VERTEX_FORMAT_2, p206 */
#define STATE3D_VERTEX_FORMAT_2_CMD (CMD_3D|(0x0a<<24))
#define VRTX_TEX_SET_7_FMT(x) ((x)<<14)
#define VRTX_TEX_SET_6_FMT(x) ((x)<<12)
#define VRTX_TEX_SET_5_FMT(x) ((x)<<10)
#define VRTX_TEX_SET_4_FMT(x) ((x)<<8)
#define VRTX_TEX_SET_3_FMT(x) ((x)<<6)
#define VRTX_TEX_SET_2_FMT(x) ((x)<<4)
#define VRTX_TEX_SET_1_FMT(x) ((x)<<2)
#define VRTX_TEX_SET_0_FMT(x) (x)
#define TEXCOORDFMT_2D 0
#define TEXCOORDFMT_3D 1
#define TEXCOORDFMT_4D 2
#define TEXCOORDFMT_1D 3
/*New stuff picked up along the way */
#define MLC_LOD_BIAS_MASK ((1<<7)-1)
/* STATE3D_VERTEX_TRANSFORM, p207 */
#define STATE3D_VERTEX_TRANS_CMD (CMD_3D|(0x1d<<24)|(0x8b<<16)|0)
#define STATE3D_VERTEX_TRANS_MTX_CMD (CMD_3D|(0x1d<<24)|(0x8b<<16)|6)
/* Dword 1 */
#define ENABLE_VIEWPORT_TRANSFORM ((1<<31)|(1<<30))
#define DISABLE_VIEWPORT_TRANSFORM (1<<31)
#define ENABLE_PERSP_DIVIDE ((1<<29)|(1<<28))
#define DISABLE_PERSP_DIVIDE (1<<29)
#define VRTX_TRANS_LOAD_MATRICES 0x7421
#define VRTX_TRANS_NO_LOAD_MATRICES 0x0000
/* Dword 2 -> 7 are matrix elements */
/* STATE3D_W_STATE, p209 */
#define STATE3D_W_STATE_CMD (CMD_3D|(0x1d<<24)|(0x8d<<16)|1)
/* Dword 1 */
#define MAGIC_W_STATE_DWORD1 0x00000008
/* Dword 2 */
#define WFAR_VALUE(x) (x)
/* if defining I830_ENABLE_4_TEXTURES, do it in i830_drm.h, too */
#define I830PACKCOLOR4444(r,g,b,a) \
((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
#define I830PACKCOLOR1555(r,g,b,a) \
((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
((a) ? 0x8000 : 0))
#define I830PACKCOLOR565(r,g,b) \
((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
#define I830PACKCOLOR8888(r,g,b,a) \
((a<<24) | (r<<16) | (g<<8) | b)
/* Stipple command, carried over from the i810, apparently:
*/
#define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
#define ST1_ENABLE (1<<16)
#define ST1_MASK (0xffff)
#define STATE3D_LOAD_STATE_IMMEDIATE_2 ((0x3<<29)|(0x1d<<24)|(0x03<<16))
#define LOAD_TEXTURE_MAP0 (1<<11)
#define TM0S0_ADDRESS_MASK 0xfffffffc
#define TM0S0_USE_FENCE (1<<1)
#define TM0S1_HEIGHT_SHIFT 21
#define TM0S1_WIDTH_SHIFT 10
#define TM0S1_PALETTE_SELECT (1<<9)
#define TM0S1_MAPSURF_FORMAT_MASK (0x7 << 6)
#define TM0S1_MAPSURF_FORMAT_SHIFT 6
#define MAPSURF_8BIT_INDEXED (0<<6)
#define MAPSURF_8BIT (1<<6)
#define MAPSURF_16BIT (2<<6)
#define MAPSURF_32BIT (3<<6)
#define MAPSURF_411 (4<<6)
#define MAPSURF_422 (5<<6)
#define MAPSURF_COMPRESSED (6<<6)
#define MAPSURF_4BIT_INDEXED (7<<6)
#define TM0S1_MT_FORMAT_MASK (0x7 << 3)
#define TM0S1_MT_FORMAT_SHIFT 3
#define MT_4BIT_IDX_ARGB8888 (7<<3) /* SURFACE_4BIT_INDEXED */
#define MT_8BIT_IDX_RGB565 (0<<3) /* SURFACE_8BIT_INDEXED */
#define MT_8BIT_IDX_ARGB1555 (1<<3)
#define MT_8BIT_IDX_ARGB4444 (2<<3)
#define MT_8BIT_IDX_AY88 (3<<3)
#define MT_8BIT_IDX_ABGR8888 (4<<3)
#define MT_8BIT_IDX_BUMP_88DVDU (5<<3)
#define MT_8BIT_IDX_BUMP_655LDVDU (6<<3)
#define MT_8BIT_IDX_ARGB8888 (7<<3)
#define MT_8BIT_I8 (0<<3) /* SURFACE_8BIT */
#define MT_8BIT_L8 (1<<3)
#define MT_16BIT_RGB565 (0<<3) /* SURFACE_16BIT */
#define MT_16BIT_ARGB1555 (1<<3)
#define MT_16BIT_ARGB4444 (2<<3)
#define MT_16BIT_AY88 (3<<3)
#define MT_16BIT_DIB_ARGB1555_8888 (4<<3)
#define MT_16BIT_BUMP_88DVDU (5<<3)
#define MT_16BIT_BUMP_655LDVDU (6<<3)
#define MT_16BIT_DIB_RGB565_8888 (7<<3)
#define MT_32BIT_ARGB8888 (0<<3) /* SURFACE_32BIT */
#define MT_32BIT_ABGR8888 (1<<3)
#define MT_32BIT_BUMP_XLDVDU_8888 (6<<3)
#define MT_32BIT_DIB_8888 (7<<3)
#define MT_411_YUV411 (0<<3) /* SURFACE_411 */
#define MT_422_YCRCB_SWAPY (0<<3) /* SURFACE_422 */
#define MT_422_YCRCB_NORMAL (1<<3)
#define MT_422_YCRCB_SWAPUV (2<<3)
#define MT_422_YCRCB_SWAPUVY (3<<3)
#define MT_COMPRESS_DXT1 (0<<3) /* SURFACE_COMPRESSED */
#define MT_COMPRESS_DXT2_3 (1<<3)
#define MT_COMPRESS_DXT4_5 (2<<3)
#define MT_COMPRESS_FXT1 (3<<3)
#define TM0S1_COLORSPACE_CONVERSION (1 << 2)
#define TM0S1_TILED_SURFACE (1 << 1)
#define TM0S1_TILE_WALK (1 << 0)
#define TM0S2_PITCH_SHIFT 21
#define TM0S2_CUBE_FACE_ENA_SHIFT 15
#define TM0S2_MAP_FORMAT (1<<14)
#define TM0S2_VERTICAL_LINE_STRIDE (1<<13)
#define TM0S2_VERITCAL_LINE_STRIDE_OFF (1<<12)
#define TM0S2_OUTPUT_CHAN_SHIFT 10
#define TM0S2_OUTPUT_CHAN_MASK (3<<10)
#define TM0S3_MIP_FILTER_MASK (0x3<<30)
#define TM0S3_MIP_FILTER_SHIFT 30
#define MIPFILTER_NONE 0
#define MIPFILTER_NEAREST 1
#define MIPFILTER_LINEAR 3
#define TM0S3_MAG_FILTER_MASK (0x3<<28)
#define TM0S3_MAG_FILTER_SHIFT 28
#define TM0S3_MIN_FILTER_MASK (0x3<<26)
#define TM0S3_MIN_FILTER_SHIFT 26
#define FILTER_NEAREST 0
#define FILTER_LINEAR 1
#define FILTER_ANISOTROPIC 2
#define TM0S3_LOD_BIAS_SHIFT 17
#define TM0S3_LOD_BIAS_MASK (0x1ff<<17)
#define TM0S3_MAX_MIP_SHIFT 9
#define TM0S3_MAX_MIP_MASK (0xff<<9)
#define TM0S3_MIN_MIP_SHIFT 3
#define TM0S3_MIN_MIP_MASK (0x3f<<3)
#define TM0S3_KILL_PIXEL (1<<2)
#define TM0S3_KEYED_FILTER (1<<1)
#define TM0S3_CHROMA_KEY (1<<0)
/* STATE3D_MAP_TEXEL_STREAM, p188 */
#define STATE3D_MAP_TEX_STREAM_CMD (CMD_3D|(0x1c<<24)|(0x05<<19))
#define DISABLE_TEX_STREAM_BUMP (1<<12)
#define ENABLE_TEX_STREAM_BUMP ((1<<12)|(1<<11))
#define TEX_MODIFY_UNIT_0 0
#define TEX_MODIFY_UNIT_1 (1<<8)
#define ENABLE_TEX_STREAM_COORD_SET (1<<7)
#define TEX_STREAM_COORD_SET(x) ((x)<<4)
#define ENABLE_TEX_STREAM_MAP_IDX (1<<3)
#define TEX_STREAM_MAP_IDX(x) (x)

View File

@@ -1,627 +0,0 @@
/**************************************************************************
*
* Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* **************************************************************************/
/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_context.c,v 1.9 2003/02/06 04:18:00 dawes Exp $ */
/**
* \file i830_context.c
*
* Heavily Based on I810 driver written by Keith Whitwell.
*
* \author Jeff Hartmann <jhartmann@2d3d.com>
* \author Graeme Fisher <graeme@2d3d.co.za>
* \author Abraham vd Merwe <abraham@2d3d.co.za>
* \author Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "context.h"
#include "matrix.h"
#include "simple_list.h"
#include "extensions.h"
#include "framebuffer.h"
#include "imports.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "array_cache/acache.h"
#include "tnl/t_pipeline.h"
#include "drivers/common/driverfuncs.h"
#include "i830_screen.h"
#include "i830_dri.h"
#include "i830_state.h"
#include "i830_tex.h"
#include "i830_span.h"
#include "i830_tris.h"
#include "i830_ioctl.h"
#include "drirenderbuffer.h"
#include "utils.h"
#define need_GL_ARB_multisample
#define need_GL_ARB_texture_compression
#define need_GL_EXT_blend_color
#define need_GL_EXT_blend_equation_separate
#define need_GL_EXT_blend_func_separate
#define need_GL_EXT_blend_minmax
#define need_GL_EXT_fog_coord
#define need_GL_EXT_secondary_color
#include "extension_helper.h"
#include "xmlpool.h" /* for symbolic values of enum-type options */
#ifndef I830_DEBUG
int I830_DEBUG = (0);
#endif
/***************************************
* Mesa's Driver Functions
***************************************/
#define DRIVER_DATE "20041007"
static const GLubyte *i830DDGetString( GLcontext *ctx, GLenum name )
{
const char * chipset;
static char buffer[128];
switch (name) {
case GL_VENDOR:
switch (I830_CONTEXT(ctx)->i830Screen->deviceID) {
case PCI_CHIP_845_G:
return (GLubyte *)"2d3D, Inc";
case PCI_CHIP_I830_M:
return (GLubyte *)"VA Linux, Inc";
case PCI_CHIP_I855_GM:
case PCI_CHIP_I865_G:
default:
return (GLubyte *)"Tungsten Graphics, Inc";
}
break;
case GL_RENDERER:
switch (I830_CONTEXT(ctx)->i830Screen->deviceID) {
case PCI_CHIP_845_G:
chipset = "Intel(R) 845G"; break;
case PCI_CHIP_I830_M:
chipset = "Intel(R) 830M"; break;
case PCI_CHIP_I855_GM:
chipset = "Intel(R) 852GM/855GM"; break;
case PCI_CHIP_I865_G:
chipset = "Intel(R) 865G"; break;
default:
chipset = "Unknown Intel Chipset"; break;
}
(void) driGetRendererString( buffer, chipset, DRIVER_DATE, 0 );
return (GLubyte *) buffer;
default:
return NULL;
}
}
static void i830BufferSize(GLframebuffer *buffer,
GLuint *width, GLuint *height)
{
GET_CURRENT_CONTEXT(ctx);
i830ContextPtr imesa = I830_CONTEXT(ctx);
/* Need to lock to make sure the driDrawable is uptodate. This
* information is used to resize Mesa's software buffers, so it has
* to be correct.
*/
LOCK_HARDWARE(imesa);
*width = imesa->driDrawable->w;
*height = imesa->driDrawable->h;
UNLOCK_HARDWARE(imesa);
}
/* Extension strings exported by the i830 driver.
*/
const struct dri_extension card_extensions[] =
{
{ "GL_ARB_multisample", GL_ARB_multisample_functions },
{ "GL_ARB_multitexture", NULL },
{ "GL_ARB_texture_border_clamp", NULL },
{ "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
{ "GL_ARB_texture_env_add", NULL },
{ "GL_ARB_texture_env_combine", NULL },
{ "GL_ARB_texture_env_crossbar", NULL },
{ "GL_ARB_texture_env_dot3", NULL },
{ "GL_ARB_texture_mirrored_repeat", NULL },
{ "GL_EXT_blend_color", GL_EXT_blend_color_functions },
{ "GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions },
{ "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions },
{ "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions },
{ "GL_EXT_blend_subtract", NULL },
{ "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
{ "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
{ "GL_EXT_stencil_wrap", NULL },
{ "GL_EXT_texture_edge_clamp", NULL },
{ "GL_EXT_texture_env_combine", NULL },
{ "GL_EXT_texture_env_dot3", NULL },
{ "GL_EXT_texture_filter_anisotropic", NULL },
{ "GL_EXT_texture_lod_bias", NULL },
{ "GL_EXT_texture_rectangle", NULL },
{ "GL_MESA_ycbcr_texture", NULL },
{ "GL_NV_blend_square", NULL },
{ "GL_SGIS_generate_mipmap", NULL },
{ NULL, NULL }
};
extern const struct tnl_pipeline_stage _i830_render_stage;
static const struct tnl_pipeline_stage *i830_pipeline[] = {
&_tnl_vertex_transform_stage,
&_tnl_normal_transform_stage,
&_tnl_lighting_stage,
&_tnl_fog_coordinate_stage,
&_tnl_texgen_stage,
&_tnl_texture_transform_stage,
/* REMOVE: point attenuation stage */
#if 1
&_i830_render_stage, /* ADD: unclipped rastersetup-to-dma */
#endif
&_tnl_render_stage,
0,
};
static const struct dri_debug_control debug_control[] =
{
{ "fall", DEBUG_FALLBACKS },
{ "tex", DEBUG_TEXTURE },
{ "ioctl", DEBUG_IOCTL },
{ "prim", DEBUG_PRIMS },
{ "vert", DEBUG_VERTS },
{ "state", DEBUG_STATE },
{ "verb", DEBUG_VERBOSE },
{ "dri", DEBUG_DRI },
{ "dma", DEBUG_DMA },
{ "san", DEBUG_SANITY },
{ "sync", DEBUG_SYNC },
{ "sleep", DEBUG_SLEEP },
{ NULL, 0 }
};
GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate)
{
GLcontext *ctx , *shareCtx;
i830ContextPtr imesa;
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
i830ScreenPrivate *screen = (i830ScreenPrivate *)sPriv->private;
I830SAREAPtr saPriv=(I830SAREAPtr)
(((GLubyte *)sPriv->pSAREA)+screen->sarea_priv_offset);
struct dd_function_table functions;
/* Allocate i830 context */
imesa = (i830ContextPtr) CALLOC_STRUCT(i830_context_t);
if (!imesa)
return GL_FALSE;
/* Init default driver functions then plug in our I830-specific functions
* (the texture functions are especially important)
*/
_mesa_init_driver_functions(&functions);
i830InitIoctlFuncs(&functions);
i830InitTextureFuncs(&functions);
/* Allocate the Mesa context */
if (sharedContextPrivate)
shareCtx = ((i830ContextPtr) sharedContextPrivate)->glCtx;
else
shareCtx = NULL;
imesa->glCtx = _mesa_create_context(mesaVis, shareCtx,
&functions, (void*) imesa);
if (!imesa->glCtx) {
FREE(imesa);
return GL_FALSE;
}
driContextPriv->driverPrivate = imesa;
imesa->i830Screen = screen;
imesa->driScreen = sPriv;
imesa->sarea = saPriv;
imesa->glBuffer = NULL;
driParseConfigFiles (&imesa->optionCache, &screen->optionCache,
screen->driScrnPriv->myNum, "i830");
(void) memset( imesa->texture_heaps, 0, sizeof( imesa->texture_heaps ) );
make_empty_list( & imesa->swapped );
imesa->nr_heaps = 1;
imesa->texture_heaps[0] = driCreateTextureHeap( 0, imesa,
screen->textureSize,
12,
I830_NR_TEX_REGIONS,
imesa->sarea->texList,
(unsigned *) & imesa->sarea->texAge, /* XXX shouldn't need cast! */
& imesa->swapped,
sizeof( struct i830_texture_object_t ),
(destroy_texture_object_t *) i830DestroyTexObj );
/* Set the maximum texture size small enough that we can guarantee
* that every texture unit can bind a maximal texture and have them
* in memory at once.
*/
ctx = imesa->glCtx;
ctx->Const.MaxTextureUnits = driQueryOptioni(&imesa->optionCache,
"texture_units");
ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
/* FIXME: driCalculateMaxTextureLevels assumes that mipmaps are tightly
* FIXME: packed, but they're not in Intel graphics hardware.
*/
driCalculateMaxTextureLevels( imesa->texture_heaps,
imesa->nr_heaps,
& ctx->Const,
4,
11, /* max 2D texture size is 2048x2048 */
0, /* 3D textures unsupported */
0, /* cube textures unsupported. */
0, /* texture rectangles unsupported. */
12,
GL_FALSE );
ctx->Const.MaxTextureMaxAnisotropy = 2.0;
ctx->Const.MinLineWidth = 1.0;
ctx->Const.MinLineWidthAA = 1.0;
ctx->Const.MaxLineWidth = 3.0;
ctx->Const.MaxLineWidthAA = 3.0;
ctx->Const.LineWidthGranularity = 1.0;
ctx->Const.MinPointSize = 1.0;
ctx->Const.MinPointSizeAA = 1.0;
ctx->Const.MaxPointSize = 255.0;
ctx->Const.MaxPointSizeAA = 3.0;
ctx->Const.PointSizeGranularity = 1.0;
ctx->Driver.GetBufferSize = i830BufferSize;
ctx->Driver.ResizeBuffers = _mesa_resize_framebuffer;
ctx->Driver.GetString = i830DDGetString;
/* Who owns who? */
ctx->DriverCtx = (void *) imesa;
imesa->glCtx = ctx;
/* Initialize the software rasterizer and helper modules. */
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
/* Install the customized pipeline: */
_tnl_destroy_pipeline( ctx );
_tnl_install_pipeline( ctx, i830_pipeline );
/* Configure swrast and T&L to match hardware characteristics: */
_swrast_allow_pixel_fog( ctx, GL_FALSE );
_swrast_allow_vertex_fog( ctx, GL_TRUE );
_tnl_allow_pixel_fog( ctx, GL_FALSE );
_tnl_allow_vertex_fog( ctx, GL_TRUE );
/* Dri stuff */
imesa->hHWContext = driContextPriv->hHWContext;
imesa->driFd = sPriv->fd;
/* drmLock ptr = &drm_hw_lock_t */
imesa->driHwLock = (drmLock *) &sPriv->pSAREA->lock;
imesa->hw_stencil = mesaVis->stencilBits && mesaVis->depthBits == 24;
switch(mesaVis->depthBits) {
case 16:
imesa->depth_scale = 1.0/0xffff;
imesa->depth_clear_mask = ~0;
imesa->ClearDepth = 0xffff;
break;
case 24:
imesa->depth_scale = 1.0/0xffffff;
imesa->depth_clear_mask = 0x00ffffff;
imesa->stencil_clear_mask = 0xff000000;
imesa->ClearDepth = 0x00ffffff;
break;
case 32: /* Not supported */
default:
break;
}
/* Completely disable stenciling for now, there are some serious issues
* with stencil.
*/
#if 0
imesa->hw_stencil = 0;
#endif
imesa->RenderIndex = ~0;
imesa->dirty = ~0;
imesa->upload_cliprects = GL_TRUE;
imesa->CurrentTexObj[0] = 0;
imesa->CurrentTexObj[1] = 0;
imesa->do_irqs = (imesa->i830Screen->irq_active &&
!getenv("I830_NO_IRQS"));
_math_matrix_ctr (&imesa->ViewportMatrix);
driInitExtensions( ctx, card_extensions, GL_TRUE );
if (imesa->glCtx->Mesa_DXTn) {
_mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
_mesa_enable_extension( ctx, "GL_S3_s3tc" );
}
else if (driQueryOptionb (&imesa->optionCache, "force_s3tc_enable")) {
_mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
}
_mesa_enable_extension( ctx, "GL_3DFX_texture_compression_FXT1" );
/* XXX these should really go right after _mesa_init_driver_functions() */
i830DDInitStateFuncs( ctx );
i830InitTriFuncs (ctx);
i830DDInitSpanFuncs( ctx );
i830DDInitState (ctx);
#if DO_DEBUG
I830_DEBUG = driParseDebugString( getenv( "I830_DEBUG" ),
debug_control );
I830_DEBUG |= driParseDebugString( getenv( "INTEL_DEBUG" ),
debug_control );
#endif
if (getenv("I830_NO_RAST") ||
getenv("INTEL_NO_RAST")) {
fprintf(stderr, "disabling 3D rasterization\n");
FALLBACK(imesa, I830_FALLBACK_USER, 1);
}
return GL_TRUE;
}
void i830DestroyContext(__DRIcontextPrivate *driContextPriv)
{
i830ContextPtr imesa = (i830ContextPtr) driContextPriv->driverPrivate;
assert(imesa); /* should never be null */
if (imesa) {
GLboolean release_texture_heaps;
release_texture_heaps = (imesa->glCtx->Shared->RefCount == 1);
_swsetup_DestroyContext (imesa->glCtx);
_tnl_DestroyContext (imesa->glCtx);
_ac_DestroyContext (imesa->glCtx);
_swrast_DestroyContext (imesa->glCtx);
/* free the Mesa context */
imesa->glCtx->DriverCtx = NULL;
_mesa_destroy_context(imesa->glCtx);
if ( release_texture_heaps ) {
/* This share group is about to go away, free our private
* texture object data.
*/
int i;
for ( i = 0 ; i < imesa->nr_heaps ; i++ ) {
driDestroyTextureHeap( imesa->texture_heaps[ i ] );
imesa->texture_heaps[ i ] = NULL;
}
assert( is_empty_list( & imesa->swapped ) );
}
FREE(imesa);
}
}
void i830XMesaSetFrontClipRects( i830ContextPtr imesa )
{
__DRIdrawablePrivate *dPriv = imesa->driDrawable;
imesa->numClipRects = dPriv->numClipRects;
imesa->pClipRects = dPriv->pClipRects;
imesa->drawX = dPriv->x;
imesa->drawY = dPriv->y;
i830EmitDrawingRectangle( imesa );
imesa->upload_cliprects = GL_TRUE;
}
void i830XMesaSetBackClipRects( i830ContextPtr imesa )
{
__DRIdrawablePrivate *dPriv = imesa->driDrawable;
if (imesa->sarea->pf_enabled == 0 && dPriv->numBackClipRects == 0) {
imesa->numClipRects = dPriv->numClipRects;
imesa->pClipRects = dPriv->pClipRects;
imesa->drawX = dPriv->x;
imesa->drawY = dPriv->y;
} else {
imesa->numClipRects = dPriv->numBackClipRects;
imesa->pClipRects = dPriv->pBackClipRects;
imesa->drawX = dPriv->backX;
imesa->drawY = dPriv->backY;
}
i830EmitDrawingRectangle( imesa );
imesa->upload_cliprects = GL_TRUE;
}
static void i830XMesaWindowMoved( i830ContextPtr imesa )
{
switch (imesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]) {
case BUFFER_BIT_FRONT_LEFT:
i830XMesaSetFrontClipRects( imesa );
break;
case BUFFER_BIT_BACK_LEFT:
i830XMesaSetBackClipRects( imesa );
break;
default:
/* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
i830XMesaSetFrontClipRects( imesa );
}
}
GLboolean i830UnbindContext(__DRIcontextPrivate *driContextPriv)
{
i830ContextPtr imesa = (i830ContextPtr) driContextPriv->driverPrivate;
unsigned i;
if (imesa) {
/* Might want to change this so texblend isn't always updated */
imesa->dirty |= (I830_UPLOAD_CTX |
I830_UPLOAD_BUFFERS |
I830_UPLOAD_STIPPLE |
I830_UPLOAD_TEXBLEND0 |
I830_UPLOAD_TEXBLEND1 |
I830_UPLOAD_TEXBLEND2 |
I830_UPLOAD_TEXBLEND3);
for ( i = 0 ; i < imesa->glCtx->Const.MaxTextureUnits ; i++ ) {
if (imesa->CurrentTexObj[i]) imesa->dirty |= I830_UPLOAD_TEX_N( i );
}
}
return GL_TRUE;
}
GLboolean i830MakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv)
{
if (driContextPriv) {
i830ContextPtr imesa = (i830ContextPtr) driContextPriv->driverPrivate;
if ( imesa->driDrawable != driDrawPriv ) {
imesa->driDrawable = driDrawPriv;
i830XMesaWindowMoved( imesa );
imesa->mesa_drawable = driDrawPriv;
}
imesa->driReadable = driReadPriv;
_mesa_make_current(imesa->glCtx,
(GLframebuffer *) driDrawPriv->driverPrivate,
(GLframebuffer *) driReadPriv->driverPrivate);
} else {
_mesa_make_current(NULL, NULL, NULL);
}
return GL_TRUE;
}
void i830GetLock( i830ContextPtr imesa, GLuint flags )
{
__DRIdrawablePrivate *dPriv = imesa->driDrawable;
__DRIscreenPrivate *sPriv = imesa->driScreen;
I830SAREAPtr sarea = imesa->sarea;
int me = imesa->hHWContext;
unsigned i;
drmGetLock(imesa->driFd, imesa->hHWContext, flags);
/* If the window moved, may need to set a new cliprect now.
*
* NOTE: This releases and regains the hw lock, so all state
* checking must be done *after* this call:
*/
DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv);
/* If we lost context, need to dump all registers to hardware.
* Note that we don't care about 2d contexts, even if they perform
* accelerated commands, so the DRI locking in the X server is even
* more broken than usual.
*/
if (sarea->ctxOwner != me) {
driUpdateFramebufferSize(imesa->glCtx, dPriv);
imesa->upload_cliprects = GL_TRUE;
imesa->dirty |= (I830_UPLOAD_CTX |
I830_UPLOAD_BUFFERS |
I830_UPLOAD_STIPPLE);
for ( i = 0 ; i < imesa->glCtx->Const.MaxTextureUnits ; i++ ) {
if(imesa->CurrentTexObj[i]) imesa->dirty |= I830_UPLOAD_TEX_N( i );
if(imesa->TexBlendWordsUsed[i]) imesa->dirty |= I830_UPLOAD_TEXBLEND_N( i );
}
sarea->perf_boxes = imesa->perf_boxes | I830_BOX_LOST_CONTEXT;
sarea->ctxOwner = me;
}
/* Shared texture managment - if another client has played with
* texture space, figure out which if any of our textures have been
* ejected, and update our global LRU.
*/
for ( i = 0 ; i < imesa->nr_heaps ; i++ ) {
DRI_AGE_TEXTURES( imesa->texture_heaps[ i ] );
}
if (imesa->lastStamp != dPriv->lastStamp) {
i830XMesaWindowMoved( imesa );
imesa->lastStamp = dPriv->lastStamp;
}
sarea->last_quiescent = -1; /* just kill it for now */
}
void i830SwapBuffers( __DRIdrawablePrivate *dPriv )
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
i830ContextPtr imesa;
GLcontext *ctx;
imesa = (i830ContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = imesa->glCtx;
if (ctx->Visual.doubleBufferMode) {
_mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
if ( 0 /*imesa->doPageFlip*/ ) { /* doPageFlip is never set !!! */
i830PageFlip( dPriv );
} else {
i830CopyBuffer( dPriv );
}
}
} else {
/* XXX this shouldn't be an error but we can't handle it for now */
_mesa_problem(NULL, "%s: drawable has no context!\n", __FUNCTION__);
}
}

View File

@@ -1,327 +0,0 @@
/*
* GLX Hardware Device Driver for Intel i830
* Copyright (C) 1999 Keith Whitwell
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/* Adapted for use in the I830M driver:
* Jeff Hartmann <jhartmann@2d3d.com>
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_context.h,v 1.7 2003/02/06 04:18:01 dawes Exp $ */
#ifndef I830CONTEXT_INC
#define I830CONTEXT_INC
typedef struct i830_context_t i830Context;
typedef struct i830_context_t *i830ContextPtr;
typedef struct i830_texture_object_t *i830TextureObjectPtr;
#include "mtypes.h"
#include "drm.h"
#include "mm.h"
#include "tnl/t_vertex.h"
#include "i830_screen.h"
#include "i830_tex.h"
#define TAG(x) i830##x
#include "tnl_dd/t_dd_vertex.h"
#undef TAG
#define DV_PF_555 (1<<8)
#define DV_PF_565 (2<<8)
#define DV_PF_8888 (3<<8)
#define I830_TEX_MAXLEVELS 10
#define I830_CONTEXT(ctx) ((i830ContextPtr)(ctx->DriverCtx))
#define GET_DISPATCH_AGE(imesa) imesa->sarea->last_dispatch
#define GET_ENQUEUE_AGE(imesa) imesa->sarea->last_enqueue
typedef void (*i830_tri_func)(i830ContextPtr, i830Vertex *, i830Vertex *,
i830Vertex *);
typedef void (*i830_line_func)(i830ContextPtr, i830Vertex *, i830Vertex *);
typedef void (*i830_point_func)(i830ContextPtr, i830Vertex *);
#define I830_MAX_TEXTURE_UNITS 4
#define I830_FALLBACK_TEXTURE 0x1
#define I830_FALLBACK_DRAW_BUFFER 0x2
#define I830_FALLBACK_READ_BUFFER 0x4
#define I830_FALLBACK_COLORMASK 0x8
#define I830_FALLBACK_RENDERMODE 0x10
#define I830_FALLBACK_STENCIL 0x20
#define I830_FALLBACK_STIPPLE 0x40
#define I830_FALLBACK_USER 0x80
struct i830_context_t
{
GLint refcount;
GLcontext *glCtx;
/*From I830 stuff*/
int TextureMode;
GLuint renderindex;
GLuint TexBlendWordsUsed[I830_MAX_TEXTURE_UNITS];
GLuint TexBlend[I830_MAX_TEXTURE_UNITS][I830_TEXBLEND_SIZE];
GLuint Init_TexBlend[I830_MAX_TEXTURE_UNITS][I830_TEXBLEND_SIZE];
GLuint Init_TexBlendWordsUsed[I830_MAX_TEXTURE_UNITS];
GLuint Init_BufferSetup[I830_DEST_SETUP_SIZE];
GLuint LodBias[I830_MAX_TEXTURE_UNITS];
GLenum palette_format;
GLuint palette[256];
GLuint Init_Setup[I830_CTX_SETUP_SIZE];
GLuint vertex_prim;
drmBufPtr vertex_dma_buffer;
GLboolean mask_red;
GLboolean mask_green;
GLboolean mask_blue;
GLboolean mask_alpha;
GLubyte clear_red;
GLubyte clear_green;
GLubyte clear_blue;
GLubyte clear_alpha;
GLfloat depth_scale;
int depth_clear_mask;
int stencil_clear_mask;
int ClearDepth;
int hw_stencil;
GLuint MonoColor;
GLuint LastTexEnabled;
GLuint TexEnabledMask;
/* Texture object bookkeeping
*/
unsigned nr_heaps;
driTexHeap * texture_heaps[1];
driTextureObject swapped;
struct i830_texture_object_t *CurrentTexObj[I830_MAX_TEXTURE_UNITS];
/* Rasterization and vertex state:
*/
GLuint Fallback;
GLuint NewGLState;
/* Vertex state
*/
GLuint vertex_size;
struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
GLuint vertex_attr_count;
char *verts; /* points to tnl->clipspace.vertex_buf */
/* State for i830tris.c.
*/
GLuint RenderIndex;
GLmatrix ViewportMatrix;
GLenum render_primitive;
GLenum reduced_primitive;
GLuint hw_primitive;
drmBufPtr vertex_buffer;
char *vertex_addr;
GLuint vertex_low;
GLuint vertex_high;
GLuint vertex_last_prim;
GLboolean upload_cliprects;
/* Fallback rasterization functions
*/
i830_point_func draw_point;
i830_line_func draw_line;
i830_tri_func draw_tri;
/* Hardware state
*/
GLuint dirty; /* I810_UPLOAD_* */
GLuint Setup[I830_CTX_SETUP_SIZE];
GLuint BufferSetup[I830_DEST_SETUP_SIZE];
GLuint StippleSetup[I830_STP_SETUP_SIZE];
unsigned int lastStamp;
GLboolean hw_stipple;
GLenum TexEnvImageFmt[2];
/* State which can't be computed completely on the fly:
*/
GLuint LcsCullMode;
GLuint LcsLineWidth;
GLuint LcsPointSize;
/* Funny mesa mirrors
*/
GLuint ClearColor;
/* DRI stuff
*/
GLuint needClip;
GLframebuffer *glBuffer;
/* These refer to the current draw (front vs. back) buffer:
*/
char *drawMap; /* draw buffer address in virtual mem */
char *readMap;
int drawX; /* origin of drawable in draw buffer */
int drawY;
GLuint numClipRects; /* cliprects for that buffer */
drm_clip_rect_t *pClipRects;
int lastSwap;
int texAge;
int ctxAge;
int dirtyAge;
int perf_boxes;
int do_irqs;
GLboolean scissor;
drm_clip_rect_t draw_rect;
drm_clip_rect_t scissor_rect;
drm_context_t hHWContext;
drmLock *driHwLock;
int driFd;
__DRIdrawablePrivate *driDrawable; /**< DRI drawable bound to this
* context for drawing.
*/
__DRIdrawablePrivate *driReadable; /**< DRI drawable bound to this
* context for reading.
*/
/**
* Drawable used by Mesa for software fallbacks for reading and
* writing. It is set by Mesa's \c SetBuffer callback, and will always be
* either \c i830_context_t::driDrawable or \c i830_context_t::driReadable.
*/
__DRIdrawablePrivate * mesa_drawable;
__DRIscreenPrivate *driScreen;
i830ScreenPrivate *i830Screen;
I830SAREAPtr sarea;
/**
* Configuration cache
*/
driOptionCache optionCache;
};
#define I830_TEX_UNIT_ENABLED(unit) (1<<unit)
#define VALID_I830_TEXTURE_OBJECT(tobj) (tobj)
#define I830_CONTEXT(ctx) ((i830ContextPtr)(ctx->DriverCtx))
#define I830_DRIVER_DATA(vb) ((i830VertexBufferPtr)((vb)->driver_data))
#define GET_DISPATCH_AGE(imesa) imesa->sarea->last_dispatch
#define GET_ENQUEUE_AGE(imesa) imesa->sarea->last_enqueue
/* Lock the hardware and validate our state.
*/
#define LOCK_HARDWARE( imesa ) \
do { \
char __ret=0; \
DRM_CAS(imesa->driHwLock, imesa->hHWContext, \
(DRM_LOCK_HELD|imesa->hHWContext), __ret); \
if (__ret) \
i830GetLock( imesa, 0 ); \
}while (0)
/* Unlock the hardware using the global current context
*/
#define UNLOCK_HARDWARE(imesa) \
do { \
imesa->perf_boxes |= imesa->sarea->perf_boxes; \
DRM_UNLOCK(imesa->driFd, imesa->driHwLock, imesa->hHWContext); \
} while (0)
/* This is the wrong way to do it, I'm sure. Otherwise the drm
* bitches that I've already got the heavyweight lock. At worst,
* this is 3 ioctls. The best solution probably only gets me down
* to 2 ioctls in the worst case.
*/
#define LOCK_HARDWARE_QUIESCENT( imesa ) do { \
LOCK_HARDWARE( imesa ); \
i830RegetLockQuiescent( imesa ); \
} while(0)
extern void i830GetLock(i830ContextPtr imesa, GLuint flags);
extern void i830EmitHwStateLocked(i830ContextPtr imesa);
extern void i830EmitDrawingRectangle(i830ContextPtr imesa);
extern void i830XMesaSetBackClipRects(i830ContextPtr imesa);
extern void i830XMesaSetFrontClipRects(i830ContextPtr imesa);
extern void i830DDExtensionsInit(GLcontext *ctx);
extern void i830DDInitDriverFuncs(GLcontext *ctx);
extern void i830DDUpdateHwState(GLcontext *ctx);
#define SUBPIXEL_X 0.125
#define SUBPIXEL_Y 0.125
/* ================================================================
* Debugging:
*/
#define DO_DEBUG 1
#if DO_DEBUG
extern int I830_DEBUG;
#else
#define I830_DEBUG 0
#endif
#define DEBUG_TEXTURE 0x1
#define DEBUG_STATE 0x2
#define DEBUG_IOCTL 0x4
#define DEBUG_PRIMS 0x8
#define DEBUG_VERTS 0x10
#define DEBUG_FALLBACKS 0x20
#define DEBUG_VERBOSE 0x40
#define DEBUG_DRI 0x80
#define DEBUG_DMA 0x100
#define DEBUG_SANITY 0x200
#define DEBUG_SYNC 0x400
#define DEBUG_SLEEP 0x800
#define PCI_CHIP_845_G 0x2562
#define PCI_CHIP_I830_M 0x3577
#define PCI_CHIP_I855_GM 0x3582
#define PCI_CHIP_I865_G 0x2572
#endif

View File

@@ -1,415 +0,0 @@
/**************************************************************************
Copyright 2001 2d3d Inc., Delray Beach, FL
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
on the rights to use, copy, modify, merge, publish, distribute, sub
license, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_debug.c,v 1.3 2002/12/10 01:26:53 dawes Exp $ */
/*
* Author:
* Jeff Hartmann <jhartmann@2d3d.com>
*/
#include "glheader.h"
#include "context.h"
#include "macros.h"
#include "enums.h"
#include "dd.h"
#include "mm.h"
#include "i830_screen.h"
#include "i830_dri.h"
#include "i830_context.h"
#include "i830_state.h"
#include "i830_tex.h"
#include "i830_tris.h"
#include "i830_ioctl.h"
#include "i830_debug.h"
#include "swrast/swrast.h"
#include "array_cache/acache.h"
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/t_pipeline.h"
#define TINY_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
VRTX_TEX_COORD_COUNT(0) | \
VRTX_HAS_DIFFUSE | \
VRTX_HAS_XYZ)
#define NOTEX_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
VRTX_TEX_COORD_COUNT(0) | \
VRTX_HAS_DIFFUSE | \
VRTX_HAS_SPEC | \
VRTX_HAS_XYZW)
#define TEX0_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
VRTX_TEX_COORD_COUNT(1) | \
VRTX_HAS_DIFFUSE | \
VRTX_HAS_SPEC | \
VRTX_HAS_XYZW)
#define TEX1_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
VRTX_TEX_COORD_COUNT(2) | \
VRTX_HAS_DIFFUSE | \
VRTX_HAS_SPEC | \
VRTX_HAS_XYZW)
#define PROJ_VF2 (STATE3D_VERTEX_FORMAT_2_CMD | \
VRTX_TEX_SET_0_FMT(TEXCOORDFMT_3D) | \
VRTX_TEX_SET_1_FMT(TEXCOORDFMT_3D) | \
VRTX_TEX_SET_2_FMT(TEXCOORDFMT_3D) | \
VRTX_TEX_SET_3_FMT(TEXCOORDFMT_3D))
#define NON_PROJ_VF2 (STATE3D_VERTEX_FORMAT_2_CMD | \
VRTX_TEX_SET_0_FMT(TEXCOORDFMT_2D) | \
VRTX_TEX_SET_1_FMT(TEXCOORDFMT_2D) | \
VRTX_TEX_SET_2_FMT(TEXCOORDFMT_2D) | \
VRTX_TEX_SET_3_FMT(TEXCOORDFMT_2D))
void i830DumpContextState( i830ContextPtr imesa )
{
GLuint *Context = imesa->Setup;
fprintf(stderr, "%s\n", __FUNCTION__);
fprintf(stderr, "STATE1 : 0x%08x\n", Context[I830_CTXREG_STATE1]);
fprintf(stderr, "STATE2 : 0x%08x\n", Context[I830_CTXREG_STATE2]);
fprintf(stderr, "STATE3 : 0x%08x\n", Context[I830_CTXREG_STATE3]);
fprintf(stderr, "STATE4 : 0x%08x\n", Context[I830_CTXREG_STATE4]);
fprintf(stderr, "STATE5 : 0x%08x\n", Context[I830_CTXREG_STATE5]);
fprintf(stderr, "IALPHAB : 0x%08x\n", Context[I830_CTXREG_IALPHAB]);
fprintf(stderr, "STENCILTST : 0x%08x\n", Context[I830_CTXREG_STENCILTST]);
fprintf(stderr, "ENABLES_1 : 0x%08x\n", Context[I830_CTXREG_ENABLES_1]);
fprintf(stderr, "ENABLES_2 : 0x%08x\n", Context[I830_CTXREG_ENABLES_2]);
fprintf(stderr, "AA : 0x%08x\n", Context[I830_CTXREG_AA]);
fprintf(stderr, "FOGCOLOR : 0x%08x\n", Context[I830_CTXREG_FOGCOLOR]);
fprintf(stderr, "BCOLOR0 : 0x%08x\n", Context[I830_CTXREG_BLENDCOLR0]);
fprintf(stderr, "BCOLOR : 0x%08x\n", Context[I830_CTXREG_BLENDCOLR]);
fprintf(stderr, "VF : 0x%08x\n", Context[I830_CTXREG_VF]);
fprintf(stderr, "VF2 : 0x%08x\n", Context[I830_CTXREG_VF2]);
fprintf(stderr, "MCSB0 : 0x%08x\n", Context[I830_CTXREG_MCSB0]);
fprintf(stderr, "MCSB1 : 0x%08x\n", Context[I830_CTXREG_MCSB1]);
}
void i830DumpBufferState( i830ContextPtr imesa )
{
GLuint *Buffer = imesa->BufferSetup;
fprintf(stderr, "%s\n", __FUNCTION__);
fprintf(stderr, "CBUFADDR : 0x%08x\n", Buffer[I830_DESTREG_CBUFADDR]);
fprintf(stderr, "DBUFADDR : 0x%08x\n", Buffer[I830_DESTREG_DBUFADDR]);
fprintf(stderr, "DV0 : 0x%08x\n", Buffer[I830_DESTREG_DV0]);
fprintf(stderr, "DV1 : 0x%08x\n", Buffer[I830_DESTREG_DV1]);
fprintf(stderr, "SENABLE : 0x%08x\n", Buffer[I830_DESTREG_SENABLE]);
fprintf(stderr, "SR0 : 0x%08x\n", Buffer[I830_DESTREG_SR0]);
fprintf(stderr, "SR1 : 0x%08x\n", Buffer[I830_DESTREG_SR1]);
fprintf(stderr, "SR2 : 0x%08x\n", Buffer[I830_DESTREG_SR2]);
fprintf(stderr, "DR0 : 0x%08x\n", Buffer[I830_DESTREG_DR0]);
fprintf(stderr, "DR1 : 0x%08x\n", Buffer[I830_DESTREG_DR1]);
fprintf(stderr, "DR2 : 0x%08x\n", Buffer[I830_DESTREG_DR2]);
fprintf(stderr, "DR3 : 0x%08x\n", Buffer[I830_DESTREG_DR3]);
fprintf(stderr, "DR4 : 0x%08x\n", Buffer[I830_DESTREG_DR4]);
}
void i830DumpStippleState( i830ContextPtr imesa )
{
GLuint *Buffer = imesa->BufferSetup;
fprintf(stderr, "%s\n", __FUNCTION__);
fprintf(stderr, "ST1 : 0x%08x\n", Buffer[I830_STPREG_ST1]);
}
void i830DumpTextureState( i830ContextPtr imesa, int unit )
{
i830TextureObjectPtr t = imesa->CurrentTexObj[unit];
if(t) {
fprintf(stderr, "%s : unit %d\n", __FUNCTION__, unit);
fprintf(stderr, "TM0LI : 0x%08x\n", t->Setup[I830_TEXREG_TM0LI]);
fprintf(stderr, "TM0S0 : 0x%08x\n", t->Setup[I830_TEXREG_TM0S0]);
fprintf(stderr, "TM0S1 : 0x%08x\n", t->Setup[I830_TEXREG_TM0S1]);
fprintf(stderr, "TM0S2 : 0x%08x\n", t->Setup[I830_TEXREG_TM0S2]);
fprintf(stderr, "TM0S3 : 0x%08x\n", t->Setup[I830_TEXREG_TM0S3]);
fprintf(stderr, "TM0S4 : 0x%08x\n", t->Setup[I830_TEXREG_TM0S4]);
fprintf(stderr, "NOP0 : 0x%08x\n", t->Setup[I830_TEXREG_NOP0]);
fprintf(stderr, "NOP1 : 0x%08x\n", t->Setup[I830_TEXREG_NOP1]);
fprintf(stderr, "NOP2 : 0x%08x\n", t->Setup[I830_TEXREG_NOP2]);
fprintf(stderr, "MCS : 0x%08x\n", t->Setup[I830_TEXREG_MCS]);
}
}
void i830DumpTextureBlendState( i830ContextPtr imesa, int unit )
{
GLuint *TexBlend = imesa->TexBlend[unit];
GLuint length = imesa->TexBlendWordsUsed[unit];
int i;
fprintf(stderr, "%s : unit %d : length %d\n", __FUNCTION__, unit, length);
for(i = 0; i < length; i++) {
fprintf(stderr, "[%d] : 0x%08x\n", i, TexBlend[i]);
}
}
void i830VertexSanity( i830ContextPtr imesa, drmI830Vertex vertex )
{
I830SAREAPtr sarea = imesa->sarea;
char *prim_name;
int size = 0;
int vfmt_size = 0;
int hw_nr_vertex = 0;
int hw_start_vertex = 0;
/* Do a bunch of sanity checks on the vertices sent to the hardware */
size = vertex.used - 4;
if(imesa->vertex_size && (size % imesa->vertex_size) != 0) {
fprintf(stderr, "\n\nVertex size does not match imesa "
"internal state\n");
fprintf(stderr, "Buffer size : %d\n", size);
fprintf(stderr, "Vertex size : %d\n", imesa->vertex_size);
}
/* Check to see if the vertex format is good, and get its size */
if (sarea->ContextState[I830_CTXREG_VF] == TINY_VERTEX_FORMAT) {
vfmt_size = 16; /* 4 dwords */
} else if (sarea->ContextState[I830_CTXREG_VF] ==
NOTEX_VERTEX_FORMAT) {
vfmt_size = 24; /* 6 dwords */
} else if (sarea->ContextState[I830_CTXREG_VF] ==
TEX0_VERTEX_FORMAT) {
vfmt_size = 32; /* 8 dwords */
if (sarea->ContextState[I830_CTXREG_VF2] != NON_PROJ_VF2) {
fprintf(stderr, "\n\nTex 0 vertex format, but proj "
"texturing\n");
}
} else if(sarea->ContextState[I830_CTXREG_VF] ==
TEX1_VERTEX_FORMAT) {
if (sarea->ContextState[I830_CTXREG_VF2] == NON_PROJ_VF2)
vfmt_size = 40; /* 10 dwords */
else
vfmt_size = 48; /* 12 dwords */
} else {
fprintf(stderr, "\n\nUnknown vertex format : vf : %08x "
"vf2 : %08x\n",
sarea->ContextState[I830_CTXREG_VF],
sarea->ContextState[I830_CTXREG_VF2]);
}
if(vfmt_size && (size % vfmt_size) != 0) {
fprintf(stderr, "\n\nVertex size does not match hardware "
"internal state\n");
fprintf(stderr, "Buffer size : %d\n", size);
fprintf(stderr, "Vertex size : %d\n", vfmt_size);
}
switch(sarea->vertex_prim) {
case PRIM3D_POINTLIST:
hw_start_vertex = 0;
hw_nr_vertex = 1;
prim_name = "PointList";
break;
case PRIM3D_LINELIST:
hw_start_vertex = 0;
hw_nr_vertex = 2;
prim_name = "LineList";
break;
case PRIM3D_LINESTRIP:
hw_start_vertex = 2;
hw_nr_vertex = 1;
prim_name = "LineStrip";
break;
case PRIM3D_TRILIST:
hw_start_vertex = 0;
hw_nr_vertex = 3;
prim_name = "TriList";
break;
case PRIM3D_TRISTRIP:
hw_start_vertex = 3;
hw_nr_vertex = 1;
prim_name = "TriStrip";
break;
case PRIM3D_TRIFAN:
hw_start_vertex = 3;
hw_nr_vertex = 1;
prim_name = "TriFan";
break;
case PRIM3D_POLY:
hw_start_vertex = 3;
hw_nr_vertex = 1;
prim_name = "Polygons";
break;
default:
prim_name = "Unknown";
fprintf(stderr, "\n\nUnknown primitive type : %08x\n",
sarea->vertex_prim);
}
if (hw_nr_vertex && vfmt_size) {
int temp_size = size - (hw_start_vertex * vfmt_size);
int remaining = (temp_size % (hw_nr_vertex * vfmt_size));
if (remaining != 0) {
fprintf(stderr, "\n\nThis buffer contains an improper"
" multiple of vertices for this primitive : %s\n",
prim_name);
fprintf(stderr, "Number of vertices in buffer : %d\n",
size / vfmt_size);
fprintf(stderr, "temp_size : %d\n", temp_size);
fprintf(stderr, "remaining vertices : %d",
remaining / vfmt_size);
}
}
if (vfmt_size) {
fprintf(stderr, "\n\nPrim name (%s), vertices (%d)\n",
prim_name,
size / vfmt_size);
}
}
void i830EmitHwStateLockedDebug( i830ContextPtr imesa )
{
int i;
if ((imesa->dirty & I830_UPLOAD_TEX0_IMAGE) && imesa->CurrentTexObj[0]) {
i830UploadTexImagesLocked(imesa, imesa->CurrentTexObj[0]);
}
if ((imesa->dirty & I830_UPLOAD_TEX1_IMAGE) && imesa->CurrentTexObj[1]) {
i830UploadTexImagesLocked(imesa, imesa->CurrentTexObj[1]);
}
if (imesa->dirty & I830_UPLOAD_CTX) {
memcpy( imesa->sarea->ContextState,
imesa->Setup, sizeof(imesa->Setup) );
i830DumpContextState(imesa);
}
for(i = 0; i < I830_TEXTURE_COUNT; i++) {
if ((imesa->dirty & I830_UPLOAD_TEX_N(i)) && imesa->CurrentTexObj[i]) {
unsigned * TexState;
imesa->sarea->dirty |= I830_UPLOAD_TEX_N(i);
switch( i ) {
case 0:
case 1:
TexState = imesa->sarea->TexState[i];
break;
case 2:
TexState = imesa->sarea->TexState2;
break;
case 3:
TexState = imesa->sarea->TexState3;
break;
}
memcpy(TexState, imesa->CurrentTexObj[i]->Setup,
sizeof(imesa->sarea->TexState[i]));
i830DumpTextureState(imesa, i);
}
}
/* Need to figure out if texturing state, or enable changed. */
for(i = 0; i < I830_TEXBLEND_COUNT; i++) {
if (imesa->dirty & I830_UPLOAD_TEXBLEND_N(i)) {
unsigned * TexBlendState;
unsigned * words_used;
imesa->sarea->dirty |= I830_UPLOAD_TEXBLEND_N(i);
switch( i ) {
case 0:
case 1:
TexBlendState = imesa->sarea->TexBlendState[i];
words_used = & imesa->sarea->TexBlendStateWordsUsed[i];
break;
case 2:
TexBlendState = imesa->sarea->TexBlendState2;
words_used = & imesa->sarea->TexBlendStateWordsUsed2;
break;
case 3:
TexBlendState = imesa->sarea->TexBlendState3;
words_used = & imesa->sarea->TexBlendStateWordsUsed3;
break;
}
memcpy(TexBlendState, imesa->TexBlend[i],
imesa->TexBlendWordsUsed[i] * 4);
*words_used = imesa->TexBlendWordsUsed[i];
i830DumpTextureBlendState(imesa, i);
}
}
if (imesa->dirty & I830_UPLOAD_BUFFERS) {
memcpy( imesa->sarea->BufferState,imesa->BufferSetup,
sizeof(imesa->BufferSetup) );
i830DumpBufferState(imesa);
}
if (imesa->dirty & I830_UPLOAD_STIPPLE) {
fprintf(stderr, "UPLOAD_STIPPLE\n");
memcpy( imesa->sarea->StippleState,imesa->StippleSetup,
sizeof(imesa->StippleSetup) );
i830DumpStippleState(imesa);
}
if (imesa->dirty & I830_UPLOAD_TEX_PALETTE_SHARED) {
memcpy( imesa->sarea->Palette[0],imesa->palette,
sizeof(imesa->sarea->Palette[0]));
} else {
i830TextureObjectPtr p;
if (imesa->dirty & I830_UPLOAD_TEX_PALETTE_N(0)) {
p = imesa->CurrentTexObj[0];
memcpy( imesa->sarea->Palette[0],p->palette,
sizeof(imesa->sarea->Palette[0]));
}
if (imesa->dirty & I830_UPLOAD_TEX_PALETTE_N(1)) {
p = imesa->CurrentTexObj[1];
memcpy( imesa->sarea->Palette[1],
p->palette,
sizeof(imesa->sarea->Palette[1]));
}
}
imesa->sarea->dirty |= (imesa->dirty & ~(I830_UPLOAD_TEX_MASK |
I830_UPLOAD_TEXBLEND_MASK));
imesa->upload_cliprects = GL_TRUE;
imesa->dirty = 0;
}

View File

@@ -1,48 +0,0 @@
/**************************************************************************
Copyright 2001 2d3d Inc., Delray Beach, FL
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
on the rights to use, copy, modify, merge, publish, distribute, sub
license, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_debug.h,v 1.3 2002/12/10 01:26:53 dawes Exp $ */
/*
* Author:
* Jeff Hartmann <jhartmann@2d3d.com>
*/
/* Defines for sanity checking and debug output */
#ifndef I830DEBUG_INC
#define I830DEBUG_INC
void i830DumpContextState( i830ContextPtr imesa );
void i830DumpStippleState( i830ContextPtr imesa );
void i830DumpBufferState( i830ContextPtr imesa );
void i830DumpTextureState( i830ContextPtr imesa, int unit );
void i830DumpTextureBlendState( i830ContextPtr imesa, int unit );
void i830VertexSanity( i830ContextPtr imesa, drmI830Vertex vertex );
void i830EmitHwStateLockedDebug( i830ContextPtr imesa );
#endif

View File

@@ -1,841 +0,0 @@
/**************************************************************************
Copyright 2001 VA Linux Systems Inc., Fremont, California.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
on the rights to use, copy, modify, merge, publish, distribute, sub
license, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_ioctl.c,v 1.5 2002/12/10 01:26:53 dawes Exp $ */
/*
* Author:
* Jeff Hartmann <jhartmann@2d3d.com>
* Graeme Fisher <graeme@2d3d.co.za>
* Abraham vd Merwe <abraham@2d3d.co.za>
*
* Heavily based on the I810 driver, which was written by:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include "glheader.h"
#include "mtypes.h"
#include "macros.h"
#include "dd.h"
#include "swrast/swrast.h"
#include "mm.h"
#include "i830_screen.h"
#include "i830_dri.h"
#include "i830_context.h"
#include "i830_ioctl.h"
#include "i830_state.h"
#include "i830_debug.h"
#include "drm.h"
static drmBufPtr i830_get_buffer_ioctl( i830ContextPtr imesa )
{
drmI830DMA dma;
drmBufPtr buf;
int retcode,i = 0;
while (1) {
retcode = drmCommandWriteRead(imesa->driFd,
DRM_I830_GETBUF,
&dma,
sizeof(drmI830DMA));
if (dma.granted == 1 && retcode == 0)
break;
if (++i > 1000) {
imesa->sarea->perf_boxes |= I830_BOX_WAIT;
retcode = drmCommandNone(imesa->driFd, DRM_I830_FLUSH);
i = 0;
}
}
buf = &(imesa->i830Screen->bufs->list[dma.request_idx]);
buf->idx = dma.request_idx;
buf->used = 0;
buf->total = dma.request_size;
buf->address = (drmAddress)dma.virtual;
return buf;
}
static void i830ClearDrawQuad(i830ContextPtr imesa, float left,
float right,
float bottom, float top, GLubyte red,
GLubyte green, GLubyte blue, GLubyte alpha)
{
GLuint *vb = i830AllocDmaLowLocked( imesa, 128 );
i830Vertex tmp;
int i;
/* PRIM3D_TRIFAN */
/* initial vertex, left bottom */
tmp.v.x = left;
tmp.v.y = bottom;
tmp.v.z = 1.0;
tmp.v.w = 1.0;
tmp.v.color.red = red;
tmp.v.color.green = green;
tmp.v.color.blue = blue;
tmp.v.color.alpha = alpha;
tmp.v.specular.red = 0;
tmp.v.specular.green = 0;
tmp.v.specular.blue = 0;
tmp.v.specular.alpha = 0;
tmp.v.u0 = 0.0f;
tmp.v.v0 = 0.0f;
for (i = 0 ; i < 8 ; i++)
vb[i] = tmp.ui[i];
/* right bottom */
vb += 8;
tmp.v.x = right;
for (i = 0 ; i < 8 ; i++)
vb[i] = tmp.ui[i];
/* right top */
vb += 8;
tmp.v.y = top;
for (i = 0 ; i < 8 ; i++)
vb[i] = tmp.ui[i];
/* left top */
vb += 8;
tmp.v.x = left;
for (i = 0 ; i < 8 ; i++)
vb[i] = tmp.ui[i];
}
static void i830ClearWithTris(GLcontext *ctx, GLbitfield mask,
GLboolean all,
GLint cx, GLint cy, GLint cw, GLint ch)
{
i830ContextPtr imesa = I830_CONTEXT( ctx );
__DRIdrawablePrivate *dPriv = imesa->driDrawable;
i830ScreenPrivate *i830Screen = imesa->i830Screen;
I830SAREAPtr sarea = imesa->sarea;
GLuint old_vertex_prim;
GLuint old_dirty;
int x0, y0, x1, y1;
if (I830_DEBUG & DEBUG_IOCTL)
fprintf(stderr, "Clearing with triangles\n");
old_dirty = imesa->dirty & ~I830_UPLOAD_CLIPRECTS;
/* Discard all the dirty flags except the cliprect one, reset later */
imesa->dirty &= I830_UPLOAD_CLIPRECTS;
if(!all) {
x0 = cx;
y0 = cy;
x1 = x0 + cw;
y1 = y0 + ch;
} else {
x0 = 0;
y0 = 0;
x1 = x0 + dPriv->w;
y1 = y0 + dPriv->h;
}
/* Clip to Screen */
if (x0 < 0) x0 = 0;
if (y0 < 0) y0 = 0;
if (x1 > i830Screen->width-1) x1 = i830Screen->width-1;
if (y1 > i830Screen->height-1) y1 = i830Screen->height-1;
LOCK_HARDWARE(imesa);
memcpy(sarea->ContextState,
imesa->Init_Setup,
sizeof(imesa->Setup) );
memcpy(sarea->BufferState,
imesa->BufferSetup,
sizeof(imesa->BufferSetup) );
sarea->StippleState[I830_STPREG_ST1] = 0;
old_vertex_prim = imesa->hw_primitive;
imesa->hw_primitive = PRIM3D_TRIFAN;
if(mask & BUFFER_BIT_FRONT_LEFT) {
GLuint tmp = sarea->ContextState[I830_CTXREG_ENABLES_2];
sarea->dirty |= (I830_UPLOAD_CTX | I830_UPLOAD_BUFFERS |
I830_UPLOAD_TEXBLEND0);
sarea->TexBlendState[0][0] = (STATE3D_MAP_BLEND_OP_CMD(0) |
TEXPIPE_COLOR |
ENABLE_TEXOUTPUT_WRT_SEL |
TEXOP_OUTPUT_CURRENT |
DISABLE_TEX_CNTRL_STAGE |
TEXOP_SCALE_1X |
TEXOP_MODIFY_PARMS |
TEXOP_LAST_STAGE |
TEXBLENDOP_ARG1);
sarea->TexBlendState[0][1] = (STATE3D_MAP_BLEND_OP_CMD(0) |
TEXPIPE_ALPHA |
ENABLE_TEXOUTPUT_WRT_SEL |
TEXOP_OUTPUT_CURRENT |
TEXOP_SCALE_1X |
TEXOP_MODIFY_PARMS |
TEXBLENDOP_ARG1);
sarea->TexBlendState[0][2] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
TEXPIPE_COLOR |
TEXBLEND_ARG1 |
TEXBLENDARG_MODIFY_PARMS |
TEXBLENDARG_CURRENT);
sarea->TexBlendState[0][3] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
TEXPIPE_ALPHA |
TEXBLEND_ARG1 |
TEXBLENDARG_MODIFY_PARMS |
TEXBLENDARG_CURRENT);
sarea->TexBlendStateWordsUsed[0] = 4;
tmp &= ~(ENABLE_STENCIL_WRITE | ENABLE_DEPTH_WRITE);
tmp |= (DISABLE_STENCIL_WRITE |
DISABLE_DEPTH_WRITE |
(imesa->mask_red << WRITEMASK_RED_SHIFT) |
(imesa->mask_green << WRITEMASK_GREEN_SHIFT) |
(imesa->mask_blue << WRITEMASK_BLUE_SHIFT) |
(imesa->mask_alpha << WRITEMASK_ALPHA_SHIFT));
sarea->ContextState[I830_CTXREG_ENABLES_2] = tmp;
if(0)
fprintf(stderr, "fcdq : r_mask(%d) g_mask(%d) b_mask(%d) a_mask(%d)\n",
imesa->mask_red, imesa->mask_green, imesa->mask_blue,
imesa->mask_alpha);
sarea->BufferState[I830_DESTREG_CBUFADDR] = i830Screen->fbOffset;
if(0)
fprintf(stderr, "fcdq : x0(%d) x1(%d) y0(%d) y1(%d)\n"
"r(0x%x) g(0x%x) b(0x%x) a(0x%x)\n",
x0, x1, y0, y1, imesa->clear_red, imesa->clear_green,
imesa->clear_blue, imesa->clear_alpha);
i830ClearDrawQuad(imesa, (float)x0, (float)x1, (float)y0, (float)y1,
imesa->clear_red, imesa->clear_green,
imesa->clear_blue, imesa->clear_alpha);
i830FlushPrimsLocked( imesa );
}
if(mask & BUFFER_BIT_BACK_LEFT) {
GLuint tmp = sarea->ContextState[I830_CTXREG_ENABLES_2];
sarea->dirty |= (I830_UPLOAD_CTX | I830_UPLOAD_BUFFERS |
I830_UPLOAD_TEXBLEND0);
sarea->TexBlendState[0][0] = (STATE3D_MAP_BLEND_OP_CMD(0) |
TEXPIPE_COLOR |
ENABLE_TEXOUTPUT_WRT_SEL |
TEXOP_OUTPUT_CURRENT |
DISABLE_TEX_CNTRL_STAGE |
TEXOP_SCALE_1X |
TEXOP_MODIFY_PARMS |
TEXOP_LAST_STAGE |
TEXBLENDOP_ARG1);
sarea->TexBlendState[0][1] = (STATE3D_MAP_BLEND_OP_CMD(0) |
TEXPIPE_ALPHA |
ENABLE_TEXOUTPUT_WRT_SEL |
TEXOP_OUTPUT_CURRENT |
TEXOP_SCALE_1X |
TEXOP_MODIFY_PARMS |
TEXBLENDOP_ARG1);
sarea->TexBlendState[0][2] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
TEXPIPE_COLOR |
TEXBLEND_ARG1 |
TEXBLENDARG_MODIFY_PARMS |
TEXBLENDARG_CURRENT);
sarea->TexBlendState[0][3] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
TEXPIPE_ALPHA |
TEXBLEND_ARG2 |
TEXBLENDARG_MODIFY_PARMS |
TEXBLENDARG_CURRENT);
sarea->TexBlendStateWordsUsed[0] = 4;
tmp &= ~(ENABLE_STENCIL_WRITE | ENABLE_DEPTH_WRITE);
tmp |= (DISABLE_STENCIL_WRITE |
DISABLE_DEPTH_WRITE |
(imesa->mask_red << WRITEMASK_RED_SHIFT) |
(imesa->mask_green << WRITEMASK_GREEN_SHIFT) |
(imesa->mask_blue << WRITEMASK_BLUE_SHIFT) |
(imesa->mask_alpha << WRITEMASK_ALPHA_SHIFT));
if(0)
fprintf(stderr, "bcdq : r_mask(%d) g_mask(%d) b_mask(%d) a_mask(%d)\n",
imesa->mask_red, imesa->mask_green, imesa->mask_blue,
imesa->mask_alpha);
sarea->ContextState[I830_CTXREG_ENABLES_2] = tmp;
sarea->BufferState[I830_DESTREG_CBUFADDR] = i830Screen->backOffset;
if(0)
fprintf(stderr, "bcdq : x0(%d) x1(%d) y0(%d) y1(%d)\n"
"r(0x%x) g(0x%x) b(0x%x) a(0x%x)\n",
x0, x1, y0, y1, imesa->clear_red, imesa->clear_green,
imesa->clear_blue, imesa->clear_alpha);
i830ClearDrawQuad(imesa, (float)x0, (float)x1, (float)y0, (float)y1,
imesa->clear_red, imesa->clear_green,
imesa->clear_blue, imesa->clear_alpha);
i830FlushPrimsLocked( imesa );
}
if(mask & BUFFER_BIT_STENCIL) {
GLuint s_mask = ctx->Stencil.WriteMask[0];
sarea->dirty |= (I830_UPLOAD_CTX | I830_UPLOAD_BUFFERS |
I830_UPLOAD_TEXBLEND0);
sarea->TexBlendState[0][0] = (STATE3D_MAP_BLEND_OP_CMD(0) |
TEXPIPE_COLOR |
ENABLE_TEXOUTPUT_WRT_SEL |
TEXOP_OUTPUT_CURRENT |
DISABLE_TEX_CNTRL_STAGE |
TEXOP_SCALE_1X |
TEXOP_MODIFY_PARMS |
TEXOP_LAST_STAGE |
TEXBLENDOP_ARG1);
sarea->TexBlendState[0][1] = (STATE3D_MAP_BLEND_OP_CMD(0) |
TEXPIPE_ALPHA |
ENABLE_TEXOUTPUT_WRT_SEL |
TEXOP_OUTPUT_CURRENT |
TEXOP_SCALE_1X |
TEXOP_MODIFY_PARMS |
TEXBLENDOP_ARG1);
sarea->TexBlendState[0][2] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
TEXPIPE_COLOR |
TEXBLEND_ARG1 |
TEXBLENDARG_MODIFY_PARMS |
TEXBLENDARG_CURRENT);
sarea->TexBlendState[0][3] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
TEXPIPE_ALPHA |
TEXBLEND_ARG2 |
TEXBLENDARG_MODIFY_PARMS |
TEXBLENDARG_CURRENT);
sarea->TexBlendStateWordsUsed[0] = 4;
sarea->ContextState[I830_CTXREG_ENABLES_1] |= (ENABLE_STENCIL_TEST |
ENABLE_DEPTH_TEST);
sarea->ContextState[I830_CTXREG_ENABLES_2] &= ~(ENABLE_STENCIL_WRITE |
ENABLE_DEPTH_WRITE |
ENABLE_COLOR_WRITE);
sarea->ContextState[I830_CTXREG_ENABLES_2] |=
(ENABLE_STENCIL_WRITE |
DISABLE_DEPTH_WRITE |
(1 << WRITEMASK_RED_SHIFT) |
(1 << WRITEMASK_GREEN_SHIFT) |
(1 << WRITEMASK_BLUE_SHIFT) |
(1 << WRITEMASK_ALPHA_SHIFT) |
ENABLE_COLOR_WRITE);
sarea->ContextState[I830_CTXREG_STATE4] &=
~MODE4_ENABLE_STENCIL_WRITE_MASK;
sarea->ContextState[I830_CTXREG_STATE4] |=
(ENABLE_STENCIL_WRITE_MASK |
STENCIL_WRITE_MASK(s_mask));
sarea->ContextState[I830_CTXREG_STENCILTST] &=
~(STENCIL_OPS_MASK |
STENCIL_REF_VALUE_MASK |
ENABLE_STENCIL_TEST_FUNC_MASK);
sarea->ContextState[I830_CTXREG_STENCILTST] |=
(ENABLE_STENCIL_PARMS |
ENABLE_STENCIL_REF_VALUE |
ENABLE_STENCIL_TEST_FUNC |
STENCIL_FAIL_OP(STENCILOP_REPLACE) |
STENCIL_PASS_DEPTH_FAIL_OP(STENCILOP_REPLACE) |
STENCIL_PASS_DEPTH_PASS_OP(STENCILOP_REPLACE) |
STENCIL_REF_VALUE((ctx->Stencil.Clear & 0xff)) |
STENCIL_TEST_FUNC(COMPAREFUNC_ALWAYS));
if(0)
fprintf(stderr, "Enables_1 (0x%x) Enables_2 (0x%x) StenTst (0x%x)\n"
"Modes_4 (0x%x)\n",
sarea->ContextState[I830_CTXREG_ENABLES_1],
sarea->ContextState[I830_CTXREG_ENABLES_2],
sarea->ContextState[I830_CTXREG_STENCILTST],
sarea->ContextState[I830_CTXREG_STATE4]);
sarea->BufferState[I830_DESTREG_CBUFADDR] = i830Screen->fbOffset;
i830ClearDrawQuad(imesa, (float)x0, (float)x1, (float)y0, (float)y1,
255, 255, 255, 255);
i830FlushPrimsLocked( imesa );
}
UNLOCK_HARDWARE(imesa);
imesa->dirty = old_dirty;
imesa->dirty |= (I830_UPLOAD_CTX |
I830_UPLOAD_BUFFERS |
I830_UPLOAD_TEXBLEND0);
imesa->hw_primitive = old_vertex_prim;
}
static void i830Clear(GLcontext *ctx, GLbitfield mask, GLboolean all,
GLint cx1, GLint cy1, GLint cw, GLint ch)
{
i830ContextPtr imesa = I830_CONTEXT( ctx );
__DRIdrawablePrivate *dPriv = imesa->driDrawable;
const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
drmI830Clear clear;
GLbitfield tri_mask = 0;
int i;
GLint cx, cy;
/* flip top to bottom */
cy = dPriv->h-cy1-ch;
cx = cx1 + imesa->drawX;
cy += imesa->drawY;
if(0) fprintf(stderr, "\nClearColor : 0x%08x\n", imesa->ClearColor);
clear.flags = 0;
clear.clear_color = imesa->ClearColor;
clear.clear_depth = 0;
clear.clear_colormask = 0;
clear.clear_depthmask = 0;
I830_FIREVERTICES( imesa );
if (mask & BUFFER_BIT_FRONT_LEFT) {
if(colorMask == ~0) {
clear.flags |= I830_FRONT;
} else {
tri_mask |= BUFFER_BIT_FRONT_LEFT;
}
mask &= ~BUFFER_BIT_FRONT_LEFT;
}
if (mask & BUFFER_BIT_BACK_LEFT) {
if(colorMask == ~0) {
clear.flags |= I830_BACK;
} else {
tri_mask |= BUFFER_BIT_BACK_LEFT;
}
mask &= ~BUFFER_BIT_BACK_LEFT;
}
if (mask & BUFFER_BIT_DEPTH) {
clear.flags |= I830_DEPTH;
clear.clear_depthmask = imesa->depth_clear_mask;
clear.clear_depth = (GLuint)(ctx->Depth.Clear * imesa->ClearDepth);
mask &= ~BUFFER_BIT_DEPTH;
}
if((mask & BUFFER_BIT_STENCIL) && imesa->hw_stencil) {
if (ctx->Stencil.WriteMask[0] != 0xff) {
tri_mask |= BUFFER_BIT_STENCIL;
} else {
clear.flags |= I830_DEPTH;
clear.clear_depthmask |= imesa->stencil_clear_mask;
clear.clear_depth |= (ctx->Stencil.Clear & 0xff) << 24;
}
mask &= ~BUFFER_BIT_STENCIL;
}
/* First check for clears that need to happen with triangles */
if(tri_mask) {
i830ClearWithTris(ctx, tri_mask, all, cx, cy, cw, ch);
}
if (clear.flags) {
LOCK_HARDWARE( imesa );
for (i = 0 ; i < imesa->numClipRects ; )
{
int nr = MIN2(i + I830_NR_SAREA_CLIPRECTS, imesa->numClipRects);
drm_clip_rect_t *box = imesa->pClipRects;
drm_clip_rect_t *b = (drm_clip_rect_t *)imesa->sarea->boxes;
int n = 0;
if (!all) {
for ( ; i < nr ; i++) {
GLint x = box[i].x1;
GLint y = box[i].y1;
GLint w = box[i].x2 - x;
GLint h = box[i].y2 - y;
if (x < cx) w -= cx - x, x = cx;
if (y < cy) h -= cy - y, y = cy;
if (x + w > cx + cw) w = cx + cw - x;
if (y + h > cy + ch) h = cy + ch - y;
if (w <= 0) continue;
if (h <= 0) continue;
b->x1 = x;
b->y1 = y;
b->x2 = x + w;
b->y2 = y + h;
b++;
n++;
}
} else {
for ( ; i < nr ; i++) {
*b++ = *(drm_clip_rect_t *)&box[i];
n++;
}
}
imesa->sarea->nbox = n;
drmCommandWrite(imesa->driFd, DRM_I830_CLEAR,
&clear, sizeof(drmI830Clear));
}
UNLOCK_HARDWARE( imesa );
imesa->upload_cliprects = GL_TRUE;
}
if (mask)
_swrast_Clear( ctx, mask, all, cx1, cy1, cw, ch );
}
/*
* Copy the back buffer to the front buffer.
*/
void i830CopyBuffer( const __DRIdrawablePrivate *dPriv )
{
i830ContextPtr imesa;
drm_clip_rect_t *pbox;
int nbox, i, tmp;
assert(dPriv);
assert(dPriv->driContextPriv);
assert(dPriv->driContextPriv->driverPrivate);
imesa = (i830ContextPtr) dPriv->driContextPriv->driverPrivate;
I830_FIREVERTICES( imesa );
LOCK_HARDWARE( imesa );
imesa->sarea->perf_boxes |= imesa->perf_boxes;
imesa->perf_boxes = 0;
pbox = dPriv->pClipRects;
nbox = dPriv->numClipRects;
for (i = 0 ; i < nbox ; )
{
int nr = MIN2(i + I830_NR_SAREA_CLIPRECTS, dPriv->numClipRects);
drm_clip_rect_t *b = (drm_clip_rect_t *)imesa->sarea->boxes;
imesa->sarea->nbox = nr - i;
for ( ; i < nr ; i++)
*b++ = pbox[i];
drmCommandNone(imesa->driFd, DRM_I830_SWAP);
}
tmp = GET_ENQUEUE_AGE(imesa);
UNLOCK_HARDWARE( imesa );
/* multiarb will suck the life out of the server without this throttle:
*/
if (GET_DISPATCH_AGE(imesa) < imesa->lastSwap) {
i830WaitAge(imesa, imesa->lastSwap);
}
imesa->lastSwap = tmp;
imesa->upload_cliprects = GL_TRUE;
}
/* Flip the front & back buffes
*/
void i830PageFlip( const __DRIdrawablePrivate *dPriv )
{
#if 0
i830ContextPtr imesa;
int tmp, ret;
if (I830_DEBUG & DEBUG_IOCTL)
fprintf(stderr, "%s\n", __FUNCTION__);
assert(dPriv);
assert(dPriv->driContextPriv);
assert(dPriv->driContextPriv->driverPrivate);
imesa = (i830ContextPtr) dPriv->driContextPriv->driverPrivate;
I830_FIREVERTICES( imesa );
LOCK_HARDWARE( imesa );
imesa->sarea->perf_boxes |= imesa->perf_boxes;
imesa->perf_boxes = 0;
if (dPriv->pClipRects) {
*(drm_clip_rect_t *)imesa->sarea->boxes = dPriv->pClipRects[0];
imesa->sarea->nbox = 1;
}
ret = drmCommandNone(imesa->driFd, DRM_I830_FLIP);
if (ret) {
fprintf(stderr, "%s: %d\n", __FUNCTION__, ret);
UNLOCK_HARDWARE( imesa );
exit(1);
}
tmp = GET_ENQUEUE_AGE(imesa);
UNLOCK_HARDWARE( imesa );
/* multiarb will suck the life out of the server without this throttle:
*/
if (GET_DISPATCH_AGE(imesa) < imesa->lastSwap) {
i830WaitAge(imesa, imesa->lastSwap);
}
i830SetDrawBuffer( imesa->glCtx, imesa->glCtx->Color.DriverDrawBuffer );
imesa->upload_cliprects = GL_TRUE;
imesa->lastSwap = tmp;
#endif
}
/* This waits for *everybody* to finish rendering -- overkill.
*/
void i830DmaFinish( i830ContextPtr imesa )
{
I830_FIREVERTICES( imesa );
LOCK_HARDWARE_QUIESCENT( imesa );
UNLOCK_HARDWARE( imesa );
}
void i830RegetLockQuiescent( i830ContextPtr imesa )
{
drmUnlock(imesa->driFd, imesa->hHWContext);
i830GetLock( imesa, DRM_LOCK_QUIESCENT );
}
void i830WaitAgeLocked( i830ContextPtr imesa, int age )
{
int i = 0;
while (++i < 5000) {
drmCommandNone(imesa->driFd, DRM_I830_GETAGE);
if (GET_DISPATCH_AGE(imesa) >= age) return;
imesa->sarea->perf_boxes |= I830_BOX_WAIT;
UNLOCK_HARDWARE( imesa );
if (I830_DEBUG & DEBUG_SLEEP) fprintf(stderr, ".");
usleep(1);
LOCK_HARDWARE( imesa );
}
/* If that didn't work, just do a flush:
*/
drmCommandNone(imesa->driFd, DRM_I830_FLUSH);
}
void i830WaitAge( i830ContextPtr imesa, int age )
{
int i = 0;
if (GET_DISPATCH_AGE(imesa) >= age) return;
while (1) {
drmCommandNone(imesa->driFd, DRM_I830_GETAGE);
if (GET_DISPATCH_AGE(imesa) >= age) return;
imesa->perf_boxes |= I830_BOX_WAIT;
if (imesa->do_irqs) {
drmI830IrqEmit ie;
drmI830IrqWait iw;
int ret;
ie.irq_seq = &iw.irq_seq;
LOCK_HARDWARE( imesa );
ret = drmCommandWriteRead( imesa->driFd, DRM_I830_IRQ_EMIT, &ie, sizeof(ie) );
if ( ret ) {
fprintf( stderr, "%s: drmI830IrqEmit: %d\n", __FUNCTION__, ret );
exit(1);
}
UNLOCK_HARDWARE(imesa);
ret = drmCommandWrite( imesa->driFd, DRM_I830_IRQ_WAIT, &iw, sizeof(iw) );
if ( ret ) {
fprintf( stderr, "%s: drmI830IrqWait: %d\n", __FUNCTION__, ret );
exit(1);
}
} else {
if (++i > 5000) usleep(1);
}
}
}
static void age_imesa( i830ContextPtr imesa, int age )
{
if (imesa->CurrentTexObj[0]) imesa->CurrentTexObj[0]->base.timestamp = age;
if (imesa->CurrentTexObj[1]) imesa->CurrentTexObj[1]->base.timestamp = age;
}
void i830FlushPrimsLocked( i830ContextPtr imesa )
{
drm_clip_rect_t *pbox = imesa->pClipRects;
int nbox = imesa->numClipRects;
drmBufPtr buffer = imesa->vertex_buffer;
I830SAREAPtr sarea = imesa->sarea;
drmI830Vertex vertex;
int i, nr;
if (I830_DEBUG & DEBUG_IOCTL)
fprintf(stderr, "%s dirty: %08x\n", __FUNCTION__, imesa->dirty);
vertex.idx = buffer->idx;
vertex.used = imesa->vertex_low;
vertex.discard = 0;
sarea->vertex_prim = imesa->hw_primitive;
/* Reset imesa vars:
*/
imesa->vertex_buffer = 0;
imesa->vertex_addr = 0;
imesa->vertex_low = 0;
imesa->vertex_high = 0;
imesa->vertex_last_prim = 0;
if (imesa->dirty) {
if (I830_DEBUG & DEBUG_SANITY)
i830EmitHwStateLockedDebug(imesa);
else
i830EmitHwStateLocked(imesa);
}
if (I830_DEBUG & DEBUG_IOCTL)
fprintf(stderr,"%s: Vertex idx %d used %d discard %d\n",
__FUNCTION__, vertex.idx, vertex.used, vertex.discard);
if (!nbox) {
vertex.used = 0;
vertex.discard = 1;
if (drmCommandWrite (imesa->driFd, DRM_I830_VERTEX,
&vertex, sizeof(drmI830Vertex))) {
fprintf(stderr, "DRM_I830_VERTEX: %d\n", -errno);
UNLOCK_HARDWARE(imesa);
exit(1);
}
return;
}
for (i = 0 ; i < nbox ; i = nr ) {
drm_clip_rect_t *b = sarea->boxes;
int j;
nr = MIN2(i + I830_NR_SAREA_CLIPRECTS, nbox);
sarea->nbox = nr - i;
for ( j = i ; j < nr ; j++) {
b[j-i] = pbox[j];
}
/* Finished with the buffer?
*/
if (nr == nbox)
vertex.discard = 1;
/* Do a bunch of sanity checks on the vertices sent to the hardware */
if (I830_DEBUG & DEBUG_SANITY) {
i830VertexSanity(imesa, vertex);
for ( j = 0 ; j < sarea->nbox ; j++) {
fprintf(stderr, "box %d/%d %d,%d %d,%d\n",
j, sarea->nbox, b[j].x1, b[j].y1, b[j].x2, b[j].y2);
}
}
drmCommandWrite (imesa->driFd, DRM_I830_VERTEX,
&vertex, sizeof(drmI830Vertex));
age_imesa(imesa, imesa->sarea->last_enqueue);
}
imesa->dirty = 0;
imesa->upload_cliprects = GL_FALSE;
}
void i830FlushPrimsGetBufferLocked( i830ContextPtr imesa )
{
if (imesa->vertex_buffer)
i830FlushPrimsLocked( imesa );
imesa->vertex_buffer = i830_get_buffer_ioctl( imesa );
imesa->vertex_addr = (char *)imesa->vertex_buffer->address;
/* leave room for instruction header & footer:
*/
imesa->vertex_high = imesa->vertex_buffer->total - 4;
imesa->vertex_low = 4;
imesa->vertex_last_prim = imesa->vertex_low;
}
void i830FlushPrimsGetBuffer( i830ContextPtr imesa )
{
LOCK_HARDWARE(imesa);
i830FlushPrimsGetBufferLocked( imesa );
UNLOCK_HARDWARE(imesa);
}
void i830FlushPrims( i830ContextPtr imesa )
{
if (imesa->vertex_buffer) {
LOCK_HARDWARE( imesa );
i830FlushPrimsLocked( imesa );
UNLOCK_HARDWARE( imesa );
}
}
int i830_check_copy(int fd)
{
return drmCommandNone(fd, DRM_I830_DOCOPY);
}
static void i830Flush( GLcontext *ctx )
{
i830ContextPtr imesa = I830_CONTEXT( ctx );
I830_FIREVERTICES( imesa );
}
static void i830Finish( GLcontext *ctx )
{
i830ContextPtr imesa = I830_CONTEXT( ctx );
i830DmaFinish( imesa );
}
void i830InitIoctlFuncs( struct dd_function_table *functions )
{
functions->Flush = i830Flush;
functions->Clear = i830Clear;
functions->Finish = i830Finish;
}

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