Compare commits

...

62 Commits

Author SHA1 Message Date
Emil Velikov
aefd6769e8 Update version to 11.1.0-rc2
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2015-11-30 00:13:23 +00:00
Neil Roberts
82a363b851 i965: Handle lum, intensity and missing components in the fast clear
It looks like the sampler hardware doesn't take into account the
surface format when sampling a cleared color after a fast clear has
been done. So for example if you clear a GL_RED surface to 1,1,1,1
then the sampling instructions will return 1,1,1,1 instead of 1,0,0,1.
This patch makes it override the color that is programmed in the
surface state in order to swizzle for luminance and intensity as well
as overriding the missing components.

Fixes the ext_framebuffer_multisample-fast-clear Piglit test.

v2: Handle luminance and intensity formats
Reviewed-by: Ben Widawsky <benjamin.widawsky@intel.com>
(cherry picked from commit 2010de4015)
2015-11-30 00:13:23 +00:00
Nanley Chery
b3183c81c4 mesa/teximage: Fix S3TC regression due to ASTC interaction
A prior, literal reading of the ASTC spec led to the prohibition
of some compressed formats being used against the targets:
TEXTURE_CUBE_MAP_ARRAY and TEXTURE_3D. Since the spec does not specify
interactions with other extensions for specific compressed textures,
remove such interactions.

Fixes the following Piglit tests on Gen9:
piglit.spec.arb_direct_state_access.getcompressedtextureimage
piglit.spec.arb_get_texture_sub_image.arb_get_texture_sub_image-getcompressed
piglit.spec.arb_texture_cube_map_array.fbo-generatemipmap-cubemap array s3tc_dxt1
piglit.spec.ext_texture_compression_s3tc.getteximage-targets cube_array s3tc

v2. Don't interact with other specific compressed formats (Ian).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91927
Suggested-by: Neil Roberts <neil@linux.intel.com>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
(cherry picked from commit d1212abf50)
2015-11-30 00:13:23 +00:00
Nanley Chery
f5e508649d mesa/extensions: Enable overriding permanently enabled extensions
Provide the ability to prevent any permanently enabled extension
from appearing in the string returned by glGetString[i]().

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 21d43fe51a)
2015-11-30 00:13:23 +00:00
Leo Liu
31546c0e8f radeon/vce: disable Stoney VCE for 11.0
Signed-off-by: Leo Liu <leo.liu@amd.com>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-11-30 00:13:23 +00:00
Emil Velikov
6b149bedc3 auxiliary/vl/dri: fd management cleanups
Analogous to previous commit, minus the extra dup. We are the one
opening the device thus we can directly use the fd.

Spotted by Coverity (CID 1339867, 1339877)

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 5d294d9fa3)
2015-11-30 00:13:23 +00:00
Emil Velikov
7a4ba7bfad auxiliary/vl/drm: fd management cleanups
Analogous to previous commit.

Spotted by Coverity (CID 1339868)

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 151290c154)
2015-11-30 00:13:23 +00:00
Emil Velikov
ef6769f18f st/xa: fd management cleanups
Analogous to previous commit.

Spotted by Coverity (CID 1339866)

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit fe71059388)
2015-11-30 00:13:23 +00:00
Emil Velikov
a71db1c46e st/dri: fd management cleanups
Add some checks if the original/dup'd fd is valid and ensure that we
don't leak it on error. The former is implicitly handled within the
pipe_loader, although let's make things explicit and check beforehand.

Spotted by Coverity (CID 1339865)

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit d90ba57c08)
2015-11-30 00:13:23 +00:00
Emil Velikov
88cd21fefb pipe-loader: check if winsys.name is non-null prior to strcmp
In theory this wouldn't be an issue, as we'll find the correct name and
break out of the loop before we hit the sentinel.

Let's fix this and avoid issues in the future.

Spotted by Coverity (CID 1339869, 1339870, 1339871)

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 5f92906b87)
2015-11-30 00:13:23 +00:00
Ilia Mirkin
97d4954f3f mesa: support GL_RED/GL_RG in ES2 contexts when driver support exists
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93126
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 0396eaaf80)
2015-11-30 00:13:23 +00:00
Nicolai Hähnle
3d525c8650 radeon: only suspend queries on flush if they haven't been suspended yet
Non-timer queries are suspended during blits. When the blits end, the queries
are resumed, but this resume operation itself might run out of CS space and
trigger a flush. When this happens, we must prevent a duplicate suspend during
preflush suspend, and we must also prevent a duplicate resume when the CS flush
returns back to the original resume operation.

This fixes a regression that was introduced by:

commit 8a125afa6e
Author: Nicolai Hähnle <nhaehnle@gmail.com>
Date:   Wed Nov 18 18:40:22 2015 +0100

    radeon: ensure that timing/profiling queries are suspended on flush

    The queries_suspended_for_flush flag is redundant because suspended queries
    are not removed from their respective linked list.

    Reviewed-by: Marek Olšák <marek.olsak@amd.com>

Reported-by: Axel Davy <axel.davy@ens.fr>
Cc: "11.1" <mesa-stable@lists.freedesktop.org>
Tested-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 9e5e702cfb)
2015-11-30 00:13:22 +00:00
Emil Velikov
9b9fff6830 targets: use the non-inline sw helpers
Previously (with the inline ones) things were embedded into the
pipe-loader, which means that we cannot control/select what we want in
each target.

That also meant that at runtime we ended up with the empty
sw_screen_create() as the GALLIUM_SOFTPIPE/LLVMPIPE were not set.

v2: Cover all the targets, not just dri.

Cc: "11.1" <mesa-stable@lists.freedesktop.org>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Edward O'Callaghan <edward.ocallaghan@koparo.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Oded Gabbay <oded.gabbay@gmail.com>
Tested-by: Nick Sarnie <commendsarnex@gmail.com>
(cherry picked from commit 59cfb21d46)

Squashed with commit

targets/xvmc: use the non-inline sw helpers

This was missed in commit 59cfb21d ("targets: use the non-inline sw
helpers").

Fixes build failure:

  CXXLD    libXvMCgallium.la
../../../../src/gallium/auxiliary/pipe-loader/.libs/libpipe_loader_static.a(libpipe_loader_static_la-pipe_loader_sw.o):(.data.rel.ro+0x0): undefined reference to `sw_screen_create'
collect2: error: ld returned 1 exit status
Makefile:756: recipe for target 'libXvMCgallium.la' failed
make[3]: *** [libXvMCgallium.la] Error 1

Trivial.

(cherry picked from commit 22d2dda03b)
2015-11-30 00:12:58 +00:00
Emil Velikov
3d09bede30 target-hepers: add non inline sw helpers
Feeling rather dirty copying the inline ones, yet we need the inline
ones for swrast only targets like libgl-xlib, osmesa.

Cc: "11.1" <mesa-stable@lists.freedesktop.org>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Edward O'Callaghan <edward.ocallaghan@koparo.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Oded Gabbay <oded.gabbay@gmail.com>
Tested-by: Nick Sarnie <commendsarnex@gmail.com>
(cherry picked from commit fbc6447c3d)
2015-11-29 19:36:56 +00:00
Emil Velikov
aad5c7d1ca pipe-loader: fix off-by one error
With earlier commit we've dropped the manual iteration over the fixed
size array and prepemtively set the variable storing the size, that is
to be returned. Yet we forgot to adjust the comparison, as before we
were comparing the index, now we're comparing the size.

Fixes: ff9cd8a67c "pipe-loader: directly use
pipe_loader_sw_probe_null() at probe time"
Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93091
Reported-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>

(cherry picked from commit f623517188)
2015-11-29 19:36:55 +00:00
Kenneth Graunke
323161333c i965: Fix scalar vertex shader struct outputs.
While we correctly set output[] for composite varyings, we set completely
bogus values for output_components[], making emit_urb_writes() output
zeros instead of the actual values.

Unfortunately, our simple approach goes out the window, and we need to
recurse into structs to get the proper value of vector_elements for each
field.

Together with the previous patch, this fixes rendering in an upcoming
game from Feral Interactive.

v2: Use pointers instead of pass-by-mutable-reference (Jason, Matt).

Cc: "11.1 11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 3810c15614)
2015-11-29 19:36:55 +00:00
Kenneth Graunke
80febef0ad i965: Fix fragment shader struct inputs.
Apparently we have literally no support for FS varying struct inputs.
This is somewhat surprising, given that we've had tests for that very
feature that have been passing for a long time.

Normally, varying packing splits up structures for us, so we don't see
them in the backend.  However, with SSO, varying packing isn't around
to save us, and we get actual structs that we have to handle.

This patch changes fs_visitor::emit_general_interpolation() to work
recursively, properly handling nested structs/arrays/and so on.
(It's easier to read with diff -b, as indentation changes.)

When using the vec4 VS backend, this fixes rendering in an upcoming
game from Feral Interactive.  (The scalar VS backend requires additional
bug fixes in the next patch.)

v2: Use pointers instead of pass-by-mutable-reference (Jason, Matt).

Cc: "11.1 11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 3e9003e9cf)
2015-11-29 19:36:55 +00:00
Tom Stellard
cf70584907 radeonsi/compute: Use the compiler's COMPUTE_PGM_RSRC* register values
The compiler has more information and is able to optimize the bits
it sets in these registers.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>

CC: <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 89851a2965)
2015-11-29 19:36:55 +00:00
Tom Stellard
96e1bf8791 radeonsi: Rename si_shader::ls_rsrc{1,2} to si_shader::rsrc{1,2}
In the future, these will be used by other shaders types.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 95e0510916)
2015-11-29 19:36:55 +00:00
Ian Romanick
34521c2840 docs: add missed i965 feature to relnotes
Trivial.  GL_ARB_fragment_layer_viewport support was added in 8c902a58
by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "11.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 9b41489cb5)
2015-11-29 17:59:46 +00:00
Timothy Arceri
6a71090002 glsl: implement recent spec update to SSO validation
Enables 200+ dEQP SSO tests to proceed past validation,
and fixes a ES31-CTS.sepshaderobjs.PipelineApi subtest.

V2: split out change that reverts a previous patch into its own commit,
move variable declaration to top of function, and fix some formatting
all suggested by Ian.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: "11.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 2571a768d6)
2015-11-29 17:59:22 +00:00
Timothy Arceri
88fd679706 Revert "mesa: return initial value for VALIDATE_STATUS if pipe not bound"
This reverts commit ba02f7a3b6.

The commit checked whether the pipeline was currently bound instead
of checking whether it had ever been bound.  The previous setting
of Validated during object creation makes this unnecessary.  The
real problem was that Validated was not properly set to false
elsewhere in the code.  This is fixed by a later patch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: "11.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 3c4aa7aff2)
2015-11-29 17:58:57 +00:00
Boyuan Zhang
bb7a1ee11f radeon/uvd: uv pitch separation for stoney
v2: set the behaviour default for future ASICs.

Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit f55f134a03)
2015-11-29 17:58:34 +00:00
Dave Airlie
7a41162b45 texgetimage: consolidate 1D array handling code.
This should fix the getteximage-depth test that currently asserts.

I was hitting problem with virgl as well in this area.

This moves the 1D array handling code to a single place.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Cc: "10.6 11.0 11.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 237bcdbab5)
2015-11-29 17:58:09 +00:00
Ilia Mirkin
5e853a4f01 docs: add missed freedreno features to relnotes
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit e4c1221d36)
2015-11-29 17:57:46 +00:00
Ilia Mirkin
2e073938d0 freedreno/a4xx: use a factor of 32767 for snorm8 blending
It appears that the hardware wants the integer to be scaled the same way
that the hardware representation is. snorm16 uses one of the float
factors, so this is only relevant for snorm8.

This fixes a number of subcases of
  bin/fbo-blending-formats GL_EXT_texture_snorm

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 81b16350fa)
2015-11-29 17:57:23 +00:00
Emil Velikov
30e1c390b3 configure.ac: default to disabled dri3 when --disable-dri is set
Not too long ago, the dri3 code was living in src/glx, which in itself
was guarded by HAVE_DRI_GLX. As the name suggests we didn't dive into
the folder when dri was disabled, thus we missed that dri3 does not
consider/honour --enable-dri.

Cc: mesa-stable@lists.freedesktop.org
Fixes: 6bd9ba7d07 "loader: Add dri3 helper"
Cc: Pali Rohár <pali.rohar@gmail.com>
Reported-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit b89d1b2ccf)
2015-11-29 17:57:00 +00:00
Emil Velikov
72e51e5dfa loader: unconditionally add AM_CPPFLAGS to libloader_la_CPPFLAGS
It seems that due to the conditional autotools is getting confused and
forgetting to add AM_CPPFLAGS when building libloader (when
HAVE_DRICOMMON is not set).

Cc: mesa-stable@lists.freedesktop.org
Fixes: 5a79e0a8e3 "automake: loader: rework the CPPFLAGS"
Reported-by: Pali Rohár <pali.rohar@gmail.com>
Tested-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit b9b0a1f58e)
2015-11-29 17:56:36 +00:00
Emil Velikov
902378d6c8 pipe-loader: link against libloader regardless of libdrm presence
Whether or not the loader has libdrm support is up-to it. Anyone using
the loader should just include it whenever they depend on it.

Cc: mesa-stable@lists.freedesktop.org
Fixes: 0f39f9cb7a "pipe-loader: add a dummy 'static' pipe-loader"
Reported-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Tested-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 8a6d476588)
2015-11-29 17:56:13 +00:00
Ilia Mirkin
f6f127b597 nv50/ir: fix (un)spilling of 3-wide results
There is no 96-bit load/store operations, so we have to split it up
into a 32-bit parts, with a split/merge around it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90348
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 4deb118d06)
2015-11-29 17:55:51 +00:00
Ilia Mirkin
a2f2329cdd nv50,nvc0: properly handle buffer storage invalidation on dsa buffer
In case that the buffer has no bind at all, assume it can be a regular
buffer. This can happen on buffers created through the ARB_dsa
interfaces.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit ad5f6b03e7)
2015-11-29 17:55:27 +00:00
Ilia Mirkin
642b66291c nouveau: use the buffer usage to determine placement when no binding
With ARB_direct_state_access, buffers can be created without any binding
hints at all. We still need to allocate these buffers to VRAM or GART,
as we don't have logic down the line to place them into GPU-mappable
space. Ideally we'd be able to shift these things around based on usage.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92438
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 079f713754)
2015-11-29 17:55:04 +00:00
Eric Anholt
06c3ed8d21 vc4: Take precedence over ilo when in simulator mode.
They're exclusive at build time, but the ilo entry is always present, so
we'd try to use it and fail out.

v2: Add comment in the code, from Emil.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 1b62a4e885)
2015-11-29 17:54:41 +00:00
Eric Anholt
cfbb08168a vc4: Just put USE_VC4_SIMULATOR in DEFINES.
In the pipe-loader reworks, it was missed in one of the new directories it
was used.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit a39eac80fd)
2015-11-29 17:54:18 +00:00
Igor Gnatenko
43b0b8a9a3 virgl: pipe_virgl_create_screen is not static
Cc: mesa-stable@lists.freedesktop.org
Fixes: 17d3a5f857 "target-helpers: add a non-inline drm_helper.h"
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93063
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 05eed0eca7)
2015-11-29 17:53:55 +00:00
Ilia Mirkin
85b6f905e1 freedreno/a4xx: disable blending and alphatest for integer rt0
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 22aeb0c568)
2015-11-29 17:53:31 +00:00
Ilia Mirkin
6a6326dcd4 freedreno/a4xx: fix independent blend
This fixes the ext_draw_buffers2 and arb_draw_buffers_blend tests.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 4c170d9e1d)
2015-11-29 17:53:08 +00:00
Ilia Mirkin
17a64701cb freedreno/a4xx: fix 3d texture setup
Same fix as on a3xx - set the second (tiny) layer size bitfield to the
smallest level's size so that the hw knows not to minify beyond that.

This fixes texelFetch sampler3D piglits.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 740eb63aa7)
2015-11-29 17:52:43 +00:00
Ilia Mirkin
cb4f6e2a30 freedreno/a4xx: only align slices in non-layer_first textures
When layer is the container, slices are tightly packed inside of each
layer. We don't need any additional alignment. On a3xx, each slice
contains all the layers, so having alignment makes sense.

This fixes a whole slew of array-related piglits, including texelFetch
and tex-miplevel-selection varieties.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit ecb0dcd34c)
2015-11-29 17:48:28 +00:00
Ian Romanick
8c564f0376 meta: Don't save or restore the active client texture
This setting is only used by glTexCoordPointer and related glEnable
calls.  Since the preceeding commits removed all of those, it is not
necessary to save, reset to default, or restore this state.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 47b3a0d235)
2015-11-24 11:36:06 -08:00
Ian Romanick
3d2bf5a5f5 meta: Don't save or restore the VBO binding
Nothing left in meta does anything with the VBO binding, so we don't
need to save or restore it.  The VAO binding is still modified.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit c63f9c735d)
2015-11-24 11:36:06 -08:00
Ian Romanick
d1b7a1f5af meta/TexSubImage: Don't pollute the buffer object namespace
tl;dr: For many types of GL object, we can *NEVER* use the Gen function.

In OpenGL ES (all versions!) and OpenGL compatibility profile,
applications don't have to call Gen functions.  The GL spec is very
clear about how you can mix-and-match generated names and non-generated
names: you can use any name you want for a particular object type until
you call the Gen function for that object type.

Here's the problem scenario:

 - Application calls a meta function that generates a name.  The first
   Gen will probably return 1.

 - Application decides to use the same name for an object of the same
   type without calling Gen.  Many demo programs use names 1, 2, 3,
   etc. without calling Gen.

 - Application calls the meta function again, and the meta function
   replaces the data.  The application's data is lost, and the app
   fails.  Have fun debugging that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 58aa56d40b)
2015-11-24 11:36:06 -08:00
Ian Romanick
9c2a7cfbbf meta: Don't pollute the buffer object namespace in _mesa_meta_DrawTex
tl;dr: For many types of GL object, we can *NEVER* use the Gen function.

In OpenGL ES (all versions!) and OpenGL compatibility profile,
applications don't have to call Gen functions.  The GL spec is very
clear about how you can mix-and-match generated names and non-generated
names: you can use any name you want for a particular object type until
you call the Gen function for that object type.

Here's the problem scenario:

 - Application calls a meta function that generates a name.  The first
   Gen will probably return 1.

 - Application decides to use the same name for an object of the same
   type without calling Gen.  Many demo programs use names 1, 2, 3,
   etc. without calling Gen.

 - Application calls the meta function again, and the meta function
   replaces the data.  The application's data is lost, and the app
   fails.  Have fun debugging that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 76cfe2bc44)
2015-11-24 11:36:06 -08:00
Ian Romanick
089fa07dee meta: Use internal functions for buffer object and VAO access in _mesa_meta_DrawTex
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit a222d4cbc3)
2015-11-24 11:36:06 -08:00
Ian Romanick
7ebc8c36a0 meta: Track VBO using gl_buffer_object instead of GL API object handle in _mesa_meta_DrawTex
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit b8a7369fb7)
2015-11-24 11:36:06 -08:00
Ian Romanick
79468fac69 meta: Partially convert _mesa_meta_DrawTex to DSA
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit d5225ee5d9)
2015-11-24 11:36:06 -08:00
Ian Romanick
756e323f2c meta: Don't pollute the buffer object namespace in _mesa_meta_setup_vertex_objects
tl;dr: For many types of GL object, we can *NEVER* use the Gen function.

In OpenGL ES (all versions!) and OpenGL compatibility profile,
applications don't have to call Gen functions.  The GL spec is very
clear about how you can mix-and-match generated names and non-generated
names: you can use any name you want for a particular object type until
you call the Gen function for that object type.

Here's the problem scenario:

 - Application calls a meta function that generates a name.  The first
   Gen will probably return 1.

 - Application decides to use the same name for an object of the same
   type without calling Gen.  Many demo programs use names 1, 2, 3,
   etc. without calling Gen.

 - Application calls the meta function again, and the meta function
   replaces the data.  The application's data is lost, and the app
   fails.  Have fun debugging that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 37d11b13ce)
2015-11-24 11:36:06 -08:00
Ian Romanick
507732ea3d meta: Use internal functions for buffer object and VAO access
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit b1b73a42c8)
2015-11-24 11:36:06 -08:00
Ian Romanick
01909c1f29 meta: Use DSA functions for VBOs in _mesa_meta_setup_vertex_objects
The fixed-function attribute paths don't get the DSA treatment because
there are no DSA entry-points for fixed-function attributes.  These
could have been added, but this is a temporary patch intended to make
later patches easier to review.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 52921f8e08)
2015-11-24 11:36:06 -08:00
Ian Romanick
76b155c9cd meta: Track VBO using gl_buffer_object instead of GL API object handle
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 1035e00a81)
2015-11-24 11:36:06 -08:00
Ian Romanick
4a5c29d877 meta: Don't leave the VBO bound after _mesa_meta_setup_vertex_objects
Meta currently does this, but future changes will make this impossible.
Explicitly do it as a step in the patch series now to catch any possible
kinks.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 3b5a7d450d)
2015-11-24 11:36:06 -08:00
Ian Romanick
bf3f0b9e9b i965: Use _mesa_NamedBufferSubData for users of _mesa_meta_setup_vertex_objects
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit ed0bd6573b)
2015-11-24 11:36:06 -08:00
Ian Romanick
e097324fee meta: Use _mesa_NamedBufferData and _mesa_NamedBufferSubData for users of _mesa_meta_setup_vertex_objects
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 7f2f300071)
2015-11-24 11:36:05 -08:00
Ian Romanick
aa607c69af meta: Use DSA functions for PBO in create_texture_for_pbo
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 89a61afdd7)
2015-11-24 11:36:05 -08:00
Ian Romanick
72470a9c37 i965: Don't pollute the buffer object namespace in brw_meta_fast_clear
tl;dr: For many types of GL object, we can *NEVER* use the Gen function.

In OpenGL ES (all versions!) and OpenGL compatibility profile,
applications don't have to call Gen functions.  The GL spec is very
clear about how you can mix-and-match generated names and non-generated
names: you can use any name you want for a particular object type until
you call the Gen function for that object type.

Here's the problem scenario:

 - Application calls a meta function that generates a name.  The first
   Gen will probably return 1.

 - Application decides to use the same name for an object of the same
   type without calling Gen.  Many demo programs use names 1, 2, 3,
   etc. without calling Gen.

 - Application calls the meta function again, and the meta function
   replaces the data.  The application's data is lost, and the app
   fails.  Have fun debugging that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 4e6b9c11fc)
2015-11-24 11:36:05 -08:00
Ian Romanick
de299e1e2e i965: Use internal functions for buffer object access
Instead of going through the GL API implementation functions, use the
lower-level functions.  This means that we have to keep track of a
pointer to the gl_buffer_object and the gl_vertex_array_object.

This has two advantages.  First, it avoids a bunch of CPU overhead in
looking up objects and validing API parameters.  Second, and much more
importantly, it will allow us to stop calling _mesa_GenBuffers /
_mesa_CreateBuffers and pollute the buffer namespace (next patch).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit e62799bd4e)
2015-11-24 11:36:05 -08:00
Ian Romanick
ded66b1451 i965: Use DSA functions for VBOs in brw_meta_fast_clear
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 1c5423d3a0)
2015-11-24 11:36:05 -08:00
Ian Romanick
b7b4104a7f i965: Pass brw_context instead of gl_context to brw_draw_rectlist
Future patches will use the brw_context instead.  Keeping this
non-functional change separate should make the function changes easier
to review.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit dcadd855f1)
2015-11-24 11:36:05 -08:00
Ian Romanick
236fb067a5 mesa: Refactor enable_vertex_array_attrib to make _mesa_enable_vertex_array_attrib
Pulls the parts of enable_vertex_array_attrib that aren't just parameter
validation out into a function that can be called from other parts of
Mesa (e.g., meta).

_mesa_enable_vertex_array_attrib can also be used to enable
fixed-function arrays.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 4a644f1caa)
2015-11-24 11:36:05 -08:00
Ian Romanick
2d9093fdf0 mesa: Refactor update_array_format to make _mesa_update_array_format_public
Pulls the parts of update_array_format that aren't just parameter
validation out into a function that can be called from other parts of
Mesa (e.g., meta).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit a336fcd36a)
2015-11-24 11:36:05 -08:00
Ian Romanick
d757c04215 mesa: Make bind_vertex_buffer avilable outside varray.c
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 8fae494df2)
2015-11-24 11:36:05 -08:00
Emil Velikov
f9339359d5 Update version to 11.1.0-rc1
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2015-11-21 13:00:25 +00:00
62 changed files with 875 additions and 490 deletions

View File

@@ -1 +1 @@
11.1.0-devel
11.1.0-rc2

View File

@@ -767,6 +767,11 @@ linux*)
dri3_default=no
;;
esac
if test "x$enable_dri" = xno; then
dri3_default=no
fi
AC_ARG_ENABLE([dri3],
[AS_HELP_STRING([--enable-dri3],
[enable DRI3 @<:@default=auto@:>@])],
@@ -2173,7 +2178,9 @@ if test -n "$with_gallium_drivers"; then
gallium_require_drm_loader
PKG_CHECK_MODULES([SIMPENROSE], [simpenrose],
[USE_VC4_SIMULATOR=yes], [USE_VC4_SIMULATOR=no])
[USE_VC4_SIMULATOR=yes;
DEFINES="$DEFINES -DUSE_VC4_SIMULATOR"],
[USE_VC4_SIMULATOR=no])
;;
xvirgl)
HAVE_GALLIUM_VIRGL=yes

View File

@@ -51,14 +51,20 @@ Note: some of the new features are only available with certain drivers.
<li>GL_ARB_arrays_of_arrays on i965</li>
<li>GL_ARB_blend_func_extended on freedreno (a3xx)</li>
<li>GL_ARB_clear_texture on nv50, nvc0</li>
<li>GL_ARB_clip_control on freedreno/a4xx</li>
<li>GL_ARB_copy_image on nv50, nvc0, radeonsi</li>
<li>GL_ARB_depth_clamp on freedreno/a4xx</li>
<li>GL_ARB_fragment_layer_viewport on i965 (gen6+)</li>
<li>GL_ARB_gpu_shader_fp64 on r600 for Cypress/Cayman/Aruba chips</li>
<li>GL_ARB_gpu_shader5 on r600 for Evergreen and later chips</li>
<li>GL_ARB_seamless_cubemap_per_texture on freedreno/a4xx</li>
<li>GL_ARB_shader_clock on i965 (gen7+)</li>
<li>GL_ARB_shader_stencil_export on i965 (gen9+)</li>
<li>GL_ARB_shader_storage_buffer_object on i965</li>
<li>GL_ARB_shader_texture_image_samples on i965, nv50, nvc0, r600, radeonsi</li>
<li>GL_ARB_texture_barrier / GL_NV_texture_barrier on i965</li>
<li>GL_ARB_texture_buffer_range on freedreno/a3xx</li>
<li>GL_ARB_texture_compression_bptc on freedreno/a4xx</li>
<li>GL_ARB_texture_query_lod on softpipe</li>
<li>GL_ARB_texture_view on radeonsi and r600 (for evergeen and newer)</li>
<li>GL_ARB_vertex_type_2_10_10_10_rev on freedreno (a3xx, a4xx)</li>

View File

@@ -37,12 +37,12 @@ libpipe_loader_static_la_SOURCES += \
libpipe_loader_dynamic_la_SOURCES += \
$(DRM_SOURCES)
endif
libpipe_loader_static_la_LIBADD = \
$(top_builddir)/src/loader/libloader.la
libpipe_loader_dynamic_la_LIBADD = \
$(top_builddir)/src/loader/libloader.la
endif
EXTRA_DIST = SConscript

View File

@@ -94,6 +94,18 @@ static const struct drm_driver_descriptor driver_descriptors[] = {
.create_screen = pipe_i915_create_screen,
.configuration = configuration_query,
},
#ifdef USE_VC4_SIMULATOR
/* VC4 simulator and ILO (i965) are mutually exclusive (error at
* configure). As the latter is unconditionally added, keep this one above
* it.
*/
{
.name = "i965",
.driver_name = "vc4",
.create_screen = pipe_vc4_create_screen,
.configuration = configuration_query,
},
#endif
{
.name = "i965",
.driver_name = "i915",
@@ -154,14 +166,6 @@ static const struct drm_driver_descriptor driver_descriptors[] = {
.create_screen = pipe_vc4_create_screen,
.configuration = configuration_query,
},
#ifdef USE_VC4_SIMULATOR
{
.name = "i965",
.driver_name = "vc4",
.create_screen = pipe_vc4_create_screen,
.configuration = configuration_query,
},
#endif
};
#endif

View File

@@ -33,9 +33,10 @@
#include "sw/kms-dri/kms_dri_sw_winsys.h"
#include "sw/null/null_sw_winsys.h"
#include "sw/wrapper/wrapper_sw_winsys.h"
#include "target-helpers/inline_sw_helper.h"
#include "target-helpers/sw_helper_public.h"
#include "state_tracker/drisw_api.h"
#include "state_tracker/sw_driver.h"
#include "state_tracker/sw_winsys.h"
struct pipe_loader_sw_device {
struct pipe_loader_device base;
@@ -136,7 +137,7 @@ pipe_loader_sw_probe_dri(struct pipe_loader_device **devs, struct drisw_loader_f
if (!pipe_loader_sw_probe_init_common(sdev))
goto fail;
for (i = 0; sdev->dd->winsys; i++) {
for (i = 0; sdev->dd->winsys[i].name; i++) {
if (strcmp(sdev->dd->winsys[i].name, "dri") == 0) {
sdev->ws = sdev->dd->winsys[i].create_winsys(drisw_lf);
break;
@@ -168,7 +169,7 @@ pipe_loader_sw_probe_kms(struct pipe_loader_device **devs, int fd)
if (!pipe_loader_sw_probe_init_common(sdev))
goto fail;
for (i = 0; sdev->dd->winsys; i++) {
for (i = 0; sdev->dd->winsys[i].name; i++) {
if (strcmp(sdev->dd->winsys[i].name, "kms_dri") == 0) {
sdev->ws = sdev->dd->winsys[i].create_winsys(fd);
break;
@@ -199,7 +200,7 @@ pipe_loader_sw_probe_null(struct pipe_loader_device **devs)
if (!pipe_loader_sw_probe_init_common(sdev))
goto fail;
for (i = 0; sdev->dd->winsys; i++) {
for (i = 0; sdev->dd->winsys[i].name; i++) {
if (strcmp(sdev->dd->winsys[i].name, "null") == 0) {
sdev->ws = sdev->dd->winsys[i].create_winsys();
break;
@@ -222,7 +223,7 @@ pipe_loader_sw_probe(struct pipe_loader_device **devs, int ndev)
{
int i = 1;
if (i < ndev) {
if (i <= ndev) {
if (!pipe_loader_sw_probe_null(devs)) {
i--;
}
@@ -244,7 +245,7 @@ pipe_loader_sw_probe_wrapped(struct pipe_loader_device **dev,
if (!pipe_loader_sw_probe_init_common(sdev))
goto fail;
for (i = 0; sdev->dd->winsys; i++) {
for (i = 0; sdev->dd->winsys[i].name; i++) {
if (strcmp(sdev->dd->winsys[i].name, "wrapped") == 0) {
sdev->ws = sdev->dd->winsys[i].create_winsys(screen);
break;

View File

@@ -223,7 +223,7 @@ pipe_freedreno_create_screen(int fd)
#include "virgl/drm/virgl_drm_public.h"
#include "virgl/virgl_public.h"
static struct pipe_screen *
struct pipe_screen *
pipe_virgl_create_screen(int fd)
{
struct virgl_winsys *vws;

View File

@@ -0,0 +1,73 @@
#ifndef SW_HELPER_H
#define SW_HELPER_H
#include "pipe/p_compiler.h"
#include "util/u_debug.h"
#include "target-helpers/sw_helper_public.h"
#include "state_tracker/sw_winsys.h"
/* Helper function to choose and instantiate one of the software rasterizers:
* llvmpipe, softpipe.
*/
#ifdef GALLIUM_SOFTPIPE
#include "softpipe/sp_public.h"
#endif
#ifdef GALLIUM_LLVMPIPE
#include "llvmpipe/lp_public.h"
#endif
#ifdef GALLIUM_VIRGL
#include "virgl/virgl_public.h"
#include "virgl/vtest/virgl_vtest_public.h"
#endif
static inline struct pipe_screen *
sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
{
struct pipe_screen *screen = NULL;
#if defined(GALLIUM_LLVMPIPE)
if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
screen = llvmpipe_create_screen(winsys);
#endif
#if defined(GALLIUM_VIRGL)
if (screen == NULL && strcmp(driver, "virpipe") == 0) {
struct virgl_winsys *vws;
vws = virgl_vtest_winsys_wrap(winsys);
screen = virgl_create_screen(vws);
}
#endif
#if defined(GALLIUM_SOFTPIPE)
if (screen == NULL)
screen = softpipe_create_screen(winsys);
#endif
return screen;
}
struct pipe_screen *
sw_screen_create(struct sw_winsys *winsys)
{
const char *default_driver;
const char *driver;
#if defined(GALLIUM_LLVMPIPE)
default_driver = "llvmpipe";
#elif defined(GALLIUM_SOFTPIPE)
default_driver = "softpipe";
#else
default_driver = "";
#endif
driver = debug_get_option("GALLIUM_DRIVER", default_driver);
return sw_screen_create_named(winsys, driver);
}
#endif

View File

@@ -0,0 +1,10 @@
#ifndef _SW_HELPER_PUBLIC_H
#define _SW_HELPER_PUBLIC_H
struct pipe_screen;
struct sw_winsys;
struct pipe_screen *
sw_screen_create(struct sw_winsys *winsys);
#endif /* _SW_HELPER_PUBLIC_H */

View File

@@ -392,7 +392,7 @@ vl_dri2_screen_create(Display *display, int screen)
goto free_connect;
if (drmGetMagic(fd, &magic))
goto free_connect;
goto close_fd;
authenticate_cookie = xcb_dri2_authenticate_unchecked(scrn->conn,
get_xcb_screen(s, screen)->root,
@@ -402,7 +402,7 @@ vl_dri2_screen_create(Display *display, int screen)
if (authenticate == NULL || !authenticate->authenticated)
goto free_authenticate;
if (pipe_loader_drm_probe_fd(&scrn->base.dev, dup(fd)))
if (pipe_loader_drm_probe_fd(&scrn->base.dev, fd))
scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev);
if (!scrn->base.pscreen)
@@ -428,8 +428,11 @@ vl_dri2_screen_create(Display *display, int screen)
release_pipe:
if (scrn->base.dev)
pipe_loader_release(&scrn->base.dev, 1);
fd = -1;
free_authenticate:
free(authenticate);
close_fd:
close(fd);
free_connect:
free(connect);
free_query:

View File

@@ -41,12 +41,16 @@ struct vl_screen *
vl_drm_screen_create(int fd)
{
struct vl_screen *vscreen;
int new_fd = -1;
vscreen = CALLOC_STRUCT(vl_screen);
if (!vscreen)
return NULL;
if (pipe_loader_drm_probe_fd(&vscreen->dev, dup(fd)))
if (fd < 0 || (new_fd = dup(fd)) < 0)
goto error;
if (pipe_loader_drm_probe_fd(&vscreen->dev, new_fd))
vscreen->pscreen = pipe_loader_create_screen(vscreen->dev);
if (!vscreen->pscreen)
@@ -63,6 +67,8 @@ vl_drm_screen_create(int fd)
error:
if (vscreen->dev)
pipe_loader_release(&vscreen->dev, 1);
else
close(new_fd);
FREE(vscreen);
return NULL;

View File

@@ -627,7 +627,7 @@ static inline uint32_t A4XX_RB_FS_OUTPUT_ENABLE_BLEND(uint32_t val)
{
return ((val) << A4XX_RB_FS_OUTPUT_ENABLE_BLEND__SHIFT) & A4XX_RB_FS_OUTPUT_ENABLE_BLEND__MASK;
}
#define A4XX_RB_FS_OUTPUT_FAST_CLEAR 0x00000100
#define A4XX_RB_FS_OUTPUT_INDEPENDENT_BLEND 0x00000100
#define A4XX_RB_FS_OUTPUT_SAMPLE_MASK__MASK 0xffff0000
#define A4XX_RB_FS_OUTPUT_SAMPLE_MASK__SHIFT 16
static inline uint32_t A4XX_RB_FS_OUTPUT_SAMPLE_MASK(uint32_t val)

View File

@@ -137,7 +137,8 @@ fd4_blend_state_create(struct pipe_context *pctx,
so->rb_mrt[i].buf_info |= A4XX_RB_MRT_BUF_INFO_DITHER_MODE(DITHER_ALWAYS);
}
so->rb_fs_output = A4XX_RB_FS_OUTPUT_ENABLE_BLEND(mrt_blend);
so->rb_fs_output = A4XX_RB_FS_OUTPUT_ENABLE_BLEND(mrt_blend) |
COND(cso->independent_blend_enable, A4XX_RB_FS_OUTPUT_INDEPENDENT_BLEND);
return so;
}

View File

@@ -194,7 +194,7 @@ emit_textures(struct fd_context *ctx, struct fd_ringbuffer *ring,
if (view->base.texture) {
struct fd_resource *rsc = fd_resource(view->base.texture);
uint32_t offset = fd_resource_offset(rsc, start, 0);
OUT_RELOC(ring, rsc->bo, offset, view->textconst4, 0);
OUT_RELOC(ring, rsc->bo, offset, view->texconst4, 0);
} else {
OUT_RING(ring, 0x00000000);
}
@@ -497,11 +497,16 @@ fd4_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring,
OUT_RINGP(ring, val, &fd4_context(ctx)->rbrc_patches);
}
if (dirty & FD_DIRTY_ZSA) {
if (dirty & (FD_DIRTY_ZSA | FD_DIRTY_FRAMEBUFFER)) {
struct fd4_zsa_stateobj *zsa = fd4_zsa_stateobj(ctx->zsa);
struct pipe_framebuffer_state *pfb = &ctx->framebuffer;
uint32_t rb_alpha_control = zsa->rb_alpha_control;
if (util_format_is_pure_integer(pipe_surface_format(pfb->cbufs[0])))
rb_alpha_control &= ~A4XX_RB_ALPHA_CONTROL_ALPHA_TEST;
OUT_PKT0(ring, REG_A4XX_RB_ALPHA_CONTROL, 1);
OUT_RING(ring, zsa->rb_alpha_control);
OUT_RING(ring, rb_alpha_control);
OUT_PKT0(ring, REG_A4XX_RB_STENCIL_CONTROL, 2);
OUT_RING(ring, zsa->rb_stencil_control);
@@ -628,10 +633,16 @@ fd4_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring,
for (i = 0; i < A4XX_MAX_RENDER_TARGETS; i++) {
enum pipe_format format = pipe_surface_format(
ctx->framebuffer.cbufs[i]);
bool is_int = util_format_is_pure_integer(format);
bool has_alpha = util_format_has_alpha(format);
uint32_t control = blend->rb_mrt[i].control;
uint32_t blend_control = blend->rb_mrt[i].blend_control_alpha;
if (is_int) {
control &= A4XX_RB_MRT_CONTROL_COMPONENT_ENABLE__MASK;
control |= A4XX_RB_MRT_CONTROL_ROP_CODE(ROP_COPY);
}
if (has_alpha) {
blend_control |= blend->rb_mrt[i].blend_control_rgb;
} else {
@@ -651,19 +662,48 @@ fd4_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring,
A4XX_RB_FS_OUTPUT_SAMPLE_MASK(0xffff));
}
if (dirty & FD_DIRTY_BLEND_COLOR) {
if (dirty & (FD_DIRTY_BLEND_COLOR | FD_DIRTY_FRAMEBUFFER)) {
struct pipe_blend_color *bcolor = &ctx->blend_color;
struct pipe_framebuffer_state *pfb = &ctx->framebuffer;
float factor = 65535.0;
int i;
for (i = 0; i < pfb->nr_cbufs; i++) {
enum pipe_format format = pipe_surface_format(pfb->cbufs[i]);
const struct util_format_description *desc =
util_format_description(format);
int j;
if (desc->is_mixed)
continue;
j = util_format_get_first_non_void_channel(format);
if (j == -1)
continue;
if (desc->channel[j].size > 8 || !desc->channel[j].normalized ||
desc->channel[j].pure_integer)
continue;
/* Just use the first unorm8/snorm8 render buffer. Can't keep
* everyone happy.
*/
if (desc->channel[j].type == UTIL_FORMAT_TYPE_SIGNED)
factor = 32767.0;
break;
}
OUT_PKT0(ring, REG_A4XX_RB_BLEND_RED, 8);
OUT_RING(ring, A4XX_RB_BLEND_RED_UINT(bcolor->color[0] * 65535.0) |
OUT_RING(ring, A4XX_RB_BLEND_RED_UINT(bcolor->color[0] * factor) |
A4XX_RB_BLEND_RED_FLOAT(bcolor->color[0]));
OUT_RING(ring, A4XX_RB_BLEND_RED_F32(bcolor->color[0]));
OUT_RING(ring, A4XX_RB_BLEND_GREEN_UINT(bcolor->color[1] * 65535.0) |
OUT_RING(ring, A4XX_RB_BLEND_GREEN_UINT(bcolor->color[1] * factor) |
A4XX_RB_BLEND_GREEN_FLOAT(bcolor->color[1]));
OUT_RING(ring, A4XX_RB_BLEND_GREEN_F32(bcolor->color[1]));
OUT_RING(ring, A4XX_RB_BLEND_BLUE_UINT(bcolor->color[2] * 65535.0) |
OUT_RING(ring, A4XX_RB_BLEND_BLUE_UINT(bcolor->color[2] * factor) |
A4XX_RB_BLEND_BLUE_FLOAT(bcolor->color[2]));
OUT_RING(ring, A4XX_RB_BLEND_BLUE_F32(bcolor->color[2]));
OUT_RING(ring, A4XX_RB_BLEND_ALPHA_UINT(bcolor->color[3] * 65535.0) |
OUT_RING(ring, A4XX_RB_BLEND_ALPHA_UINT(bcolor->color[3] * factor) |
A4XX_RB_BLEND_ALPHA_FLOAT(bcolor->color[3]));
OUT_RING(ring, A4XX_RB_BLEND_ALPHA_F32(bcolor->color[3]));
}

View File

@@ -214,6 +214,7 @@ fd4_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
struct fd_resource *rsc = fd_resource(prsc);
unsigned lvl = fd_sampler_first_level(cso);
unsigned miplevels = fd_sampler_last_level(cso) - lvl;
uint32_t sz2 = 0;
if (!so)
return NULL;
@@ -259,7 +260,10 @@ fd4_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
case PIPE_TEXTURE_3D:
so->texconst3 =
A4XX_TEX_CONST_3_DEPTH(u_minify(prsc->depth0, lvl)) |
A4XX_TEX_CONST_3_LAYERSZ(rsc->slices[0].size0);
A4XX_TEX_CONST_3_LAYERSZ(rsc->slices[lvl].size0);
while (lvl < cso->u.tex.last_level && sz2 != rsc->slices[lvl+1].size0)
sz2 = rsc->slices[++lvl].size0;
so->texconst4 = A4XX_TEX_CONST_4_LAYERSZ(sz2);
break;
default:
so->texconst3 = 0x00000000;

View File

@@ -51,7 +51,7 @@ fd4_sampler_stateobj(struct pipe_sampler_state *samp)
struct fd4_pipe_sampler_view {
struct pipe_sampler_view base;
uint32_t texconst0, texconst1, texconst2, texconst3, textconst4;
uint32_t texconst0, texconst1, texconst2, texconst3, texconst4;
};
static inline struct fd4_pipe_sampler_view *

View File

@@ -551,7 +551,7 @@ fd_resource_create(struct pipe_screen *pscreen,
struct fd_resource *rsc = CALLOC_STRUCT(fd_resource);
struct pipe_resource *prsc = &rsc->base.b;
enum pipe_format format = tmpl->format;
uint32_t size;
uint32_t size, alignment;
DBG("target=%d, format=%s, %ux%ux%u, array_size=%u, last_level=%u, "
"nr_samples=%u, usage=%u, bind=%x, flags=%x",
@@ -583,6 +583,7 @@ fd_resource_create(struct pipe_screen *pscreen,
assert(rsc->cpp);
alignment = slice_alignment(pscreen, tmpl);
if (is_a4xx(fd_screen(pscreen))) {
switch (tmpl->target) {
case PIPE_TEXTURE_3D:
@@ -590,11 +591,12 @@ fd_resource_create(struct pipe_screen *pscreen,
break;
default:
rsc->layer_first = true;
alignment = 1;
break;
}
}
size = setup_slices(rsc, slice_alignment(pscreen, tmpl), format);
size = setup_slices(rsc, alignment, format);
if (rsc->layer_first) {
rsc->layer_size = align(size, 4096);

View File

@@ -1573,10 +1573,28 @@ SpillCodeInserter::spill(Instruction *defi, Value *slot, LValue *lval)
Instruction *st;
if (slot->reg.file == FILE_MEMORY_LOCAL) {
st = new_Instruction(func, OP_STORE, ty);
st->setSrc(0, slot);
st->setSrc(1, lval);
lval->noSpill = 1;
if (ty != TYPE_B96) {
st = new_Instruction(func, OP_STORE, ty);
st->setSrc(0, slot);
st->setSrc(1, lval);
} else {
st = new_Instruction(func, OP_SPLIT, ty);
st->setSrc(0, lval);
for (int d = 0; d < lval->reg.size / 4; ++d)
st->setDef(d, new_LValue(func, FILE_GPR));
for (int d = lval->reg.size / 4 - 1; d >= 0; --d) {
Value *tmp = cloneShallow(func, slot);
tmp->reg.size = 4;
tmp->reg.data.offset += 4 * d;
Instruction *s = new_Instruction(func, OP_STORE, TYPE_U32);
s->setSrc(0, tmp);
s->setSrc(1, st->getDef(d));
defi->bb->insertAfter(defi, s);
}
}
} else {
st = new_Instruction(func, OP_CVT, ty);
st->setDef(0, slot);
@@ -1596,7 +1614,27 @@ SpillCodeInserter::unspill(Instruction *usei, LValue *lval, Value *slot)
Instruction *ld;
if (slot->reg.file == FILE_MEMORY_LOCAL) {
lval->noSpill = 1;
ld = new_Instruction(func, OP_LOAD, ty);
if (ty != TYPE_B96) {
ld = new_Instruction(func, OP_LOAD, ty);
} else {
ld = new_Instruction(func, OP_MERGE, ty);
for (int d = 0; d < lval->reg.size / 4; ++d) {
Value *tmp = cloneShallow(func, slot);
LValue *val;
tmp->reg.size = 4;
tmp->reg.data.offset += 4 * d;
Instruction *l = new_Instruction(func, OP_LOAD, TYPE_U32);
l->setDef(0, (val = new_LValue(func, FILE_GPR)));
l->setSrc(0, tmp);
usei->bb->insertBefore(usei, l);
ld->setSrc(d, val);
val->noSpill = 1;
}
ld->setDef(0, lval);
usei->bb->insertBefore(usei, ld);
return lval;
}
} else {
ld = new_Instruction(func, OP_CVT, ty);
}

View File

@@ -657,8 +657,8 @@ nouveau_buffer_create(struct pipe_screen *pscreen,
if (buffer->base.flags & (PIPE_RESOURCE_FLAG_MAP_PERSISTENT |
PIPE_RESOURCE_FLAG_MAP_COHERENT)) {
buffer->domain = NOUVEAU_BO_GART;
} else if (buffer->base.bind &
(screen->vidmem_bindings & screen->sysmem_bindings)) {
} else if (buffer->base.bind == 0 || (buffer->base.bind &
(screen->vidmem_bindings & screen->sysmem_bindings))) {
switch (buffer->base.usage) {
case PIPE_USAGE_DEFAULT:
case PIPE_USAGE_IMMUTABLE:
@@ -685,6 +685,10 @@ nouveau_buffer_create(struct pipe_screen *pscreen,
if (buffer->base.bind & screen->sysmem_bindings)
buffer->domain = NOUVEAU_BO_GART;
}
/* There can be very special situations where we want non-gpu-mapped
* buffers, but never through this interface.
*/
assert(buffer->domain);
ret = nouveau_buffer_allocate(screen, buffer, buffer->domain);
if (ret == false)

View File

@@ -168,9 +168,10 @@ nv50_invalidate_resource_storage(struct nouveau_context *ctx,
int ref)
{
struct nv50_context *nv50 = nv50_context(&ctx->pipe);
unsigned bind = res->bind ? res->bind : PIPE_BIND_VERTEX_BUFFER;
unsigned s, i;
if (res->bind & PIPE_BIND_RENDER_TARGET) {
if (bind & PIPE_BIND_RENDER_TARGET) {
assert(nv50->framebuffer.nr_cbufs <= PIPE_MAX_COLOR_BUFS);
for (i = 0; i < nv50->framebuffer.nr_cbufs; ++i) {
if (nv50->framebuffer.cbufs[i] &&
@@ -182,7 +183,7 @@ nv50_invalidate_resource_storage(struct nouveau_context *ctx,
}
}
}
if (res->bind & PIPE_BIND_DEPTH_STENCIL) {
if (bind & PIPE_BIND_DEPTH_STENCIL) {
if (nv50->framebuffer.zsbuf &&
nv50->framebuffer.zsbuf->texture == res) {
nv50->dirty |= NV50_NEW_FRAMEBUFFER;
@@ -192,11 +193,11 @@ nv50_invalidate_resource_storage(struct nouveau_context *ctx,
}
}
if (res->bind & (PIPE_BIND_VERTEX_BUFFER |
PIPE_BIND_INDEX_BUFFER |
PIPE_BIND_CONSTANT_BUFFER |
PIPE_BIND_STREAM_OUTPUT |
PIPE_BIND_SAMPLER_VIEW)) {
if (bind & (PIPE_BIND_VERTEX_BUFFER |
PIPE_BIND_INDEX_BUFFER |
PIPE_BIND_CONSTANT_BUFFER |
PIPE_BIND_STREAM_OUTPUT |
PIPE_BIND_SAMPLER_VIEW)) {
assert(nv50->num_vtxbufs <= PIPE_MAX_ATTRIBS);
for (i = 0; i < nv50->num_vtxbufs; ++i) {

View File

@@ -180,9 +180,10 @@ nvc0_invalidate_resource_storage(struct nouveau_context *ctx,
int ref)
{
struct nvc0_context *nvc0 = nvc0_context(&ctx->pipe);
unsigned bind = res->bind ? res->bind : PIPE_BIND_VERTEX_BUFFER;
unsigned s, i;
if (res->bind & PIPE_BIND_RENDER_TARGET) {
if (bind & PIPE_BIND_RENDER_TARGET) {
for (i = 0; i < nvc0->framebuffer.nr_cbufs; ++i) {
if (nvc0->framebuffer.cbufs[i] &&
nvc0->framebuffer.cbufs[i]->texture == res) {
@@ -193,7 +194,7 @@ nvc0_invalidate_resource_storage(struct nouveau_context *ctx,
}
}
}
if (res->bind & PIPE_BIND_DEPTH_STENCIL) {
if (bind & PIPE_BIND_DEPTH_STENCIL) {
if (nvc0->framebuffer.zsbuf &&
nvc0->framebuffer.zsbuf->texture == res) {
nvc0->dirty |= NVC0_NEW_FRAMEBUFFER;
@@ -203,12 +204,12 @@ nvc0_invalidate_resource_storage(struct nouveau_context *ctx,
}
}
if (res->bind & (PIPE_BIND_VERTEX_BUFFER |
PIPE_BIND_INDEX_BUFFER |
PIPE_BIND_CONSTANT_BUFFER |
PIPE_BIND_STREAM_OUTPUT |
PIPE_BIND_COMMAND_ARGS_BUFFER |
PIPE_BIND_SAMPLER_VIEW)) {
if (bind & (PIPE_BIND_VERTEX_BUFFER |
PIPE_BIND_INDEX_BUFFER |
PIPE_BIND_CONSTANT_BUFFER |
PIPE_BIND_STREAM_OUTPUT |
PIPE_BIND_COMMAND_ARGS_BUFFER |
PIPE_BIND_SAMPLER_VIEW)) {
for (i = 0; i < nvc0->num_vtxbufs; ++i) {
if (nvc0->vtxbuf[i].buffer == res) {
nvc0->dirty |= NVC0_NEW_ARRAYS;

View File

@@ -136,8 +136,12 @@ static void r600_memory_barrier(struct pipe_context *ctx, unsigned flags)
void r600_preflush_suspend_features(struct r600_common_context *ctx)
{
/* suspend queries */
if (!LIST_IS_EMPTY(&ctx->active_nontimer_queries))
if (ctx->num_cs_dw_nontimer_queries_suspend) {
/* Since non-timer queries are suspended during blits,
* we have to guard against double-suspends. */
r600_suspend_nontimer_queries(ctx);
ctx->nontimer_queries_suspended_by_flush = true;
}
if (!LIST_IS_EMPTY(&ctx->active_timer_queries))
r600_suspend_timer_queries(ctx);
@@ -158,8 +162,10 @@ void r600_postflush_resume_features(struct r600_common_context *ctx)
/* resume queries */
if (!LIST_IS_EMPTY(&ctx->active_timer_queries))
r600_resume_timer_queries(ctx);
if (!LIST_IS_EMPTY(&ctx->active_nontimer_queries))
if (ctx->nontimer_queries_suspended_by_flush) {
ctx->nontimer_queries_suspended_by_flush = false;
r600_resume_nontimer_queries(ctx);
}
}
static void r600_flush_from_st(struct pipe_context *ctx,

View File

@@ -392,6 +392,7 @@ struct r600_common_context {
struct list_head active_nontimer_queries;
struct list_head active_timer_queries;
unsigned num_cs_dw_nontimer_queries_suspend;
bool nontimer_queries_suspended_by_flush;
unsigned num_cs_dw_timer_queries_suspend;
/* Additional hardware info. */
unsigned backend_mask;

View File

@@ -958,6 +958,8 @@ static void ruvd_end_frame(struct pipe_video_codec *decoder,
dec->msg->body.decode.db_pitch = dec->base.width;
dt = dec->set_dtb(dec->msg, (struct vl_video_buffer *)target);
if (((struct r600_common_screen*)dec->screen)->family >= CHIP_STONEY)
dec->msg->body.decode.dt_wa_chroma_top_offset = dec->msg->body.decode.dt_pitch / 2;
switch (u_reduce_video_profile(picture->profile)) {
case PIPE_VIDEO_FORMAT_MPEG4_AVC:

View File

@@ -394,7 +394,10 @@ struct ruvd_msg {
uint32_t dt_chroma_top_offset;
uint32_t dt_chroma_bottom_offset;
uint32_t dt_surf_tile_config;
uint32_t dt_reserved[3];
uint32_t dt_uv_surf_tile_config;
// re-use dt_wa_chroma_top_offset as dt_ext_info for UV pitch in stoney
uint32_t dt_wa_chroma_top_offset;
uint32_t dt_wa_chroma_bottom_offset;
uint32_t reserved[16];

View File

@@ -389,6 +389,11 @@ struct pipe_video_codec *rvce_create_encoder(struct pipe_context *context,
struct radeon_surf *tmp_surf;
unsigned cpb_size;
if (rscreen->info.family == CHIP_STONEY) {
RVID_ERR("Stoney VCE is not supported!\n");
return NULL;
}
if (!rscreen->info.vce_fw_version) {
RVID_ERR("Kernel doesn't supports VCE!\n");
return NULL;

View File

@@ -34,11 +34,6 @@
#define MAX_GLOBAL_BUFFERS 20
/* XXX: Even though we don't pass the scratch buffer via user sgprs any more
* LLVM still expects that we specify 4 USER_SGPRS so it can remain compatible
* with older mesa. */
#define NUM_USER_SGPRS 4
struct si_compute {
struct si_context *ctx;
@@ -238,7 +233,6 @@ static void si_launch_grid(
uint64_t kernel_args_va;
uint64_t scratch_buffer_va = 0;
uint64_t shader_va;
unsigned arg_user_sgpr_count = NUM_USER_SGPRS;
unsigned i;
struct si_shader *shader = &program->shader;
unsigned lds_blocks;
@@ -366,20 +360,7 @@ static void si_launch_grid(
si_pm4_set_reg(pm4, R_00B830_COMPUTE_PGM_LO, shader_va >> 8);
si_pm4_set_reg(pm4, R_00B834_COMPUTE_PGM_HI, shader_va >> 40);
si_pm4_set_reg(pm4, R_00B848_COMPUTE_PGM_RSRC1,
/* We always use at least 3 VGPRS, these come from
* TIDIG_COMP_CNT.
* XXX: The compiler should account for this.
*/
S_00B848_VGPRS((MAX2(3, shader->num_vgprs) - 1) / 4)
/* We always use at least 4 + arg_user_sgpr_count. The 4 extra
* sgprs are from TGID_X_EN, TGID_Y_EN, TGID_Z_EN, TG_SIZE_EN
* XXX: The compiler should account for this.
*/
| S_00B848_SGPRS(((MAX2(4 + arg_user_sgpr_count,
shader->num_sgprs)) - 1) / 8)
| S_00B028_FLOAT_MODE(shader->float_mode))
;
si_pm4_set_reg(pm4, R_00B848_COMPUTE_PGM_RSRC1, shader->rsrc1);
lds_blocks = shader->lds_size;
/* XXX: We are over allocating LDS. For SI, the shader reports LDS in
@@ -395,17 +376,10 @@ static void si_launch_grid(
assert(lds_blocks <= 0xFF);
si_pm4_set_reg(pm4, R_00B84C_COMPUTE_PGM_RSRC2,
S_00B84C_SCRATCH_EN(shader->scratch_bytes_per_wave > 0)
| S_00B84C_USER_SGPR(arg_user_sgpr_count)
| S_00B84C_TGID_X_EN(1)
| S_00B84C_TGID_Y_EN(1)
| S_00B84C_TGID_Z_EN(1)
| S_00B84C_TG_SIZE_EN(1)
| S_00B84C_TIDIG_COMP_CNT(2)
| S_00B84C_LDS_SIZE(lds_blocks)
| S_00B84C_EXCP_EN(0))
;
shader->rsrc2 &= C_00B84C_LDS_SIZE;
shader->rsrc2 |= S_00B84C_LDS_SIZE(lds_blocks);
si_pm4_set_reg(pm4, R_00B84C_COMPUTE_PGM_RSRC2, shader->rsrc2);
si_pm4_set_reg(pm4, R_00B854_COMPUTE_RESOURCE_LIMITS, 0);
si_pm4_set_reg(pm4, R_00B858_COMPUTE_STATIC_THREAD_MGMT_SE0,

View File

@@ -3745,12 +3745,14 @@ void si_shader_binary_read_config(const struct si_screen *sscreen,
shader->num_sgprs = MAX2(shader->num_sgprs, (G_00B028_SGPRS(value) + 1) * 8);
shader->num_vgprs = MAX2(shader->num_vgprs, (G_00B028_VGPRS(value) + 1) * 4);
shader->float_mode = G_00B028_FLOAT_MODE(value);
shader->rsrc1 = value;
break;
case R_00B02C_SPI_SHADER_PGM_RSRC2_PS:
shader->lds_size = MAX2(shader->lds_size, G_00B02C_EXTRA_LDS_SIZE(value));
break;
case R_00B84C_COMPUTE_PGM_RSRC2:
shader->lds_size = MAX2(shader->lds_size, G_00B84C_LDS_SIZE(value));
shader->rsrc2 = value;
break;
case R_0286CC_SPI_PS_INPUT_ENA:
shader->spi_ps_input_ena = value;

View File

@@ -290,8 +290,8 @@ struct si_shader {
bool is_gs_copy_shader;
bool dx10_clamp_mode; /* convert NaNs to 0 */
unsigned ls_rsrc1;
unsigned ls_rsrc2;
unsigned rsrc1;
unsigned rsrc2;
};
static inline struct tgsi_shader_info *si_get_vs_info(struct si_context *sctx)

View File

@@ -163,7 +163,7 @@ static void si_emit_derived_tess_state(struct si_context *sctx,
perpatch_output_offset = output_patch0_offset + pervertex_output_patch_size;
lds_size = output_patch0_offset + output_patch_size * *num_patches;
ls_rsrc2 = ls->current->ls_rsrc2;
ls_rsrc2 = ls->current->rsrc2;
if (sctx->b.chip_class >= CIK) {
assert(lds_size <= 65536);
@@ -178,7 +178,7 @@ static void si_emit_derived_tess_state(struct si_context *sctx,
if (sctx->b.chip_class == CIK && sctx->b.family != CHIP_HAWAII)
radeon_set_sh_reg(cs, R_00B52C_SPI_SHADER_PGM_RSRC2_LS, ls_rsrc2);
radeon_set_sh_reg_seq(cs, R_00B528_SPI_SHADER_PGM_RSRC1_LS, 2);
radeon_emit(cs, ls->current->ls_rsrc1);
radeon_emit(cs, ls->current->rsrc1);
radeon_emit(cs, ls_rsrc2);
/* Compute userdata SGPRs. */

View File

@@ -121,11 +121,11 @@ static void si_shader_ls(struct si_shader *shader)
si_pm4_set_reg(pm4, R_00B520_SPI_SHADER_PGM_LO_LS, va >> 8);
si_pm4_set_reg(pm4, R_00B524_SPI_SHADER_PGM_HI_LS, va >> 40);
shader->ls_rsrc1 = S_00B528_VGPRS((shader->num_vgprs - 1) / 4) |
shader->rsrc1 = S_00B528_VGPRS((shader->num_vgprs - 1) / 4) |
S_00B528_SGPRS((num_sgprs - 1) / 8) |
S_00B528_VGPR_COMP_CNT(vgpr_comp_cnt) |
S_00B528_DX10_CLAMP(shader->dx10_clamp_mode);
shader->ls_rsrc2 = S_00B52C_USER_SGPR(num_user_sgprs) |
shader->rsrc2 = S_00B52C_USER_SGPR(num_user_sgprs) |
S_00B52C_SCRATCH_EN(shader->scratch_bytes_per_wave > 0);
}

View File

@@ -6,8 +6,4 @@ TARGET_LIB_DEPS += \
$(top_builddir)/src/gallium/winsys/vc4/drm/libvc4drm.la \
$(top_builddir)/src/gallium/drivers/vc4/libvc4.la
if USE_VC4_SIMULATOR
TARGET_CPPFLAGS += -DUSE_VC4_SIMULATOR
endif
endif

View File

@@ -23,7 +23,6 @@ include Makefile.sources
include $(top_srcdir)/src/gallium/Automake.inc
if USE_VC4_SIMULATOR
SIM_CFLAGS = -DUSE_VC4_SIMULATOR=1
SIM_LDFLAGS = -lsimpenrose
endif

View File

@@ -1446,6 +1446,7 @@ dri2_init_screen(__DRIscreen * sPriv)
struct pipe_screen *pscreen = NULL;
const struct drm_conf_ret *throttle_ret;
const struct drm_conf_ret *dmabuf_ret;
int fd = -1;
screen = CALLOC_STRUCT(dri_screen);
if (!screen)
@@ -1457,7 +1458,10 @@ dri2_init_screen(__DRIscreen * sPriv)
sPriv->driverPrivate = (void *)screen;
if (pipe_loader_drm_probe_fd(&screen->dev, dup(screen->fd)))
if (screen->fd < 0 || (fd = dup(screen->fd)) < 0)
goto fail;
if (pipe_loader_drm_probe_fd(&screen->dev, fd))
pscreen = pipe_loader_create_screen(screen->dev);
if (!pscreen)
@@ -1502,6 +1506,8 @@ fail:
dri_destroy_screen_helper(screen);
if (screen->dev)
pipe_loader_release(&screen->dev, 1);
else
close(fd);
FREE(screen);
return NULL;
}
@@ -1519,6 +1525,7 @@ dri_kms_init_screen(__DRIscreen * sPriv)
struct dri_screen *screen;
struct pipe_screen *pscreen = NULL;
uint64_t cap;
int fd = -1;
screen = CALLOC_STRUCT(dri_screen);
if (!screen)
@@ -1529,7 +1536,10 @@ dri_kms_init_screen(__DRIscreen * sPriv)
sPriv->driverPrivate = (void *)screen;
if (pipe_loader_sw_probe_kms(&screen->dev, dup(screen->fd)))
if (screen->fd < 0 || (fd = dup(screen->fd)) < 0)
goto fail;
if (pipe_loader_sw_probe_kms(&screen->dev, fd))
pscreen = pipe_loader_create_screen(screen->dev);
if (!pscreen)
@@ -1557,6 +1567,8 @@ fail:
dri_destroy_screen_helper(screen);
if (screen->dev)
pipe_loader_release(&screen->dev, 1);
else
close(fd);
FREE(screen);
#endif // GALLIUM_SOFTPIPE
return NULL;

View File

@@ -152,11 +152,15 @@ xa_tracker_create(int drm_fd)
struct xa_tracker *xa = calloc(1, sizeof(struct xa_tracker));
enum xa_surface_type stype;
unsigned int num_formats;
int fd = -1;
if (!xa)
return NULL;
if (pipe_loader_drm_probe_fd(&xa->dev, dup(drm_fd)))
if (drm_fd < 0 || (fd = dup(drm_fd)) < 0)
goto out_no_fd;
if (pipe_loader_drm_probe_fd(&xa->dev, fd))
xa->screen = pipe_loader_create_screen(xa->dev);
if (!xa->screen)
@@ -208,6 +212,9 @@ xa_tracker_create(int drm_fd)
out_no_screen:
if (xa->dev)
pipe_loader_release(&xa->dev, 1);
fd = -1;
out_no_fd:
close(fd);
free(xa);
return NULL;
}

View File

@@ -31,6 +31,7 @@
#include "pipe/p_state.h"
#include "target-helpers/drm_helper.h"
#include "target-helpers/sw_helper.h"
#include "state_tracker/drm_driver.h"
#include "d3dadapter/d3dadapter9.h"

View File

@@ -1,4 +1,5 @@
#include "target-helpers/drm_helper.h"
#include "target-helpers/sw_helper.h"
#include "dri_screen.h"

View File

@@ -1 +1,2 @@
#include "target-helpers/drm_helper.h"
#include "target-helpers/sw_helper.h"

View File

@@ -1 +1,2 @@
#include "target-helpers/drm_helper.h"
#include "target-helpers/sw_helper.h"

View File

@@ -1 +1,2 @@
#include "target-helpers/drm_helper.h"
#include "target-helpers/sw_helper.h"

View File

@@ -1 +1,2 @@
#include "target-helpers/drm_helper.h"
#include "target-helpers/sw_helper.h"

View File

@@ -1 +1,2 @@
#include "target-helpers/drm_helper.h"
#include "target-helpers/sw_helper.h"

View File

@@ -34,12 +34,12 @@ AM_CPPFLAGS = \
$(LIBDRM_CFLAGS) \
$(LIBUDEV_CFLAGS)
libloader_la_CPPFLAGS = $(AM_CPPFLAGS)
libloader_la_SOURCES = $(LOADER_C_FILES)
libloader_la_LIBADD =
if HAVE_DRICOMMON
libloader_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
libloader_la_CPPFLAGS += \
-I$(top_srcdir)/src/mesa/drivers/dri/common/ \
-I$(top_builddir)/src/mesa/drivers/dri/common/ \
-I$(top_srcdir)/src/mesa/ \

View File

@@ -95,9 +95,12 @@ static struct blit_shader *
choose_blit_shader(GLenum target, struct blit_shader_table *table);
static void cleanup_temp_texture(struct temp_texture *tex);
static void meta_glsl_clear_cleanup(struct clear_state *clear);
static void meta_decompress_cleanup(struct decompress_state *decompress);
static void meta_drawpix_cleanup(struct drawpix_state *drawpix);
static void meta_glsl_clear_cleanup(struct gl_context *ctx,
struct clear_state *clear);
static void meta_decompress_cleanup(struct gl_context *ctx,
struct decompress_state *decompress);
static void meta_drawpix_cleanup(struct gl_context *ctx,
struct drawpix_state *drawpix);
void
_mesa_meta_bind_fbo_image(GLenum fboTarget, GLenum attachment,
@@ -310,13 +313,13 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx,
/**
* Configure vertex buffer and vertex array objects for tests
*
* Regardless of whether a new VAO and new VBO are created, the objects
* referenced by \c VAO and \c VBO will be bound into the GL state vector
* when this function terminates.
* Regardless of whether a new VAO is created, the object referenced by \c VAO
* will be bound into the GL state vector when this function terminates. The
* object referenced by \c VBO will \b not be bound.
*
* \param VAO Storage for vertex array object handle. If 0, a new VAO
* will be created.
* \param VBO Storage for vertex buffer object handle. If 0, a new VBO
* \param buf_obj Storage for vertex buffer object pointer. If \c NULL, a new VBO
* will be created. The new VBO will have storage for 4
* \c vertex structures.
* \param use_generic_attributes Should generic attributes 0 and 1 be used,
@@ -333,57 +336,84 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx,
* Use \c texcoord_size instead.
*/
void
_mesa_meta_setup_vertex_objects(GLuint *VAO, GLuint *VBO,
_mesa_meta_setup_vertex_objects(struct gl_context *ctx,
GLuint *VAO, struct gl_buffer_object **buf_obj,
bool use_generic_attributes,
unsigned vertex_size, unsigned texcoord_size,
unsigned color_size)
{
if (*VAO == 0) {
assert(*VBO == 0);
struct gl_vertex_array_object *array_obj;
assert(*buf_obj == NULL);
/* create vertex array object */
_mesa_GenVertexArrays(1, VAO);
_mesa_BindVertexArray(*VAO);
array_obj = _mesa_lookup_vao(ctx, *VAO);
assert(array_obj != NULL);
/* create vertex array buffer */
_mesa_GenBuffers(1, VBO);
_mesa_BindBuffer(GL_ARRAY_BUFFER, *VBO);
_mesa_BufferData(GL_ARRAY_BUFFER, 4 * sizeof(struct vertex), NULL,
GL_DYNAMIC_DRAW);
*buf_obj = ctx->Driver.NewBufferObject(ctx, 0xDEADBEEF);
if (*buf_obj == NULL)
return;
_mesa_buffer_data(ctx, *buf_obj, GL_NONE, 4 * sizeof(struct vertex), NULL,
GL_DYNAMIC_DRAW, __func__);
/* setup vertex arrays */
if (use_generic_attributes) {
assert(color_size == 0);
_mesa_VertexAttribPointer(0, vertex_size, GL_FLOAT, GL_FALSE,
sizeof(struct vertex), OFFSET(x));
_mesa_EnableVertexAttribArray(0);
_mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_GENERIC(0),
vertex_size, GL_FLOAT, GL_RGBA, GL_FALSE,
GL_FALSE, GL_FALSE,
offsetof(struct vertex, x), true);
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_GENERIC(0),
*buf_obj, 0, sizeof(struct vertex));
_mesa_enable_vertex_array_attrib(ctx, array_obj,
VERT_ATTRIB_GENERIC(0));
if (texcoord_size > 0) {
_mesa_VertexAttribPointer(1, texcoord_size, GL_FLOAT, GL_FALSE,
sizeof(struct vertex), OFFSET(tex));
_mesa_EnableVertexAttribArray(1);
_mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_GENERIC(1),
texcoord_size, GL_FLOAT, GL_RGBA,
GL_FALSE, GL_FALSE, GL_FALSE,
offsetof(struct vertex, tex), false);
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_GENERIC(1),
*buf_obj, 0, sizeof(struct vertex));
_mesa_enable_vertex_array_attrib(ctx, array_obj,
VERT_ATTRIB_GENERIC(1));
}
} else {
_mesa_VertexPointer(vertex_size, GL_FLOAT, sizeof(struct vertex),
OFFSET(x));
_mesa_EnableClientState(GL_VERTEX_ARRAY);
_mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_POS,
vertex_size, GL_FLOAT, GL_RGBA, GL_FALSE,
GL_FALSE, GL_FALSE,
offsetof(struct vertex, x), true);
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_POS,
*buf_obj, 0, sizeof(struct vertex));
_mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_POS);
if (texcoord_size > 0) {
_mesa_TexCoordPointer(texcoord_size, GL_FLOAT,
sizeof(struct vertex), OFFSET(tex));
_mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
_mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_TEX(0),
vertex_size, GL_FLOAT, GL_RGBA, GL_FALSE,
GL_FALSE, GL_FALSE,
offsetof(struct vertex, tex), false);
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_TEX(0),
*buf_obj, 0, sizeof(struct vertex));
_mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_TEX(0));
}
if (color_size > 0) {
_mesa_ColorPointer(color_size, GL_FLOAT,
sizeof(struct vertex), OFFSET(r));
_mesa_EnableClientState(GL_COLOR_ARRAY);
_mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_COLOR0,
vertex_size, GL_FLOAT, GL_RGBA, GL_FALSE,
GL_FALSE, GL_FALSE,
offsetof(struct vertex, r), false);
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_COLOR0,
*buf_obj, 0, sizeof(struct vertex));
_mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_COLOR0);
}
}
} else {
_mesa_BindVertexArray(*VAO);
_mesa_BindBuffer(GL_ARRAY_BUFFER, *VBO);
}
}
@@ -408,12 +438,12 @@ _mesa_meta_free(struct gl_context *ctx)
{
GET_CURRENT_CONTEXT(old_context);
_mesa_make_current(ctx, NULL, NULL);
_mesa_meta_glsl_blit_cleanup(&ctx->Meta->Blit);
meta_glsl_clear_cleanup(&ctx->Meta->Clear);
_mesa_meta_glsl_generate_mipmap_cleanup(&ctx->Meta->Mipmap);
_mesa_meta_glsl_blit_cleanup(ctx, &ctx->Meta->Blit);
meta_glsl_clear_cleanup(ctx, &ctx->Meta->Clear);
_mesa_meta_glsl_generate_mipmap_cleanup(ctx, &ctx->Meta->Mipmap);
cleanup_temp_texture(&ctx->Meta->TempTex);
meta_decompress_cleanup(&ctx->Meta->Decompress);
meta_drawpix_cleanup(&ctx->Meta->DrawPix);
meta_decompress_cleanup(ctx, &ctx->Meta->Decompress);
meta_drawpix_cleanup(ctx, &ctx->Meta->DrawPix);
if (old_context)
_mesa_make_current(old_context, old_context->WinSysDrawBuffer, old_context->WinSysReadBuffer);
else
@@ -630,7 +660,6 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
GLuint u, tgt;
save->ActiveUnit = ctx->Texture.CurrentUnit;
save->ClientActiveUnit = ctx->Array.ActiveTexture;
save->EnvMode = ctx->Texture.Unit[0].EnvMode;
/* Disable all texture units */
@@ -663,7 +692,6 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
/* set defaults for unit[0] */
_mesa_ActiveTexture(GL_TEXTURE0);
_mesa_ClientActiveTexture(GL_TEXTURE0);
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
}
@@ -715,8 +743,6 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
/* save vertex array object state */
_mesa_reference_vao(ctx, &save->VAO,
ctx->Array.VAO);
_mesa_reference_buffer_object(ctx, &save->ArrayBufferObj,
ctx->Array.ArrayBufferObj);
/* set some default state? */
}
@@ -1092,7 +1118,6 @@ _mesa_meta_end(struct gl_context *ctx)
/* restore current unit state */
_mesa_ActiveTexture(GL_TEXTURE0 + save->ActiveUnit);
_mesa_ClientActiveTexture(GL_TEXTURE0 + save->ClientActiveUnit);
}
if (state & MESA_META_TRANSFORM) {
@@ -1126,10 +1151,6 @@ _mesa_meta_end(struct gl_context *ctx)
}
if (state & MESA_META_VERTEX) {
/* restore vertex buffer object */
_mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, save->ArrayBufferObj->Name);
_mesa_reference_buffer_object(ctx, &save->ArrayBufferObj, NULL);
/* restore vertex array object */
_mesa_BindVertexArray(save->VAO->Name);
_mesa_reference_vao(ctx, &save->VAO, NULL);
@@ -1490,10 +1511,12 @@ _mesa_meta_setup_drawpix_texture(struct gl_context *ctx,
}
void
_mesa_meta_setup_ff_tnl_for_blit(GLuint *VAO, GLuint *VBO,
_mesa_meta_setup_ff_tnl_for_blit(struct gl_context *ctx,
GLuint *VAO, struct gl_buffer_object **buf_obj,
unsigned texcoord_size)
{
_mesa_meta_setup_vertex_objects(VAO, VBO, false, 2, texcoord_size, 0);
_mesa_meta_setup_vertex_objects(ctx, VAO, buf_obj, false, 2, texcoord_size,
0);
/* setup projection matrix */
_mesa_MatrixMode(GL_PROJECTION);
@@ -1538,7 +1561,8 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
GLuint vs, fs;
bool has_integer_textures;
_mesa_meta_setup_vertex_objects(&clear->VAO, &clear->VBO, true, 3, 0, 0);
_mesa_meta_setup_vertex_objects(ctx, &clear->VAO, &clear->buf_obj, true,
3, 0, 0);
if (clear->ShaderProg != 0)
return;
@@ -1619,14 +1643,13 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
}
static void
meta_glsl_clear_cleanup(struct clear_state *clear)
meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear)
{
if (clear->VAO == 0)
return;
_mesa_DeleteVertexArrays(1, &clear->VAO);
clear->VAO = 0;
_mesa_DeleteBuffers(1, &clear->VBO);
clear->VBO = 0;
_mesa_reference_buffer_object(ctx, &clear->buf_obj, NULL);
_mesa_DeleteProgram(clear->ShaderProg);
clear->ShaderProg = 0;
@@ -1734,7 +1757,8 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl)
y1 = ((float) fb->_Ymax / fb->Height) * 2.0f - 1.0f;
z = -invert_z(ctx->Depth.Clear);
} else {
_mesa_meta_setup_vertex_objects(&clear->VAO, &clear->VBO, false, 3, 0, 4);
_mesa_meta_setup_vertex_objects(ctx, &clear->VAO, &clear->buf_obj, false,
3, 0, 4);
x0 = (float) fb->_Xmin;
y0 = (float) fb->_Ymin;
@@ -1817,8 +1841,8 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl)
}
/* upload new vertex data */
_mesa_BufferData(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts,
GL_DYNAMIC_DRAW_ARB);
_mesa_buffer_data(ctx, clear->buf_obj, GL_NONE, sizeof(verts), verts,
GL_DYNAMIC_DRAW, __func__);
/* draw quad(s) */
if (fb->MaxNumLayers > 0) {
@@ -1864,7 +1888,7 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
MESA_META_VERTEX |
MESA_META_VIEWPORT));
_mesa_meta_setup_vertex_objects(&copypix->VAO, &copypix->VBO, false,
_mesa_meta_setup_vertex_objects(ctx, &copypix->VAO, &copypix->buf_obj, false,
3, 2, 0);
/* Silence valgrind warnings about reading uninitialized stack. */
@@ -1904,7 +1928,8 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
verts[3].tex[1] = tex->Ttop;
/* upload new vertex data */
_mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
_mesa_buffer_sub_data(ctx, copypix->buf_obj, 0, sizeof(verts), verts,
__func__);
}
_mesa_set_enable(ctx, tex->Target, GL_TRUE);
@@ -1918,14 +1943,13 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
}
static void
meta_drawpix_cleanup(struct drawpix_state *drawpix)
meta_drawpix_cleanup(struct gl_context *ctx, struct drawpix_state *drawpix)
{
if (drawpix->VAO != 0) {
_mesa_DeleteVertexArrays(1, &drawpix->VAO);
drawpix->VAO = 0;
_mesa_DeleteBuffers(1, &drawpix->VBO);
drawpix->VBO = 0;
_mesa_reference_buffer_object(ctx, &drawpix->buf_obj, NULL);
}
if (drawpix->StencilFP != 0) {
@@ -2185,7 +2209,7 @@ _mesa_meta_DrawPixels(struct gl_context *ctx,
newTex = _mesa_meta_alloc_texture(tex, width, height, texIntFormat);
_mesa_meta_setup_vertex_objects(&drawpix->VAO, &drawpix->VBO, false,
_mesa_meta_setup_vertex_objects(ctx, &drawpix->VAO, &drawpix->buf_obj, false,
3, 2, 0);
/* Silence valgrind warnings about reading uninitialized stack. */
@@ -2222,8 +2246,8 @@ _mesa_meta_DrawPixels(struct gl_context *ctx,
}
/* upload new vertex data */
_mesa_BufferData(GL_ARRAY_BUFFER_ARB, sizeof(verts),
verts, GL_DYNAMIC_DRAW_ARB);
_mesa_buffer_data(ctx, drawpix->buf_obj, GL_NONE, sizeof(verts), verts,
GL_DYNAMIC_DRAW, __func__);
/* set given unpack params */
ctx->Unpack = *unpack;
@@ -2378,7 +2402,8 @@ _mesa_meta_Bitmap(struct gl_context *ctx,
MESA_META_VERTEX |
MESA_META_VIEWPORT));
_mesa_meta_setup_vertex_objects(&bitmap->VAO, &bitmap->VBO, false, 3, 2, 4);
_mesa_meta_setup_vertex_objects(ctx, &bitmap->VAO, &bitmap->buf_obj, false,
3, 2, 4);
newTex = _mesa_meta_alloc_texture(tex, width, height, texIntFormat);
@@ -2423,7 +2448,8 @@ _mesa_meta_Bitmap(struct gl_context *ctx,
}
/* upload new vertex data */
_mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
_mesa_buffer_sub_data(ctx, bitmap->buf_obj, 0, sizeof(verts), verts,
__func__);
}
/* choose different foreground/background alpha values */
@@ -2952,14 +2978,15 @@ meta_decompress_fbo_cleanup(struct decompress_fbo_state *decompress_fbo)
}
static void
meta_decompress_cleanup(struct decompress_state *decompress)
meta_decompress_cleanup(struct gl_context *ctx,
struct decompress_state *decompress)
{
meta_decompress_fbo_cleanup(&decompress->byteFBO);
meta_decompress_fbo_cleanup(&decompress->floatFBO);
if (decompress->VAO != 0) {
_mesa_DeleteVertexArrays(1, &decompress->VAO);
_mesa_DeleteBuffers(1, &decompress->VBO);
_mesa_reference_buffer_object(ctx, &decompress->buf_obj, NULL);
}
if (decompress->Sampler != 0)
@@ -3079,12 +3106,14 @@ decompress_texture_image(struct gl_context *ctx,
}
if (use_glsl_version) {
_mesa_meta_setup_vertex_objects(&decompress->VAO, &decompress->VBO, true,
_mesa_meta_setup_vertex_objects(ctx, &decompress->VAO,
&decompress->buf_obj, true,
2, 4, 0);
_mesa_meta_setup_blit_shader(ctx, target, false, &decompress->shaders);
} else {
_mesa_meta_setup_ff_tnl_for_blit(&decompress->VAO, &decompress->VBO, 3);
_mesa_meta_setup_ff_tnl_for_blit(ctx, &decompress->VAO,
&decompress->buf_obj, 3);
}
if (!decompress->Sampler) {
@@ -3128,7 +3157,8 @@ decompress_texture_image(struct gl_context *ctx,
_mesa_set_viewport(ctx, 0, 0, 0, width, height);
/* upload new vertex data */
_mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
_mesa_buffer_sub_data(ctx, decompress->buf_obj, 0, sizeof(verts), verts,
__func__);
/* setup texture state */
_mesa_BindTexture(target, texObj->Name);
@@ -3272,36 +3302,45 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
if (drawtex->VAO == 0) {
/* one-time setup */
GLint active_texture;
struct gl_vertex_array_object *array_obj;
/* create vertex array object */
_mesa_GenVertexArrays(1, &drawtex->VAO);
_mesa_BindVertexArray(drawtex->VAO);
/* create vertex array buffer */
_mesa_GenBuffers(1, &drawtex->VBO);
_mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, drawtex->VBO);
_mesa_BufferData(GL_ARRAY_BUFFER_ARB, sizeof(verts),
NULL, GL_DYNAMIC_DRAW_ARB);
array_obj = _mesa_lookup_vao(ctx, drawtex->VAO);
assert(array_obj != NULL);
/* client active texture is not part of the array object */
active_texture = ctx->Array.ActiveTexture;
/* create vertex array buffer */
drawtex->buf_obj = ctx->Driver.NewBufferObject(ctx, 0xDEADBEEF);
if (drawtex->buf_obj == NULL)
return;
_mesa_buffer_data(ctx, drawtex->buf_obj, GL_NONE, sizeof(verts), verts,
GL_DYNAMIC_DRAW, __func__);
/* setup vertex arrays */
_mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
_mesa_EnableClientState(GL_VERTEX_ARRAY);
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
_mesa_ClientActiveTexture(GL_TEXTURE0 + i);
_mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(st[i]));
_mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
}
_mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_POS,
3, GL_FLOAT, GL_RGBA, GL_FALSE,
GL_FALSE, GL_FALSE,
offsetof(struct vertex, x), true);
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_POS,
drawtex->buf_obj, 0, sizeof(struct vertex));
_mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_POS);
/* restore client active texture */
_mesa_ClientActiveTexture(GL_TEXTURE0 + active_texture);
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
_mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_TEX(i),
2, GL_FLOAT, GL_RGBA, GL_FALSE,
GL_FALSE, GL_FALSE,
offsetof(struct vertex, st[i]), true);
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_TEX(i),
drawtex->buf_obj, 0, sizeof(struct vertex));
_mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_TEX(i));
}
}
else {
_mesa_BindVertexArray(drawtex->VAO);
_mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, drawtex->VBO);
}
/* vertex positions, texcoords */
@@ -3366,7 +3405,8 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
verts[3].st[i][1] = t1;
}
_mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
_mesa_buffer_sub_data(ctx, drawtex->buf_obj, 0, sizeof(verts), verts,
__func__);
}
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);

View File

@@ -146,7 +146,6 @@ struct save_state
/** MESA_META_TEXTURE */
GLuint ActiveUnit;
GLuint ClientActiveUnit;
/** for unit[0] only */
struct gl_texture_object *CurrentTexture[NUM_TEXTURE_TARGETS];
/** mask of TEXTURE_2D_BIT, etc */
@@ -156,7 +155,6 @@ struct save_state
/** MESA_META_VERTEX */
struct gl_vertex_array_object *VAO;
struct gl_buffer_object *ArrayBufferObj;
/** MESA_META_VIEWPORT */
GLfloat ViewportX, ViewportY, ViewportW, ViewportH;
@@ -300,7 +298,7 @@ enum blit_msaa_shader {
struct blit_state
{
GLuint VAO;
GLuint VBO;
struct gl_buffer_object *buf_obj;
struct blit_shader_table shaders_with_depth;
struct blit_shader_table shaders_without_depth;
GLuint msaa_shaders[BLIT_MSAA_SHADER_COUNT];
@@ -322,7 +320,7 @@ struct fb_tex_blit_state
struct clear_state
{
GLuint VAO;
GLuint VBO;
struct gl_buffer_object *buf_obj;
GLuint ShaderProg;
GLint ColorLocation;
GLint LayerLocation;
@@ -339,7 +337,7 @@ struct clear_state
struct copypix_state
{
GLuint VAO;
GLuint VBO;
struct gl_buffer_object *buf_obj;
};
@@ -349,7 +347,7 @@ struct copypix_state
struct drawpix_state
{
GLuint VAO;
GLuint VBO;
struct gl_buffer_object *buf_obj;
GLuint StencilFP; /**< Fragment program for drawing stencil images */
GLuint DepthFP; /**< Fragment program for drawing depth images */
@@ -362,7 +360,7 @@ struct drawpix_state
struct bitmap_state
{
GLuint VAO;
GLuint VBO;
struct gl_buffer_object *buf_obj;
struct temp_texture Tex; /**< separate texture from other meta ops */
};
@@ -372,7 +370,7 @@ struct bitmap_state
struct gen_mipmap_state
{
GLuint VAO;
GLuint VBO;
struct gl_buffer_object *buf_obj;
GLuint FBO;
GLuint Sampler;
@@ -396,7 +394,8 @@ struct decompress_state
{
GLuint VAO;
struct decompress_fbo_state byteFBO, floatFBO;
GLuint VBO, Sampler;
struct gl_buffer_object *buf_obj;
GLuint Sampler;
struct blit_shader_table shaders;
};
@@ -407,7 +406,7 @@ struct decompress_state
struct drawtex_state
{
GLuint VAO;
GLuint VBO;
struct gl_buffer_object *buf_obj;
};
#define MAX_META_OPS_DEPTH 8
@@ -620,13 +619,15 @@ struct temp_texture *
_mesa_meta_get_temp_depth_texture(struct gl_context *ctx);
void
_mesa_meta_setup_vertex_objects(GLuint *VAO, GLuint *VBO,
_mesa_meta_setup_vertex_objects(struct gl_context *ctx,
GLuint *VAO, struct gl_buffer_object **buf_obj,
bool use_generic_attributes,
unsigned vertex_size, unsigned texcoord_size,
unsigned color_size);
void
_mesa_meta_setup_ff_tnl_for_blit(GLuint *VAO, GLuint *VBO,
_mesa_meta_setup_ff_tnl_for_blit(struct gl_context *ctx,
GLuint *VAO, struct gl_buffer_object **buf_obj,
unsigned texcoord_size);
void
@@ -652,13 +653,14 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx,
struct blit_shader_table *table);
void
_mesa_meta_glsl_blit_cleanup(struct blit_state *blit);
_mesa_meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit);
void
_mesa_meta_blit_shader_table_cleanup(struct blit_shader_table *table);
void
_mesa_meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap);
_mesa_meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx,
struct gen_mipmap_state *mipmap);
void
_mesa_meta_bind_fbo_image(GLenum target, GLenum attachment,

View File

@@ -565,7 +565,7 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
texcoord_size = 2 + (src_rb->Depth > 1 ? 1 : 0);
_mesa_meta_setup_vertex_objects(&blit->VAO, &blit->VBO, true,
_mesa_meta_setup_vertex_objects(ctx, &blit->VAO, &blit->buf_obj, true,
2, texcoord_size, 0);
if (is_target_multisample && is_filter_scaled_resolve && is_scaled_blit) {
@@ -691,8 +691,9 @@ blitframebuffer_texture(struct gl_context *ctx,
do_depth);
}
else {
_mesa_meta_setup_ff_tnl_for_blit(&ctx->Meta->Blit.VAO,
&ctx->Meta->Blit.VBO,
_mesa_meta_setup_ff_tnl_for_blit(ctx,
&ctx->Meta->Blit.VAO,
&ctx->Meta->Blit.buf_obj,
2);
}
@@ -789,7 +790,8 @@ blitframebuffer_texture(struct gl_context *ctx,
verts[3].tex[1] = t1;
verts[3].tex[2] = readAtt->Zoffset;
_mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
_mesa_buffer_sub_data(ctx, blit->buf_obj, 0, sizeof(verts), verts,
__func__);
}
/* setup viewport */
@@ -1004,13 +1006,12 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
}
void
_mesa_meta_glsl_blit_cleanup(struct blit_state *blit)
_mesa_meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit)
{
if (blit->VAO) {
_mesa_DeleteVertexArrays(1, &blit->VAO);
blit->VAO = 0;
_mesa_DeleteBuffers(1, &blit->VBO);
blit->VBO = 0;
_mesa_reference_buffer_object(ctx, &blit->buf_obj, NULL);
}
_mesa_meta_blit_shader_table_cleanup(&blit->shaders_with_depth);

View File

@@ -120,14 +120,14 @@ fallback_required(struct gl_context *ctx, GLenum target,
}
void
_mesa_meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap)
_mesa_meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx,
struct gen_mipmap_state *mipmap)
{
if (mipmap->VAO == 0)
return;
_mesa_DeleteVertexArrays(1, &mipmap->VAO);
mipmap->VAO = 0;
_mesa_DeleteBuffers(1, &mipmap->VBO);
mipmap->VBO = 0;
_mesa_reference_buffer_object(ctx, &mipmap->buf_obj, NULL);
_mesa_DeleteSamplers(1, &mipmap->Sampler);
mipmap->Sampler = 0;
@@ -196,11 +196,11 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
* GenerateMipmap function.
*/
if (use_glsl_version) {
_mesa_meta_setup_vertex_objects(&mipmap->VAO, &mipmap->VBO, true,
_mesa_meta_setup_vertex_objects(ctx, &mipmap->VAO, &mipmap->buf_obj, true,
2, 4, 0);
_mesa_meta_setup_blit_shader(ctx, target, false, &mipmap->shaders);
} else {
_mesa_meta_setup_ff_tnl_for_blit(&mipmap->VAO, &mipmap->VBO, 3);
_mesa_meta_setup_ff_tnl_for_blit(ctx, &mipmap->VAO, &mipmap->buf_obj, 3);
_mesa_set_enable(ctx, target, GL_TRUE);
}
@@ -335,8 +335,8 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
verts[3].tex);
/* upload vertex data */
_mesa_BufferData(GL_ARRAY_BUFFER_ARB, sizeof(verts),
verts, GL_DYNAMIC_DRAW_ARB);
_mesa_buffer_data(ctx, mipmap->buf_obj, GL_NONE, sizeof(verts), verts,
GL_DYNAMIC_DRAW, __func__);
_mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, dstImage, layer);

View File

@@ -69,7 +69,7 @@ create_texture_for_pbo(struct gl_context *ctx,
int dims, int width, int height, int depth,
GLenum format, GLenum type, const void *pixels,
const struct gl_pixelstore_attrib *packing,
GLuint *tmp_pbo, GLuint *tmp_tex)
struct gl_buffer_object **tmp_pbo, GLuint *tmp_tex)
{
uint32_t pbo_format;
GLenum internal_format;
@@ -101,7 +101,7 @@ create_texture_for_pbo(struct gl_context *ctx,
row_stride = _mesa_image_row_stride(packing, width, format, type);
if (_mesa_is_bufferobj(packing->BufferObj)) {
*tmp_pbo = 0;
*tmp_pbo = NULL;
buffer_obj = packing->BufferObj;
first_pixel += (intptr_t)pixels;
} else {
@@ -109,32 +109,28 @@ create_texture_for_pbo(struct gl_context *ctx,
assert(create_pbo);
_mesa_GenBuffers(1, tmp_pbo);
/* We are not doing this inside meta_begin/end. However, we know the
* client doesn't have the given target bound, so we can go ahead and
* squash it. We'll set it back when we're done.
*/
_mesa_BindBuffer(pbo_target, *tmp_pbo);
*tmp_pbo = ctx->Driver.NewBufferObject(ctx, 0xDEADBEEF);
if (*tmp_pbo == NULL)
return NULL;
/* In case of GL_PIXEL_PACK_BUFFER, pass null pointer for the pixel
* data to avoid unnecessary data copying in _mesa_BufferData().
* data to avoid unnecessary data copying in _mesa_buffer_data.
*/
if (is_pixel_pack)
_mesa_BufferData(pbo_target,
last_pixel - first_pixel,
NULL,
GL_STREAM_READ);
_mesa_buffer_data(ctx, *tmp_pbo, GL_NONE,
last_pixel - first_pixel,
NULL,
GL_STREAM_READ,
__func__);
else
_mesa_BufferData(pbo_target,
last_pixel - first_pixel,
(char *)pixels + first_pixel,
GL_STREAM_DRAW);
_mesa_buffer_data(ctx, *tmp_pbo, GL_NONE,
last_pixel - first_pixel,
(char *)pixels + first_pixel,
GL_STREAM_DRAW,
__func__);
buffer_obj = packing->BufferObj;
buffer_obj = *tmp_pbo;
first_pixel = 0;
_mesa_BindBuffer(pbo_target, 0);
}
_mesa_GenTextures(1, tmp_tex);
@@ -165,7 +161,7 @@ create_texture_for_pbo(struct gl_context *ctx,
row_stride,
read_only)) {
_mesa_DeleteTextures(1, tmp_tex);
_mesa_DeleteBuffers(1, tmp_pbo);
_mesa_reference_buffer_object(ctx, tmp_pbo, NULL);
return NULL;
}
@@ -181,7 +177,8 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,
bool allocate_storage, bool create_pbo,
const struct gl_pixelstore_attrib *packing)
{
GLuint pbo = 0, pbo_tex = 0, fbos[2] = { 0, 0 };
struct gl_buffer_object *pbo = NULL;
GLuint pbo_tex = 0, fbos[2] = { 0, 0 };
int image_height;
struct gl_texture_image *pbo_tex_image;
GLenum status;
@@ -284,7 +281,7 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,
fail:
_mesa_DeleteFramebuffers(2, fbos);
_mesa_DeleteTextures(1, &pbo_tex);
_mesa_DeleteBuffers(1, &pbo);
_mesa_reference_buffer_object(ctx, &pbo, NULL);
_mesa_meta_end(ctx);
@@ -299,7 +296,8 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
GLenum format, GLenum type, const void *pixels,
const struct gl_pixelstore_attrib *packing)
{
GLuint pbo = 0, pbo_tex = 0, fbos[2] = { 0, 0 };
struct gl_buffer_object *pbo = NULL;
GLuint pbo_tex = 0, fbos[2] = { 0, 0 };
int image_height;
struct gl_texture_image *pbo_tex_image;
struct gl_renderbuffer *rb = NULL;
@@ -456,7 +454,7 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
fail:
_mesa_DeleteFramebuffers(2, fbos);
_mesa_DeleteTextures(1, &pbo_tex);
_mesa_DeleteBuffers(1, &pbo);
_mesa_reference_buffer_object(ctx, &pbo, NULL);
_mesa_meta_end(ctx);

View File

@@ -1055,33 +1055,19 @@ fs_visitor::emit_linterp(const fs_reg &attr, const fs_reg &interp,
}
void
fs_visitor::emit_general_interpolation(fs_reg attr, const char *name,
fs_visitor::emit_general_interpolation(fs_reg *attr, const char *name,
const glsl_type *type,
glsl_interp_qualifier interpolation_mode,
int location, bool mod_centroid,
int *location, bool mod_centroid,
bool mod_sample)
{
attr.type = brw_type_for_base_type(type->get_scalar_type());
assert(stage == MESA_SHADER_FRAGMENT);
brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data;
brw_wm_prog_key *key = (brw_wm_prog_key*) this->key;
unsigned int array_elements;
if (type->is_array()) {
array_elements = type->arrays_of_arrays_size();
if (array_elements == 0) {
fail("dereferenced array '%s' has length 0\n", name);
}
type = type->without_array();
} else {
array_elements = 1;
}
if (interpolation_mode == INTERP_QUALIFIER_NONE) {
bool is_gl_Color =
location == VARYING_SLOT_COL0 || location == VARYING_SLOT_COL1;
*location == VARYING_SLOT_COL0 || *location == VARYING_SLOT_COL1;
if (key->flat_shade && is_gl_Color) {
interpolation_mode = INTERP_QUALIFIER_FLAT;
} else {
@@ -1089,71 +1075,86 @@ fs_visitor::emit_general_interpolation(fs_reg attr, const char *name,
}
}
for (unsigned int i = 0; i < array_elements; i++) {
for (unsigned int j = 0; j < type->matrix_columns; j++) {
if (prog_data->urb_setup[location] == -1) {
/* If there's no incoming setup data for this slot, don't
* emit interpolation for it.
*/
attr = offset(attr, bld, type->vector_elements);
location++;
continue;
}
if (type->is_array() || type->is_matrix()) {
const glsl_type *elem_type = glsl_get_array_element(type);
const unsigned length = glsl_get_length(type);
if (interpolation_mode == INTERP_QUALIFIER_FLAT) {
/* Constant interpolation (flat shading) case. The SF has
* handed us defined values in only the constant offset
* field of the setup reg.
*/
for (unsigned int k = 0; k < type->vector_elements; k++) {
struct brw_reg interp = interp_reg(location, k);
interp = suboffset(interp, 3);
interp.type = attr.type;
bld.emit(FS_OPCODE_CINTERP, attr, fs_reg(interp));
attr = offset(attr, bld, 1);
}
} else {
/* Smooth/noperspective interpolation case. */
for (unsigned int k = 0; k < type->vector_elements; k++) {
struct brw_reg interp = interp_reg(location, k);
if (devinfo->needs_unlit_centroid_workaround && mod_centroid) {
/* Get the pixel/sample mask into f0 so that we know
* which pixels are lit. Then, for each channel that is
* unlit, replace the centroid data with non-centroid
* data.
*/
bld.emit(FS_OPCODE_MOV_DISPATCH_TO_FLAGS);
fs_inst *inst;
inst = emit_linterp(attr, fs_reg(interp), interpolation_mode,
false, false);
inst->predicate = BRW_PREDICATE_NORMAL;
inst->predicate_inverse = true;
if (devinfo->has_pln)
inst->no_dd_clear = true;
inst = emit_linterp(attr, fs_reg(interp), interpolation_mode,
mod_centroid && !key->persample_shading,
mod_sample || key->persample_shading);
inst->predicate = BRW_PREDICATE_NORMAL;
inst->predicate_inverse = false;
if (devinfo->has_pln)
inst->no_dd_check = true;
} else {
emit_linterp(attr, fs_reg(interp), interpolation_mode,
mod_centroid && !key->persample_shading,
mod_sample || key->persample_shading);
}
if (devinfo->gen < 6 && interpolation_mode == INTERP_QUALIFIER_SMOOTH) {
bld.MUL(attr, attr, this->pixel_w);
}
attr = offset(attr, bld, 1);
}
}
location++;
for (unsigned i = 0; i < length; i++) {
emit_general_interpolation(attr, name, elem_type, interpolation_mode,
location, mod_centroid, mod_sample);
}
} else if (type->is_record()) {
for (unsigned i = 0; i < type->length; i++) {
const glsl_type *field_type = type->fields.structure[i].type;
emit_general_interpolation(attr, name, field_type, interpolation_mode,
location, mod_centroid, mod_sample);
}
} else {
assert(type->is_scalar() || type->is_vector());
if (prog_data->urb_setup[*location] == -1) {
/* If there's no incoming setup data for this slot, don't
* emit interpolation for it.
*/
*attr = offset(*attr, bld, type->vector_elements);
(*location)++;
return;
}
attr->type = brw_type_for_base_type(type->get_scalar_type());
if (interpolation_mode == INTERP_QUALIFIER_FLAT) {
/* Constant interpolation (flat shading) case. The SF has
* handed us defined values in only the constant offset
* field of the setup reg.
*/
for (unsigned int i = 0; i < type->vector_elements; i++) {
struct brw_reg interp = interp_reg(*location, i);
interp = suboffset(interp, 3);
interp.type = attr->type;
bld.emit(FS_OPCODE_CINTERP, *attr, fs_reg(interp));
*attr = offset(*attr, bld, 1);
}
} else {
/* Smooth/noperspective interpolation case. */
for (unsigned int i = 0; i < type->vector_elements; i++) {
struct brw_reg interp = interp_reg(*location, i);
if (devinfo->needs_unlit_centroid_workaround && mod_centroid) {
/* Get the pixel/sample mask into f0 so that we know
* which pixels are lit. Then, for each channel that is
* unlit, replace the centroid data with non-centroid
* data.
*/
bld.emit(FS_OPCODE_MOV_DISPATCH_TO_FLAGS);
fs_inst *inst;
inst = emit_linterp(*attr, fs_reg(interp), interpolation_mode,
false, false);
inst->predicate = BRW_PREDICATE_NORMAL;
inst->predicate_inverse = true;
if (devinfo->has_pln)
inst->no_dd_clear = true;
inst = emit_linterp(*attr, fs_reg(interp), interpolation_mode,
mod_centroid && !key->persample_shading,
mod_sample || key->persample_shading);
inst->predicate = BRW_PREDICATE_NORMAL;
inst->predicate_inverse = false;
if (devinfo->has_pln)
inst->no_dd_check = true;
} else {
emit_linterp(*attr, fs_reg(interp), interpolation_mode,
mod_centroid && !key->persample_shading,
mod_sample || key->persample_shading);
}
if (devinfo->gen < 6 && interpolation_mode == INTERP_QUALIFIER_SMOOTH) {
bld.MUL(*attr, *attr, this->pixel_w);
}
*attr = offset(*attr, bld, 1);
}
}
(*location)++;
}
}

View File

@@ -209,10 +209,10 @@ public:
fs_reg *emit_frontfacing_interpolation();
fs_reg *emit_samplepos_setup();
fs_reg *emit_sampleid_setup();
void emit_general_interpolation(fs_reg attr, const char *name,
void emit_general_interpolation(fs_reg *attr, const char *name,
const glsl_type *type,
glsl_interp_qualifier interpolation_mode,
int location, bool mod_centroid,
int *location, bool mod_centroid,
bool mod_sample);
fs_reg *emit_vs_system_value(int location);
void emit_interpolation_setup_gen4();
@@ -250,6 +250,8 @@ public:
void emit_nir_code();
void nir_setup_inputs();
void nir_setup_single_output_varying(fs_reg *reg, const glsl_type *type,
unsigned *location);
void nir_setup_outputs();
void nir_setup_uniforms();
void nir_emit_system_values();

View File

@@ -81,14 +81,41 @@ fs_visitor::nir_setup_inputs()
reg.type = BRW_REGISTER_TYPE_D;
bld.emit(FS_OPCODE_CINTERP, retype(input, BRW_REGISTER_TYPE_D), reg);
} else {
emit_general_interpolation(input, var->name, var->type,
int location = var->data.location;
emit_general_interpolation(&input, var->name, var->type,
(glsl_interp_qualifier) var->data.interpolation,
var->data.location, var->data.centroid,
&location, var->data.centroid,
var->data.sample);
}
}
}
void
fs_visitor::nir_setup_single_output_varying(fs_reg *reg,
const glsl_type *type,
unsigned *location)
{
if (type->is_array() || type->is_matrix()) {
const struct glsl_type *elem_type = glsl_get_array_element(type);
const unsigned length = glsl_get_length(type);
for (unsigned i = 0; i < length; i++) {
nir_setup_single_output_varying(reg, elem_type, location);
}
} else if (type->is_record()) {
for (unsigned i = 0; i < type->length; i++) {
const struct glsl_type *field_type = type->fields.structure[i].type;
nir_setup_single_output_varying(reg, field_type, location);
}
} else {
assert(type->is_scalar() || type->is_vector());
this->outputs[*location] = *reg;
this->output_components[*location] = type->vector_elements;
*reg = offset(*reg, bld, 4);
(*location)++;
}
}
void
fs_visitor::nir_setup_outputs()
{
@@ -99,17 +126,13 @@ fs_visitor::nir_setup_outputs()
nir_foreach_variable(var, &nir->outputs) {
fs_reg reg = offset(nir_outputs, bld, var->data.driver_location);
int vector_elements = var->type->without_array()->vector_elements;
switch (stage) {
case MESA_SHADER_VERTEX:
case MESA_SHADER_GEOMETRY:
for (int i = 0; i < type_size_vec4(var->type); i++) {
int output = var->data.location + i;
this->outputs[output] = offset(reg, bld, 4 * i);
this->output_components[output] = vector_elements;
}
case MESA_SHADER_GEOMETRY: {
unsigned location = var->data.location;
nir_setup_single_output_varying(&reg, var->type, &location);
break;
}
case MESA_SHADER_FRAGMENT:
if (var->data.index > 0) {
assert(var->data.location == FRAG_RESULT_DATA0);
@@ -129,6 +152,8 @@ fs_visitor::nir_setup_outputs()
} else if (var->data.location == FRAG_RESULT_SAMPLE_MASK) {
this->sample_mask = reg;
} else {
int vector_elements = var->type->without_array()->vector_elements;
/* gl_FragData or a user-defined FS output */
assert(var->data.location >= FRAG_RESULT_DATA0 &&
var->data.location < FRAG_RESULT_DATA0+BRW_MAX_DRAW_BUFFERS);

View File

@@ -54,8 +54,9 @@
#include "brw_blorp.h"
struct brw_fast_clear_state {
struct gl_buffer_object *buf_obj;
struct gl_vertex_array_object *array_obj;
GLuint vao;
GLuint vbo;
GLuint shader_prog;
GLint color_location;
};
@@ -64,11 +65,11 @@ static bool
brw_fast_clear_init(struct brw_context *brw)
{
struct brw_fast_clear_state *clear;
struct gl_context *ctx = &brw->ctx;
if (brw->fast_clear_state) {
clear = brw->fast_clear_state;
_mesa_BindVertexArray(clear->vao);
_mesa_BindBuffer(GL_ARRAY_BUFFER, clear->vbo);
return true;
}
@@ -79,10 +80,21 @@ brw_fast_clear_init(struct brw_context *brw)
memset(clear, 0, sizeof *clear);
_mesa_GenVertexArrays(1, &clear->vao);
_mesa_BindVertexArray(clear->vao);
_mesa_GenBuffers(1, &clear->vbo);
_mesa_BindBuffer(GL_ARRAY_BUFFER, clear->vbo);
_mesa_VertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, 0);
_mesa_EnableVertexAttribArray(0);
clear->buf_obj = ctx->Driver.NewBufferObject(ctx, 0xDEADBEEF);
if (clear->buf_obj == NULL)
return false;
clear->array_obj = _mesa_lookup_vao(ctx, clear->vao);
assert(clear->array_obj != NULL);
_mesa_update_array_format(ctx, clear->array_obj, VERT_ATTRIB_GENERIC(0),
2, GL_FLOAT, GL_RGBA, GL_FALSE, GL_FALSE, GL_FALSE,
0, true);
_mesa_bind_vertex_buffer(ctx, clear->array_obj, VERT_ATTRIB_GENERIC(0),
clear->buf_obj, 0, sizeof(float) * 2);
_mesa_enable_vertex_array_attrib(ctx, clear->array_obj,
VERT_ATTRIB_GENERIC(0));
return true;
}
@@ -150,7 +162,7 @@ brw_meta_fast_clear_free(struct brw_context *brw)
_mesa_make_current(&brw->ctx, NULL, NULL);
_mesa_DeleteVertexArrays(1, &clear->vao);
_mesa_DeleteBuffers(1, &clear->vbo);
_mesa_reference_buffer_object(&brw->ctx, &clear->buf_obj, NULL);
_mesa_DeleteProgram(clear->shader_prog);
free(clear);
@@ -165,8 +177,10 @@ struct rect {
};
static void
brw_draw_rectlist(struct gl_context *ctx, struct rect *rect, int num_instances)
brw_draw_rectlist(struct brw_context *brw, struct rect *rect, int num_instances)
{
struct gl_context *ctx = &brw->ctx;
struct brw_fast_clear_state *clear = brw->fast_clear_state;
int start = 0, count = 3;
struct _mesa_prim prim;
float verts[6];
@@ -179,8 +193,8 @@ brw_draw_rectlist(struct gl_context *ctx, struct rect *rect, int num_instances)
verts[5] = rect->y0;
/* upload new vertex data */
_mesa_BufferData(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts,
GL_DYNAMIC_DRAW_ARB);
_mesa_buffer_data(ctx, clear->buf_obj, GL_NONE, sizeof(verts), verts,
GL_DYNAMIC_DRAW, __func__);
if (ctx->NewState)
_mesa_update_state(ctx);
@@ -380,13 +394,43 @@ set_fast_clear_color(struct brw_context *brw,
struct intel_mipmap_tree *mt,
const union gl_color_union *color)
{
union gl_color_union override_color = *color;
/* The sampler doesn't look at the format of the surface when the fast
* clear color is used so we need to implement luminance, intensity and
* missing components manually.
*/
switch (_mesa_get_format_base_format(mt->format)) {
case GL_INTENSITY:
override_color.ui[3] = override_color.ui[0];
/* flow through */
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:
override_color.ui[1] = override_color.ui[0];
override_color.ui[2] = override_color.ui[0];
break;
default:
for (int i = 0; i < 3; i++) {
if (!_mesa_format_has_color_component(mt->format, i))
override_color.ui[i] = 0;
}
break;
}
if (!_mesa_format_has_color_component(mt->format, 3)) {
if (_mesa_is_format_integer_color(mt->format))
override_color.ui[3] = 1;
else
override_color.f[3] = 1.0f;
}
if (brw->gen >= 9) {
mt->gen9_fast_clear_color = *color;
mt->gen9_fast_clear_color = override_color;
} else {
mt->fast_clear_color_value = 0;
for (int i = 0; i < 4; i++) {
/* Testing for non-0 works for integer and float colors */
if (color->f[i] != 0.0f) {
if (override_color.f[i] != 0.0f) {
mt->fast_clear_color_value |=
1 << (GEN7_SURFACE_CLEAR_COLOR_SHIFT + (3 - i));
}
@@ -664,7 +708,7 @@ brw_meta_fast_clear(struct brw_context *brw, struct gl_framebuffer *fb,
_mesa_meta_drawbuffers_from_bitfield(fast_clear_buffers);
brw_bind_rep_write_shader(brw, (float *) fast_clear_color);
set_fast_clear_op(brw, GEN7_PS_RENDER_TARGET_FAST_CLEAR_ENABLE);
brw_draw_rectlist(ctx, &fast_clear_rect, layers);
brw_draw_rectlist(brw, &fast_clear_rect, layers);
set_fast_clear_op(brw, 0);
/* Now set the mcs we cleared to INTEL_FAST_CLEAR_STATE_CLEAR so we'll
@@ -683,7 +727,7 @@ brw_meta_fast_clear(struct brw_context *brw, struct gl_framebuffer *fb,
if (rep_clear_buffers) {
_mesa_meta_drawbuffers_from_bitfield(rep_clear_buffers);
brw_bind_rep_write_shader(brw, ctx->Color.ClearColor.f);
brw_draw_rectlist(ctx, &clear_rect, layers);
brw_draw_rectlist(brw, &clear_rect, layers);
}
bail_to_meta:
@@ -788,7 +832,7 @@ brw_meta_resolve_color(struct brw_context *brw,
mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;
get_resolve_rect(brw, mt, &rect);
brw_draw_rectlist(ctx, &rect, 1);
brw_draw_rectlist(brw, &rect, 1);
set_fast_clear_op(brw, 0);
use_rectlist(brw, false);

View File

@@ -286,7 +286,8 @@ setup_program(struct brw_context *brw, bool msaa_tex)
char *fs_source;
const struct sampler_and_fetch *sampler = &samplers[msaa_tex];
_mesa_meta_setup_vertex_objects(&blit->VAO, &blit->VBO, true, 2, 2, 0);
_mesa_meta_setup_vertex_objects(&brw->ctx, &blit->VAO, &blit->buf_obj, true,
2, 2, 0);
GLuint *prog_id = &brw->meta_stencil_blit_programs[msaa_tex];
@@ -372,7 +373,7 @@ adjust_mip_level(const struct intel_mipmap_tree *mt,
}
static void
prepare_vertex_data(void)
prepare_vertex_data(struct gl_context *ctx, struct gl_buffer_object *buf_obj)
{
static const struct vertex verts[] = {
{ .x = -1.0f, .y = -1.0f },
@@ -380,7 +381,7 @@ prepare_vertex_data(void)
{ .x = 1.0f, .y = 1.0f },
{ .x = -1.0f, .y = 1.0f } };
_mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
_mesa_buffer_sub_data(ctx, buf_obj, 0, sizeof(verts), verts, __func__);
}
static bool
@@ -460,7 +461,7 @@ brw_meta_stencil_blit(struct brw_context *brw,
_mesa_Uniform1i(_mesa_GetUniformLocation(prog, "dst_num_samples"),
dst_mt->num_samples);
prepare_vertex_data();
prepare_vertex_data(ctx, ctx->Meta->Blit.buf_obj);
_mesa_set_viewport(ctx, 0, dims.dst_x0, dims.dst_y0,
dims.dst_x1 - dims.dst_x0, dims.dst_y1 - dims.dst_y0);
_mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);

View File

@@ -40,7 +40,6 @@
struct gl_extensions _mesa_extension_override_enables;
struct gl_extensions _mesa_extension_override_disables;
static char *extra_extensions = NULL;
static char *cant_disable_extensions = NULL;
/**
@@ -68,29 +67,30 @@ const struct mesa_extension _mesa_extension_table[] = {
#undef EXT
};
static bool disabled_extensions[ARRAY_SIZE(_mesa_extension_table)];
/**
* Given an extension name, lookup up the corresponding member of struct
* gl_extensions and return that member's offset (in bytes). If the name is
* not found in the \c _mesa_extension_table, return 0.
* gl_extensions and return that member's index. If the name is
* not found in the \c _mesa_extension_table, return -1.
*
* \param name Name of extension.
* \return Offset of member in struct gl_extensions.
* \return Index of member in struct gl_extensions.
*/
static size_t
name_to_offset(const char* name)
static int
name_to_index(const char* name)
{
unsigned i;
if (name == 0)
return 0;
return -1;
for (i = 0; i < ARRAY_SIZE(_mesa_extension_table); ++i) {
if (strcmp(name, _mesa_extension_table[i].name) == 0)
return _mesa_extension_table[i].offset;
return i;
}
return 0;
return -1;
}
/**
@@ -206,11 +206,11 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
* \return offset of extensions withint `ext' or 0 if extension is not known
*/
static size_t
set_extension(struct gl_extensions *ext, const char *name, GLboolean state)
set_extension(struct gl_extensions *ext, int i, GLboolean state)
{
size_t offset;
offset = name_to_offset(name);
offset = i < 0 ? 0 : _mesa_extension_table[i].offset;
if (offset != 0 && (offset != o(dummy_true) || state != GL_FALSE)) {
((GLboolean *) ext)[offset] = state;
}
@@ -240,12 +240,6 @@ get_extension_override( struct gl_context *ctx )
{
override_extensions_in_context(ctx);
if (cant_disable_extensions != NULL) {
_mesa_problem(ctx,
"Trying to disable permanently enabled extensions: %s",
cant_disable_extensions);
}
if (extra_extensions == NULL) {
return calloc(1, sizeof(char));
} else {
@@ -257,7 +251,7 @@ get_extension_override( struct gl_context *ctx )
/**
* \brief Free extra_extensions and cant_disable_extensions strings
* \brief Free extra_extensions string
*
* These strings are allocated early during the first context creation by
* _mesa_one_time_init_extension_overrides.
@@ -266,7 +260,6 @@ static void
free_unknown_extensions_strings(void)
{
free(extra_extensions);
free(cant_disable_extensions);
}
@@ -295,22 +288,20 @@ _mesa_one_time_init_extension_overrides(void)
/* extra_exts: List of unrecognized extensions. */
extra_extensions = calloc(ALIGN(strlen(env_const) + 2, 4), sizeof(char));
cant_disable_extensions = calloc(ALIGN(strlen(env_const) + 2, 4), sizeof(char));
/* Copy env_const because strtok() is destructive. */
env = strdup(env_const);
if (env == NULL ||
extra_extensions == NULL ||
cant_disable_extensions == NULL) {
extra_extensions == NULL) {
free(env);
free(extra_extensions);
free(cant_disable_extensions);
return;
}
for (ext = strtok(env, " "); ext != NULL; ext = strtok(NULL, " ")) {
int enable;
int i;
bool recognized;
switch (ext[0]) {
case '+':
@@ -326,7 +317,8 @@ _mesa_one_time_init_extension_overrides(void)
break;
}
offset = set_extension(&_mesa_extension_override_enables, ext, enable);
i = name_to_index(ext);
offset = set_extension(&_mesa_extension_override_enables, i, enable);
if (offset != 0 && (offset != o(dummy_true) || enable != GL_FALSE)) {
((GLboolean *) &_mesa_extension_override_disables)[offset] = !enable;
recognized = true;
@@ -334,14 +326,12 @@ _mesa_one_time_init_extension_overrides(void)
recognized = false;
}
if (!recognized) {
if (enable) {
strcat(extra_extensions, ext);
strcat(extra_extensions, " ");
} else if (offset == o(dummy_true)) {
strcat(cant_disable_extensions, ext);
strcat(cant_disable_extensions, " ");
}
if (i >= 0)
disabled_extensions[i] = !enable;
if (!recognized && enable) {
strcat(extra_extensions, ext);
strcat(extra_extensions, " ");
}
}
@@ -355,13 +345,6 @@ _mesa_one_time_init_extension_overrides(void)
} else if (extra_extensions[len - 1] == ' ') {
extra_extensions[len - 1] = '\0';
}
len = strlen(cant_disable_extensions);
if (len == 0) {
free(cant_disable_extensions);
cant_disable_extensions = NULL;
} else if (cant_disable_extensions[len - 1] == ' ') {
cant_disable_extensions[len - 1] = '\0';
}
}
@@ -402,7 +385,8 @@ _mesa_extension_supported(const struct gl_context *ctx, extension_index i)
const bool *base = (bool *) &ctx->Extensions;
const struct mesa_extension *ext = _mesa_extension_table + i;
return (ctx->Version >= ext->version[ctx->API]) && base[ext->offset];
return !disabled_extensions[i] &&
(ctx->Version >= ext->version[ctx->API]) && base[ext->offset];
}
/**

View File

@@ -2077,12 +2077,18 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
* \return error code, or GL_NO_ERROR.
*/
GLenum
_mesa_es_error_check_format_and_type(GLenum format, GLenum type,
_mesa_es_error_check_format_and_type(const struct gl_context *ctx,
GLenum format, GLenum type,
unsigned dimensions)
{
GLboolean type_valid = GL_TRUE;
switch (format) {
case GL_RED:
case GL_RG:
if (ctx->API == API_OPENGLES || !ctx->Extensions.ARB_texture_rg)
return GL_INVALID_VALUE;
/* fallthrough */
case GL_ALPHA:
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:

View File

@@ -127,7 +127,8 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
GLenum format, GLenum type);
extern GLenum
_mesa_es_error_check_format_and_type(GLenum format, GLenum type,
_mesa_es_error_check_format_and_type(const struct gl_context *ctx,
GLenum format, GLenum type,
unsigned dimensions);
extern GLenum

View File

@@ -645,8 +645,7 @@ _mesa_GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
*params = pipe->InfoLog ? strlen(pipe->InfoLog) + 1 : 0;
return;
case GL_VALIDATE_STATUS:
/* If pipeline is not bound, return initial value 0. */
*params = (ctx->_Shader->Name != pipe->Name) ? 0 : pipe->Validated;
*params = pipe->Validated;
return;
case GL_VERTEX_SHADER:
*params = pipe->CurrentProgram[MESA_SHADER_VERTEX]
@@ -762,6 +761,7 @@ _mesa_validate_program_pipeline(struct gl_context* ctx,
GLboolean IsBound)
{
unsigned i;
bool program_empty = true;
pipe->Validated = GL_FALSE;
@@ -858,6 +858,29 @@ _mesa_validate_program_pipeline(struct gl_context* ctx,
}
}
/* Section 11.1.3.11 (Validation) of the OpenGL 4.5 spec says:
*
* "An INVALID_OPERATION error is generated by any command that trans-
* fers vertices to the GL or launches compute work if the current set
* of active program objects cannot be executed, for reasons including:
*
* ...
*
* - There is no current program object specified by UseProgram,
* there is a current program pipeline object, and that object is
* empty (no executable code is installed for any stage).
*/
for (i = 0; i < MESA_SHADER_STAGES; i++) {
if (pipe->CurrentProgram[i]) {
program_empty = false;
break;
}
}
if (program_empty) {
goto err;
}
/* Section 2.11.11 (Shader Execution), subheading "Validation," of the
* OpenGL 4.1 spec says:
*

View File

@@ -1043,7 +1043,7 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
_mesa_get_color_read_type(ctx) == type) {
err = GL_NO_ERROR;
} else if (ctx->Version < 30) {
err = _mesa_es_error_check_format_and_type(format, type, 2);
err = _mesa_es_error_check_format_and_type(ctx, format, type, 2);
if (err == GL_NO_ERROR) {
if (type == GL_FLOAT || type == GL_HALF_FLOAT_OES) {
err = GL_INVALID_OPERATION;

View File

@@ -88,12 +88,6 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions,
return;
}
if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
depth = height;
height = 1;
}
assert(zoffset + depth <= texImage->Depth);
for (img = 0; img < depth; img++) {
GLubyte *srcMap;
GLint srcRowStride;
@@ -141,7 +135,6 @@ get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions,
assert(type == GL_UNSIGNED_INT_24_8 ||
type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
assert(zoffset + depth <= texImage->Depth);
for (img = 0; img < depth; img++) {
GLubyte *srcMap;
GLint rowstride;
@@ -233,7 +226,6 @@ get_tex_ycbcr(struct gl_context *ctx, GLuint dimensions,
{
GLint img, row;
assert(zoffset + depth <= texImage->Depth);
for (img = 0; img < depth; img++) {
GLubyte *srcMap;
GLint rowstride;
@@ -431,13 +423,6 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
bool needsRebase;
void *rgba = NULL;
if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
depth = height;
height = 1;
zoffset = yoffset;
yoffset = 0;
}
/* Depending on the base format involved we may need to apply a rebase
* transform (for example: if we download to a Luminance format we want
* G=0 and B=0).
@@ -737,6 +722,17 @@ _mesa_GetTexSubImage_sw(struct gl_context *ctx,
pixels = ADD_POINTERS(buf, pixels);
}
/* for all array textures, the Z axis selects the layer */
if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
depth = height;
height = 1;
zoffset = yoffset;
yoffset = 0;
assert(zoffset + depth <= texImage->Height);
} else {
assert(zoffset + depth <= texImage->Depth);
}
if (get_tex_memcpy(ctx, xoffset, yoffset, zoffset, width, height, depth,
format, type, pixels, texImage)) {
/* all done */

View File

@@ -1333,21 +1333,6 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
break;
case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
case GL_TEXTURE_CUBE_MAP_ARRAY:
/* From section 3.8.6, page 146 of OpenGL ES 3.0 spec:
*
* "The ETC2/EAC texture compression algorithm supports only
* two-dimensional images. If internalformat is an ETC2/EAC format,
* glCompressedTexImage3D will generate an INVALID_OPERATION error if
* target is not TEXTURE_2D_ARRAY."
*
* This should also be applicable for glTexStorage3D(). Other available
* targets for these functions are: TEXTURE_3D and TEXTURE_CUBE_MAP_ARRAY.
*/
if (layout == MESA_FORMAT_LAYOUT_ETC2 && _mesa_is_gles3(ctx))
return write_error(error, GL_INVALID_OPERATION);
target_can_be_compresed = ctx->Extensions.ARB_texture_cube_map_array;
/* From the KHR_texture_compression_astc_hdr spec:
*
* Add a second new column "3D Tex." which is empty for all non-ASTC
@@ -1368,16 +1353,24 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
* 8.19 is *not* checked'
*
* The instances of <internalformat> above should say <target>.
*
* ETC2/EAC formats are the only alternative in GLES and thus such errors
* have already been handled by normal ETC2/EAC behavior.
*/
/* Throw an INVALID_OPERATION error if the target is
* TEXTURE_CUBE_MAP_ARRAY and the format is not ASTC.
/* From section 3.8.6, page 146 of OpenGL ES 3.0 spec:
*
* "The ETC2/EAC texture compression algorithm supports only
* two-dimensional images. If internalformat is an ETC2/EAC format,
* glCompressedTexImage3D will generate an INVALID_OPERATION error if
* target is not TEXTURE_2D_ARRAY."
*
* This should also be applicable for glTexStorage3D(). Other available
* targets for these functions are: TEXTURE_3D and TEXTURE_CUBE_MAP_ARRAY.
*/
if (target_can_be_compresed &&
ctx->Extensions.KHR_texture_compression_astc_ldr &&
layout != MESA_FORMAT_LAYOUT_ASTC)
return write_error(error, GL_INVALID_OPERATION);
if (layout == MESA_FORMAT_LAYOUT_ETC2 && _mesa_is_gles3(ctx))
return write_error(error, GL_INVALID_OPERATION);
target_can_be_compresed = ctx->Extensions.ARB_texture_cube_map_array;
break;
case GL_TEXTURE_3D:
switch (layout) {
@@ -1401,12 +1394,6 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
return write_error(error, GL_INVALID_OPERATION);
break;
default:
/* Throw an INVALID_OPERATION error if the target is TEXTURE_3D and
* the format is not ASTC.
* See comment in switch case GL_TEXTURE_CUBE_MAP_ARRAY for more info.
*/
if (ctx->Extensions.KHR_texture_compression_astc_ldr)
return write_error(error, GL_INVALID_OPERATION);
break;
}
default:
@@ -1712,7 +1699,7 @@ texture_format_error_check_gles(struct gl_context *ctx, GLenum format,
}
}
else {
err = _mesa_es_error_check_format_and_type(format, type, dimensions);
err = _mesa_es_error_check_format_and_type(ctx, format, type, dimensions);
if (err != GL_NO_ERROR) {
_mesa_error(ctx, err, "%s(format = %s, type = %s)",
callerName, _mesa_enum_to_string(format),

View File

@@ -154,12 +154,12 @@ vertex_attrib_binding(struct gl_context *ctx,
* Binds a buffer object to the vertex buffer binding point given by index,
* and sets the Offset and Stride fields.
*/
static void
bind_vertex_buffer(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
GLuint index,
struct gl_buffer_object *vbo,
GLintptr offset, GLsizei stride)
void
_mesa_bind_vertex_buffer(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
GLuint index,
struct gl_buffer_object *vbo,
GLintptr offset, GLsizei stride)
{
struct gl_vertex_buffer_binding *binding = &vao->VertexBinding[index];
@@ -247,6 +247,52 @@ get_legal_types_mask(const struct gl_context *ctx)
}
/**
* \param attrib The index of the attribute array
* \param size Components per element (1, 2, 3 or 4)
* \param type Datatype of each component (GL_FLOAT, GL_INT, etc)
* \param format Either GL_RGBA or GL_BGRA.
* \param normalized Whether integer types are converted to floats in [-1, 1]
* \param integer Integer-valued values (will not be normalized to [-1, 1])
* \param doubles Double values not reduced to floats
* \param relativeOffset Offset of the first element relative to the binding
* offset.
* \param flush_verties Should \c FLUSH_VERTICES be invoked before updating
* state?
*/
void
_mesa_update_array_format(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
GLuint attrib, GLint size, GLenum type,
GLenum format, GLboolean normalized,
GLboolean integer, GLboolean doubles,
GLuint relativeOffset, bool flush_vertices)
{
struct gl_vertex_attrib_array *const array = &vao->VertexAttrib[attrib];
GLint elementSize;
assert(size <= 4);
if (flush_vertices) {
FLUSH_VERTICES(ctx, 0);
}
elementSize = _mesa_bytes_per_vertex_attrib(size, type);
assert(elementSize != -1);
array->Size = size;
array->Type = type;
array->Format = format;
array->Normalized = normalized;
array->Integer = integer;
array->Doubles = doubles;
array->RelativeOffset = relativeOffset;
array->_ElementSize = elementSize;
vao->NewArrays |= VERT_BIT(attrib);
ctx->NewState |= _NEW_ARRAY;
}
/**
* Does error checking and updates the format in an attrib array.
*
@@ -274,9 +320,7 @@ update_array_format(struct gl_context *ctx,
GLboolean normalized, GLboolean integer, GLboolean doubles,
GLuint relativeOffset)
{
struct gl_vertex_attrib_array *array;
GLbitfield typeBit;
GLint elementSize;
GLenum format = GL_RGBA;
if (ctx->Array.LegalTypesMask == 0 || ctx->Array.LegalTypesMaskAPI != ctx->API) {
@@ -377,23 +421,9 @@ update_array_format(struct gl_context *ctx,
return false;
}
assert(size <= 4);
elementSize = _mesa_bytes_per_vertex_attrib(size, type);
assert(elementSize != -1);
array = &vao->VertexAttrib[attrib];
array->Size = size;
array->Type = type;
array->Format = format;
array->Normalized = normalized;
array->Integer = integer;
array->Doubles = doubles;
array->RelativeOffset = relativeOffset;
array->_ElementSize = elementSize;
vao->NewArrays |= VERT_BIT(attrib);
ctx->NewState |= _NEW_ARRAY;
_mesa_update_array_format(ctx, vao, attrib, size, type, format,
normalized, integer, doubles, relativeOffset,
false);
return true;
}
@@ -491,8 +521,9 @@ update_array(struct gl_context *ctx,
/* Update the vertex buffer binding */
effectiveStride = stride != 0 ? stride : array->_ElementSize;
bind_vertex_buffer(ctx, ctx->Array.VAO, attrib, ctx->Array.ArrayBufferObj,
(GLintptr) ptr, effectiveStride);
_mesa_bind_vertex_buffer(ctx, ctx->Array.VAO, attrib,
ctx->Array.ArrayBufferObj, (GLintptr) ptr,
effectiveStride);
}
@@ -739,6 +770,22 @@ _mesa_VertexAttribLPointer(GLuint index, GLint size, GLenum type,
}
void
_mesa_enable_vertex_array_attrib(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
unsigned attrib)
{
assert(attrib < ARRAY_SIZE(vao->VertexAttrib));
if (!vao->VertexAttrib[attrib].Enabled) {
/* was disabled, now being enabled */
FLUSH_VERTICES(ctx, _NEW_ARRAY);
vao->VertexAttrib[attrib].Enabled = GL_TRUE;
vao->_Enabled |= VERT_BIT(attrib);
vao->NewArrays |= VERT_BIT(attrib);
}
}
static void
enable_vertex_array_attrib(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
@@ -750,15 +797,7 @@ enable_vertex_array_attrib(struct gl_context *ctx,
return;
}
assert(VERT_ATTRIB_GENERIC(index) < ARRAY_SIZE(vao->VertexAttrib));
if (!vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) {
/* was disabled, now being enabled */
FLUSH_VERTICES(ctx, _NEW_ARRAY);
vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_TRUE;
vao->_Enabled |= VERT_BIT_GENERIC(index);
vao->NewArrays |= VERT_BIT_GENERIC(index);
}
_mesa_enable_vertex_array_attrib(ctx, vao, VERT_ATTRIB_GENERIC(index));
}
@@ -1716,8 +1755,8 @@ vertex_array_vertex_buffer(struct gl_context *ctx,
vbo = ctx->Shared->NullBufferObj;
}
bind_vertex_buffer(ctx, vao, VERT_ATTRIB_GENERIC(bindingIndex),
vbo, offset, stride);
_mesa_bind_vertex_buffer(ctx, vao, VERT_ATTRIB_GENERIC(bindingIndex),
vbo, offset, stride);
}
@@ -1804,8 +1843,8 @@ vertex_array_vertex_buffers(struct gl_context *ctx,
struct gl_buffer_object *vbo = ctx->Shared->NullBufferObj;
for (i = 0; i < count; i++)
bind_vertex_buffer(ctx, vao, VERT_ATTRIB_GENERIC(first + i),
vbo, 0, 16);
_mesa_bind_vertex_buffer(ctx, vao, VERT_ATTRIB_GENERIC(first + i),
vbo, 0, 16);
return;
}
@@ -1876,8 +1915,8 @@ vertex_array_vertex_buffers(struct gl_context *ctx,
vbo = ctx->Shared->NullBufferObj;
}
bind_vertex_buffer(ctx, vao, VERT_ATTRIB_GENERIC(first + i),
vbo, offsets[i], strides[i]);
_mesa_bind_vertex_buffer(ctx, vao, VERT_ATTRIB_GENERIC(first + i),
vbo, offsets[i], strides[i]);
}
_mesa_end_bufferobj_lookups(ctx);

View File

@@ -90,6 +90,26 @@ _mesa_attr_zero_aliases_vertex(struct gl_context *ctx)
&& !is_forward_compatible_context));
}
extern void
_mesa_update_array_format(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
GLuint attrib, GLint size, GLenum type,
GLenum format, GLboolean normalized,
GLboolean integer, GLboolean doubles,
GLuint relativeOffset, bool flush_vertices);
extern void
_mesa_enable_vertex_array_attrib(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
unsigned attrib);
extern void
_mesa_bind_vertex_buffer(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
GLuint index,
struct gl_buffer_object *vbo,
GLintptr offset, GLsizei stride);
extern void GLAPIENTRY
_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr);