Commit Graph

94 Commits

Author SHA1 Message Date
Eric Anholt
0045a67418 mesa: Add missing _mesa_sizeof_glsl_type() for UNSIGNED_INT.
Somehow we managed to get the unsigned int vectors, but not scalar.
Fixes _mesa_problem complaints in piglit's uint tests.

Reviewed-by: Chad Versace <chad@chad-versace.us>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-09-28 12:09:09 -07:00
Kenneth Graunke
db726b048e mesa: In validate_program(), initialize errMsg for safety.
validate_program relies on validate_shader_program to fill in errMsg;
empirically, there exist cases where that doesn't happen.

While tracking those down may be worthwhile, initializing the string so
we don't try to ralloc_strdup random garbage also seems wise.

Fixes issues caught by valgrind while running some test case.

NOTE: This is a candidate for stable release branches.

Reviewed-by: Chad Versace <chad@chad-versace.us>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2011-08-05 14:19:39 -07:00
Henri Verbeet
4744195628 mesa: Use the Elements macro for the sampler index assert in validate_samplers().
This is probably nicer if the array size ever changes.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-07-07 20:30:13 +02:00
Henri Verbeet
86adc2b29e mesa: Allow sampling from units >= MAX_TEXTURE_UNITS in shaders.
The total number of units used by a shader is limited to MAX_TEXTURE_UNITS,
but the actual indices are only limited by MAX_COMBINED_TEXTURE_IMAGE_UNITS,
since they're shared between vertex and fragment shaders.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-07-07 20:30:13 +02:00
Brian Paul
230c71d9ee mesa: add some minor fixes for geometry shaders 2011-06-02 21:49:49 -06:00
Marek Olšák
d69dc2e203 mesa: UseShaderProgramEXT and Uniform* shouldn't be allowed inside Begin/End
I couldn't find this being required by the spec.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-06-01 16:03:26 +02:00
Marek Olšák
29ceeeba20 mesa: forbid UseProgram to be called inside Begin/End
The spec doesn't state it should be an error, but. We have this piglit test
useprogram-inside-begin that passes with this commit. No idea what's correct.

NOTE: This is a candidate for the 7.10 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-05-30 16:26:02 +02:00
Brian Paul
179a88d52c mesa: minor whitespace fixes 2011-05-25 21:07:50 -06:00
Marek Olšák
2d2b546189 mesa: remove set-but-unused variable in bind_attrib_location 2011-05-01 14:02:35 +02:00
Brian Paul
c1f4b2364f mesa: TEXTURE_BUFFER fix-up
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=36033
2011-04-06 12:33:30 -06:00
Brian Paul
e0e94026a0 mesa: move location of some geometry program limits
The gl_program_constants struct is for limits that are applicable to
any/all shader stages.  Move the geometry shader-only fields into the
gl_constants struct.
Remove redundant MaxGeometryUniformComponents field too.
2011-03-11 09:25:22 -07:00
Brian Paul
4293a12c7f mesa: call FLUSH_VERTICES() before deleting shaders, buffers, query objects
Need to flush rendering (or at least indicate that the rug might be getting
pulled out from underneath us) when a shader, buffer object or query object
is about to be deleted.

Also, this helps to tell the VBO module to unmap its current vertex buffer.
2011-03-11 09:25:21 -07:00
Brian Paul
2634e92dc0 mesa: add/update VERBOSE_API logging 2011-02-08 19:20:43 -07:00
Kenneth Graunke
d3073f58c1 Convert everything from the talloc API to the ralloc API. 2011-01-31 10:17:09 -08:00
Ian Romanick
dde3270c19 mesa: Connect glGetShaderPrecisionFormat into the dispatch table 2011-01-20 13:35:59 -08:00
Brian Paul
3ee60a3558 mesa: implement glGetShaderPrecisionFormat()
Drivers should override the default range/precision info as needed.
No drivers do this yet.
2011-01-19 07:41:55 -07:00
Eric Anholt
7b987578a9 mesa: Add actual support for glReleaseShaderCompiler from ES2.
Fixes no-op dispatch warning in piglit
arb_es2_compatibility-releaseshadercompiler.c.
2011-01-14 15:30:04 -08:00
Vinson Lee
db61b9ce39 mesa: Directly include mfeatures.h in files that perform feature tests. 2011-01-07 00:13:00 -08:00
Vinson Lee
0117da40cd mesa: Include mtypes.h in files that use gl_context struct.
Directly include mtypes.h if a file uses a gl_context struct. This
allows future removal of headers that are not strictly necessary but
indirectly include mtypes.h for a file.
2011-01-05 23:11:54 -08:00
Brian Paul
2900e56f9d mesa: use gl_shader_type enum 2010-11-23 17:00:08 -07:00
Eric Anholt
d348b0c72d mesa: Fix delayed state flagging for EXT_sso-related program changes.
Flushing the vertices after having already updated the state doesn't
do any good.  Fixes useshaderprogram-flushverts-1.  As a side effect,
by moving it to the right place we end up skipping no-op state changes
for traditional glUseProgram.
2010-11-06 11:44:32 -07:00
Eric Anholt
a974949f3b mesa: Make metaops use program refcounts instead of names.
Fixes failure on restoring state when the program was active but
deleted, and the name no longer exists.

Bug #31194
2010-10-29 11:28:38 -07:00
Brian Paul
53eca8d216 mesa: plug in stubs for glBindFragDataLocation(), glGetFragDataLocation() 2010-10-28 21:17:41 -06:00
Ian Romanick
84eba3ef71 Track separate programs for each stage
The assumption is that all stages are the same program or that
varyings are passed between stages using built-in varyings.
2010-10-27 13:35:53 -07:00
Ian Romanick
75c6f47288 mesa: Track an ActiveProgram distinct from CurrentProgram
ActiveProgram is the GL_EXT_separate_shader_objects state variable
used for glUniform calls.  glUseProgram also sets this.
2010-10-27 13:35:53 -07:00
Ian Romanick
c72aa7fa58 mesa: Skeletal support for GL_EXT_separate_shader_objects
Really just filling in the entry points.  None of them do anything
other than validate their inputs.
2010-10-27 13:35:53 -07:00
Ian Romanick
7d8ba5f78f mesa: Clean up various 'unused parameter' warnings in shaderapi 2010-10-13 15:35:23 -07:00
Ian Romanick
ccc1c4c6d9 mesa: Clean up two 'comparison between signed and unsigned' warnings 2010-10-13 15:35:23 -07:00
Ian Romanick
5cb24c4a75 mesa: Refactor validation of shader targets
Actually validate that the implementation supports the particular
shader target as well.  Previously if a driver only supported vertex
shaders, for example, glCreateShaderObjectARB would gladly create a
fragment shader.

NOTE: this is a candidate for the 7.9 branch.
2010-10-13 15:35:18 -07:00
Kristian Høgsberg
f9995b3075 Drop GLcontext typedef and use struct gl_context instead 2010-10-13 09:43:25 -04:00
Ian Romanick
2b70dbfe09 glsl2: Add EmitNoNoise flag, use it to remove noise opcodes 2010-09-09 15:39:52 -07:00
Luca Barbieri
e591c4625c glsl: add several EmitNo* options, and MaxUnrollIterations
This increases the chance that GLSL programs will actually work.

Note that continues and returns are not yet lowered, so linking
will just fail if not supported.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-09-08 20:36:37 -07:00
Luca Barbieri
6d3a2c97f4 glsl: make compiler options per-target
This allows us to specify different options, especially useful for chips
without unified shaders.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-09-08 20:36:37 -07:00
Eric Anholt
b2872ea353 Revert "mesa: Don't add 1 to GL_ACTIVE_UNIFORM_MAX_LENGTH."
This reverts commit 001a7bfdfc.  I
hadn't found the section of the spec clarifying that the old behavior
was right.  Reverting fixes the new version of the testcase, and the
Humus demos that could no longer find their uniforms.

Bug #29782
Bug #29783
2010-08-25 16:45:31 -07:00
Eric Anholt
001a7bfdfc mesa: Don't add 1 to GL_ACTIVE_UNIFORM_MAX_LENGTH.
Fixes: glsl-getactiveuniform-length.
2010-08-23 10:34:31 -07:00
Vinson Lee
a575067d70 mesa: Remove unnecessary heaaders from shaderapi.c. 2010-08-18 18:49:32 -07:00
Eric Anholt
afe125e0a1 Merge remote branch 'origin/master' into glsl2
This pulls in multiple i965 driver fixes which will help ensure better
testing coverage during development, and also gets past the conflicts
of the src/mesa/shader -> src/mesa/program move.

Conflicts:
	src/mesa/Makefile
	src/mesa/main/shaderapi.c
	src/mesa/main/shaderobj.h
2010-07-26 17:53:27 -07:00
Chia-I Wu
40ef298641 mesa: Fix OpenGL ES-only builds.
Check FEATURE_GL in _mesa_init_shader_dispatch and
_mesa_init_shader_uniform_dispatch.  OpenGL ES can not and does not use
_mesa_init_<...>_dispatch.  This is supposed to be temporary.  Ideally,
a more flexible way for initializing dispatch tables should be
developed.
2010-07-03 16:48:36 +08:00
Brian Paul
ae8164a67b mesa: add geometry shader fields to gl_shader_program
These 3 fields are per shader-program.  Copy them into the geometry
program at link time for convenient access later.

Also, add some missing glGetProgramiv() queries.
2010-07-02 15:36:14 -06:00
Brian Paul
291bcfd831 mesa: add missing error checks in _mesa_program_parameteri() 2010-07-02 09:09:06 -06:00
Zack Rusin
da7bd6a90e mesa: initial support for ARB_geometry_shader4
laying down the foundation for everything and implementing most of the
stuff.
linking, gl_VerticesIn and multidimensional inputs are left.
2010-06-28 22:53:21 -04:00
Brian Paul
ec2b92f98c mesa: rename src/mesa/shader/ to src/mesa/program/ 2010-06-10 23:23:13 -06:00
Brian Paul
f1c5043f94 mesa: move shader/slang/* sources to main/slang/*
Reduce the source tree depth a bit.
2010-06-10 22:48:16 -06:00
Brian Paul
a37b2219d6 mesa: refactor shader api / object code
Remove the unneeded ctx->Driver hooks for shader-related functions.
Move state and API-related things into main/.
2010-06-10 20:32:57 -06:00