mesa.git
7 years agoegl/drm: Move loop vars inside the loop
Chad Versace [Thu, 22 Jun 2017 18:00:40 +0000 (11:00 -0700)]
egl/drm: Move loop vars inside the loop

That is, consistently do this:

    for (int i = 0; ...)

No behavioral change.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/android: Declare loop vars inside their loops (v2)
Chad Versace [Thu, 22 Jun 2017 18:00:40 +0000 (11:00 -0700)]
egl/android: Declare loop vars inside their loops (v2)

That is, consistently do this:

    for (int i = 0; ...)

No behavioral change.

v2: Rebase.

Reviewed-by: Eric Engestrom <eric@engestrom.ch> (v1)
7 years agosvga: minor whitespace fixes in svga_pipe_vertex.c
Brian Paul [Thu, 22 Jun 2017 19:32:50 +0000 (13:32 -0600)]
svga: minor whitespace fixes in svga_pipe_vertex.c

7 years agosvga: check return value from svga_set_shader( SVGA3D_SHADERTYPE_GS, NULL)
Brian Paul [Thu, 22 Jun 2017 18:58:39 +0000 (12:58 -0600)]
svga: check return value from svga_set_shader( SVGA3D_SHADERTYPE_GS, NULL)

If the call fails we need to flush the command buffer and retry.  In this
case, we were failing to unbind the GS which led to subsequent errors.

This fixes a bug replaying a Cinebench R15 apitrace in a Linux guest.
VMware bug 1894451

cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: fix pre-mature flushing of the command buffer
Charmaine Lee [Wed, 21 Jun 2017 22:35:38 +0000 (15:35 -0700)]
svga: fix pre-mature flushing of the command buffer

When surface_invalidate is called to invalidate a newly created surface
in svga_validate_surface_view(), it is possible that the command
buffer is already full, and in this case, currently, the associated wddm
winsys function will flush the command buffer and resend the invalidate
surface command. However, this can pre-maturely flush the command buffer
if there is still pending image updates to be patched.

To fix the problem, this patch will add a return status to the
surface_invalidate interface and if it returns FALSE, the caller will
call svga_context_flush() to do the proper context flush.
Note, we don't call svga_context_flush() if surface_invalidate()
fails when flushing the screen surface cache though, because it is
already in the process of context flush, all the image updates are already
patched, calling svga_context_flush() can trigger a deadlock.
So in this case, we call the winsys context flush interface directly
to flush the command buffer.

Fixes driver errors and graphics corruption running Tropics. VMware bug 1891975.

Also tested with MTT glretrace, piglit and various OpenGL apps such as
Heaven, CinebenchR15, NobelClinicianViewer, Lightsmark, GoogleEarth.

cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agoswr: invalidate attachment on transition change
George Kyriazis [Thu, 15 Jun 2017 19:39:36 +0000 (14:39 -0500)]
swr: invalidate attachment on transition change

Consider the following RT attachment order:
1. Attach surfaces attachments 0 & 1, and render with them
2. Detach 0 & 1
3. Re-attach 0 & 1 to different surfaces
4. Render with the new attachment

The definition of a tile being resolved is that local changes have been
flushed out to the surface, hence there is no need to reload the tile before
it's written to.  For an invalid tile, the tile has to be reloaded from
the surface before rendering.

Stage (2) was marking hot tiles for attachements 0 & 1 as RESOLVED,
which means that the hot tiles can be written out to memory with no
need to read them back in (they are "clean").  They need to be marked as
resolved here, because a surface may be destroyed after a detach, and we
don't want to have un-resolved tiles that may force a readback from a
NULL (destroyed) surface.  (Part of a destroy is detach all attachments first)

Stage (3), during the no att -> att transition, we  need to realize that the
"new" surface tiles need to be fetched fresh from the new surface, instead
of using the resolved tiles, that belong to a stale attachment.

This is done by marking the hot tiles as invalid in stage (3), when we realize
that a new attachment is being made, so that they are re-fetched during
rendering in stage (4).

Also note that hot tiles are indexed by attachment.

- Fixes VTK dual depth-peeling tests.
- No piglit changes

Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoRevert "getteximage: Return correct error value when texure object is not found"
Juan A. Suarez Romero [Thu, 22 Jun 2017 16:16:16 +0000 (18:16 +0200)]
Revert "getteximage: Return correct error value when texure object is not found"

From OpenGL 4.5 spec PDF, section '8.11. Texture Queries', page 236:
  "An INVALID_VALUE error is generated if texture is not the name of
   an existing texture object."

Same wording applies to the compressed version.

But turns out this is a spec bug, and Khronos is fixing it for the next
revisions.

The proposal is to return INVALID_OPERATION in these cases.

This reverts commit 633c959faeae5099fd095f27da7b954e4a36254b.

v2:
- Use _mesa_lookup_texture_err (Samuel Pitoiset)

v3:
- _mesa_lookup_texture_err() already handles texture > 0 (Samuel
Pitoiset)
- Just revert 633c959fae (Juan A. Suarez)

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoegl: properly count configs
Eric Engestrom [Wed, 21 Jun 2017 20:55:56 +0000 (21:55 +0100)]
egl: properly count configs

dri2_conf represents another config (which shouldn't be counted)
if it doesn't have the requested ID.

Reported-by: Liu Zhiquan <zhiquan.liu@intel.com>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl/android: Change order of EGLConfig generation (v2)
Chad Versace [Sat, 17 Jun 2017 02:11:21 +0000 (19:11 -0700)]
egl/android: Change order of EGLConfig generation (v2)

Many Android apps (such as Google's official NDK GLES2 example app), and
even portions the core framework code (such as SystemServiceManager in
Nougat), incorrectly choose their EGLConfig.  They neglect to match the
EGLConfig's EGL_NATIVE_VISUAL_ID against the window's native format, and
instead choose the first EGLConfig whose channel sizes match those of
the native window format while ignoring the channel *ordering*.

We can detect such buggy clients in logcat when they call
eglCreateSurface, by detecting the mismatch between the EGLConfig's
format and the window's format.

As a workaround, this patch changes the order of EGLConfig generation
such that all EGLConfigs for HAL pixel format i precede those for HAL
pixel format i+1. In my (chadversary) testing on Android Nougat, this
was good enough to pacify the buggy clients.

v2: Rebase to make patch cherry-pickable to stable.

Cc: mesa-stable@lists.freedesktop.org
Cc: Tomasz Figa <tfiga@chromium.org>
Cc: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi915: Fix gl_Fragcoord interpolation
Ville Syrjälä [Tue, 20 Jun 2017 19:05:04 +0000 (22:05 +0300)]
i915: Fix gl_Fragcoord interpolation

gl_FragCoord contains the window coordinates so it seems to me that
we should not use perspective correct interpolation for it. At least
now I get similar output as i965/swrast/llvmpipe produce.

This fixes dEQP-GLES2.functional.shaders.builtin_variable.fragcoord_w.
dEQP-GLES2.functional.shaders.builtin_variable.fragcoord_xyz was already
passing, though I'm not quite sure how it managed to do that.

v2: Add definitons for the S3 "wrap shortest" bits as well (Ian)

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
7 years agoegl: simplify dri_config conditionals
Eric Engestrom [Wed, 21 Jun 2017 09:40:31 +0000 (10:40 +0100)]
egl: simplify dri_config conditionals

In the same spirit as 858f2f2ae6 (egl/dri2: ease srgb __DRIconfig
conditionals), let's merge dri_single_config and dri_double_config into
a single dri_config[2].

This moves the `if (double) dri_double_config else dri_single_config`
logic to `dri_config[double]`, reducing code duplication and making it
easier to read.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradeonsi/gfx9: enable DCC fast clear
Marek Olšák [Fri, 12 May 2017 22:44:24 +0000 (00:44 +0200)]
radeonsi/gfx9: enable DCC fast clear

It seems to work now.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: don't ever flush the TC metadata cache
Marek Olšák [Tue, 20 Jun 2017 16:26:12 +0000 (18:26 +0200)]
radeonsi/gfx9: don't ever flush the TC metadata cache

The closed Vulkan driver doesn't do it either.

Also remove some old comments that aren't useful.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: use TC L2 for fast color clear with CP DMA
Marek Olšák [Tue, 20 Jun 2017 16:25:05 +0000 (18:25 +0200)]
radeonsi/gfx9: use TC L2 for fast color clear with CP DMA

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: fix DCC fast clear for luminance and alpha formats
Marek Olšák [Tue, 20 Jun 2017 15:20:34 +0000 (17:20 +0200)]
radeonsi: fix DCC fast clear for luminance and alpha formats

I reproduced this bug on Polaris11 and Raven.

I can't get this bug on Fiji. The reason might be that Fiji doesn't use
2D tiling for the test due to higher 2D tiling alignment requirements.

Fixes piglit: spec@ext_framebuffer_object@fbo-fast-clear

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: don't emit partial flushes at the end of IBs (v2)
Marek Olšák [Fri, 16 Jun 2017 12:25:34 +0000 (14:25 +0200)]
radeonsi: don't emit partial flushes at the end of IBs (v2)

The kernel sort of does the same thing with fences.

v2: do emit partial flushes on SI

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoanv: FORMAT_FEATURE_TRANSFER_SRC/DST_BIT_KHR not used with VkFormatProperties.bufferF...
Andres Gomez [Wed, 14 Jun 2017 16:55:56 +0000 (19:55 +0300)]
anv: FORMAT_FEATURE_TRANSFER_SRC/DST_BIT_KHR not used with VkFormatProperties.bufferFeatures

VK_FORMAT_FEATURE_TRANSFER_[SRC|DST]_BIT_KHR is a flag value of the
VkFormatFeatureFlagBits enum that can only be hold and checked against
the linearTilingFeatures or optimalTilingFeatures members of the
VkFormatProperties struct but not the bufferFeatures member.

>From the Vulkan® 1.0.51, with the VK_KHR_maintenance1 extension,
section 32.3.2 docs for VkFormatProperties:

   "* linearTilingFeatures is a bitmask of VkFormatFeatureFlagBits
      specifying features supported by images created with a tiling
      parameter of VK_IMAGE_TILING_LINEAR.

    * optimalTilingFeatures is a bitmask of VkFormatFeatureFlagBits
      specifying features supported by images created with a tiling
      parameter of VK_IMAGE_TILING_OPTIMAL.

    * bufferFeatures is a bitmask of VkFormatFeatureFlagBits
      specifying features supported by buffers."

    ...

    Bits which can be set in the VkFormatProperties features
    linearTilingFeatures, optimalTilingFeatures, and bufferFeatures
    are:

    typedef enum VkFormatFeatureFlagBits {

    ...

      VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = 0x00004000,
      VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = 0x00008000,

    ...

    } VkFormatFeatureFlagBits;

    ...

    The following bits may be set in linearTilingFeatures and
    optimalTilingFeatures, specifying that the features are supported
    by images or image views created with the queried
    vkGetPhysicalDeviceFormatProperties::format:

    ...

    * VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR specifies that an image
      can be used as a source image for copy commands.

    * VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR specifies that an image
      can be used as a destination image for copy commands and clear
      commands."

Cc: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: Iago Toral Quiroga <itoral@igalia.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agochange va max_entrypoints
Chandu Babu N [Sat, 17 Jun 2017 11:49:13 +0000 (11:49 +0000)]
change va max_entrypoints

As encode support is added along with decode, increase max_entrypoints to two.
vaMaxNumEntrypoints was returning incorrect value and causing
memory corruption before this commit

v2: assert when max_entrypoints needs to be bigger

CC: mesa-stable@lists.freedesktop.org
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agost/va: Fix leak in VAAPI subpictures
Chandu Babu N [Thu, 22 Jun 2017 05:18:41 +0000 (10:48 +0530)]
st/va: Fix leak in VAAPI subpictures

sampler view allocated in vaAssociateSubpicture is not cleared
in vaiDeassociateSubpicture.

Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agoglsl: tidy up int declaration
Timothy Arceri [Wed, 21 Jun 2017 10:12:12 +0000 (20:12 +1000)]
glsl: tidy up int declaration

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoglsl: fix typo in comment
Timothy Arceri [Wed, 21 Jun 2017 10:12:11 +0000 (20:12 +1000)]
glsl: fix typo in comment

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: fix using texture id 0 with glTextureSubImage*()
Samuel Pitoiset [Wed, 21 Jun 2017 08:11:49 +0000 (10:11 +0200)]
mesa: fix using texture id 0 with glTextureSubImage*()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: fix using texture id 0 with gl*TextureParameter*()
Samuel Pitoiset [Wed, 21 Jun 2017 08:04:49 +0000 (10:04 +0200)]
mesa: fix using texture id 0 with gl*TextureParameter*()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: fix using texture id 0 with VDPAURegisterSurfaceNV()
Samuel Pitoiset [Wed, 21 Jun 2017 08:01:55 +0000 (10:01 +0200)]
mesa: fix using texture id 0 with VDPAURegisterSurfaceNV()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: fix using texture id 0 with glTextureStorage*()
Samuel Pitoiset [Wed, 21 Jun 2017 07:56:55 +0000 (09:56 +0200)]
mesa: fix using texture id 0 with glTextureStorage*()

This fixes an assertion in debug build, and probably a crash
in release build.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: pass the 'caller' function to texturestorage() helper
Samuel Pitoiset [Wed, 21 Jun 2017 07:54:49 +0000 (09:54 +0200)]
mesa: pass the 'caller' function to texturestorage() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: use _mesa_lookup_texture_err() in get_tex_obj_for_clear()
Samuel Pitoiset [Wed, 21 Jun 2017 08:09:47 +0000 (10:09 +0200)]
mesa: use _mesa_lookup_texture_err() in get_tex_obj_for_clear()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: remove unused _mesa_delete_nameless_texture()
Samuel Pitoiset [Wed, 21 Jun 2017 07:41:50 +0000 (09:41 +0200)]
mesa: remove unused _mesa_delete_nameless_texture()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: check for allocation failures in _mesa_new_texture_object()
Samuel Pitoiset [Wed, 21 Jun 2017 07:07:36 +0000 (09:07 +0200)]
mesa: check for allocation failures in _mesa_new_texture_object()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoradeonsi: use the correct LLVMTargetMachineRef in si_build_shader_variant
Nicolai Hähnle [Mon, 12 Jun 2017 20:33:56 +0000 (22:33 +0200)]
radeonsi: use the correct LLVMTargetMachineRef in si_build_shader_variant

si_build_shader_variant can actually be called directly from one of
normal-priority compiler threads. In that case, the thread_index is
only valid for the normal tm array.

v2:
- use the correct sel/shader->compiler_ctx_state

Fixes: 86cc8097266c ("radeonsi: use a compiler queue with a low priority for optimized shaders")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi/gfx9: keep reusing the same buffer/address for the gfx9 flush fence
Marek Olšák [Tue, 6 Jun 2017 22:16:46 +0000 (00:16 +0200)]
radeonsi/gfx9: keep reusing the same buffer/address for the gfx9 flush fence

instead of using a monotonic suballocator

v2: initialize the memory at context creation

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: enable the constant engine
Marek Olšák [Fri, 12 May 2017 22:40:34 +0000 (00:40 +0200)]
radeonsi/gfx9: enable the constant engine

I think this kernel commit fixes it:
     drm/amdgpu:use FRAME_CNTL for new GFX ucode

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: indirect buffers and all CP packets use TC L2
Marek Olšák [Tue, 6 Jun 2017 10:13:40 +0000 (12:13 +0200)]
radeonsi/gfx9: indirect buffers and all CP packets use TC L2

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: flush CB after MSAA only when transitioning from CB to textures
Marek Olšák [Wed, 14 Jun 2017 23:42:46 +0000 (01:42 +0200)]
radeonsi: flush CB after MSAA only when transitioning from CB to textures

The main flush before texturing is done after the FMASK decompress pass.

CB after MSAA rendering is not flushed in set_framebuffer_state and also
not in memory_barrier if the current color buffer is MSAA. We fully rely
on the FMASK decompress pass for the flushing.

Some CB decompress and resolve passes need an explicit flush before and
after.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: unify CB_RESOLVE blitter invocation code
Marek Olšák [Wed, 14 Jun 2017 23:23:22 +0000 (01:23 +0200)]
radeonsi: unify CB_RESOLVE blitter invocation code

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: flush DB caches only when transitioning from DB to texturing
Marek Olšák [Wed, 14 Jun 2017 22:34:08 +0000 (00:34 +0200)]
radeonsi: flush DB caches only when transitioning from DB to texturing

Use the mechanism of si_decompress_textures, but instead of doing
the actual decompression, just flag the DB cache flush there.

This removes a lot of unnecessary DB cache flushes.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: add separate HUD counters for CB and DB cache flushes
Marek Olšák [Wed, 14 Jun 2017 22:29:41 +0000 (00:29 +0200)]
radeonsi: add separate HUD counters for CB and DB cache flushes

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't set the border color if it's unused
Marek Olšák [Thu, 15 Jun 2017 11:45:24 +0000 (13:45 +0200)]
st/mesa: don't set the border color if it's unused

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't set 16 scissors and 16 viewports if they're unused
Marek Olšák [Wed, 14 Jun 2017 21:09:24 +0000 (23:09 +0200)]
st/mesa: don't set 16 scissors and 16 viewports if they're unused

Only do so if there is a shader writing gl_ViewportIndex.
This removes a lot of CPU overhead for the most common case.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: fix pipe_rasterizer_state::scissor with multiple viewports
Marek Olšák [Wed, 14 Jun 2017 21:02:04 +0000 (23:02 +0200)]
st/mesa: fix pipe_rasterizer_state::scissor with multiple viewports

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: simplify st_update_viewport
Marek Olšák [Wed, 14 Jun 2017 20:45:13 +0000 (22:45 +0200)]
st/mesa: simplify st_update_viewport

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: remove redundant sample_mask checking
Marek Olšák [Wed, 14 Jun 2017 20:37:31 +0000 (22:37 +0200)]
st/mesa: remove redundant sample_mask checking

cso does that too

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: use precomputed st_fb_orientation
Marek Olšák [Wed, 14 Jun 2017 20:36:28 +0000 (22:36 +0200)]
st/mesa: use precomputed st_fb_orientation

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: don't call _mesa_update_clip_plane in the GL core profile
Marek Olšák [Wed, 14 Jun 2017 12:46:43 +0000 (14:46 +0200)]
mesa: don't call _mesa_update_clip_plane in the GL core profile

It uses the projection matrix to transform the clip plane.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agost/mesa: set st_context::...num_samplers to 0 when there are no samplers
Marek Olšák [Wed, 14 Jun 2017 16:31:06 +0000 (18:31 +0200)]
st/mesa: set st_context::...num_samplers to 0 when there are no samplers

This was missed during my st/mesa series.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: unify fail paths for update_single_texture
Marek Olšák [Mon, 12 Jun 2017 17:29:37 +0000 (19:29 +0200)]
st/mesa: unify fail paths for update_single_texture

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't call u_sampler_view_default_template for sampler views
Marek Olšák [Sun, 11 Jun 2017 23:27:26 +0000 (01:27 +0200)]
st/mesa: don't call u_sampler_view_default_template for sampler views

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: always set sampler swizzle according to the texture base format
Marek Olšák [Sun, 11 Jun 2017 23:20:34 +0000 (01:20 +0200)]
st/mesa: always set sampler swizzle according to the texture base format

Mainly don't (indirectly) call util_format_description here.

If the driver supports texture swizzling, this will always do the right
thing. If the driver doesn't support it, it doesn't matter.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: samplers only need to track whether GLSL >= 130
Marek Olšák [Sun, 11 Jun 2017 23:15:59 +0000 (01:15 +0200)]
st/mesa: samplers only need to track whether GLSL >= 130

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: simplify get_texture_format_swizzle
Marek Olšák [Sun, 11 Jun 2017 23:04:34 +0000 (01:04 +0200)]
st/mesa: simplify get_texture_format_swizzle

- Don't check GL_NONE (that was only for buffers).
- Don't use util_format_is_depth_or_stencil.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: add an entirely separate codepath for setting up buffer views
Marek Olšák [Sun, 11 Jun 2017 23:00:04 +0000 (01:00 +0200)]
st/mesa: add an entirely separate codepath for setting up buffer views

Remove handling of buffers from all texture paths.
This simplifies things for both buffers and textures.

get_sampler_view_format is also cleaned up not to call
util_format_is_depth_and_stencil.

v2: also update st_NewTextureHandle

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (v1)
7 years agost/mesa: don't return an error from update_single_texture
Marek Olšák [Sat, 10 Jun 2017 23:41:40 +0000 (01:41 +0200)]
st/mesa: don't return an error from update_single_texture

It can just return a NULL sampler view, which is better than not doing
anything at all.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: clean up trivial dereferences in update_textures
Marek Olšák [Sat, 10 Jun 2017 23:40:15 +0000 (01:40 +0200)]
st/mesa: clean up trivial dereferences in update_textures

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't check MaxTextureImageUnits in update_textures
Marek Olšák [Sat, 10 Jun 2017 23:37:18 +0000 (01:37 +0200)]
st/mesa: don't check MaxTextureImageUnits in update_textures

The linker takes care of it.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't call st_shader_stage_to_ptarget in update_textures
Marek Olšák [Sat, 10 Jun 2017 23:32:19 +0000 (01:32 +0200)]
st/mesa: don't call st_shader_stage_to_ptarget in update_textures

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agocso: inline a few frequently-used functions
Marek Olšák [Sat, 10 Jun 2017 23:08:37 +0000 (01:08 +0200)]
cso: inline a few frequently-used functions

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agocso: don't return errors from sampler functions
Marek Olšák [Sat, 10 Jun 2017 21:23:56 +0000 (23:23 +0200)]
cso: don't return errors from sampler functions

No code checks the errors.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agocso: don't track the number of sampler states bound
Marek Olšák [Sat, 10 Jun 2017 21:12:25 +0000 (23:12 +0200)]
cso: don't track the number of sampler states bound

This removes 2 loops from hot codepaths and adds 1 loop to a rare codepath
(restore_sampler_states), and makes sanitize_hash() slightly worse.

Sampler states, when bound, are not unbound for draw calls that don't need
them. That's OK, because bound sampler states don't add any overhead.

This results in lower CPU overhead in most cases.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: sink and simplify texBaseFormat getting for sampler states
Marek Olšák [Sat, 10 Jun 2017 20:44:10 +0000 (22:44 +0200)]
st/mesa: sink and simplify texBaseFormat getting for sampler states

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't set sampler states for TBOs
Marek Olšák [Thu, 15 Jun 2017 01:00:59 +0000 (03:00 +0200)]
st/mesa: don't set sampler states for TBOs

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: optimize sampler state translation code
Marek Olšák [Sat, 10 Jun 2017 20:34:34 +0000 (22:34 +0200)]
st/mesa: optimize sampler state translation code

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: sink code needed for apply_texture_swizzle_to_border_color
Marek Olšák [Sat, 10 Jun 2017 20:13:48 +0000 (22:13 +0200)]
st/mesa: sink code needed for apply_texture_swizzle_to_border_color

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: simplify update_shader_samplers
Marek Olšák [Sat, 10 Jun 2017 19:59:07 +0000 (21:59 +0200)]
st/mesa: simplify update_shader_samplers

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: when binding sampler states, don't check the max sampler limit
Marek Olšák [Sat, 10 Jun 2017 19:57:20 +0000 (21:57 +0200)]
st/mesa: when binding sampler states, don't check the max sampler limit

The GLSL linker takes care of it.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't unbind sampler states if none are used
Marek Olšák [Sat, 10 Jun 2017 19:39:16 +0000 (21:39 +0200)]
st/mesa: don't unbind sampler states if none are used

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agost/mesa: unify update_gp/tcp/tep code
Marek Olšák [Sat, 10 Jun 2017 18:13:14 +0000 (20:13 +0200)]
st/mesa: unify update_gp/tcp/tep code

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't search through shader variants if there is only one
Marek Olšák [Sat, 10 Jun 2017 18:05:24 +0000 (20:05 +0200)]
st/mesa: don't search through shader variants if there is only one

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't track shader variants in st_context
Marek Olšák [Sat, 10 Jun 2017 17:58:06 +0000 (19:58 +0200)]
st/mesa: don't track shader variants in st_context

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: move blend color into its own state atom
Marek Olšák [Sat, 10 Jun 2017 17:36:11 +0000 (19:36 +0200)]
st/mesa: move blend color into its own state atom

This is now sensible thanks to the NewBlendColor flag.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: check correctly if multisampling is enabled
Marek Olšák [Sat, 10 Jun 2017 00:15:34 +0000 (02:15 +0200)]
st/mesa: check correctly if multisampling is enabled

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't invoke st_finalize_texture & st_convert_sampler for TBOs
Marek Olšák [Tue, 20 Jun 2017 19:32:28 +0000 (21:32 +0200)]
st/mesa: don't invoke st_finalize_texture & st_convert_sampler for TBOs

This is a v2 of the previous patch (v1 didn't skip st_finalize_texture).

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: simplify _mesa_is_image_unit_valid for buffers
Marek Olšák [Sun, 11 Jun 2017 22:49:15 +0000 (00:49 +0200)]
mesa: simplify _mesa_is_image_unit_valid for buffers

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_PROGRAM_CONSTANTS for GLSL programs for st/mesa
Marek Olšák [Sat, 10 Jun 2017 15:22:09 +0000 (17:22 +0200)]
mesa: don't flag _NEW_PROGRAM_CONSTANTS for GLSL programs for st/mesa

v2: also update _mesa_uniform_handle for bindless textures

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (v1)
Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> (v1)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoglsl: Track whether uniforms are active per stage
Kenneth Graunke [Sat, 13 Sep 2014 18:13:26 +0000 (11:13 -0700)]
glsl: Track whether uniforms are active per stage

for finer granularity state flagging

v2: Marek - use a bitmask, add shader cache support

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_PROGRAM_CONSTANTS for non-GLSL programs for st/mesa
Marek Olšák [Sat, 10 Jun 2017 15:22:09 +0000 (17:22 +0200)]
mesa: don't flag _NEW_PROGRAM_CONSTANTS for non-GLSL programs for st/mesa

This has the benefit that we get to set up constants for exactly
the shader stage that needs it.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: flush vertices before updating ctx->_Shader
Marek Olšák [Sat, 10 Jun 2017 13:41:22 +0000 (15:41 +0200)]
mesa: flush vertices before updating ctx->_Shader

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: set driver flags for glPopAttrib(GL_ENABLE_BIT) properly
Marek Olšák [Sat, 10 Jun 2017 10:38:13 +0000 (12:38 +0200)]
mesa: set driver flags for glPopAttrib(GL_ENABLE_BIT) properly

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_POLYGON_STIPPLE for st/mesa
Marek Olšák [Sat, 10 Jun 2017 10:31:33 +0000 (12:31 +0200)]
mesa: don't flag _NEW_POLYGON_STIPPLE for st/mesa

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_LINE for st/mesa
Marek Olšák [Sat, 10 Jun 2017 10:25:50 +0000 (12:25 +0200)]
mesa: don't flag _NEW_LINE for st/mesa

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_POLYGON for st/mesa
Marek Olšák [Sat, 10 Jun 2017 10:18:34 +0000 (12:18 +0200)]
mesa: don't flag _NEW_POLYGON for st/mesa

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_TRANSFORM for st/mesa if possible
Marek Olšák [Sat, 10 Jun 2017 10:09:43 +0000 (12:09 +0200)]
mesa: don't flag _NEW_TRANSFORM for st/mesa if possible

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_TRANSFORM for Transform.RasterPositionUnclipped
Marek Olšák [Sat, 10 Jun 2017 09:55:50 +0000 (11:55 +0200)]
mesa: don't flag _NEW_TRANSFORM for Transform.RasterPositionUnclipped

It's not a driver state, it's for glRasterPos.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_TRANSFORM for primitive restart
Marek Olšák [Sat, 10 Jun 2017 09:51:40 +0000 (11:51 +0200)]
mesa: don't flag _NEW_TRANSFORM for primitive restart

It's a draw state.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_VIEWPORT for st/mesa if possible
Marek Olšák [Sat, 10 Jun 2017 00:39:06 +0000 (02:39 +0200)]
mesa: don't flag _NEW_VIEWPORT for st/mesa if possible

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: flush vertices before changing viewports
Marek Olšák [Sat, 10 Jun 2017 00:28:05 +0000 (02:28 +0200)]
mesa: flush vertices before changing viewports

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_MULTISAMPLE for st/mesa
Marek Olšák [Sat, 10 Jun 2017 00:14:15 +0000 (02:14 +0200)]
mesa: don't flag _NEW_MULTISAMPLE for st/mesa

There are several new driver flags here so that it maps nicely to gallium.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_COLOR for st/mesa if possible
Marek Olšák [Fri, 9 Jun 2017 23:46:34 +0000 (01:46 +0200)]
mesa: don't flag _NEW_COLOR for st/mesa if possible

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: use DriverFlags.NewAlphaTest to communicate alphatest changes to st/mesa
Marek Olšák [Fri, 9 Jun 2017 23:07:59 +0000 (01:07 +0200)]
mesa: use DriverFlags.NewAlphaTest to communicate alphatest changes to st/mesa

Now AlphaFunc avoids the blend state update in st/mesa and avoids
_mesa_update_state_locked.

The GL_ALPHA_TEST enable won't trigger blend state updates in st/mesa
after st/mesa stops relying on _NEW_COLOR.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_DEPTH for st/mesa
Marek Olšák [Fri, 9 Jun 2017 22:58:04 +0000 (00:58 +0200)]
mesa: don't flag _NEW_DEPTH for st/mesa

skipping _mesa_update_state_locked

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: make _mesa_set_varying_vp_inputs a no-op in GL core profile
Marek Olšák [Fri, 9 Jun 2017 22:52:51 +0000 (00:52 +0200)]
mesa: make _mesa_set_varying_vp_inputs a no-op in GL core profile

just don't set _NEW_VARYING_VP_INPUTS.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: remove _NEW_BUFFER_OBJECT
Marek Olšák [Fri, 9 Jun 2017 22:48:53 +0000 (00:48 +0200)]
mesa: remove _NEW_BUFFER_OBJECT

not used

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't flag _NEW_SCISSOR for st/mesa
Marek Olšák [Fri, 9 Jun 2017 22:30:18 +0000 (00:30 +0200)]
mesa: don't flag _NEW_SCISSOR for st/mesa

Not needed and we get to bypass _mesa_update_state_locked that would be
a no-op.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't execute most of _mesa_update_state_locked for GL core profile
Marek Olšák [Fri, 9 Jun 2017 22:14:11 +0000 (00:14 +0200)]
mesa: don't execute most of _mesa_update_state_locked for GL core profile

There is plenty of legacy stuff here.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: simplify handling the return value of update_program
Marek Olšák [Fri, 9 Jun 2017 22:01:21 +0000 (00:01 +0200)]
mesa: simplify handling the return value of update_program

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: simplify a loop in _mesa_update_texture_state
Marek Olšák [Fri, 9 Jun 2017 21:54:16 +0000 (23:54 +0200)]
mesa: simplify a loop in _mesa_update_texture_state

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: replace VP/FP/ATIfs _Enabled flags with helper functions
Marek Olšák [Fri, 9 Jun 2017 21:27:41 +0000 (23:27 +0200)]
mesa: replace VP/FP/ATIfs _Enabled flags with helper functions

These are only used in the GL compatibility profile.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: don't update draw buffer bounds in _mesa_update_state
Marek Olšák [Fri, 9 Jun 2017 20:19:33 +0000 (22:19 +0200)]
mesa: don't update draw buffer bounds in _mesa_update_state

st/mesa doesn't need the draw bounds for draw calls. I've added the call
where it's necessary in core Mesa and drivers, but I suspect that most
drivers can just move the call to the right places.

The core Mesa places aren't hot paths, so the call overhead doesn't matter
there.

For now, only st/mesa is made such that this function is invoked very
rarely.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: remove update_framebuffer_size
Marek Olšák [Fri, 9 Jun 2017 20:47:16 +0000 (22:47 +0200)]
mesa: remove update_framebuffer_size

For the default framebuffer, _mesa_resize_framebuffer updates it.
For FBOs, _mesa_test_framebuffer_completeness updates it.

This code is redundant.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agomesa: replace ctx->Polygon._FrontBit with a helper function
Marek Olšák [Fri, 9 Jun 2017 19:42:12 +0000 (21:42 +0200)]
mesa: replace ctx->Polygon._FrontBit with a helper function

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: replace ctx->VertexProgram._TwoSideEnabled with a helper function
Marek Olšák [Fri, 9 Jun 2017 19:27:18 +0000 (21:27 +0200)]
mesa: replace ctx->VertexProgram._TwoSideEnabled with a helper function

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>