Commit Graph

47590 Commits

Author SHA1 Message Date
Ian Romanick
c42ca36d67 mesa: Add missing check for glUniform*v count > 1 on non-array
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:16 -08:00
Ian Romanick
719909698c mesa: Rewrite the way uniforms are tracked and handled
Switch all of the code in ir_to_mesa, st_glsl_to_tgsi, glUniform*,
glGetUniform, glGetUniformLocation, and glGetActiveUniforms to use the
gl_uniform_storage structures in the gl_shader_program.

A couple of notes:

 * Like most rewrite-the-world patches, this should be reviewed by
   applying the patch and examining the modified functions.

 * This leaves a lot of dead code around in linker.cpp and
   uniform_query.cpp.  This will be deleted in the next patches.

v2: Update the comment block (previously a FINISHME) in _mesa_uniform
about generating GL_INVALID_VALUE when an out-of-range sampler index
is specified.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:16 -08:00
Ian Romanick
143d20c16a i965: Move _mesa_ir_link_shader call before device-specific linking
_mesa_ir_link_shader needs to be called before cloning the IR tree so
that the var->location field for uniforms is set.

WARNING: This change breaks several integer division related piglit
tests.  The tests break because _mesa_ir_link_shader lowers integer
division to an RCP followed by a MUL.  The fix is to factor out more
of the code from ir_to_mesa so that _mesa_ir_link_shader does not need
to be called at all by the i965 driver.  This will be the subject of
several follow-on patches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:16 -08:00
Ian Romanick
cfab4327c3 mesa: Add log_uniform and log_program_parameters to dump data
These were both useful debugging aids while developing this code.
log_uniform will be used to keep the MESA_GLSL=uniform behavior.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:16 -08:00
Ian Romanick
d7a7e4fc99 ir_to_mesa: Add _mesa_associate_uniform_storage
Connects all of the gl_program_parameter structures with the correct
gl_uniform_storage structures.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:16 -08:00
Ian Romanick
70650d08fa mesa: Add _mesa_uniform_{attach,detach_all}_driver_storage functions
These functions are used to create and destroy the connections between
a uniform and the storage used by the driver to hold its value.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:16 -08:00
Ian Romanick
9516182e80 mesa: Add _mesa_propagate_uniforms_to_driver_storage
This function propagates the values from the backing storage of a
gl_uniform_storage structure to the driver supplied data locations.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:16 -08:00
Ian Romanick
07731ed169 linker: Track uniform locations to new tracking structures
This is just the infrastructure and the code.  It's not used yet.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:16 -08:00
Ian Romanick
9a21d4670c mesa: Add structures for "new style" uniform tracking in shader programs
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:16 -08:00
Ian Romanick
466d5ffee4 linker: Add helper class for parcelling out backing storage to uniforms
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:16 -08:00
Ian Romanick
57f79de6d0 linker: Add helper class for determining uniform usage
v2: Remane class count_uniform_size based on feedback from Eric:

    "Maybe just "count_uniform_size"?  "usage" makes me think "way it's
    dereferenced" or something."

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:16 -08:00
Ian Romanick
2f45ed393a mesa: Move most of uniforms.c to uniform_query.cpp
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:16 -08:00
Ian Romanick
65add4327d mesa: Refactor parameter validate for GetUniform, Uniform, and UniformMatrix
v2: Update a comment block about the different treatment of
location=-1 based on feedback from Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:16 -08:00
Ian Romanick
637a7eb9e9 mesa: Move {split,merge}_location_offset to uniforms.h
Prepend _mesa_uniform_ to the names and rework the calling
convention.  The calling convention was changed for a couple reasons.

1. Having a single variable named 'location' have completely different
meanings at different places in the function is confusing.  Before
calling split_location_offset the location is the encoded value
returned by glGetUniformLocation.  After calling split_location_offset
it's the index of the uniform in the gl_uniform_list::Uniforms array.

2. In a later commit the original value of 'location' is needed after
split_location_offset has been called.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:16 -08:00
Ian Romanick
4ad460991c glsl: Add new structures for tracking uniforms in linked shaders
v2: Update some comments based on feedback from Eric Anholt.

v3: Remove gl_uniform_storage::dirty field.  Make
gl_uniform_storage::initialized be bool, and make
gl_uniform_storage::sampler be uint8_t.

v4: Include stdbool.h after Tom Stellard noticed a build failure that
was introduced by the changes in v2.  Oops.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:16 -08:00
Ian Romanick
4ad41af616 mesa: Make get_uniform available outside compilation unit
Also rename to _mesa_get_uniform.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:15 -08:00
Ian Romanick
fa7eccb8c0 mesa: Move the link check from _mesa_get_uniform_location to _mesa_GetUniformLocationARB
There are cases where we might want to internally query the location
of a uniform in a shader that failed linking.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:15 -08:00
Ian Romanick
f6ee7bce65 linker: Make invalidate_variable_locations available outside the compilation unit
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:15 -08:00
Ian Romanick
68db407b20 glsl: Allow glsl_types.h to be included in C sources
Some C code will want access to the glsl_base_type and
glsl_sampler_dim enums in the near future.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:15 -08:00
Ian Romanick
017346f403 mesa: Add string_to_uint_map::clear method to clear the map
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2011-11-07 13:33:15 -08:00
Ian Romanick
295e07ef51 mesa: Fix error generation for glClearBuffer{i ui}v with GL_DEPTH or GL_STENCIL
The spec says "Only ClearBufferiv should be used to clear
stencil buffers." and "Only ClearBufferfv should be used to clear
depth buffers."  However, on the following page it also says:

    "The result of ClearBuffer is undefined if no conversion between
    the type of the specified value and the type of the buffer being
    cleared is defined (for example, if ClearBufferiv is called for a
    fixed- or floating-point buffer, or if ClearBufferfv is called
    for a signed or unsigned integer buffer). *This is not an error.*"

Emphasis mine.

Fixes problems with piglit's clearbuffer-invalid-drawbuffer test.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-07 13:32:22 -08:00
Brian Paul
f4fb0be605 mesa: fix the selection of soft renderbuffer color formats
This fixes a regression from the recent glReadPixels changes found
with the piglit hiz tests.

Use either MESA_FORMAT_RGBA8888 or MESA_FORMAT_RGBA8888_REV for color
buffers depending on endian-ness.  Before, the gl_renderbuffer::Format
field was MESA_FORMAT_RGBA8888 but the data was really stored as
MESA_FORMAT_RGBA8888_REV when using a little endian machine.

Getting this right matters now that we can access renderbuffer data
without going through the span functions (namely glReadPixels() +
MapRenderbuffer()).
2011-11-07 14:25:48 -07:00
Brian Paul
0ef8c0ddc7 mesa: remove unneeded soft renderbuffer format-setting code
These vars will just get overwritten when we call _mesa_add_renderbuffer()
anyway.  We only need to set the InternalFormat field when we create the
software renderbuffer.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-07 14:25:48 -07:00
Brian Paul
87ac3ae50e mesa: fix comment typo in intel_renderbuffer 2011-11-07 14:25:48 -07:00
Brian Paul
46f5ef557f intel: update intel_texture_image comment 2011-11-07 14:25:48 -07:00
Brian Paul
24524784cf intel: wrap comment and fix typo 2011-11-07 14:25:48 -07:00
Brian Paul
377eb5c30c st/mesa: first implementation of Map/UnmapRenderbuffer()
Untested, but also unused at this point.
2011-11-07 14:25:48 -07:00
Brian Paul
32c3957991 xlib: implement renderbuffer mapping/unmapping
This fixes the glReadPixels() regression for reading from the front/back
color buffers.

Note, we only allow one mapping of an XImage/Pixmap renderbuffer
at any time.  That might need to be revisited in the future.
2011-11-07 14:25:47 -07:00
Brian Paul
68c3d21b68 mesa: check for immutable texture in _mesa_test_texobj_completeness()
One of the points of GL_ARB_texture_storage is to make it impossible
to have malformed mipmap stacks.  If we know the texture object is
immutable, we can skip a bunch of size checking.
2011-11-07 14:25:47 -07:00
Brian Paul
b64dc2a275 swrast: update program type assertion
Fixes bogus failed assertion when using NV_fragment_program, such
as with demos/fplight.c

Note: This is a candidate for the 7.11 branch.
2011-11-07 14:25:47 -07:00
Brian Paul
af734468fe st/mesa: clean-up st_translate_interp() 2011-11-07 14:25:47 -07:00
Brian Paul
0d05422c20 st/mesa: add some null pointer checking to better handle out of memory
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-11-07 13:25:46 -07:00
Morgan Armand
245edfb005 st/mesa: fix memory leaks
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-11-07 13:25:46 -07:00
Morgan Armand
33ca21fc3c st/mesa: fix indentation
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-11-07 13:25:46 -07:00
Morgan Armand
89d6044b7b softpipe: fix memory leaks
This series of patches is a splitted version of my previous one, as suggested by Brian.

Signed-off-by: Brian Paul <brianp@vmware.com>
2011-11-07 13:25:46 -07:00
Kenneth Graunke
dceb202297 i965: Fix Sandybridge regression introduced by workaround-free math.
Commit a73c65c534 had a typo which
accidentally enabled the workaround-free Gen7 code on Gen6.

Fixes GPU hangs in anything using pow() or integer division/modulus.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-07 12:09:02 -08:00
Kenneth Graunke
a73c65c534 i965: Enable faster workaround-free math on Ivybridge.
According to the documentation, Ivybridge's math instruction works in
SIMD16 mode for the fragment shader, and no longer forbids align16 mode
for the vertex shader.

The documentation claims that SIMD16 mode isn't supported for INT DIV,
but empirical evidence shows that it works fine.  Presumably the note
is trying to warn us that the variant that returns both quotient and
remainder in (dst, dst + 1) doesn't work in SIMD16 mode since dst + 1
would be sechalf(dst), trashing half your results.  Since we don't use
that variant, we don't care and can just enable SIMD16 everywhere.

The documentation also still claims that source modifiers and
conditional modifiers aren't supported, but empirical evidence and
study of the simulator both show that they work just fine.

Goodbye workarounds.  Math just works now.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2011-11-07 11:03:22 -08:00
Marek Olšák
97534d92e2 mesa: add missing checks to compute_version
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-07 13:19:58 +01:00
Fabio Pedretti
1401b96bb9 radeon: cleanup radeon shared code after r300 and r600 classic drivers removal
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-11-07 09:21:38 +00:00
Kenneth Graunke
4abba27ae0 i965: Fix struct vs class warnings in brw_fs_vector_splitting.cpp.
Makes clang happier.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-06 23:02:27 -08:00
Dave Airlie
0d8deb5bc9 llvmpipe: fix typo in the depth sampling aos code.
Just found by reading llvmpipe code for no great reason.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-11-06 22:32:04 +00:00
Dave Airlie
73c6657596 llvmpipe: enable RGTC after u_format fix.
The two piglit tests pass + render correctly.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-11-06 22:32:04 +00:00
Dave Airlie
f0d1b5f41a u_format: fix RGTC support in fits 8unorm.
Signed RGTC won't fit in a unorm, so don't allow them.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-11-06 22:32:04 +00:00
Chia-I Wu
8b64b86a65 scons: add CPP_SOURCES for nv50/nvc0 2011-11-06 14:38:23 -07:00
Chia-I Wu
ad156efe39 android: add CPP_SOURCES for nv50/nvc0 2011-11-06 14:38:23 -07:00
Chia-I Wu
917b8e3814 android: reorder nouveau pipe drivers
To match targerts/dri-nouveau, and to fix a potential

  "undefined reference to `nv50_ir::getTargetNVC0(unsigned int)'"

error.
2011-11-06 14:38:23 -07:00
Dave Airlie
2318443ebd gl3.txt: update for ARB_texture_storage.
As per Brian's suggestion.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-11-06 19:39:36 +00:00
Dave Airlie
391e33ffbf r600g: add initial linestipple support.
It seems line loop stipple in hardware needs something I don't know, it might
need a proper geometry shader who knows.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-11-06 12:54:27 +00:00
Christian Inci
3031708e64 gallivm: change sys::getHostTriple to sys::getDefaultTargetTriple for LLVM >= 0x0301
LLVM change r143502

Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
2011-11-06 07:41:10 +00:00
Vinson Lee
adb7f1351e g3dvl: Fix memory leaks on error paths.
Fixes Coverity resource leak defect.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-11-05 22:09:03 -07:00