Paul Berry [Wed, 23 Oct 2013 17:59:57 +0000 (10:59 -0700)]
glsl: Move UsesClipDistance from gl_{vertex,geometry}_program into gl_program.
This will make it easier for back-ends to share code between geometry
shader and vertex shader compilation. Also, it is renamed to
"UsesClipDistanceOut" to clarify that (a) in geometry shaders, it
refers to the gl_ClipDistance output rather than the gl_ClipDistance
input, and (b) it is irrelevant in fragment shaders.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Paul Berry [Wed, 23 Oct 2013 19:55:24 +0000 (12:55 -0700)]
glsl/gs: Fix transform feedback of gl_ClipDistance.
Since gl_ClipDistance is lowered from an array of floats to an array
of vec4's during compilation, transform feedback has special logic to
keep track of the pre-lowered array size so that attempting to perform
transform feedback on gl_ClipDistance produces a result with the
correct size.
Previously, this special logic always consulted the vertex shader's
size for gl_ClipDistance. This patch fixes it so that it uses the
geometry shader's size for gl_ClipDistance when a geometry shader is
in use.
Fixes piglit test spec/glsl-1.50/transform-feedback-type-and-size.
v2: Change the type of LastClipDistanceArraySize to "unsigned", and
clarify the comment above it.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Paul Berry [Wed, 23 Oct 2013 20:36:25 +0000 (13:36 -0700)]
i965: Fix gl_MaxCombinedTextureImageUnits.
We've always overriden
ctx->Const.{Vertex,Fragment}Program.MaxTextureImageUnits to reflect
the number of texture image units supported by the hardware (rather
than using the default values assigned by Mesa core) so it seems
sensible to do that for GeometryProgram.MaxTextureImageUnits too. We
set it to 0 if geometry shaders aren't supported.
Once that is done, we can just unconditionally add
GeometryProgram.MaxTextureImageUnits to MaxCombinedTextureImageUnits.
Fixes piglit test "spec/glsl-1.50/built-in
constants/gl_MaxCombinedTextureImageUnits".
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Rob Clark [Thu, 24 Oct 2013 21:53:31 +0000 (17:53 -0400)]
freedreno/a3xx/compiler: relative addressing
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Rob Clark [Thu, 24 Oct 2013 21:45:27 +0000 (17:45 -0400)]
freedreno/a3xx: fix const/rel/const-rel encoding
The encoding of constant, relative, and relative-const src registers is
a bit more complex than originally thought, which gives an extra bit to
encode const reg # at expense of taking a bit from relative offset.
In most cases a3xx seems to actually use a scheme whereby it can encode
an extra bit for const register. You have three possible encodings in
thirteen bits:
register: (11 bits for N.c)
00........... rN.c
relative: (10 bits for N)
010.......... r<a0.x + N>
011.......... c<a0.x + N>
const: (12 bits for N.c)
1............ cN.c
Which means we can deal w/ more consts than previously thought.
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Rob Clark [Thu, 19 Sep 2013 14:17:09 +0000 (10:17 -0400)]
freedreno/a3xx: add blend state
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Rob Clark [Fri, 27 Sep 2013 19:35:19 +0000 (15:35 -0400)]
freedreno/resource: fail more gracefully
Fail more gracefully when buffer allocation/import fails.
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Roland Scheidegger [Wed, 23 Oct 2013 17:13:21 +0000 (19:13 +0200)]
gallivm: implement fully accurate corner filtering for seamless cube maps
d3d10 requires that cube corners are filtered with accurate weights (that
is, the weight of the non-existing corner texel should be evenly distributed
to the other 3 texels). OpenGL does not require this (but recommends it).
This requires us to use different filtering code, since we need per-texel
weights which our 2d lerp doesn't (and can't) do. And of course the (now
per element) weights need to be adjusted too for it to work.
Invoke the new filtering code whenever there's an edge to keep things simpler,
as it will work for edges too not just corners but of course it's only needed
with corners.
More ugly code for not much gain but at least a hacked up cubemap demo
shows very nice corners now... Not sure yet if and how this should be
configurable...
v2: incorporate feedback from Jose, only use special corner filtering code
when there's a corner not when there's only an edge (as corner filtering code
is slower, though a perf difference was only measureable when always
forcing edge code). Plus some minor style fixes.
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Eric Anholt [Sat, 28 Sep 2013 00:03:58 +0000 (17:03 -0700)]
mesa: Remove dricore from the build.
No driver uses it any more, and it's been replaced by megadrivers.
v2: Remove always-on conditional for NEED_LIBPROGRAM (review by Emil)
Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Eric Anholt [Fri, 27 Sep 2013 23:57:11 +0000 (16:57 -0700)]
swrast: Build the driver into the shared mesa_dri_drivers.so.
v2: drop dridir now that it's unused.
v3: Fix linking after rebase when building just swrast from classic but a
drm-using gallium driver.
v4: Consistently put spaces around += in the updated Makefile.am block.
v5: Set a global driverAPI variable so loaders don't have to update to
createNewScreen2() (though they may want to for thread safety).
Reviewed-by: Matt Turner <mattst88@gmail.com> (v3)
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Eric Anholt [Fri, 27 Sep 2013 23:32:40 +0000 (16:32 -0700)]
radeon: Build the driver into the shared mesa_dri_drivers.so.
This required some reordering of headers to ensure that the symbol name
redefines happened before any prototypes.
v2: drop dridir now that it's unused.
v3: Consistently put spaces around += in the updated Makefile.am blocks.
v4: Set a global driverAPI variable so loaders don't have to update to
createNewScreen2() (though they may want to for thread safety).
Reviewed-by: Matt Turner <mattst88@gmail.com> (v2)
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Eric Anholt [Fri, 27 Sep 2013 21:22:59 +0000 (14:22 -0700)]
i915: Build the driver into the shared mesa_dri_drivers.so.
i915 has symbols for formerly-shared code that conflict with i965, so we
define them away using gen-symbol-redefs.py. Options considered:
- This option. Downsides: The symbols in profiling and debugging don't
match the source. The symbol list may change in the future and we won't
notice without manually running the tool again.
- Use objcopy --localize-hidden to automatically demote our symbols to
locals. This didn't work on i965 due to c++ weak symbols (which can't
be localized), but could work on i915. We could do it on i915 only, but
it does produce libtool warnings at link time due to libtool not knowing
if the resulting .o file is safe to link (stupid libtool). Plus you end
up with different symbols of the same name, which is confusing for
debugging too. On the other hand, no future symbol conflicts long term.
- Write our own libelf tool that handles c++ weak symbols like we want and
apply it to all drivers. All the downsides of above, but applies
uniformly across drivers.
- Edit the files to just rename all the i915 or i965 symbols that
conflict. There are on the order of 100 that have a prefix we used to
share, so it would take a bit of typing. Fewest downsides, but still
can have conflicts long term.
Ultimately, this is the least invasive change at the moment, and we can
see if the "more symbol conflicts appear later" thing is a real concern or
not.
Note that the ability to compile a version of i915 without INTEL_DEBUG env
support is dropped. It's too useful.
v2: drop dridir now that it's unused.
v3: Consistently put spaces around += in the updated Makefile.am block.
v4: Set a global driverAPI variable so loaders don't have to update to
createNewScreen2() (though they may want to for thread safety).
Reviewed-by: Matt Turner <mattst88@gmail.com> (v2)
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Eric Anholt [Fri, 27 Sep 2013 22:14:56 +0000 (15:14 -0700)]
dri: Add a tool for generating #defines to namespace driver global symbols.
Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Eric Anholt [Tue, 24 Sep 2013 17:24:07 +0000 (10:24 -0700)]
nouveau: Build the driver into the shared mesa_dri_drivers.so.
v2: drop dridir now that it's unused.
v3: Consistently put spaces around += in the updated Makefile.am block.
v4: Set a global driverAPI variable so loaders don't have to update to
createNewScreen2() (though they may want to for thread safety).
v5: Fix missed public symbol in nouveau. (caught by Emil)
Reviewed-by: Matt Turner <mattst88@gmail.com> (v2)
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Eric Anholt [Wed, 26 Jun 2013 20:04:51 +0000 (13:04 -0700)]
i965: Build the driver into a shared mesa_dri_drivers.so .
Previously, we've split things such that mesa core is in libdricore,
exposing the whole Mesa core interface in the global namespace, and the
i965_dri.so code all links against that. Along with polluting application
namespace terribly, it requires extra PLT indirections and prevents LTO.
Instead, we can build all of the driver contents into the same .so with
just a few symbols exposed to be referenced from the actual driver .so
file, allowing LTO and reducing our exposed symbol count massively.
FPS improvement on GLB2.7 with INTEL_NO_HW=1: 2.61061% +/- 1.16957% (n=50)
(without LTO, just the PLT reductions from this commit)
Note that the X Server requires commit
7ecfab47eb221dbb996ea6c033348b8eceaeb893 to successfully load this driver!
v2: Set a global driverAPI variable so loaders don't have to update to
createNewScreen2() (though they may want to for thread safety).
v3: Drop AM_CPPFLAGS addition (Emil pointed out I'd missed some cflags
that would be necessary, though only if we actually relied on them).
v4: Fix install with DESTDIR set.
Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> (v2)
Eric Anholt [Thu, 26 Sep 2013 17:51:29 +0000 (10:51 -0700)]
dri: Implement a DRI vtable extension to replace the global driDriverAPI.
As we move to megadrivers, we are unable to build multiple drivers with
the same public global symbol per driver (Think an X Server with an intel
and a nouveau driver, and the X Server implementing indirect for both --
we have to actually talk to the right driver). By slipping the
driDriverAPI vtable into the driver's extension list, we can replace the
usage of the global symbol with usage of the loader-dlsym()ed driver
information.
v2: Pull in the hunk to avoid crashing on null driver_extensions. Thanks,
Emil!
Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Eric Anholt [Fri, 27 Sep 2013 18:39:25 +0000 (11:39 -0700)]
dri: Pass in the dlsym()ed driver extension to screen creation.
This will allow a megadrivers build to reference the actual driver being
loaded from the shared dri_util screen creation code.
v2: Fix indentation, fallback case in EGL (review by Emil).
Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
Reviewed-by: Chad Versace <chad.versace@linux.intel.com> (v1)
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Eric Anholt [Sat, 12 Oct 2013 00:38:18 +0000 (17:38 -0700)]
gbm: Add support for the new __driDriverGetExtensions interface.
v2: Fix uninitialized variable use in the old-ABI case.
Reviewed-by: Chad Versace <chad.versace@linux.intel.com> (v1)
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Eric Anholt [Tue, 24 Sep 2013 18:05:22 +0000 (11:05 -0700)]
egl: Add an optional function call for getting the DRI driver interface.
v2: Fix asprintf error checking.
Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Eric Anholt [Mon, 23 Sep 2013 21:44:10 +0000 (14:44 -0700)]
glx: Add an optional function call for getting the DRI driver interface.
The previous interface relied on a static struct, which meant that the
driver didn't get a chance to edit the struct before the struct got used.
For megadrivers, I want struct specific to the driver being loaded.
v2: Fix the prototype in the docs (caught by Marek). Since the driver
name was in the function, we didn't need to also pass it in.
v3: Fix asprintf error checking (caught by Matt's gcc).
Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Eric Anholt [Fri, 27 Sep 2013 22:25:40 +0000 (15:25 -0700)]
dri: Move driver config options to dri driver extensions.
This way they aren't all sitting in the global namespace (with the same
name per driver).
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Eric Anholt [Wed, 26 Jun 2013 22:15:57 +0000 (15:15 -0700)]
dri: Allow config options to be passed to the loader through extensions.
Turns out already we have this nice mechanism for providing optional
things from the driver to the loader, and I was going to have to rename
the public global symbol to avoid conflicts when doing megadrivers.
While the former __driConfigOptions is technically loader interface, this
is the only loader that made use of that symbol. Continue paying
attention to it if we can't find the new option, to retain compatibility
with old drivers.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Eric Anholt [Fri, 27 Sep 2013 22:36:59 +0000 (15:36 -0700)]
glx: Move the driver extension-loading to a helper function.
I'm planning on doing driver extension parsing from 3 places, and making
the extension loading step a bit longer.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Francisco Jerez [Thu, 24 Oct 2013 19:09:55 +0000 (12:09 -0700)]
clover: Query maximum kernel block size from the device instead of the kernel object.
Based on a similar fix from Aaron Watry. It seems unlikely that we
will ever need a kernel-specific setting for this, and the Gallium API
doesn't support it. Remove kernel::max_block_size() altogether.
Brian Paul [Tue, 22 Oct 2013 22:50:57 +0000 (16:50 -0600)]
glsl: silence unused 'var' variable warning
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Brian Paul [Tue, 22 Oct 2013 22:47:38 +0000 (16:47 -0600)]
svga: remove user-space vertex/index buffer code
The gallium vbuf module, which we've been using for some time now, takes
care of uploading user-space vertex/index data into real buffers. The
upload code in the svga driver was unused.
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Chad Versace [Tue, 15 Oct 2013 22:16:19 +0000 (15:16 -0700)]
i965: Print more debuginfo in intel_texsubimage_memcpy()
Print info about packing, format, type, and tiling. This will help debug
future issues with this fastpath.
Reviewed-by: Frank Henigman <fjhenigman@google.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Chad Versace [Fri, 18 Oct 2013 21:06:49 +0000 (14:06 -0700)]
i965: Fix glTexImage when packing alignment != cpp
Fixes texture corruption of Weston clients on cairo-glesv2 backend.
Commit 49ed599 introduced the bug.
Corruption occured when glTexSubImage called
intel_texsubimage_tiled_memcpy() with:
x,y=10,9
w,h=7,7
format=GL_ALPHA(0x1906)
type=GL_UNSIGNED_BYTE(0x1401)
gl_format=MESA_FORMAT_A8(0x18)
packing.alignemnt=4
The function miscalculated the source image's stride as w*cpp=7 without
taking into account the packing alignment. The actual stride was 8.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70435
Reported-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Tested-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by:Frank Henigman <fjhenigman@google.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Rob Clark [Thu, 24 Oct 2013 00:08:15 +0000 (20:08 -0400)]
freedreno: fix compile error
Small typo introduced in a3ed98f.
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Paul Berry [Tue, 22 Oct 2013 12:56:37 +0000 (05:56 -0700)]
i965/fs: Only unroll high-accuracy dFdy() from SIMD16 to SIMD8 on gen4 and IVB.
In commit 800610f (i965/fs: Improve accuracy of dFdy() to match
dFdx()) I unrolled the high-accuracy dFdy() computation from a single
SIMD16 instruction to two SIMD8 instructions because of text I found
in the i965 (gen4) PRM saying that instruction compression could not
be used in align16 mode. I couldn't find similar text in later
hardware docs, and I observed problems trying to use instruction
compression on align16 mode on Ivy Bridge, so I assumed that the
restriction still applied and the associated documentation had simply
been lost.
After consultation with the hardware engineers, it turns out this is
not the case. In point of fact, the restriction was dropped in gen5,
re-introduced in Ivy Bridge, and dropped again in Haswell. The reason
I didn't notice this is that in the Ivy Bridge documentation, the
restriction was in a different section, and described using different
language.
Now that we know that the restriction only applies to Gen4 and Ivy
Bridge, we can limit the unrolling to those platforms.
Tested on gen5, gen6, and gen7 (both Ivy Bridge and Haswell).
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Paul Berry [Tue, 22 Oct 2013 17:26:52 +0000 (10:26 -0700)]
glsl/gs: Prevent illegal input/output primitive types.
From the GLSL 1.50 spec, section 4.3.8.1 (Input Layout Qualifiers):
The layout qualifier identifiers for geometry shader inputs are
layout-qualifier-id
points
lines
lines_adjacency
triangles
triangles_adjacency
And from section 4.3.8.2 (Output Layout Qualifiers)
The layout qualifier identifiers for geometry shader outputs are
layout-qualifier-id
points
line_strip
triangle_strip
max_vertices = integer-constant
We were erroneously allowing line_strip and triangle_strip to be used
as input qualifiers, and we were allowing lines, lines_adjacency,
triangles, and triangles_adjacency to be used as output qualifiers.
Fixes piglit tests "glsl-1.50-gs-{input,output}-layout-qualifiers *".
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Eric Anholt [Mon, 7 Oct 2013 21:34:00 +0000 (14:34 -0700)]
i965: Add perf debug hint when the app makes us do index buffer scanning.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Eric Anholt [Fri, 4 Oct 2013 03:03:41 +0000 (20:03 -0700)]
i965: Try to avoid stalls on the GPU when doing glBufferSubData().
On DOTA2, framerate on dota2-de1.dem in windowed mode on my laptop
improves by 7.69854% +/- 0.909163% (n=3). In a microbenchmark hitting
this code path (wall time of piglit vbo-subdata-many), runtime decreases
from 0.8 to 0.05 seconds.
v2: Use out of range start/end instead of separate bool for the active
flag (suggestion by Jordan), fix double-upload in the stalling path.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Eric Anholt [Tue, 8 Oct 2013 00:31:04 +0000 (17:31 -0700)]
i965: Be sure to reset brw->vb.buffers[] when trying to redo vertex setup.
The brw_prepare_vertices that sets up buffers[] depends on these
parameters, so don't let brw_prepare_vertices() skip it.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Eric Anholt [Sat, 5 Oct 2013 00:46:04 +0000 (17:46 -0700)]
i965: Add support for GL_ARB_texture_buffer_range.
Supporting this extension turns out to simplify our code a bit over not
supporting this extension, once the glBufferSubData() synchronization code
lands.
v2: Use 16 byte alignment like we do for uniform buffers, due to unaligned
access penalties.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> (v1)
Eric Anholt [Fri, 4 Oct 2013 02:36:03 +0000 (19:36 -0700)]
i965: Add a note about the late-allocation in intel_bufferobj_buffer().
This was mostly for the i915 system-memory VBO code, which we don't have
any more, but since that existed we've ended up producing dependencies on
it being there.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Eric Anholt [Fri, 4 Oct 2013 02:34:41 +0000 (19:34 -0700)]
i965: Drop intel_bufferobj_source().
Since src_offset was always 0, it wasn't doing anything for us beyond
intel_bufferobj_buffer().
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Eric Anholt [Fri, 4 Oct 2013 23:13:00 +0000 (16:13 -0700)]
i965: Fix texture buffer rendering after a whole buffer replacement.
If glBufferData(), glBufferSubData(0, obj->Size), or similar happens, we
get a new drm_intel_bo for the buffer object, and thus need to re-upload
texture buffer state so we point at the new data.
Fixes the new piglit GL_ARB_texture_buffer_object/data-sync
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
David Heidelberger [Wed, 23 Oct 2013 19:25:12 +0000 (21:25 +0200)]
Brian Paul [Wed, 23 Oct 2013 19:16:34 +0000 (13:16 -0600)]
nv50: clamp PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS to PIPE_MAX_SAMPLERS
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70212
Tested-by: Aaron Watry <awatry@gmail.com>
Brian Paul [Wed, 23 Oct 2013 18:30:36 +0000 (12:30 -0600)]
radeonsi: remove unused si_set_cs_sampler_view()
Fixes build breakage.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70804
Tested-by: Vinson Lee <vlee@freedesktop.org>
Brian Paul [Tue, 8 Oct 2013 00:16:22 +0000 (18:16 -0600)]
gallium: new, unified pipe_context::set_sampler_views() function
The new function replaces four old functions: set_fragment/vertex/
geometry/compute_sampler_views().
Note: at this time, it's expected that the 'start' parameter will
always be zero.
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Brian Paul [Sat, 19 Oct 2013 17:22:33 +0000 (11:22 -0600)]
svga: remove unneeded include of u_double_list.h
Kenneth Graunke [Tue, 28 May 2013 02:51:35 +0000 (19:51 -0700)]
i965: Expose write_reg() as brw_store_register_mem64().
Writing a 64-bit register value to memory is sufficiently complicated
that it makes sense to reuse this function rather than duplicating it.
Exposing it outside of gen6_queryobj.c means it needs a more descriptive
function name. It could probably be moved to brw_util.c or somewhere
else, but this works too.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Kenneth Graunke [Tue, 28 May 2013 02:44:44 +0000 (19:44 -0700)]
i965: Move flushing out of write_reg and into the callers.
The current callers just want to write a single register, so combining
the register read with a pipeline flush made sense. However, in the
future we'll want to do multiple register reads back to back, and we'll
only want to flush once.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Ian Romanick [Fri, 4 Oct 2013 17:46:29 +0000 (10:46 -0700)]
glsl: Simplify the interface to link_invalidate_variable_locations
The unit tests added in the previous commits prove some things about the
state of some internal data structures. The most important of these is
that all built-in input and output variables have explicit_location
set. This means that link_invalidate_variable_locations doesn't need to
know the range of non-generic shader inputs or outputs. It can simply
reset location state depending on whether explicit_location is set.
There are two additional assumptions that were already implicit in the
code that comments now document.
- ir_variable::is_unmatched_generic_inout is only used by the linker
when connecting outputs from one shader stage to inputs of another
shader stage.
- Any varying that has explicit_location set must be a built-in. This
will be true until GL_ARB_separate_shader_objects is supported.
As a result, the input_base and output_base parameters to
link_invalidate_variable_locations are no longer necessary, and the code
for resetting locations and setting is_unmatched_generic_inout can be
simplified.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Ian Romanick [Tue, 22 Oct 2013 22:10:16 +0000 (15:10 -0700)]
glsl/tests: Unit test vertex shader in / out with link_invalidate_variable_locations
Validates:
- ir_variable::explicit_location should not be modified.
- If ir_variable::explicit_location is not set, ir_variable::location,
ir_variable::location_frac, and
ir_variable::is_unmatched_generic_inout must be reset to 0.
- If ir_variable::explicit_location is set, ir_variable::location
should not be modified. ir_variable::location_frac, and
ir_variable::is_unmatched_generic_inout must be reset to 0.
Previous unit tests have shown that all non-generic inputs / outputs
have explicit_location set.
v2: Split the link_invalidate_variable_locations interface change out to
a separate patch. Remove the vertex_in_builtin_without_explicit and
vertex_out_builtin_without_explicit tests. There was a lot of good
discussion about this on the mailing list to which I refer the
interested reader. Both changes suggested by Paul.
http://lists.freedesktop.org/archives/mesa-dev/2013-October/046652.html
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Ian Romanick [Tue, 22 Oct 2013 22:07:00 +0000 (15:07 -0700)]
glsl: Modify interface to link_invalidate_variable_locations
This will make it easier to unit test this function in successive
patches. Also, correct the prototype in linker.h. It was... wrong.
v2: Split the interface change from adding the unit tests. Suggested by
Paul.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Ian Romanick [Thu, 3 Oct 2013 22:21:53 +0000 (15:21 -0700)]
glsl/tests: Verify geometry shader built-ins generated by _mesa_glsl_initialize_variables
Checks that the variables generated meet certain criteria.
- Geometry shader inputs have an explicit location.
- Geometry shader outputs have an explicit location.
- Fragment shader-only varying locations are not used.
- Geometry shader uniforms and system values don't have an explicit
location.
- Geometry shader constants don't have an explicit location and are
read-only.
- No other kinds of geometry variables exist.
It does not verify that an specific variables exist.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Ian Romanick [Thu, 3 Oct 2013 22:14:35 +0000 (15:14 -0700)]
glsl/tests: Verify fragment shader built-ins generated by _mesa_glsl_initialize_variables
Checks that the variables generated meet certain criteria.
- Fragment shader inputs have an explicit location.
- Fragment shader outputs have an explicit location.
- Vertex / geometry shader-only varying locations are not used.
- Fragment shader uniforms and system values don't have an explicit
location.
- Fragment shader constants don't have an explicit location and are
read-only.
- No other kinds of fragment variables exist.
It does not verify that an specific variables exist.
v2: Use _mesa_varying_slot_in_fs in
fragment_builtin.inputs_have_explicit_location. Suggested by Paul.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Ian Romanick [Thu, 3 Oct 2013 22:05:44 +0000 (15:05 -0700)]
glsl/tests: Verify vertex shader built-ins generated by _mesa_glsl_initialize_variables
Checks that the variables generated meet certain criteria.
- Vertex shader inputs have an explicit location.
- Vertex shader outputs have an explicit location.
- Fragment shader-only varying locations are not used.
- Vertex shader uniforms and system values don't have an explicit
location.
- Vertex shader constants don't have an explicit location and are
read-only.
- No other kinds of vertex variables exist.
It does not verify that an specific variables exist.
v2: Fix memory management mistakes in
common_builtin::string_starts_with_prefix. Clean up error message
reporting in common_builtin::no_invalid_variable_modes. Both suggested
by Paul.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Ian Romanick [Wed, 2 Oct 2013 23:19:59 +0000 (16:19 -0700)]
glsl: When constructing a variable with an interface type, set interface_type
Ever since the addition of interface blocks with instance names, we have
had an implicit invariant:
var->type->is_interface() ==
(var->type == var->interface_type)
The odd use of == here is intentional because !var->type->is_interface()
implies var->type != var->interface_type.
Further, if var->type->is_array() is true, we have a related implicit
invariant:
var->type->fields.array->is_interface() ==
(var->type->fields.array == var->interface_type)
However, the ir_variable constructor doesn't maintain either invariant.
That seems kind of silly... and I tripped over it while writing some
other code. This patch makes the constructor do the right thing, and it
introduces some tests to verify that behavior.
v2: Add general-ir-test to .gitignore. Update the description of the
ir_variable invariant for arrays in the commit message. Both suggested
by Paul.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Ian Romanick [Tue, 15 Oct 2013 21:01:03 +0000 (14:01 -0700)]
mesa/tests: Add simple, dumb test for _mesa_program_state_string
After some discussions about the correct way to update
_mesa_program_state_string, I decided to make a unit test for the
function. It turns out that the function didn't work quite the way I
thought. The unit test proves that the code was already correct.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: Anuj Phogat <anuj.phogat@gmail.com>
Ander Conselvan de Oliveira [Wed, 16 Oct 2013 12:04:03 +0000 (15:04 +0300)]
wayland: Don't leak wl_drm global when unbinding display
Scott Graham [Tue, 22 Oct 2013 14:37:44 +0000 (08:37 -0600)]
mesa: fixes for MSVC 2013
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Brian Paul [Sat, 19 Oct 2013 14:27:40 +0000 (08:27 -0600)]
st/mesa: minor whitespace, comment changes in st_draw.c
Brian Paul [Sat, 19 Oct 2013 14:23:10 +0000 (08:23 -0600)]
st/dri: minor formatting clean-ups in dri_context.c
Brian Paul [Sat, 19 Oct 2013 14:21:38 +0000 (08:21 -0600)]
mesa: fix a couple issues with U_FIXED, I_FIXED macros
Silence a bunch of MSVC type conversion warnings.
Changed return type of S_FIXED to int32_t (signed). The result
is the same. It just seems more intuitive that a signed conversion
function should return a signed value.
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Brian Paul [Sat, 19 Oct 2013 14:21:38 +0000 (08:21 -0600)]
mesa: remove GL_MESA_program_debug bits from gl.h
The code for this was removed from Mesa some time ago.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Brian Paul [Sat, 19 Oct 2013 14:21:38 +0000 (08:21 -0600)]
mesa: remove remnants of GL_MESA_shader_debug
This extension never saw any real use so remove it.
v2: also update tests/num_strings.cpp for 'make check'
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Kenneth Graunke [Sun, 20 Oct 2013 04:27:37 +0000 (21:27 -0700)]
i965: Only emit interpolation setup if there are actual FS inputs.
Dead code elimination would get rid of the extra instructions, but
skipping this saves iterations through the optimization loop.
From shader-db:
N Min Max Median Avg Stddev
x 14672 3 16 3 3.1334515 0.
59904168
+ 14672 1 16 3 2.8955153 0.
77732963
Difference at 95.0% confidence
-0.237936 +/- 0.0158798
-7.59342% +/- 0.506783%
(Student's t, pooled s = 0.693935)
Embarassingly, the classic shadow mapping shader:
void main() { }
used to require three iterations through the optimization loop.
With this patch, it only requires one (which makes no progress).
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Chris Forbes [Sat, 12 Oct 2013 23:39:47 +0000 (12:39 +1300)]
i965/fs: Fix accidental type conversion in header setup
Previously one side could be UD while the other was float.
V2: Prefer float; apparently IVB can dispatch float ops faster. (Thanks
Eric)
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
Chris Forbes [Sat, 12 Oct 2013 23:20:03 +0000 (12:20 +1300)]
i965/fs: Fix handling of sampler messages with header but zero offset
Gather unconditionally uses a header, but in some cases the
texture_offset value will be zero.
V2: Don't introduce a bogus conversion.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
Matt Turner [Wed, 16 Oct 2013 23:56:45 +0000 (16:56 -0700)]
glsl: Optimize -(-expr) into expr.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Matt Turner [Wed, 16 Oct 2013 23:56:44 +0000 (16:56 -0700)]
glsl: Optimize abs(-expr) and abs(abs(expr)) into abs(expr).
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Matt Turner [Wed, 16 Oct 2013 23:56:43 +0000 (16:56 -0700)]
glsl: Use saved values instead of recomputing them.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Matt Turner [Fri, 18 Oct 2013 22:12:33 +0000 (15:12 -0700)]
docs: Mark GLSL 1.50, 3.30, and geometry shaders done for i965.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Rico Schüller [Mon, 21 Oct 2013 09:11:36 +0000 (11:11 +0200)]
docs: Update docs for ARB_texture_mirror_clamp_to_edge.
Signed-off-by: Rico Schüller <kgbricola@web.de>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Kenneth Graunke [Mon, 21 Oct 2013 03:19:53 +0000 (20:19 -0700)]
i965: Implement ARB_texture_mirror_clamp_to_edge.
This passes Piglit's texwrap tests.
v2: Remove _EXT suffix.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Rico Schüller <kgbricola@web.de>
Kenneth Graunke [Tue, 22 Oct 2013 03:56:44 +0000 (20:56 -0700)]
i965: Drop unused simple_list.h includes.
These don't appear to be necessary. Everything compiles just fine.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Kristian Høgsberg [Fri, 18 Oct 2013 04:21:41 +0000 (21:21 -0700)]
gbm-dri: Support importing RGB565 buffers
Paul Berry [Mon, 14 Oct 2013 01:01:11 +0000 (18:01 -0700)]
glsl/linker: Allow mixing of desktop GLSL versions.
Previously, Mesa followed the linkage rules outlined in the GLSL
1.20-1.40 specs, which (collectively) said that GLSL versions 1.10 and
1.20 could be linked together, but no other versions could be linked.
In GLSL 4.30, the linkage rules were relaxed so that any two desktop
GLSL versions can be linked together. This change was made because it
reflected the behaviour of nearly all existing implementations (see
Khronos bug 8463). Mesa was one of the few (perhaps the only)
exceptions to prohibit cross-linking of some GLSL versions.
Since the GLSL linkage rules were deliberately relaxed in order to
match the behaviour of existing implementations, it seems appropriate
to relax the rules in Mesa too (even though Mesa doesn't support GLSL
4.30 yet).
Note that linking ES and desktop shaders is still prohibited, as is
linking ES shaders having different GLSL versions.
Fixes piglit tests "shaders/version-mixing {interstage,intrastage}".
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Francisco Jerez [Sat, 19 Oct 2013 01:14:28 +0000 (18:14 -0700)]
clover: Improve region and pitch argument handling in memory transfer APIs.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Fri, 18 Oct 2013 23:25:36 +0000 (16:25 -0700)]
clover: Add a pixel_size() method to the image class.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Sun, 6 Oct 2013 20:52:02 +0000 (13:52 -0700)]
clover: Implement support for the ICD extension.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Wed, 24 Jul 2013 10:13:40 +0000 (12:13 +0200)]
clover: Make sure hidden is the default symbol visibility.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Tom Stellard [Wed, 18 Sep 2013 07:36:55 +0000 (00:36 -0700)]
clover: Prepare the build system for ICD support.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Francisco Jerez [Thu, 19 Sep 2013 03:57:39 +0000 (20:57 -0700)]
clover: Fix memory leak when initializing a device object fails.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Mon, 16 Sep 2013 06:07:10 +0000 (23:07 -0700)]
clover: Tidy up resource::mapping.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Mon, 16 Sep 2013 06:04:28 +0000 (23:04 -0700)]
clover: Simplify command_queue::flush().
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Tue, 17 Sep 2013 04:50:40 +0000 (21:50 -0700)]
clover: Clean up the kernel and program object interface.
[ Tom Stellard: Make sure to bind global arguments before retrieving handles. ]
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Tue, 17 Sep 2013 04:38:32 +0000 (21:38 -0700)]
clover: Clean up the interface of the context object slightly.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Tue, 17 Sep 2013 04:44:36 +0000 (21:44 -0700)]
clover: Delete copy constructors and assignment operators in all non-copiable objects.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Tue, 17 Sep 2013 04:11:16 +0000 (21:11 -0700)]
clover: Define a few convenience equality operators.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Tue, 17 Sep 2013 04:44:19 +0000 (21:44 -0700)]
clover: Simplify the platform object by using util/range.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Tue, 17 Sep 2013 04:13:47 +0000 (21:13 -0700)]
clover: Add property list helpers with a syntax consistent with other API objects.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Mon, 16 Sep 2013 05:20:43 +0000 (22:20 -0700)]
clover: Switch samplers to the new model.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Tue, 1 Oct 2013 19:00:51 +0000 (12:00 -0700)]
clover: Switch memory objects to the new model.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Wed, 18 Sep 2013 06:20:11 +0000 (23:20 -0700)]
clover: Switch kernel and program objects to the new model.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Tue, 1 Oct 2013 18:57:32 +0000 (11:57 -0700)]
clover: Switch command queues to the new model.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Tue, 1 Oct 2013 18:54:07 +0000 (11:54 -0700)]
clover: Switch event objects to the new model.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Mon, 16 Sep 2013 03:50:30 +0000 (20:50 -0700)]
clover: Switch context objects to the new model.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Mon, 16 Sep 2013 03:06:57 +0000 (20:06 -0700)]
clover: Switch device objects to the new model.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Tue, 17 Sep 2013 01:26:04 +0000 (18:26 -0700)]
clover: Switch platform objects to the new model.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Sun, 6 Oct 2013 20:51:01 +0000 (13:51 -0700)]
clover: Define helper classes for the new object model.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Sun, 6 Oct 2013 20:49:49 +0000 (13:49 -0700)]
clover: Clean up property query functions by using a new property_buffer helper class.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Sun, 6 Oct 2013 20:49:05 +0000 (13:49 -0700)]
clover: Switch to the new utility code.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Sun, 15 Sep 2013 22:29:34 +0000 (15:29 -0700)]
clover: Name include guards consistently.
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Wed, 18 Sep 2013 06:13:48 +0000 (23:13 -0700)]
clover: Replace a bunch of double underscores with single underscores.
Identifiers with double underscores are reserved, and using them has
undefined behavior according to the C++ spec. It's unlikely to make
any difference, but...
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Francisco Jerez [Sun, 6 Oct 2013 20:48:23 +0000 (13:48 -0700)]
clover: Clean up the event profiling code.
Tested-by: Tom Stellard <thomas.stellard@amd.com>