Compare commits

...

161 Commits

Author SHA1 Message Date
Brian Paul
ebef61f5c0 html fix 2005-05-04 20:05:21 +00:00
Brian Paul
fe6ee3f5e6 EGLScreenMESA updates 2005-05-04 20:00:15 +00:00
Brian Paul
f5581bb994 don't call XTranslateCoordinates() if rendering to pixmap 2005-05-04 14:50:45 +00:00
Keith Whitwell
47b29f511a Add a facility to route all rasterization through a fragment program
which is automatically generated to match the current texture environment
state.  Introduces a new value ctx->FragmentProgram._Active which is
true when either _Enabled is true or there is such a fragment program
ready to run.

To test out on a driver running the software rasterizer, set
MESA_TEX_PROG=t in the environment.  It goes without saying that performance
is lower for the software rasterizer in this mode.
2005-05-04 11:44:44 +00:00
Keith Whitwell
c3f764f7bb Sort instructions for clarity. 2005-05-04 11:21:46 +00:00
Keith Whitwell
3151b27b0a Include negate information in disassembly output. 2005-05-04 11:21:25 +00:00
Keith Whitwell
209b090241 Mark unused registers as undefined so dissassemblers can recognized
them easily.
2005-05-04 11:20:59 +00:00
Keith Whitwell
d8f9599403 Improve the quality of the disassembly output for fragment programs. 2005-05-04 11:20:20 +00:00
Jouk Jansen
c6e1569b7f Committing in .
OpenVMS compile update

 Modified Files:
 	Mesa/src/mesa/shader/slang/descrip.mms
 ----------------------------------------------------------------------
2005-05-04 06:33:58 +00:00
Jon Smirl
82761cb08b DRI fbdev driver getting better. Now I can see something on the screen
but it isn't the right something yet.
2005-05-04 06:12:22 +00:00
Brian Paul
c22990c29a sync with latest EGL_MESA_screen_surface spec (EGLScreenMESA handles) 2005-05-04 03:33:21 +00:00
Brian Paul
3aeae20685 updates for latest EGLScreenMESA changes 2005-05-04 03:32:39 +00:00
Keith Whitwell
884b5ade86 Import all texture coordinate arrays. Import them only once. 2005-05-03 15:11:23 +00:00
Aapo Tahkola
138b7ef4d9 Add support to external tnl switcher and disable hw tnl by default. 2005-05-01 23:36:43 +00:00
Felix Kuehling
3a934557bf Bumped the Savage driver date (a bit late) to mark S3TC support. 2005-05-01 14:37:23 +00:00
Felix Kuehling
5f0bf77255 Fixed and cleaned up programming of watermark registers. There may be
a marginal speedup, but I'm not sure this has the same effect on all
hardware. Tested on Savage IX and ProSavageDDR. For experimenting with
different values see the macros at the start of savagestate.c.
2005-05-01 14:29:16 +00:00
Jon Smirl
8af7ff1ded Improve the DRI fb driver, now it compiles.
Added code to support NEW_INTERFACE.
It still doesn't work. Made it build from make linux-solo.
2005-05-01 00:21:27 +00:00
Brian Paul
1c54579e86 apply previous GL_COMPRESSED_TEXTURE_FORMATS_ARB fix to generator file, and regenerate get.c 2005-04-30 18:30:16 +00:00
Aapo Tahkola
7d33053e47 r300 side support for fixed function pipeline. This isnt functional with current Mesa. 2005-04-30 11:06:14 +00:00
Felix Kuehling
47d18cbb64 Fixed bogus ENUM_TO_BOOLEAN in
_mesa_GetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS_ARB). Must be ENUM_TO_INT.
mesa/progs/tests/texenv now lists supported compressed texture formats
correctly.
2005-04-30 02:09:23 +00:00
Felix Kuehling
f1d053b19a Added S3TC support to the Savage driver with some help from Mark Cass's
S3TC support for an older driver version. On Savage3D/IX/MX
GL_EXT_texture_compression_s3tc can't be enabled because DXT3 and DXT5
are not supported. However GL_S3_s3tc is enabled on all Savage chips.
Tested on a Savage IX and a ProSavageDDR
2005-04-30 02:03:18 +00:00
Jon Smirl
28d0a9c9dd Fix include path to make build work 2005-04-29 22:25:21 +00:00
Keith Whitwell
5f534aa1e2 Format for 80 columns. Add alternate matrix mul based on MAD rather than DP4. 2005-04-29 17:32:27 +00:00
Keith Whitwell
e9e20fc47d Add DISASSEM define, similar to other program generator files. 2005-04-29 17:31:54 +00:00
Keith Whitwell
a5cb1aa211 Add linux-fbdev config 2005-04-29 17:31:10 +00:00
Keith Whitwell
431417fec7 new config 2005-04-29 17:30:29 +00:00
Keith Whitwell
5c81a4b9cd Put back not-so-redundant #ifdef. 2005-04-29 15:41:24 +00:00
Keith Whitwell
a6ebcdfe7d Remove redundant #ifdef, fix compiler warning 2005-04-29 15:37:27 +00:00
Keith Whitwell
2c19069182 new file 2005-04-29 15:36:38 +00:00
Keith Whitwell
15e75e00c7 Maintain a fragment program for current texturing state. 2005-04-29 15:11:39 +00:00
Brian Paul
d59054e60b fix _tnl_copy_to_current() so that current edge flag and rasterpos aren't trashed by color index updates 2005-04-28 21:14:00 +00:00
Keith Whitwell
5cef1a1fed Stop gcc-4.0 complaining about "type qualifiers ignored on function
return type".
2005-04-28 13:16:23 +00:00
Keith Whitwell
545515cbea Stop gcc-4.0 complaining about "type qualifiers ignored on function
return type".
2005-04-28 12:05:58 +00:00
Brian Paul
97e1e60b1c move set_component_sizes() to fix bug 3135 2005-04-27 21:20:30 +00:00
Brian Paul
69441868f6 no need to enable fog or set fog mode with fragment program 2005-04-26 20:58:27 +00:00
Brian Paul
55d8dd4078 tweak previous fog/fragment program fix 2005-04-26 20:56:21 +00:00
Brian Paul
d09df24082 added interpolate_fog() 2005-04-26 17:35:45 +00:00
Brian Paul
c03b6f40ba enable fog render input if fragment program fog option set 2005-04-26 17:25:53 +00:00
Brian Paul
c039af165d comments and minor clean-up 2005-04-26 16:02:56 +00:00
Aapo Tahkola
c3259fa436 Fix as suggested by Ben Skeggs. 2005-04-25 09:50:45 +00:00
Keith Whitwell
b83aadb0e4 Ensure all VB->AttribPtr[] are populated. Reported by Aapo Tahkola 2005-04-25 09:36:27 +00:00
Jon Smirl
576caad33e Minor changes to make linux-solo build again 2005-04-25 03:03:10 +00:00
Felix Kuehling
cbc8d7596a Software fallback for glColorMask. Can be avoided on Savage4 when all
channels are masked (disable draw update). Bumped driver date to
reflect recent correctness fixes. The driver now passes all glean
tests except exactRGBA on both Savage4 and Savage3D-based cards.
2005-04-24 20:55:57 +00:00
Aapo Tahkola
6ffd0a4cf1 Modifying to build against current Mesa. Disabled r200*.c files since they didnt want to build anymore. 2005-04-24 09:08:31 +00:00
Felix Kuehling
5c906924ed Fixed a segfault introduced by Keith's pipeline changes. 2005-04-23 19:54:30 +00:00
Felix Kuehling
9b4536a654 Texturing fixes for Savage3D/MX/IX:
- force emitting texAddr when the texture image changed (flush caches)
- set transparent texture color key to something improbable
  (couldn't find a way to disable it completely)
- fixed texture environment modes GL_DECAL and GL_REPLACE
- made texture environment mode GL_BLEND a software fallback
- added two custom texture formats for promoting from GL_ALPHA to ARGB8888
  and 4444. Since the hardware can't be made to ignore the RGB color
  components, set them to 1 instead of 0. This gives the correct results
- disabled GL_EXT_texture_env_add on Savage3D/MX/IX
- map both GL_CLAMP and GL_CLAMP_TO_EDGE to hardware mode "wrap". It doesn't
  match either mode exactly by the spec, so we should either fall back on both
  or none. I chose the latter.
- fall back to software when s and t wrapping modes differ (hardware has only
  one bit for both)
2005-04-23 17:18:57 +00:00
Keith Whitwell
df943a4041 Fix the worst problems with dangling edgeflag references in
display lists.  These mainly arise from edgeflag being the only
attribute no longer stored internally as a float and requiring
various special case paths to accomodate it.
2005-04-23 11:55:18 +00:00
Keith Whitwell
0d4af83f25 Updates for pipeline_stage struct changes. 2005-04-22 22:47:09 +00:00
Keith Whitwell
bf87f86493 First pass at updating these drivers with pipeline_stage struct changes. 2005-04-22 22:42:09 +00:00
Felix Kuehling
963586b871 Added a French translation of option descriptions by Stephane Marchesin. 2005-04-22 21:36:37 +00:00
Brian Paul
fc06f9fb25 demo / test progs 2005-04-22 21:17:14 +00:00
Brian Paul
20d44dc9bc types for Mesa implementation of EGL 2005-04-22 21:16:28 +00:00
Brian Paul
11b0a76370 prototype EGL_MESA_screen_surface. 2005-04-22 21:16:12 +00:00
Brian Paul
adbff7e977 initial EGL code 2005-04-22 21:09:39 +00:00
Keith Whitwell
a661654a33 Move the call to _tnl_UpdateFixedFunctionProgram to make
it easier for hardware drivers to test this out.
2005-04-22 13:02:04 +00:00
Keith Whitwell
6f973f3367 Simplify the pipeline_stage structure
- remove input/output fields, input tracking removed.
	- remove state fields, the validate function now called
	  on every statechange.
	- add an explicit 'create' function.

Add in code to build vertex program to implement current t&l state.  Still
disabled, but turn on with a #define in t_vp_build.h.
2005-04-22 12:51:19 +00:00
Keith Whitwell
6a13c7da4c Up the value of MAX_NV_VERTEX_PROGRAM_PARAMS to a power of two. 2005-04-22 12:46:13 +00:00
Michal Krol
addcc6afbd Add more error checking. 2005-04-22 10:43:36 +00:00
Michal Krol
19fb77ee7b Cosmetic changes. 2005-04-22 10:28:53 +00:00
Michal Krol
b10d080b1e Move some utility functions to slang_utility.c. 2005-04-22 10:15:32 +00:00
Michal Krol
3ed1f07686 Provide precompiled binary versions of built-in library .gc sources
to dramatically improve shader compiling performance.
2005-04-22 09:51:46 +00:00
Brian Paul
2cbbd3dc50 undef DEPTH_TYPE at end 2005-04-22 02:56:21 +00:00
Felix Kuehling
a7fcac5e92 Fixed some suspicious pointer casts that caused lots of
compile-time-warnings on x86-64. Not tested on x86-64 yet, but a good
thing in general, so I'm giving up waiting for feedback. See also
https://bugs.freedesktop.org/show_bug.cgi?id=2924.
2005-04-21 21:50:54 +00:00
Felix Kuehling
07d91bbb59 Fixed TexEnv modes GL_BLEND and GL_ADD on Savage4-based cards. Disabled
the use of hardware texture format I8 as it produces garbage at least on
ProSavageDDR.
2005-04-21 21:43:21 +00:00
Aapo Tahkola
b3474de7b5 Adding some comments. 2005-04-21 19:09:54 +00:00
Keith Whitwell
7c26b61f93 Reduce the size of mesa's internal fragment and vertex program
representations by switching to packed structures for registers and
instructions.
2005-04-21 14:46:57 +00:00
Brian Paul
88b69d7998 use _mesa_pow() for LIT (bug 3087) 2005-04-21 14:19:50 +00:00
Keith Whitwell
f069e5e412 Facility to construct a vertex program which executes the current
fixed function t&l pipeline.

Currently runs most of the Mesa demos OK, but still needs debugging &
polishing.
2005-04-21 13:13:49 +00:00
Keith Whitwell
0ff98b03c6 New software implementation of ARB_vertex_program. Similar in speed
to existing version, but with the potential for good improvements.
2005-04-21 13:11:02 +00:00
Aapo Tahkola
70375aff48 Had some odd problems with add and temps so doing it with mad. Adding some MAD_2 cases. 2005-04-21 05:24:02 +00:00
Brian Paul
52bf005425 fix state.light[n].spot.direction.w value (bug 3083) 2005-04-20 23:47:03 +00:00
Brian Paul
8d51bbf2a3 clean up buffer creation code 2005-04-20 17:12:10 +00:00
Aapo Tahkola
fc8f202181 Reorganized shader stuff. 2005-04-19 18:49:44 +00:00
Aapo Tahkola
c4e1fd5a7f Fixes for bugs that were nailed down when compairing against software vertex shading. 2005-04-19 03:12:30 +00:00
Aapo Tahkola
f8ed0aa268 Fixing and enabling elt buffers by default. 2005-04-18 22:41:43 +00:00
Ian Romanick
d03ab104db If the file name passed to parse_GL_API is None or "-", read from standard
input.  This allows use of GL API scripts in pipelines.
2005-04-18 21:30:20 +00:00
Ian Romanick
93d2d54e7a Refactor a bunch of common code from the "leaf" scripts to a new functions,
parse_GL_API, in gl_XML.py.
2005-04-18 19:42:23 +00:00
Ian Romanick
8ea22650bd Fill-in function offsets and correct a couple typos. 2005-04-18 19:17:12 +00:00
Ian Romanick
2510ba618d Convert all Python scripts to use XML namespaces. 2005-04-18 19:16:07 +00:00
Peter Zubaj
b7142567bc Alpha test fix 2005-04-18 19:06:14 +00:00
Ian Romanick
61f08d8094 Move the DTD to its own file. 2005-04-18 18:36:57 +00:00
Brian Paul
f905145b60 comments and clean-up 2005-04-18 17:48:25 +00:00
Ian Romanick
02986cb2cc Add support for pthreads and TLS to libGL for __glXLock / __glXUnlock and
for tracking the current GLX context.

This fixes bug #3024.
2005-04-18 16:59:53 +00:00
Ian Romanick
2e823f29e4 Send GL_PACK_INVERT_MESA state to the server. This fixes bug #2538. 2005-04-18 16:40:36 +00:00
Brian Paul
b52673117b s/NORMAL/FOG/ (J.P. Delport) 2005-04-18 14:21:44 +00:00
Jouk Jansen
49b1d95c1c Updates for OpenVMS : New makefiles
added some type-casts

 Modified Files:
 	Mesa/src/mesa/shader/descrip.mms
 	Mesa/src/mesa/shader/program.c
 	Mesa/src/mesa/shader/slang/slang_compile.c
 	Mesa/src/mesa/shader/slang/slang_preprocess.c
 Added Files:
 	Mesa/src/mesa/shader/slang/descrip.mms
 ----------------------------------------------------------------------
2005-04-18 13:05:24 +00:00
Brian Paul
e9a3d8a772 added SLANG_SOURCES to SOLO_C_SOURCES 2005-04-15 22:20:46 +00:00
Brian Paul
afb3fb4b77 config for profiling with gprof 2005-04-15 22:16:18 +00:00
Brian Paul
635ee2df37 added _mesa_share_state() 2005-04-15 17:25:07 +00:00
Ben Crossman
509710cfd7 more gldirect compile fixes. Getting near the linking stage now. No build file yet. 2005-04-15 17:17:47 +00:00
Brian Paul
efb41b07ff remove carriage returns 2005-04-15 16:05:14 +00:00
Keith Whitwell
78803b2667 Fix alpha value of STATE_LIGHTMODEL_SCENECOLOR. From the spec:
The "w" component of the program parameter variable is filled with
 the alpha component of the front diffuse material color.

Make sure matrix inverses are uptodate also.
2005-04-15 12:57:23 +00:00
Michal Krol
a131d50fb7 add shader/slang/slang_preprocess.c 2005-04-15 10:30:43 +00:00
Michal Krol
e3a846b0e3 implement info log; parse #version directive 2005-04-15 10:23:10 +00:00
Michal Krol
65ce50897e slang preprocessor 2005-04-15 10:21:34 +00:00
Michal Krol
8855664489 slang #version directive syntax 2005-04-15 10:20:30 +00:00
Michal Krol
35725a92be change __asm statement semantics 2005-04-15 10:19:27 +00:00
Ben Crossman
d8aa5ffed5 Reverted the last change back to fix bug 3035 2005-04-15 09:13:21 +00:00
Ian Romanick
067e788acd Convert 'variable_param' from a CDATA attribute to a NMTOKENS attribute.
The main difference is that white-space is used to separate the names
instead of comas.
2005-04-14 23:03:44 +00:00
Ian Romanick
73b4c1b388 Refactor the handling of the '(true | false)' enumerated attributes. 2005-04-14 23:00:34 +00:00
Ian Romanick
a3deff2404 Modify the DTD to use NMTOKEN, enumerants, and explicit default values
wherever possible.  Correct a couple mis-uses of the 'counter' attribute
when 'count' was intended.  Fix some errors in the DTD and in the data with
'doubles_in_order'.
2005-04-14 22:59:46 +00:00
Ian Romanick
6cae4f3bc9 In GLX_USE_TLS builds, make GET_CURRENT_CONTEXT use the TLS verion of the
variable.  Without this, GET_CURRENT_CONTEXT would *always* result in a call
to _glapi_get_context (because _glapi_Context is a const pointer to NULL in
TLS builds).
2005-04-14 21:05:55 +00:00
Ian Romanick
f434e07a6a Add missing includes of indirect.h. 2005-04-14 20:35:33 +00:00
Ben Crossman
369404299c A few getenv() that werent using the mesa wrapper version 2005-04-14 19:54:15 +00:00
Ben Crossman
b2b01a60db Some initial compile fixes. Still some left and warnings that need fixing. No where near runnable yet. 2005-04-14 16:58:25 +00:00
Keith Whitwell
60e2810ae4 Disable CLOD (Lod constant) state emit. The values emitted were
possibly negative, hence clobbering the leading register-id byte.
Fixed the calculation of the values to prevent negative numbers being
emitted, but the code still doesn't implement texture LOD bias
correctly, so leave it disabled overall.
2005-04-14 15:53:30 +00:00
Michal Krol
99b329ca13 hook to _slang_compile() 2005-04-14 10:31:36 +00:00
Michal Krol
ed5f790919 cosmetic changes 2005-04-14 10:30:08 +00:00
Michal Krol
8c01903114 ARB_fragment_shader state 2005-04-14 10:28:14 +00:00
Michal Krol
6372ea0da0 ARB_fragment/vertex_shader state 2005-04-14 10:27:19 +00:00
Michal Krol
2a37053fd5 ARB_shading_language_100 bit;
Fragment shader derivative hint
2005-04-14 10:25:49 +00:00
Michal Krol
1e8fc5ffea add GL_ARB_shading_language_100;
reorder GL_ARB_shader_objects and GL_ARB_fragment/vertex_shader stuff
2005-04-14 10:23:51 +00:00
Michal Krol
5c968cbc5e add FEATURE_ARB_shading_language_100;
remove FEATURE_shading_language;
add ARB_fragment/vertex_shader max values
2005-04-14 10:21:30 +00:00
Michal Krol
98e35025ba do not use isdigit() - can cause link errors 2005-04-14 10:19:19 +00:00
Brian Paul
fd451b6d01 updated procedure for getting CVS-write access 2005-04-13 23:50:47 +00:00
Ian Romanick
25fe93f0a1 Add TLS support to libGL and, by virtue of using glthread.h and GL_CALL, all
DRI drivers.  A TLS enabled libGL can load a TLS or a non-TLS DRI driver,
but a TLS DRI driver requires a TLS enabled libGL.

This fixes bug #1822.
2005-04-13 20:59:15 +00:00
Ian Romanick
c604e457d1 Revert revision 1.13. This allows server-side libGLcore (in X.org) to build
with Mesa CVS.  This change was wrong in the first place, and the issue that
necessitated it has been resolved.  For more background on the problem see:

http://marc.theaimsgroup.com/?l=mesa3d-dev&m=111333880529935&w=2
2005-04-13 18:41:33 +00:00
Michal Krol
9a5ba4794c add SLANG_SOURCES 2005-04-13 14:05:28 +00:00
Michal Krol
fa2802d4d0 clean-up stuff 2005-04-13 14:05:06 +00:00
Michal Krol
0e7836b500 simple front-end compiler 2005-04-13 14:04:41 +00:00
Michal Krol
d3ea221d3e add __fixed_input and __fixed_output qualifier support;
fix for_init_statement output;
2005-04-13 13:18:35 +00:00
Michal Krol
2f951683be cosmetic changes;
add __fixed_input and __fixed_output qualifiers for built-in variables;
2005-04-13 13:06:57 +00:00
Michal Krol
5a38200122 cosmetic changes;
fix syntax errors;
2005-04-13 13:03:23 +00:00
Michal Krol
f18d70b804 cosmetic changes;
change first parameter's qualifier from inout to out for __operator =;
remove __asm instructions: int_add, int_multiply, int_divide, int_negate,
int_less, int_equal, bool_equal;
2005-04-13 12:59:58 +00:00
Michal Krol
cfcf86b37d converts a .gc file to a C header containing string form of the file 2005-04-13 12:48:40 +00:00
Felix Kuehling
0ad2ef20a7 Added a Spanish translation by David Rubio Miguélezand a Dutch
translation by Manfred Stienstra.
2005-04-12 21:01:30 +00:00
Felix Kuehling
ad0dbe6b04 Changed escaping of double quotes. 2005-04-12 20:58:34 +00:00
Brian Paul
41bddcfa7b PF_8A8R8G8B pixel format (Dave Reveman) 2005-04-12 01:41:04 +00:00
Felix Kuehling
55ba0dccc9 Manage option translations in separate .po files to make translations
easier for non-programmers familiar with GNU gettext. For now there is
only a German translation but more translations are encouraged.

Translatable strings are extracted from t_options.h containing option
definitions with English descriptions. A corresponding header options.h
with all available translations of option descriptions is generated by
gen_xmlpool.py and included by xmlpool.h.

Many option descriptions were rephrased to make them unambiguous for
translation without context. They are hopefully more helpful to users at
the same time.
2005-04-11 21:41:40 +00:00
Brian Paul
aaa5a66433 set table size to 1023 and use new HASH_FUNC() macro 2005-04-10 17:44:27 +00:00
Adam Jackson
5f92c38f0e Bug #2945: Fix math error that left half the hash buckets empty. 2005-04-09 18:35:57 +00:00
Ian Romanick
db382c5b1d Remove all the radeon_subset files. They were completely unused. Keith
Whitwell says, "[T]he radeon subset code can probably be archived now."
This "fixes" bug #1623.
2005-04-08 23:54:20 +00:00
Ian Romanick
a657c1aee8 Use the same dispatch.c source file for "normal" Mesa builds and DRI
libGL builds.
2005-04-07 23:58:51 +00:00
Brian Paul
d9c389dff6 Add shaderobjects_3dlabs.c back into build but use #ifdef FEATURE_shading_language to enable/disable relevant code. 2005-04-07 14:38:41 +00:00
Ian Romanick
c51ed8c236 Follow the GLX_SGIX_fbconfig spec and return the complete list of
available fbconfigs if attrList is NULL.  This fixes bug #2917.
2005-04-07 00:05:55 +00:00
Brian Paul
c61782958b added wrappers/helpers for creating/destroying rendering contexts 2005-04-06 22:41:46 +00:00
Brian Paul
c3984fc015 changed implementation of GetAllFBConfigs() 2005-04-06 22:40:39 +00:00
Brian Paul
481bdd383a Fix Fake_glXChooseFBConfig so passing NULL attribList causes a list of all
fbconfigs to be returned.
2005-04-06 22:33:15 +00:00
Ian Romanick
bfc8a8dc63 Make linux-dri-x86-64 more like linux-dri-x86. Add ARCH_FLAGS. This is
where things like "-m64" or "-m32" should be specified.  Using this, a
32-bit DRI build can be done on an x86-64 system by doing 'ARCH_CFLAGS=-m32
make linux-dri-x86'.  Minor tweaks to linux-dri to support these changes.
2005-04-06 21:34:34 +00:00
Ian Romanick
29c909f81c Make glxgears_fbconfig compile and respect the DISPLAY setting. Add it
to the Makefile as well.
2005-04-05 20:43:06 +00:00
Keith Whitwell
5234d17514 Don't call PrimitiveNotify with an invalid primitive. Fix ipers
wireframe mode.
2005-04-05 10:30:05 +00:00
Brian Paul
c39a4bc83c s/Togle/Toggle/ 2005-04-04 20:06:40 +00:00
Brian Paul
a92100a3c6 updated warning string to match patch in bug report 2868 2005-04-04 16:06:16 +00:00
Brian Paul
fe1230f1c8 Use FEATURE_shading_language to control whether the shading language
compiler is hooked in.  May be enabled on compiler command line by setting
-DFEATURE_shading_lanuage=1.
2005-04-01 01:41:54 +00:00
Adam Jackson
26772ac988 Disable _mesa_3dlabs_create_{program,shader}_object references. 2005-03-30 17:02:18 +00:00
Brian Paul
425569bbc5 Disable C++ shading language code yet again. Doesn't compile with older
g++ installations.
2005-03-29 02:46:59 +00:00
Brian Paul
93b52d9484 re-enable shading language sources 2005-03-29 02:31:43 +00:00
Brian Paul
1706ba4101 re-enable _mesa_init_shaderobjects_3dlabs() call 2005-03-29 02:31:11 +00:00
Brian Paul
9a54843a94 fix a variety of warnings/errors 2005-03-29 02:28:21 +00:00
Brian Paul
cb80e3905c disable 3dlabs shading language code until build is fixed 2005-03-26 19:45:40 +00:00
Brian Paul
32e845f05e disable _mesa_init_shaderobjects_3dlabs() call until build is fixed 2005-03-26 19:45:08 +00:00
Brian Paul
7d4abc9b3a remove INSTALL.GNU from tarball list 2005-03-26 19:22:06 +00:00
Brian Paul
a62fe7f5e3 obsolete 2005-03-26 19:21:07 +00:00
Michal Krol
00e599e783 implement gl2_3dlabs_shhandle interface; resolve few TODOs 2005-03-25 12:16:53 +00:00
Michal Krol
1d7f71924d cleanup query functions 2005-03-25 12:12:50 +00:00
Michal Krol
05ab19ef43 add _mesa_init_shaderobjects_3dlabs() declaration 2005-03-25 12:07:31 +00:00
Michal Krol
a095aa4f4b fix comments; fix TBuiltInResource typedef 2005-03-25 12:05:30 +00:00
Michal Krol
675f802542 fix comments; disable DLL linkage for WIN32 2005-03-25 12:03:58 +00:00
Felix Kuehling
116986bad5 Fixed segfault due to an off-by-one error in SAVAGE_TEX_MAXLEVELS. 2005-03-24 11:53:19 +00:00
Felix Kuehling
798e753e07 Initialize texture addresses to something valid. 2005-03-23 17:59:09 +00:00
Keith Whitwell
ce1d7ee5ee remove file after merge 2005-03-23 12:01:08 +00:00
280 changed files with 25138 additions and 9898 deletions

View File

@@ -87,6 +87,7 @@ linux-dri \
linux-dri-x86 \
linux-dri-x86-64 \
linux-dri-ppc \
linux-fbdev \
linux-glide \
linux-icc \
linux-icc-static \
@@ -142,7 +143,6 @@ LIB_FILES = \
$(DIRECTORY)/configs/[a-z]* \
$(DIRECTORY)/docs/*.html \
$(DIRECTORY)/docs/COPYING \
$(DIRECTORY)/docs/INSTALL.GNU \
$(DIRECTORY)/docs/README.* \
$(DIRECTORY)/docs/RELNOTES* \
$(DIRECTORY)/docs/VERSIONS \

View File

@@ -14,9 +14,11 @@ MKDEP = /usr/X11R6/bin/makedepend
#MKDEP_OPTIONS = -MF depend
WARN_FLAGS = -Wall
OPT_FLAGS = -O -g
PIC_FLAGS = -fPIC
OPT_FLAGS = -O -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 \
@@ -24,25 +26,25 @@ DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
X11_INCLUDES = -I/usr/X11R6/include -I/usr/X11R6/include/X11/extensions
CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(ASM_FLAGS) -std=c99 $(PIC_FLAGS) -ffast-math \
$(DEFINES)
CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
$(ASM_FLAGS) -std=c99 -ffast-math
CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) \
$(DEFINES)
CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
ASM_SOURCES =
# Library/program dependencies
DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lm -lpthread -ldl
EXTRA_LIB_PATH=-L/usr/X11R6/lib
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
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl
GLUT_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXt -lXi -lm
GLW_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(LIB_DIR) -l$(GL_LIB) -lXt -lX11
# Directories
SRC_DIRS = mesa glu glut/glx glw glx/x11
SRC_DIRS = glx/x11 mesa glu glut/glx glw
DRIVER_DIRS = dri
PROGRAM_DIRS =
WINDOW_SYSTEM=dri

View File

@@ -1,40 +1,20 @@
# -*-makefile-*-
# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others
include $(TOP)/configs/default
include $(TOP)/configs/linux-dri
CONFIG_NAME = linux-dri-x86-64
# Compiler and flags
CC = gcc
CXX = g++
DEFINES = -DDRI_NEW_INTERFACE_ONLY -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS -D_GNU_SOURCE
CFLAGS = -m64 -Wmissing-prototypes -g -std=c99 -Wundef -fPIC -ffast-math $(DEFINES)
CXXFLAGS = -m64 -Wall -g -ansi -pedantic -fPIC $(DEFINES)
X11_INCLUDES = -I/usr/X11R6/include -I/usr/X11R6/include/X11/extensions
#ASM_SOURCES = $(X86_SOURCES)
ARCH_FLAGS = -m64
LIB_DIR = $(TOP)/lib64
# Library/program dependencies
DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl
GL_LIB_DEPS = -L/usr/X11R6/lib64 -lX11 -lXext -lXxf86vm -lm -lpthread -ldl
GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib64 -lX11 -lXmu -lXt -lXi -lm
GLW_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -L/usr/X11R6/lib64 -lXt -lX11
EXTRA_LIB_PATH=-L/usr/X11R6/lib64
# Directories
SRC_DIRS = mesa glu glut/glx glw glx/x11
DRIVER_DIRS = dri
PROGRAM_DIRS =
WINDOW_SYSTEM=dri
# ffb, gamma, and sis are missing because they have
# not be converted to use the new interface. Do i810 & i830 really
# need to be included here?
# 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
# system where they could *ever* be used.
#
DRI_DIRS = dri_client i810 i830 i915 mach64 mga r128 r200 radeon tdfx unichrome savage
DRI_DIRS = dri_client i915 mach64 mga r128 r200 radeon tdfx unichrome savage

9
configs/linux-fbdev Normal file
View File

@@ -0,0 +1,9 @@
# Configuration for generic Linux
include $(TOP)/configs/linux
CONFIG_NAME = linux-fbdev
DRIVER_DIRS = fbdev
CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -DUSE_GLFBDEV_DRIVER

29
configs/linux-profile Normal file
View File

@@ -0,0 +1,29 @@
# Configuration for profiling on Linux with gprof
include $(TOP)/configs/default
CONFIG_NAME = linux-profile
# Compiler and flags
CC = gcc
CXX = g++
CFLAGS = -pg -O -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG
CXXFLAGS = -pg -O -ansi -pedantic -Wall -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -DDEBUG -DMESA_DEBUG
GLUT_CFLAGS = -fexceptions
# Need to have -L/usr/X11R6/lib in these:
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread
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) -lXt -L/usr/X11R6/lib -lX11
# Need to make static libs for profiling:
MKLIB_OPTIONS = -static
GL_LIB_NAME = lib$(GL_LIB).a
GLU_LIB_NAME = lib$(GLU_LIB).a
GLUT_LIB_NAME = lib$(GLUT_LIB).a
GLW_LIB_NAME = lib$(GLW_LIB).a
OSMESA_LIB_NAME = lib$(OSMesa).a
APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lpthread

View File

@@ -14,9 +14,6 @@ CFLAGS = $(DEFINES) -Wmissing-prototypes -g -std=c99 -Wundef -fPIC -ffast-math
CXXFLAGS = $(DEFINES) -Wall -O3 -ansi -pedantic -fPIC
ASM_SOURCES = $(X86_SOURCES)
# Library/program dependencies
DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl
GL_LIB_DEPS = -lm -lpthread -ldl
@@ -30,4 +27,4 @@ DRIVER_DIRS = dri
PROGRAM_DIRS = miniglx
#DRI_DIRS = fb ffb gamma sis savage
DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 radeon tdfx unichrome
DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 radeon tdfx unichrome fb

View File

@@ -1,182 +0,0 @@
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

View File

@@ -67,9 +67,11 @@ Here are the basic instructions for Unix systems:
Mesa developers working with the Mesa CVS repository need to first
have an account on <a href="http://www.freedesktop.org" target="_parent">
freedesktop.org</a>.
You can request an account from either
<a href="mailto:dstone@trinity.unimelb.edu.au">Daniel Stone</a> or
<a href="mailto:eta@lclark.edu">Eric Anholt</a>.
To get an account, please ask Brian or the other Mesa developers for
permission.
Then, if there are no objections, follow this
<a href="http://www.freedesktop.org/wiki/AccountRequests" target="_parent">
procedure</a>.
</p>
<p>

View File

@@ -2,7 +2,7 @@
<TITLE>Mesa News</TITLE>
<link rel="stylesheet" type="text/css" href="mesa.css"></head>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
@@ -960,6 +960,6 @@ source code</a>.</p>
<hr>
$Id: news.html,v 3.17 2005/01/20 03:55:10 brianp Exp $
$Id: news.html,v 3.18 2005/05/04 20:05:21 brianp Exp $
</body>
</html>

View File

@@ -35,7 +35,11 @@
** compliant with the OpenGL(R) version 1.2.1 Specification.
*/
#if 0/*XXX TEMPORARY HACK*/
#include <GLES/gl.h>
#else
#include <GL/gl.h>
#endif
#include <GLES/egltypes.h>
/* XXX should go in eglext.h */
@@ -225,6 +229,41 @@ GLAPI EGLBoolean APIENTRY eglWaitNative (EGLint engine);
GLAPI EGLBoolean APIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface draw);
GLAPI EGLBoolean APIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, NativePixmapType target);
/* EGL_MESA_screen extension >>> PRELIMINARY <<< */
#ifndef EGL_MESA_screen_surface
#define EGL_MESA_screen_surface 1
#define EGL_BAD_SCREEN_MESA 0x4000
#define EGL_BAD_MODE_MESA 0x4001
#define EGL_SCREEN_COUNT_MESA 0x4002
#define EGL_SCREEN_POSITION_MESA 0x4003
#define EGL_MODE_ID_MESA 0x4004
#define EGL_REFRESH_RATE_MESA 0x4005
#define EGL_OPTIMAL_MODE_MESA 0x4006
#define EGL_SCREEN_BIT_MESA 0x08
GLAPI EGLBoolean APIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
GLAPI EGLBoolean APIENTRY eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
GLAPI EGLBoolean APIENTRY eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
GLAPI EGLBoolean APIENTRY eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
GLAPI EGLSurface APIENTRY eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
GLAPI EGLBoolean APIENTRY eglShowSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface);
GLAPI EGLBoolean APIENTRY eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
GLAPI EGLBoolean APIENTRY eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
GLAPI EGLBoolean APIENTRY eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
GLAPI EGLBoolean APIENTRY eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
#endif /* EGL_MESA_screen_surface */
#ifdef __cplusplus
}
#endif

View File

@@ -1,48 +1,45 @@
/*
* egltypes.h - EGL API compatibility
*
* The intention here is to support multiple EGL implementations for the
* various backends - GLX, AGL, WGL, Solo - so we define the EGL types as
* opaque handles. We also define the Native types as opaque handles for
* now, which should be fine for GLX and Solo but the others who knows.
* They can extend this later.
*
* We require that 'int' be 32 bits. Other than that this should be pretty
* portable.
*
* Derived from the OpenGL|ES 1.1 egl.h on the Khronos website:
* http://www.khronos.org/opengles/spec_headers/opengles1_1/egl.h
*
*/
** egltypes.h for Mesa
**
** ONLY egl.h SHOULD INCLUDE THIS FILE!
**
** See comments about egltypes.h in the standard egl.h file.
*/
#ifndef _EGLTYPES_H
#define _EGLTYPES_H
#include <sys/types.h>
/*
* Native types
*/
typedef void *NativeDisplayType;
typedef void *NativePixmapType;
typedef void *NativeWindowType;
/*
* Types and resources
*/
typedef GLboolean EGLBoolean;
typedef GLint EGLint;
typedef void *EGLDisplay;
typedef void *EGLConfig;
typedef void *EGLSurface;
typedef void *EGLContext;
** These opaque EGL types are implemented as unsigned 32-bit integers:
*/
typedef u_int32_t EGLDisplay;
typedef u_int32_t EGLConfig;
typedef u_int32_t EGLSurface;
typedef u_int32_t EGLContext;
/* EGL_MESA_screen_surface */
typedef u_int32_t EGLModeMESA;
typedef u_int32_t EGLScreenMESA;
/*
* EGL and native handle values
*/
#define EGL_DEFAULT_DISPLAY ((NativeDisplayType)0)
#define EGL_NO_CONTEXT ((EGLContext)0)
#define EGL_NO_DISPLAY ((EGLDisplay)0)
#define EGL_NO_SURFACE ((EGLSurface)0)
** Other basic EGL types:
*/
typedef u_int8_t EGLBoolean;
typedef int32_t EGLint;
#endif /* _EGLTYPES_H */
typedef void * NativeDisplayType;
typedef int NativePixmapType;
typedef int NativeWindowType;
/*
** EGL and native handle null values:
*/
#define EGL_DEFAULT_DISPLAY ((NativeDisplayType) 0)
#define EGL_NO_CONTEXT ((EGLContext) 0)
#define EGL_NO_DISPLAY ((EGLDisplay) 0)
#define EGL_NO_SURFACE ((EGLSurface) 0)
/* EGL_MESA_screen_surface */
#define EGL_NO_MODE_MESA ((EGLModeMESA) 0)

View File

@@ -51,20 +51,16 @@ static void Redisplay( void )
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
if (PixelLight) {
#if defined(GL_ARB_fragment_program)
glProgramLocalParameter4fvARB_func(GL_FRAGMENT_PROGRAM_ARB,
LIGHTPOS, LightPos);
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glEnable(GL_VERTEX_PROGRAM_ARB);
#endif
glDisable(GL_LIGHTING);
}
else {
glLightfv(GL_LIGHT0, GL_POSITION, LightPos);
#if defined(GL_ARB_fragment_program)
glDisable(GL_FRAGMENT_PROGRAM_ARB);
glDisable(GL_VERTEX_PROGRAM_ARB);
#endif
glEnable(GL_LIGHTING);
}
@@ -302,7 +298,6 @@ static void Init( void )
glDeleteProgramsARB_func = (PFNGLDELETEPROGRAMSARBPROC) glutGetProcAddress("glDeleteProgramsARB");
assert(glDeleteProgramsARB_func);
#if defined(GL_ARB_fragment_program)
/*
* Fragment program
*/
@@ -354,7 +349,6 @@ static void Init( void )
exit(0);
}
assert(glIsProgramARB_func(VertProg));
#endif
/*
* Misc init
@@ -371,11 +365,9 @@ static void Init( void )
{
/* Green-ish fog color */
static const GLfloat fogColor[4] = {0.5, 1.0, 0.5, 0};
glFogi(GL_FOG_MODE, GL_LINEAR);
glFogfv(GL_FOG_COLOR, fogColor);
glFogf(GL_FOG_START, 5.0);
glFogf(GL_FOG_END, 25.0);
glEnable(GL_FOG);
}
#endif

View File

@@ -304,7 +304,7 @@ printhelp(void)
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help");
glRasterPos2i(60, 390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help");
glRasterPos2i(60, 360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Increase particle size");
@@ -317,9 +317,9 @@ printhelp(void)
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "R - Decrease emission radius");
glRasterPos2i(60, 240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog");
glRasterPos2i(60, 210);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "s - Togle shadows");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "s - Toggle shadows");
glRasterPos2i(60, 180);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate");
glRasterPos2i(60, 150);
@@ -330,7 +330,7 @@ printhelp(void)
glRasterPos2i(60, 90);
if (joyavailable)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"j - Togle jostick control (Joystick control available)");
"j - Toggle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"(No Joystick control available)");

View File

@@ -146,10 +146,10 @@ static void printhelp(void)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Help");
glRasterPos2i(60,390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"h - Togle Help");
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"h - Toggle Help");
glRasterPos2i(60,360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"f - Togle Fog");
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"f - Toggle Fog");
glRasterPos2i(60,330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Arrow Keys - Rotate");
glRasterPos2i(60,300);

View File

@@ -269,13 +269,13 @@ printhelp(void)
printstring(GLUT_BITMAP_HELVETICA_18, "Help");
glRasterPos2i(60, 390);
printstring(GLUT_BITMAP_HELVETICA_12, "h - Togle Help");
printstring(GLUT_BITMAP_HELVETICA_12, "h - Toggle Help");
glRasterPos2i(60, 370);
printstring(GLUT_BITMAP_HELVETICA_12, "f - Togle Fog");
printstring(GLUT_BITMAP_HELVETICA_12, "f - Toggle Fog");
glRasterPos2i(60, 350);
printstring(GLUT_BITMAP_HELVETICA_12, "b - Togle Back face culling");
printstring(GLUT_BITMAP_HELVETICA_12, "b - Toggle Back face culling");
glRasterPos2i(60, 330);
printstring(GLUT_BITMAP_HELVETICA_12, "p - Togle Wire frame");
printstring(GLUT_BITMAP_HELVETICA_12, "p - Toggle Wire frame");
glRasterPos2i(60, 310);
printstring(GLUT_BITMAP_HELVETICA_12, "Arrow Keys - Rotate");
glRasterPos2i(60, 290);
@@ -286,7 +286,7 @@ printhelp(void)
glRasterPos2i(60, 250);
if (joyavailable)
printstring(GLUT_BITMAP_HELVETICA_12,
"j - Togle jostick control (Joystick control available)");
"j - Toggle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_HELVETICA_12,
"(No Joystick control available)");
@@ -300,11 +300,11 @@ printhelp(void)
glRasterPos2i(60, 190);
printstring(GLUT_BITMAP_HELVETICA_12,
"1 - Togle the plane texture map window");
"1 - Toggle the plane texture map window");
glRasterPos2i(60, 170);
printstring(GLUT_BITMAP_HELVETICA_12,
"2 - Togle the sphere texture map window");
"2 - Toggle the sphere texture map window");
}
static GLboolean

View File

@@ -250,13 +250,13 @@ static void printhelp(void)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Help");
glRasterPos2i(60,390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"h - Togle Help");
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"h - Toggle Help");
glRasterPos2i(60,360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"t - Togle Textures");
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"t - Toggle Textures");
glRasterPos2i(60,330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"f - Togle Fog");
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"f - Toggle Fog");
glRasterPos2i(60,300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"b - Togle Back face culling");
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"b - Toggle Back face culling");
glRasterPos2i(60,270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Arrow Keys - Rotate");
glRasterPos2i(60,240);
@@ -266,7 +266,7 @@ static void printhelp(void)
glRasterPos2i(60,180);
if(joyavailable)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"j - Togle jostick control (Joystick control available)");
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"j - Toggle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"(No Joystick control available)");
}

View File

@@ -229,15 +229,15 @@ printhelp(void)
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help");
glRasterPos2i(60, 390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help");
glRasterPos2i(60, 360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Togle Textures");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Toggle Textures");
glRasterPos2i(60, 330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog");
glRasterPos2i(60, 300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "p - Wire frame");
glRasterPos2i(60, 270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Togle Back face culling");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Toggle Back face culling");
glRasterPos2i(60, 240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate");
glRasterPos2i(60, 210);
@@ -248,7 +248,7 @@ printhelp(void)
glRasterPos2i(60, 150);
if (joyavailable)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"j - Togle jostick control (Joystick control available)");
"j - Toggle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"(No Joystick control available)");

View File

@@ -300,15 +300,15 @@ printhelp(void)
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help");
glRasterPos2i(60, 390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help");
glRasterPos2i(60, 360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Togle Textures");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Toggle Textures");
glRasterPos2i(60, 330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog");
glRasterPos2i(60, 300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "m - Togle strips");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "m - Toggle strips");
glRasterPos2i(60, 270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Togle Back face culling");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Toggle Back face culling");
glRasterPos2i(60, 240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate");
glRasterPos2i(60, 210);
@@ -319,7 +319,7 @@ printhelp(void)
glRasterPos2i(60, 150);
if (joyavailable)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"j - Togle jostick control (Joystick control available)");
"j - Toggle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"(No Joystick control available)");

View File

@@ -324,15 +324,15 @@ printhelp(void)
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help");
glRasterPos2i(60, 390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Togle Help");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help");
glRasterPos2i(60, 360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Togle Textures");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Toggle Textures");
glRasterPos2i(60, 330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Togle Fog");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog");
glRasterPos2i(60, 300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "m - Togle strips");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "m - Toggle strips");
glRasterPos2i(60, 270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Togle Back face culling");
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Toggle Back face culling");
glRasterPos2i(60, 240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate");
glRasterPos2i(60, 210);
@@ -343,7 +343,7 @@ printhelp(void)
glRasterPos2i(60, 150);
if (joyavailable)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"j - Togle jostick control (Joystick control available)");
"j - Toggle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"(No Joystick control available)");

42
progs/egl/Makefile Normal file
View File

@@ -0,0 +1,42 @@
# progs/egl/Makefile
TOP = ../..
include $(TOP)/configs/current
INCLUDE_DIRS = -I$(TOP)/include
HEADERS = $(TOP)/include/GLES/egl.h
PROGRAMS = \
demo1 \
eglinfo
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
default: $(PROGRAMS)
demo1: demo1.o $(LIB_DIR)/libEGL.so
$(CC) demo1.o -L$(LIB_DIR) -lEGL -o $@
demo1.o: demo1.c $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include demo1.c
eglinfo: eglinfo.o $(LIB_DIR)/libEGL.so
$(CC) eglinfo.o -L$(LIB_DIR) -lEGL -o $@
eglinfo.o: eglinfo.c $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include eglinfo.c
clean:
rm -f *.o *~
rm -f *.so
rm -f $(PROGRAMS)

97
progs/egl/demo1.c Normal file
View File

@@ -0,0 +1,97 @@
/*
* Exercise EGL API functions
*/
#include <GLES/egl.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
/**
* Test EGL_MESA_screen_surface functions
*/
static void
TestScreens(EGLDisplay dpy)
{
#define MAX 8
EGLScreenMESA screens[MAX];
EGLint numScreens;
EGLint i;
eglGetScreensMESA(dpy, screens, MAX, &numScreens);
printf("Found %d screens\n", numScreens);
for (i = 0; i < numScreens; i++) {
printf(" Screen %d handle: %d\n", i, (int) screens[i]);
}
}
int
main(int argc, char *argv[])
{
int maj, min;
EGLContext ctx;
EGLSurface pbuffer;
EGLConfig configs[10];
EGLint numConfigs, i;
EGLBoolean b;
const EGLint pbufAttribs[] = {
EGL_WIDTH, 500,
EGL_HEIGHT, 500,
EGL_NONE
};
/*
EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
*/
EGLDisplay d = eglGetDisplay("!demo");
assert(d);
if (!eglInitialize(d, &maj, &min)) {
printf("demo: eglInitialize failed\n");
exit(1);
}
printf("EGL version = %d.%d\n", maj, min);
printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
eglGetConfigs(d, configs, 10, &numConfigs);
printf("Got %d EGL configs:\n", numConfigs);
for (i = 0; i < numConfigs; i++) {
EGLint id, red, depth;
eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red);
eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth);
printf("%2d: Red Size = %d Depth Size = %d\n", id, red, depth);
}
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
printf("failed to create context\n");
return 0;
}
pbuffer = eglCreatePbufferSurface(d, configs[0], pbufAttribs);
if (pbuffer == EGL_NO_SURFACE) {
printf("failed to create pbuffer\n");
return 0;
}
b = eglMakeCurrent(d, pbuffer, pbuffer, ctx);
if (!b) {
printf("make current failed\n");
return 0;
}
b = eglMakeCurrent(d, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
TestScreens(d);
eglDestroySurface(d, pbuffer);
eglDestroyContext(d, ctx);
eglTerminate(d);
return 0;
}

158
progs/egl/eglinfo.c Normal file
View File

@@ -0,0 +1,158 @@
/*
* eglinfo - like glxinfo but for EGL
*
* Brian Paul
* 11 March 2005
*
* Copyright (C) 2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <GLES/egl.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_CONFIGS 1000
#define MAX_MODES 1000
/**
* Print table of all available configurations.
*/
static void
PrintConfigs(EGLDisplay d)
{
EGLConfig configs[MAX_CONFIGS];
EGLint numConfigs, i;
eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
printf("Configurations:\n");
printf(" bf lv d st colorbuffer dp st supported \n");
printf(" id sz l b ro r g b a th cl surfaces \n");
printf("----------------------------------------------\n");
for (i = 0; i < numConfigs; i++) {
EGLint id, size, level;
EGLint red, green, blue, alpha;
EGLint depth, stencil;
EGLint surfaces;
EGLint doubleBuf = 1, stereo = 0;
char surfString[100] = "";
eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
eglGetConfigAttrib(d, configs[i], EGL_BUFFER_SIZE, &size);
eglGetConfigAttrib(d, configs[i], EGL_LEVEL, &level);
eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red);
eglGetConfigAttrib(d, configs[i], EGL_GREEN_SIZE, &green);
eglGetConfigAttrib(d, configs[i], EGL_BLUE_SIZE, &blue);
eglGetConfigAttrib(d, configs[i], EGL_ALPHA_SIZE, &alpha);
eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth);
eglGetConfigAttrib(d, configs[i], EGL_STENCIL_SIZE, &stencil);
eglGetConfigAttrib(d, configs[i], EGL_SURFACE_TYPE, &surfaces);
if (surfaces & EGL_WINDOW_BIT)
strcat(surfString, "win,");
if (surfaces & EGL_PBUFFER_BIT)
strcat(surfString, "pb,");
if (surfaces & EGL_PIXMAP_BIT)
strcat(surfString, "pix,");
if (strlen(surfString) > 0)
surfString[strlen(surfString) - 1] = 0;
printf("0x%02x %2d %2d %c %c %2d %2d %2d %2d %2d %2d %-12s\n",
id, size, level,
doubleBuf ? 'y' : '.',
stereo ? 'y' : '.',
red, green, blue, alpha,
depth, stencil, surfString);
}
}
/**
* Print table of all available configurations.
*/
static void
PrintModes(EGLDisplay d)
{
#ifdef EGL_MESA_screen_surface
const char *extensions = eglQueryString(d, EGL_EXTENSIONS);
if (strstr("EGL_MESA_screen_surface", extensions)) {
EGLScreenMESA screens[20];
EGLint numScreens = 1, scrn;
EGLModeMESA modes[MAX_MODES];
eglGetScreensMESA(d, screens, 20, &numScreens);
printf("Number of Screens: %d\n\n", numScreens);
for (scrn = 0; scrn < numScreens; scrn++) {
EGLint numModes, i;
eglGetModesMESA(d, screens[scrn], modes, MAX_MODES, &numModes);
printf("Screen %d Modes:\n", scrn);
printf(" id width height refresh\n");
printf("-------------------------\n");
for (i = 0; i < numModes; i++) {
EGLint id, w, h, r;
eglGetModeAttribMESA(d, modes[i], EGL_MODE_ID_MESA, &id);
eglGetModeAttribMESA(d, modes[i], EGL_WIDTH, &w);
eglGetModeAttribMESA(d, modes[i], EGL_HEIGHT, &h);
eglGetModeAttribMESA(d, modes[i], EGL_REFRESH_RATE_MESA, &r);
printf("0x%02x %5d %5d %.3f\n", id, w, h, r / 1000.0);
}
}
}
#endif
}
int
main(int argc, char *argv[])
{
int maj, min;
EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (!eglInitialize(d, &maj, &min)) {
printf("eglinfo: eglInitialize failed\n");
exit(1);
}
printf("EGL API version: %d.%d\n", maj, min);
printf("EGL vendor string: %s\n", eglQueryString(d, EGL_VENDOR));
printf("EGL version string: %s\n", eglQueryString(d, EGL_VERSION));
printf("EGL extensions string:\n");
printf(" %s\n", eglQueryString(d, EGL_EXTENSIONS));
printf("\n");
PrintConfigs(d);
printf("\n");
PrintModes(d);
eglTerminate(d);
return 0;
}

53
progs/fbdev/Makefile Normal file
View File

@@ -0,0 +1,53 @@
# Makefile for miniglx demo programs
TOP = ../..
include $(TOP)/configs/current
SOURCES = glfbdevtest.c
OBJECTS = $(SOURCES:.c=.o)
PROGS = $(SOURCES:%.c=%)
INCLUDES = \
-I. \
-I$(TOP)/include
##### RULES #####
.SUFFIXES:
.SUFFIXES: .c
.c:
$(CC) $(INCLUDES) $(CFLAGS) $< $(APP_LIB_DEPS) -o $@
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
.S.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
##### TARGETS #####
default: depend $(PROGS)
clean:
rm -f $(PROGS)
rm -f *.o
depend: $(SOURCES)
touch depend
$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null
# Emacs tags
tags:
etags `find . -name \*.[ch]` `find ../include`
include depend

View File

@@ -11,6 +11,7 @@ LIB_DEP = $(LIB_DIR)/$(GL_LIB_NAME) $(LIB_DIR)/$(GLU_LIB_NAME)
PROGS = glthreads \
glxdemo \
glxgears \
glxgears_fbconfig \
glxcontexts \
glxheads \
glxinfo \
@@ -64,6 +65,11 @@ pbdemo.o: pbdemo.c pbutil.h
pbutil.o: pbutil.c pbutil.h
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) pbutil.c
glxgears_fbconfig: glxgears_fbconfig.o pbutil.o
$(CC) glxgears_fbconfig.o pbutil.o $(APP_LIB_DEPS) -o $@
glxgears_fbconfig.o: glxgears_fbconfig.c pbutil.h
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) glxgears_fbconfig.c
xrotfontdemo: xrotfontdemo.o xuserotfont.o
$(CC) xrotfontdemo.o xuserotfont.o $(APP_LIB_DEPS) -o $@

View File

@@ -32,6 +32,8 @@
*/
#define GLX_GLXEXT_PROTOTYPES
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
@@ -44,7 +46,7 @@
#include <assert.h>
#include "pbutil.h"
/* I had to the the SGIX versions of these because for some reason glxext.h
/* I had to use the SGIX versions of these because for some reason glxext.h
* doesn't define the core versions if GLX_VERSION_1_3 is defined, and glx.h
* doesn't define them at all. One or both header files is clearly broken.
*/
@@ -436,7 +438,7 @@ make_window( Display *dpy, const char *name,
printf("\nThe following fbconfigs meet the requirements. The first one "
"will be used.\n\n");
for ( i = 0 ; i < num_configs ; i++ ) {
PrintFBConfigInfo(dpy, fbconfig[i], GL_TRUE);
PrintFBConfigInfo(dpy, scrnum, fbconfig[i], GL_TRUE);
}
/* window attributes */
@@ -557,7 +559,7 @@ main(int argc, char *argv[])
Display *dpy;
Window win;
GLXContext ctx;
char *dpyName = ":0";
const char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
int i;

View File

@@ -9,7 +9,6 @@
* to the GLX_SGIX_fbconfig/pbuffer extensions.
*/
#include <stdio.h>
#include <string.h>
#include "pbutil.h"
@@ -89,13 +88,10 @@ GetAllFBConfigs(Display *dpy, int screen, int *nConfigs)
#endif
#if defined(GLX_SGIX_fbconfig) && defined(GLX_SGIX_pbuffer)
if (pbSupport == 2) {
/* this *seems* to work, but may not be perfect */
static int fbAttribs[] = {
GLX_RENDER_TYPE, 0,
GLX_DRAWABLE_TYPE, 0,
None
};
return glXChooseFBConfigSGIX(dpy, screen, fbAttribs, nConfigs);
/* The GLX_SGIX_fbconfig extensions says to pass NULL to get list
* of all available configurations.
*/
return glXChooseFBConfigSGIX(dpy, screen, NULL, nConfigs);
}
#endif
return NULL;
@@ -296,6 +292,43 @@ PrintFBConfigInfo(Display *dpy, int screen, FBCONFIG config, Bool horizFormat)
GLXContext
CreateContext(Display *dpy, int screen, FBCONFIG config)
{
int pbSupport = QueryPbuffers(dpy, screen);
#if defined(GLX_VERSION_1_3)
if (pbSupport == 1) {
/* GLX 1.3 */
GLXContext c;
c = glXCreateNewContext(dpy, config, GLX_RGBA_TYPE, NULL, True);
if (!c) {
/* try indirect */
c = glXCreateNewContext(dpy, config, GLX_RGBA_TYPE, NULL, False);
}
return c;
}
#endif
#if defined(GLX_SGIX_fbconfig) && defined(GLX_SGIX_pbuffer)
if (pbSupport == 2) {
GLXContext c;
c = glXCreateContextWithConfigSGIX(dpy, config, GLX_RGBA_TYPE_SGIX, NULL, True);
if (!c) {
c = glXCreateContextWithConfigSGIX(dpy, config, GLX_RGBA_TYPE_SGIX, NULL, False);
}
return c;
}
#endif
return 0;
}
void
DestroyContext(Display *dpy, GLXContext ctx)
{
glXDestroyContext(dpy, ctx);
}
/* This is only used by CreatePbuffer() */
static int XErrorFlag = 0;
static int HandleXError(Display *dpy, XErrorEvent *event)

View File

@@ -46,6 +46,14 @@ extern XVisualInfo *
GetVisualFromFBConfig(Display *dpy, int screen, FBCONFIG config);
extern GLXContext
CreateContext(Display *dpy, int screen, FBCONFIG config);
extern void
DestroyContext(Display *dpy, GLXContext ctx);
extern PBUFFER
CreatePbuffer(Display *dpy, int screen, FBCONFIG config,
int width, int height, Bool preserve, Bool largest);

24
src/egl/Makefile Normal file
View File

@@ -0,0 +1,24 @@
# src/egl/Makefile
TOP = ../..
SUBDIRS = main drivers/demo
default: subdirs
subdirs:
@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir ; $(MAKE)) || exit 1 ; \
fi \
done
clean:
@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir ; $(MAKE) clean) ; \
fi \
done

View File

@@ -0,0 +1,31 @@
# src/egl/drivers/demo/Makefile
TOP = ../../../..
include $(TOP)/configs/current
INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/egl/main
SOURCES = demo.c
OBJECTS = $(SOURCES:.c=.o)
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
default: $(LIB_DIR)/demodriver.so
$(LIB_DIR)/demodriver.so: $(OBJECTS)
$(TOP)/bin/mklib -o demodriver.so -noprefix \
-install $(LIB_DIR) $(OBJECTS)
clean:
rm -f *.o
rm -f *.so

386
src/egl/drivers/demo/demo.c Normal file
View File

@@ -0,0 +1,386 @@
/*
* Sample driver: Demo
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "eglconfig.h"
#include "eglcontext.h"
#include "egldisplay.h"
#include "egldriver.h"
#include "eglglobals.h"
#include "eglmode.h"
#include "eglscreen.h"
#include "eglsurface.h"
/**
* Demo driver-specific driver class derived from _EGLDriver
*/
typedef struct demo_driver
{
_EGLDriver Base; /* base class/object */
GLuint DemoStuff;
} DemoDriver;
#define DEMO_DRIVER(D) ((DemoDriver *) (D))
/**
* Demo driver-specific surface class derived from _EGLSurface
*/
typedef struct demo_surface
{
_EGLSurface Base; /* base class/object */
GLuint DemoStuff;
} DemoSurface;
/**
* Demo driver-specific context class derived from _EGLContext
*/
typedef struct demo_context
{
_EGLContext Base; /* base class/object */
GLuint DemoStuff;
} DemoContext;
static EGLBoolean
demoInitialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
{
_EGLDisplay *disp = _eglLookupDisplay(dpy);
_EGLScreen *scrn;
EGLint i;
/* Create a screen */
scrn = _eglNewScreen();
_eglAddScreen(disp, scrn);
/* Create the screen's modes - silly example */
_eglAddMode(scrn, 1600, 1200, 32, 72 * 1000);
_eglAddMode(scrn, 1280, 1024, 32, 72 * 1000);
_eglAddMode(scrn, 1280, 1024, 16, 72 * 1000);
_eglAddMode(scrn, 1024, 768, 32, 72 * 1000);
/* Create the display's visual configs - silly example */
for (i = 0; i < 4; i++) {
_EGLConfig config;
_eglInitConfig(&config, i + 1);
SET_CONFIG_ATTRIB(&config, EGL_RED_SIZE, 8);
SET_CONFIG_ATTRIB(&config, EGL_GREEN_SIZE, 8);
SET_CONFIG_ATTRIB(&config, EGL_BLUE_SIZE, 8);
SET_CONFIG_ATTRIB(&config, EGL_ALPHA_SIZE, 8);
SET_CONFIG_ATTRIB(&config, EGL_BUFFER_SIZE, 32);
if (i & 1) {
SET_CONFIG_ATTRIB(&config, EGL_DEPTH_SIZE, 32);
}
if (i & 2) {
SET_CONFIG_ATTRIB(&config, EGL_STENCIL_SIZE, 8);
}
SET_CONFIG_ATTRIB(&config, EGL_SURFACE_TYPE,
(EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT));
_eglAddConfig(disp, &config);
}
drv->Initialized = EGL_TRUE;
*major = 1;
*minor = 0;
return EGL_TRUE;
}
static EGLBoolean
demoTerminate(_EGLDriver *drv, EGLDisplay dpy)
{
/*DemoDriver *demo = DEMO_DRIVER(dpy);*/
free(drv);
return EGL_TRUE;
}
static DemoContext *
LookupDemoContext(EGLContext ctx)
{
_EGLContext *c = _eglLookupContext(ctx);
return (DemoContext *) c;
}
static DemoSurface *
LookupDemoSurface(EGLSurface surf)
{
_EGLSurface *s = _eglLookupSurface(surf);
return (DemoSurface *) s;
}
static EGLContext
demoCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list)
{
_EGLConfig *conf;
DemoContext *c;
_EGLDisplay *disp = _eglLookupDisplay(dpy);
int i;
conf = _eglLookupConfig(drv, dpy, config);
if (!conf) {
_eglError(EGL_BAD_CONFIG, "eglCreateContext");
return EGL_NO_CONTEXT;
}
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
switch (attrib_list[i]) {
/* no attribs defined for now */
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglCreateContext");
return EGL_NO_CONTEXT;
}
}
c = (DemoContext *) calloc(1, sizeof(DemoContext));
if (!c)
return EGL_NO_CONTEXT;
_eglInitContext(&c->Base);
c->Base.Display = disp;
c->Base.Config = conf;
c->Base.DrawSurface = EGL_NO_SURFACE;
c->Base.ReadSurface = EGL_NO_SURFACE;
c->DemoStuff = 1;
printf("demoCreateContext\n");
/* generate handle and insert into hash table */
_eglSaveContext(&c->Base);
assert(c->Base.Handle);
return c->Base.Handle;
}
static EGLSurface
demoCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list)
{
int i;
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
switch (attrib_list[i]) {
/* no attribs at this time */
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglCreateWindowSurface");
return EGL_NO_SURFACE;
}
}
printf("eglCreateWindowSurface()\n");
/* XXX unfinished */
return EGL_NO_SURFACE;
}
static EGLSurface
demoCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list)
{
_EGLConfig *conf;
EGLint i;
conf = _eglLookupConfig(drv, dpy, config);
if (!conf) {
_eglError(EGL_BAD_CONFIG, "eglCreatePixmapSurface");
return EGL_NO_SURFACE;
}
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
switch (attrib_list[i]) {
/* no attribs at this time */
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglCreatePixmapSurface");
return EGL_NO_SURFACE;
}
}
if (conf->Attrib[EGL_SURFACE_TYPE - FIRST_ATTRIB] == 0) {
_eglError(EGL_BAD_MATCH, "eglCreatePixmapSurface");
return EGL_NO_SURFACE;
}
printf("eglCreatePixmapSurface()\n");
return EGL_NO_SURFACE;
}
static EGLSurface
demoCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
{
_EGLConfig *conf;
EGLint i, width = 0, height = 0, largest, texFormat, texTarget, mipmapTex;
DemoSurface *surf;
conf = _eglLookupConfig(drv, dpy, config);
if (!conf) {
_eglError(EGL_BAD_CONFIG, "eglCreatePbufferSurface");
return EGL_NO_SURFACE;
}
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
switch (attrib_list[i]) {
case EGL_WIDTH:
width = attrib_list[++i];
break;
case EGL_HEIGHT:
height = attrib_list[++i];
break;
case EGL_LARGEST_PBUFFER:
largest = attrib_list[++i];
break;
case EGL_TEXTURE_FORMAT:
texFormat = attrib_list[++i];
break;
case EGL_TEXTURE_TARGET:
texTarget = attrib_list[++i];
break;
case EGL_MIPMAP_TEXTURE:
mipmapTex = attrib_list[++i];
break;
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglCreatePbufferSurface");
return EGL_NO_SURFACE;
}
}
if (width <= 0 || height <= 0) {
_eglError(EGL_BAD_ATTRIBUTE, "eglCreatePbufferSurface(width or height)");
return EGL_NO_SURFACE;
}
surf = (DemoSurface *) calloc(1, sizeof(DemoSurface));
if (!surf)
return EGL_NO_SURFACE;
surf->Base.Config = conf;
surf->Base.Type = EGL_PBUFFER_BIT;
surf->Base.Width = width;
surf->Base.Height = height;
surf->Base.TextureFormat = texFormat;
surf->Base.TextureTarget = texTarget;
surf->Base.MipmapTexture = mipmapTex;
surf->Base.MipmapLevel = 0;
surf->Base.SwapInterval = 0;
printf("eglCreatePbufferSurface()\n");
/* insert into hash table */
_eglSaveSurface(&surf->Base);
assert(surf->Base.Handle);
return surf->Base.Handle;
}
static EGLBoolean
demoDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
{
DemoSurface *fs = LookupDemoSurface(surface);
_eglRemoveSurface(&fs->Base);
if (fs->Base.IsBound) {
fs->Base.DeletePending = EGL_TRUE;
}
else {
free(fs);
}
return EGL_TRUE;
}
static EGLBoolean
demoDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext context)
{
DemoContext *fc = LookupDemoContext(context);
_eglRemoveContext(&fc->Base);
if (fc->Base.IsBound) {
fc->Base.DeletePending = EGL_TRUE;
}
else {
free(fc);
}
return EGL_TRUE;
}
static EGLBoolean
demoMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext context)
{
/*DemoDriver *demo = DEMO_DRIVER(dpy);*/
DemoSurface *readSurf = LookupDemoSurface(read);
DemoSurface *drawSurf = LookupDemoSurface(draw);
DemoContext *ctx = LookupDemoContext(context);
EGLBoolean b;
b = _eglMakeCurrent(drv, dpy, draw, read, context);
if (!b)
return EGL_FALSE;
/* XXX this is where we'd do the hardware context switch */
(void) drawSurf;
(void) readSurf;
(void) ctx;
printf("eglMakeCurrent()\n");
return EGL_TRUE;
}
static const char *
demoQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name)
{
if (name == EGL_EXTENSIONS) {
return "EGL_MESA_screen_surface";
}
else {
return _eglQueryString(drv, dpy, name);
}
}
/*
* Just to silence warning
*/
extern _EGLDriver *
_eglMain(NativeDisplayType dpy);
/**
* The bootstrap function. Return a new DemoDriver object and
* plug in API functions.
*/
_EGLDriver *
_eglMain(NativeDisplayType dpy)
{
DemoDriver *demo;
demo = (DemoDriver *) calloc(1, sizeof(DemoDriver));
if (!demo) {
return NULL;
}
/* First fill in the dispatch table with defaults */
_eglInitDriverFallbacks(&demo->Base);
/* then plug in our Demo-specific functions */
demo->Base.Initialize = demoInitialize;
demo->Base.Terminate = demoTerminate;
demo->Base.CreateContext = demoCreateContext;
demo->Base.MakeCurrent = demoMakeCurrent;
demo->Base.CreateWindowSurface = demoCreateWindowSurface;
demo->Base.CreatePixmapSurface = demoCreatePixmapSurface;
demo->Base.CreatePbufferSurface = demoCreatePbufferSurface;
demo->Base.DestroySurface = demoDestroySurface;
demo->Base.DestroyContext = demoDestroyContext;
demo->Base.QueryString = demoQueryString;
return &demo->Base;
}

64
src/egl/main/Makefile Normal file
View File

@@ -0,0 +1,64 @@
# src/egl/main/Makefile
TOP = ../../..
include $(TOP)/configs/current
INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/mesa/glapi
HEADERS = \
eglconfig.h \
eglcontext.h \
egldisplay.h \
egldriver.h \
eglglobals.h \
eglhash.h \
eglmode.h \
eglscreen.h \
eglsurface.h
SOURCES = \
eglapi.c \
eglconfig.c \
eglcontext.c \
egldisplay.c \
egldriver.c \
eglglobals.c \
eglhash.c \
eglmode.c \
eglscreen.c \
eglsurface.c
OBJECTS = $(SOURCES:.c=.o)
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
default: depend library
# EGL Library
library: $(LIB_DIR)/libEGL.so
$(LIB_DIR)/libEGL.so: $(OBJECTS)
$(TOP)/bin/mklib -o EGL -major 1 -minor 0 \
-install $(LIB_DIR) -ldl $(OBJECTS)
clean:
rm -f *.o *.so*
rm -f core.*
depend: $(SOURCES) $(HEADERS)
@ echo "running $(MKDEP)"
@ touch depend
$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \
$(SOURCES) $(HEADERS) > /dev/null
include depend
# DO NOT DELETE

452
src/egl/main/eglapi.c Normal file
View File

@@ -0,0 +1,452 @@
/**
* Public EGL API entrypoints
*
* Generally, we use the EGLDisplay parameter as a key to lookup the
* appropriate device driver handle, then jump though the driver's
* dispatch table to handle the function.
*
* That allows us the option of supporting multiple, simultaneous,
* heterogeneous hardware devices in the future.
*
* The EGLDisplay, EGLConfig, EGLContext and EGLSurface types are
* opaque handles implemented with 32-bit unsigned integers.
* It's up to the driver function or fallback function to look up the
* handle and get an object.
* By using opaque handles, we leave open the possibility of having
* indirect rendering in the future, like GLX.
*
*
* Notes on naming conventions:
*
* eglFooBar - public EGL function
* EGL_FOO_BAR - public EGL token
* EGLDatatype - public EGL datatype
*
* _eglFooBar - private EGL function
* _EGLDatatype - private EGL datatype, typedef'd struct
* _egl_struct - private EGL struct, non-typedef'd
*
*/
#include <stdio.h>
#include <string.h>
/**#include "glapi.h"**/
#include "eglcontext.h"
#include "egldisplay.h"
#include "egltypedefs.h"
#include "eglglobals.h"
#include "egldriver.h"
#include "eglsurface.h"
/**
* NOTE: displayName is treated as a string in _eglChooseDriver()!!!
* This will probably change!
* See _eglChooseDriver() for details!
*/
EGLDisplay APIENTRY
eglGetDisplay(NativeDisplayType displayName)
{
_EGLDisplay *dpy;
_eglInitGlobals();
dpy = _eglNewDisplay(displayName);
if (dpy)
return dpy->Handle;
else
return EGL_NO_DISPLAY;
}
EGLBoolean APIENTRY
eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
{
if (dpy) {
_EGLDriver *drv = _eglChooseDriver(dpy);
if (drv)
return drv->Initialize(drv, dpy, major, minor);
}
return EGL_FALSE;
}
EGLBoolean APIENTRY
eglTerminate(EGLDisplay dpy)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
if (drv)
return _eglCloseDriver(drv, dpy);
else
return EGL_FALSE;
}
const char * APIENTRY
eglQueryString(EGLDisplay dpy, EGLint name)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
if (drv)
return drv->QueryString(drv, dpy, name);
else
return NULL;
}
EGLBoolean APIENTRY
eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
/* XXX check drv for null in remaining functions */
return drv->GetConfigs(drv, dpy, configs, config_size, num_config);
}
EGLBoolean APIENTRY
eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->ChooseConfig(drv, dpy, attrib_list, configs, config_size, num_config);
}
EGLBoolean APIENTRY
eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->GetConfigAttrib(drv, dpy, config, attribute, value);
}
EGLContext APIENTRY
eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->CreateContext(drv, dpy, config, share_list, attrib_list);
}
EGLBoolean APIENTRY
eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->DestroyContext(drv, dpy, ctx);
}
EGLBoolean APIENTRY
eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->MakeCurrent(drv, dpy, draw, read, ctx);
}
EGLBoolean APIENTRY
eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->QueryContext(drv, dpy, ctx, attribute, value);
}
EGLSurface APIENTRY
eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->CreateWindowSurface(drv, dpy, config, window, attrib_list);
}
EGLSurface APIENTRY
eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->CreatePixmapSurface(drv, dpy, config, pixmap, attrib_list);
}
EGLSurface APIENTRY
eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->CreatePbufferSurface(drv, dpy, config, attrib_list);
}
EGLBoolean APIENTRY
eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->DestroySurface(drv, dpy, surface);
}
EGLBoolean APIENTRY
eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->QuerySurface(drv, dpy, surface, attribute, value);
}
EGLBoolean APIENTRY
eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->SurfaceAttrib(drv, dpy, surface, attribute, value);
}
EGLBoolean APIENTRY
eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->BindTexImage(drv, dpy, surface, buffer);
}
EGLBoolean APIENTRY
eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->ReleaseTexImage(drv, dpy, surface, buffer);
}
EGLBoolean APIENTRY
eglSwapInterval(EGLDisplay dpy, EGLint interval)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->SwapInterval(drv, dpy, interval);
}
EGLBoolean APIENTRY
eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->SwapBuffers(drv, dpy, draw);
}
EGLBoolean APIENTRY
eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->CopyBuffers(drv, dpy, surface, target);
}
EGLBoolean APIENTRY
eglWaitGL(void)
{
EGLDisplay dpy = eglGetCurrentDisplay();
if (dpy != EGL_NO_DISPLAY) {
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->WaitGL(drv, dpy);
}
else
return EGL_FALSE;
}
EGLBoolean APIENTRY
eglWaitNative(EGLint engine)
{
EGLDisplay dpy = eglGetCurrentDisplay();
if (dpy != EGL_NO_DISPLAY) {
_EGLDriver *drv = _eglLookupDriver(dpy);
return drv->WaitNative(drv, dpy, engine);
}
else
return EGL_FALSE;
}
EGLDisplay APIENTRY
eglGetCurrentDisplay(void)
{
_EGLDisplay *dpy = _eglGetCurrentDisplay();
if (dpy)
return dpy->Handle;
else
return EGL_NO_DISPLAY;
}
EGLContext APIENTRY
eglGetCurrentContext(void)
{
_EGLContext *ctx = _eglGetCurrentContext();
if (ctx)
return ctx->Handle;
else
return EGL_NO_CONTEXT;
}
EGLSurface APIENTRY
eglGetCurrentSurface(EGLint readdraw)
{
_EGLSurface *s = _eglGetCurrentSurface(readdraw);
if (s)
return s->Handle;
else
return EGL_NO_SURFACE;
}
EGLint APIENTRY
eglGetError(void)
{
EGLint e = _eglGlobal.LastError;
_eglGlobal.LastError = EGL_SUCCESS;
return e;
}
void (* APIENTRY eglGetProcAddress(const char *procname))()
{
typedef void (*genericFunc)();
struct name_function {
const char *name;
_EGLProc function;
};
static struct name_function egl_functions[] = {
/* alphabetical order */
{ "eglBindTexImage", (_EGLProc) eglBindTexImage },
{ "eglChooseConfig", (_EGLProc) eglChooseConfig },
{ "eglCopyBuffers", (_EGLProc) eglCopyBuffers },
{ "eglCreateContext", (_EGLProc) eglCreateContext },
{ "eglCreatePbufferSurface", (_EGLProc) eglCreatePbufferSurface },
{ "eglCreatePixmapSurface", (_EGLProc) eglCreatePixmapSurface },
{ "eglCreateWindowSurface", (_EGLProc) eglCreateWindowSurface },
{ "eglDestroyContext", (_EGLProc) eglDestroyContext },
{ "eglDestroySurface", (_EGLProc) eglDestroySurface },
{ "eglGetConfigAttrib", (_EGLProc) eglGetConfigAttrib },
{ "eglGetConfigs", (_EGLProc) eglGetConfigs },
{ "eglGetCurrentContext", (_EGLProc) eglGetCurrentContext },
{ "eglGetCurrentDisplay", (_EGLProc) eglGetCurrentDisplay },
{ "eglGetCurrentSurface", (_EGLProc) eglGetCurrentSurface },
{ "eglGetDisplay", (_EGLProc) eglGetDisplay },
{ "eglGetError", (_EGLProc) eglGetError },
{ "eglGetProcAddress", (_EGLProc) eglGetProcAddress },
{ "eglInitialize", (_EGLProc) eglInitialize },
{ "eglMakeCurrent", (_EGLProc) eglMakeCurrent },
{ "eglQueryContext", (_EGLProc) eglQueryContext },
{ "eglQueryString", (_EGLProc) eglQueryString },
{ "eglQuerySurface", (_EGLProc) eglQuerySurface },
{ "eglReleaseTexImage", (_EGLProc) eglReleaseTexImage },
{ "eglSurfaceAttrib", (_EGLProc) eglSurfaceAttrib },
{ "eglSwapBuffers", (_EGLProc) eglSwapBuffers },
{ "eglSwapInterval", (_EGLProc) eglSwapInterval },
{ "eglTerminate", (_EGLProc) eglTerminate },
{ "eglWaitGL", (_EGLProc) eglWaitGL },
{ "eglWaitNative", (_EGLProc) eglWaitNative },
/* Extensions */
{ "eglShowSurfaceMESA", (_EGLProc) NULL },
{ "eglGetModesMESA", (_EGLProc) NULL },
{ NULL, NULL }
};
EGLint i;
for (i = 0; egl_functions[i].name; i++) {
if (strcmp(egl_functions[i].name, procname) == 0) {
return (genericFunc) egl_functions[i].function;
}
}
#if 0
/* XXX enable this code someday */
return (genericFunc) _glapi_get_proc_address(procname);
#else
return NULL;
#endif
}
/*
* EGL_MESA_screen extension
*/
EGLBoolean APIENTRY
eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen,
const EGLint *attrib_list, EGLModeMESA *modes,
EGLint modes_size, EGLint *num_modes)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
if (drv)
return drv->ChooseModeMESA(drv, dpy, screen, attrib_list, modes, modes_size, num_modes);
else
return EGL_FALSE;
}
EGLBoolean APIENTRY
eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
if (drv)
return drv->GetModesMESA(drv, dpy, screen, modes, mode_size, num_mode);
else
return EGL_FALSE;
}
EGLBoolean APIENTRY
eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
if (drv)
return drv->GetModeAttribMESA(drv, dpy, mode, attribute, value);
else
return EGL_FALSE;
}
EGLBoolean
eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
if (drv)
return drv->GetScreensMESA(drv, dpy, screens, max_screens, num_screens);
else
return EGL_FALSE;
}
EGLSurface
eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
{
return EGL_FALSE;
}
EGLBoolean
eglShowSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface)
{
return EGL_FALSE;
}
EGLBoolean
eglScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA mode)
{
return EGL_FALSE;
}
EGLBoolean
eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface)
{
return EGL_FALSE;
}
EGLBoolean
eglQueryScreenMESA( EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value)
{
return EGL_FALSE;
}

312
src/egl/main/eglconfig.c Normal file
View File

@@ -0,0 +1,312 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "eglconfig.h"
#include "egldisplay.h"
#include "egldriver.h"
#include "eglglobals.h"
#define MIN2(A, B) (((A) < (B)) ? (A) : (B))
/**
* Init the given _EGLconfig to default values.
* \param id the configuration's ID.
*/
void
_eglInitConfig(_EGLConfig *config, EGLint id)
{
memset(config, 0, sizeof(*config));
config->Handle = id;
SET_CONFIG_ATTRIB(config, EGL_CONFIG_ID, id);
SET_CONFIG_ATTRIB(config, EGL_BIND_TO_TEXTURE_RGB, EGL_DONT_CARE);
SET_CONFIG_ATTRIB(config, EGL_BIND_TO_TEXTURE_RGBA, EGL_DONT_CARE);
SET_CONFIG_ATTRIB(config, EGL_CONFIG_CAVEAT, EGL_DONT_CARE);
SET_CONFIG_ATTRIB(config, EGL_NATIVE_RENDERABLE, EGL_DONT_CARE);
SET_CONFIG_ATTRIB(config, EGL_NATIVE_VISUAL_TYPE, EGL_DONT_CARE);
SET_CONFIG_ATTRIB(config, EGL_MIN_SWAP_INTERVAL, EGL_DONT_CARE);
SET_CONFIG_ATTRIB(config, EGL_MAX_SWAP_INTERVAL, EGL_DONT_CARE);
SET_CONFIG_ATTRIB(config, EGL_SURFACE_TYPE, EGL_WINDOW_BIT);
SET_CONFIG_ATTRIB(config, EGL_TRANSPARENT_TYPE, EGL_NONE);
SET_CONFIG_ATTRIB(config, EGL_TRANSPARENT_RED_VALUE, EGL_DONT_CARE);
SET_CONFIG_ATTRIB(config, EGL_TRANSPARENT_GREEN_VALUE, EGL_DONT_CARE);
SET_CONFIG_ATTRIB(config, EGL_TRANSPARENT_BLUE_VALUE, EGL_DONT_CARE);
}
/**
* Given an EGLConfig handle, return the corresponding _EGLConfig object.
*/
_EGLConfig *
_eglLookupConfig(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config)
{
EGLint i;
_EGLDisplay *disp = _eglLookupDisplay(dpy);
for (i = 0; i < disp->NumConfigs; i++) {
if (disp->Configs[i].Handle == config) {
return disp->Configs + i;
}
}
return NULL;
}
/**
* Add the given _EGLConifg to the given display.
*/
_EGLConfig *
_eglAddConfig(_EGLDisplay *display, const _EGLConfig *config)
{
_EGLConfig *newConfigs;
EGLint n;
n = display->NumConfigs;
newConfigs = (_EGLConfig *) realloc(display->Configs,
(n + 1) * sizeof(_EGLConfig));
if (newConfigs) {
display->Configs = newConfigs;
display->Configs[n] = *config; /* copy struct */
display->NumConfigs++;
return display->Configs + n;
}
else {
return NULL;
}
}
/**
* Parse the attrib_list to fill in the fields of the given _egl_config
* Return EGL_FALSE if any errors, EGL_TRUE otherwise.
*/
EGLBoolean
_eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list)
{
EGLint i;
/* XXX set all config attribs to EGL_DONT_CARE */
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
EGLint k = attrib_list[i] - FIRST_ATTRIB;
if (k >= 0 && k < MAX_ATTRIBS) {
config->Attrib[k] = attrib_list[++i];
}
else {
_eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
return EGL_FALSE;
}
}
return EGL_TRUE;
}
#define EXACT 1
#define ATLEAST 2
#define MASK 3
#define SMALLER 4
#define SPECIAL 5
#define NONE 6
struct sort_info {
EGLint Attribute;
EGLint MatchCriteria;
EGLint SortOrder;
};
/* This encodes the info from Table 3.5 of the EGL spec, ordered by
* Sort Priority.
*/
static struct sort_info SortInfo[] = {
{ EGL_CONFIG_CAVEAT, EXACT, SPECIAL },
{ EGL_RED_SIZE, ATLEAST, SPECIAL },
{ EGL_GREEN_SIZE, ATLEAST, SPECIAL },
{ EGL_BLUE_SIZE, ATLEAST, SPECIAL },
{ EGL_ALPHA_SIZE, ATLEAST, SPECIAL },
{ EGL_BUFFER_SIZE, ATLEAST, SMALLER },
{ EGL_SAMPLE_BUFFERS, ATLEAST, SMALLER },
{ EGL_SAMPLES, ATLEAST, SMALLER },
{ EGL_DEPTH_SIZE, ATLEAST, SMALLER },
{ EGL_STENCIL_SIZE, ATLEAST, SMALLER },
{ EGL_NATIVE_VISUAL_TYPE, EXACT, SPECIAL },
{ EGL_CONFIG_ID, EXACT, SMALLER },
{ EGL_BIND_TO_TEXTURE_RGB, EXACT, NONE },
{ EGL_BIND_TO_TEXTURE_RGBA, EXACT, NONE },
{ EGL_LEVEL, EXACT, NONE },
{ EGL_NATIVE_RENDERABLE, EXACT, NONE },
{ EGL_MAX_SWAP_INTERVAL, EXACT, NONE },
{ EGL_MIN_SWAP_INTERVAL, EXACT, NONE },
{ EGL_SURFACE_TYPE, MASK, NONE },
{ EGL_TRANSPARENT_TYPE, EXACT, NONE },
{ EGL_TRANSPARENT_RED_VALUE, EXACT, NONE },
{ EGL_TRANSPARENT_GREEN_VALUE, EXACT, NONE },
{ EGL_TRANSPARENT_BLUE_VALUE, EXACT, NONE },
{ 0, 0, 0 }
};
/**
* Return EGL_TRUE if the attributes of c meet or exceed the minimums
* specified by min.
*/
EGLBoolean
_eglConfigQualifies(const _EGLConfig *c, const _EGLConfig *min)
{
EGLint i;
for (i = 0; SortInfo[i].Attribute != 0; i++) {
const EGLint mv = GET_CONFIG_ATTRIB(min, SortInfo[i].Attribute);
if (mv != EGL_DONT_CARE) {
const EGLint cv = GET_CONFIG_ATTRIB(c, SortInfo[i].Attribute);
if (SortInfo[i].MatchCriteria == EXACT) {
if (cv != mv) {
return EGL_FALSE;
}
}
else if (SortInfo[i].MatchCriteria == ATLEAST) {
if (cv < mv) {
return EGL_FALSE;
}
}
else {
assert(SortInfo[i].MatchCriteria == MASK);
if ((mv & cv) != mv) {
return EGL_FALSE;
}
}
}
}
return EGL_TRUE;
}
/**
* Compare configs 'a' and 'b' and return -1 if a belongs before b,
* 1 if a belongs after b, or 0 if they're equal.
*/
EGLint
_eglCompareConfigs(const _EGLConfig *a, const _EGLConfig *b)
{
EGLint i;
for (i = 0; SortInfo[i].Attribute != 0; i++) {
const EGLint av = GET_CONFIG_ATTRIB(a, SortInfo[i].Attribute);
const EGLint bv = GET_CONFIG_ATTRIB(b, SortInfo[i].Attribute);
if (SortInfo[i].SortOrder == SMALLER) {
if (av < bv)
return -1;
else if (av > bv)
return 1;
/* else, continue examining attribute values */
}
else if (SortInfo[i].SortOrder == SPECIAL) {
if (SortInfo[i].Attribute == EGL_CONFIG_CAVEAT) {
/* values are EGL_NONE, SLOW_CONFIG, or NON_CONFORMANT_CONFIG */
if (av < bv)
return -1;
else if (av > bv)
return 1;
}
else if (SortInfo[i].Attribute == EGL_RED_SIZE ||
SortInfo[i].Attribute == EGL_GREEN_SIZE ||
SortInfo[i].Attribute == EGL_BLUE_SIZE ||
SortInfo[i].Attribute == EGL_ALPHA_SIZE) {
if (av > bv)
return -1;
else if (av < bv)
return 1;
}
else {
assert(SortInfo[i].Attribute == EGL_NATIVE_VISUAL_TYPE);
if (av < bv)
return -1;
else if (av > bv)
return 1;
}
}
else {
assert(SortInfo[i].SortOrder == NONE);
/* continue examining attribute values */
}
}
return 0;
}
/**
* Typical fallback routine for eglChooseConfig
*/
EGLBoolean
_eglChooseConfig(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
{
_EGLDisplay *disp = _eglLookupDisplay(dpy);
_EGLConfig criteria;
EGLint i;
/* parse the attrib_list to initialize criteria */
if (!_eglParseConfigAttribs(&criteria, attrib_list)) {
return EGL_FALSE;
}
*num_config = 0;
for (i = 0; i < disp->NumConfigs; i++) {
const _EGLConfig *conf = disp->Configs + i;
if (_eglConfigQualifies(conf, &criteria)) {
if (*num_config < config_size) {
/* save */
configs[*num_config] = conf->Handle;
(*num_config)++;
}
else {
break;
}
}
}
/* XXX sort the list here */
return EGL_TRUE;
}
/**
* Fallback for eglGetConfigAttrib.
*/
EGLBoolean
_eglGetConfigAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
{
const _EGLConfig *conf = _eglLookupConfig(drv, dpy, config);
const EGLint k = attribute - FIRST_ATTRIB;
if (k >= 0 && k < MAX_ATTRIBS) {
*value = conf->Attrib[k];
return EGL_TRUE;
}
else {
_eglError(EGL_BAD_ATTRIBUTE, "eglGetConfigAttrib");
return EGL_FALSE;
}
}
/**
* Fallback for eglGetConfigs.
*/
EGLBoolean
_eglGetConfigs(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
{
_EGLDisplay *disp = _eglLookupDisplay(dpy);
if (!drv->Initialized) {
_eglError(EGL_NOT_INITIALIZED, "eglGetConfigs");
return EGL_FALSE;
}
*num_config = MIN2(disp->NumConfigs, config_size);
if (configs) {
EGLint i;
for (i = 0; i < *num_config; i++) {
configs[i] = disp->Configs[i].Handle;
}
}
return EGL_TRUE;
}

60
src/egl/main/eglconfig.h Normal file
View File

@@ -0,0 +1,60 @@
#ifndef EGLCONFIG_INCLUDED
#define EGLCONFIG_INCLUDED
#include "egltypedefs.h"
#define MAX_ATTRIBS 100
#define FIRST_ATTRIB EGL_BUFFER_SIZE
struct _egl_config
{
EGLConfig Handle; /* the public/opaque handle which names this config */
EGLint Attrib[MAX_ATTRIBS];
};
#define SET_CONFIG_ATTRIB(CONF, ATTR, VAL) ((CONF)->Attrib[(ATTR) - FIRST_ATTRIB] = VAL)
#define GET_CONFIG_ATTRIB(CONF, ATTR) ((CONF)->Attrib[(ATTR) - FIRST_ATTRIB])
extern void
_eglInitConfig(_EGLConfig *config, EGLint id);
extern _EGLConfig *
_eglLookupConfig(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config);
extern _EGLConfig *
_eglAddConfig(_EGLDisplay *display, const _EGLConfig *config);
extern EGLBoolean
_eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list);
extern EGLBoolean
_eglConfigQualifies(const _EGLConfig *c, const _EGLConfig *min);
extern EGLint
_eglCompareConfigs(const _EGLConfig *a, const _EGLConfig *b);
extern EGLBoolean
_eglChooseConfig(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
extern EGLBoolean
_eglGetConfigAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
extern EGLBoolean
_eglGetConfigs(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
#endif /* EGLCONFIG_INCLUDED */

226
src/egl/main/eglcontext.c Normal file
View File

@@ -0,0 +1,226 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "eglconfig.h"
#include "eglcontext.h"
#include "egldriver.h"
#include "eglglobals.h"
#include "eglhash.h"
#include "eglsurface.h"
/**
* Initialize the given _EGLContext object to defaults.
*/
void
_eglInitContext(_EGLContext *ctx)
{
/* just init to zer for now */
memset(ctx, 0, sizeof(_EGLContext));
}
/*
* Assign an EGLContext handle to the _EGLContext object then put it into
* the hash table.
*/
void
_eglSaveContext(_EGLContext *ctx)
{
assert(ctx);
ctx->Handle = _eglHashGenKey(_eglGlobal.Contexts);
_eglHashInsert(_eglGlobal.Contexts, ctx->Handle, ctx);
}
/**
* Remove the given _EGLContext object from the hash table.
*/
void
_eglRemoveContext(_EGLContext *ctx)
{
_eglHashRemove(_eglGlobal.Contexts, ctx->Handle);
}
/**
* Return the _EGLContext object that corresponds to the given
* EGLContext handle.
*/
_EGLContext *
_eglLookupContext(EGLContext ctx)
{
_EGLContext *c = (_EGLContext *) _eglHashLookup(_eglGlobal.Contexts, ctx);
return c;
}
/**
* Return the currently bound _EGLContext object, or NULL.
*/
_EGLContext *
_eglGetCurrentContext(void)
{
/* XXX this should be per-thread someday */
return _eglGlobal.CurrentContext;
}
/**
* Just a placeholder/demo function. Real driver will never use this!
*/
EGLContext
_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list)
{
_EGLConfig *conf = _eglLookupConfig(drv, dpy, config);
if (!conf) {
_eglError(EGL_BAD_CONFIG, "eglCreateContext");
return EGL_NO_CONTEXT;
}
if (share_list != EGL_NO_CONTEXT) {
_EGLContext *shareCtx = _eglLookupContext(share_list);
if (!shareCtx) {
_eglError(EGL_BAD_CONTEXT, "eglCreateContext(share_list)");
return EGL_NO_CONTEXT;
}
}
return EGL_NO_CONTEXT;
}
/**
* Default fallback routine - drivers should usually override this.
*/
EGLBoolean
_eglDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx)
{
_EGLContext *context = _eglLookupContext(ctx);
if (context) {
_eglHashRemove(_eglGlobal.Contexts, ctx);
if (context->IsBound) {
context->DeletePending = EGL_TRUE;
}
else {
free(context);
}
return EGL_TRUE;
}
else {
_eglError(EGL_BAD_CONTEXT, "eglDestroyContext");
return EGL_TRUE;
}
}
EGLBoolean
_eglQueryContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
{
_EGLContext *c = _eglLookupContext(ctx);
(void) drv;
(void) dpy;
if (!c) {
_eglError(EGL_BAD_CONTEXT, "eglQueryContext");
return EGL_FALSE;
}
switch (attribute) {
case EGL_CONFIG_ID:
*value = GET_CONFIG_ATTRIB(c->Config, EGL_CONFIG_ID);
return EGL_TRUE;
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
return EGL_FALSE;
}
}
/**
* Drivers will typically call this to do the error checking and
* update the various IsBound and DeletePending flags.
* Then, the driver will do its device-dependent Make-Current stuff.
*/
EGLBoolean
_eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface d, EGLSurface r, EGLContext context)
{
_EGLContext *ctx = _eglLookupContext(context);
_EGLSurface *draw = _eglLookupSurface(d);
_EGLSurface *read = _eglLookupSurface(r);
_EGLContext *oldContext = _eglGetCurrentContext();
_EGLSurface *oldDrawSurface = _eglGetCurrentSurface(EGL_DRAW);
_EGLSurface *oldReadSurface = _eglGetCurrentSurface(EGL_READ);
/* error checking */
if (ctx) {
if (draw == NULL || read == NULL) {
_eglError(EGL_BAD_MATCH, "eglMakeCurrent");
return EGL_FALSE;
}
if (draw->Config != ctx->Config) {
_eglError(EGL_BAD_MATCH, "eglMakeCurrent");
return EGL_FALSE;
}
if (read->Config != ctx->Config) {
_eglError(EGL_BAD_MATCH, "eglMakeCurrent");
return EGL_FALSE;
}
}
/*
* check if the old context or surfaces need to be deleted
*/
if (oldDrawSurface != NULL) {
oldDrawSurface->IsBound = EGL_FALSE;
if (oldDrawSurface->DeletePending) {
/* make sure we don't try to rebind a deleted surface */
if (draw == oldDrawSurface || draw == oldReadSurface) {
draw = NULL;
}
/* really delete surface now */
drv->DestroySurface(drv, dpy, oldDrawSurface->Handle);
}
}
if (oldReadSurface != NULL && oldReadSurface != oldDrawSurface) {
oldReadSurface->IsBound = EGL_FALSE;
if (oldReadSurface->DeletePending) {
/* make sure we don't try to rebind a deleted surface */
if (read == oldDrawSurface || read == oldReadSurface) {
read = NULL;
}
/* really delete surface now */
drv->DestroySurface(drv, dpy, oldReadSurface->Handle);
}
}
if (oldContext != NULL) {
oldContext->IsBound = EGL_FALSE;
if (oldContext->DeletePending) {
/* make sure we don't try to rebind a deleted context */
if (ctx == oldContext) {
ctx = NULL;
}
/* really delete context now */
drv->DestroyContext(drv, dpy, oldContext->Handle);
}
}
if (ctx) {
/* check read/draw again, in case we deleted them above */
if (draw == NULL || read == NULL) {
_eglError(EGL_BAD_MATCH, "eglMakeCurrent");
return EGL_FALSE;
}
ctx->DrawSurface = draw;
ctx->ReadSurface = read;
ctx->IsBound = EGL_TRUE;
draw->IsBound = EGL_TRUE;
read->IsBound = EGL_TRUE;
}
_eglGlobal.CurrentContext = ctx;
return EGL_TRUE;
}

64
src/egl/main/eglcontext.h Normal file
View File

@@ -0,0 +1,64 @@
#ifndef EGLCONTEXT_INCLUDED
#define EGLCONTEXT_INCLUDED
#include "egltypedefs.h"
/**
* "Base" class for device driver contexts.
*/
struct _egl_context
{
EGLContext Handle; /* The public/opaque handle which names this object */
_EGLDisplay *Display; /* who do I belong to? */
_EGLConfig *Config;
_EGLSurface *DrawSurface;
_EGLSurface *ReadSurface;
EGLBoolean IsBound;
EGLBoolean DeletePending;
};
extern void
_eglInitContext(_EGLContext *ctx);
extern void
_eglSaveContext(_EGLContext *ctx);
extern void
_eglRemoveContext(_EGLContext *ctx);
extern _EGLContext *
_eglLookupContext(EGLContext ctx);
extern _EGLContext *
_eglGetCurrentContext(void);
extern EGLContext
_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list);
extern EGLBoolean
_eglDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx);
extern EGLBoolean
_eglQueryContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
extern EGLBoolean
_eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
#endif /* EGLCONTEXT_INCLUDED */

71
src/egl/main/egldisplay.c Normal file
View File

@@ -0,0 +1,71 @@
#include <stdlib.h>
#include <string.h>
#include "eglcontext.h"
#include "egldisplay.h"
#include "eglglobals.h"
#include "eglhash.h"
static char *
my_strdup(const char *s)
{
int l = strlen(s);
char *s2 = malloc(l + 1);
strcpy(s2, s);
return s2;
}
/**
* We're assuming that the NativeDisplayType parameter is actually
* a string.
* Return a new _EGLDisplay object for the given displayName
*/
_EGLDisplay *
_eglNewDisplay(NativeDisplayType displayName)
{
_EGLDisplay *dpy = (_EGLDisplay *) malloc(sizeof(_EGLDisplay));
if (dpy) {
dpy->Handle = _eglHashGenKey(_eglGlobal.Displays);
_eglHashInsert(_eglGlobal.Displays, dpy->Handle, dpy);
if (displayName)
dpy->Name = my_strdup(displayName);
else
dpy->Name = NULL;
dpy->Driver = NULL; /* this gets set later */
}
return dpy;
}
/**
* Return the _EGLDisplay object that corresponds to the given public/
* opaque display handle.
*/
_EGLDisplay *
_eglLookupDisplay(EGLDisplay dpy)
{
_EGLDisplay *d = (_EGLDisplay *) _eglHashLookup(_eglGlobal.Displays, dpy);
return d;
}
_EGLDisplay *
_eglGetCurrentDisplay(void)
{
_EGLContext *ctx = _eglGetCurrentContext();
if (ctx)
return ctx->Display;
else
return NULL;
}
void
_eglDeleteDisplay(_EGLDisplay *disp)
{
/* XXX incomplete */
free(disp->Configs);
free(disp);
}

39
src/egl/main/egldisplay.h Normal file
View File

@@ -0,0 +1,39 @@
#ifndef EGLDISPLAY_INCLUDED
#define EGLDISPLAY_INCLUDED
#include "egltypedefs.h"
struct _egl_display
{
EGLDisplay Handle;
char *Name;
_EGLDriver *Driver;
EGLint NumScreens;
_EGLScreen **Screens; /* array [NumScreens] */
EGLint NumConfigs;
_EGLConfig *Configs; /* array [NumConfigs] */
};
extern _EGLDisplay *
_eglNewDisplay(NativeDisplayType displayName);
extern _EGLDisplay *
_eglLookupDisplay(EGLDisplay dpy);
extern _EGLDisplay *
_eglGetCurrentDisplay(void);
extern void
_eglDeleteDisplay(_EGLDisplay *disp);
#endif /* EGLDISPLAY_INCLUDED */

235
src/egl/main/egldriver.c Normal file
View File

@@ -0,0 +1,235 @@
#include <assert.h>
#include <dlfcn.h>
#include <stdio.h>
#include <string.h>
#include "eglconfig.h"
#include "eglcontext.h"
#include "egldisplay.h"
#include "egldriver.h"
#include "eglglobals.h"
#include "eglmode.h"
#include "eglscreen.h"
#include "eglsurface.h"
const char *DefaultDriverName = "demo";
/**
* Choose and open/init the hardware driver for the given EGLDisplay.
* Previously, the EGLDisplay was created with _eglNewDisplay() where
* we recorded the user's NativeDisplayType parameter.
*
* Now we'll use the NativeDisplayType value.
*
* Currently, the native display value is treated as a string.
* If the first character is ':' we interpret it as a screen or card index
* number (i.e. ":0" or ":1", etc)
* Else if the first character is '!' we interpret it as specific driver name
* (i.e. "!r200" or "!i830".
*/
_EGLDriver *
_eglChooseDriver(EGLDisplay display)
{
_EGLDisplay *dpy = _eglLookupDisplay(display);
_EGLDriver *drv;
const char *driverName = DefaultDriverName;
const char *name;
assert(dpy);
name = dpy->Name;
if (!name) {
/* use default */
}
else if (name[0] == ':' && (name[1] >= '0' && name[1] <= '9') && !name[2]) {
printf("EGL: Use driver for screen: %s\n", name);
/* XXX probe hardware here to determine which driver to open */
/* driverName = "something"; */
}
else if (name[0] == '!') {
/* use specified driver name */
driverName = name + 1;
printf("EGL: Use driver named %s\n", driverName);
}
else {
/* Maybe display was returned by XOpenDisplay? */
printf("EGL: can't parse display pointer\n");
}
drv = _eglOpenDriver(dpy, driverName);
dpy->Driver = drv;
return drv;
}
/**
* Open/load the named driver and call its bootstrap function: _eglMain().
* \return new _EGLDriver object.
*/
_EGLDriver *
_eglOpenDriver(_EGLDisplay *dpy, const char *driverName)
{
void *lib;
char driverFilename[1000];
/* XXX also prepend a directory path??? */
sprintf(driverFilename, "%sdriver.so", driverName);
#if 1
lib = dlopen(driverFilename, RTLD_NOW);
if (lib) {
_EGLDriver *drv;
_EGLMain_t mainFunc;
mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain");
if (!mainFunc) {
fprintf(stderr, "_eglMain not found in %s", (char *) driverFilename);
dlclose(lib);
return NULL;
}
drv = mainFunc(dpy);
if (!drv) {
dlclose(lib);
return NULL;
}
drv->LibHandle = lib;
drv->Display = dpy;
return drv;
}
else {
fprintf(stderr, "EGLdebug: Error opening %s: %s\n",
driverFilename, dlerror());
return NULL;
}
#else
/* use built-in driver */
return _eglDefaultMain(d);
#endif
}
EGLBoolean
_eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy)
{
void *handle = drv->LibHandle;
EGLBoolean b;
fprintf(stderr, "EGL debug: Closing driver\n");
/*
* XXX check for currently bound context/surfaces and delete them?
*/
b = drv->Terminate(drv, dpy);
dlclose(handle);
return b;
}
/**
* Given a display handle, return the _EGLDriver for that display.
*/
_EGLDriver *
_eglLookupDriver(EGLDisplay dpy)
{
_EGLDisplay *d = _eglLookupDisplay(dpy);
if (d)
return d->Driver;
else
return NULL;
}
/**
* Plug all the available fallback routines into the given driver's
* dispatch table.
*/
void
_eglInitDriverFallbacks(_EGLDriver *drv)
{
/* If a pointer is set to NULL, then the device driver _really_ has
* to implement it.
*/
drv->Initialize = NULL;
drv->Terminate = NULL;
drv->GetConfigs = _eglGetConfigs;
drv->ChooseConfig = _eglChooseConfig;
drv->GetConfigAttrib = _eglGetConfigAttrib;
drv->CreateContext = _eglCreateContext;
drv->DestroyContext = _eglDestroyContext;
drv->MakeCurrent = _eglMakeCurrent;
drv->QueryContext = _eglQueryContext;
drv->CreateWindowSurface = _eglCreateWindowSurface;
drv->CreatePixmapSurface = _eglCreatePixmapSurface;
drv->CreatePbufferSurface = _eglCreatePbufferSurface;
drv->DestroySurface = _eglDestroySurface;
drv->QuerySurface = _eglQuerySurface;
drv->SurfaceAttrib = _eglSurfaceAttrib;
drv->BindTexImage = _eglBindTexImage;
drv->ReleaseTexImage = _eglReleaseTexImage;
drv->SwapInterval = _eglSwapInterval;
drv->SwapBuffers = _eglSwapBuffers;
drv->CopyBuffers = _eglCopyBuffers;
drv->QueryString = _eglQueryString;
drv->WaitGL = _eglWaitGL;
drv->WaitNative = _eglWaitNative;
/* EGL_MESA_screen */
drv->ChooseModeMESA = _eglChooseModeMESA;
drv->GetModesMESA = _eglGetModesMESA;
drv->GetModeAttribMESA = _eglGetModeAttribMESA;
drv->GetScreensMESA = _eglGetScreensMESA;
drv->CreateScreenSurfaceMESA = _eglCreateScreenSurfaceMESA;
drv->ShowSurfaceMESA = _eglShowSurfaceMESA;
drv->ScreenPositionMESA = _eglScreenPositionMESA;
drv->QueryScreenMESA = _eglQueryScreenMESA;
drv->QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA;
drv->QueryScreenModeMESA = _eglQueryScreenModeMESA;
}
const char *
_eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name)
{
(void) drv;
(void) dpy;
switch (name) {
case EGL_VENDOR:
return "Mesa Project";
case EGL_VERSION:
return "1.0";
case EGL_EXTENSIONS:
return "";
default:
_eglError(EGL_BAD_PARAMETER, "eglQueryString");
return NULL;
}
}
EGLBoolean
_eglWaitGL(_EGLDriver *drv, EGLDisplay dpy)
{
/* just a placeholder */
(void) drv;
(void) dpy;
return EGL_TRUE;
}
EGLBoolean
_eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine)
{
/* just a placeholder */
(void) drv;
(void) dpy;
(void) engine;
return EGL_TRUE;
}

154
src/egl/main/egldriver.h Normal file
View File

@@ -0,0 +1,154 @@
#ifndef EGLDRIVER_INCLUDED
#define EGLDRIVER_INCLUDED
#include "egltypedefs.h"
/* driver funcs */
typedef EGLBoolean (*Initialize_t)(_EGLDriver *, EGLDisplay dpy, EGLint *major, EGLint *minor);
typedef EGLBoolean (*Terminate_t)(_EGLDriver *, EGLDisplay dpy);
/* config funcs */
typedef EGLBoolean (*GetConfigs_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
typedef EGLBoolean (*ChooseConfig_t)(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
typedef EGLBoolean (*GetConfigAttrib_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
/* context funcs */
typedef EGLContext (*CreateContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list);
typedef EGLBoolean (*DestroyContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx);
typedef EGLBoolean (*MakeCurrent_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
typedef EGLBoolean (*QueryContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
/* surface funcs */
typedef EGLSurface (*CreateWindowSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list);
typedef EGLSurface (*CreatePixmapSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list);
typedef EGLSurface (*CreatePbufferSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
typedef EGLBoolean (*DestroySurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface);
typedef EGLBoolean (*QuerySurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
typedef EGLBoolean (*SurfaceAttrib_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
typedef EGLBoolean (*BindTexImage_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer);
typedef EGLBoolean (*ReleaseTexImage_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer);
typedef EGLBoolean (*SwapInterval_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint interval);
typedef EGLBoolean (*SwapBuffers_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw);
typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, NativePixmapType target);
/* misc funcs */
typedef const char *(*QueryString_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint name);
typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, EGLDisplay dpy);
typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint engine);
/* EGL_MESA_screen extension */
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);
typedef EGLBoolean (*GetScreensMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
typedef EGLSurface (*CreateScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
typedef EGLBoolean (*ShowSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface);
typedef EGLBoolean (*ScreenPositionMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
typedef EGLBoolean (*QueryScreenMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
typedef EGLBoolean (*QueryScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
typedef EGLBoolean (*QueryScreenModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
/**
* Base class for device drivers.
*/
struct _egl_driver
{
EGLBoolean Initialized; /* set by driver after initialized */
void *LibHandle; /* dlopen handle */
_EGLDisplay *Display;
int ABIversion;
int APImajor, APIminor; /* returned through eglInitialize */
/*
* The API dispatcher jumps through these functions
*/
Initialize_t Initialize;
Terminate_t Terminate;
GetConfigs_t GetConfigs;
ChooseConfig_t ChooseConfig;
GetConfigAttrib_t GetConfigAttrib;
CreateContext_t CreateContext;
DestroyContext_t DestroyContext;
MakeCurrent_t MakeCurrent;
QueryContext_t QueryContext;
CreateWindowSurface_t CreateWindowSurface;
CreatePixmapSurface_t CreatePixmapSurface;
CreatePbufferSurface_t CreatePbufferSurface;
DestroySurface_t DestroySurface;
QuerySurface_t QuerySurface;
SurfaceAttrib_t SurfaceAttrib;
BindTexImage_t BindTexImage;
ReleaseTexImage_t ReleaseTexImage;
SwapInterval_t SwapInterval;
SwapBuffers_t SwapBuffers;
CopyBuffers_t CopyBuffers;
QueryString_t QueryString;
WaitGL_t WaitGL;
WaitNative_t WaitNative;
/* EGL_MESA_screen extension */
ChooseModeMESA_t ChooseModeMESA;
GetModesMESA_t GetModesMESA;
GetModeAttribMESA_t GetModeAttribMESA;
GetScreensMESA_t GetScreensMESA;
CreateScreenSurfaceMESA_t CreateScreenSurfaceMESA;
ShowSurfaceMESA_t ShowSurfaceMESA;
ScreenPositionMESA_t ScreenPositionMESA;
QueryScreenMESA_t QueryScreenMESA;
QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
QueryScreenModeMESA_t QueryScreenModeMESA;
};
extern _EGLDriver *
_eglDefaultMain(NativeDisplayType d);
extern _EGLDriver *
_eglChooseDriver(EGLDisplay dpy);
extern _EGLDriver *
_eglOpenDriver(_EGLDisplay *dpy, const char *driverName);
extern EGLBoolean
_eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy);
extern _EGLDriver *
_eglLookupDriver(EGLDisplay d);
extern void
_eglInitDriverFallbacks(_EGLDriver *drv);
extern const char *
_eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name);
extern EGLBoolean
_eglWaitGL(_EGLDriver *drv, EGLDisplay dpy);
extern EGLBoolean
_eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine);
#endif /* EGLDRIVER_INCLUDED */

65
src/egl/main/eglglobals.c Normal file
View File

@@ -0,0 +1,65 @@
#include <stdio.h>
#include "eglglobals.h"
struct _egl_global _eglGlobal = { EGL_FALSE };
/**
* Init the fields in the _eglGlobal struct
* May be safely called more than once.
*/
void
_eglInitGlobals(void)
{
if (!_eglGlobal.Initialized) {
_eglGlobal.Displays = _eglNewHashTable();
_eglGlobal.Contexts = _eglNewHashTable();
_eglGlobal.Surfaces = _eglNewHashTable();
_eglGlobal.FreeScreenHandle = 1;
_eglGlobal.CurrentContext = EGL_NO_CONTEXT;
_eglGlobal.LastError = EGL_SUCCESS;
_eglGlobal.Initialized = EGL_TRUE;
}
}
/**
* Should call this via an atexit handler.
*/
void
_eglDestroyGlobals(void)
{
/* XXX TODO walk over table entries, deleting each */
_eglDeleteHashTable(_eglGlobal.Displays);
_eglDeleteHashTable(_eglGlobal.Contexts);
_eglDeleteHashTable(_eglGlobal.Surfaces);
}
/**
* Record EGL error code.
*/
void
_eglError(EGLint errCode, const char *msg)
{
if (_eglGlobal.LastError == EGL_SUCCESS) {
_eglGlobal.LastError = errCode;
/* XXX temporary */
fprintf(stderr, "EGL Error 0x%x in %s\n", errCode, msg);
}
}
/**
* Return a new screen handle/ID.
* NOTE: we never reuse these!
*/
EGLScreenMESA
_eglAllocScreenHandle(void)
{
EGLScreenMESA s = _eglGlobal.FreeScreenHandle;
_eglGlobal.FreeScreenHandle++;
return s;
}

44
src/egl/main/eglglobals.h Normal file
View File

@@ -0,0 +1,44 @@
#ifndef EGLGLOBALS_INCLUDED
#define EGLGLOBALS_INCLUDED
#include "egltypedefs.h"
#include "eglhash.h"
struct _egl_global
{
EGLBoolean Initialized;
_EGLHashtable *Displays;
_EGLHashtable *Contexts;
_EGLHashtable *Surfaces;
EGLScreenMESA FreeScreenHandle;
EGLint LastError;
/* XXX this should be per-thread someday */
_EGLContext *CurrentContext;
};
extern struct _egl_global _eglGlobal;
extern void
_eglInitGlobals(void);
extern void
_eglDestroyGlobals(void);
extern void
_eglError(EGLint errCode, const char *msg);
extern EGLScreenMESA
_eglAllocScreenHandle(void);
#endif /* EGLGLOBALS_INCLUDED */

347
src/egl/main/eglhash.c Normal file
View File

@@ -0,0 +1,347 @@
/**
* \file hash.c
* Generic hash table.
*
* This code taken from Mesa and adapted.
*/
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include "eglhash.h"
#define TABLE_SIZE 1023 /**< Size of lookup table/array */
#define HASH_FUNC(K) ((K) % TABLE_SIZE)
/*
* Unfinished mutex stuff
*/
typedef int _EGLMutex;
static void
_eglInitMutex(_EGLMutex m)
{
}
static void
_eglDestroyMutex(_EGLMutex m)
{
}
static void
_eglLockMutex(_EGLMutex m)
{
}
static void
_eglUnlockMutex(_EGLMutex m)
{
}
typedef struct _egl_hashentry _EGLHashentry;
struct _egl_hashentry
{
EGLuint Key; /**< the entry's key */
void *Data; /**< the entry's data */
_EGLHashentry *Next; /**< pointer to next entry */
};
struct _egl_hashtable
{
_EGLHashentry *Table[TABLE_SIZE]; /**< the lookup table */
EGLuint MaxKey; /**< highest key inserted so far */
_EGLMutex Mutex; /**< mutual exclusion lock */
};
/**
* Create a new hash table.
*
* \return pointer to a new, empty hash table.
*/
_EGLHashtable *
_eglNewHashTable(void)
{
_EGLHashtable *table = (_EGLHashtable *) calloc(1, sizeof(_EGLHashtable));
if (table) {
_eglInitMutex(table->Mutex);
table->MaxKey = 1;
}
return table;
}
/**
* Delete a hash table.
* Frees each entry on the hash table and then the hash table structure itself.
* Note that the caller should have already traversed the table and deleted
* the objects in the table (i.e. We don't free the entries' data pointer).
*
* \param table the hash table to delete.
*/
void
_eglDeleteHashTable(_EGLHashtable *table)
{
EGLuint i;
assert(table);
for (i = 0; i < TABLE_SIZE; i++) {
_EGLHashentry *entry = table->Table[i];
while (entry) {
_EGLHashentry *next = entry->Next;
free(entry);
entry = next;
}
}
_eglDestroyMutex(table->Mutex);
free(table);
}
/**
* Lookup an entry in the hash table.
*
* \param table the hash table.
* \param key the key.
*
* \return pointer to user's data or NULL if key not in table
*/
void *
_eglHashLookup(const _EGLHashtable *table, EGLuint key)
{
EGLuint pos;
const _EGLHashentry *entry;
assert(table);
if (!key)
return NULL;
pos = HASH_FUNC(key);
entry = table->Table[pos];
while (entry) {
if (entry->Key == key) {
return entry->Data;
}
entry = entry->Next;
}
return NULL;
}
/**
* Insert a key/pointer pair into the hash table.
* If an entry with this key already exists we'll replace the existing entry.
*
* \param table the hash table.
* \param key the key (not zero).
* \param data pointer to user data.
*/
void
_eglHashInsert(_EGLHashtable *table, EGLuint key, void *data)
{
/* search for existing entry with this key */
EGLuint pos;
_EGLHashentry *entry;
assert(table);
assert(key);
_eglLockMutex(table->Mutex);
if (key > table->MaxKey)
table->MaxKey = key;
pos = HASH_FUNC(key);
entry = table->Table[pos];
while (entry) {
if (entry->Key == key) {
/* replace entry's data */
entry->Data = data;
_eglUnlockMutex(table->Mutex);
return;
}
entry = entry->Next;
}
/* alloc and insert new table entry */
entry = (_EGLHashentry *) malloc(sizeof(_EGLHashentry));
entry->Key = key;
entry->Data = data;
entry->Next = table->Table[pos];
table->Table[pos] = entry;
_eglUnlockMutex(table->Mutex);
}
/**
* Remove an entry from the hash table.
*
* \param table the hash table.
* \param key key of entry to remove.
*
* While holding the hash table's lock, searches the entry with the matching
* key and unlinks it.
*/
void
_eglHashRemove(_EGLHashtable *table, EGLuint key)
{
EGLuint pos;
_EGLHashentry *entry, *prev;
assert(table);
assert(key);
_eglLockMutex(table->Mutex);
pos = HASH_FUNC(key);
prev = NULL;
entry = table->Table[pos];
while (entry) {
if (entry->Key == key) {
/* found it! */
if (prev) {
prev->Next = entry->Next;
}
else {
table->Table[pos] = entry->Next;
}
free(entry);
_eglUnlockMutex(table->Mutex);
return;
}
prev = entry;
entry = entry->Next;
}
_eglUnlockMutex(table->Mutex);
}
/**
* Get the key of the "first" entry in the hash table.
*
* This is used in the course of deleting all display lists when
* a context is destroyed.
*
* \param table the hash table
*
* \return key for the "first" entry in the hash table.
*
* While holding the lock, walks through all table positions until finding
* the first entry of the first non-empty one.
*/
EGLuint
_eglHashFirstEntry(_EGLHashtable *table)
{
EGLuint pos;
assert(table);
_eglLockMutex(table->Mutex);
for (pos = 0; pos < TABLE_SIZE; pos++) {
if (table->Table[pos]) {
_eglUnlockMutex(table->Mutex);
return table->Table[pos]->Key;
}
}
_eglUnlockMutex(table->Mutex);
return 0;
}
/**
* Given a hash table key, return the next key. This is used to walk
* over all entries in the table. Note that the keys returned during
* walking won't be in any particular order.
* \return next hash key or 0 if end of table.
*/
EGLuint
_eglHashNextEntry(const _EGLHashtable *table, EGLuint key)
{
const _EGLHashentry *entry;
EGLuint pos;
assert(table);
assert(key);
/* Find the entry with given key */
pos = HASH_FUNC(key);
entry = table->Table[pos];
while (entry) {
if (entry->Key == key) {
break;
}
entry = entry->Next;
}
if (!entry) {
/* the key was not found, we can't find next entry */
return 0;
}
if (entry->Next) {
/* return next in linked list */
return entry->Next->Key;
}
else {
/* look for next non-empty table slot */
pos++;
while (pos < TABLE_SIZE) {
if (table->Table[pos]) {
return table->Table[pos]->Key;
}
pos++;
}
return 0;
}
}
/**
* Dump contents of hash table for debugging.
*
* \param table the hash table.
*/
void
_eglHashPrint(const _EGLHashtable *table)
{
EGLuint i;
assert(table);
for (i = 0; i < TABLE_SIZE; i++) {
const _EGLHashentry *entry = table->Table[i];
while (entry) {
printf("%u %p\n", entry->Key, entry->Data);
entry = entry->Next;
}
}
}
/**
* Return a new, unused hash key.
*/
EGLuint
_eglHashGenKey(_EGLHashtable *table)
{
EGLuint k;
_eglLockMutex(table->Mutex);
k = table->MaxKey;
table->MaxKey++;
_eglUnlockMutex(table->Mutex);
return k;
}

39
src/egl/main/eglhash.h Normal file
View File

@@ -0,0 +1,39 @@
/**
* \file eglhash.h
* Generic hash table.
*/
#ifndef EGLHASH_INCLUDED
#define EGLHASH_INCLUDED
/* XXX move this? */
typedef unsigned int EGLuint;
typedef struct _egl_hashtable _EGLHashtable;
extern _EGLHashtable *_eglNewHashTable(void);
extern void _eglDeleteHashTable(_EGLHashtable *table);
extern void *_eglHashLookup(const _EGLHashtable *table, EGLuint key);
extern void _eglHashInsert(_EGLHashtable *table, EGLuint key, void *data);
extern void _eglHashRemove(_EGLHashtable *table, EGLuint key);
extern EGLuint _eglHashFirstEntry(_EGLHashtable *table);
extern EGLuint _eglHashNextEntry(const _EGLHashtable *table, EGLuint key);
extern void _eglHashPrint(const _EGLHashtable *table);
extern EGLuint _eglHashGenKey(_EGLHashtable *table);
extern void _egltest_hash_functions(void);
#endif /* EGLHASH_INCLUDED */

178
src/egl/main/eglmode.c Normal file
View File

@@ -0,0 +1,178 @@
#include <assert.h>
#include <stdlib.h>
#include "egldisplay.h"
#include "egldriver.h"
#include "eglmode.h"
#include "eglglobals.h"
#include "eglscreen.h"
#define MIN2(A, B) (((A) < (B)) ? (A) : (B))
/**
* Given an EGLModeMESA handle, return the corresponding _EGLMode object
* or null if non-existant.
*/
_EGLMode *
_eglLookupMode(EGLDisplay dpy, EGLModeMESA mode)
{
const _EGLDisplay *disp = _eglLookupDisplay(dpy);
EGLint scrnum;
/* loop over all screens on the display */
for (scrnum = 0; scrnum < disp->NumScreens; scrnum++) {
const _EGLScreen *scrn = disp->Screens[scrnum];
EGLint i;
/* search list of modes for handle */
for (i = 0; i < scrn->NumModes; i++) {
if (scrn->Modes[i].Handle == mode) {
return scrn->Modes + i;
}
}
}
return NULL;
}
/**
* Add a new mode with the given attributes (width, height, depth, refreshRate)
* to the given screen.
* Assign a new mode ID/handle to the mode as well.
* \return pointer to the new _EGLMode
*/
_EGLMode *
_eglAddMode(_EGLScreen *screen, EGLint width, EGLint height,
EGLint depth, EGLint refreshRate)
{
EGLint n;
_EGLMode *newModes;
assert(screen);
assert(width > 0);
assert(height > 0);
assert(depth > 0);
assert(refreshRate > 0);
n = screen->NumModes;
newModes = (_EGLMode *) realloc(screen->Modes, (n+1) * sizeof(_EGLMode));
if (newModes) {
screen->Modes = newModes;
screen->Modes[n].Handle = n + 1;
screen->Modes[n].Width = width;
screen->Modes[n].Height = height;
screen->Modes[n].Depth = depth;
screen->Modes[n].RefreshRate = refreshRate;
screen->Modes[n].Stereo = EGL_FALSE;
screen->NumModes++;
return screen->Modes + n;
}
else {
return NULL;
}
}
/**
* Search for the EGLMode that best matches the given attribute list.
*/
EGLBoolean
_eglChooseModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
const EGLint *attrib_list, EGLModeMESA *modes,
EGLint modes_size, EGLint *num_modes)
{
EGLint i;
/* XXX incomplete */
for (i = 0; attrib_list[i] != EGL_NONE; i++) {
switch (attrib_list[i]) {
case EGL_WIDTH:
i++;
break;
case EGL_HEIGHT:
i++;
break;
case EGL_REFRESH_RATE_MESA:
i++;
break;
#if 0
case EGL_STEREO_MESA:
i++;
break;
#endif
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglChooseMode");
return EGL_FALSE;
}
}
return EGL_TRUE;
}
/**
* Return all possible modes for the given screen
*/
EGLBoolean
_eglGetModesMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes)
{
_EGLScreen *scrn = _eglLookupScreen(dpy, screen);
EGLint i;
if (!scrn) {
_eglError(EGL_BAD_SCREEN_MESA, "eglGetModes");
return EGL_FALSE;
}
*num_modes = MIN2(modes_size, scrn->NumModes);
for (i = 0; i < *num_modes; i++) {
modes[i] = scrn->Modes[i].Handle;
}
return EGL_TRUE;
}
/**
* Query an attribute of a mode.
*/
EGLBoolean
_eglGetModeAttribMESA(_EGLDriver *drv, EGLDisplay dpy,
EGLModeMESA mode, EGLint attribute, EGLint *value)
{
_EGLMode *m = _eglLookupMode(dpy, mode);
switch (attribute) {
case EGL_MODE_ID_MESA:
*value = m->Handle;
break;
case EGL_WIDTH:
*value = m->Width;
break;
case EGL_HEIGHT:
*value = m->Height;
break;
#if 0
case EGL_DEPTH_MESA:
*value = m->Depth;
break;
#endif
case EGL_REFRESH_RATE_MESA:
*value = m->RefreshRate;
break;
#if 0
case EGL_STEREO_MESA:
*value = m->Stereo;
break;
#endif
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglGetModeAttrib");
return EGL_FALSE;
}
return EGL_TRUE;
}

50
src/egl/main/eglmode.h Normal file
View File

@@ -0,0 +1,50 @@
#ifndef EGLMODE_INCLUDED
#define EGLMODE_INCLUDED
#include "egltypedefs.h"
/**
* Data structure which corresponds to an EGLModeMESA.
*/
struct _egl_mode
{
EGLModeMESA Handle; /* the public/opaque handle which names this mode */
EGLint Width, Height; /* size in pixels */
EGLint Depth; /* bits per pixel */
EGLint RefreshRate; /* rate * 1000.0 */
EGLBoolean Stereo;
/* Other possible attributes */
/* interlaced */
/* external sync */
};
extern _EGLMode *
_eglLookupMode(EGLDisplay dpy, EGLModeMESA mode);
extern _EGLMode *
_eglAddMode(_EGLScreen *screen, EGLint width, EGLint height,
EGLint depth, EGLint refreshRate);
extern EGLBoolean
_eglChooseModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
const EGLint *attrib_list, EGLModeMESA *modes,
EGLint modes_size, EGLint *num_modes);
extern EGLBoolean
_eglGetModesMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
extern EGLBoolean
_eglGetModeAttribMESA(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode,
EGLint attribute, EGLint *value);
#endif /* EGLMODE_INCLUDED */

309
src/egl/main/eglscreen.c Normal file
View File

@@ -0,0 +1,309 @@
/*
* Ideas for screen management extension to EGL.
*
* Each EGLDisplay has one or more screens (CRTs, Flat Panels, etc).
* The screens' handles can be obtained with eglGetScreensMESA().
*
* A new kind of EGLSurface is possible- one which can be directly scanned
* out on a screen. Such a surface is created with eglCreateScreenSurface().
*
* To actually display a screen surface on a screen, the eglShowSurface()
* function is called.
*/
#include <assert.h>
#include <stdlib.h>
#include "egldisplay.h"
#include "eglglobals.h"
#include "eglmode.h"
#include "eglsurface.h"
#include "eglscreen.h"
/**
* Return a new _EGLScreen object.
*/
_EGLScreen *
_eglNewScreen(void)
{
return (_EGLScreen *) calloc(1, sizeof(_EGLScreen));
}
/**
* Given a public screen handle, return the internal _EGLScreen object.
*/
_EGLScreen *
_eglLookupScreen(EGLDisplay dpy, EGLScreenMESA screen)
{
EGLint i;
_EGLDisplay *display = _eglLookupDisplay(dpy);
if (!display)
return NULL;
for (i = 0; i < display->NumScreens; i++) {
if (display->Screens[i]->Handle == screen)
return display->Screens[i];
}
return NULL;
}
/**
* Add the given _EGLScreen to the display's list of screens.
*/
void
_eglAddScreen(_EGLDisplay *display, _EGLScreen *screen)
{
EGLint n;
assert(display);
assert(screen);
screen->Handle = _eglAllocScreenHandle();
n = display->NumScreens;
display->Screens = realloc(display->Screens, (n+1) * sizeof(_EGLScreen *));
display->Screens[n] = screen;
display->NumScreens++;
}
EGLBoolean
_eglGetScreensMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens,
EGLint max_screens, EGLint *num_screens)
{
_EGLDisplay *display = _eglLookupDisplay(dpy);
EGLint n;
if (!display) {
_eglError(EGL_BAD_DISPLAY, "eglGetScreensMESA");
return EGL_FALSE;
}
if (display->NumScreens > max_screens) {
n = max_screens;
}
else {
n = display->NumScreens;
}
if (screens) {
EGLint i;
for (i = 0; i < n; i++)
screens[i] = display->Screens[i]->Handle;
}
if (num_screens)
*num_screens = n;
return EGL_TRUE;
}
/**
* Create a drawing surface which can be directly displayed on a screen.
*/
EGLSurface
_eglCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
const EGLint *attrib_list)
{
_EGLSurface *surf;
EGLint width = 0, height = 0;
EGLint i;
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
switch (attrib_list[i]) {
case EGL_WIDTH:
width = attrib_list[++i];
break;
case EGL_HEIGHT:
height = attrib_list[++i];
break;
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglCreateScreenSurfaceMESA");
return EGL_NO_SURFACE;
}
}
if (width <= 0 || height <= 0) {
_eglError(EGL_BAD_ATTRIBUTE,
"eglCreateScreenSurfaceMESA(width or height)");
return EGL_NO_SURFACE;
}
surf = (_EGLSurface *) malloc(sizeof(_EGLSurface));
_eglInitSurface(surf);
surf->Width = width;
surf->Height = height;
surf->Type = EGL_SCREEN_BIT_MESA;
/* insert into hash table */
_eglSaveSurface(surf);
assert(surf->Handle);
return surf->Handle;
}
/**
* Show the given surface on the named screen.
* If surface is EGL_NO_SURFACE, disable the screen's output.
*
* This is just a placeholder function; drivers will always override
* this with code that _really_ shows the surface.
*/
EGLBoolean
_eglShowSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
EGLSurface surface)
{
_EGLScreen *scrn = _eglLookupScreen(dpy, screen);
_EGLMode *mode;
if (!scrn) {
_eglError(EGL_BAD_SCREEN_MESA, "eglShowSurfaceMESA");
return EGL_FALSE;
}
/*
* XXX: Check if the surface's configuration is compatible with the
* current screen mode.
*/
mode = scrn->CurrentMode;
if (mode == EGL_NO_MODE_MESA) {
_eglError(EGL_BAD_MODE_MESA, "eglShowSurfaceMESA(no current mode)");
return EGL_FALSE;
}
if (surface == EGL_NO_SURFACE) {
scrn->CurrentSurface = NULL;
}
else {
_EGLSurface *surf = _eglLookupSurface(surface);
if (!surf || surf->Type != EGL_SCREEN_BIT_MESA) {
_eglError(EGL_BAD_SURFACE, "eglShowSurfaceMESA");
return EGL_FALSE;
}
if (surf->Width < mode->Width || surf->Height < mode->Height) {
_eglError(EGL_BAD_SURFACE,
"eglShowSurfaceMESA(surface smaller than screen size)");
return EGL_FALSE;
}
scrn->CurrentSurface = surf;
}
return EGL_TRUE;
}
/**
* Set a screen's current display mode.
* Note: mode = EGL_NO_MODE is valid (turns off the screen)
*
* This is just a placeholder function; drivers will always override
* this with code that _really_ sets the mode.
*/
EGLBoolean
_eglScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
EGLModeMESA mode)
{
_EGLScreen *scrn = _eglLookupScreen(dpy, screen);
if (!scrn) {
_eglError(EGL_BAD_SCREEN_MESA, "eglScreenModeMESA");
return EGL_FALSE;
}
scrn->CurrentMode = _eglLookupMode(dpy, mode);
return EGL_TRUE;
}
/**
* Set a screen's surface origin.
*/
EGLBoolean
_eglScreenPositionMESA(_EGLDriver *drv, EGLDisplay dpy,
EGLScreenMESA screen, EGLint x, EGLint y)
{
_EGLScreen *scrn = _eglLookupScreen(dpy, screen);
if (!scrn) {
_eglError(EGL_BAD_SCREEN_MESA, "eglScreenPositionMESA");
return EGL_FALSE;
}
scrn->OriginX = x;
scrn->OriginY = y;
return EGL_TRUE;
}
/**
* Query a screen's current surface.
*/
EGLBoolean
_eglQueryScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy,
EGLScreenMESA screen, EGLSurface *surface)
{
const _EGLScreen *scrn = _eglLookupScreen(dpy, screen);
if (scrn->CurrentSurface)
*surface = scrn->CurrentSurface->Handle;
else
*surface = EGL_NO_SURFACE;
return EGL_TRUE;
}
/**
* Query a screen's current mode.
*/
EGLBoolean
_eglQueryScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
EGLModeMESA *mode)
{
const _EGLScreen *scrn = _eglLookupScreen(dpy, screen);
if (scrn->CurrentMode)
*mode = scrn->CurrentMode->Handle;
else
*mode = EGL_NO_MODE_MESA;
return EGL_TRUE;
}
EGLBoolean
_eglQueryScreenMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
EGLint attribute, EGLint *value)
{
const _EGLScreen *scrn = _eglLookupScreen(dpy, screen);
if (!scrn) {
_eglError(EGL_BAD_SCREEN_MESA, "eglQueryScreenMESA");
return EGL_FALSE;
}
switch (attribute) {
case EGL_SCREEN_POSITION_MESA:
value[0] = scrn->OriginX;
value[1] = scrn->OriginY;
break;
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglQueryScreenMESA");
return EGL_FALSE;
}
return EGL_TRUE;
}
void
_eglDeleteScreen(_EGLScreen *scrn)
{
free(scrn->Modes);
free(scrn);
}

75
src/egl/main/eglscreen.h Normal file
View File

@@ -0,0 +1,75 @@
#ifndef EGLSCREEN_INCLUDED
#define EGLSCREEN_INCLUDED
/* NOTE: there is no public EGLScreen type, we refers to screens with
* an integer.
*/
struct _egl_screen
{
EGLScreenMESA Handle; /* The public/opaque handle which names this object */
_EGLMode *CurrentMode;
_EGLSurface *CurrentSurface;
EGLint OriginX, OriginY;
EGLint NumModes;
_EGLMode *Modes; /* array [NumModes] */
};
extern _EGLScreen *
_eglNewScreen(void);
extern _EGLScreen *
_eglLookupScreen(EGLDisplay dpy, EGLScreenMESA screen);
extern void
_eglAddScreen(_EGLDisplay *display, _EGLScreen *screen);
extern EGLBoolean
_eglGetScreensMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
extern EGLSurface
_eglCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
extern EGLBoolean
_eglShowSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface);
extern EGLBoolean
_eglScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA mode);
extern EGLBoolean
_eglScreenPositionMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
extern EGLBoolean
_eglQueryDisplayMESA(_EGLDriver *drv, EGLDisplay dpy, EGLint attribute, EGLint *value);
extern EGLBoolean
_eglQueryScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy,
EGLScreenMESA screen, EGLSurface *surface);
extern EGLBoolean
_eglQueryScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
extern EGLBoolean
_eglQueryScreenMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
extern void
_eglDeleteScreen(_EGLScreen *scrn);
#endif /* EGLSCREEN_INCLUDED */

246
src/egl/main/eglsurface.c Normal file
View File

@@ -0,0 +1,246 @@
/**
* Surface-related functions.
*
* See the eglcontext.c file for comments that also apply here.
*/
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "eglcontext.h"
#include "eglconfig.h"
#include "eglsurface.h"
#include "eglglobals.h"
#include "eglhash.h"
void
_eglInitSurface(_EGLSurface *surf)
{
/* XXX fix this up */
memset(surf, 0, sizeof(_EGLSurface));
}
void
_eglSaveSurface(_EGLSurface *surf)
{
assert(surf);
surf->Handle = _eglHashGenKey(_eglGlobal.Contexts);
_eglHashInsert(_eglGlobal.Surfaces, surf->Handle, surf);
}
void
_eglRemoveSurface(_EGLSurface *surf)
{
_eglHashRemove(_eglGlobal.Surfaces, surf->Handle);
}
_EGLSurface *
_eglLookupSurface(EGLSurface surf)
{
_EGLSurface *c = (_EGLSurface *) _eglHashLookup(_eglGlobal.Surfaces, surf);
return c;
}
_EGLSurface *
_eglGetCurrentSurface(EGLint readdraw)
{
_EGLContext *ctx = _eglGetCurrentContext();
if (ctx) {
switch (readdraw) {
case EGL_DRAW:
return ctx->DrawSurface;
case EGL_READ:
return ctx->ReadSurface;
default:
return NULL;
}
}
return NULL;
}
EGLBoolean
_eglSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
{
/* Basically just do error checking */
_EGLContext *context = _eglGetCurrentContext();
_EGLSurface *surface = _eglLookupSurface(draw);
if (context && context->DrawSurface != surface) {
_eglError(EGL_BAD_SURFACE, "eglSwapBuffers");
return EGL_FALSE;
}
if (surface == NULL) {
_eglError(EGL_BAD_SURFACE, "eglSwapBuffers");
return EGL_FALSE;
}
return EGL_TRUE;
}
EGLBoolean
_eglCopyBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, NativePixmapType target)
{
/* XXX unfinished */
return EGL_FALSE;
}
EGLBoolean
_eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf, EGLint attribute, EGLint *value)
{
_EGLSurface *surface = _eglLookupSurface(surf);
if (surface == NULL) {
_eglError(EGL_BAD_SURFACE, "eglQuerySurface");
return EGL_FALSE;
}
switch (attribute) {
case EGL_WIDTH:
*value = surface->Width;
return EGL_TRUE;
case EGL_HEIGHT:
*value = surface->Height;
return EGL_TRUE;
case EGL_CONFIG_ID:
*value = GET_CONFIG_ATTRIB(surface->Config, EGL_CONFIG_ID);
return EGL_TRUE;
case EGL_TEXTURE_FORMAT:
/* texture attributes: only for pbuffers, no error otherwise */
if (surface->Type == EGL_PBUFFER_BIT)
*value = surface->TextureFormat;
return EGL_TRUE;
case EGL_TEXTURE_TARGET:
if (surface->Type == EGL_PBUFFER_BIT)
*value = surface->TextureTarget;
return EGL_TRUE;
case EGL_MIPMAP_TEXTURE:
if (surface->Type == EGL_PBUFFER_BIT)
*value = surface->MipmapTexture;
return EGL_TRUE;
case EGL_MIPMAP_LEVEL:
if (surface->Type == EGL_PBUFFER_BIT)
*value = surface->MipmapLevel;
return EGL_TRUE;
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
return EGL_FALSE;
}
}
/**
* Default fallback routine - drivers should usually override this.
*/
EGLSurface
_eglCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list)
{
/* nothing - just a placeholder */
return EGL_NO_SURFACE;
}
/**
* Default fallback routine - drivers should usually override this.
*/
EGLSurface
_eglCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list)
{
/* nothing - just a placeholder */
return EGL_NO_SURFACE;
}
/**
* Default fallback routine - drivers should usually override this.
*/
EGLSurface
_eglCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
{
/* nothing - just a placeholder */
return EGL_NO_SURFACE;
}
/**
* Default fallback routine - drivers should usually override this.
*/
EGLBoolean
_eglDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
{
_EGLSurface *surf = _eglLookupSurface(surface);
if (surf) {
_eglHashRemove(_eglGlobal.Surfaces, surface);
if (surf->IsBound) {
surf->DeletePending = EGL_TRUE;
}
else {
free(surf);
}
return EGL_TRUE;
}
else {
_eglError(EGL_BAD_SURFACE, "eglDestroySurface");
return EGL_FALSE;
}
}
/**
* Default fallback routine - drivers might override this.
*/
EGLBoolean
_eglSurfaceAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf, EGLint attribute, EGLint value)
{
_EGLSurface *surface = _eglLookupSurface(surf);
if (surface == NULL) {
_eglError(EGL_BAD_SURFACE, "eglSurfaceAttrib");
return EGL_FALSE;
}
switch (attribute) {
case EGL_MIPMAP_LEVEL:
surface->MipmapLevel = value;
break;
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglSurfaceAttrib");
return EGL_FALSE;
}
return EGL_TRUE;
}
EGLBoolean
_eglBindTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
/* XXX unfinished */
return EGL_FALSE;
}
EGLBoolean
_eglReleaseTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
/* XXX unfinished */
return EGL_FALSE;
}
EGLBoolean
_eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval)
{
_EGLSurface *surf = _eglGetCurrentSurface(EGL_DRAW);
if (surf == NULL) {
_eglError(EGL_BAD_SURFACE, "eglSwapInterval");
return EGL_FALSE;
}
surf->SwapInterval = interval;
return EGL_TRUE;
}

96
src/egl/main/eglsurface.h Normal file
View File

@@ -0,0 +1,96 @@
#ifndef EGLSURFACE_INCLUDED
#define EGLSURFACE_INCLUDED
#include "egltypedefs.h"
/**
* "Base" class for device driver surfaces.
*/
struct _egl_surface
{
EGLSurface Handle; /* The public/opaque handle which names this object */
_EGLConfig *Config;
/* May need reference counting here */
EGLBoolean IsBound;
EGLBoolean DeletePending;
EGLint Type; /* one of EGL_WINDOW_BIT, EGL_PIXMAP_BIT or EGL_PBUFFER_BIT */
EGLint Width, Height;
EGLint TextureFormat, TextureTarget;
EGLint MipmapTexture, MipmapLevel;
EGLint SwapInterval;
/* If type == EGL_SCREEN_BIT: */
EGLint VisibleRefCount; /* number of screens I'm displayed on */
};
extern void
_eglInitSurface(_EGLSurface *surf);
extern void
_eglSaveSurface(_EGLSurface *surf);
extern void
_eglRemoveSurface(_EGLSurface *surf);
extern _EGLSurface *
_eglLookupSurface(EGLSurface surf);
extern _EGLSurface *
_eglGetCurrentSurface(EGLint readdraw);
extern EGLBoolean
_eglSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw);
extern EGLBoolean
_eglCopyBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, NativePixmapType target);
extern EGLBoolean
_eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
extern EGLSurface
_eglCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list);
extern EGLSurface
_eglCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list);
extern EGLSurface
_eglCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
extern EGLBoolean
_eglDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface);
extern EGLBoolean
_eglSurfaceAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
extern EGLBoolean
_eglBindTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer);
extern EGLBoolean
_eglReleaseTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer);
extern EGLBoolean
_eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval);
#endif /* EGLSURFACE_INCLUDED */

View File

@@ -0,0 +1,28 @@
#ifndef EGLTYPEDEFS_INCLUDED
#define EGLTYPEDEFS_INCLUDED
#include <GLES/egl.h>
typedef struct _egl_config _EGLConfig;
typedef struct _egl_context _EGLContext;
typedef struct _egl_display _EGLDisplay;
typedef struct _egl_driver _EGLDriver;
typedef struct _egl_mode _EGLMode;
typedef struct _egl_screen _EGLScreen;
typedef struct _egl_surface _EGLSurface;
typedef void (*_EGLProc)();
typedef _EGLDriver *(*_EGLMain_t)(_EGLDisplay *dpy);
#endif /* EGLTYPEDEFS_INCLUDED */

View File

@@ -86,6 +86,9 @@ default: depend $(LIB_DIR)/$(GL_LIB_NAME)
glcontextmodes.c:
ln -s $(TOP)/src/mesa/drivers/dri/common/glcontextmodes.c .
dispatch.c:
ln -s $(TOP)/src/mesa/main/dispatch.c .
# Make libGL
$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile
CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(GL_LIB) -major 1 -minor 2 $(MKLIB_OPTIONS) \

View File

@@ -36,6 +36,7 @@
#include <assert.h>
#include "glxclient.h"
#include "indirect.h"
#include "indirect_vertex_array.h"
/*****************************************************************************/

View File

@@ -1,74 +0,0 @@
/* $XFree86: xc/lib/GL/glx/dispatch.c,v 1.5 2003/06/30 01:45:10 torrey Exp $ */
/**************************************************************************
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.
**************************************************************************/
/*
* Authors:
* Brian Paul <brian@precisioninsight.com>
*
*/
#ifndef GLX_USE_APPLEGL
#include <GL/gl.h>
#include "glheader.h"
#include "glapi.h"
#include "glapitable.h"
/*
* NOTE: this file implements C-based dispatch of the OpenGL entrypoints
* (glAccum, glBegin, etc).
* This code IS NOT USED if we're compiling on an x86 system and using
* the glapi_x86.S assembly code.
*/
#if !(defined(USE_X86_ASM) || defined(USE_SPARC_ASM))
#define KEYWORD1 PUBLIC
#define KEYWORD2
#define NAME(func) gl##func
#define DISPATCH(func, args, msg) \
const struct _glapi_table *dispatch; \
dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
(dispatch->func) args
#define RETURN_DISPATCH(func, args, msg) \
const struct _glapi_table *dispatch; \
dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
return (dispatch->func) args
#include "glapitemp.h"
#endif /* USE_X86_ASM */
#endif /* !GLX_USE_APPLEGL */

View File

@@ -222,6 +222,15 @@ static __DRIdriver *OpenDriver(const char *driverName)
void *handle = NULL;
/* If TLS support is enabled, try to open the TLS version of the driver
* binary first. If that fails, try the non-TLS version.
*/
#ifdef GLX_USE_TLS
snprintf(realDriverName, 200, "%s/tls/%s_dri.so", libDir, driverName);
InfoMessageF("OpenDriver: trying %s\n", realDriverName);
handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
#endif
if ( handle == NULL ) {
snprintf(realDriverName, 200, "%s/%s_dri.so", libDir, driverName);
InfoMessageF("OpenDriver: trying %s\n", realDriverName);

View File

@@ -34,6 +34,7 @@
#include "packrender.h"
#include "packsingle.h"
#include "indirect.h"
#include <assert.h>

View File

@@ -60,8 +60,10 @@
#include "GL/internal/glcore.h"
#include "glapitable.h"
#include "glxextensions.h"
#ifdef XTHREADS
#include "Xthreads.h"
#if defined( XTHREADS )
# include "Xthreads.h"
#elif defined( PTHREADS )
# include <pthread.h>
#endif
#ifdef GLX_BUILT_IN_XMESA
#include "realglx.h" /* just silences prototype warnings */
@@ -625,24 +627,44 @@ extern __GLXdisplayPrivate *__glXInitialize(Display*);
extern int __glXDebug;
/* This is per-thread storage in an MT environment */
#if defined(GLX_DIRECT_RENDERING) && defined(XTHREADS)
extern __GLXcontext *__glXGetCurrentContext(void);
#if defined( XTHREADS ) || defined( PTHREADS )
extern void __glXSetCurrentContext(__GLXcontext *c);
# if defined( GLX_USE_TLS )
extern __thread void * __glX_tls_Context
__attribute__((tls_model("initial-exec")));
# define __glXGetCurrentContext() __glX_tls_Context
# else
extern __GLXcontext *__glXGetCurrentContext(void);
# endif /* defined( GLX_USE_TLS ) */
#else
extern __GLXcontext *__glXcurrentContext;
#define __glXGetCurrentContext() __glXcurrentContext
#define __glXSetCurrentContext(gc) __glXcurrentContext = gc
#endif
#endif /* defined( XTHREADS ) || defined( PTHREADS ) */
/*
** Global lock for all threads in this address space using the GLX
** extension
*/
#if defined(GLX_DIRECT_RENDERING) && defined(XTHREADS)
#if defined( XTHREADS )
extern xmutex_rec __glXmutex;
#define __glXLock() xmutex_lock(&__glXmutex)
#define __glXUnlock() xmutex_unlock(&__glXmutex)
#elif defined( PTHREADS )
extern pthread_mutex_t __glXmutex;
#define __glXLock() pthread_mutex_lock(&__glXmutex)
#define __glXUnlock() pthread_mutex_unlock(&__glXmutex)
#else
#define __glXLock()
#define __glXUnlock()

View File

@@ -1678,7 +1678,7 @@ PUBLIC GLXFBConfig *GLX_PREFIX(glXChooseFBConfig)(Display *dpy, int screen,
config_list = (__GLcontextModes **)
GLX_PREFIX(glXGetFBConfigs)( dpy, screen, & list_size );
if ( (config_list != NULL) && (list_size > 0) ) {
if ( (config_list != NULL) && (list_size > 0) && (attribList != NULL) ) {
list_size = choose_visual( config_list, list_size, attribList,
GL_TRUE );
if ( list_size == 0 ) {

View File

@@ -52,7 +52,9 @@
#include "indirect_init.h"
#include "glapi.h"
#ifdef XTHREADS
#include "Xthreads.h"
# include "Xthreads.h"
#elif defined(PTHREADS)
# include <pthread.h>
#endif
#include "glxextensions.h"
#include "glcontextmodes.h"
@@ -138,7 +140,7 @@ static __GLapi *IndirectAPI = NULL;
* Current context management and locking
*/
#if defined(GLX_DIRECT_RENDERING) && defined(XTHREADS)
#if defined( XTHREADS )
/* thread safe */
static GLboolean TSDinitialized = GL_FALSE;
@@ -174,6 +176,77 @@ void __glXSetCurrentContext(__GLXcontext *c)
/* Used by the __glXLock() and __glXUnlock() macros */
xmutex_rec __glXmutex;
#elif defined( PTHREADS )
pthread_mutex_t __glXmutex = PTHREAD_MUTEX_INITIALIZER;
# if defined( GLX_USE_TLS )
/**
* Per-thread GLX context pointer.
*
* \c __glXSetCurrentContext is written is such a way that this pointer can
* \b never be \c NULL. This is important! Because of this
* \c __glXGetCurrentContext can be implemented as trivial macro.
*/
__thread void * __glX_tls_Context __attribute__((tls_model("initial-exec")))
= &dummyContext;
void __glXSetCurrentContext( __GLXcontext * c )
{
__glX_tls_Context = (c != NULL) ? c : &dummyContext;
}
# else
static pthread_once_t once_control = PTHREAD_ONCE_INIT;
/**
* Per-thread data key.
*
* Once \c init_thread_data has been called, the per-thread data key will
* take a value of \c NULL. As each new thread is created the default
* value, in that thread, will be \c NULL.
*/
static pthread_key_t ContextTSD;
/**
* Initialize the per-thread data key.
*
* This function is called \b exactly once per-process (not per-thread!) to
* initialize the per-thread data key. This is ideally done using the
* \c pthread_once mechanism.
*/
static void init_thread_data( void )
{
if ( pthread_key_create( & ContextTSD, NULL ) != 0 ) {
perror( "pthread_key_create" );
exit( -1 );
}
}
void __glXSetCurrentContext( __GLXcontext * c )
{
pthread_once( & once_control, init_thread_data );
pthread_setspecific( ContextTSD, c );
}
__GLXcontext * __glXGetCurrentContext( void )
{
void * v;
pthread_once( & once_control, init_thread_data );
v = pthread_getspecific( ContextTSD );
return (v == NULL) ? & dummyContext : (__GLXcontext *) v;
}
# endif /* defined( GLX_USE_TLS ) */
#elif defined( THREADS )
#error Unknown threading method specified.
#else
/* not thread safe */
@@ -1119,7 +1192,7 @@ __GLXdisplayPrivate *__glXInitialize(Display* dpy)
XEDataObject dataObj;
int major, minor;
#if defined(GLX_DIRECT_RENDERING) && defined(XTHREADS)
#if defined(XTHREADS)
{
static int firstCall = 1;
if (firstCall) {

View File

@@ -35,6 +35,32 @@
*/
#include "glxclient.h"
#include "indirect.h"
/**
* Send glPixelStore command to the server
*
* \param gc Current GLX context
* \param sop Either \c X_GLsop_PixelStoref or \c X_GLsop_PixelStorei
* \param pname Selector of which pixel parameter is to be set.
* \param param Value that \c pname is set to.
*
* \sa __indirect_glPixelStorei, __indirect_glPixelStoref
*/
static void
send_PixelStore( __GLXcontext * gc, unsigned sop, GLenum pname,
const void * param )
{
Display * const dpy = gc->currentDpy;
const GLuint cmdlen = 8;
if (__builtin_expect(dpy != NULL, 1)) {
GLubyte const * pc = __glXSetupSingleRequest(gc, sop, cmdlen);
(void) memcpy((void *)(pc + 0), (void *)(&pname), 4);
(void) memcpy((void *)(pc + 4), param, 4);
UnlockDisplay(dpy); SyncHandle();
}
return;
}
/*
** Specify parameters that control the storage format of pixel arrays.
@@ -164,12 +190,18 @@ void __indirect_glPixelStoref(GLenum pname, GLfloat param)
case GL_UNPACK_LSB_FIRST:
state->storeUnpack.lsbFirst = (param != 0);
break;
/* Group all of the pixel store modes that need to be sent to the
* server here. Care must be used to only send modes to the server that
* won't affect the size of the data sent to or received from the
* server. GL_PACK_INVERT_MESA is safe in this respect, but other,
* future modes may not be.
*/
case GL_PACK_INVERT_MESA:
send_PixelStore( gc, X_GLsop_PixelStoref, pname, & param );
break;
default:
/*
** NOTE: there are currently no pixel storage commands that need to
** be sent to the server. This may change in future versions
** of the API, however.
*/
__glXSetError(gc, GL_INVALID_ENUM);
break;
}
@@ -287,12 +319,18 @@ void __indirect_glPixelStorei(GLenum pname, GLint param)
case GL_UNPACK_LSB_FIRST:
state->storeUnpack.lsbFirst = (param != 0);
break;
/* Group all of the pixel store modes that need to be sent to the
* server here. Care must be used to only send modes to the server that
* won't affect the size of the data sent to or received from the
* server. GL_PACK_INVERT_MESA is safe in this respect, but other,
* future modes may not be.
*/
case GL_PACK_INVERT_MESA:
send_PixelStore( gc, X_GLsop_PixelStorei, pname, & param );
break;
default:
/*
** NOTE: there are currently no pixel storage commands that need to
** be sent to the server. This may change in future versions
** of the API, however.
*/
__glXSetError(gc, GL_INVALID_ENUM);
break;
}

View File

@@ -60,6 +60,7 @@
*/
#include "packrender.h"
#include "indirect.h"
/**
* Send a large image to the server. If necessary, a buffer is allocated

View File

@@ -39,6 +39,7 @@
#include "glxclient.h"
#include "packsingle.h"
#include "glxextensions.h"
#include "indirect.h"
#include "indirect_vertex_array.h"
/* Used for GL_ARB_transpose_matrix */

View File

@@ -35,6 +35,7 @@
*/
#include "packsingle.h"
#include "indirect.h"
void __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type,
GLvoid *row, GLvoid *column, GLvoid *span)

View File

@@ -58,6 +58,7 @@ SOLO_C_SOURCES = \
$(SWRAST_SOURCES) \
$(SWRAST_SETUP_SOURCES) \
$(SHADER_SOURCES) \
$(SLANG_SOURCES) \
$(ASM_C_SOURCES)
SOLO_OBJECTS = $(SOLO_C_SOURCES:.c=.o) \

View File

@@ -69,7 +69,7 @@ default: depend symlinks $(LIBNAME) $(LIB_DIR)/$(LIBNAME)
$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template
rm -f $@
gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS)
gcc $(ARCH_FLAGS) -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS)
$(LIB_DIR)/$(LIBNAME): $(LIBNAME)

View File

@@ -51,7 +51,7 @@
#include "drm_sarea.h"
#include "glcontextmodes.h"
#ifndef PFNGLXGETMSCRATEOMLPROC
#ifndef GLX_OML_sync_control
typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRInativeDisplay *dpy, __DRIid drawable, int32_t *numerator, int32_t *denominator);
#endif

View File

@@ -33,6 +33,8 @@
#ifndef MMIO_H
#define MMIO_H
#include "glheader.h"
#if defined( __powerpc__ )
static __inline__ u_int32_t

View File

@@ -1,14 +1,3 @@
/* -*- mode:C; coding: mult-utf-8-unix -*-
*
* !!! Important: This file is encoded in UTF-8 !!!
*
* Note (Emacs): You need Mule. In Debian the package is called
* mule-ucs.
*
* Note (Emacs): You may have to enable multibyte characters in the
* Mule customization group or by setting
* default-enable-multibyte-characters to t in your .emacs:
*/
/*
* XML DRI client-side driver configuration
* Copyright (C) 2003 Felix Kuehling
@@ -37,8 +26,11 @@
* \brief Pool of common options
* \author Felix Kuehling
*
* This file defines macros that can be used to construct driConfigOptions
* in the drivers.
* This file defines macros that can be used to construct
* driConfigOptions in the drivers. Common options are defined in
* xmlpool/t_options.h from which xmlpool/options.h is generated with
* translations. This file defines generic helper macros and includes
* xmlpool/options.h.
*/
#ifndef __XMLPOOL_H
@@ -92,255 +84,11 @@
#define DRI_CONF_ENUM(value,text) \
"<enum value=\""#value"\" text=\""text"\"/>\n"
/*
* predefined option sections and options with multi-lingual descriptions
* Predefined option sections and options with multi-lingual descriptions
* are now automatically generated.
*/
/** \brief Debugging options */
#define DRI_CONF_SECTION_DEBUG \
DRI_CONF_SECTION_BEGIN \
DRI_CONF_DESC(en,"Debugging") \
DRI_CONF_DESC(de,"Fehlersuche")
#define DRI_CONF_NO_RAST(def) \
DRI_CONF_OPT_BEGIN(no_rast,bool,def) \
DRI_CONF_DESC(en,"Disable 3D acceleration") \
DRI_CONF_DESC(de,"3D-Beschleunigung abschalten") \
DRI_CONF_OPT_END
#define DRI_CONF_PERFORMANCE_BOXES(def) \
DRI_CONF_OPT_BEGIN(performance_boxes,bool,def) \
DRI_CONF_DESC(en,"Show performance boxes") \
DRI_CONF_DESC(de,"Zeige Performanceboxen") \
DRI_CONF_OPT_END
#define DRI_CONF_DEBUG_DMA(def) \
DRI_CONF_OPT_BEGIN(debug_dma,bool,def) \
DRI_CONF_DESC(en,"Debug DMA buffers") \
DRI_CONF_DESC(de,"DMA Puffer debuggen") \
DRI_CONF_OPT_END
/** \brief Texture-related options */
#define DRI_CONF_SECTION_QUALITY \
DRI_CONF_SECTION_BEGIN \
DRI_CONF_DESC(en,"Image Quality") \
DRI_CONF_DESC(de,"Bildqualität")
#define DRI_CONF_TEXTURE_DEPTH_FB 0
#define DRI_CONF_TEXTURE_DEPTH_32 1
#define DRI_CONF_TEXTURE_DEPTH_16 2
#define DRI_CONF_TEXTURE_DEPTH_FORCE_16 3
#define DRI_CONF_TEXTURE_DEPTH(def) \
DRI_CONF_OPT_BEGIN_V(texture_depth,enum,def,"0:3") \
DRI_CONF_DESC_BEGIN(en,"Texture color depth") \
DRI_CONF_ENUM(0,"Prefer frame buffer color depth") \
DRI_CONF_ENUM(1,"Prefer 32 bits") \
DRI_CONF_ENUM(2,"Prefer 16 bits") \
DRI_CONF_ENUM(3,"Force 16 bits") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Texturfarbtiefe") \
DRI_CONF_ENUM(0,"Bevorzugt so wie Framebuffer") \
DRI_CONF_ENUM(1,"Bevorzugt 32 Bits") \
DRI_CONF_ENUM(2,"Bevorzugt 16 Bits") \
DRI_CONF_ENUM(3,"Höchstens 16 Bits") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_DEF_MAX_ANISOTROPY(def,range) \
DRI_CONF_OPT_BEGIN_V(def_max_anisotropy,float,def,range) \
DRI_CONF_DESC(en,"Default maximum value for anisotropic texture filtering") \
DRI_CONF_DESC(de,"Standard Maximalwert für anisotropische Texturfilterung") \
DRI_CONF_OPT_END
#define DRI_CONF_NO_NEG_LOD_BIAS(def) \
DRI_CONF_OPT_BEGIN(no_neg_lod_bias,bool,def) \
DRI_CONF_DESC(en,"Forbid negative texture LOD bias") \
DRI_CONF_DESC(de,"Verbiete negativen Textur-LOD-Bias") \
DRI_CONF_OPT_END
#define DRI_CONF_FORCE_S3TC_ENABLE(def) \
DRI_CONF_OPT_BEGIN(force_s3tc_enable,bool,def) \
DRI_CONF_DESC(en,"enable s3tc even if software support is not available") \
DRI_CONF_DESC(de,"Benutze s3tc auch ohne Softwareunterstuetzung") \
DRI_CONF_OPT_END
#define DRI_CONF_COLOR_REDUCTION_ROUND 0
#define DRI_CONF_COLOR_REDUCTION_DITHER 1
#define DRI_CONF_COLOR_REDUCTION(def) \
DRI_CONF_OPT_BEGIN_V(color_reduction,enum,def,"0:1") \
DRI_CONF_DESC_BEGIN(en,"Default color reduction method") \
DRI_CONF_ENUM(0,"Round or truncate") \
DRI_CONF_ENUM(1,"Dither") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Standardmethode zur Farbreduktion") \
DRI_CONF_ENUM(0,"Runden oder Abschneiden") \
DRI_CONF_ENUM(1,"Rastern") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_ROUND_TRUNC 0
#define DRI_CONF_ROUND_ROUND 1
#define DRI_CONF_ROUND_MODE(def) \
DRI_CONF_OPT_BEGIN_V(round_mode,enum,def,"0:1") \
DRI_CONF_DESC_BEGIN(en,"Round or truncate colors") \
DRI_CONF_ENUM(0,"Truncate") \
DRI_CONF_ENUM(1,"Round") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Farben runden oder abschneiden") \
DRI_CONF_ENUM(0,"Abschneiden") \
DRI_CONF_ENUM(1,"Runden") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_DITHER_XERRORDIFF 0
#define DRI_CONF_DITHER_XERRORDIFFRESET 1
#define DRI_CONF_DITHER_ORDERED 2
#define DRI_CONF_DITHER_MODE(def) \
DRI_CONF_OPT_BEGIN_V(dither_mode,enum,def,"0:2") \
DRI_CONF_DESC_BEGIN(en,"Color dithering") \
DRI_CONF_ENUM(0,"Horizontal error diffusion") \
DRI_CONF_ENUM(1,"Horizontal error diffusion, reset error at line start") \
DRI_CONF_ENUM(2,"Ordered 2D dithering") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Farben rastern") \
DRI_CONF_ENUM(0,"Horizontale Fehlerstreuung") \
DRI_CONF_ENUM(1,"Horizontale Fehlerstreuung, Fehler am Zeilenanfang zurücksetzen") \
DRI_CONF_ENUM(2,"Geordnete 2D Farbrasterung") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_FLOAT_DEPTH(def) \
DRI_CONF_OPT_BEGIN(float_depth,bool,def) \
DRI_CONF_DESC(en,"Floating point depth buffer") \
DRI_CONF_DESC(de,"Fließkomma z-Puffer") \
DRI_CONF_OPT_END
/** \brief Performance-related options */
#define DRI_CONF_SECTION_PERFORMANCE \
DRI_CONF_SECTION_BEGIN \
DRI_CONF_DESC(en,"Performance") \
DRI_CONF_DESC(de,"Leistung")
#define DRI_CONF_TCL_SW 0
#define DRI_CONF_TCL_PIPELINED 1
#define DRI_CONF_TCL_VTXFMT 2
#define DRI_CONF_TCL_CODEGEN 3
#define DRI_CONF_TCL_MODE(def) \
DRI_CONF_OPT_BEGIN_V(tcl_mode,enum,def,"0:3") \
DRI_CONF_DESC_BEGIN(en,"TCL mode (Transformation, Clipping, Lighting)") \
DRI_CONF_ENUM(0,"Software") \
DRI_CONF_ENUM(1,"TCL stage in MESA pipeline") \
DRI_CONF_ENUM(2,"Bypass MESA's pipeline") \
DRI_CONF_ENUM(3,"Bypass MESA's pipeline with state-based code generation") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"TCL Modus (Transformation, Clipping, Licht)") \
DRI_CONF_ENUM(0,"Software") \
DRI_CONF_ENUM(1,"TCL Stufe in MESA Pipeline") \
DRI_CONF_ENUM(2,"Umgehe MESAs Pipeline") \
DRI_CONF_ENUM(3,"Umgehe MESAs Pipeline mit zustandsbasierter Codegenerierung") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_FTHROTTLE_BUSY 0
#define DRI_CONF_FTHROTTLE_USLEEPS 1
#define DRI_CONF_FTHROTTLE_IRQS 2
#define DRI_CONF_FTHROTTLE_MODE(def) \
DRI_CONF_OPT_BEGIN_V(fthrottle_mode,enum,def,"0:2") \
DRI_CONF_DESC_BEGIN(en,"Frame throttling") \
DRI_CONF_ENUM(0,"Busy waiting") \
DRI_CONF_ENUM(1,"Usleeps") \
DRI_CONF_ENUM(2,"Software interrupts") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Framethrottling") \
DRI_CONF_ENUM(0,"Aktives Warten") \
DRI_CONF_ENUM(1,"Usleeps") \
DRI_CONF_ENUM(2,"Software Interrutps") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_VBLANK_NEVER 0
#define DRI_CONF_VBLANK_DEF_INTERVAL_0 1
#define DRI_CONF_VBLANK_DEF_INTERVAL_1 2
#define DRI_CONF_VBLANK_ALWAYS_SYNC 3
#define DRI_CONF_VBLANK_MODE(def) \
DRI_CONF_OPT_BEGIN_V(vblank_mode,enum,def,"0:3") \
DRI_CONF_DESC_BEGIN(en,"Synchronization with vertical refresh (swap intervals)") \
DRI_CONF_ENUM(0,"Never, FPS rulez!") \
DRI_CONF_ENUM(1,"Application preference, default interval 0") \
DRI_CONF_ENUM(2,"Application preference, default interval 1") \
DRI_CONF_ENUM(3,"Application preference, always synchronize with refresh") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Synchronisation mit dem vertikalen Bildaufbau (swap intervals)") \
DRI_CONF_ENUM(0,"Niemals, immer die maximale Framerate") \
DRI_CONF_ENUM(1,"Anwendung entscheidet, Standardinterval 0") \
DRI_CONF_ENUM(2,"Anwendung entscheidet, Standardinterval 1") \
DRI_CONF_ENUM(3,"Anwendung entscheidet, immer mit Bildaufbau synchronisieren") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_HYPERZ_DISABLED 0
#define DRI_CONF_HYPERZ_ENABLED 1
#define DRI_CONF_HYPERZ(def) \
DRI_CONF_OPT_BEGIN(hyperz,bool,def) \
DRI_CONF_DESC(en,"Use hyperz") \
DRI_CONF_DESC(de,"Hyperz benutzen") \
DRI_CONF_OPT_END
#define DRI_CONF_MAX_TEXTURE_UNITS(def,min,max) \
DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min ":" # max ) \
DRI_CONF_DESC(en,"Number of texture units") \
DRI_CONF_DESC(de,"Anzahl der Textureinheiten") \
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 texture level hack for radeon/r200 for playing games with compressed textures") \
DRI_CONF_OPT_END
#define DRI_CONF_TEXTURE_BLEND_QUALITY(def,range) \
DRI_CONF_OPT_BEGIN_V(texture_blend_quality,float,def,range) \
DRI_CONF_DESC(en, "texture blend quality, aka brilinear texture filtering") \
DRI_CONF_DESC(de, "Texturfilterqualität, auch bekannt als brilineare Texturfilterung") \
DRI_CONF_OPT_END
#define DRI_CONF_TEXTURE_HEAPS_ALL 0
#define DRI_CONF_TEXTURE_HEAPS_CARD 1
#define DRI_CONF_TEXTURE_HEAPS_GART 2
#define DRI_CONF_TEXTURE_HEAPS(def) \
DRI_CONF_OPT_BEGIN_V(texture_heaps,enum,def,"0:2") \
DRI_CONF_DESC_BEGIN(en,"Used types of texture memory") \
DRI_CONF_ENUM(0,"All available") \
DRI_CONF_ENUM(1,"Only card memory (if available)") \
DRI_CONF_ENUM(2,"Only GART (AGP/PCIE) memory (if available)") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Verwendete Texturspeicherarten") \
DRI_CONF_ENUM(0,"Alle verfügbaren") \
DRI_CONF_ENUM(1,"Nur Grafikspeicher (falls vorhanden)") \
DRI_CONF_ENUM(2,"Nur GART (AGP/PCIE) Speicher (falls vorhanden)") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
/* Options for features that are not done in hardware by the driver (like GL_ARB_vertex_program
On cards where there is no documentation (r200) or on rasterization-only hardware). */
#define DRI_CONF_SECTION_SOFTWARE \
DRI_CONF_SECTION_BEGIN \
DRI_CONF_DESC(de,"Funktionalität, die nicht durch die Hardware beschleunigt wird") \
DRI_CONF_DESC(en,"Features that are not hardware-accelerated")
#define DRI_CONF_ARB_VERTEX_PROGRAM(def) \
DRI_CONF_OPT_BEGIN(arb_vertex_program,bool,def) \
DRI_CONF_DESC(de,"GL_ARB_vertex_program aktivieren") \
DRI_CONF_DESC(en,"Enable GL_ARB_vertex_program") \
DRI_CONF_DESC(fr,"Activer GL_ARB_vertex_program") \
DRI_CONF_OPT_END
#define DRI_CONF_NV_VERTEX_PROGRAM(def) \
DRI_CONF_OPT_BEGIN(nv_vertex_program,bool,def) \
DRI_CONF_DESC(de,"GL_NV_vertex_program aktivieren") \
DRI_CONF_DESC(en,"Enable GL_NV_vertex_program") \
DRI_CONF_DESC(fr,"Activer GL_NV_vertex_program") \
DRI_CONF_OPT_END
#include "xmlpool/options.h"
#endif

View File

@@ -0,0 +1,96 @@
# Convenient makefile for managing translations.
# Prerequisites:
# - GNU gettext
# - Python
# Adding new translations
# -----------------------
# To start working on a new translation edit the POS=... line
# below. If you want to add for example a french translation, add
# fr.po.
# Then run "make po" to generate a fresh .po file from translatable
# strings in t_options.h. Now you can edit the new .po file (fr.po in
# the example above) to translate the strings. Please make sure that
# your editor encodes the file in UTF-8.
# Updating existing translations
# ------------------------------
# Run "make po" to update .po files with new translatable strings from
# t_options.h. Now you can edit the .po files you're interested
# in. Please make sure that your editor encodes the file in UTF-8.
# Updating options.h
# ------------------
# Finally run "make" to generate options.h from t_options.h with all
# translations. Now you can rebuild the drivers. Any common options
# used by the drivers will have option descriptions with the latest
# translations.
# Publishing translations
# -----------------------
# To get your translation(s) into Mesa CVS, please send me your
# <lang>.po file.
# More information:
# - info gettext
# The set of supported languages. Add languages as needed.
POS=de.po es.po nl.po fr.po
#
# Don't change anything below, unless you know what you're doing.
#
LANGS=$(POS:%.po=%)
MOS=$(POS:%.po=%/LC_MESSAGES/options.mo)
POT=xmlpool.pot
.PHONY: all clean pot po mo
all: options.h
# Only intermediate files are cleaned up. options.h is not deleted because
# it's in CVS.
clean:
rm -f $(POT) *~
rm -rf $(LANGS)
# Default target options.h
options.h: t_options.h mo
python gen_xmlpool.py $(LANGS) > options.h
# Update .mo files from the corresponding .po files.
mo:
@for mo in $(MOS); do \
lang=$${mo%%/*}; \
echo "Updating $$mo from $$lang.po."; \
mkdir -p $${mo%/*}; \
msgfmt -o $$mo $$lang.po; \
done
# Use this target to create or update .po files with new messages in
# driconf.py.
po: $(POS)
pot: $(POT)
# Extract message catalog from driconf.py.
$(POT): t_options.h
xgettext -L C --from-code utf-8 -o $(POT) t_options.h
# Create or update a .po file for a specific language.
%.po: $(POT)
@if [ -f $@ ]; then \
echo "Merging new strings from $(POT) into $@."; \
mv $@ $@~; \
msgmerge -o $@ $@~ $(POT); \
else \
echo "Initializing $@ from $(POT)."; \
msginit -i $(POT) -o $@~ --locale=$*; \
sed -e 's/charset=.*\\n/charset=UTF-8\\n/' $@~ > $@; \
fi

View File

@@ -0,0 +1,231 @@
# German translations for DRI driver options.
# Copyright (C) 2005 Felix Kuehling
# This file is distributed under the same license as the Mesa package.
# Felix Kuehling <fxkuehl@gmx.de>, 2005.
#
msgid ""
msgstr ""
"Project-Id-Version: Mesa 6.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-04-11 23:19+0200\n"
"PO-Revision-Date: 2005-04-11 01:34+0200\n"
"Last-Translator: Felix Kuehling <fxkuehl@gmx.de>\n"
"Language-Team: German <de@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: t_options.h:53
msgid "Debugging"
msgstr "Fehlersuche"
#: t_options.h:57
msgid "Disable 3D acceleration"
msgstr "3D-Beschleunigung abschalten"
#: t_options.h:62
msgid "Show performance boxes"
msgstr "Zeige Performanceboxen"
#: t_options.h:69
msgid "Image Quality"
msgstr "Bildqualität"
#: t_options.h:77
msgid "Texture color depth"
msgstr "Texturfarbtiefe"
#: t_options.h:78
msgid "Prefer frame buffer color depth"
msgstr "Bevorzuge Farbtiefe des Framebuffers"
#: t_options.h:79
msgid "Prefer 32 bits per texel"
msgstr "Bevorzuge 32 bits pro Texel"
#: t_options.h:80
msgid "Prefer 16 bits per texel"
msgstr "Bevorzuge 16 bits pro Texel"
#: t_options.h:81
msgid "Force 16 bits per texel"
msgstr "Erzwinge 16 bits pro Texel"
#: t_options.h:87
msgid "Initial maximum value for anisotropic texture filtering"
msgstr "Initialer Maximalwert für anisotropische Texturfilterung"
#: t_options.h:92
msgid "Forbid negative texture LOD bias"
msgstr "Verbiete negative Textur-Detailgradverschiebung"
#: t_options.h:97
msgid ""
"Enable S3TC texture compression even if software support is not available"
msgstr ""
"Aktiviere S3TC Texturkomprimierung auch wenn die nötige "
"Softwareunterstützung fehlt"
#: t_options.h:104
msgid "Initial color reduction method"
msgstr "Initiale Farbreduktionsmethode"
#: t_options.h:105
msgid "Round colors"
msgstr "Farben runden"
#: t_options.h:106
msgid "Dither colors"
msgstr "Farben rastern"
#: t_options.h:114
msgid "Color rounding method"
msgstr "Farbrundungsmethode"
#: t_options.h:115
msgid "Round color components downward"
msgstr "Farbkomponenten abrunden"
#: t_options.h:116
msgid "Round to nearest color"
msgstr "Zur ähnlichsten Farbe runden"
#: t_options.h:125
msgid "Color dithering method"
msgstr "Farbrasterungsmethode"
#: t_options.h:126
msgid "Horizontal error diffusion"
msgstr "Horizontale Fehlerstreuung"
#: t_options.h:127
msgid "Horizontal error diffusion, reset error at line start"
msgstr "Horizontale Fehlerstreuung, Fehler am Zeilenanfang zurücksetzen"
#: t_options.h:128
msgid "Ordered 2D color dithering"
msgstr "Geordnete 2D Farbrasterung"
#: t_options.h:134
msgid "Floating point depth buffer"
msgstr "Fließkomma z-Puffer"
#: t_options.h:140
msgid "Performance"
msgstr "Leistung"
#: t_options.h:148
msgid "TCL mode (Transformation, Clipping, Lighting)"
msgstr "TCL-Modus (Transformation, Clipping, Licht)"
#: t_options.h:149
msgid "Use software TCL pipeline"
msgstr "Benutze die Software-TCL-Pipeline"
#: t_options.h:150
msgid "Use hardware TCL as first TCL pipeline stage"
msgstr "Benutze Hardware TCL als erste Stufe der TCL-Pipeline"
#: t_options.h:151
msgid "Bypass the TCL pipeline"
msgstr "Umgehe die TCL-Pipeline"
#: t_options.h:152
msgid ""
"Bypass the TCL pipeline with state-based machine code generated on-the-fly"
msgstr ""
"Umgehe die TCL-Pipeline mit zur Laufzeit erzeugtem, zustandsbasiertem "
"Maschinencode"
#: t_options.h:161
msgid "Method to limit rendering latency"
msgstr "Methode zur Begrenzung der Bildverzögerung"
#: t_options.h:162
msgid "Busy waiting for the graphics hardware"
msgstr "Aktives Warten auf die Grafikhardware"
#: t_options.h:163
msgid "Sleep for brief intervals while waiting for the graphics hardware"
msgstr "Kurze Schlafintervalle beim Warten auf die Grafikhardware"
#: t_options.h:164
msgid "Let the graphics hardware emit a software interrupt and sleep"
msgstr ""
"Die Grafikhardware eine Softwareunterbrechnung erzeugen lassen und schlafen"
#: t_options.h:174
msgid "Synchronization with vertical refresh (swap intervals)"
msgstr "Synchronisation mit der vertikalen Bildwiederholung"
#: t_options.h:175
msgid "Never synchronize with vertical refresh, ignore application's choice"
msgstr ""
"Niemals mit der Bildwiederholung synchronisieren, Anweisungen der Anwendung "
"ignorieren"
#: t_options.h:176
msgid "Initial swap interval 0, obey application's choice"
msgstr "Initiales Bildinterval 0, Anweisungen der Anwendung gehorchen"
#: t_options.h:177
msgid "Initial swap interval 1, obey application's choice"
msgstr "Initiales Bildinterval 1, Anweisungen der Anwendung gehorchen"
#: t_options.h:178
msgid ""
"Always synchronize with vertical refresh, application chooses the minimum "
"swap interval"
msgstr ""
"Immer mit der Bildwiederholung synchronisieren, Anwendung wählt das minmale "
"Bildinterval"
#: t_options.h:186
msgid "Use HyperZ to boost performance"
msgstr "HyperZ zur Leistungssteigerung verwenden"
#: t_options.h:191
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"
#: t_options.h:201
msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering"
msgstr ""
"Texturfilterqualität versus -geschwindigkeit, auch bekannt als „brilineare“ "
"Texturfilterung"
#: t_options.h:209
msgid "Used types of texture memory"
msgstr "Benutzte Arten von Texturspeicher"
#: t_options.h:210
msgid "All available memory"
msgstr "Aller verfügbarer Speicher"
#: t_options.h:211
msgid "Only card memory (if available)"
msgstr "Nur Grafikspeicher (falls verfügbar)"
#: t_options.h:212
msgid "Only GART (AGP/PCIE) memory (if available)"
msgstr "Nur GART-Speicher (AGP/PCIE) (falls verfügbar)"
#: t_options.h:220
msgid "Features that are not hardware-accelerated"
msgstr "Funktionalität, die nicht hardwarebeschleunigt ist"
#: t_options.h:224
msgid "Enable extension GL_ARB_vertex_program"
msgstr "Erweiterung GL_ARB_vertex_program aktivieren"
#: t_options.h:229
msgid "Enable extension GL_NV_vertex_program"
msgstr "Erweiterung GL_NV_vertex_program aktivieren"

View File

@@ -0,0 +1,219 @@
# translation of es.po to Spanish
# Spanish translations for PACKAGE package.
# Copyright (C) 2005 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# David <deifo@ono.com>, 2005.
# David Rubio Miguélez <deifo@ono.com>, 2005.
#
msgid ""
msgstr ""
"Project-Id-Version: es\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-04-12 12:18+0200\n"
"PO-Revision-Date: 2005-04-12 20:26+0200\n"
"Last-Translator: David Rubio Miguélez <deifo@ono.com>\n"
"Language-Team: Spanish <es@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: KBabel 1.10\n"
#: t_options.h:53
msgid "Debugging"
msgstr "Depurando"
#: t_options.h:57
msgid "Disable 3D acceleration"
msgstr "Desactivar aceleración 3D"
#: t_options.h:62
msgid "Show performance boxes"
msgstr "Mostrar cajas de rendimiento"
#: t_options.h:69
msgid "Image Quality"
msgstr "Calidad de imagen"
#: t_options.h:77
msgid "Texture color depth"
msgstr "Profundidad de color de textura"
#: t_options.h:78
msgid "Prefer frame buffer color depth"
msgstr "Preferir profundidad de color del \"framebuffer\""
#: t_options.h:79
msgid "Prefer 32 bits per texel"
msgstr "Preferir 32 bits por texel"
#: t_options.h:80
msgid "Prefer 16 bits per texel"
msgstr "Preferir 16 bits por texel"
#: t_options.h:81
msgid "Force 16 bits per texel"
msgstr "Forzar a 16 bits por texel"
#: t_options.h:87
msgid "Initial maximum value for anisotropic texture filtering"
msgstr "Valor máximo inicial para filtrado anisotrópico de textura"
#: t_options.h:92
msgid "Forbid negative texture LOD bias"
msgstr "Prohibir valores negativos de Nivel De Detalle (LOD) de texturas"
#: t_options.h:97
msgid "Enable S3TC texture compression even if software support is not available"
msgstr "Activar la compresión de texturas S3TC incluso si el soporte por software no está disponible"
#: t_options.h:104
msgid "Initial color reduction method"
msgstr "Método inicial de reducción de color"
#: t_options.h:105
msgid "Round colors"
msgstr "Colores redondeados"
#: t_options.h:106
msgid "Dither colors"
msgstr "Colores suavizados"
#: t_options.h:114
msgid "Color rounding method"
msgstr "Método de redondeo de colores"
#: t_options.h:115
msgid "Round color components downward"
msgstr "Redondear hacia abajo los componentes de color"
#: t_options.h:116
msgid "Round to nearest color"
msgstr "Redondear al color más cercano"
#: t_options.h:125
msgid "Color dithering method"
msgstr "Método de suavizado de color"
#: t_options.h:126
msgid "Horizontal error diffusion"
msgstr "Difusión de error horizontal"
#: t_options.h:127
msgid "Horizontal error diffusion, reset error at line start"
msgstr "Difusión de error horizontal, reiniciar error al comienzo de línea"
#: t_options.h:128
msgid "Ordered 2D color dithering"
msgstr "Suavizado de color 2D ordenado"
#: t_options.h:134
msgid "Floating point depth buffer"
msgstr "Búfer de profundidad en coma flotante"
#: t_options.h:140
msgid "Performance"
msgstr "Rendimiento"
#: t_options.h:148
msgid "TCL mode (Transformation, Clipping, Lighting)"
msgstr "Modo TCL (Transformación, Recorte, Iluminación)"
#: t_options.h:149
msgid "Use software TCL pipeline"
msgstr "Usar tubería TCL por software"
#: t_options.h:150
msgid "Use hardware TCL as first TCL pipeline stage"
msgstr "Usar TCL por hardware en la primera fase de la tubería TCL"
#: t_options.h:151
msgid "Bypass the TCL pipeline"
msgstr "Pasar por alto la tubería TCL"
#: t_options.h:152
msgid "Bypass the TCL pipeline with state-based machine code generated on-the-fly"
msgstr "Pasar por alto la tubería TCL con código máquina basado en estados generado al vuelo"
#: t_options.h:161
msgid "Method to limit rendering latency"
msgstr "Método para limitar la latencia de rénder"
#: t_options.h:162
msgid "Busy waiting for the graphics hardware"
msgstr "Esperar activamente al hardware gráfico"
#: t_options.h:163
msgid "Sleep for brief intervals while waiting for the graphics hardware"
msgstr "Dormir en intervalos cortos mientras se espera al hardware gráfico"
#: t_options.h:164
msgid "Let the graphics hardware emit a software interrupt and sleep"
msgstr "Permitir que el hardware gráfico emita una interrupción de software y duerma"
#: t_options.h:174
msgid "Synchronization with vertical refresh (swap intervals)"
msgstr "Sincronización con el refresco vertical (intervalos de intercambio)"
#: t_options.h:175
msgid "Never synchronize with vertical refresh, ignore application's choice"
msgstr "No sincronizar nunca con el refresco vertical, ignorar la elección de la aplicación"
#: t_options.h:176
msgid "Initial swap interval 0, obey application's choice"
msgstr "Intervalo de intercambio inicial 0, obedecer la elección de la aplicación"
#: t_options.h:177
msgid "Initial swap interval 1, obey application's choice"
msgstr "Intervalo de intercambio inicial 1, obedecer la elección de la aplicación"
#: t_options.h:178
msgid ""
"Always synchronize with vertical refresh, application chooses the minimum "
"swap interval"
msgstr "Sincronizar siempre con el refresco vertical, la aplicación elige el intervalo de intercambio mínimo"
#: t_options.h:186
msgid "Use HyperZ to boost performance"
msgstr "Usar HyperZ para potenciar rendimiento"
#: t_options.h:191
msgid "Number of texture units used"
msgstr "Número de unidades de textura usadas"
#: t_options.h:196
msgid "Enable hack to allow larger textures with texture compression on radeon/r200"
msgstr "Activar \"hack\" para permitir texturas más grandes con compresión de textura activada en la Radeon/r200"
#: t_options.h:201
msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering"
msgstr "Calidad de filtrado de textura vs. velocidad, alias filtrado \"brilinear\" de textura"
#: t_options.h:209
msgid "Used types of texture memory"
msgstr "Tipos de memoria de textura usados"
#: t_options.h:210
msgid "All available memory"
msgstr "Toda la memoria disponible"
#: t_options.h:211
msgid "Only card memory (if available)"
msgstr "Sólo la memoria de la tarjeta (si disponible)"
#: t_options.h:212
msgid "Only GART (AGP/PCIE) memory (if available)"
msgstr "Sólo memoria GART (AGP/PCIE) (si disponible)"
#: t_options.h:220
msgid "Features that are not hardware-accelerated"
msgstr "Características no aceleradas por hardware"
#: t_options.h:224
msgid "Enable extension GL_ARB_vertex_program"
msgstr "Activar la extensión GL_ARB_vertex_program"
#: t_options.h:229
msgid "Enable extension GL_NV_vertex_program"
msgstr "Activar extensión GL_NV_vertex_program"

View File

@@ -0,0 +1,225 @@
# French translations for DRI driver options.
# Copyright (C) 2005 Stephane Marchesin
# This file is distributed under the same license as the Mesa package.
# Stephane Marchesin <marchesin@icps.u-strasbg.fr>, 2005.
#
msgid ""
msgstr ""
"Project-Id-Version: Mesa 6.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-04-11 23:19+0200\n"
"PO-Revision-Date: 2005-04-11 01:34+0200\n"
"Last-Translator: Stephane Marchesin <marchesin@icps.u-strasbg.fr>\n"
"Language-Team: French <fr@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: t_options.h:53
msgid "Debugging"
msgstr "Debogage"
#: t_options.h:57
msgid "Disable 3D acceleration"
msgstr "Désactiver l'accélération 3D"
#: t_options.h:62
msgid "Show performance boxes"
msgstr "Afficher les boîtes de performance"
#: t_options.h:69
msgid "Image Quality"
msgstr "Qualité d'image"
#: t_options.h:77
msgid "Texture color depth"
msgstr "Profondeur de texture"
#: t_options.h:78
msgid "Prefer frame buffer color depth"
msgstr "Profondeur de couleur"
#: t_options.h:79
msgid "Prefer 32 bits per texel"
msgstr "Préférer 32 bits par texel"
#: t_options.h:80
msgid "Prefer 16 bits per texel"
msgstr "Prérérer 16 bits par texel"
#: t_options.h:81
msgid "Force 16 bits per texel"
msgstr "Forcer 16 bits par texel"
#: t_options.h:87
msgid "Initial maximum value for anisotropic texture filtering"
msgstr "Valeur maximale initiale pour le filtrage anisotropique de texture"
#: t_options.h:92
msgid "Forbid negative texture LOD bias"
msgstr "Interdire le LOD bias negatif"
#: t_options.h:97
msgid ""
"Enable S3TC texture compression even if software support is not available"
msgstr ""
"Activer la compression de texture S3TC même si le support logiciel est absent"
#: t_options.h:104
msgid "Initial color reduction method"
msgstr "Technique de réduction de couleurs"
#: t_options.h:105
msgid "Round colors"
msgstr "Arrondir les valeurs de couleur"
#: t_options.h:106
msgid "Dither colors"
msgstr "Tramer les couleurs"
#: t_options.h:114
msgid "Color rounding method"
msgstr "Méthode d'arrondi des couleurs"
#: t_options.h:115
msgid "Round color components downward"
msgstr "Arrondi à l'inférieur"
#: t_options.h:116
msgid "Round to nearest color"
msgstr "Arrondi au plus proche"
#: t_options.h:125
msgid "Color dithering method"
msgstr "Méthode de tramage"
#: t_options.h:126
msgid "Horizontal error diffusion"
msgstr "Diffusion d'erreur horizontale"
#: t_options.h:127
msgid "Horizontal error diffusion, reset error at line start"
msgstr "Diffusion d'erreur horizontale, réinitialisé pour chaque ligne"
#: t_options.h:128
msgid "Ordered 2D color dithering"
msgstr "Tramage ordonné des couleurs"
#: t_options.h:134
msgid "Floating point depth buffer"
msgstr "Z-buffer en virgule flottante"
#: t_options.h:140
msgid "Performance"
msgstr "Performance"
#: t_options.h:148
msgid "TCL mode (Transformation, Clipping, Lighting)"
msgstr "Mode de TCL (Transformation, Clipping, Eclairage)"
#: t_options.h:149
msgid "Use software TCL pipeline"
msgstr "Utiliser un pipeline TCL logiciel"
#: t_options.h:150
msgid "Use hardware TCL as first TCL pipeline stage"
msgstr "Utiliser le TCL matériel pour le premier niveau de pipeline"
#: t_options.h:151
msgid "Bypass the TCL pipeline"
msgstr "Court-circuiter le pipeline TCL"
#: t_options.h:152
msgid ""
"Bypass the TCL pipeline with state-based machine code generated on-the-fly"
msgstr ""
"Court-circuiter le pipeline TCL par une machine à états qui génère le code"
"de TCL à la volée"
#: t_options.h:161
msgid "Method to limit rendering latency"
msgstr "Méthode d'attente de la carte graphique"
#: t_options.h:162
msgid "Busy waiting for the graphics hardware"
msgstr "Attente active de la carte graphique"
#: t_options.h:163
msgid "Sleep for brief intervals while waiting for the graphics hardware"
msgstr "Attente utilisant usleep()"
#: t_options.h:164
msgid "Let the graphics hardware emit a software interrupt and sleep"
msgstr "Utiliser les interruptions"
#: t_options.h:174
msgid "Synchronization with vertical refresh (swap intervals)"
msgstr "Synchronisation de l'affichage avec le balayage vertical"
#: t_options.h:175
msgid "Never synchronize with vertical refresh, ignore application's choice"
msgstr "Ne jamais synchroniser avec le balayage vertical, ignorer le choix de l'application"
#: t_options.h:176
msgid "Initial swap interval 0, obey application's choice"
msgstr "Ne pas synchroniser avec le balayage vertical par défaut, mais obéir au choix de l'application"
#: t_options.h:177
msgid "Initial swap interval 1, obey application's choice"
msgstr "Synchroniser avec le balayage vertical par défaut, mais obéir au choix de l'application"
#: t_options.h:178
msgid ""
"Always synchronize with vertical refresh, application chooses the minimum "
"swap interval"
msgstr ""
"Toujours synchroniser avec le balayage vertical, l'application choisit l'intervalle minimal"
#: t_options.h:186
msgid "Use HyperZ to boost performance"
msgstr "Utiliser le HyperZ pour améliorer les performances"
#: t_options.h:191
msgid "Number of texture units used"
msgstr "Nombre d'unités de texture"
#: t_options.h:196
msgid ""
"Enable hack to allow larger textures with texture compression on radeon/r200"
msgstr ""
"Activer le hack permettant l'utilisation de textures de grande taille avec la "
"compression de textures sur radeon/r200"
#: t_options.h:201
msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering"
msgstr ""
"Qualité/performance du filtrage trilinéaire de texture (filtrage brilinéaire)"
#: t_options.h:209
msgid "Used types of texture memory"
msgstr "Types de mémoire de texture"
#: t_options.h:210
msgid "All available memory"
msgstr "Utiliser toute la mémoire disponible"
#: t_options.h:211
msgid "Only card memory (if available)"
msgstr "Utiliser uniquement la mémoire graphique (si disponible)"
#: t_options.h:212
msgid "Only GART (AGP/PCIE) memory (if available)"
msgstr "Utiliser uniquement la mémoire GART (AGP/PCIE) (si disponible)"
#: t_options.h:220
msgid "Features that are not hardware-accelerated"
msgstr "Fonctionnalités ne bénéficiant pas d'une accélération matérielle"
#: t_options.h:224
msgid "Enable extension GL_ARB_vertex_program"
msgstr "Activer l'extension GL_ARB_vertex_program"
#: t_options.h:229
msgid "Enable extension GL_NV_vertex_program"
msgstr "Activer l'extension GL_NV_vertex_program"

View File

@@ -0,0 +1,191 @@
#!/usr/bin/python
import sys
import gettext
import re
# List of supported languages
languages = sys.argv[1:]
# Escape special characters in C strings
def escapeCString (s):
escapeSeqs = {'\a' : '\\a', '\b' : '\\b', '\f' : '\\f', '\n' : '\\n',
'\r' : '\\r', '\t' : '\\t', '\v' : '\\v', '\\' : '\\\\'}
# " -> '' is a hack. Quotes (") aren't possible in XML attributes.
# Better use Unicode characters for typographic quotes in option
# descriptions and translations.
i = 0
r = ''
while i < len(s):
# Special case: escape double quote with \u201c or \u201d, depending
# on whether it's an open or close quote. This is needed because plain
# double quotes are not possible in XML attributes.
if s[i] == '"':
if i == len(s)-1 or s[i+1].isspace():
# close quote
q = u'\u201c'
else:
# open quote
q = u'\u201d'
r = r + q
elif escapeSeqs.has_key(s[i]):
r = r + escapeSeqs[s[i]]
else:
r = r + s[i]
i = i + 1
return r
# Expand escape sequences in C strings (needed for gettext lookup)
def expandCString (s):
escapeSeqs = {'a' : '\a', 'b' : '\b', 'f' : '\f', 'n' : '\n',
'r' : '\r', 't' : '\t', 'v' : '\v',
'"' : '"', '\\' : '\\'}
i = 0
escape = False
hexa = False
octa = False
num = 0
digits = 0
r = ''
while i < len(s):
if not escape:
if s[i] == '\\':
escape = True
else:
r = r + s[i]
elif hexa:
if (s[i] >= '0' and s[i] <= '9') or \
(s[i] >= 'a' and s[i] <= 'f') or \
(s[i] >= 'A' and s[i] <= 'F'):
num = num * 16 + int(s[i],16)
digits = digits + 1
else:
digits = 2
if digits >= 2:
hexa = False
escape = False
r = r + chr(num)
elif octa:
if s[i] >= '0' and s[i] <= '7':
num = num * 8 + int(s[i],8)
digits = digits + 1
else:
digits = 3
if digits >= 3:
octa = False
escape = False
r = r + chr(num)
else:
if escapeSeqs.has_key(s[i]):
r = r + escapeSeqs[s[i]]
escape = False
elif s[i] >= '0' and s[i] <= '7':
octa = True
num = int(s[i],8)
if num <= 3:
digits = 1
else:
digits = 2
elif s[i] == 'x' or s[i] == 'X':
hexa = True
num = 0
digits = 0
else:
r = r + s[i]
escape = False
i = i + 1
return r
# Expand matches. The first match is always a DESC or DESC_BEGIN match.
# Subsequent matches are ENUM matches.
#
# DESC, DESC_BEGIN format: \1 \2=<lang> \3 \4=gettext(" \5=<text> \6=") \7
# ENUM format: \1 \2=gettext(" \3=<text> \4=") \5
def expandMatches (matches, translations, end=None):
assert len(matches) > 0
nTranslations = len(translations)
i = 0
# Expand the description+enums for all translations
for lang,trans in translations:
i = i + 1
# Make sure that all but the last line of a simple description
# are extended with a backslash.
suffix = ''
if len(matches) == 1 and i < len(translations) and \
not matches[0].expand (r'\7').endswith('\\'):
suffix = ' \\'
# Expand the description line. Need to use ugettext in order to allow
# non-ascii unicode chars in the original English descriptions.
text = escapeCString (trans.ugettext (unicode (expandCString (
matches[0].expand (r'\5')), "utf-8"))).encode("utf-8")
print matches[0].expand (r'\1' + lang + r'\3"' + text + r'"\7') + suffix
# Expand any subsequent enum lines
for match in matches[1:]:
text = escapeCString (trans.ugettext (unicode (expandCString (
match.expand (r'\3')), "utf-8"))).encode("utf-8")
print match.expand (r'\1"' + text + r'"\5')
# Expand description end
if end:
print end,
# Compile a list of translation classes to all supported languages.
# The first translation is always a NullTranslations.
translations = [("en", gettext.NullTranslations())]
for lang in languages:
try:
trans = gettext.translation ("options", ".", [lang])
except IOError:
sys.stderr.write ("Warning: language '%s' not found.\n" % lang)
continue
translations.append ((lang, trans))
# Regular expressions:
reLibintl_h = re.compile (r'#\s*include\s*<libintl.h>')
reDESC = re.compile (r'(\s*DRI_CONF_DESC\s*\(\s*)([a-z]+)(\s*,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$')
reDESC_BEGIN = re.compile (r'(\s*DRI_CONF_DESC_BEGIN\s*\(\s*)([a-z]+)(\s*,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$')
reENUM = re.compile (r'(\s*DRI_CONF_ENUM\s*\([^,]+,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$')
reDESC_END = re.compile (r'\s*DRI_CONF_DESC_END')
# Print a header
print \
"/***********************************************************************\n" \
" *** THIS FILE IS GENERATED AUTOMATICALLY. DON'T EDIT! ***\n" \
" ***********************************************************************/"
# Process the options template and generate options.h with all
# translations.
template = file ("t_options.h", "r")
descMatches = []
for line in template:
if len(descMatches) > 0:
matchENUM = reENUM .match (line)
matchDESC_END = reDESC_END.match (line)
if matchENUM:
descMatches.append (matchENUM)
elif matchDESC_END:
expandMatches (descMatches, translations, line)
descMatches = []
else:
sys.stderr.write (
"Warning: unexpected line inside description dropped:\n%s\n" \
% line)
continue
if reLibintl_h.search (line):
# Ignore (comment out) #include <libintl.h>
print "/* %s * commented out by gen_xmlpool.py */" % line
continue
matchDESC = reDESC .match (line)
matchDESC_BEGIN = reDESC_BEGIN.match (line)
if matchDESC:
assert len(descMatches) == 0
expandMatches ([matchDESC], translations)
elif matchDESC_BEGIN:
assert len(descMatches) == 0
descMatches = [matchDESC_BEGIN]
else:
print line,
if len(descMatches) > 0:
sys.stderr.write ("Warning: unterminated description at end of file.\n")
expandMatches (descMatches, translations)

View File

@@ -0,0 +1,230 @@
# Dutch translations for PACKAGE package.
# Copyright (C) 2005 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# <manfred.stienstra@dwerg.net>, 2005.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-04-12 20:09+0200\n"
"PO-Revision-Date: 2005-04-12 20:09+0200\n"
"Last-Translator: Manfred Stienstra <manfred.stienstra@dwerg.net>\n"
"Language-Team: Dutch <vertaling@nl.linux.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: t_options.h:53
msgid "Debugging"
msgstr "Debuggen"
#: t_options.h:57
msgid "Disable 3D acceleration"
msgstr "3D versnelling uitschakelen"
#: t_options.h:62
msgid "Show performance boxes"
msgstr "Laat prestatie boxjes zien"
#: t_options.h:69
msgid "Image Quality"
msgstr "Beeldkwaliteit"
#: t_options.h:77
msgid "Texture color depth"
msgstr "Textuurkleurendiepte"
#: t_options.h:78
msgid "Prefer frame buffer color depth"
msgstr "Prefereer kaderbufferkleurdiepte"
#: t_options.h:79
msgid "Prefer 32 bits per texel"
msgstr "Prefereer 32 bits per texel"
#: t_options.h:80
msgid "Prefer 16 bits per texel"
msgstr "Prefereer 16 bits per texel"
#: t_options.h:81
msgid "Force 16 bits per texel"
msgstr "Dwing 16 bits per texel af"
#: t_options.h:87
msgid "Initial maximum value for anisotropic texture filtering"
msgstr "Initïele maximum waarde voor anisotrophische textuur filtering"
#: t_options.h:92
msgid "Forbid negative texture LOD bias"
msgstr "Verbied negatief niveau detailonderscheid (LOD) van texturen"
#: t_options.h:97
msgid ""
"Enable S3TC texture compression even if software support is not available"
msgstr ""
"Schakel S3TC textuurcompressie in, zelfs als softwareondersteuning niet "
"aanwezig is"
#: t_options.h:104
msgid "Initial color reduction method"
msgstr "Initïele kleurreductie methode"
#: t_options.h:105
msgid "Round colors"
msgstr "Rond kleuren af"
#: t_options.h:106
msgid "Dither colors"
msgstr "Rasteriseer kleuren"
#: t_options.h:114
msgid "Color rounding method"
msgstr "Kleurafrondingmethode"
#: t_options.h:115
msgid "Round color components downward"
msgstr "Rond kleurencomponenten af naar beneden"
#: t_options.h:116
msgid "Round to nearest color"
msgstr "Rond af naar dichtsbijzijnde kleur"
#: t_options.h:125
msgid "Color dithering method"
msgstr "Kleurrasteriseringsmethode"
#: t_options.h:126
msgid "Horizontal error diffusion"
msgstr "Horizontale foutdiffusie"
#: t_options.h:127
msgid "Horizontal error diffusion, reset error at line start"
msgstr "Horizontale foutdiffusie, zet fout bij lijnbegin terug"
#: t_options.h:128
msgid "Ordered 2D color dithering"
msgstr "Geordende 2D kleurrasterisering"
#: t_options.h:134
msgid "Floating point depth buffer"
msgstr "Dieptebuffer als commagetal"
#: t_options.h:140
msgid "Performance"
msgstr "Prestatie"
#: t_options.h:148
msgid "TCL mode (Transformation, Clipping, Lighting)"
msgstr "TCL-modus (Transformatie, Clipping, Licht)"
#: t_options.h:149
msgid "Use software TCL pipeline"
msgstr "Gebruik software TCL pijpleiding"
#: t_options.h:150
msgid "Use hardware TCL as first TCL pipeline stage"
msgstr "Gebruik hardware TCL as eerste TCL pijpleiding trap"
#: t_options.h:151
msgid "Bypass the TCL pipeline"
msgstr "Omzeil de TCL pijpleiding"
#: t_options.h:152
msgid ""
"Bypass the TCL pipeline with state-based machine code generated on-the-fly"
msgstr ""
"Omzeil de TCL pijpleiding met staatgebaseerde machinecode die tijdens "
"executie gegenereerd wordt"
#: t_options.h:161
msgid "Method to limit rendering latency"
msgstr "Methode om beeldopbouwvertraging te onderdrukken"
#: t_options.h:162
msgid "Busy waiting for the graphics hardware"
msgstr "Actief wachten voor de grafische hardware"
#: t_options.h:163
msgid "Sleep for brief intervals while waiting for the graphics hardware"
msgstr "Slaap voor korte intervallen tijdens het wachten op de grafische "
"hardware"
#: t_options.h:164
msgid "Let the graphics hardware emit a software interrupt and sleep"
msgstr "Laat de grafische hardware een software onderbreking uitzenden en in "
"slaap vallen"
#: t_options.h:174
msgid "Synchronization with vertical refresh (swap intervals)"
msgstr "Synchronisatie met verticale verversing (interval omwisselen)"
#: t_options.h:175
msgid "Never synchronize with vertical refresh, ignore application's choice"
msgstr "Nooit synchroniseren met verticale verversing, negeer de keuze van de "
"applicatie"
#: t_options.h:176
msgid "Initial swap interval 0, obey application's choice"
msgstr "Initïeel omwisselingsinterval 0, honoreer de keuze van de applicatie"
#: t_options.h:177
msgid "Initial swap interval 1, obey application's choice"
msgstr "Initïeel omwisselingsinterval 1, honoreer de keuze van de applicatie"
#: t_options.h:178
msgid ""
"Always synchronize with vertical refresh, application chooses the minimum "
"swap interval"
msgstr ""
"Synchroniseer altijd met verticale verversing, de applicatie kiest het "
"minimum omwisselingsinterval"
#: t_options.h:186
msgid "Use HyperZ to boost performance"
msgstr "Gebruik HyperZ om de prestaties te verbeteren"
#: t_options.h:191
msgid "Number of texture units used"
msgstr "Aantal textuureenheden in gebruik"
#: t_options.h:196
msgid ""
"Enable hack to allow larger textures with texture compression on radeon/r200"
msgstr ""
"Schakel hack in om met textuurcompressie grotere texturen toe te staan op "
"een radeon/r200"
#: t_options.h:201
msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering"
msgstr "Textuurfilterkwaliteit versus -snelheid, ookwel bekend als "
"“brilineaire” textuurfiltering"
#: t_options.h:209
msgid "Used types of texture memory"
msgstr "Gebruikte soorten textuurgeheugen"
#: t_options.h:210
msgid "All available memory"
msgstr "Al het beschikbaar geheugen"
#: t_options.h:211
msgid "Only card memory (if available)"
msgstr "Alleen geheugen op de kaart (als het aanwezig is)"
#: t_options.h:212
msgid "Only GART (AGP/PCIE) memory (if available)"
msgstr "Alleen GART (AGP/PCIE) geheugen (als het aanwezig is)"
#: t_options.h:220
msgid "Features that are not hardware-accelerated"
msgstr "Eigenschappen die niet hardwareversneld zijn"
#: t_options.h:224
msgid "Enable extension GL_ARB_vertex_program"
msgstr "Zet uitbreiding GL_ARB_vertex_program aan"
#: t_options.h:229
msgid "Enable extension GL_NV_vertex_program"
msgstr "Zet uitbreiding GL_NV_vertex_program aan"

View File

@@ -0,0 +1,462 @@
/***********************************************************************
*** THIS FILE IS GENERATED AUTOMATICALLY. DON'T EDIT! ***
***********************************************************************/
/*
* XML DRI client-side driver configuration
* Copyright (C) 2003 Felix Kuehling
*
* 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
* FELIX KUEHLING, 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.
*
*/
/**
* \file t_options.h
* \brief Templates of common options
* \author Felix Kuehling
*
* This file defines macros for common options that can be used to
* construct driConfigOptions in the drivers. This file is only a
* template containing English descriptions for options wrapped in
* gettext(). xgettext can be used to extract translatable
* strings. These strings can then be translated by anyone familiar
* with GNU gettext. gen_xmlpool.py takes this template and fills in
* all the translations. The result (options.h) is included by
* xmlpool.h which in turn can be included by drivers.
*
* The macros used to describe otions in this file are defined in
* ../xmlpool.h.
*/
/* This is needed for xgettext to extract translatable strings.
* gen_xmlpool.py will discard this line. */
/* #include <libintl.h>
* commented out by gen_xmlpool.py */
/*
* predefined option sections and options with multi-lingual descriptions
*/
/** \brief Debugging options */
#define DRI_CONF_SECTION_DEBUG \
DRI_CONF_SECTION_BEGIN \
DRI_CONF_DESC(en,"Debugging") \
DRI_CONF_DESC(de,"Fehlersuche") \
DRI_CONF_DESC(es,"Depurando") \
DRI_CONF_DESC(nl,"Debuggen") \
DRI_CONF_DESC(fr,"Debogage")
#define DRI_CONF_NO_RAST(def) \
DRI_CONF_OPT_BEGIN(no_rast,bool,def) \
DRI_CONF_DESC(en,"Disable 3D acceleration") \
DRI_CONF_DESC(de,"3D-Beschleunigung abschalten") \
DRI_CONF_DESC(es,"Desactivar aceleración 3D") \
DRI_CONF_DESC(nl,"3D versnelling uitschakelen") \
DRI_CONF_DESC(fr,"Désactiver l'accélération 3D") \
DRI_CONF_OPT_END
#define DRI_CONF_PERFORMANCE_BOXES(def) \
DRI_CONF_OPT_BEGIN(performance_boxes,bool,def) \
DRI_CONF_DESC(en,"Show performance boxes") \
DRI_CONF_DESC(de,"Zeige Performanceboxen") \
DRI_CONF_DESC(es,"Mostrar cajas de rendimiento") \
DRI_CONF_DESC(nl,"Laat prestatie boxjes zien") \
DRI_CONF_DESC(fr,"Afficher les boîtes de performance") \
DRI_CONF_OPT_END
/** \brief Texture-related options */
#define DRI_CONF_SECTION_QUALITY \
DRI_CONF_SECTION_BEGIN \
DRI_CONF_DESC(en,"Image Quality") \
DRI_CONF_DESC(de,"Bildqualität") \
DRI_CONF_DESC(es,"Calidad de imagen") \
DRI_CONF_DESC(nl,"Beeldkwaliteit") \
DRI_CONF_DESC(fr,"Qualité d'image")
#define DRI_CONF_TEXTURE_DEPTH_FB 0
#define DRI_CONF_TEXTURE_DEPTH_32 1
#define DRI_CONF_TEXTURE_DEPTH_16 2
#define DRI_CONF_TEXTURE_DEPTH_FORCE_16 3
#define DRI_CONF_TEXTURE_DEPTH(def) \
DRI_CONF_OPT_BEGIN_V(texture_depth,enum,def,"0:3") \
DRI_CONF_DESC_BEGIN(en,"Texture color depth") \
DRI_CONF_ENUM(0,"Prefer frame buffer color depth") \
DRI_CONF_ENUM(1,"Prefer 32 bits per texel") \
DRI_CONF_ENUM(2,"Prefer 16 bits per texel") \
DRI_CONF_ENUM(3,"Force 16 bits per texel") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Texturfarbtiefe") \
DRI_CONF_ENUM(0,"Bevorzuge Farbtiefe des Framebuffers") \
DRI_CONF_ENUM(1,"Bevorzuge 32 bits pro Texel") \
DRI_CONF_ENUM(2,"Bevorzuge 16 bits pro Texel") \
DRI_CONF_ENUM(3,"Erzwinge 16 bits pro Texel") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(es,"Profundidad de color de textura") \
DRI_CONF_ENUM(0,"Preferir profundidad de color del ”framebuffer“") \
DRI_CONF_ENUM(1,"Preferir 32 bits por texel") \
DRI_CONF_ENUM(2,"Preferir 16 bits por texel") \
DRI_CONF_ENUM(3,"Forzar a 16 bits por texel") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(nl,"Textuurkleurendiepte") \
DRI_CONF_ENUM(0,"Prefereer kaderbufferkleurdiepte") \
DRI_CONF_ENUM(1,"Prefereer 32 bits per texel") \
DRI_CONF_ENUM(2,"Prefereer 16 bits per texel") \
DRI_CONF_ENUM(3,"Dwing 16 bits per texel af") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(fr,"Profondeur de texture") \
DRI_CONF_ENUM(0,"Profondeur de couleur") \
DRI_CONF_ENUM(1,"Préférer 32 bits par texel") \
DRI_CONF_ENUM(2,"Prérérer 16 bits par texel") \
DRI_CONF_ENUM(3,"Forcer 16 bits par texel") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_DEF_MAX_ANISOTROPY(def,range) \
DRI_CONF_OPT_BEGIN_V(def_max_anisotropy,float,def,range) \
DRI_CONF_DESC(en,"Initial maximum value for anisotropic texture filtering") \
DRI_CONF_DESC(de,"Initialer Maximalwert für anisotropische Texturfilterung") \
DRI_CONF_DESC(es,"Valor máximo inicial para filtrado anisotrópico de textura") \
DRI_CONF_DESC(nl,"Initïele maximum waarde voor anisotrophische textuur filtering") \
DRI_CONF_DESC(fr,"Valeur maximale initiale pour le filtrage anisotropique de texture") \
DRI_CONF_OPT_END
#define DRI_CONF_NO_NEG_LOD_BIAS(def) \
DRI_CONF_OPT_BEGIN(no_neg_lod_bias,bool,def) \
DRI_CONF_DESC(en,"Forbid negative texture LOD bias") \
DRI_CONF_DESC(de,"Verbiete negative Textur-Detailgradverschiebung") \
DRI_CONF_DESC(es,"Prohibir valores negativos de Nivel De Detalle (LOD) de texturas") \
DRI_CONF_DESC(nl,"Verbied negatief niveau detailonderscheid (LOD) van texturen") \
DRI_CONF_DESC(fr,"Interdire le LOD bias negatif") \
DRI_CONF_OPT_END
#define DRI_CONF_FORCE_S3TC_ENABLE(def) \
DRI_CONF_OPT_BEGIN(force_s3tc_enable,bool,def) \
DRI_CONF_DESC(en,"Enable S3TC texture compression even if software support is not available") \
DRI_CONF_DESC(de,"Aktiviere S3TC Texturkomprimierung auch wenn die nötige Softwareunterstützung fehlt") \
DRI_CONF_DESC(es,"Activar la compresión de texturas S3TC incluso si el soporte por software no está disponible") \
DRI_CONF_DESC(nl,"Schakel S3TC textuurcompressie in, zelfs als softwareondersteuning niet aanwezig is") \
DRI_CONF_DESC(fr,"Activer la compression de texture S3TC même si le support logiciel est absent") \
DRI_CONF_OPT_END
#define DRI_CONF_COLOR_REDUCTION_ROUND 0
#define DRI_CONF_COLOR_REDUCTION_DITHER 1
#define DRI_CONF_COLOR_REDUCTION(def) \
DRI_CONF_OPT_BEGIN_V(color_reduction,enum,def,"0:1") \
DRI_CONF_DESC_BEGIN(en,"Initial color reduction method") \
DRI_CONF_ENUM(0,"Round colors") \
DRI_CONF_ENUM(1,"Dither colors") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Initiale Farbreduktionsmethode") \
DRI_CONF_ENUM(0,"Farben runden") \
DRI_CONF_ENUM(1,"Farben rastern") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(es,"Método inicial de reducción de color") \
DRI_CONF_ENUM(0,"Colores redondeados") \
DRI_CONF_ENUM(1,"Colores suavizados") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(nl,"Initïele kleurreductie methode") \
DRI_CONF_ENUM(0,"Rond kleuren af") \
DRI_CONF_ENUM(1,"Rasteriseer kleuren") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(fr,"Technique de réduction de couleurs") \
DRI_CONF_ENUM(0,"Arrondir les valeurs de couleur") \
DRI_CONF_ENUM(1,"Tramer les couleurs") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_ROUND_TRUNC 0
#define DRI_CONF_ROUND_ROUND 1
#define DRI_CONF_ROUND_MODE(def) \
DRI_CONF_OPT_BEGIN_V(round_mode,enum,def,"0:1") \
DRI_CONF_DESC_BEGIN(en,"Color rounding method") \
DRI_CONF_ENUM(0,"Round color components downward") \
DRI_CONF_ENUM(1,"Round to nearest color") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Farbrundungsmethode") \
DRI_CONF_ENUM(0,"Farbkomponenten abrunden") \
DRI_CONF_ENUM(1,"Zur ähnlichsten Farbe runden") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(es,"Método de redondeo de colores") \
DRI_CONF_ENUM(0,"Redondear hacia abajo los componentes de color") \
DRI_CONF_ENUM(1,"Redondear al color más cercano") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(nl,"Kleurafrondingmethode") \
DRI_CONF_ENUM(0,"Rond kleurencomponenten af naar beneden") \
DRI_CONF_ENUM(1,"Rond af naar dichtsbijzijnde kleur") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(fr,"Méthode d'arrondi des couleurs") \
DRI_CONF_ENUM(0,"Arrondi à l'inférieur") \
DRI_CONF_ENUM(1,"Arrondi au plus proche") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_DITHER_XERRORDIFF 0
#define DRI_CONF_DITHER_XERRORDIFFRESET 1
#define DRI_CONF_DITHER_ORDERED 2
#define DRI_CONF_DITHER_MODE(def) \
DRI_CONF_OPT_BEGIN_V(dither_mode,enum,def,"0:2") \
DRI_CONF_DESC_BEGIN(en,"Color dithering method") \
DRI_CONF_ENUM(0,"Horizontal error diffusion") \
DRI_CONF_ENUM(1,"Horizontal error diffusion, reset error at line start") \
DRI_CONF_ENUM(2,"Ordered 2D color dithering") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Farbrasterungsmethode") \
DRI_CONF_ENUM(0,"Horizontale Fehlerstreuung") \
DRI_CONF_ENUM(1,"Horizontale Fehlerstreuung, Fehler am Zeilenanfang zurücksetzen") \
DRI_CONF_ENUM(2,"Geordnete 2D Farbrasterung") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(es,"Método de suavizado de color") \
DRI_CONF_ENUM(0,"Difusión de error horizontal") \
DRI_CONF_ENUM(1,"Difusión de error horizontal, reiniciar error al comienzo de línea") \
DRI_CONF_ENUM(2,"Suavizado de color 2D ordenado") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(nl,"Kleurrasteriseringsmethode") \
DRI_CONF_ENUM(0,"Horizontale foutdiffusie") \
DRI_CONF_ENUM(1,"Horizontale foutdiffusie, zet fout bij lijnbegin terug") \
DRI_CONF_ENUM(2,"Geordende 2D kleurrasterisering") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(fr,"Méthode de tramage") \
DRI_CONF_ENUM(0,"Diffusion d'erreur horizontale") \
DRI_CONF_ENUM(1,"Diffusion d'erreur horizontale, réinitialisé pour chaque ligne") \
DRI_CONF_ENUM(2,"Tramage ordonné des couleurs") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_FLOAT_DEPTH(def) \
DRI_CONF_OPT_BEGIN(float_depth,bool,def) \
DRI_CONF_DESC(en,"Floating point depth buffer") \
DRI_CONF_DESC(de,"Fließkomma z-Puffer") \
DRI_CONF_DESC(es,"Búfer de profundidad en coma flotante") \
DRI_CONF_DESC(nl,"Dieptebuffer als commagetal") \
DRI_CONF_DESC(fr,"Z-buffer en virgule flottante") \
DRI_CONF_OPT_END
/** \brief Performance-related options */
#define DRI_CONF_SECTION_PERFORMANCE \
DRI_CONF_SECTION_BEGIN \
DRI_CONF_DESC(en,"Performance") \
DRI_CONF_DESC(de,"Leistung") \
DRI_CONF_DESC(es,"Rendimiento") \
DRI_CONF_DESC(nl,"Prestatie") \
DRI_CONF_DESC(fr,"Performance")
#define DRI_CONF_TCL_SW 0
#define DRI_CONF_TCL_PIPELINED 1
#define DRI_CONF_TCL_VTXFMT 2
#define DRI_CONF_TCL_CODEGEN 3
#define DRI_CONF_TCL_MODE(def) \
DRI_CONF_OPT_BEGIN_V(tcl_mode,enum,def,"0:3") \
DRI_CONF_DESC_BEGIN(en,"TCL mode (Transformation, Clipping, Lighting)") \
DRI_CONF_ENUM(0,"Use software TCL pipeline") \
DRI_CONF_ENUM(1,"Use hardware TCL as first TCL pipeline stage") \
DRI_CONF_ENUM(2,"Bypass the TCL pipeline") \
DRI_CONF_ENUM(3,"Bypass the TCL pipeline with state-based machine code generated on-the-fly") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"TCL-Modus (Transformation, Clipping, Licht)") \
DRI_CONF_ENUM(0,"Benutze die Software-TCL-Pipeline") \
DRI_CONF_ENUM(1,"Benutze Hardware TCL als erste Stufe der TCL-Pipeline") \
DRI_CONF_ENUM(2,"Umgehe die TCL-Pipeline") \
DRI_CONF_ENUM(3,"Umgehe die TCL-Pipeline mit zur Laufzeit erzeugtem, zustandsbasiertem Maschinencode") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(es,"Modo TCL (Transformación, Recorte, Iluminación)") \
DRI_CONF_ENUM(0,"Usar tubería TCL por software") \
DRI_CONF_ENUM(1,"Usar TCL por hardware en la primera fase de la tubería TCL") \
DRI_CONF_ENUM(2,"Pasar por alto la tubería TCL") \
DRI_CONF_ENUM(3,"Pasar por alto la tubería TCL con código máquina basado en estados generado al vuelo") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(nl,"TCL-modus (Transformatie, Clipping, Licht)") \
DRI_CONF_ENUM(0,"Gebruik software TCL pijpleiding") \
DRI_CONF_ENUM(1,"Gebruik hardware TCL as eerste TCL pijpleiding trap") \
DRI_CONF_ENUM(2,"Omzeil de TCL pijpleiding") \
DRI_CONF_ENUM(3,"Omzeil de TCL pijpleiding met staatgebaseerde machinecode die tijdens executie gegenereerd wordt") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(fr,"Mode de TCL (Transformation, Clipping, Eclairage)") \
DRI_CONF_ENUM(0,"Utiliser un pipeline TCL logiciel") \
DRI_CONF_ENUM(1,"Utiliser le TCL matériel pour le premier niveau de pipeline") \
DRI_CONF_ENUM(2,"Court-circuiter le pipeline TCL") \
DRI_CONF_ENUM(3,"Court-circuiter le pipeline TCL par une machine à états qui génère le codede TCL à la volée") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_FTHROTTLE_BUSY 0
#define DRI_CONF_FTHROTTLE_USLEEPS 1
#define DRI_CONF_FTHROTTLE_IRQS 2
#define DRI_CONF_FTHROTTLE_MODE(def) \
DRI_CONF_OPT_BEGIN_V(fthrottle_mode,enum,def,"0:2") \
DRI_CONF_DESC_BEGIN(en,"Method to limit rendering latency") \
DRI_CONF_ENUM(0,"Busy waiting for the graphics hardware") \
DRI_CONF_ENUM(1,"Sleep for brief intervals while waiting for the graphics hardware") \
DRI_CONF_ENUM(2,"Let the graphics hardware emit a software interrupt and sleep") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Methode zur Begrenzung der Bildverzögerung") \
DRI_CONF_ENUM(0,"Aktives Warten auf die Grafikhardware") \
DRI_CONF_ENUM(1,"Kurze Schlafintervalle beim Warten auf die Grafikhardware") \
DRI_CONF_ENUM(2,"Die Grafikhardware eine Softwareunterbrechnung erzeugen lassen und schlafen") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(es,"Método para limitar la latencia de rénder") \
DRI_CONF_ENUM(0,"Esperar activamente al hardware gráfico") \
DRI_CONF_ENUM(1,"Dormir en intervalos cortos mientras se espera al hardware gráfico") \
DRI_CONF_ENUM(2,"Permitir que el hardware gráfico emita una interrupción de software y duerma") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(nl,"Methode om beeldopbouwvertraging te onderdrukken") \
DRI_CONF_ENUM(0,"Actief wachten voor de grafische hardware") \
DRI_CONF_ENUM(1,"Slaap voor korte intervallen tijdens het wachten op de grafische hardware") \
DRI_CONF_ENUM(2,"Laat de grafische hardware een software onderbreking uitzenden en in slaap vallen") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(fr,"Méthode d'attente de la carte graphique") \
DRI_CONF_ENUM(0,"Attente active de la carte graphique") \
DRI_CONF_ENUM(1,"Attente utilisant usleep()") \
DRI_CONF_ENUM(2,"Utiliser les interruptions") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_VBLANK_NEVER 0
#define DRI_CONF_VBLANK_DEF_INTERVAL_0 1
#define DRI_CONF_VBLANK_DEF_INTERVAL_1 2
#define DRI_CONF_VBLANK_ALWAYS_SYNC 3
#define DRI_CONF_VBLANK_MODE(def) \
DRI_CONF_OPT_BEGIN_V(vblank_mode,enum,def,"0:3") \
DRI_CONF_DESC_BEGIN(en,"Synchronization with vertical refresh (swap intervals)") \
DRI_CONF_ENUM(0,"Never synchronize with vertical refresh, ignore application's choice") \
DRI_CONF_ENUM(1,"Initial swap interval 0, obey application's choice") \
DRI_CONF_ENUM(2,"Initial swap interval 1, obey application's choice") \
DRI_CONF_ENUM(3,"Always synchronize with vertical refresh, application chooses the minimum swap interval") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Synchronisation mit der vertikalen Bildwiederholung") \
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_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") \
DRI_CONF_ENUM(1,"Intervalo de intercambio inicial 0, obedecer la elección de la aplicación") \
DRI_CONF_ENUM(2,"Intervalo de intercambio inicial 1, obedecer la elección de la aplicación") \
DRI_CONF_ENUM(3,"Sincronizar siempre con el refresco vertical, la aplicación elige el intervalo de intercambio mínimo") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(nl,"Synchronisatie met verticale verversing (interval omwisselen)") \
DRI_CONF_ENUM(0,"Nooit synchroniseren met verticale verversing, negeer de keuze van de applicatie") \
DRI_CONF_ENUM(1,"Initïeel omwisselingsinterval 0, honoreer de keuze van de applicatie") \
DRI_CONF_ENUM(2,"Initïeel omwisselingsinterval 1, honoreer de keuze van de applicatie") \
DRI_CONF_ENUM(3,"Synchroniseer altijd met verticale verversing, de applicatie kiest het minimum omwisselingsinterval") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(fr,"Synchronisation de l'affichage avec le balayage vertical") \
DRI_CONF_ENUM(0,"Ne jamais synchroniser avec le balayage vertical, ignorer le choix de l'application") \
DRI_CONF_ENUM(1,"Ne pas synchroniser avec le balayage vertical par défaut, mais obéir au choix de l'application") \
DRI_CONF_ENUM(2,"Synchroniser avec le balayage vertical par défaut, mais obéir au choix de l'application") \
DRI_CONF_ENUM(3,"Toujours synchroniser avec le balayage vertical, l'application choisit l'intervalle minimal") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_HYPERZ_DISABLED 0
#define DRI_CONF_HYPERZ_ENABLED 1
#define DRI_CONF_HYPERZ(def) \
DRI_CONF_OPT_BEGIN(hyperz,bool,def) \
DRI_CONF_DESC(en,"Use HyperZ to boost performance") \
DRI_CONF_DESC(de,"HyperZ zur Leistungssteigerung verwenden") \
DRI_CONF_DESC(es,"Usar HyperZ para potenciar rendimiento") \
DRI_CONF_DESC(nl,"Gebruik HyperZ om de prestaties te verbeteren") \
DRI_CONF_DESC(fr,"Utiliser le HyperZ pour améliorer les performances") \
DRI_CONF_OPT_END
#define DRI_CONF_MAX_TEXTURE_UNITS(def,min,max) \
DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min ":" # max ) \
DRI_CONF_DESC(en,"Number of texture units used") \
DRI_CONF_DESC(de,"Anzahl der benutzten Textureinheiten") \
DRI_CONF_DESC(es,"Número de unidades de textura usadas") \
DRI_CONF_DESC(nl,"Aantal textuureenheden in gebruik") \
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") \
DRI_CONF_OPT_END
#define DRI_CONF_TEXTURE_BLEND_QUALITY(def,range) \
DRI_CONF_OPT_BEGIN_V(texture_blend_quality,float,def,range) \
DRI_CONF_DESC(en,"Texture filtering quality vs. speed, AKA “brilinear” texture filtering") \
DRI_CONF_DESC(de,"Texturfilterqualität versus -geschwindigkeit, auch bekannt als „brilineare“ Texturfilterung") \
DRI_CONF_DESC(es,"Calidad de filtrado de textura vs. velocidad, alias filtrado ”brilinear“ de textura") \
DRI_CONF_DESC(nl,"Textuurfilterkwaliteit versus -snelheid, ookwel bekend als “brilineaire” textuurfiltering") \
DRI_CONF_DESC(fr,"Qualité/performance du filtrage trilinéaire de texture (filtrage brilinéaire)") \
DRI_CONF_OPT_END
#define DRI_CONF_TEXTURE_HEAPS_ALL 0
#define DRI_CONF_TEXTURE_HEAPS_CARD 1
#define DRI_CONF_TEXTURE_HEAPS_GART 2
#define DRI_CONF_TEXTURE_HEAPS(def) \
DRI_CONF_OPT_BEGIN_V(texture_heaps,enum,def,"0:2") \
DRI_CONF_DESC_BEGIN(en,"Used types of texture memory") \
DRI_CONF_ENUM(0,"All available memory") \
DRI_CONF_ENUM(1,"Only card memory (if available)") \
DRI_CONF_ENUM(2,"Only GART (AGP/PCIE) memory (if available)") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Benutzte Arten von Texturspeicher") \
DRI_CONF_ENUM(0,"Aller verfügbarer Speicher") \
DRI_CONF_ENUM(1,"Nur Grafikspeicher (falls verfügbar)") \
DRI_CONF_ENUM(2,"Nur GART-Speicher (AGP/PCIE) (falls verfügbar)") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(es,"Tipos de memoria de textura usados") \
DRI_CONF_ENUM(0,"Toda la memoria disponible") \
DRI_CONF_ENUM(1,"Sólo la memoria de la tarjeta (si disponible)") \
DRI_CONF_ENUM(2,"Sólo memoria GART (AGP/PCIE) (si disponible)") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(nl,"Gebruikte soorten textuurgeheugen") \
DRI_CONF_ENUM(0,"Al het beschikbaar geheugen") \
DRI_CONF_ENUM(1,"Alleen geheugen op de kaart (als het aanwezig is)") \
DRI_CONF_ENUM(2,"Alleen GART (AGP/PCIE) geheugen (als het aanwezig is)") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(fr,"Types de mémoire de texture") \
DRI_CONF_ENUM(0,"Utiliser toute la mémoire disponible") \
DRI_CONF_ENUM(1,"Utiliser uniquement la mémoire graphique (si disponible)") \
DRI_CONF_ENUM(2,"Utiliser uniquement la mémoire GART (AGP/PCIE) (si disponible)") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
/* Options for features that are not done in hardware by the driver (like GL_ARB_vertex_program
On cards where there is no documentation (r200) or on rasterization-only hardware). */
#define DRI_CONF_SECTION_SOFTWARE \
DRI_CONF_SECTION_BEGIN \
DRI_CONF_DESC(en,"Features that are not hardware-accelerated") \
DRI_CONF_DESC(de,"Funktionalität, die nicht hardwarebeschleunigt ist") \
DRI_CONF_DESC(es,"Características no aceleradas por hardware") \
DRI_CONF_DESC(nl,"Eigenschappen die niet hardwareversneld zijn") \
DRI_CONF_DESC(fr,"Fonctionnalités ne bénéficiant pas d'une accélération matérielle")
#define DRI_CONF_ARB_VERTEX_PROGRAM(def) \
DRI_CONF_OPT_BEGIN(arb_vertex_program,bool,def) \
DRI_CONF_DESC(en,"Enable extension GL_ARB_vertex_program") \
DRI_CONF_DESC(de,"Erweiterung GL_ARB_vertex_program aktivieren") \
DRI_CONF_DESC(es,"Activar la extensión GL_ARB_vertex_program") \
DRI_CONF_DESC(nl,"Zet uitbreiding GL_ARB_vertex_program aan") \
DRI_CONF_DESC(fr,"Activer l'extension GL_ARB_vertex_program") \
DRI_CONF_OPT_END
#define DRI_CONF_NV_VERTEX_PROGRAM(def) \
DRI_CONF_OPT_BEGIN(nv_vertex_program,bool,def) \
DRI_CONF_DESC(en,"Enable extension GL_NV_vertex_program") \
DRI_CONF_DESC(de,"Erweiterung GL_NV_vertex_program aktivieren") \
DRI_CONF_DESC(es,"Activar extensión GL_NV_vertex_program") \
DRI_CONF_DESC(nl,"Zet uitbreiding GL_NV_vertex_program aan") \
DRI_CONF_DESC(fr,"Activer l'extension GL_NV_vertex_program") \
DRI_CONF_OPT_END

View File

@@ -0,0 +1,230 @@
/*
* XML DRI client-side driver configuration
* Copyright (C) 2003 Felix Kuehling
*
* 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
* FELIX KUEHLING, 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.
*
*/
/**
* \file t_options.h
* \brief Templates of common options
* \author Felix Kuehling
*
* This file defines macros for common options that can be used to
* construct driConfigOptions in the drivers. This file is only a
* template containing English descriptions for options wrapped in
* gettext(). xgettext can be used to extract translatable
* strings. These strings can then be translated by anyone familiar
* with GNU gettext. gen_xmlpool.py takes this template and fills in
* all the translations. The result (options.h) is included by
* xmlpool.h which in turn can be included by drivers.
*
* The macros used to describe otions in this file are defined in
* ../xmlpool.h.
*/
/* This is needed for xgettext to extract translatable strings.
* gen_xmlpool.py will discard this line. */
#include <libintl.h>
/*
* predefined option sections and options with multi-lingual descriptions
*/
/** \brief Debugging options */
#define DRI_CONF_SECTION_DEBUG \
DRI_CONF_SECTION_BEGIN \
DRI_CONF_DESC(en,gettext("Debugging"))
#define DRI_CONF_NO_RAST(def) \
DRI_CONF_OPT_BEGIN(no_rast,bool,def) \
DRI_CONF_DESC(en,gettext("Disable 3D acceleration")) \
DRI_CONF_OPT_END
#define DRI_CONF_PERFORMANCE_BOXES(def) \
DRI_CONF_OPT_BEGIN(performance_boxes,bool,def) \
DRI_CONF_DESC(en,gettext("Show performance boxes")) \
DRI_CONF_OPT_END
/** \brief Texture-related options */
#define DRI_CONF_SECTION_QUALITY \
DRI_CONF_SECTION_BEGIN \
DRI_CONF_DESC(en,gettext("Image Quality"))
#define DRI_CONF_TEXTURE_DEPTH_FB 0
#define DRI_CONF_TEXTURE_DEPTH_32 1
#define DRI_CONF_TEXTURE_DEPTH_16 2
#define DRI_CONF_TEXTURE_DEPTH_FORCE_16 3
#define DRI_CONF_TEXTURE_DEPTH(def) \
DRI_CONF_OPT_BEGIN_V(texture_depth,enum,def,"0:3") \
DRI_CONF_DESC_BEGIN(en,gettext("Texture color depth")) \
DRI_CONF_ENUM(0,gettext("Prefer frame buffer color depth")) \
DRI_CONF_ENUM(1,gettext("Prefer 32 bits per texel")) \
DRI_CONF_ENUM(2,gettext("Prefer 16 bits per texel")) \
DRI_CONF_ENUM(3,gettext("Force 16 bits per texel")) \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_DEF_MAX_ANISOTROPY(def,range) \
DRI_CONF_OPT_BEGIN_V(def_max_anisotropy,float,def,range) \
DRI_CONF_DESC(en,gettext("Initial maximum value for anisotropic texture filtering")) \
DRI_CONF_OPT_END
#define DRI_CONF_NO_NEG_LOD_BIAS(def) \
DRI_CONF_OPT_BEGIN(no_neg_lod_bias,bool,def) \
DRI_CONF_DESC(en,gettext("Forbid negative texture LOD bias")) \
DRI_CONF_OPT_END
#define DRI_CONF_FORCE_S3TC_ENABLE(def) \
DRI_CONF_OPT_BEGIN(force_s3tc_enable,bool,def) \
DRI_CONF_DESC(en,gettext("Enable S3TC texture compression even if software support is not available")) \
DRI_CONF_OPT_END
#define DRI_CONF_COLOR_REDUCTION_ROUND 0
#define DRI_CONF_COLOR_REDUCTION_DITHER 1
#define DRI_CONF_COLOR_REDUCTION(def) \
DRI_CONF_OPT_BEGIN_V(color_reduction,enum,def,"0:1") \
DRI_CONF_DESC_BEGIN(en,gettext("Initial color reduction method")) \
DRI_CONF_ENUM(0,gettext("Round colors")) \
DRI_CONF_ENUM(1,gettext("Dither colors")) \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_ROUND_TRUNC 0
#define DRI_CONF_ROUND_ROUND 1
#define DRI_CONF_ROUND_MODE(def) \
DRI_CONF_OPT_BEGIN_V(round_mode,enum,def,"0:1") \
DRI_CONF_DESC_BEGIN(en,gettext("Color rounding method")) \
DRI_CONF_ENUM(0,gettext("Round color components downward")) \
DRI_CONF_ENUM(1,gettext("Round to nearest color")) \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_DITHER_XERRORDIFF 0
#define DRI_CONF_DITHER_XERRORDIFFRESET 1
#define DRI_CONF_DITHER_ORDERED 2
#define DRI_CONF_DITHER_MODE(def) \
DRI_CONF_OPT_BEGIN_V(dither_mode,enum,def,"0:2") \
DRI_CONF_DESC_BEGIN(en,gettext("Color dithering method")) \
DRI_CONF_ENUM(0,gettext("Horizontal error diffusion")) \
DRI_CONF_ENUM(1,gettext("Horizontal error diffusion, reset error at line start")) \
DRI_CONF_ENUM(2,gettext("Ordered 2D color dithering")) \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_FLOAT_DEPTH(def) \
DRI_CONF_OPT_BEGIN(float_depth,bool,def) \
DRI_CONF_DESC(en,gettext("Floating point depth buffer")) \
DRI_CONF_OPT_END
/** \brief Performance-related options */
#define DRI_CONF_SECTION_PERFORMANCE \
DRI_CONF_SECTION_BEGIN \
DRI_CONF_DESC(en,gettext("Performance"))
#define DRI_CONF_TCL_SW 0
#define DRI_CONF_TCL_PIPELINED 1
#define DRI_CONF_TCL_VTXFMT 2
#define DRI_CONF_TCL_CODEGEN 3
#define DRI_CONF_TCL_MODE(def) \
DRI_CONF_OPT_BEGIN_V(tcl_mode,enum,def,"0:3") \
DRI_CONF_DESC_BEGIN(en,gettext("TCL mode (Transformation, Clipping, Lighting)")) \
DRI_CONF_ENUM(0,gettext("Use software TCL pipeline")) \
DRI_CONF_ENUM(1,gettext("Use hardware TCL as first TCL pipeline stage")) \
DRI_CONF_ENUM(2,gettext("Bypass the TCL pipeline")) \
DRI_CONF_ENUM(3,gettext("Bypass the TCL pipeline with state-based machine code generated on-the-fly")) \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_FTHROTTLE_BUSY 0
#define DRI_CONF_FTHROTTLE_USLEEPS 1
#define DRI_CONF_FTHROTTLE_IRQS 2
#define DRI_CONF_FTHROTTLE_MODE(def) \
DRI_CONF_OPT_BEGIN_V(fthrottle_mode,enum,def,"0:2") \
DRI_CONF_DESC_BEGIN(en,gettext("Method to limit rendering latency")) \
DRI_CONF_ENUM(0,gettext("Busy waiting for the graphics hardware")) \
DRI_CONF_ENUM(1,gettext("Sleep for brief intervals while waiting for the graphics hardware")) \
DRI_CONF_ENUM(2,gettext("Let the graphics hardware emit a software interrupt and sleep")) \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_VBLANK_NEVER 0
#define DRI_CONF_VBLANK_DEF_INTERVAL_0 1
#define DRI_CONF_VBLANK_DEF_INTERVAL_1 2
#define DRI_CONF_VBLANK_ALWAYS_SYNC 3
#define DRI_CONF_VBLANK_MODE(def) \
DRI_CONF_OPT_BEGIN_V(vblank_mode,enum,def,"0:3") \
DRI_CONF_DESC_BEGIN(en,gettext("Synchronization with vertical refresh (swap intervals)")) \
DRI_CONF_ENUM(0,gettext("Never synchronize with vertical refresh, ignore application's choice")) \
DRI_CONF_ENUM(1,gettext("Initial swap interval 0, obey application's choice")) \
DRI_CONF_ENUM(2,gettext("Initial swap interval 1, obey application's choice")) \
DRI_CONF_ENUM(3,gettext("Always synchronize with vertical refresh, application chooses the minimum swap interval")) \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_HYPERZ_DISABLED 0
#define DRI_CONF_HYPERZ_ENABLED 1
#define DRI_CONF_HYPERZ(def) \
DRI_CONF_OPT_BEGIN(hyperz,bool,def) \
DRI_CONF_DESC(en,gettext("Use HyperZ to boost performance")) \
DRI_CONF_OPT_END
#define DRI_CONF_MAX_TEXTURE_UNITS(def,min,max) \
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")) \
DRI_CONF_OPT_END
#define DRI_CONF_TEXTURE_BLEND_QUALITY(def,range) \
DRI_CONF_OPT_BEGIN_V(texture_blend_quality,float,def,range) \
DRI_CONF_DESC(en,gettext("Texture filtering quality vs. speed, AKA “brilinear” texture filtering")) \
DRI_CONF_OPT_END
#define DRI_CONF_TEXTURE_HEAPS_ALL 0
#define DRI_CONF_TEXTURE_HEAPS_CARD 1
#define DRI_CONF_TEXTURE_HEAPS_GART 2
#define DRI_CONF_TEXTURE_HEAPS(def) \
DRI_CONF_OPT_BEGIN_V(texture_heaps,enum,def,"0:2") \
DRI_CONF_DESC_BEGIN(en,gettext("Used types of texture memory")) \
DRI_CONF_ENUM(0,gettext("All available memory")) \
DRI_CONF_ENUM(1,gettext("Only card memory (if available)")) \
DRI_CONF_ENUM(2,gettext("Only GART (AGP/PCIE) memory (if available)")) \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
/* Options for features that are not done in hardware by the driver (like GL_ARB_vertex_program
On cards where there is no documentation (r200) or on rasterization-only hardware). */
#define DRI_CONF_SECTION_SOFTWARE \
DRI_CONF_SECTION_BEGIN \
DRI_CONF_DESC(en,gettext("Features that are not hardware-accelerated"))
#define DRI_CONF_ARB_VERTEX_PROGRAM(def) \
DRI_CONF_OPT_BEGIN(arb_vertex_program,bool,def) \
DRI_CONF_DESC(en,gettext("Enable extension GL_ARB_vertex_program")) \
DRI_CONF_OPT_END
#define DRI_CONF_NV_VERTEX_PROGRAM(def) \
DRI_CONF_OPT_BEGIN(nv_vertex_program,bool,def) \
DRI_CONF_DESC(en,gettext("Enable extension GL_NV_vertex_program")) \
DRI_CONF_OPT_END

View File

@@ -12,6 +12,7 @@ COMMON_SOURCES = \
../common/texmem.c \
../common/vblank.c \
../common/dri_util.c \
../common/xmlconfig.c \
../common/glcontextmodes.c
DRIVER_SOURCES = \
@@ -23,6 +24,7 @@ C_SOURCES = \
ASM_SOURCES =
include ../Makefile.template
symlinks:

View File

@@ -22,7 +22,6 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* Minimal swrast-based dri loadable driver.
*
* Todo:
@@ -42,35 +41,12 @@
* that may not be valid everywhere.
*/
#include <assert.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include <linux/kd.h>
#include <linux/vt.h>
#include "GL/miniglx.h" /* window-system-specific */
#include "miniglxP.h" /* window-system-specific */
#include "dri_util.h" /* window-system-specific-ish */
#include "driver.h"
#include "drm.h"
#include "utils.h"
#include "buffers.h"
#include "context.h"
#include "extensions.h"
#include "imports.h"
#include "matrix.h"
#include "texformat.h"
#include "texstore.h"
#include "teximage.h"
#include "array_cache/acache.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
@@ -80,7 +56,6 @@
#include "drivers/common/driverfuncs.h"
typedef struct {
GLcontext *glCtx; /* Mesa context */
@@ -89,11 +64,34 @@ typedef struct {
__DRIscreenPrivate *screen;
__DRIdrawablePrivate *drawable; /* drawable bound to this ctx */
} dri;
} fbContext, *fbContextPtr;
typedef struct {
GLframebuffer *mesa_framebuffer;
void *currentBuffer;
void *frontBuffer;
void *backBuffer;
int currentPitch;
} fbDrawable, *fbDrawablePtr;
typedef struct {
unsigned long hFrameBuffer;
int fbOrigin;
int fbSize;
int fbStride;
int fbWidth;
int fbHeight;
int bpp;
int drmFD;
drmAddress fbMap;
} fbDRI, *fbDRIPtr;
#define FB_CONTEXT(ctx) ((fbContextPtr)(ctx->DriverCtx))
#ifdef USE_NEW_INTERFACE
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
#endif /* USE_NEW_INTERFACE */
static const GLubyte *
get_string(GLcontext *ctx, GLenum pname)
@@ -147,18 +145,19 @@ set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit )
{
fbContextPtr fbdevctx = FB_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = fbdevctx->dri.drawable;
fbDrawablePtr fbdrawable = (fbDrawablePtr)dPriv->driverPrivate;
/* What a twisted mess of private structs
*/
assert(buffer == dPriv->driverPrivate);
assert(buffer == fbdrawable->mesa_framebuffer);
switch (bufferBit) {
case DD_FRONT_LEFT_BIT:
dPriv->currentBuffer = dPriv->frontBuffer;
fbdrawable->currentBuffer = fbdrawable->frontBuffer;
break;
case DD_BACK_LEFT_BIT:
dPriv->currentBuffer = dPriv->backBuffer;
fbdrawable->currentBuffer = fbdrawable->backBuffer;
break;
default:
/* This happens a lot if the client renders to the frontbuffer */
@@ -188,9 +187,10 @@ init_core_functions( struct dd_function_table *functions )
#define NAME(PREFIX) PREFIX##_B8G8R8
#define SPAN_VARS \
const fbContextPtr fbdevctx = FB_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = fbdevctx->dri.drawable;
__DRIdrawablePrivate *dPriv = fbdevctx->dri.drawable; \
const fbDrawablePtr fbdrawable = (fbDrawablePtr)dPriv->driverPrivate;
#define INIT_PIXEL_PTR(P, X, Y) \
GLubyte *P = (GLubyte *)dPriv->currentBuffer + (Y) * dPriv->currentPitch + (X) * 3
GLubyte *P = (GLubyte *)fbdrawable->currentBuffer + (Y) * fbdrawable->currentPitch + (X) * 3
#define INC_PIXEL_PTR(P) P += 3
#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
P[0] = B; P[1] = G; P[2] = R
@@ -206,9 +206,10 @@ init_core_functions( struct dd_function_table *functions )
#define NAME(PREFIX) PREFIX##_B8G8R8A8
#define SPAN_VARS \
const fbContextPtr fbdevctx = FB_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = fbdevctx->dri.drawable;
__DRIdrawablePrivate *dPriv = fbdevctx->dri.drawable; \
const fbDrawablePtr fbdrawable = (fbDrawablePtr)dPriv->driverPrivate;
#define INIT_PIXEL_PTR(P, X, Y) \
GLubyte *P = (GLubyte *)dPriv->currentBuffer + (Y) * dPriv->currentPitch + (X) * 4;
GLubyte *P = (GLubyte *)fbdrawable->currentBuffer + (Y) * fbdrawable->currentPitch + (X) * 4;
#define INC_PIXEL_PTR(P) P += 4
#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
P[0] = B; P[1] = G; P[2] = R; P[3] = 255
@@ -224,9 +225,10 @@ init_core_functions( struct dd_function_table *functions )
#define NAME(PREFIX) PREFIX##_B5G6R5
#define SPAN_VARS \
const fbContextPtr fbdevctx = FB_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = fbdevctx->dri.drawable;
__DRIdrawablePrivate *dPriv = fbdevctx->dri.drawable; \
const fbDrawablePtr fbdrawable = (fbDrawablePtr)dPriv->driverPrivate;
#define INIT_PIXEL_PTR(P, X, Y) \
GLushort *P = (GLushort *) ((char *)dPriv->currentBuffer + (Y) * dPriv->currentPitch + (X) * 2)
GLushort *P = (GLushort *) ((char *)fbdrawable->currentBuffer + (Y) * fbdrawable->currentPitch + (X) * 2)
#define INC_PIXEL_PTR(P) P += 1
#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
*P = ( (((R) & 0xf8) << 8) | (((G) & 0xfc) << 3) | ((B) >> 3) )
@@ -245,9 +247,10 @@ init_core_functions( struct dd_function_table *functions )
#define NAME(PREFIX) PREFIX##_B5G5R5
#define SPAN_VARS \
const fbContextPtr fbdevctx = FB_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = fbdevctx->dri.drawable;
__DRIdrawablePrivate *dPriv = fbdevctx->dri.drawable; \
const fbDrawablePtr fbdrawable = (fbDrawablePtr)dPriv->driverPrivate;
#define INIT_PIXEL_PTR(P, X, Y) \
GLushort *P = (GLushort *) ((char *)dPriv->currentBuffer + (Y) * dPriv->currentPitch + (X) * 2)
GLushort *P = (GLushort *) ((char *)fbdrawable->currentBuffer + (Y) * fbdrawable->currentPitch + (X) * 2)
#define INC_PIXEL_PTR(P) P += 1
#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
*P = ( (((R) & 0xf8) << 7) | (((G) & 0xf8) << 2) | ((B) >> 3) )
@@ -266,9 +269,10 @@ init_core_functions( struct dd_function_table *functions )
#define NAME(PREFIX) PREFIX##_CI8
#define SPAN_VARS \
const fbContextPtr fbdevctx = FB_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = fbdevctx->dri.drawable;
__DRIdrawablePrivate *dPriv = fbdevctx->dri.drawable; \
const fbDrawablePtr fbdrawable = (fbDrawablePtr)dPriv->driverPrivate;
#define INIT_PIXEL_PTR(P, X, Y) \
GLubyte *P = (GLubyte *)dPriv->currentBuffer + (Y) * dPriv->currentPitch + (X)
GLubyte *P = (GLubyte *)fbdrawable->currentBuffer + (Y) * fbdrawable->currentPitch + (X)
#define INC_PIXEL_PTR(P) P += 1
#define STORE_CI_PIXEL(P, CI) \
P[0] = CI
@@ -278,19 +282,46 @@ init_core_functions( struct dd_function_table *functions )
#include "swrast/s_spantemp.h"
/* Initialize the driver specific screen private data.
*/
static GLboolean
fbInitDriver( __DRIscreenPrivate *sPriv )
{
sPriv->private = NULL;
fbDRIPtr dri_priv = (fbDRIPtr)sPriv->pDevPriv;
fbDRIPtr priv;
int drmFD;
drmFD = drmOpen("radeon", NULL );
if (drmFD < 0) {
fprintf(stderr, "[drm] drmOpen failed\n");
return GL_FALSE;
}
priv = _mesa_malloc(sizeof(*priv));
if (!priv)
return GL_FALSE;
*priv = *dri_priv;
priv->drmFD = drmFD;
if (drmMap(drmFD, priv->hFrameBuffer, priv->fbSize, &priv->fbMap) < 0) {
fprintf(stderr, "[drm] drmMap framebuffer failed\n");
free(priv);
return GL_FALSE;
}
sPriv->private = priv;
return GL_TRUE;
}
static void
fbDestroyScreen( __DRIscreenPrivate *sPriv )
{
fbDRIPtr priv = (fbDRIPtr)sPriv->private;
drmUnmap(priv->fbMap, priv->fbSize);
drmClose(priv->drmFD);
_mesa_free(priv);
}
/* Create the device specific context.
@@ -451,6 +482,9 @@ fbCreateBuffer( __DRIscreenPrivate *driScrnPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
{
fbDRIPtr spriv = (fbDRIPtr)driScrnPriv->private;
fbDrawablePtr fbdrawable;
if (isPixmap) {
return GL_FALSE; /* not implemented */
}
@@ -459,21 +493,31 @@ fbCreateBuffer( __DRIscreenPrivate *driScrnPriv,
const GLboolean swAlpha = mesaVis->alphaBits > 0;
const GLboolean swAccum = mesaVis->accumRedBits > 0;
const GLboolean swStencil = mesaVis->stencilBits > 0;
driDrawPriv->driverPrivate = (void *)
fbdrawable = _mesa_calloc(sizeof(*fbdrawable));
if (!fbdrawable)
return 0;
fbdrawable->mesa_framebuffer = (void *)
_mesa_create_framebuffer( mesaVis,
swDepth,
swStencil,
swAccum,
swAlpha );
if (!driDrawPriv->driverPrivate)
return 0;
if (!fbdrawable->mesa_framebuffer) {
_mesa_free(fbdrawable);
return 0;
}
driDrawPriv->driverPrivate = fbdrawable;
fbdrawable->frontBuffer = fbdrawable->currentBuffer = spriv->fbMap;
fbdrawable->currentPitch = spriv->fbWidth;
/* Replace the framebuffer back buffer with a malloc'ed one --
* big speedup.
*/
if (driDrawPriv->backBuffer)
driDrawPriv->backBuffer = _mesa_malloc(driDrawPriv->currentPitch * driDrawPriv->h);
fbdrawable->backBuffer = _mesa_malloc(fbdrawable->currentPitch * driDrawPriv->h);
return 1;
}
@@ -483,8 +527,12 @@ fbCreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void
fbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
_mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
_mesa_free(driDrawPriv->backBuffer);
fbDrawablePtr fbdrawable = (fbDrawablePtr)driDrawPriv->driverPrivate;
_mesa_destroy_framebuffer(fbdrawable->mesa_framebuffer);
_mesa_free(fbdrawable->backBuffer);
_mesa_free(fbdrawable);
driDrawPriv->driverPrivate = NULL;
}
@@ -494,6 +542,7 @@ fbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
static void
fbSwapBuffers( __DRIdrawablePrivate *dPriv )
{
fbDrawablePtr fbdrawable = (fbDrawablePtr)dPriv->driverPrivate;
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
fbContextPtr fbmesa;
@@ -503,19 +552,19 @@ fbSwapBuffers( __DRIdrawablePrivate *dPriv )
if (ctx->Visual.doubleBufferMode) {
int i;
int offset = 0;
char *tmp = _mesa_malloc(dPriv->currentPitch);
char *tmp = _mesa_malloc(fbdrawable->currentPitch);
_mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
ASSERT(dPriv->frontBuffer);
ASSERT(dPriv->backBuffer);
ASSERT(fbdrawable->frontBuffer);
ASSERT(fbdrawable->backBuffer);
for (i = 0; i < dPriv->h; i++) {
_mesa_memcpy(tmp, (char *) dPriv->backBuffer + offset,
dPriv->currentPitch);
_mesa_memcpy((char *) dPriv->frontBuffer + offset, tmp,
dPriv->currentPitch);
offset += dPriv->currentPitch;
_mesa_memcpy(tmp, (char *) fbdrawable->backBuffer + offset,
fbdrawable->currentPitch);
_mesa_memcpy((char *) fbdrawable->frontBuffer + offset, tmp,
fbdrawable->currentPitch);
offset += fbdrawable->currentPitch;
}
_mesa_free(tmp);
@@ -543,8 +592,8 @@ fbMakeCurrent( __DRIcontextPrivate *driContextPriv,
newFbCtx->dri.drawable = driDrawPriv;
_mesa_make_current2( newFbCtx->glCtx,
(GLframebuffer *) driDrawPriv->driverPrivate,
(GLframebuffer *) driReadPriv->driverPrivate );
((fbDrawablePtr)driDrawPriv->driverPrivate)->mesa_framebuffer,
((fbDrawablePtr)driReadPriv->driverPrivate)->mesa_framebuffer);
} else {
_mesa_make_current( 0, 0 );
}
@@ -562,80 +611,18 @@ fbUnbindContext( __DRIcontextPrivate *driContextPriv )
}
static struct __DriverAPIRec fbAPI = {
fbInitDriver,
fbDestroyScreen,
fbCreateContext,
fbDestroyContext,
fbCreateBuffer,
fbDestroyBuffer,
fbSwapBuffers,
fbMakeCurrent,
fbUnbindContext
.InitDriver = fbInitDriver,
.DestroyScreen = fbDestroyScreen,
.CreateContext = fbCreateContext,
.DestroyContext = fbDestroyContext,
.CreateBuffer = fbCreateBuffer,
.DestroyBuffer = fbDestroyBuffer,
.SwapBuffers = fbSwapBuffers,
.MakeCurrent = fbMakeCurrent,
.UnbindContext = fbUnbindContext,
};
/*
* This is the bootstrap function for the driver.
* The __driCreateScreen name is the symbol that libGL.so fetches.
* Return: pointer to a __DRIscreenPrivate.
*/
void *
__driCreateScreen(struct DRIDriverRec *driver,
struct DRIDriverContextRec *driverContext)
{
__DRIscreenPrivate *psp;
psp = __driUtilCreateScreenNoDRM(driver, driverContext, &fbAPI);
return (void *) psp;
}
/**
* \brief Establish the set of modes available for the display.
*
* \param ctx display handle.
* \param numModes will receive the number of supported modes.
* \param modes will point to the list of supported modes.
*
* \return one on success, or zero on failure.
*
* Allocates a single visual and fills it with information according to the
* display bit depth. Supports only 16 and 32 bpp bit depths, aborting
* otherwise.
*/
const __GLcontextModes __glModes[] = {
/* 32 bit, RGBA Depth=24 Stencil=8 */
{.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
.haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_TRUE,
.redBits = 8, .greenBits = 8, .blueBits = 8, .alphaBits = 8,
.redMask = 0xff0000, .greenMask = 0xff00, .blueMask = 0xff, .alphaMask = 0xff000000,
.rgbBits = 32, .indexBits = 0,
.accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
.depthBits = 24, .stencilBits = 8,
.numAuxBuffers= 0, .level = 0, .pixmapMode = GL_FALSE, },
/* 16 bit, RGB Depth=16 */
{.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
.haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_FALSE,
.redBits = 5, .greenBits = 6, .blueBits = 5, .alphaBits = 0,
.redMask = 0xf800, .greenMask = 0x07e0, .blueMask = 0x001f, .alphaMask = 0x0,
.rgbBits = 16, .indexBits = 0,
.accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
.depthBits = 16, .stencilBits = 0,
.numAuxBuffers= 0, .level = 0, .pixmapMode = GL_FALSE, },
};
static int
__driInitScreenModes( const DRIDriverContext *ctx,
int *numModes, const __GLcontextModes **modes)
{
*numModes = sizeof(__glModes)/sizeof(__GLcontextModes *);
*modes = &__glModes[0];
return 1;
}
static int
__driValidateMode(const DRIDriverContext *ctx )
@@ -646,26 +633,75 @@ __driValidateMode(const DRIDriverContext *ctx )
static int
__driInitFBDev( struct DRIDriverContextRec *ctx )
{
int id;
ctx->shared.hFrameBuffer = ctx->FBStart;
ctx->shared.fbSize = ctx->FBSize;
ctx->shared.hSAREA = 0xB37D;
fbDRIPtr pfbDRI;
/* Note that drmOpen will try to load the kernel module, if needed. */
/* we need a fbdev drm driver - it will only track maps */
ctx->drmFD = drmOpen("radeon", NULL );
if (ctx->drmFD < 0) {
fprintf(stderr, "[drm] drmOpen failed\n");
return 0;
}
ctx->shared.SAREASize = SAREA_MAX;
id = shmget(ctx->shared.hSAREA, ctx->shared.SAREASize, IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR);
if (id == -1) {
/* segment will already exist if previous server segfaulted */
id = shmget(ctx->shared.hSAREA, ctx->shared.SAREASize, 0);
if (id == -1) {
fprintf(stderr, "fb: shmget failed\n");
return 0;
}
if (drmAddMap( ctx->drmFD,
0,
ctx->shared.SAREASize,
DRM_SHM,
DRM_CONTAINS_LOCK,
&ctx->shared.hSAREA) < 0)
{
fprintf(stderr, "[drm] drmAddMap failed\n");
return 0;
}
ctx->pSAREA = shmat(id, NULL, 0);
if (ctx->pSAREA == (void *)-1) {
fprintf(stderr, "fb: shmat failed\n");
return 0;
fprintf(stderr, "[drm] added %d byte SAREA at 0x%08lx\n",
ctx->shared.SAREASize, ctx->shared.hSAREA);
if (drmMap( ctx->drmFD,
ctx->shared.hSAREA,
ctx->shared.SAREASize,
(drmAddressPtr)(&ctx->pSAREA)) < 0)
{
fprintf(stderr, "[drm] drmMap failed\n");
return 0;
}
memset(ctx->pSAREA, 0, SAREA_MAX);
memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
fprintf(stderr, "[drm] mapped SAREA 0x%08lx to %p, size %d\n",
ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
/* Need to AddMap the framebuffer and mmio regions here:
*/
if (drmAddMap( ctx->drmFD,
(drm_handle_t)ctx->FBStart,
ctx->FBSize,
DRM_FRAME_BUFFER,
#ifndef _EMBEDDED
0,
#else
DRM_READ_ONLY,
#endif
&ctx->shared.hFrameBuffer) < 0)
{
fprintf(stderr, "[drm] drmAddMap framebuffer failed\n");
return 0;
}
fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
ctx->shared.hFrameBuffer);
pfbDRI = (fbDRIPtr)malloc(sizeof(*pfbDRI));
pfbDRI->hFrameBuffer = ctx->shared.hFrameBuffer;
pfbDRI->fbOrigin = ctx->shared.fbOrigin;
pfbDRI->fbSize = ctx->shared.fbSize;
pfbDRI->fbStride = ctx->shared.fbStride;
pfbDRI->fbWidth = ctx->shared.virtualWidth;
pfbDRI->fbHeight = ctx->shared.virtualHeight;
pfbDRI->bpp = ctx->bpp;
ctx->driverClientMsg = pfbDRI;
ctx->driverClientMsgSize = sizeof(*pfbDRI);
return 1;
}
@@ -674,13 +710,148 @@ __driHaltFBDev( struct DRIDriverContextRec *ctx )
{
}
struct DRIDriverRec __driDriver = {
__driInitScreenModes,
__driValidateMode,
__driValidateMode,
__driInitFBDev,
__driHaltFBDev
};
#ifdef USE_NEW_INTERFACE
static __GLcontextModes *
fbFillInModes( unsigned pixel_bits, unsigned depth_bits,
unsigned stencil_bits, GLboolean have_back_buffer )
{
__GLcontextModes * modes;
__GLcontextModes * m;
unsigned num_modes;
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
GLenum fb_format;
GLenum fb_type;
/* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy
* enough to add support. Basically, if a context is created with an
* fbconfig where the swap method is GLX_SWAP_COPY_OML, pageflipping
* will never be used.
*/
static const GLenum back_buffer_modes[] = {
GLX_NONE, GLX_SWAP_UNDEFINED_OML /*, GLX_SWAP_COPY_OML */
};
u_int8_t depth_bits_array[2];
u_int8_t stencil_bits_array[2];
depth_bits_array[0] = depth_bits;
depth_bits_array[1] = depth_bits;
/* Just like with the accumulation buffer, always provide some modes
* with a stencil buffer. It will be a sw fallback, but some apps won't
* care about that.
*/
stencil_bits_array[0] = 0;
stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits;
depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1;
back_buffer_factor = (have_back_buffer) ? 2 : 1;
num_modes = depth_buffer_factor * back_buffer_factor * 4;
if ( pixel_bits == 16 ) {
fb_format = GL_RGB;
fb_type = GL_UNSIGNED_SHORT_5_6_5;
}
else {
fb_format = GL_BGR;
fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
modes = (*create_context_modes)( num_modes, sizeof( __GLcontextModes ) );
m = modes;
if ( ! driFillInModes( & m, fb_format, fb_type,
depth_bits_array, stencil_bits_array, depth_buffer_factor,
back_buffer_modes, back_buffer_factor,
GLX_TRUE_COLOR ) ) {
fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
__func__, __LINE__ );
return NULL;
}
if ( ! driFillInModes( & m, fb_format, fb_type,
depth_bits_array, stencil_bits_array, depth_buffer_factor,
back_buffer_modes, back_buffer_factor,
GLX_DIRECT_COLOR ) ) {
fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
__func__, __LINE__ );
return NULL;
}
/* Mark the visual as slow if there are "fake" stencil bits.
*/
for ( m = modes ; m != NULL ; m = m->next ) {
if ( (m->stencilBits != 0) && (m->stencilBits != stencil_bits) ) {
m->visualRating = GLX_SLOW_CONFIG;
}
}
return modes;
}
/**
* This is the bootstrap function for the driver. libGL supplies all of the
* requisite information about the system, and the driver initializes itself.
* This routine also fills in the linked list pointed to by \c driver_modes
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
*
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
* failure.
*/
PUBLIC
void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
const __GLcontextModes * modes,
const __DRIversion * ddx_version,
const __DRIversion * dri_version,
const __DRIversion * drm_version,
const __DRIframebuffer * frame_buffer,
drmAddress pSAREA, int fd,
int internal_api_version,
__GLcontextModes ** driver_modes )
{
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 4, 0, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 1, 5, 0 };
if ( ! driCheckDriDdxDrmVersions2( "fb",
dri_version, & dri_expected,
ddx_version, & ddx_expected,
drm_version, & drm_expected ) ) {
return NULL;
}
psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &fbAPI);
if ( psp != NULL ) {
create_context_modes = (PFNGLXCREATECONTEXTMODES)
glXGetProcAddress( (const GLubyte *) "__glXCreateContextModes" );
if ( create_context_modes != NULL ) {
#if 0
fbDRIPtr dri_priv = (fbDRIPtr) psp->pDevPriv;
*driver_modes = fbFillInModes( dri_priv->bpp,
(dri_priv->bpp == 16) ? 16 : 24,
(dri_priv->bpp == 16) ? 0 : 8,
(dri_priv->backOffset != dri_priv->depthOffset) );
#endif
*driver_modes = fbFillInModes( 24, 24, 8, 0);
}
}
return (void *) psp;
}
#endif /* USE_NEW_INTERFACE */

View File

@@ -209,31 +209,12 @@ static GLboolean gamma_run_render( GLcontext *ctx,
}
static void gamma_check_render( GLcontext *ctx,
struct tnl_pipeline_stage *stage )
{
stage->inputs = TNL_CONTEXT(ctx)->render_inputs;
}
static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
}
const struct tnl_pipeline_stage _gamma_render_stage =
{
"gamma render",
(_DD_NEW_SEPARATE_SPECULAR |
_NEW_TEXTURE|
_NEW_FOG|
_NEW_RENDERMODE), /* re-check (new inputs) */
0, /* re-run (always runs) */
GL_TRUE, /* active */
0, 0, /* inputs (set in check_render), outputs */
0, 0, /* changed_inputs, private */
dtr, /* destructor */
gamma_check_render, /* check - initially set to alloc data */
NULL,
NULL,
NULL,
NULL,
gamma_run_render /* run */
};

View File

@@ -161,31 +161,13 @@ static GLboolean i810_run_render( GLcontext *ctx,
}
static void i810_check_render( GLcontext *ctx,
struct tnl_pipeline_stage *stage )
{
stage->inputs = TNL_CONTEXT(ctx)->render_inputs;
}
static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
}
const struct tnl_pipeline_stage _i810_render_stage =
{
"i810 render",
(_DD_NEW_SEPARATE_SPECULAR |
_NEW_TEXTURE|
_NEW_FOG|
_NEW_RENDERMODE), /* re-check (new inputs) */
0, /* re-run (always runs) */
GL_TRUE, /* active */
0, 0, /* inputs (set in check_render), outputs */
0, 0, /* changed_inputs, private */
dtr, /* destructor */
i810_check_render, /* check - initially set to alloc data */
NULL,
NULL,
NULL,
NULL,
i810_run_render /* run */
};

View File

@@ -215,30 +215,12 @@ static GLboolean i830_run_render( GLcontext *ctx,
}
static void i830_check_render( GLcontext *ctx,
struct tnl_pipeline_stage *stage )
{
stage->inputs = TNL_CONTEXT(ctx)->render_inputs;
}
static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
}
const struct tnl_pipeline_stage _i830_render_stage =
{
"i830 render",
(_DD_NEW_SEPARATE_SPECULAR |
_NEW_TEXTURE|
_NEW_FOG|
_NEW_RENDERMODE), /* re-check (new inputs) */
0, /* re-run (always runs) */
GL_TRUE, /* active */
0, 0, /* inputs (set in check_render), outputs */
0, 0, /* changed_inputs, private */
dtr, /* destructor */
i830_check_render, /* check - initially set to alloc data */
NULL,
NULL,
NULL,
NULL,
i830_run_render /* run */
};

View File

@@ -130,7 +130,7 @@ static GLuint src_vector( struct i915_fragment_program *p,
case PROGRAM_STATE_VAR:
case PROGRAM_NAMED_PARAM:
src = i915_emit_param4fv(
p, program->Parameters->Parameters[source->Index].Values );
p, program->Parameters->ParameterValues[source->Index] );
break;
default:
@@ -139,10 +139,10 @@ static GLuint src_vector( struct i915_fragment_program *p,
}
src = swizzle(src,
source->Swizzle[0],
source->Swizzle[1],
source->Swizzle[2],
source->Swizzle[3]);
GET_SWZ(source->Swizzle, 0),
GET_SWZ(source->Swizzle, 1),
GET_SWZ(source->Swizzle, 2),
GET_SWZ(source->Swizzle, 3));
if (source->NegateBase)
src = negate( src, 1,1,1,1 );
@@ -179,30 +179,30 @@ static GLuint get_result_flags( const struct fp_instruction *inst )
GLuint flags = 0;
if (inst->Saturate) flags |= A0_DEST_SATURATE;
if (inst->DstReg.WriteMask[0]) flags |= A0_DEST_CHANNEL_X;
if (inst->DstReg.WriteMask[1]) flags |= A0_DEST_CHANNEL_Y;
if (inst->DstReg.WriteMask[2]) flags |= A0_DEST_CHANNEL_Z;
if (inst->DstReg.WriteMask[3]) flags |= A0_DEST_CHANNEL_W;
if (inst->DstReg.WriteMask & WRITEMASK_X) flags |= A0_DEST_CHANNEL_X;
if (inst->DstReg.WriteMask & WRITEMASK_Y) flags |= A0_DEST_CHANNEL_Y;
if (inst->DstReg.WriteMask & WRITEMASK_Z) flags |= A0_DEST_CHANNEL_Z;
if (inst->DstReg.WriteMask & WRITEMASK_W) flags |= A0_DEST_CHANNEL_W;
return flags;
}
static GLuint translate_tex_src_bit( struct i915_fragment_program *p,
static GLuint translate_tex_src_idx( struct i915_fragment_program *p,
GLubyte bit )
{
switch (bit) {
case TEXTURE_1D_BIT: return D0_SAMPLE_TYPE_2D;
case TEXTURE_2D_BIT: return D0_SAMPLE_TYPE_2D;
case TEXTURE_RECT_BIT: return D0_SAMPLE_TYPE_2D;
case TEXTURE_3D_BIT: return D0_SAMPLE_TYPE_VOLUME;
case TEXTURE_CUBE_BIT: return D0_SAMPLE_TYPE_CUBE;
case TEXTURE_1D_INDEX: return D0_SAMPLE_TYPE_2D;
case TEXTURE_2D_INDEX: return D0_SAMPLE_TYPE_2D;
case TEXTURE_RECT_INDEX: return D0_SAMPLE_TYPE_2D;
case TEXTURE_3D_INDEX: return D0_SAMPLE_TYPE_VOLUME;
case TEXTURE_CUBE_INDEX: return D0_SAMPLE_TYPE_CUBE;
default: i915_program_error(p, "TexSrcBit"); return 0;
}
}
#define EMIT_TEX( OP ) \
do { \
GLuint dim = translate_tex_src_bit( p, inst->TexSrcBit ); \
GLuint dim = translate_tex_src_idx( p, inst->TexSrcIdx ); \
GLuint sampler = i915_emit_decl(p, REG_TYPE_S, \
inst->TexSrcUnit, dim); \
GLuint coord = src_vector( p, &inst->SrcReg[0], program); \
@@ -592,10 +592,10 @@ static void upload_program( struct i915_fragment_program *p )
swizzle(tmp, X,Y,X,Y),
swizzle(tmp, X,X,ONE,ONE), 0);
if (inst->DstReg.WriteMask[1]) {
if (inst->DstReg.WriteMask & WRITEMASK_Y) {
GLuint tmp1;
if (inst->DstReg.WriteMask[0])
if (inst->DstReg.WriteMask & WRITEMASK_X)
tmp1 = i915_get_utemp( p );
else
tmp1 = tmp;
@@ -614,7 +614,7 @@ static void upload_program( struct i915_fragment_program *p )
i915_emit_const4fv( p, sin_constants ), 0);
}
if (inst->DstReg.WriteMask[0]) {
if (inst->DstReg.WriteMask & WRITEMASK_X) {
i915_emit_arith( p,
A0_MUL,
tmp, A0_DEST_CHANNEL_XYZ, 0,

View File

@@ -229,31 +229,12 @@ static GLboolean intel_run_render( GLcontext *ctx,
return GL_FALSE; /* finished the pipe */
}
static void intel_check_render( GLcontext *ctx,
struct tnl_pipeline_stage *stage )
{
stage->inputs = TNL_CONTEXT(ctx)->render_inputs;
}
static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
}
const struct tnl_pipeline_stage _intel_render_stage =
{
"intel render",
(_DD_NEW_SEPARATE_SPECULAR |
_NEW_TEXTURE|
_NEW_FOG|
_NEW_RENDERMODE), /* re-check (new inputs) */
0, /* re-run (always runs) */
GL_TRUE, /* active */
0, 0, /* inputs (set in check_render), outputs */
0, 0, /* changed_inputs, private */
dtr, /* destructor */
intel_check_render, /* check - initially set to alloc data */
NULL,
NULL,
NULL,
NULL,
intel_run_render /* run */
};

View File

@@ -161,30 +161,12 @@ static GLboolean mga_run_render( GLcontext *ctx,
}
static void mga_check_render( GLcontext *ctx, struct tnl_pipeline_stage *stage )
{
stage->inputs = TNL_CONTEXT(ctx)->render_inputs;
}
static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
}
const struct tnl_pipeline_stage _mga_render_stage =
{
"mga render",
(_DD_NEW_SEPARATE_SPECULAR |
_NEW_TEXTURE|
_NEW_FOG|
_NEW_RENDERMODE), /* re-check (new inputs) */
0, /* re-run (always runs) */
GL_TRUE, /* active */
0, 0, /* inputs (set in check_render), outputs */
0, 0, /* changed_inputs, private */
dtr, /* destructor */
mga_check_render, /* check - initially set to alloc data */
NULL,
NULL,
NULL,
NULL,
mga_run_render /* run */
};

View File

@@ -384,7 +384,7 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx,
return GL_FALSE;
r200ReleaseArrays( ctx, ~0 /* stage->changed_inputs */ );
r200EmitArrays( ctx, stage->inputs );
r200EmitArrays( ctx, tnl->render_inputs );
rmesa->tcl.Elts = VB->Elts;
@@ -408,85 +408,15 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx,
static void r200_check_tcl_render( GLcontext *ctx,
struct tnl_pipeline_stage *stage )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint inputs = VERT_BIT_POS;
GLuint unit;
/* Validate state:
*/
if (rmesa->NewGLState)
r200ValidateState( ctx );
if (ctx->RenderMode == GL_RENDER) {
/* Make all this event-driven:
*/
if (ctx->Light.Enabled) {
inputs |= VERT_BIT_NORMAL;
if (1 || ctx->Light.ColorMaterialEnabled) {
inputs |= VERT_BIT_COLOR0;
}
}
else {
inputs |= VERT_BIT_COLOR0;
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
inputs |= VERT_BIT_COLOR1;
}
}
if ( ctx->Fog.FogCoordinateSource == GL_FOG_COORD ) {
inputs |= VERT_BIT_FOG;
}
for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
if (rmesa->TexGenNeedNormals[unit]) {
inputs |= VERT_BIT_NORMAL;
}
inputs |= VERT_BIT_TEX(unit);
}
}
stage->inputs = inputs;
stage->active = 1;
}
else
stage->active = 0;
}
static void r200_init_tcl_render( GLcontext *ctx,
struct tnl_pipeline_stage *stage )
{
stage->check = r200_check_tcl_render;
stage->check( ctx, stage );
}
static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
}
/* Initial state for tcl stage.
*/
const struct tnl_pipeline_stage _r200_tcl_stage =
{
"r200 render",
(_DD_NEW_SEPARATE_SPECULAR |
_NEW_LIGHT|
_NEW_TEXTURE|
_NEW_FOG|
_NEW_RENDERMODE), /* re-check (new inputs) */
0, /* re-run (always runs) */
GL_TRUE, /* active */
0, 0, /* inputs (set in check_render), outputs */
0, NULL, /* changed_inputs, private */
dtr, /* destructor */
r200_init_tcl_render, /* check - initially set to alloc data */
NULL, /* private */
NULL,
NULL,
NULL,
r200_run_tcl_render /* run */
};

View File

@@ -37,30 +37,31 @@ DRIVER_SOURCES = \
r300_texstate.c \
r300_texprog.c \
r300_vertexprog.c \
r300_maos.c \
\
r200_context.c \
r200_ioctl.c \
r200_state.c \
r200_state_init.c \
r200_cmdbuf.c \
r200_pixel.c \
r200_tex.c \
r200_texmem.c \
r200_texstate.c \
r200_tcl.c \
r200_swtcl.c \
r200_maos.c \
r200_sanity.c \
r200_vtxfmt.c \
r200_vtxfmt_c.c \
r200_vtxfmt_sse.c \
r200_vtxfmt_x86.c
r300_shader.c \
r300_maos.c
# \
# r200_context.c \
# r200_ioctl.c \
# r200_state.c \
# r200_state_init.c \
# r200_cmdbuf.c \
# r200_pixel.c \
# r200_tex.c \
# r200_texmem.c \
# r200_texstate.c \
# r200_swtcl.c \
# r200_maos.c \
# r200_sanity.c \
# r200_vtxfmt.c \
# r200_vtxfmt_c.c \
# r200_vtxfmt_sse.c \
# r200_vtxfmt_x86.c
C_SOURCES = $(COMMON_SOURCES) $(DRIVER_SOURCES)
X86_SOURCES = r200_vtxtmp_x86.S
X86_SOURCES =
#r200_vtxtmp_x86.S
SYMLINKS = \
server/radeon_dri.c \

View File

@@ -62,6 +62,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "utils.h"
#include "xmlpool.h" /* for symbolic values of enum-type options */
/* hw_tcl_on derives from future_hw_tcl_on when its safe to change it. */
int future_hw_tcl_on=0;
int hw_tcl_on=0;
/* Extension strings exported by the R300 driver.
*/
@@ -118,7 +121,7 @@ static const struct tnl_pipeline_stage *r300_pipeline[] = {
&_tnl_fog_coordinate_stage,
&_tnl_texgen_stage,
&_tnl_texture_transform_stage,
//&_tnl_vertex_program_stage,
&_tnl_vertex_program_stage,
/* Try again to go to tcl?
* - no good for asymmetric-twoside (do with multipass)
@@ -173,7 +176,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
r300InitIoctlFuncs(&functions);
r300InitStateFuncs(&functions);
r300InitTextureFuncs(&functions);
r300InitVertexProgFuncs(&functions);
r300InitShaderFuncs(&functions);
if (!radeonInitContext(&r300->radeon, &functions,
glVisual, driContextPriv, sharedContextPrivate)) {
@@ -292,7 +295,9 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
tcl_mode = driQueryOptioni(&r300->radeon.optionCache, "tcl_mode");
if (driQueryOptionb(&r300->radeon.optionCache, "no_rast")) {
fprintf(stderr, "disabling 3D acceleration\n");
#if R200_MERGED
FALLBACK(&r300->radeon, RADEON_FALLBACK_DISABLE, 1);
#endif
}
if (tcl_mode == DRI_CONF_TCL_SW ||
!(r300->radeon.radeonScreen->chipset & RADEON_CHIPSET_TCL)) {

View File

@@ -566,9 +566,15 @@ struct r300_vertex_shader_state {
int unknown_ptr3; /* pointer within program space */
};
#define VERTPROG_ACTIVE(ctx) ( ctx->VertexProgram._Enabled && (R300_CONTEXT(ctx)->current_vp != NULL) && \
(R300_CONTEXT(ctx)->current_vp->translated) )
extern int hw_tcl_on;
#define CURRENT_VERTEX_SHADER(ctx) (ctx->VertexProgram._Enabled ? ctx->VertexProgram.Current : &ctx->_TnlProgram)
//#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && (OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit)))) : \
// (r300->state.render_inputs & (_TNL_BIT_TEX0<<(unit))))
#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit))) : \
ctx->Texture.Unit[unit]._ReallyEnabled && r300->state.render_inputs & (_TNL_BIT_TEX0<<(unit)))
/* r300_vertex_shader_state and r300_vertex_program should probably be merged together someday.
* Keeping them them seperate for now should ensure fixed pipeline keeps functioning properly.
*/
@@ -582,7 +588,6 @@ struct r300_vertex_program {
int t2rs;
unsigned long num_temporaries; /* Number of temp vars used by program */
int inputs[VERT_ATTRIB_MAX];
GLuint outputs;
};
/* 64 appears to be the maximum */
@@ -737,8 +742,6 @@ struct r300_context {
GLuint TexGenInputs;
GLuint TexGenCompSel;
GLmatrix tmpmat;
struct r300_vertex_program *current_vp;
};
#define R300_CONTEXT(ctx) ((r300ContextPtr)(ctx->DriverCtx))
@@ -761,7 +764,8 @@ extern GLboolean r300CreateContext(const __GLcontextModes * glVisual,
__DRIcontextPrivate * driContextPriv,
void *sharedContextPrivate);
extern void r300InitVertexProgFuncs(struct dd_function_table *functions);
void translate_vertex_shader(struct r300_vertex_program *vp);
extern void r300InitShaderFuncs(struct dd_function_table *functions);
extern void r300VertexProgUpdateParams(GLcontext *ctx, struct r300_vertex_program *vp);
#endif /* __R300_CONTEXT_H__ */

View File

@@ -60,6 +60,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define CLEARBUFFER_DEPTH 0x2
#define CLEARBUFFER_STENCIL 0x4
/* TODO: Fix this so that white vertical lines no longer appear. */
static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
{
GLcontext* ctx = r300->radeon.glCtx;

View File

@@ -173,7 +173,8 @@ static void emit_vector(GLcontext * ctx,
fprintf(stderr, "%s count %d size %d stride %d\n",
__FUNCTION__, count, size, stride);
assert(!rvb->buf);
/* Gets triggered when playing with future_hw_tcl_on ...*/
//assert(!rvb->buf);
if (stride == 0) {
r300AllocDmaRegion(rmesa, rvb, size * 4, 4);
@@ -218,15 +219,12 @@ void r300EmitElts(GLcontext * ctx, GLuint *elts, unsigned long n_elts)
unsigned short int *out;
int i;
r300AllocDmaRegion(rmesa, rvb, (n_elts+1)*2 , 0x20);
r300AllocDmaRegion(rmesa, rvb, n_elts*sizeof(unsigned short int), 2);
out = (unsigned short int *)(rvb->address + rvb->start);
for(i=0; i < n_elts; i++)
out[i]=(unsigned short int)elts[i];
if(n_elts & 1)
out[i]=0;
}
/* Emit vertex data to GART memory (unless immediate mode)
@@ -243,7 +241,8 @@ void r300EmitArrays(GLcontext * ctx, GLboolean immd)
GLuint vic_1 = 0; /* R300_VAP_INPUT_CNTL_1 */
GLuint aa_vap_reg = 0; /* VAP register assignment */
GLuint i;
GLuint inputs = 0, outputs = 0;
GLuint inputs = 0;
GLuint InputsRead = CURRENT_VERTEX_SHADER(ctx)->InputsRead;
#define CONFIGURE_AOS(r, f, v, sz, cn) { \
@@ -254,7 +253,7 @@ void r300EmitArrays(GLcontext * ctx, GLboolean immd)
exit(-1); \
} \
\
if (VERTPROG_ACTIVE(ctx) == GL_FALSE) \
if (hw_tcl_on == GL_FALSE) \
rmesa->state.aos[nr-1].aos_reg = aa_vap_reg++; \
rmesa->state.aos[nr-1].aos_format = f; \
if (immd) { \
@@ -272,48 +271,41 @@ void r300EmitArrays(GLcontext * ctx, GLboolean immd)
} \
}
if (VERTPROG_ACTIVE(ctx)) {
if (rmesa->current_vp->inputs[VERT_ATTRIB_POS] != -1) {
if (hw_tcl_on) {
struct r300_vertex_program *prog=(struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx);
if (InputsRead & (1<<VERT_ATTRIB_POS)) {
inputs |= _TNL_BIT_POS;
rmesa->state.aos[nr++].aos_reg = rmesa->current_vp->inputs[VERT_ATTRIB_POS];
rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_POS];
}
if (rmesa->current_vp->inputs[VERT_ATTRIB_NORMAL] != -1) {
if (InputsRead & (1<<VERT_ATTRIB_NORMAL)) {
inputs |= _TNL_BIT_NORMAL;
rmesa->state.aos[nr++].aos_reg = rmesa->current_vp->inputs[VERT_ATTRIB_NORMAL];
rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_NORMAL];
}
if (rmesa->current_vp->inputs[VERT_ATTRIB_COLOR0] != -1) {
if (InputsRead & (1<<VERT_ATTRIB_COLOR0)) {
inputs |= _TNL_BIT_COLOR0;
rmesa->state.aos[nr++].aos_reg = rmesa->current_vp->inputs[VERT_ATTRIB_COLOR0];
rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_COLOR0];
}
if (rmesa->current_vp->inputs[VERT_ATTRIB_COLOR1] != -1) {
if (InputsRead & (1<<VERT_ATTRIB_COLOR1)) {
inputs |= _TNL_BIT_COLOR1;
rmesa->state.aos[nr++].aos_reg = rmesa->current_vp->inputs[VERT_ATTRIB_COLOR1];
rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_COLOR1];
}
if (rmesa->current_vp->inputs[VERT_ATTRIB_FOG] != -1) {
if (InputsRead & (1<<VERT_ATTRIB_FOG)) {
inputs |= _TNL_BIT_FOG;
rmesa->state.aos[nr++].aos_reg = rmesa->current_vp->inputs[VERT_ATTRIB_FOG];
rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_FOG];
}
if(ctx->Const.MaxTextureUnits > 8) { /* Not sure if this can even happen... */
fprintf(stderr, "%s: Cant handle that many inputs\n", __FUNCTION__);
exit(-1);
}
for (i=0;i<ctx->Const.MaxTextureUnits;i++) {
if (rmesa->current_vp->inputs[VERT_ATTRIB_TEX0+i] != -1) {
if (InputsRead & (1<<(VERT_ATTRIB_TEX0+i))) {
inputs |= _TNL_BIT_TEX0<<i;
rmesa->state.aos[nr++].aos_reg = rmesa->current_vp->inputs[VERT_ATTRIB_TEX0+i];
rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_TEX0+i];
}
}
nr = 0;
} else {
inputs = TNL_CONTEXT(ctx)->render_inputs;
/* Hack to see what would happen if we would enable tex units according to their enabled values.
Why arent we doing this?
As for vertex programs tex coords should be passed if program wants them as some programs might deliver
some other values to the program with them. Futher more some programs might generate output tex coords
without taking them as inputs. */
/*for (i=0;i<ctx->Const.MaxTextureUnits;i++)
if(ctx->Texture.Unit[i].Enabled == 0)
inputs &= ~ (_TNL_BIT_TEX0<<i);*/
}
rmesa->state.render_inputs = inputs;
@@ -497,23 +489,40 @@ drm_radeon_cmd_header_t *cmd = NULL;
#endif
/* Stage 3: VAP output */
if (VERTPROG_ACTIVE(ctx))
outputs = rmesa->current_vp->outputs;
else
outputs = inputs;
R300_STATECHANGE(r300, vof);
r300->hw.vof.cmd[R300_VOF_CNTL_0]=0;
if(outputs & _TNL_BIT_POS)
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
if(outputs & _TNL_BIT_COLOR0)
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
r300->hw.vof.cmd[R300_VOF_CNTL_1]=0;
for(i=0;i < ctx->Const.MaxTextureUnits;i++)
if(outputs & (_TNL_BIT_TEX0<<i))
r300->hw.vof.cmd[R300_VOF_CNTL_1]|=(4<<(3*i));
if (hw_tcl_on){
GLuint OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->OutputsWritten;
if(OutputsWritten & (1<<VERT_RESULT_HPOS))
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
if(OutputsWritten & (1<<VERT_RESULT_COL0))
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
/*if(OutputsWritten & (1<<VERT_RESULT_COL1))
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT;
if(OutputsWritten & (1<<VERT_RESULT_BFC0))
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT;
if(OutputsWritten & (1<<VERT_RESULT_BFC1))
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT;*/
//if(OutputsWritten & (1<<VERT_RESULT_FOGC))
//if(OutputsWritten & (1<<VERT_RESULT_PSIZ))
for(i=0;i < ctx->Const.MaxTextureUnits;i++)
if(OutputsWritten & (1<<(VERT_RESULT_TEX0+i)))
r300->hw.vof.cmd[R300_VOF_CNTL_1] |= (4<<(3*i));
} else {
if(inputs & _TNL_BIT_POS)
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
if(inputs & _TNL_BIT_COLOR0)
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
for(i=0;i < ctx->Const.MaxTextureUnits;i++)
if(inputs & (_TNL_BIT_TEX0<<i))
r300->hw.vof.cmd[R300_VOF_CNTL_1]|=(4<<(3*i));
}
rmesa->state.aos_count = nr;
}

View File

@@ -58,6 +58,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r300_maos.h"
#include "r300_emit.h"
extern int future_hw_tcl_on;
/**********************************************************************
* Hardware rasterization
*
@@ -459,6 +461,7 @@ static GLboolean r300_run_immediate_render(GLcontext *ctx,
return GL_FALSE;
}
/* vertex buffer implementation */
static void inline fire_EB(PREFIX unsigned long addr, int vertex_count, int type)
@@ -466,18 +469,22 @@ static void inline fire_EB(PREFIX unsigned long addr, int vertex_count, int type
LOCAL_VARS
unsigned long addr_a;
addr_a = addr & 0x1c;
if(addr & 1){
WARN_ONCE("Badly aligned buffer\n");
return ;
}
addr_a = 0; /*addr & 0x1c;*/
check_space(6);
start_packet3(RADEON_CP_PACKET3_3D_DRAW_INDX_2, 0);
/* TODO: Check if R300_VAP_VF_CNTL__INDEX_SIZE_32bit works. */
/* TODO: R300_VAP_VF_CNTL__INDEX_SIZE_32bit . */
e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (vertex_count<<16) | type);
start_packet3(RADEON_CP_PACKET3_INDX_BUFFER, 2);
e32(R300_EB_UNK1 | (addr_a << 16) | R300_EB_UNK2);
e32(addr & 0xffffffe3);
e32((vertex_count+1)/2 + addr_a/4);
e32(addr /*& 0xffffffe3*/);
e32((vertex_count+1)/2 /*+ addr_a/4*/); /* Total number of dwords needed? */
}
static void r300_render_vb_primitive(r300ContextPtr rmesa,
@@ -500,7 +507,7 @@ static void r300_render_vb_primitive(r300ContextPtr rmesa,
if(rmesa->state.Elts){
r300EmitAOS(rmesa, rmesa->state.aos_count, 0);
#if 1
#if 0
start_index32_packet(num_verts, type);
for(i=0; i < num_verts; i++)
e32(rmesa->state.Elts[start+i]); /* start ? */
@@ -654,7 +661,7 @@ do { \
if (1 || RADEON_DEBUG & DEBUG_FALLBACKS) \
fprintf(stderr, "%s: fallback:%s\n", \
__FUNCTION__, #expr); \
stage->active = GL_FALSE; \
/*stage->active = GL_FALSE*/; \
return; \
} \
} while(0)
@@ -669,7 +676,7 @@ static void r300_check_render(GLcontext *ctx, struct tnl_pipeline_stage *stage)
/* We only support rendering in hardware for now */
if (ctx->RenderMode != GL_RENDER) {
stage->active = GL_FALSE;
//stage->active = GL_FALSE;
return;
}
@@ -720,18 +727,20 @@ static void dtr(struct tnl_pipeline_stage *stage)
(void)stage;
}
GLboolean r300_create_render(GLcontext *ctx, struct tnl_pipeline_stage *stage){
return GL_TRUE;
}
const struct tnl_pipeline_stage _r300_render_stage = {
"r300 hw rasterize",
_NEW_ALL, /* re-check (always re-check for now) */
0, /* re-run (always runs) */
GL_TRUE, /* active */
0, 0, /* inputs (set in check_render), outputs */
0, 0, /* changed_inputs, private */
NULL,
r300_create_render,
dtr, /* destructor */
r300_check_render, /* check */
r300_run_render /* run */
};
static GLboolean r300_run_tcl_render(GLcontext *ctx,
struct tnl_pipeline_stage *stage)
{
@@ -739,9 +748,16 @@ static GLboolean r300_run_tcl_render(GLcontext *ctx,
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
GLuint i;
hw_tcl_on=future_hw_tcl_on;
if (RADEON_DEBUG & DEBUG_PRIMS)
fprintf(stderr, "%s\n", __FUNCTION__);
if(hw_tcl_on == GL_FALSE)
return GL_TRUE;
if(ctx->VertexProgram._Enabled == GL_FALSE){
_tnl_UpdateFixedFunctionProgram(ctx);
r300ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB, &ctx->_TnlProgram);
}
return r300_run_vb_render(ctx, stage);
}
@@ -756,24 +772,15 @@ static void r300_check_tcl_render(GLcontext *ctx, struct tnl_pipeline_stage *sta
/* We only support rendering in hardware for now */
if (ctx->RenderMode != GL_RENDER) {
stage->active = GL_FALSE;
//stage->active = GL_FALSE;
return;
}
if(VERTPROG_ACTIVE(ctx)) {
stage->active = GL_TRUE;
stage->inputs = ctx->VertexProgram.Current->InputsRead;
} else {
stage->active = GL_FALSE;
}
}
const struct tnl_pipeline_stage _r300_tcl_stage = {
"r300 tcl",
_NEW_ALL, /* re-check (always re-check for now) */
0, /* re-run (always runs) */
GL_TRUE, /* active */
0, 0, /* inputs (set in check_render), outputs */
0, 0, /* changed_inputs, private */
NULL,
r300_create_render,
dtr, /* destructor */
r300_check_tcl_render, /* check */
r300_run_tcl_render /* run */

View File

@@ -0,0 +1,99 @@
#include "glheader.h"
#include "macros.h"
#include "enums.h"
#include "program.h"
#include "r300_context.h"
#include "nvvertprog.h"
static void r300BindProgram(GLcontext *ctx, GLenum target, struct program *prog)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
struct r300_vertex_program *vp=(void *)prog;
switch(target){
case GL_VERTEX_PROGRAM_ARB:
//rmesa->current_vp = vp;
break;
default:
WARN_ONCE("Target not supported yet!\n");
break;
}
}
/* Mesa doesnt seem to have prototype for this */
struct program *
_mesa_init_ati_fragment_shader( GLcontext *ctx, struct ati_fragment_shader *prog,
GLenum target, GLuint id);
static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id)
{
struct r300_vertex_program *vp;
struct fragment_program *fp;
struct ati_fragment_shader *afs;
switch(target){
case GL_VERTEX_PROGRAM_ARB:
vp=CALLOC_STRUCT(r300_vertex_program);
return _mesa_init_vertex_program(ctx, &vp->mesa_program, target, id);
case GL_FRAGMENT_PROGRAM_ARB:
fp=CALLOC_STRUCT(fragment_program);
return _mesa_init_fragment_program(ctx, fp, target, id);
case GL_FRAGMENT_PROGRAM_NV:
fp=CALLOC_STRUCT(fragment_program);
return _mesa_init_fragment_program(ctx, fp, target, id);
case GL_FRAGMENT_SHADER_ATI:
afs=CALLOC_STRUCT(ati_fragment_shader);
return _mesa_init_ati_fragment_shader(ctx, afs, target, id);
}
return NULL;
}
static void r300DeleteProgram(GLcontext *ctx, struct program *prog)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
struct r300_vertex_program *vp=(void *)prog;
/*if(rmesa->current_vp == vp)
rmesa->current_vp = NULL;*/
_mesa_delete_program(ctx, prog);
}
void r300ProgramStringNotify(GLcontext *ctx, GLenum target,
struct program *prog)
{
struct r300_vertex_program *vp=(void *)prog;
switch(target) {
case GL_VERTEX_PROGRAM_ARB:
vp->translated=GL_FALSE;
translate_vertex_shader(vp);
break;
case GL_FRAGMENT_PROGRAM_ARB:
break;
}
}
static GLboolean r300IsProgramNative(GLcontext *ctx, GLenum target, struct program *prog)
{
struct r300_vertex_program *vp=(void *)prog;
r300ContextPtr rmesa = R300_CONTEXT(ctx);
return 1;
}
void r300InitShaderFuncs(struct dd_function_table *functions)
{
functions->NewProgram=r300NewProgram;
functions->BindProgram=r300BindProgram;
functions->DeleteProgram=r300DeleteProgram;
functions->ProgramStringNotify=r300ProgramStringNotify;
functions->IsProgramNative=r300IsProgramNative;
}

View File

@@ -435,6 +435,28 @@ static void r300UpdateCulling(GLcontext* ctx)
r300->hw.cul.cmd[R300_CUL_CULL] = val;
}
static void update_early_z(GLcontext* ctx)
{
/* updates register 0x4f14
if depth test is not enabled it should be 0x00000000
if depth is enabled and alpha not it should be 0x00000001
if depth and alpha is enabled it should be 0x00000000
*/
r300ContextPtr r300 = R300_CONTEXT(ctx);
R300_STATECHANGE(r300, unk4F10);
if (ctx->Color.AlphaEnabled)
/* disable early Z */
r300->hw.unk4F10.cmd[2] = 0x00000000;
else {
if (ctx->Depth.Test)
/* enable early Z */
r300->hw.unk4F10.cmd[2] = 0x00000001;
else
/* disable early Z */
r300->hw.unk4F10.cmd[2] = 0x00000000;
}
}
/**
* Handle glEnable()/glDisable().
@@ -468,6 +490,7 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state)
r300->hw.at.cmd[R300_AT_ALPHA_TEST] &=
~R300_ALPHA_TEST_ENABLE;
}
update_early_z(ctx);
break;
case GL_BLEND:
@@ -488,6 +511,7 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state)
r300->hw.zs.cmd[R300_ZS_CNTL_0] &= R300_RB3D_STENCIL_ENABLE;
r300->hw.zs.cmd[R300_ZS_CNTL_0] |= newval;
update_early_z(ctx);
break;
case GL_STENCIL_TEST:
@@ -502,7 +526,9 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state)
~R300_RB3D_STENCIL_ENABLE;
}
} else {
#if R200_MERGED
FALLBACK(&r300->radeon, RADEON_FALLBACK_STENCIL, state);
#endif
}
break;
@@ -998,7 +1024,7 @@ static void r300PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units)
}
/* Routing and texture-related */
#if 0
void r300_setup_routing(GLcontext *ctx, GLboolean immediate)
{
int i, count=0,reg=0;
@@ -1215,7 +1241,7 @@ void r300_setup_routing(GLcontext *ctx, GLboolean immediate)
r300->hw.vof.cmd[R300_VOF_CNTL_1]|=(4<<(3*i));
}
#endif
static r300TexObj default_tex_obj={
filter:R300_TX_MAG_FILTER_LINEAR | R300_TX_MIN_FILTER_LINEAR,
pitch: 0x8000,
@@ -1328,6 +1354,7 @@ void r300_setup_textures(GLcontext *ctx)
r300ContextPtr r300 = R300_CONTEXT(ctx);
int max_texture_unit=-1; /* -1 translates into no setup costs for fields */
struct gl_texture_unit *texUnit;
GLuint OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->OutputsWritten;
R300_STATECHANGE(r300, txe);
R300_STATECHANGE(r300, tex.filter);
@@ -1353,14 +1380,12 @@ void r300_setup_textures(GLcontext *ctx)
}
for(i=0; i < mtu; i++) {
/*if(ctx->Texture.Unit[i].Enabled == 0)
continue;*/
if( ((r300->state.render_inputs & (_TNL_BIT_TEX0<<i))!=0) != ((ctx->Texture.Unit[i].Enabled)!=0) ) {
/*if( ((r300->state.render_inputs & (_TNL_BIT_TEX0<<i))!=0) != ((ctx->Texture.Unit[i].Enabled)!=0) ) {
WARN_ONCE("Mismatch between render_inputs and ctx->Texture.Unit[i].Enabled value(%d vs %d).\n",
((r300->state.render_inputs & (_TNL_BIT_TEX0<<i))!=0), ((ctx->Texture.Unit[i].Enabled)!=0));
}
}*/
if(r300->state.render_inputs & (_TNL_BIT_TEX0<<i)) {
if(TMU_ENABLED(ctx, i)) {
t=r300->state.texture.unit[i].texobj;
//fprintf(stderr, "format=%08x\n", r300->state.texture.unit[i].format);
r300->state.texture.tc_count++;
@@ -1423,7 +1448,7 @@ void r300_setup_rs_unit(GLcontext *ctx)
0x00,
0x00
};
GLuint vap_outputs;
GLuint OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->OutputsWritten;
/* This needs to be rewritten - it is a hack at best */
@@ -1435,11 +1460,6 @@ void r300_setup_rs_unit(GLcontext *ctx)
cur_reg = 0;
r300->hw.rr.cmd[R300_RR_ROUTE_0] = 0;
if (VERTPROG_ACTIVE(ctx))
vap_outputs = r300->current_vp->outputs;
else
vap_outputs = r300->state.render_inputs;
for (i=0;i<ctx->Const.MaxTextureUnits;i++) {
r300->hw.ri.cmd[R300_RI_INTERP_0+i] = 0
| R300_RS_INTERP_USED
@@ -1447,7 +1467,7 @@ void r300_setup_rs_unit(GLcontext *ctx)
| interp_magic[i];
// fprintf(stderr, "RS_INTERP[%d] = 0x%x\n", i, r300->hw.ri.cmd[R300_RI_INTERP_0+i]);
if (r300->state.render_inputs & (_TNL_BIT_TEX0<<i)) {
if (TMU_ENABLED(ctx, i)) {
assert(r300->state.texture.tc_count != 0);
r300->hw.rr.cmd[R300_RR_ROUTE_0 + cur_reg] = 0
| R300_RS_ROUTE_ENABLE
@@ -1457,7 +1477,7 @@ void r300_setup_rs_unit(GLcontext *ctx)
cur_reg++;
}
}
if (vap_outputs & _TNL_BIT_COLOR0)
if (hw_tcl_on ? OutputsWritten & (1<<VERT_RESULT_COL0) : r300->state.render_inputs & _TNL_BIT_COLOR0)
r300->hw.rr.cmd[R300_RR_ROUTE_0] |= 0
| R300_RS_ROUTE_0_COLOR
| (cur_reg << R300_RS_ROUTE_0_COLOR_DEST_SHIFT);
@@ -1693,7 +1713,7 @@ void r300SetupVertexShader(r300ContextPtr rmesa)
0x400 area might have something to do with pixel shaders as it appears right after pfs programming.
0x406 is set to { 0.0, 0.0, 1.0, 0.0 } most of the time but should change with smooth points and in other rare cases. */
//setup_vertex_shader_fragment(rmesa, 0x406, &unk4);
if(VERTPROG_ACTIVE(ctx)){
if(hw_tcl_on && ((struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx))->translated){
r300SetupVertexProgram(rmesa);
return ;
}
@@ -1754,6 +1774,7 @@ void r300SetupVertexProgram(r300ContextPtr rmesa)
int inst_count;
int param_count;
LOCAL_VARS
struct r300_vertex_program *prog=(struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx);
/* Reset state, in case we don't use something */
@@ -1761,19 +1782,19 @@ void r300SetupVertexProgram(r300ContextPtr rmesa)
((drm_r300_cmd_header_t*)rmesa->hw.vpi.cmd)->vpu.count = 0;
((drm_r300_cmd_header_t*)rmesa->hw.vps.cmd)->vpu.count = 0;
r300VertexProgUpdateParams(ctx, rmesa->current_vp);
r300VertexProgUpdateParams(ctx, prog);
setup_vertex_shader_fragment(rmesa, VSF_DEST_PROGRAM, &(rmesa->current_vp->program));
setup_vertex_shader_fragment(rmesa, VSF_DEST_PROGRAM, &(prog->program));
setup_vertex_shader_fragment(rmesa, VSF_DEST_MATRIX0, &(rmesa->current_vp->params));
setup_vertex_shader_fragment(rmesa, VSF_DEST_MATRIX0, &(prog->params));
#if 0
setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN1, &(rmesa->state.vertex_shader.unknown1));
setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN2, &(rmesa->state.vertex_shader.unknown2));
#endif
inst_count=rmesa->current_vp->program.length/4 - 1;
param_count=rmesa->current_vp->params.length/4;
inst_count=prog->program.length/4 - 1;
param_count=prog->params.length/4;
R300_STATECHANGE(rmesa, pvs);
rmesa->hw.pvs.cmd[R300_PVS_CNTL_1]=(0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT)
@@ -1782,7 +1803,7 @@ void r300SetupVertexProgram(r300ContextPtr rmesa)
rmesa->hw.pvs.cmd[R300_PVS_CNTL_2]=(0 << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT)
| (param_count << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT);
rmesa->hw.pvs.cmd[R300_PVS_CNTL_3]=(0/*rmesa->state.vertex_shader.unknown_ptr2*/ << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT)
| ((inst_count-rmesa->current_vp->t2rs) /*rmesa->state.vertex_shader.unknown_ptr3*/ << 0);
| (inst_count /*rmesa->state.vertex_shader.unknown_ptr3*/ << 0);
/* This is done for vertex shader fragments, but also needs to be done for vap_pvs,
so I leave it as a reminder */
@@ -1799,12 +1820,13 @@ void r300GenerateTexturePixelShader(r300ContextPtr r300)
int i, mtu;
mtu = r300->radeon.glCtx->Const.MaxTextureUnits;
GLenum envMode;
GLuint OutputsWritten = CURRENT_VERTEX_SHADER(r300->radeon.glCtx)->OutputsWritten;
int tex_inst=0, alu_inst=0;
for(i=0;i<mtu;i++){
/* No need to proliferate {} */
if(! (r300->state.render_inputs & (_TNL_BIT_TEX0<<i)))continue;
if(!TMU_ENABLED(r300->radeon.glCtx, i))continue;
envMode = r300->radeon.glCtx->Texture.Unit[i].EnvMode;
//fprintf(stderr, "envMode=%s\n", _mesa_lookup_enum_by_nr(envMode));
@@ -2102,7 +2124,7 @@ void r300ResetHwState(r300ContextPtr r300)
/* Initialize magic registers
TODO : learn what they really do, or get rid of
those we don't have to touch */
r300->hw.unk2080.cmd[1] = 0x0030045A;
r300->hw.unk2080.cmd[1] = 0x0030045A; /* Dangerous */
r300->hw.vte.cmd[1] = R300_VPORT_X_SCALE_ENA
| R300_VPORT_X_OFFSET_ENA
@@ -2314,12 +2336,12 @@ void r300ResetHwState(r300ContextPtr r300)
r300->hw.unk4EA0.cmd[2] = 0xffffffff;
r300->hw.unk4F10.cmd[1] = 0x00000002; // depthbuffer format?
r300->hw.unk4F10.cmd[2] = 0x00000000;
//r300->hw.unk4F10.cmd[2] = 0x00000000;
r300->hw.unk4F10.cmd[3] = 0x00000003;
r300->hw.unk4F10.cmd[4] = 0x00000000;
/* experiment a bit */
r300->hw.unk4F10.cmd[2] = 0x00000001; // depthbuffer format?
//r300->hw.unk4F10.cmd[2] = 0x00000001; // depthbuffer format?
r300->hw.zb.cmd[R300_ZB_OFFSET] =
r300->radeon.radeonScreen->depthOffset +

View File

@@ -206,12 +206,12 @@ GLuint emit_texenv(r300ContextPtr r300, GLuint tc_reg, GLuint unit)
break;
case GL_COMBINE:
WARN_ONCE("EnvMode == GL_COMBINE unsupported! Help Me!!\n");
return Cf;
return get_source(ps, GL_TEXTURE, unit, tc_reg);
break;
default:
WARN_ONCE("Unknown EnvMode == %d, name=%d\n", envmode,
_mesa_lookup_enum_by_nr(envmode));
return Cf;
return get_source(ps, GL_TEXTURE, unit, tc_reg);
break;
}
@@ -223,6 +223,7 @@ void r300GenerateTextureFragmentShader(r300ContextPtr r300)
struct r300_pixel_shader_program *p = &ps->program;
GLcontext *ctx = r300->radeon.glCtx;
int i, tc_reg;
GLuint OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->OutputsWritten;
p->tex.length = 0;
p->alu.length = 0;
@@ -235,7 +236,7 @@ void r300GenerateTextureFragmentShader(r300ContextPtr r300)
tc_reg = 0;
for (i=0;i<ctx->Const.MaxTextureUnits;i++) {
if (r300->state.render_inputs & (_TNL_BIT_TEX0<<i)) {
if (TMU_ENABLED(ctx, i)) {
ps->have_sample = 0;
ps->src_previous = emit_texenv(r300, tc_reg, i);
tc_reg++;

View File

@@ -1302,7 +1302,10 @@ static GLboolean update_tex_common(GLcontext * ctx, int unit)
}
}
#if R200_MERGED
FALLBACK(&rmesa->radeon, RADEON_FALLBACK_BORDER_MODE, t->border_fallback);
#endif
return !t->border_fallback;
}
@@ -1351,7 +1354,9 @@ void r300UpdateTextureState(GLcontext * ctx)
r300UpdateTextureUnit(ctx, 7)
);
#if R200_MERGED
FALLBACK(&rmesa->radeon, RADEON_FALLBACK_TEXTURE, !ok);
#endif
/* This needs correction, or just be done elsewhere
if (rmesa->radeon.TclFallback)

View File

@@ -42,7 +42,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define OP_MASK (0xf) /* we are unlikely to have more than 15 */
#define OPN(operator, ip, op) {#operator, VP_OPCODE_##operator, ip, op}
struct{
static struct{
char *name;
int opcode;
unsigned long ip; /* number of input operands and flags */
@@ -82,7 +82,7 @@ struct{
#undef OPN
#define OPN(rf) {#rf, PROGRAM_##rf}
struct{
static struct{
char *name;
int id;
}register_file_names[]={
@@ -97,7 +97,7 @@ struct{
OPN(ADDRESS),
};
char *dst_mask_names[4]={ "X", "Y", "Z", "W" };
static char *dst_mask_names[4]={ "X", "Y", "Z", "W" };
/* from vertex program spec:
Instruction Inputs Output Description
@@ -174,13 +174,13 @@ void dump_program_params(GLcontext *ctx, struct vertex_program *vp)
fprintf(stderr, "{ ");
for(i=0; i < 4; i++)
fprintf(stderr, "%f ", vp->Parameters->Parameters[pi].Values[i]);
fprintf(stderr, "%f ", vp->Parameters->ParameterValues[pi][i]);
fprintf(stderr, "}\n");
}
}
static void debug_vp(GLcontext *ctx, struct vertex_program *vp)
void debug_vp(GLcontext *ctx, struct vertex_program *vp)
{
struct vp_instruction *vpi;
int i, operand_index;
@@ -212,7 +212,7 @@ static void debug_vp(GLcontext *ctx, struct vertex_program *vp)
fprintf(stderr, "%d.", vpi->DstReg.Index);
for(i=0; i < 4; i++)
if(vpi->DstReg.WriteMask[i])
if(vpi->DstReg.WriteMask & (1<<i))
fprintf(stderr, "%s", dst_mask_names[i]);
fprintf(stderr, " ");
@@ -230,8 +230,8 @@ static void debug_vp(GLcontext *ctx, struct vertex_program *vp)
}
fprintf(stderr, "%d.", vpi->SrcReg[operand_index].Index);
for(i=0; i < 4; i++)
fprintf(stderr, "%s", dst_mask_names[vpi->SrcReg[operand_index].Swizzle[i]]);
/*for(i=0; i < 4; i++)
fprintf(stderr, "%s", dst_mask_names[vpi->SrcReg[operand_index].Swizzle[i]]);*/
if(operand_index+1 < (op_names[operator_index].ip & (~FLAG_MASK)) )
fprintf(stderr, ",");
@@ -262,10 +262,10 @@ void r300VertexProgUpdateParams(GLcontext *ctx, struct r300_vertex_program *vp)
case NAMED_PARAMETER:
//fprintf(stderr, "%s", vp->Parameters->Parameters[pi].Name);
case CONSTANT:
vp->params.body.f[dst_index++]=mesa_vp->Parameters->Parameters[pi].Values[0];
vp->params.body.f[dst_index++]=mesa_vp->Parameters->Parameters[pi].Values[1];
vp->params.body.f[dst_index++]=mesa_vp->Parameters->Parameters[pi].Values[2];
vp->params.body.f[dst_index++]=mesa_vp->Parameters->Parameters[pi].Values[3];
vp->params.body.f[dst_index++]=mesa_vp->Parameters->ParameterValues[pi][0];
vp->params.body.f[dst_index++]=mesa_vp->Parameters->ParameterValues[pi][1];
vp->params.body.f[dst_index++]=mesa_vp->Parameters->ParameterValues[pi][2];
vp->params.body.f[dst_index++]=mesa_vp->Parameters->ParameterValues[pi][3];
break;
default: _mesa_problem(NULL, "Bad param type in %s", __FUNCTION__);
@@ -276,14 +276,14 @@ void r300VertexProgUpdateParams(GLcontext *ctx, struct r300_vertex_program *vp)
vp->params.length=dst_index;
}
static unsigned long t_dst_mask(GLboolean *mask)
static unsigned long t_dst_mask(GLuint mask)
{
unsigned long flags=0;
if(mask[0]) flags |= VSF_FLAG_X;
if(mask[1]) flags |= VSF_FLAG_Y;
if(mask[2]) flags |= VSF_FLAG_Z;
if(mask[3]) flags |= VSF_FLAG_W;
if(mask & WRITEMASK_X) flags |= VSF_FLAG_X;
if(mask & WRITEMASK_Y) flags |= VSF_FLAG_Y;
if(mask & WRITEMASK_Z) flags |= VSF_FLAG_Z;
if(mask & WRITEMASK_W) flags |= VSF_FLAG_W;
return flags;
}
@@ -311,6 +311,40 @@ static unsigned long t_dst_class(enum register_file file)
}
}
static unsigned long t_dst_index(struct r300_vertex_program *vp, struct vp_dst_register *dst)
{
if(dst->File == PROGRAM_OUTPUT)
switch(dst->Index){
case VERT_RESULT_HPOS:
return 0;
case VERT_RESULT_COL0:
return 1;
case VERT_RESULT_TEX0:
return 2;
case VERT_RESULT_TEX1:
return 3;
case VERT_RESULT_TEX2:
return 4;
case VERT_RESULT_TEX3:
return 5;
case VERT_RESULT_TEX4:
return 6;
case VERT_RESULT_TEX5:
return 7;
case VERT_RESULT_TEX6:
return 8;
case VERT_RESULT_TEX7:
return 9;
case VERT_RESULT_COL1:
case VERT_RESULT_BFC0:
case VERT_RESULT_BFC1:
case VERT_RESULT_FOGC:
case VERT_RESULT_PSIZ:
default: WARN_ONCE("Unknown output\n"); return 10;
}
return dst->Index;
}
static unsigned long t_src_class(enum register_file file)
{
@@ -340,13 +374,12 @@ static unsigned long t_src_class(enum register_file file)
static unsigned long t_swizzle(GLubyte swizzle)
{
switch(swizzle){
case 0: return VSF_IN_COMPONENT_X;
case 1: return VSF_IN_COMPONENT_Y;
case 2: return VSF_IN_COMPONENT_Z;
case 3: return VSF_IN_COMPONENT_W;
case SWIZZLE_ZERO:
case SWIZZLE_ONE:
case SWIZZLE_X: return VSF_IN_COMPONENT_X;
case SWIZZLE_Y: return VSF_IN_COMPONENT_Y;
case SWIZZLE_Z: return VSF_IN_COMPONENT_Z;
case SWIZZLE_W: return VSF_IN_COMPONENT_W;
case SWIZZLE_ZERO: return VSF_IN_COMPONENT_ZERO;
case SWIZZLE_ONE: return VSF_IN_COMPONENT_ONE;
default:
fprintf(stderr, "problem in %s", __FUNCTION__);
exit(0);
@@ -396,10 +429,10 @@ static unsigned long t_src(struct r300_vertex_program *vp, struct vp_src_registe
{
return MAKE_VSF_SOURCE(t_src_index(vp, src),
t_swizzle(src->Swizzle[0]),
t_swizzle(src->Swizzle[1]),
t_swizzle(src->Swizzle[2]),
t_swizzle(src->Swizzle[3]),
t_swizzle(GET_SWZ(src->Swizzle, 0)),
t_swizzle(GET_SWZ(src->Swizzle, 1)),
t_swizzle(GET_SWZ(src->Swizzle, 2)),
t_swizzle(GET_SWZ(src->Swizzle, 3)),
t_src_class(src->File),
src->Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
}
@@ -408,10 +441,10 @@ static unsigned long t_src_scalar(struct r300_vertex_program *vp, struct vp_src_
{
return MAKE_VSF_SOURCE(t_src_index(vp, src),
t_swizzle(src->Swizzle[0]),
t_swizzle(src->Swizzle[0]),
t_swizzle(src->Swizzle[0]),
t_swizzle(src->Swizzle[0]),
t_swizzle(GET_SWZ(src->Swizzle, 0)),
t_swizzle(GET_SWZ(src->Swizzle, 0)),
t_swizzle(GET_SWZ(src->Swizzle, 0)),
t_swizzle(GET_SWZ(src->Swizzle, 0)),
t_src_class(src->File),
src->Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
}
@@ -420,14 +453,12 @@ static unsigned long t_opcode(enum vp_opcode opcode)
{
switch(opcode){
case VP_OPCODE_ADD: return R300_VPI_OUT_OP_ADD;
case VP_OPCODE_DST: return R300_VPI_OUT_OP_DST;
case VP_OPCODE_EX2: return R300_VPI_OUT_OP_EX2;
case VP_OPCODE_EXP: return R300_VPI_OUT_OP_EXP;
case VP_OPCODE_FRC: return R300_VPI_OUT_OP_FRC;
case VP_OPCODE_LG2: return R300_VPI_OUT_OP_LG2;
case VP_OPCODE_LOG: return R300_VPI_OUT_OP_LOG;
case VP_OPCODE_MAD: return R300_VPI_OUT_OP_MAD;
case VP_OPCODE_MAX: return R300_VPI_OUT_OP_MAX;
case VP_OPCODE_MIN: return R300_VPI_OUT_OP_MIN;
case VP_OPCODE_MUL: return R300_VPI_OUT_OP_MUL;
@@ -452,7 +483,7 @@ static unsigned long op_operands(enum vp_opcode opcode)
/* Can we trust mesas opcodes to be in order ? */
for(i=0; i < sizeof(op_names) / sizeof(*op_names); i++)
if(op_names[i].opcode == opcode)
return op_names[i].ip & OP_MASK;
return op_names[i].ip;
fprintf(stderr, "op %d not found in op_names\n", opcode);
exit(-1);
@@ -467,7 +498,7 @@ static unsigned long op_operands(enum vp_opcode opcode)
t_src_class(b.File) == VSF_IN_CLASS_ATTR))) \
#define SRCS_WRITABLE 1
static void translate_program(struct r300_vertex_program *vp)
void translate_vertex_shader(struct r300_vertex_program *vp)
{
struct vertex_program *mesa_vp=(void *)vp;
struct vp_instruction *vpi;
@@ -476,6 +507,7 @@ static void translate_program(struct r300_vertex_program *vp)
VERTEX_SHADER_INSTRUCTION *o_inst;
unsigned long operands;
int are_srcs_scalar;
unsigned long hw_op;
/* Initial value should be last tmp reg that hw supports.
Strangely enough r300 doesnt mind even though these would be out of range.
Smart enough to realize that it doesnt need it? */
@@ -492,29 +524,12 @@ static void translate_program(struct r300_vertex_program *vp)
for(i=0; i < VERT_ATTRIB_MAX; i++)
vp->inputs[i]=-1;
vp->outputs = 0;
/* FIXME: hardcoded values in arbprogparse.c:parse_result_binding ()
We might want to use these constants for VAP output in general as well once they have been added to
mesa headers.
*/
if(mesa_vp->OutputsWritten & (1<<0))
vp->outputs |= _TNL_BIT_POS;
if(mesa_vp->OutputsWritten & (1<<1))
vp->outputs |= _TNL_BIT_COLOR0;
if(mesa_vp->OutputsWritten & (1<<2))
vp->outputs |= _TNL_BIT_COLOR1;
for(i=0; i < 8/*ctx->Const.MaxTextureUnits*/; i++)
if(mesa_vp->OutputsWritten & (1<<(7+i)))
vp->outputs |= _TNL_BIT_TEX(i);
if(mesa_vp->OutputsWritten & ~(0x7 | 0x3f80))
fprintf(stderr, "%s:Odd bits(0x%08x)\n", __FUNCTION__, mesa_vp->OutputsWritten);
o_inst=vp->program.body.i;
for(vpi=mesa_vp->Instructions; vpi->Opcode != VP_OPCODE_END; vpi++, o_inst++){
operands=op_operands(vpi->Opcode);
are_srcs_scalar=operands & SCALAR_FLAG;
operands &= ~SCALAR_FLAG;
operands &= OP_MASK;
for(i=0; i < operands; i++)
src[i]=vpi->SrcReg[i];
@@ -569,7 +584,7 @@ static void translate_program(struct r300_vertex_program *vp)
Ops that need temp vars should probably be given reg indexes starting at the end of tmp area. */
switch(vpi->Opcode){
case VP_OPCODE_MOV://ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO}
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, vpi->DstReg.Index,
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=t_src(vp, &src[0]);
o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
@@ -579,72 +594,101 @@ static void translate_program(struct r300_vertex_program *vp)
o_inst->src3=0;
goto next;
case VP_OPCODE_ADD:
hw_op=(src[0].File == PROGRAM_TEMPORARY &&
src[1].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : R300_VPI_OUT_OP_MAD;
o_inst->op=MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=t_src(vp, &src[0]);
o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
SWIZZLE_ONE, SWIZZLE_ONE,
SWIZZLE_ONE, SWIZZLE_ONE,
t_src_class(src[0].File), VSF_FLAG_NONE);
o_inst->src3=t_src(vp, &src[1]);
goto next;
case VP_OPCODE_MAD:
hw_op=(src[0].File == PROGRAM_TEMPORARY &&
src[1].File == PROGRAM_TEMPORARY &&
src[2].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : R300_VPI_OUT_OP_MAD;
o_inst->op=MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=t_src(vp, &src[0]);
o_inst->src2=t_src(vp, &src[1]);
o_inst->src3=t_src(vp, &src[2]);
goto next;
case VP_OPCODE_MUL: /* HW mul can take third arg but appears to have some other limitations. */
hw_op=(src[0].File == PROGRAM_TEMPORARY &&
src[1].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : R300_VPI_OUT_OP_MAD;
o_inst->op=MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=t_src(vp, &src[0]);
o_inst->src2=t_src(vp, &src[1]);
o_inst->src3=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
SWIZZLE_ZERO, SWIZZLE_ZERO,
SWIZZLE_ZERO, SWIZZLE_ZERO,
t_src_class(src[1].File), VSF_FLAG_NONE);
goto next;
case VP_OPCODE_DP3://DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ZERO} PARAM 0{} {X Y Z ZERO}
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, vpi->DstReg.Index,
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(src[0].Swizzle[0]),
t_swizzle(src[0].Swizzle[1]),
t_swizzle(src[0].Swizzle[2]),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
t_swizzle(GET_SWZ(src[0].Swizzle, 1)),
t_swizzle(GET_SWZ(src[0].Swizzle, 2)),
SWIZZLE_ZERO,
t_src_class(src[0].File),
src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
src[0].Negate ? VSF_FLAG_XYZ : VSF_FLAG_NONE);
o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
t_swizzle(src[1].Swizzle[0]),
t_swizzle(src[1].Swizzle[1]),
t_swizzle(src[1].Swizzle[2]),
t_swizzle(GET_SWZ(src[1].Swizzle, 0)),
t_swizzle(GET_SWZ(src[1].Swizzle, 1)),
t_swizzle(GET_SWZ(src[1].Swizzle, 2)),
SWIZZLE_ZERO,
t_src_class(src[1].File),
src[1].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
src[1].Negate ? VSF_FLAG_XYZ : VSF_FLAG_NONE);
o_inst->src3=0;
goto next;
case VP_OPCODE_SUB://ADD RESULT 1.X Y Z W TMP 0{} {X Y Z W} PARAM 1{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W
#ifdef SRCS_WRITABLE
vpi->Opcode=VP_OPCODE_ADD;
src[1].Negate=!src[1].Negate;
break;
#else
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, vpi->DstReg.Index,
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=t_src(vp, &src[0]);
o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
t_swizzle(src[1].Swizzle[0]),
t_swizzle(src[1].Swizzle[1]),
t_swizzle(src[1].Swizzle[2]),
t_swizzle(src[1].Swizzle[3]),
t_swizzle(GET_SWZ(src[1].Swizzle, 0)),
t_swizzle(GET_SWZ(src[1].Swizzle, 1)),
t_swizzle(GET_SWZ(src[1].Swizzle, 2)),
t_swizzle(GET_SWZ(src[1].Swizzle, 3)),
t_src_class(src[1].File),
(!src[1].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE);
o_inst->src3=0;
goto next;
#endif
case VP_OPCODE_ABS://MAX RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W
#ifdef SRCS_WRITABLE
vpi->Opcode=VP_OPCODE_MAX;
src[1]=src[0];
src[1].Negate=!src[0].Negate;
operands=op_operands(vpi->Opcode);
break;
#else
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_MAX, vpi->DstReg.Index,
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_MAX, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=t_src(vp, &src[0]);
o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(src[0].Swizzle[0]),
t_swizzle(src[0].Swizzle[1]),
t_swizzle(src[0].Swizzle[2]),
t_swizzle(src[0].Swizzle[3]),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
t_swizzle(GET_SWZ(src[0].Swizzle, 1)),
t_swizzle(GET_SWZ(src[0].Swizzle, 2)),
t_swizzle(GET_SWZ(src[0].Swizzle, 3)),
t_src_class(src[0].File),
VSF_FLAG_ALL);
(!src[0].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE);
o_inst->src3=0;
goto next;
#endif
case VP_OPCODE_FLR:
/* FRC TMP 0.X Y Z W PARAM 0{} {X Y Z W}
ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} TMP 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W */
@@ -657,7 +701,7 @@ static void translate_program(struct r300_vertex_program *vp)
o_inst->src3=0;
o_inst++;
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, vpi->DstReg.Index,
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=t_src(vp, &src[0]);
@@ -674,102 +718,123 @@ static void translate_program(struct r300_vertex_program *vp)
u_temp_i--;
goto next;
case VP_OPCODE_LG2:// LG2 RESULT 1.X Y Z W PARAM 0{} {X X X X}
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_LG2, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
t_src_class(src[0].File),
src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
o_inst->src2=0;
o_inst->src3=0;
goto next;
case VP_OPCODE_LIT://LIT TMP 1.Y Z TMP 1{} {X W Z Y} TMP 1{} {Y W Z X} TMP 1{} {Y X Z W}
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_LIT, vpi->DstReg.Index,
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_LIT, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
/* NOTE: Users swizzling might not work. */
o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(src[0].Swizzle[0]), // x
t_swizzle(src[0].Swizzle[3]), // w
t_swizzle(src[0].Swizzle[2]), // z
t_swizzle(src[0].Swizzle[1]), // y
t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
t_src_class(src[0].File),
src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(src[0].Swizzle[1]), // y
t_swizzle(src[0].Swizzle[3]), // w
t_swizzle(src[0].Swizzle[2]), // z
t_swizzle(src[0].Swizzle[0]), // x
t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
t_src_class(src[0].File),
src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
o_inst->src3=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(src[0].Swizzle[1]), // y
t_swizzle(src[0].Swizzle[0]), // x
t_swizzle(src[0].Swizzle[2]), // z
t_swizzle(src[0].Swizzle[3]), // w
t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
t_src_class(src[0].File),
src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
goto next;
case VP_OPCODE_DPH://DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ONE} PARAM 0{} {X Y Z W}
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, vpi->DstReg.Index,
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(src[0].Swizzle[0]),
t_swizzle(src[0].Swizzle[1]),
t_swizzle(src[0].Swizzle[2]),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
t_swizzle(GET_SWZ(src[0].Swizzle, 1)),
t_swizzle(GET_SWZ(src[0].Swizzle, 2)),
VSF_IN_COMPONENT_ONE,
t_src_class(src[0].File),
src[1].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
src[0].Negate ? VSF_FLAG_XYZ : VSF_FLAG_NONE);
o_inst->src2=t_src(vp, &src[1]);
o_inst->src3=0;
goto next;
case VP_OPCODE_XPD: /* Broken due to swizzling */
/* ADD TMP 0.X Y Z PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO}
MUL TMP 1.X Y Z W TMP 0{} {Z X Y ZERO} PARAM 1{} {Y Z X ZERO}
MAD RESULT 1.X Y Z W TMP 0{} {Y Z X ONE} PARAM 1{} {Z X Y ONE} TMP 1{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W*/
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, u_temp_i,
case VP_OPCODE_XPD:
/* mul r0, r1.yzxw, r2.zxyw
mad r0, -r2.yzxw, r1.zxyw, r0
NOTE: might need MAD_2
*/
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, u_temp_i,
t_dst_mask(vpi->DstReg.WriteMask), VSF_OUT_CLASS_TMP);
o_inst->src1=t_src(vp, &src[0]);
o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
t_src_class(src[0].File),
src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z
t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x
t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y
t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w
t_src_class(src[1].File),
src[1].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
o_inst->src3=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
SWIZZLE_ZERO, SWIZZLE_ZERO,
SWIZZLE_ZERO, SWIZZLE_ZERO,
t_src_class(src[1].File),
VSF_FLAG_NONE);
o_inst++;
u_temp_i--;
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y
t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z
t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x
t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w
t_src_class(src[1].File),
(!src[1].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE);
o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
SWIZZLE_ZERO, SWIZZLE_ZERO,
SWIZZLE_ZERO, SWIZZLE_ZERO,
t_src_class(src[0].File), VSF_FLAG_NONE);
o_inst->src3=0;
o_inst++;
u_temp_i--;
t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
t_src_class(src[0].File),
src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_MUL, u_temp_i,
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=MAKE_VSF_SOURCE(u_temp_i+1,
VSF_IN_COMPONENT_X,
VSF_IN_COMPONENT_Y,
VSF_IN_COMPONENT_Z,
SWIZZLE_ZERO,
VSF_IN_CLASS_TMP,
/* Not 100% sure about this */
(!src[1].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE/*VSF_FLAG_ALL*/);
o_inst->src2=t_src(vp, &src[1]);
o_inst->src3=0;
u_temp_i--;
o_inst++;
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, vpi->DstReg.Index,
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=MAKE_VSF_SOURCE(u_temp_i+2,
VSF_IN_COMPONENT_X,
VSF_IN_COMPONENT_Y,
VSF_IN_COMPONENT_Z,
SWIZZLE_ONE,
VSF_IN_CLASS_TMP,
/* Not 100% sure about this */
src[1].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE/*VSF_FLAG_ALL*/);
o_inst->src2=MAKE_VSF_SOURCE(u_temp_i+1,
o_inst->src3=MAKE_VSF_SOURCE(u_temp_i+1,
VSF_IN_COMPONENT_X,
VSF_IN_COMPONENT_Y,
VSF_IN_COMPONENT_Z,
VSF_IN_COMPONENT_W,
VSF_IN_CLASS_TMP,
/* Not 100% sure about this */
(!src[1].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE/*VSF_FLAG_ALL*/);
o_inst->src3=0;
VSF_FLAG_NONE);
goto next;
case VP_OPCODE_ARL:
@@ -786,7 +851,7 @@ static void translate_program(struct r300_vertex_program *vp)
break;
}
o_inst->op=MAKE_VSF_OP(t_opcode(vpi->Opcode), vpi->DstReg.Index,
o_inst->op=MAKE_VSF_OP(t_opcode(vpi->Opcode), t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
if(are_srcs_scalar){
@@ -866,115 +931,3 @@ static void translate_program(struct r300_vertex_program *vp)
vp->translated=GL_TRUE;
}
static void r300BindProgram(GLcontext *ctx, GLenum target, struct program *prog)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
struct r300_vertex_program *vp=(void *)prog;
#if 0
fprintf(stderr, "r300BindProgram\n");
#endif
if(rmesa->current_vp == vp)
return ;
rmesa->current_vp = vp;
}
/* Mesa doesnt seem to have prototype for this */
struct program *
_mesa_init_ati_fragment_shader( GLcontext *ctx, struct ati_fragment_shader *prog,
GLenum target, GLuint id);
static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id)
{
struct r300_vertex_program *vp;
struct fragment_program *fp;
struct ati_fragment_shader *afs;
#if 0
fprintf(stderr, "r300NewProgram, target=%d, id=%d\n", target, id);
#endif
switch(target){
case GL_VERTEX_PROGRAM_ARB:
vp=CALLOC_STRUCT(r300_vertex_program);
return _mesa_init_vertex_program(ctx, &vp->mesa_program, target, id);
case GL_FRAGMENT_PROGRAM_ARB:
fp=CALLOC_STRUCT(fragment_program);
return _mesa_init_fragment_program(ctx, fp, target, id);
case GL_FRAGMENT_PROGRAM_NV:
fp=CALLOC_STRUCT(fragment_program);
return _mesa_init_fragment_program(ctx, fp, target, id);
case GL_FRAGMENT_SHADER_ATI:
afs=CALLOC_STRUCT(ati_fragment_shader);
return _mesa_init_ati_fragment_shader(ctx, afs, target, id);
}
return NULL;
}
static void r300DeleteProgram(GLcontext *ctx, struct program *prog)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
struct r300_vertex_program *vp=(void *)prog;
#if 0
fprintf(stderr, "r300DeleteProgram\n");
#endif
if(rmesa->current_vp == vp)
rmesa->current_vp = NULL;
_mesa_delete_program(ctx, prog);
}
static GLboolean r300IsProgramNative(GLcontext *ctx, GLenum target,
struct program *prog);
static void r300ProgramStringNotify(GLcontext *ctx, GLenum target,
struct program *prog)
{
struct r300_vertex_program *vp=(void *)prog;
#if 0
fprintf(stderr, "r300ProgramStringNotify\n");
#endif
switch(target) {
case GL_VERTEX_PROGRAM_ARB:
vp->translated=GL_FALSE;
break;
case GL_FRAGMENT_PROGRAM_ARB:
return ;
break;
}
/* XXX: There is still something wrong as mesa doesnt call r300IsProgramNative at all */
(void)r300IsProgramNative(ctx, target, prog);
}
static GLboolean r300IsProgramNative(GLcontext *ctx, GLenum target,
struct program *prog)
{
struct r300_vertex_program *vp=(void *)prog;
r300ContextPtr rmesa = R300_CONTEXT(ctx);
#if 0
fprintf(stderr, "r300IsProgramNative\n");
//exit(0);
debug_vp(ctx, vp);
#endif
translate_program(vp);
//r300VertexProgUpdateParams(ctx, vp);
return 1;
}
/* This is misnamed and shouldnt be here since fragment programs use these functions too */
void r300InitVertexProgFuncs(struct dd_function_table *functions)
{
functions->NewProgram=r300NewProgram;
functions->BindProgram=r300BindProgram;
functions->DeleteProgram=r300DeleteProgram;
functions->ProgramStringNotify=r300ProgramStringNotify;
functions->IsProgramNative=r300IsProgramNative;
}

View File

@@ -270,11 +270,13 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
driDrawableInitVBlank(driDrawPriv,
radeon->vblank_flags);
radeon->dri.drawable = driDrawPriv;
#if R200_MERGED
if (IS_FAMILY_R200(radeon)) {
r200UpdateWindow(radeon->glCtx);
r200UpdateViewportOffset(radeon->glCtx);
}
#endif
}
_mesa_make_current2(radeon->glCtx,
@@ -290,9 +292,11 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
_mesa_update_state(radeon->glCtx);
#if R200_MERGED
if (IS_FAMILY_R200(radeon))
r200ValidateState(radeon->glCtx);
#endif
} else {
if (RADEON_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s ctx is null\n", __FUNCTION__);

View File

@@ -80,6 +80,7 @@ static __inline GLuint radeonPackColor(GLuint cpp,
#define RADEON_FALLBACK_DISABLE 0x40
#define RADEON_FALLBACK_BORDER_MODE 0x80
#if R200_MERGED
extern void radeonFallback(GLcontext * ctx, GLuint bit, GLboolean mode);
#define FALLBACK( radeon, bit, mode ) do { \
@@ -87,7 +88,9 @@ extern void radeonFallback(GLcontext * ctx, GLuint bit, GLboolean mode);
__FUNCTION__, bit, mode ); \
radeonFallback( (radeon)->glCtx, bit, mode ); \
} while (0)
#else
#define FALLBACK( radeon, bit, mode ) fprintf(stderr, "%s:%s\n", __LINE__, __FILE__);
#endif
/* TCL fallbacks */
extern void radeonTclFallback(GLcontext * ctx, GLuint bit, GLboolean mode);
@@ -106,7 +109,11 @@ extern void radeonTclFallback(GLcontext * ctx, GLuint bit, GLboolean mode);
#define RADEON_TCL_FALLBACK_BITMAP 0x0800 /* draw bitmap with points */
#define RADEON_TCL_FALLBACK_VERTEX_PROGRAM 0x1000 /* vertex program active */
#if R200_MERGED
#define TCL_FALLBACK( ctx, bit, mode ) radeonTclFallback( ctx, bit, mode )
#else
#define TCL_FALLBACK( ctx, bit, mode ) ;
#endif
struct radeon_dri_mirror {

View File

@@ -40,7 +40,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "macros.h"
#include "context.h"
#include "swrast/swrast.h"
#include "r200_context.h"
#include "r300_context.h"
#include "r200_state.h"
@@ -329,8 +328,10 @@ void radeonFlush(GLcontext * ctx)
if (IS_FAMILY_R300(radeon))
r300Flush(ctx);
#if R200_MERGED
else
r200Flush(ctx);
#endif
}

View File

@@ -68,6 +68,7 @@ static void radeonUpdatePageFlipping(radeonContextPtr radeon)
/**
* Called by radeonGetLock() after the lock has been obtained.
*/
#if R200_MERGED
static void r200RegainedLock(r200ContextPtr r200)
{
__DRIdrawablePrivate *dPriv = r200->radeon.dri.drawable;
@@ -94,6 +95,7 @@ static void r200RegainedLock(r200ContextPtr r200)
DRI_AGE_TEXTURES(r200->texture_heaps[i]);
}
}
#endif
static void r300RegainedLock(radeonContextPtr radeon)
{
@@ -111,7 +113,7 @@ static void r300RegainedLock(radeonContextPtr radeon)
radeon->lastStamp = dPriv->lastStamp;
}
#if 0
#if R200_MERGED
for (i = 0; i < r200->nr_heaps; i++) {
DRI_AGE_TEXTURES(r200->texture_heaps[i]);
}
@@ -149,8 +151,10 @@ void radeonGetLock(radeonContextPtr radeon, GLuint flags)
if (IS_FAMILY_R300(radeon))
r300RegainedLock(radeon);
#if R200_MERGED
else
r200RegainedLock((r200ContextPtr)radeon);
#endif
radeon->lost_context = GL_TRUE;
}

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