Commit Graph

38690 Commits

Author SHA1 Message Date
Kristian Høgsberg b4bb668020 dri: Unset current context and dispatch table when unbinding
Otherwise, when we switch to an indirect glx context and then back, it looks
like we're still current.

https://bugs.freedesktop.org/show_bug.cgi?id=29977#c7
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2010-09-08 09:01:43 -04:00
Chia-I Wu 1a5b32ca01 glsl: Support GLSL ES in the standalone compile.
GLSL ES mode is enabled when --glsl-es is passed to glsl_compiler.
2010-09-08 04:08:29 -07:00
Chia-I Wu dc754586ca glsl: Require a context in _mesa_glsl_parse_state.
Create a dummy context in the standalone compiler and pass it to
_mesa_glsl_parse_state.
2010-09-08 04:08:24 -07:00
Chia-I Wu 7e03e2b2c7 st/dri: Call dri_init_extensions only for API_OPENGL.
libmesagallium.a that this state tracker will be linked to expects
OpenGL's _glapi_table.  That is, it expects libGL.so instead of
libGLESv1_CM.so or libGLESv2.so.  As there is no clean way to know the
shared library the app links to, use the api as a simple check.  It
might be as well to simply remove this function call though.
2010-09-08 18:21:19 +08:00
Chia-I Wu 444d8408e7 st/dri: Use enum st_api_type internally. 2010-09-08 18:20:44 +08:00
nobled 8e3b658b7f st/dri: Add multi-api support
Make st/dri screens capable of creating OpenGL ES and
OpenGL ES2 contexts.

TODO: Figure out the "get_current" problem with multiple
st_api's for real.

(s/API_OPENGLES1/API_OPENGLES/ by Chia-I Wu)
2010-09-08 17:25:01 +08:00
nobled ecd7ec9d62 st/dri: Make clear which API's are supported
If the caller requests a GLES context, don't silently create
a desktop GL context in its place.
2010-09-08 12:55:26 +08:00
Dave Airlie bf346f065c r600g: add initial bank swizzle support.
this is ported from r600c mostly, bank swizzling is real messy and I don't think
I got enough sleep last night to fully understand it.
2010-09-08 14:12:21 +10:00
Kenneth Graunke 48e789d71e glcpp: Fix build on non-GCC compilers. 2010-09-07 18:01:33 -07:00
Kenneth Graunke 10eaa8bcbc ast_to_hir: Mark arrays as lvalues in GLSL ES, but prohibit assignment.
This allows them to be passed as out/inout parameters, but still
prevents them from being used as the target of an assignment.  This is
per section 5.8 of the GLSL ES 1.00 specification.
2010-09-07 17:30:39 -07:00
Kenneth Graunke a98d5a5ac8 glsl: Allow overloading of built-ins without hiding in GLSL ES.
The rules are explicitly different from desktop GLSL.
2010-09-07 17:30:39 -07:00
Kenneth Graunke f412fac5b4 glsl: Move is_builtin flag back to ir_function_signature.
This effectively reverts b6f15869b3.

In desktop GLSL, defining a function with the same name as a built-in
hides that built-in function completely, so there would never be
built-in and user function signatures in the same ir_function.

However, in GLSL ES, overloading built-ins is allowed, and does not
hide the built-in signatures - so we're back to needing this.
2010-09-07 17:30:38 -07:00
Kenneth Graunke c98deb18d5 ast_to_hir: Reject embedded structure definitions in GLSL ES 1.00. 2010-09-07 17:30:38 -07:00
Kenneth Graunke d8e34e29eb ast_to_hir: Reject unsized array declarations in GLSL ES 1.00. 2010-09-07 17:30:38 -07:00
Kenneth Graunke b4ec3f268c ast_to_hir: Allow matrix-from-matrix constructors in GLSL ES.
Everything but 1.10 supports this, so just change the check to ==.
2010-09-07 17:30:38 -07:00
Kenneth Graunke 883ac22810 i965: Enable EXT_framebuffer_blit internally.
Otherwise, ES2's BindFramebuffer entrypoint hits this assertion:
main/fbobject.c:1323: _mesa_BindFramebufferEXT: Assertion
`ctx->Extensions.EXT_framebuffer_blit' failed.
2010-09-07 17:30:38 -07:00
Kenneth Graunke 67da41c10c mesa: Enable GL_MAX_VERTEX_ATTRIBS in ES2.
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2010-09-07 17:30:38 -07:00
Kenneth Graunke 5a81d057db linker: Fix assertion and cross-version checks for version 100.
Fixes an assert (min_version >= 110) which was no longer correct, and
also prohibits linking ES2 shaders with non-ES2 shaders.  I'm not
positive this is correct, but the specification doesn't seem to say.
2010-09-07 17:30:38 -07:00
Kenneth Graunke 116dc670e9 glsl: Add built-in function profiles for GLSL ES 1.00. 2010-09-07 17:30:38 -07:00
Kenneth Graunke b4fe4d52b6 glsl: Add built-in variables for GLSL ES 1.00. 2010-09-07 17:30:38 -07:00
Kenneth Graunke 76deef138e glsl: Split out types that are in 1.10 but not GLSL ES 1.00. 2010-09-07 17:30:37 -07:00
Kenneth Graunke c5e74871d9 glsl: Recognize GLSL ES 1.00 keywords. 2010-09-07 17:30:37 -07:00
Kenneth Graunke 7dcfc44b72 glsl: Define GL_ES preprocessor macro if API is OpenGL ES 2.0.
Also define it if #version 100 is encountered.
2010-09-07 17:30:37 -07:00
Kenneth Graunke 719caa403e glsl: Accept language version 100 and make it the default on ES2. 2010-09-07 17:30:37 -07:00
Kenneth Graunke 814c89abdb glsl: Set default language version in mesa_glsl_parse_state constructor.
This should make it easier to change the default version based on the
API (say, version 1.00 for OpenGL ES).

Also, synchronize the symbol table's version with the parse state's
version just before doing AST-to-HIR.  This way, it will be set when
it matters, but the main initialization code doesn't have to care about
the symbol table.
2010-09-07 17:30:37 -07:00
Eric Anholt 4a867be143 ir_to_mesa: Add support for gl_NormalScale.
Bug #30040.
2010-09-07 16:43:35 -07:00
Kenneth Graunke a09a8ec12d glsl: Make sure shader source isn't NULL.
This should only occur if glCompileShader is called without a prior call
to glShaderSource.  An empty source program should be the empty string.
2010-09-07 16:25:53 -07:00
Tilman Sauerbeck 1e28dd4ebe r600g: Added missing r600_bc_add_literal() calls to XPD implementation.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-08 09:10:46 +10:00
Tilman Sauerbeck 460c5304ab r600g: Added preliminary support for the LOG opcode.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-08 09:10:07 +10:00
Tilman Sauerbeck 42c966bc49 r600g: Added missing abs-ification to RSQ.
This makes the 'fp1-RSQ test 2' piglit test work.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-08 09:07:02 +10:00
Dave Airlie a3a94554f5 r600g: split opcodes out and add wrapper around usage.
This splits the r600 opcodes out of the sq file and adds a wrapper
so we can convert to evergreen opcodes later without touching these functions
too much.
2010-09-08 08:49:00 +10:00
Dave Airlie d42efb9e8d r600g: add support for constants in memory buffers.
DX9 constants were in the constant file, and evergreen no longer support
cfile. r600/700 can also use constants in memory buffers, so add the code
(disabled for now) to enable that as precursor for evergreen.
2010-09-08 08:41:57 +10:00
Dave Airlie 9ef1c51be1 r600g: abstract the hw states out behind a vtbl.
this is step one towards evergreen support, it lets us plug in whole
new hw level states.
2010-09-08 08:30:59 +10:00
Ian Romanick f09fabc448 glsl2: Forbid array-types in ?: operator in GLSL 1.10
Fixes bugzilla #30039.
2010-09-07 14:33:29 -07:00
Eric Anholt 50a3349bee mesa: Set the base format of GL_ALPHA FBOs and teach swrast about it.
Fixes assertion failures in fbo-alpha with a debug build of Mesa.
Bug #29781.
2010-09-07 14:34:23 -07:00
Eric Anholt acd7c21541 ir_to_mesa: Fix warning in last commit.
I swear there was some git option for "don't push things when you've
got uncommitted changes", but I can't find it now.
2010-09-07 14:26:53 -07:00
Eric Anholt 6c0ba32fd1 ir_to_mesa: Move the STATE_VAR elements of a builtin uniform to a temp (v2).
Like the constant handling and the handling of other uniforms, we add
the whole thing to the Parameters, avoiding messy, incomplete logic
for adding just the elements of a builting uniform that get used.
This means that a driver that relies only on ParameterValues[] for its
parameters will have an increased parameter load, but drivers
generally don't do that (since they have other params they need to
handle, too).

Fixes glsl-fs-statevar-call (testcase for Ember).  Bug #29687.

v2: Continue referencing the STATE_VAR[] file directly when the
uniform will land in STATE_VAR[] formatted exactly as we'd put into a
temporary.  When there's array dereferencing, we don't copy-propagate
in Mesa IR (not knowing where the array is in register space), so
smarts here are required or we'll massively increase the temp count.
2010-09-07 13:59:29 -07:00
Ian Romanick 956f049fd2 glsl2: Early return with visit_continue in loop_analysis::visit(ir_dereference_variable *)
Returning early with visit_continue_with_parent prevented the
then-statements and else-statements of if-statements such as the
following from being processed:

	  if (some_var) { ... } else { ... }

Fixes piglit test case glsl-fs-loop-nested-if and bugzilla #30030.
2010-09-07 13:36:32 -07:00
Kenneth Graunke 0427228bbc glsl: Change grammar rules for selection statements to match the spec.
Fixes piglit test case loop-06.vert.

Unfortunately, causes 1 shift/reduce conflict.
2010-09-07 13:17:05 -07:00
Eric Anholt 24c12e6c7f i965: Store the byte address in the VS constant buffer as an integer.
We carefully multiplied our two ints (since we want to be precise
after all) then stored them in a float, which is not specced to really
work, in addition to wasting precision.  Fixes
vp-arl-constant-array-huge-* things since the assertions were added.
2010-09-07 13:00:22 -07:00
Eric Anholt 32b84ef4ca i965: Make pixel_xy results UW.
There is a restriction on the destination of an operation involving a
vector immediate being 128-bit aligned and the destination horizontal
stride being equivalent to 2 bytes.  Fixes bad pixel_x results from
gl_FragCoord, where each pair had the same value.
2010-09-07 13:00:22 -07:00
Török Edvin c47b289972 glsl2: check for _NumLinkedShaders being 0
Otherwise spring 0.82+.4.0 crashes when starting a game
because prog->_LinkedShaders[0] is NULL.

This also fixes piglit test cases glsl-link-empty-prog-0[12].
2010-09-07 12:27:07 -07:00
Kristian Høgsberg 3ea3f5e0a5 glx: Set an all NULL vtable for dummyContext
This reverts 6a6e6d7b0a and initializes
dummyContext with an all NULL vtable.  The context vtable pointer is
supposed to always be non-NULL, but the vtable entries can be NULL.
2010-09-07 14:32:28 -04:00
Kristian Høgsberg 57d3f71132 glx: Fix compilation with out xf86vidmode 2010-09-07 14:24:25 -04:00
Kristian Høgsberg f84d8fab99 glx: Use GLX_BufferSwapComplete unconditionally, we require glproto 1.4.11 2010-09-07 14:24:25 -04:00
Michel Dänzer 6a6e6d7b0a Fix crashes when some GLX API entrypoints are called with no current context.
I was hitting this with gliv.

The GLX spec explicitly mentions that glXWaitX, glXWaitGL and glXUseXFont calls
are ignored when there's no current context. Not sure what if anything the
GLX_EXT_texture_from_pixmap spec says about this, but I think ignoring the
calls makes more sense than crashing there as well. :)
2010-09-07 19:54:16 +02:00
Eric Anholt 5afdfa222f i965: Don't bother with RNDZ for f2i.
The default type conversion for MOV should be fine, and RNDZ actually
requires two instructions.
2010-09-07 10:34:10 -07:00
Eric Anholt a560a509fa i965: Add some validation on BRW_OPCODE_MUL and ADD's arguments.
Now that we're playing with other types in brw_fs.cpp, it's easy to
trip over issues like these.
2010-09-07 10:34:10 -07:00
Eric Anholt 0002069fd5 i965: Add assertion for another requirement about types.
This catches a failure in the FS backend.
2010-09-07 10:34:09 -07:00
Eric Anholt 3fb5377ba5 i965: Align the start of attribute interp coefficients in FS to use PLN. 2010-09-07 10:34:09 -07:00