2016-02-16 17:27:28 -06:00
|
|
|
/****************************************************************************
|
|
|
|
|
* Copyright (C) 2015 Intel Corporation. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
|
*
|
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
|
* Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
|
* IN THE SOFTWARE.
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
2016-11-11 11:44:05 -06:00
|
|
|
#include "swr_context.h"
|
|
|
|
|
#include "swr_public.h"
|
|
|
|
|
#include "swr_screen.h"
|
|
|
|
|
#include "swr_resource.h"
|
|
|
|
|
#include "swr_fence.h"
|
|
|
|
|
#include "gen_knobs.h"
|
|
|
|
|
|
2016-02-16 17:27:28 -06:00
|
|
|
#include "pipe/p_screen.h"
|
|
|
|
|
#include "pipe/p_defines.h"
|
|
|
|
|
#include "util/u_memory.h"
|
|
|
|
|
#include "util/u_format.h"
|
|
|
|
|
#include "util/u_inlines.h"
|
|
|
|
|
#include "util/u_cpu_detect.h"
|
2016-05-12 11:27:57 -05:00
|
|
|
#include "util/u_format_s3tc.h"
|
2016-12-05 11:32:19 -06:00
|
|
|
#include "util/u_string.h"
|
2019-01-30 10:43:40 -06:00
|
|
|
#include "util/u_screen.h"
|
2016-02-16 17:27:28 -06:00
|
|
|
|
|
|
|
|
#include "state_tracker/sw_winsys.h"
|
|
|
|
|
|
|
|
|
|
#include "jit_api.h"
|
|
|
|
|
|
2016-11-09 17:16:36 -05:00
|
|
|
#include "memory/TilingFunctions.h"
|
|
|
|
|
|
2016-02-16 17:27:28 -06:00
|
|
|
#include <stdio.h>
|
2016-09-20 11:15:55 -05:00
|
|
|
#include <map>
|
2016-02-16 17:27:28 -06:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Max texture sizes
|
|
|
|
|
* XXX Check max texture size values against core and sampler.
|
|
|
|
|
*/
|
2017-11-20 11:32:55 -06:00
|
|
|
#define SWR_MAX_TEXTURE_SIZE (2 * 1024 * 1024 * 1024ULL) /* 2GB */
|
2019-04-29 15:38:24 -07:00
|
|
|
#define SWR_MAX_TEXTURE_2D_SIZE 8192
|
2016-02-16 17:27:28 -06:00
|
|
|
#define SWR_MAX_TEXTURE_3D_LEVELS 12 /* 2K x 2K x 2K for now */
|
|
|
|
|
#define SWR_MAX_TEXTURE_CUBE_LEVELS 14 /* 8K x 8K for now */
|
|
|
|
|
#define SWR_MAX_TEXTURE_ARRAY_LAYERS 512 /* 8K x 512 / 8K x 8K x 512 */
|
|
|
|
|
|
2017-07-12 15:04:47 -05:00
|
|
|
/* Default max client_copy_limit */
|
2017-10-18 14:10:26 -05:00
|
|
|
#define SWR_CLIENT_COPY_LIMIT 8192
|
2017-07-12 15:04:47 -05:00
|
|
|
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
/* Flag indicates creation of alternate surface, to prevent recursive loop
|
|
|
|
|
* in resource creation when msaa_force_enable is set. */
|
|
|
|
|
#define SWR_RESOURCE_FLAG_ALT_SURFACE (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
|
|
|
|
|
|
|
|
|
|
|
2016-02-16 17:27:28 -06:00
|
|
|
static const char *
|
|
|
|
|
swr_get_name(struct pipe_screen *screen)
|
|
|
|
|
{
|
2016-12-05 11:32:19 -06:00
|
|
|
static char buf[100];
|
2018-11-20 11:59:28 +00:00
|
|
|
snprintf(buf, sizeof(buf), "SWR (LLVM %u.%u, %u bits)",
|
|
|
|
|
HAVE_LLVM >> 8, HAVE_LLVM & 0xff,
|
|
|
|
|
lp_native_vector_width);
|
2016-12-05 11:32:19 -06:00
|
|
|
return buf;
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
|
swr_get_vendor(struct pipe_screen *screen)
|
|
|
|
|
{
|
|
|
|
|
return "Intel Corporation";
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-04 11:41:41 -04:00
|
|
|
static bool
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
swr_is_format_supported(struct pipe_screen *_screen,
|
2016-02-16 17:27:28 -06:00
|
|
|
enum pipe_format format,
|
|
|
|
|
enum pipe_texture_target target,
|
|
|
|
|
unsigned sample_count,
|
2018-05-23 18:46:19 -04:00
|
|
|
unsigned storage_sample_count,
|
2016-02-16 17:27:28 -06:00
|
|
|
unsigned bind)
|
|
|
|
|
{
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
struct swr_screen *screen = swr_screen(_screen);
|
|
|
|
|
struct sw_winsys *winsys = screen->winsys;
|
2016-02-16 17:27:28 -06:00
|
|
|
const struct util_format_description *format_desc;
|
|
|
|
|
|
|
|
|
|
assert(target == PIPE_BUFFER || target == PIPE_TEXTURE_1D
|
|
|
|
|
|| target == PIPE_TEXTURE_1D_ARRAY
|
|
|
|
|
|| target == PIPE_TEXTURE_2D
|
|
|
|
|
|| target == PIPE_TEXTURE_2D_ARRAY
|
|
|
|
|
|| target == PIPE_TEXTURE_RECT
|
|
|
|
|
|| target == PIPE_TEXTURE_3D
|
|
|
|
|
|| target == PIPE_TEXTURE_CUBE
|
|
|
|
|
|| target == PIPE_TEXTURE_CUBE_ARRAY);
|
|
|
|
|
|
2018-05-23 18:46:19 -04:00
|
|
|
if (MAX2(1, sample_count) != MAX2(1, storage_sample_count))
|
|
|
|
|
return false;
|
|
|
|
|
|
2016-02-16 17:27:28 -06:00
|
|
|
format_desc = util_format_description(format);
|
|
|
|
|
if (!format_desc)
|
2019-07-04 11:41:41 -04:00
|
|
|
return false;
|
2016-02-16 17:27:28 -06:00
|
|
|
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
if ((sample_count > screen->msaa_max_count)
|
2017-11-13 11:17:41 -08:00
|
|
|
|| !util_is_power_of_two_or_zero(sample_count))
|
2019-07-04 11:41:41 -04:00
|
|
|
return false;
|
2016-02-16 17:27:28 -06:00
|
|
|
|
2017-04-12 18:53:01 -05:00
|
|
|
if (bind & PIPE_BIND_DISPLAY_TARGET) {
|
2016-02-16 17:27:28 -06:00
|
|
|
if (!winsys->is_displaytarget_format_supported(winsys, bind, format))
|
2019-07-04 11:41:41 -04:00
|
|
|
return false;
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bind & PIPE_BIND_RENDER_TARGET) {
|
|
|
|
|
if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS)
|
2019-07-04 11:41:41 -04:00
|
|
|
return false;
|
2016-02-16 17:27:28 -06:00
|
|
|
|
|
|
|
|
if (mesa_to_swr_format(format) == (SWR_FORMAT)-1)
|
2019-07-04 11:41:41 -04:00
|
|
|
return false;
|
2016-02-16 17:27:28 -06:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Although possible, it is unnatural to render into compressed or YUV
|
|
|
|
|
* surfaces. So disable these here to avoid going into weird paths
|
|
|
|
|
* inside the state trackers.
|
|
|
|
|
*/
|
|
|
|
|
if (format_desc->block.width != 1 || format_desc->block.height != 1)
|
2019-07-04 11:41:41 -04:00
|
|
|
return false;
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bind & PIPE_BIND_DEPTH_STENCIL) {
|
|
|
|
|
if (format_desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS)
|
2019-07-04 11:41:41 -04:00
|
|
|
return false;
|
2016-02-16 17:27:28 -06:00
|
|
|
|
|
|
|
|
if (mesa_to_swr_format(format) == (SWR_FORMAT)-1)
|
2019-07-04 11:41:41 -04:00
|
|
|
return false;
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
|
|
|
|
|
2016-05-12 11:27:57 -05:00
|
|
|
if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC ||
|
|
|
|
|
format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) {
|
2019-07-04 11:41:41 -04:00
|
|
|
return false;
|
2016-05-12 11:27:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (format_desc->layout == UTIL_FORMAT_LAYOUT_ETC &&
|
|
|
|
|
format != PIPE_FORMAT_ETC1_RGB8) {
|
2019-07-04 11:41:41 -04:00
|
|
|
return false;
|
2016-05-12 11:27:57 -05:00
|
|
|
}
|
|
|
|
|
|
2019-05-31 13:33:32 +02:00
|
|
|
if ((bind & (PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW)) &&
|
|
|
|
|
((bind & PIPE_BIND_DISPLAY_TARGET) == 0)) {
|
|
|
|
|
/* Disable all 3-channel formats, where channel size != 32 bits.
|
|
|
|
|
* In some cases we run into crashes (in generate_unswizzled_blend()),
|
|
|
|
|
* for 3-channel RGB16 variants, there was an apparent LLVM bug.
|
|
|
|
|
* In any case, disabling the shallower 3-channel formats avoids a
|
|
|
|
|
* number of issues with GL_ARB_copy_image support.
|
|
|
|
|
*/
|
|
|
|
|
if (format_desc->is_array &&
|
|
|
|
|
format_desc->nr_channels == 3 &&
|
|
|
|
|
format_desc->block.bits != 96) {
|
2019-07-04 11:41:41 -04:00
|
|
|
return false;
|
2019-05-31 13:33:32 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-16 17:27:28 -06:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
|
|
|
|
{
|
|
|
|
|
switch (param) {
|
2016-11-20 13:31:43 -05:00
|
|
|
/* limits */
|
2016-02-16 17:27:28 -06:00
|
|
|
case PIPE_CAP_MAX_RENDER_TARGETS:
|
|
|
|
|
return PIPE_MAX_COLOR_BUFS;
|
2019-04-29 15:38:24 -07:00
|
|
|
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
|
|
|
|
|
return SWR_MAX_TEXTURE_2D_SIZE;
|
2016-02-16 17:27:28 -06:00
|
|
|
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
|
|
|
|
|
return SWR_MAX_TEXTURE_3D_LEVELS;
|
|
|
|
|
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
|
|
|
|
|
return SWR_MAX_TEXTURE_CUBE_LEVELS;
|
|
|
|
|
case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS:
|
|
|
|
|
return MAX_SO_STREAMS;
|
|
|
|
|
case PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS:
|
|
|
|
|
case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS:
|
2016-11-27 00:45:17 -05:00
|
|
|
return MAX_ATTRIBUTES * 4;
|
2016-02-16 17:27:28 -06:00
|
|
|
case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES:
|
|
|
|
|
case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
|
|
|
|
|
return 1024;
|
|
|
|
|
case PIPE_CAP_MAX_VERTEX_STREAMS:
|
|
|
|
|
return 1;
|
|
|
|
|
case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
|
|
|
|
|
return 2048;
|
|
|
|
|
case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS:
|
|
|
|
|
return SWR_MAX_TEXTURE_ARRAY_LAYERS;
|
2019-05-15 17:04:15 +02:00
|
|
|
case PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET:
|
2016-02-16 17:27:28 -06:00
|
|
|
case PIPE_CAP_MIN_TEXEL_OFFSET:
|
|
|
|
|
return -8;
|
2019-05-15 17:04:15 +02:00
|
|
|
case PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET:
|
2016-02-16 17:27:28 -06:00
|
|
|
case PIPE_CAP_MAX_TEXEL_OFFSET:
|
|
|
|
|
return 7;
|
2019-05-15 17:04:15 +02:00
|
|
|
case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
|
|
|
|
|
return 4;
|
2016-11-20 13:31:43 -05:00
|
|
|
case PIPE_CAP_GLSL_FEATURE_LEVEL:
|
|
|
|
|
return 330;
|
2018-02-15 01:32:08 +01:00
|
|
|
case PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY:
|
|
|
|
|
return 140;
|
2016-11-20 13:31:43 -05:00
|
|
|
case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
|
|
|
|
|
return 16;
|
|
|
|
|
case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
|
|
|
|
|
return 64;
|
|
|
|
|
case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
|
|
|
|
|
return 65536;
|
|
|
|
|
case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
|
2019-05-27 14:21:49 +02:00
|
|
|
return 1;
|
2016-11-20 13:31:43 -05:00
|
|
|
case PIPE_CAP_MAX_VIEWPORTS:
|
2019-07-02 16:44:34 +02:00
|
|
|
return KNOB_NUM_VIEWPORTS_SCISSORS;
|
2016-11-20 13:31:43 -05:00
|
|
|
case PIPE_CAP_ENDIANNESS:
|
|
|
|
|
return PIPE_ENDIAN_NATIVE;
|
2018-08-21 22:00:11 -04:00
|
|
|
case PIPE_CAP_DEPTH_CLIP_DISABLE_SEPARATE:
|
2016-11-13 09:20:03 -05:00
|
|
|
return 0;
|
2016-11-20 13:31:43 -05:00
|
|
|
|
|
|
|
|
/* supported features */
|
|
|
|
|
case PIPE_CAP_NPOT_TEXTURES:
|
|
|
|
|
case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
|
|
|
|
|
case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
|
2019-07-05 16:36:41 +02:00
|
|
|
case PIPE_CAP_FRAGMENT_SHADER_TEXTURE_LOD:
|
|
|
|
|
case PIPE_CAP_FRAGMENT_SHADER_DERIVATIVES:
|
|
|
|
|
case PIPE_CAP_VERTEX_SHADER_SATURATE:
|
2016-11-20 13:31:43 -05:00
|
|
|
case PIPE_CAP_POINT_SPRITE:
|
|
|
|
|
case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
|
|
|
|
|
case PIPE_CAP_OCCLUSION_QUERY:
|
|
|
|
|
case PIPE_CAP_QUERY_TIME_ELAPSED:
|
|
|
|
|
case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
|
|
|
|
|
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
|
2018-06-23 17:26:47 -07:00
|
|
|
case PIPE_CAP_TEXTURE_MIRROR_CLAMP_TO_EDGE:
|
2016-11-20 13:31:43 -05:00
|
|
|
case PIPE_CAP_TEXTURE_SWIZZLE:
|
|
|
|
|
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
|
|
|
|
|
case PIPE_CAP_INDEP_BLEND_ENABLE:
|
|
|
|
|
case PIPE_CAP_INDEP_BLEND_FUNC:
|
|
|
|
|
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
|
|
|
|
|
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
|
|
|
|
|
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
|
|
|
|
|
case PIPE_CAP_DEPTH_CLIP_DISABLE:
|
|
|
|
|
case PIPE_CAP_PRIMITIVE_RESTART:
|
|
|
|
|
case PIPE_CAP_TGSI_INSTANCEID:
|
|
|
|
|
case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
|
|
|
|
|
case PIPE_CAP_START_INSTANCE:
|
|
|
|
|
case PIPE_CAP_SEAMLESS_CUBE_MAP:
|
|
|
|
|
case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
|
|
|
|
|
case PIPE_CAP_CONDITIONAL_RENDER:
|
2016-11-13 09:20:03 -05:00
|
|
|
case PIPE_CAP_VERTEX_COLOR_UNCLAMPED:
|
2016-02-16 17:27:28 -06:00
|
|
|
case PIPE_CAP_MIXED_COLORBUFFER_FORMATS:
|
|
|
|
|
case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
|
|
|
|
|
case PIPE_CAP_USER_VERTEX_BUFFERS:
|
2016-10-14 00:03:12 -04:00
|
|
|
case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS:
|
2016-11-20 13:31:43 -05:00
|
|
|
case PIPE_CAP_QUERY_TIMESTAMP:
|
|
|
|
|
case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
|
|
|
|
|
case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
|
|
|
|
|
case PIPE_CAP_DRAW_INDIRECT:
|
|
|
|
|
case PIPE_CAP_UMA:
|
|
|
|
|
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
|
|
|
|
|
case PIPE_CAP_CLIP_HALFZ:
|
|
|
|
|
case PIPE_CAP_POLYGON_OFFSET_CLAMP:
|
|
|
|
|
case PIPE_CAP_DEPTH_BOUNDS_TEST:
|
2017-02-25 21:09:57 -06:00
|
|
|
case PIPE_CAP_CLEAR_TEXTURE:
|
2016-11-20 13:31:43 -05:00
|
|
|
case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
|
|
|
|
|
case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
|
|
|
|
|
case PIPE_CAP_CULL_DISTANCE:
|
2016-11-20 13:33:04 -05:00
|
|
|
case PIPE_CAP_CUBE_MAP_ARRAY:
|
2017-04-11 11:50:23 -05:00
|
|
|
case PIPE_CAP_DOUBLES:
|
2019-05-15 17:04:15 +02:00
|
|
|
case PIPE_CAP_TEXTURE_QUERY_LOD:
|
2019-05-31 13:33:32 +02:00
|
|
|
case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS:
|
2016-02-16 17:27:28 -06:00
|
|
|
return 1;
|
2016-11-20 13:31:43 -05:00
|
|
|
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
/* MSAA support
|
2017-08-25 14:59:13 -05:00
|
|
|
* If user has explicitly set max_sample_count = 1 (via SWR_MSAA_MAX_COUNT)
|
|
|
|
|
* then disable all MSAA support and go back to old (FAKE_SW_MSAA) caps. */
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
case PIPE_CAP_TEXTURE_MULTISAMPLE:
|
|
|
|
|
case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
|
2017-08-25 14:59:13 -05:00
|
|
|
return (swr_screen(screen)->msaa_max_count > 1) ? 1 : 0;
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
case PIPE_CAP_FAKE_SW_MSAA:
|
2017-08-25 14:59:13 -05:00
|
|
|
return (swr_screen(screen)->msaa_max_count > 1) ? 0 : 1;
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
|
2017-08-18 11:51:59 -05:00
|
|
|
/* fetch jit change for 2-4GB buffers requires alignment */
|
|
|
|
|
case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
|
|
|
|
|
case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
|
|
|
|
|
case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
|
|
|
|
|
return 1;
|
|
|
|
|
|
2016-11-20 13:31:43 -05:00
|
|
|
/* unsupported features */
|
|
|
|
|
case PIPE_CAP_ANISOTROPIC_FILTER:
|
|
|
|
|
case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
|
|
|
|
|
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
|
|
|
|
|
case PIPE_CAP_SHADER_STENCIL_EXPORT:
|
|
|
|
|
case PIPE_CAP_TEXTURE_BARRIER:
|
|
|
|
|
case PIPE_CAP_FRAGMENT_COLOR_CLAMPED:
|
|
|
|
|
case PIPE_CAP_VERTEX_COLOR_CLAMPED:
|
|
|
|
|
case PIPE_CAP_COMPUTE:
|
2016-11-20 13:13:12 -05:00
|
|
|
case PIPE_CAP_TGSI_VS_LAYER_VIEWPORT:
|
2016-02-16 17:27:28 -06:00
|
|
|
case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS:
|
|
|
|
|
case PIPE_CAP_TGSI_TEXCOORD:
|
|
|
|
|
case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
|
|
|
|
|
case PIPE_CAP_TEXTURE_GATHER_SM5:
|
|
|
|
|
case PIPE_CAP_SAMPLE_SHADING:
|
|
|
|
|
case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
|
|
|
|
|
case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
|
|
|
|
|
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
|
|
|
|
|
case PIPE_CAP_SAMPLER_VIEW_TARGET:
|
|
|
|
|
case PIPE_CAP_VERTEXID_NOBASE:
|
|
|
|
|
case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
|
|
|
|
|
case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
|
|
|
|
|
case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
|
|
|
|
|
case PIPE_CAP_TGSI_TXQS:
|
|
|
|
|
case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
|
|
|
|
|
case PIPE_CAP_SHAREABLE_SHADERS:
|
|
|
|
|
case PIPE_CAP_DRAW_PARAMETERS:
|
|
|
|
|
case PIPE_CAP_TGSI_PACK_HALF_FLOAT:
|
|
|
|
|
case PIPE_CAP_MULTI_DRAW_INDIRECT:
|
|
|
|
|
case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS:
|
|
|
|
|
case PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL:
|
|
|
|
|
case PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL:
|
|
|
|
|
case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
|
|
|
|
|
case PIPE_CAP_INVALIDATE_BUFFER:
|
|
|
|
|
case PIPE_CAP_GENERATE_MIPMAP:
|
|
|
|
|
case PIPE_CAP_STRING_MARKER:
|
|
|
|
|
case PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY:
|
|
|
|
|
case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
|
|
|
|
|
case PIPE_CAP_QUERY_BUFFER_OBJECT:
|
|
|
|
|
case PIPE_CAP_QUERY_MEMORY_INFO:
|
2016-04-12 15:00:31 +02:00
|
|
|
case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
|
2016-04-01 19:58:29 -05:00
|
|
|
case PIPE_CAP_PCI_GROUP:
|
|
|
|
|
case PIPE_CAP_PCI_BUS:
|
|
|
|
|
case PIPE_CAP_PCI_DEVICE:
|
|
|
|
|
case PIPE_CAP_PCI_FUNCTION:
|
2016-04-21 11:10:29 -05:00
|
|
|
case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
|
2016-05-20 21:05:34 -07:00
|
|
|
case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
|
2016-05-29 11:39:52 -04:00
|
|
|
case PIPE_CAP_TGSI_VOTE:
|
2016-06-11 15:26:45 -04:00
|
|
|
case PIPE_CAP_MAX_WINDOW_RECTANGLES:
|
2016-06-13 22:28:32 +02:00
|
|
|
case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
|
2016-07-19 13:07:24 +02:00
|
|
|
case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
|
2016-10-07 09:42:55 +02:00
|
|
|
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
|
2016-11-18 20:49:54 +01:00
|
|
|
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
|
2016-11-26 17:35:31 -05:00
|
|
|
case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
|
2016-12-05 11:35:57 -06:00
|
|
|
case PIPE_CAP_NATIVE_FENCE_FD:
|
2016-12-31 13:34:11 +01:00
|
|
|
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
|
2019-05-14 20:23:36 -07:00
|
|
|
case PIPE_CAP_FBFETCH:
|
2017-01-16 22:14:38 -05:00
|
|
|
case PIPE_CAP_TGSI_MUL_ZERO_WINS:
|
2016-06-09 10:13:03 +10:00
|
|
|
case PIPE_CAP_INT64:
|
2017-02-04 22:31:29 -05:00
|
|
|
case PIPE_CAP_INT64_DIVMOD:
|
2017-03-07 02:09:03 +01:00
|
|
|
case PIPE_CAP_TGSI_TEX_TXF_LZ:
|
2017-03-29 20:44:57 +02:00
|
|
|
case PIPE_CAP_TGSI_CLOCK:
|
2017-03-16 18:00:05 -04:00
|
|
|
case PIPE_CAP_POLYGON_MODE_FILL_RECTANGLE:
|
2017-02-02 21:10:44 +01:00
|
|
|
case PIPE_CAP_SPARSE_BUFFER_PAGE_SIZE:
|
2017-03-30 11:16:09 +02:00
|
|
|
case PIPE_CAP_TGSI_BALLOT:
|
2017-04-13 21:54:54 +02:00
|
|
|
case PIPE_CAP_TGSI_TES_LAYER_VIEWPORT:
|
2017-04-30 01:18:43 +02:00
|
|
|
case PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX:
|
2017-05-15 16:30:30 +02:00
|
|
|
case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
|
2017-05-24 15:42:39 -04:00
|
|
|
case PIPE_CAP_POST_DEPTH_COVERAGE:
|
2017-02-16 13:43:16 +01:00
|
|
|
case PIPE_CAP_BINDLESS_TEXTURE:
|
2017-06-25 18:31:11 +02:00
|
|
|
case PIPE_CAP_NIR_SAMPLERS_AS_DEREF:
|
2017-07-26 19:16:14 +02:00
|
|
|
case PIPE_CAP_QUERY_SO_OVERFLOW:
|
2017-08-03 13:54:45 +10:00
|
|
|
case PIPE_CAP_MEMOBJ:
|
2017-08-17 20:12:42 +10:00
|
|
|
case PIPE_CAP_LOAD_CONSTBUF:
|
2017-09-26 15:56:15 +02:00
|
|
|
case PIPE_CAP_TGSI_ANY_REG_AS_ADDRESS:
|
2017-07-27 12:05:56 -07:00
|
|
|
case PIPE_CAP_TILE_RASTER_ORDER:
|
2017-11-01 09:40:33 +10:00
|
|
|
case PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
|
2018-05-23 17:45:50 -04:00
|
|
|
case PIPE_CAP_FRAMEBUFFER_MSAA_CONSTRAINTS:
|
2017-10-26 01:50:44 +02:00
|
|
|
case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
|
2017-08-23 14:39:55 -04:00
|
|
|
case PIPE_CAP_CONTEXT_PRIORITY_MASK:
|
2017-10-04 17:30:23 -04:00
|
|
|
case PIPE_CAP_FENCE_SIGNAL:
|
2018-01-27 01:52:08 +01:00
|
|
|
case PIPE_CAP_CONSTBUF0_FLAGS:
|
2017-08-18 15:51:48 +10:00
|
|
|
case PIPE_CAP_PACKED_UNIFORMS:
|
2018-04-07 16:15:00 -06:00
|
|
|
case PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_TRIANGLES:
|
|
|
|
|
case PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_POINTS_LINES:
|
|
|
|
|
case PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_TRIANGLES:
|
|
|
|
|
case PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_POINTS_LINES:
|
|
|
|
|
case PIPE_CAP_CONSERVATIVE_RASTER_POST_DEPTH_COVERAGE:
|
|
|
|
|
case PIPE_CAP_MAX_CONSERVATIVE_RASTER_SUBPIXEL_PRECISION_BIAS:
|
2018-06-14 19:56:28 -06:00
|
|
|
case PIPE_CAP_PROGRAMMABLE_SAMPLE_LOCATIONS:
|
2018-08-31 20:52:29 -04:00
|
|
|
case PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET:
|
2019-01-16 23:18:25 +00:00
|
|
|
case PIPE_CAP_IMAGE_LOAD_FORMATTED:
|
2016-02-16 17:27:28 -06:00
|
|
|
return 0;
|
2018-08-06 08:07:25 -04:00
|
|
|
case PIPE_CAP_MAX_GS_INVOCATIONS:
|
|
|
|
|
return 32;
|
2018-08-06 08:38:54 -04:00
|
|
|
case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
|
|
|
|
|
return 1 << 27;
|
2019-02-13 22:32:25 -05:00
|
|
|
case PIPE_CAP_MAX_VARYINGS:
|
|
|
|
|
return 32;
|
2016-11-20 13:31:43 -05:00
|
|
|
|
|
|
|
|
case PIPE_CAP_VENDOR_ID:
|
|
|
|
|
return 0xFFFFFFFF;
|
|
|
|
|
case PIPE_CAP_DEVICE_ID:
|
|
|
|
|
return 0xFFFFFFFF;
|
|
|
|
|
case PIPE_CAP_ACCELERATED:
|
|
|
|
|
return 0;
|
|
|
|
|
case PIPE_CAP_VIDEO_MEMORY: {
|
|
|
|
|
/* XXX: Do we want to return the full amount of system memory ? */
|
|
|
|
|
uint64_t system_memory;
|
|
|
|
|
|
|
|
|
|
if (!os_get_total_physical_memory(&system_memory))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
return (int)(system_memory >> 20);
|
|
|
|
|
}
|
2019-01-30 10:43:40 -06:00
|
|
|
default:
|
|
|
|
|
return u_pipe_screen_get_param_defaults(screen, param);
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
swr_get_shader_param(struct pipe_screen *screen,
|
2017-03-05 12:13:02 -07:00
|
|
|
enum pipe_shader_type shader,
|
2016-02-16 17:27:28 -06:00
|
|
|
enum pipe_shader_cap param)
|
|
|
|
|
{
|
2017-03-02 16:41:02 -06:00
|
|
|
if (shader == PIPE_SHADER_VERTEX ||
|
|
|
|
|
shader == PIPE_SHADER_FRAGMENT ||
|
|
|
|
|
shader == PIPE_SHADER_GEOMETRY)
|
2016-02-16 17:27:28 -06:00
|
|
|
return gallivm_get_shader_param(param);
|
|
|
|
|
|
2017-03-02 16:41:02 -06:00
|
|
|
// Todo: tesselation, compute
|
2016-02-16 17:27:28 -06:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static float
|
|
|
|
|
swr_get_paramf(struct pipe_screen *screen, enum pipe_capf param)
|
|
|
|
|
{
|
|
|
|
|
switch (param) {
|
|
|
|
|
case PIPE_CAPF_MAX_LINE_WIDTH:
|
|
|
|
|
case PIPE_CAPF_MAX_LINE_WIDTH_AA:
|
|
|
|
|
case PIPE_CAPF_MAX_POINT_WIDTH:
|
|
|
|
|
return 255.0; /* arbitrary */
|
|
|
|
|
case PIPE_CAPF_MAX_POINT_WIDTH_AA:
|
|
|
|
|
return 0.0;
|
|
|
|
|
case PIPE_CAPF_MAX_TEXTURE_ANISOTROPY:
|
|
|
|
|
return 0.0;
|
|
|
|
|
case PIPE_CAPF_MAX_TEXTURE_LOD_BIAS:
|
2016-11-19 10:10:47 -05:00
|
|
|
return 16.0; /* arbitrary */
|
2018-04-07 16:15:00 -06:00
|
|
|
case PIPE_CAPF_MIN_CONSERVATIVE_RASTER_DILATE:
|
|
|
|
|
case PIPE_CAPF_MAX_CONSERVATIVE_RASTER_DILATE:
|
|
|
|
|
case PIPE_CAPF_CONSERVATIVE_RASTER_DILATE_GRANULARITY:
|
|
|
|
|
return 0.0f;
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
|
|
|
|
/* should only get here on unhandled cases */
|
|
|
|
|
debug_printf("Unexpected PIPE_CAPF %d query\n", param);
|
|
|
|
|
return 0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SWR_FORMAT
|
|
|
|
|
mesa_to_swr_format(enum pipe_format format)
|
|
|
|
|
{
|
2016-09-20 11:15:55 -05:00
|
|
|
static const std::map<pipe_format,SWR_FORMAT> mesa2swr = {
|
2016-11-20 17:42:26 -05:00
|
|
|
/* depth / stencil */
|
2016-09-20 11:15:55 -05:00
|
|
|
{PIPE_FORMAT_Z16_UNORM, R16_UNORM}, // z
|
|
|
|
|
{PIPE_FORMAT_Z32_FLOAT, R32_FLOAT}, // z
|
|
|
|
|
{PIPE_FORMAT_Z24_UNORM_S8_UINT, R24_UNORM_X8_TYPELESS}, // z
|
|
|
|
|
{PIPE_FORMAT_Z24X8_UNORM, R24_UNORM_X8_TYPELESS}, // z
|
2016-11-20 17:42:26 -05:00
|
|
|
{PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, R32_FLOAT_X8X24_TYPELESS}, // z
|
|
|
|
|
|
|
|
|
|
/* alpha */
|
|
|
|
|
{PIPE_FORMAT_A8_UNORM, A8_UNORM},
|
|
|
|
|
{PIPE_FORMAT_A16_UNORM, A16_UNORM},
|
|
|
|
|
{PIPE_FORMAT_A16_FLOAT, A16_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_A32_FLOAT, A32_FLOAT},
|
|
|
|
|
|
|
|
|
|
/* odd sizes, bgr */
|
|
|
|
|
{PIPE_FORMAT_B5G6R5_UNORM, B5G6R5_UNORM},
|
|
|
|
|
{PIPE_FORMAT_B5G6R5_SRGB, B5G6R5_UNORM_SRGB},
|
|
|
|
|
{PIPE_FORMAT_B5G5R5A1_UNORM, B5G5R5A1_UNORM},
|
|
|
|
|
{PIPE_FORMAT_B5G5R5X1_UNORM, B5G5R5X1_UNORM},
|
|
|
|
|
{PIPE_FORMAT_B4G4R4A4_UNORM, B4G4R4A4_UNORM},
|
|
|
|
|
{PIPE_FORMAT_B8G8R8A8_UNORM, B8G8R8A8_UNORM},
|
|
|
|
|
{PIPE_FORMAT_B8G8R8A8_SRGB, B8G8R8A8_UNORM_SRGB},
|
|
|
|
|
{PIPE_FORMAT_B8G8R8X8_UNORM, B8G8R8X8_UNORM},
|
|
|
|
|
{PIPE_FORMAT_B8G8R8X8_SRGB, B8G8R8X8_UNORM_SRGB},
|
|
|
|
|
|
|
|
|
|
/* rgb10a2 */
|
|
|
|
|
{PIPE_FORMAT_R10G10B10A2_UNORM, R10G10B10A2_UNORM},
|
|
|
|
|
{PIPE_FORMAT_R10G10B10A2_SNORM, R10G10B10A2_SNORM},
|
|
|
|
|
{PIPE_FORMAT_R10G10B10A2_USCALED, R10G10B10A2_USCALED},
|
|
|
|
|
{PIPE_FORMAT_R10G10B10A2_SSCALED, R10G10B10A2_SSCALED},
|
|
|
|
|
{PIPE_FORMAT_R10G10B10A2_UINT, R10G10B10A2_UINT},
|
|
|
|
|
|
|
|
|
|
/* rgb10x2 */
|
|
|
|
|
{PIPE_FORMAT_R10G10B10X2_USCALED, R10G10B10X2_USCALED},
|
|
|
|
|
|
|
|
|
|
/* bgr10a2 */
|
|
|
|
|
{PIPE_FORMAT_B10G10R10A2_UNORM, B10G10R10A2_UNORM},
|
|
|
|
|
{PIPE_FORMAT_B10G10R10A2_SNORM, B10G10R10A2_SNORM},
|
|
|
|
|
{PIPE_FORMAT_B10G10R10A2_USCALED, B10G10R10A2_USCALED},
|
|
|
|
|
{PIPE_FORMAT_B10G10R10A2_SSCALED, B10G10R10A2_SSCALED},
|
|
|
|
|
{PIPE_FORMAT_B10G10R10A2_UINT, B10G10R10A2_UINT},
|
|
|
|
|
|
|
|
|
|
/* bgr10x2 */
|
|
|
|
|
{PIPE_FORMAT_B10G10R10X2_UNORM, B10G10R10X2_UNORM},
|
|
|
|
|
|
|
|
|
|
/* r11g11b10 */
|
|
|
|
|
{PIPE_FORMAT_R11G11B10_FLOAT, R11G11B10_FLOAT},
|
|
|
|
|
|
|
|
|
|
/* 32 bits per component */
|
2016-09-20 11:15:55 -05:00
|
|
|
{PIPE_FORMAT_R32_FLOAT, R32_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_R32G32_FLOAT, R32G32_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_R32G32B32_FLOAT, R32G32B32_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_R32G32B32A32_FLOAT, R32G32B32A32_FLOAT},
|
2016-11-20 17:42:26 -05:00
|
|
|
{PIPE_FORMAT_R32G32B32X32_FLOAT, R32G32B32X32_FLOAT},
|
|
|
|
|
|
2016-09-20 11:15:55 -05:00
|
|
|
{PIPE_FORMAT_R32_USCALED, R32_USCALED},
|
|
|
|
|
{PIPE_FORMAT_R32G32_USCALED, R32G32_USCALED},
|
|
|
|
|
{PIPE_FORMAT_R32G32B32_USCALED, R32G32B32_USCALED},
|
|
|
|
|
{PIPE_FORMAT_R32G32B32A32_USCALED, R32G32B32A32_USCALED},
|
2016-11-20 17:42:26 -05:00
|
|
|
|
2016-09-20 11:15:55 -05:00
|
|
|
{PIPE_FORMAT_R32_SSCALED, R32_SSCALED},
|
|
|
|
|
{PIPE_FORMAT_R32G32_SSCALED, R32G32_SSCALED},
|
|
|
|
|
{PIPE_FORMAT_R32G32B32_SSCALED, R32G32B32_SSCALED},
|
|
|
|
|
{PIPE_FORMAT_R32G32B32A32_SSCALED, R32G32B32A32_SSCALED},
|
2016-11-20 17:42:26 -05:00
|
|
|
|
|
|
|
|
{PIPE_FORMAT_R32_UINT, R32_UINT},
|
|
|
|
|
{PIPE_FORMAT_R32G32_UINT, R32G32_UINT},
|
|
|
|
|
{PIPE_FORMAT_R32G32B32_UINT, R32G32B32_UINT},
|
|
|
|
|
{PIPE_FORMAT_R32G32B32A32_UINT, R32G32B32A32_UINT},
|
|
|
|
|
|
|
|
|
|
{PIPE_FORMAT_R32_SINT, R32_SINT},
|
|
|
|
|
{PIPE_FORMAT_R32G32_SINT, R32G32_SINT},
|
|
|
|
|
{PIPE_FORMAT_R32G32B32_SINT, R32G32B32_SINT},
|
|
|
|
|
{PIPE_FORMAT_R32G32B32A32_SINT, R32G32B32A32_SINT},
|
|
|
|
|
|
|
|
|
|
/* 16 bits per component */
|
2016-09-20 11:15:55 -05:00
|
|
|
{PIPE_FORMAT_R16_UNORM, R16_UNORM},
|
|
|
|
|
{PIPE_FORMAT_R16G16_UNORM, R16G16_UNORM},
|
|
|
|
|
{PIPE_FORMAT_R16G16B16_UNORM, R16G16B16_UNORM},
|
|
|
|
|
{PIPE_FORMAT_R16G16B16A16_UNORM, R16G16B16A16_UNORM},
|
2016-11-20 17:42:26 -05:00
|
|
|
{PIPE_FORMAT_R16G16B16X16_UNORM, R16G16B16X16_UNORM},
|
|
|
|
|
|
2016-09-20 11:15:55 -05:00
|
|
|
{PIPE_FORMAT_R16_USCALED, R16_USCALED},
|
|
|
|
|
{PIPE_FORMAT_R16G16_USCALED, R16G16_USCALED},
|
|
|
|
|
{PIPE_FORMAT_R16G16B16_USCALED, R16G16B16_USCALED},
|
|
|
|
|
{PIPE_FORMAT_R16G16B16A16_USCALED, R16G16B16A16_USCALED},
|
2016-11-20 17:42:26 -05:00
|
|
|
|
2016-09-20 11:15:55 -05:00
|
|
|
{PIPE_FORMAT_R16_SNORM, R16_SNORM},
|
|
|
|
|
{PIPE_FORMAT_R16G16_SNORM, R16G16_SNORM},
|
|
|
|
|
{PIPE_FORMAT_R16G16B16_SNORM, R16G16B16_SNORM},
|
|
|
|
|
{PIPE_FORMAT_R16G16B16A16_SNORM, R16G16B16A16_SNORM},
|
2016-11-20 17:42:26 -05:00
|
|
|
|
2016-09-20 11:15:55 -05:00
|
|
|
{PIPE_FORMAT_R16_SSCALED, R16_SSCALED},
|
|
|
|
|
{PIPE_FORMAT_R16G16_SSCALED, R16G16_SSCALED},
|
|
|
|
|
{PIPE_FORMAT_R16G16B16_SSCALED, R16G16B16_SSCALED},
|
|
|
|
|
{PIPE_FORMAT_R16G16B16A16_SSCALED, R16G16B16A16_SSCALED},
|
2016-11-20 17:42:26 -05:00
|
|
|
|
|
|
|
|
{PIPE_FORMAT_R16_UINT, R16_UINT},
|
|
|
|
|
{PIPE_FORMAT_R16G16_UINT, R16G16_UINT},
|
|
|
|
|
{PIPE_FORMAT_R16G16B16_UINT, R16G16B16_UINT},
|
|
|
|
|
{PIPE_FORMAT_R16G16B16A16_UINT, R16G16B16A16_UINT},
|
|
|
|
|
|
|
|
|
|
{PIPE_FORMAT_R16_SINT, R16_SINT},
|
|
|
|
|
{PIPE_FORMAT_R16G16_SINT, R16G16_SINT},
|
|
|
|
|
{PIPE_FORMAT_R16G16B16_SINT, R16G16B16_SINT},
|
|
|
|
|
{PIPE_FORMAT_R16G16B16A16_SINT, R16G16B16A16_SINT},
|
|
|
|
|
|
|
|
|
|
{PIPE_FORMAT_R16_FLOAT, R16_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_R16G16_FLOAT, R16G16_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_R16G16B16_FLOAT, R16G16B16_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_R16G16B16A16_FLOAT, R16G16B16A16_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_R16G16B16X16_FLOAT, R16G16B16X16_FLOAT},
|
|
|
|
|
|
|
|
|
|
/* 8 bits per component */
|
2016-09-20 11:15:55 -05:00
|
|
|
{PIPE_FORMAT_R8_UNORM, R8_UNORM},
|
|
|
|
|
{PIPE_FORMAT_R8G8_UNORM, R8G8_UNORM},
|
|
|
|
|
{PIPE_FORMAT_R8G8B8_UNORM, R8G8B8_UNORM},
|
2016-11-20 17:42:26 -05:00
|
|
|
{PIPE_FORMAT_R8G8B8_SRGB, R8G8B8_UNORM_SRGB},
|
2016-09-20 11:15:55 -05:00
|
|
|
{PIPE_FORMAT_R8G8B8A8_UNORM, R8G8B8A8_UNORM},
|
2016-11-20 17:42:26 -05:00
|
|
|
{PIPE_FORMAT_R8G8B8A8_SRGB, R8G8B8A8_UNORM_SRGB},
|
|
|
|
|
{PIPE_FORMAT_R8G8B8X8_UNORM, R8G8B8X8_UNORM},
|
2016-11-20 17:51:24 -05:00
|
|
|
{PIPE_FORMAT_R8G8B8X8_SRGB, R8G8B8X8_UNORM_SRGB},
|
2016-11-20 17:42:26 -05:00
|
|
|
|
2016-09-20 11:15:55 -05:00
|
|
|
{PIPE_FORMAT_R8_USCALED, R8_USCALED},
|
|
|
|
|
{PIPE_FORMAT_R8G8_USCALED, R8G8_USCALED},
|
|
|
|
|
{PIPE_FORMAT_R8G8B8_USCALED, R8G8B8_USCALED},
|
|
|
|
|
{PIPE_FORMAT_R8G8B8A8_USCALED, R8G8B8A8_USCALED},
|
2016-11-20 17:42:26 -05:00
|
|
|
|
2016-09-20 11:15:55 -05:00
|
|
|
{PIPE_FORMAT_R8_SNORM, R8_SNORM},
|
|
|
|
|
{PIPE_FORMAT_R8G8_SNORM, R8G8_SNORM},
|
|
|
|
|
{PIPE_FORMAT_R8G8B8_SNORM, R8G8B8_SNORM},
|
|
|
|
|
{PIPE_FORMAT_R8G8B8A8_SNORM, R8G8B8A8_SNORM},
|
2016-11-20 17:42:26 -05:00
|
|
|
|
2016-09-20 11:15:55 -05:00
|
|
|
{PIPE_FORMAT_R8_SSCALED, R8_SSCALED},
|
|
|
|
|
{PIPE_FORMAT_R8G8_SSCALED, R8G8_SSCALED},
|
|
|
|
|
{PIPE_FORMAT_R8G8B8_SSCALED, R8G8B8_SSCALED},
|
|
|
|
|
{PIPE_FORMAT_R8G8B8A8_SSCALED, R8G8B8A8_SSCALED},
|
|
|
|
|
|
|
|
|
|
{PIPE_FORMAT_R8_UINT, R8_UINT},
|
|
|
|
|
{PIPE_FORMAT_R8G8_UINT, R8G8_UINT},
|
|
|
|
|
{PIPE_FORMAT_R8G8B8_UINT, R8G8B8_UINT},
|
|
|
|
|
{PIPE_FORMAT_R8G8B8A8_UINT, R8G8B8A8_UINT},
|
|
|
|
|
|
|
|
|
|
{PIPE_FORMAT_R8_SINT, R8_SINT},
|
|
|
|
|
{PIPE_FORMAT_R8G8_SINT, R8G8_SINT},
|
|
|
|
|
{PIPE_FORMAT_R8G8B8_SINT, R8G8B8_SINT},
|
|
|
|
|
{PIPE_FORMAT_R8G8B8A8_SINT, R8G8B8A8_SINT},
|
|
|
|
|
|
2016-12-07 17:04:20 -06:00
|
|
|
/* These formats are valid for vertex data, but should not be used
|
|
|
|
|
* for render targets.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
{PIPE_FORMAT_R32_FIXED, R32_SFIXED},
|
|
|
|
|
{PIPE_FORMAT_R32G32_FIXED, R32G32_SFIXED},
|
|
|
|
|
{PIPE_FORMAT_R32G32B32_FIXED, R32G32B32_SFIXED},
|
|
|
|
|
{PIPE_FORMAT_R32G32B32A32_FIXED, R32G32B32A32_SFIXED},
|
|
|
|
|
|
2017-01-05 07:29:22 -06:00
|
|
|
{PIPE_FORMAT_R64_FLOAT, R64_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_R64G64_FLOAT, R64G64_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_R64G64B64_FLOAT, R64G64B64_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_R64G64B64A64_FLOAT, R64G64B64A64_FLOAT},
|
|
|
|
|
|
2016-11-12 13:09:21 -05:00
|
|
|
/* These formats have entries in SWR but don't have Load/StoreTile
|
|
|
|
|
* implementations. That means these aren't renderable, and thus having
|
|
|
|
|
* a mapping entry here is detrimental.
|
|
|
|
|
*/
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
{PIPE_FORMAT_L8_UNORM, L8_UNORM},
|
|
|
|
|
{PIPE_FORMAT_I8_UNORM, I8_UNORM},
|
|
|
|
|
{PIPE_FORMAT_L8A8_UNORM, L8A8_UNORM},
|
|
|
|
|
{PIPE_FORMAT_L16_UNORM, L16_UNORM},
|
|
|
|
|
{PIPE_FORMAT_UYVY, YCRCB_SWAPUVY},
|
|
|
|
|
|
|
|
|
|
{PIPE_FORMAT_L8_SRGB, L8_UNORM_SRGB},
|
|
|
|
|
{PIPE_FORMAT_L8A8_SRGB, L8A8_UNORM_SRGB},
|
|
|
|
|
|
|
|
|
|
{PIPE_FORMAT_DXT1_RGBA, BC1_UNORM},
|
|
|
|
|
{PIPE_FORMAT_DXT3_RGBA, BC2_UNORM},
|
|
|
|
|
{PIPE_FORMAT_DXT5_RGBA, BC3_UNORM},
|
|
|
|
|
|
|
|
|
|
{PIPE_FORMAT_DXT1_SRGBA, BC1_UNORM_SRGB},
|
|
|
|
|
{PIPE_FORMAT_DXT3_SRGBA, BC2_UNORM_SRGB},
|
|
|
|
|
{PIPE_FORMAT_DXT5_SRGBA, BC3_UNORM_SRGB},
|
|
|
|
|
|
|
|
|
|
{PIPE_FORMAT_RGTC1_UNORM, BC4_UNORM},
|
|
|
|
|
{PIPE_FORMAT_RGTC1_SNORM, BC4_SNORM},
|
|
|
|
|
{PIPE_FORMAT_RGTC2_UNORM, BC5_UNORM},
|
|
|
|
|
{PIPE_FORMAT_RGTC2_SNORM, BC5_SNORM},
|
|
|
|
|
|
|
|
|
|
{PIPE_FORMAT_L16A16_UNORM, L16A16_UNORM},
|
|
|
|
|
{PIPE_FORMAT_I16_UNORM, I16_UNORM},
|
|
|
|
|
{PIPE_FORMAT_L16_FLOAT, L16_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_L16A16_FLOAT, L16A16_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_I16_FLOAT, I16_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_L32_FLOAT, L32_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_L32A32_FLOAT, L32A32_FLOAT},
|
|
|
|
|
{PIPE_FORMAT_I32_FLOAT, I32_FLOAT},
|
|
|
|
|
|
|
|
|
|
{PIPE_FORMAT_I8_UINT, I8_UINT},
|
|
|
|
|
{PIPE_FORMAT_L8_UINT, L8_UINT},
|
|
|
|
|
{PIPE_FORMAT_L8A8_UINT, L8A8_UINT},
|
|
|
|
|
|
|
|
|
|
{PIPE_FORMAT_I8_SINT, I8_SINT},
|
|
|
|
|
{PIPE_FORMAT_L8_SINT, L8_SINT},
|
|
|
|
|
{PIPE_FORMAT_L8A8_SINT, L8A8_SINT},
|
|
|
|
|
|
|
|
|
|
*/
|
2016-09-20 11:15:55 -05:00
|
|
|
};
|
|
|
|
|
|
swr: avoid using exceptions for expected condition handling
I was getting a weird segfault from GCC 4.9.3:
0x00007ffff54f27aa in strlen () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff54f27aa in strlen () from /lib64/libc.so.6
#1 0x00007ffff4f128e5 in get_cie_encoding (cie=cie@entry=0x7ffff6e09813)
at /gcc-4.9.3/libgcc/unwind-dw2-fde.c:272
#2 0x00007ffff4f1318e in classify_object_over_fdes (ob=ob@entry=0xd7bb90, this_fde=0x7ffff7f11010)
at /gcc-4.9.3/libgcc/unwind-dw2-fde.c:628
#3 0x00007ffff4f135ba in init_object (ob=0xd7bb90)
at /gcc-4.9.3/libgcc/unwind-dw2-fde.c:749
#4 search_object (ob=ob@entry=0xd7bb90, pc=pc@entry=0x7ffff4f11f4d <_Unwind_RaiseException+61>)
at /gcc-4.9.3/libgcc/unwind-dw2-fde.c:961
#5 0x00007ffff4f13e62 in _Unwind_Find_registered_FDE (bases=0x7fffffffd358, pc=0x7ffff4f11f4d <_Unwind_RaiseException+61>)
at /gcc-4.9.3/libgcc/unwind-dw2-fde.c:1025
#6 _Unwind_Find_FDE (pc=0x7ffff4f11f4d <_Unwind_RaiseException+61>, bases=bases@entry=0x7fffffffd358)
at /gcc-4.9.3/libgcc/unwind-dw2-fde-dip.c:450
#7 0x00007ffff4f11197 in uw_frame_state_for (context=context@entry=0x7fffffffd2b0, fs=fs@entry=0x7fffffffd100)
at /gcc-4.9.3/libgcc/unwind-dw2.c:1245
#8 0x00007ffff4f11b15 in uw_init_context_1 (context=context@entry=0x7fffffffd2b0, outer_cfa=outer_cfa@entry=0x7fffffffd660, outer_ra=0x7ffff518d23b <__cxa_throw+91>)
at /gcc-4.9.3/libgcc/unwind-dw2.c:1566
#9 0x00007ffff4f11f4e in _Unwind_RaiseException (exc=0xd7c250)
at /gcc-4.9.3/libgcc/unwind.inc:88
#10 0x00007ffff518d23b in __cxa_throw () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libstdc++.so.6
#11 0x00007ffff51ed556 in std::__throw_out_of_range(char const*) ()
from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libstdc++.so.6
#12 0x00007fffea778be0 in std::map<pipe_format, SWR_FORMAT, std::less<pipe_format>, std::allocator<std::pair<pipe_format const, SWR_FORMAT> > >::at (
this=0x7fffebeb4c40 <mesa_to_swr_format(pipe_format)::mesa2swr>,
__k=@0x7fffffffd73c: PIPE_FORMAT_RGTC1_UNORM)
at /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4/bits/stl_map.h:549
#13 0x00007fffea776aee in mesa_to_swr_format (format=PIPE_FORMAT_RGTC1_UNORM) at swr_screen.cpp:597
We can just void this whole issue by not using exceptions in the
first place.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
2016-11-12 22:18:48 -05:00
|
|
|
auto it = mesa2swr.find(format);
|
|
|
|
|
if (it == mesa2swr.end())
|
2016-09-20 11:15:55 -05:00
|
|
|
return (SWR_FORMAT)-1;
|
swr: avoid using exceptions for expected condition handling
I was getting a weird segfault from GCC 4.9.3:
0x00007ffff54f27aa in strlen () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff54f27aa in strlen () from /lib64/libc.so.6
#1 0x00007ffff4f128e5 in get_cie_encoding (cie=cie@entry=0x7ffff6e09813)
at /gcc-4.9.3/libgcc/unwind-dw2-fde.c:272
#2 0x00007ffff4f1318e in classify_object_over_fdes (ob=ob@entry=0xd7bb90, this_fde=0x7ffff7f11010)
at /gcc-4.9.3/libgcc/unwind-dw2-fde.c:628
#3 0x00007ffff4f135ba in init_object (ob=0xd7bb90)
at /gcc-4.9.3/libgcc/unwind-dw2-fde.c:749
#4 search_object (ob=ob@entry=0xd7bb90, pc=pc@entry=0x7ffff4f11f4d <_Unwind_RaiseException+61>)
at /gcc-4.9.3/libgcc/unwind-dw2-fde.c:961
#5 0x00007ffff4f13e62 in _Unwind_Find_registered_FDE (bases=0x7fffffffd358, pc=0x7ffff4f11f4d <_Unwind_RaiseException+61>)
at /gcc-4.9.3/libgcc/unwind-dw2-fde.c:1025
#6 _Unwind_Find_FDE (pc=0x7ffff4f11f4d <_Unwind_RaiseException+61>, bases=bases@entry=0x7fffffffd358)
at /gcc-4.9.3/libgcc/unwind-dw2-fde-dip.c:450
#7 0x00007ffff4f11197 in uw_frame_state_for (context=context@entry=0x7fffffffd2b0, fs=fs@entry=0x7fffffffd100)
at /gcc-4.9.3/libgcc/unwind-dw2.c:1245
#8 0x00007ffff4f11b15 in uw_init_context_1 (context=context@entry=0x7fffffffd2b0, outer_cfa=outer_cfa@entry=0x7fffffffd660, outer_ra=0x7ffff518d23b <__cxa_throw+91>)
at /gcc-4.9.3/libgcc/unwind-dw2.c:1566
#9 0x00007ffff4f11f4e in _Unwind_RaiseException (exc=0xd7c250)
at /gcc-4.9.3/libgcc/unwind.inc:88
#10 0x00007ffff518d23b in __cxa_throw () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libstdc++.so.6
#11 0x00007ffff51ed556 in std::__throw_out_of_range(char const*) ()
from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libstdc++.so.6
#12 0x00007fffea778be0 in std::map<pipe_format, SWR_FORMAT, std::less<pipe_format>, std::allocator<std::pair<pipe_format const, SWR_FORMAT> > >::at (
this=0x7fffebeb4c40 <mesa_to_swr_format(pipe_format)::mesa2swr>,
__k=@0x7fffffffd73c: PIPE_FORMAT_RGTC1_UNORM)
at /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4/bits/stl_map.h:549
#13 0x00007fffea776aee in mesa_to_swr_format (format=PIPE_FORMAT_RGTC1_UNORM) at swr_screen.cpp:597
We can just void this whole issue by not using exceptions in the
first place.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
2016-11-12 22:18:48 -05:00
|
|
|
else
|
|
|
|
|
return it->second;
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
|
|
|
|
|
2019-07-04 11:41:41 -04:00
|
|
|
static bool
|
2016-02-16 17:27:28 -06:00
|
|
|
swr_displaytarget_layout(struct swr_screen *screen, struct swr_resource *res)
|
|
|
|
|
{
|
|
|
|
|
struct sw_winsys *winsys = screen->winsys;
|
|
|
|
|
struct sw_displaytarget *dt;
|
|
|
|
|
|
2016-11-09 17:16:36 -05:00
|
|
|
const unsigned width = align(res->swr.width, res->swr.halign);
|
|
|
|
|
const unsigned height = align(res->swr.height, res->swr.valign);
|
|
|
|
|
|
2016-02-16 17:27:28 -06:00
|
|
|
UINT stride;
|
|
|
|
|
dt = winsys->displaytarget_create(winsys,
|
|
|
|
|
res->base.bind,
|
|
|
|
|
res->base.format,
|
2016-11-09 17:16:36 -05:00
|
|
|
width, height,
|
2016-02-16 17:27:28 -06:00
|
|
|
64, NULL,
|
|
|
|
|
&stride);
|
|
|
|
|
|
|
|
|
|
if (dt == NULL)
|
2019-07-04 11:41:41 -04:00
|
|
|
return false;
|
2016-02-16 17:27:28 -06:00
|
|
|
|
|
|
|
|
void *map = winsys->displaytarget_map(winsys, dt, 0);
|
|
|
|
|
|
|
|
|
|
res->display_target = dt;
|
2017-09-07 15:17:23 -05:00
|
|
|
res->swr.xpBaseAddress = (gfxptr_t)map;
|
2016-02-16 17:27:28 -06:00
|
|
|
|
|
|
|
|
/* Clear the display target surface */
|
|
|
|
|
if (map)
|
2016-11-09 17:16:36 -05:00
|
|
|
memset(map, 0, height * stride);
|
2016-02-16 17:27:28 -06:00
|
|
|
|
|
|
|
|
winsys->displaytarget_unmap(winsys, dt);
|
|
|
|
|
|
2019-07-04 11:41:41 -04:00
|
|
|
return true;
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
|
|
|
|
|
2016-11-09 17:16:36 -05:00
|
|
|
static bool
|
2016-02-16 17:27:28 -06:00
|
|
|
swr_texture_layout(struct swr_screen *screen,
|
|
|
|
|
struct swr_resource *res,
|
2019-07-04 11:41:41 -04:00
|
|
|
bool allocate)
|
2016-02-16 17:27:28 -06:00
|
|
|
{
|
|
|
|
|
struct pipe_resource *pt = &res->base;
|
|
|
|
|
|
|
|
|
|
pipe_format fmt = pt->format;
|
|
|
|
|
const struct util_format_description *desc = util_format_description(fmt);
|
|
|
|
|
|
|
|
|
|
res->has_depth = util_format_has_depth(desc);
|
|
|
|
|
res->has_stencil = util_format_has_stencil(desc);
|
|
|
|
|
|
|
|
|
|
if (res->has_stencil && !res->has_depth)
|
|
|
|
|
fmt = PIPE_FORMAT_R8_UINT;
|
|
|
|
|
|
2016-11-09 17:16:36 -05:00
|
|
|
/* We always use the SWR layout. For 2D and 3D textures this looks like:
|
|
|
|
|
*
|
|
|
|
|
* |<------- pitch ------->|
|
|
|
|
|
* +=======================+-------
|
|
|
|
|
* |Array 0 | ^
|
|
|
|
|
* | | |
|
|
|
|
|
* | Level 0 | |
|
|
|
|
|
* | | |
|
|
|
|
|
* | | qpitch
|
|
|
|
|
* +-----------+-----------+ |
|
|
|
|
|
* | | L2L2L2L2 | |
|
|
|
|
|
* | Level 1 | L3L3 | |
|
|
|
|
|
* | | L4 | v
|
|
|
|
|
* +===========+===========+-------
|
|
|
|
|
* |Array 1 |
|
|
|
|
|
* | |
|
|
|
|
|
* | Level 0 |
|
|
|
|
|
* | |
|
|
|
|
|
* | |
|
|
|
|
|
* +-----------+-----------+
|
|
|
|
|
* | | L2L2L2L2 |
|
|
|
|
|
* | Level 1 | L3L3 |
|
|
|
|
|
* | | L4 |
|
|
|
|
|
* +===========+===========+
|
|
|
|
|
*
|
|
|
|
|
* The overall width in bytes is known as the pitch, while the overall
|
|
|
|
|
* height in rows is the qpitch. Array slices are laid out logically below
|
|
|
|
|
* one another, qpitch rows apart. For 3D surfaces, the "level" values are
|
|
|
|
|
* just invalid for the higher array numbers (since depth is also
|
|
|
|
|
* minified). 1D and 1D array surfaces are stored effectively the same way,
|
|
|
|
|
* except that pitch never plays into it. All the levels are logically
|
|
|
|
|
* adjacent to each other on the X axis. The qpitch becomes the number of
|
|
|
|
|
* elements between array slices, while the pitch is unused.
|
|
|
|
|
*
|
|
|
|
|
* Each level's sizes are subject to the valign and halign settings of the
|
|
|
|
|
* surface. For compressed formats that swr is unaware of, we will use an
|
|
|
|
|
* appropriately-sized uncompressed format, and scale the widths/heights.
|
|
|
|
|
*
|
|
|
|
|
* This surface is stored inside res->swr. For depth/stencil textures,
|
|
|
|
|
* res->secondary will have an identically-laid-out but R8_UINT-formatted
|
|
|
|
|
* stencil tree. In the Z32F_S8 case, the primary surface still has 64-bpp
|
|
|
|
|
* texels, to simplify map/unmap logic which copies the stencil values
|
|
|
|
|
* in/out.
|
|
|
|
|
*/
|
|
|
|
|
|
2016-02-16 17:27:28 -06:00
|
|
|
res->swr.width = pt->width0;
|
|
|
|
|
res->swr.height = pt->height0;
|
|
|
|
|
res->swr.type = swr_convert_target_type(pt->target);
|
|
|
|
|
res->swr.tileMode = SWR_TILE_NONE;
|
|
|
|
|
res->swr.format = mesa_to_swr_format(fmt);
|
2016-11-09 17:16:36 -05:00
|
|
|
res->swr.numSamples = std::max(1u, pt->nr_samples);
|
|
|
|
|
|
|
|
|
|
if (pt->bind & (PIPE_BIND_RENDER_TARGET | PIPE_BIND_DEPTH_STENCIL)) {
|
|
|
|
|
res->swr.halign = KNOB_MACROTILE_X_DIM;
|
|
|
|
|
res->swr.valign = KNOB_MACROTILE_Y_DIM;
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
|
|
|
|
|
/* If SWR_MSAA_FORCE_ENABLE is set, turn on MSAA and override requested
|
|
|
|
|
* surface sample count. */
|
|
|
|
|
if (screen->msaa_force_enable) {
|
|
|
|
|
res->swr.numSamples = screen->msaa_max_count;
|
|
|
|
|
fprintf(stderr,"swr_texture_layout: forcing sample count: %d\n",
|
|
|
|
|
res->swr.numSamples);
|
|
|
|
|
}
|
2016-11-09 17:16:36 -05:00
|
|
|
} else {
|
|
|
|
|
res->swr.halign = 1;
|
|
|
|
|
res->swr.valign = 1;
|
|
|
|
|
}
|
2016-02-16 17:27:28 -06:00
|
|
|
|
2016-11-09 17:16:36 -05:00
|
|
|
unsigned halign = res->swr.halign * util_format_get_blockwidth(fmt);
|
|
|
|
|
unsigned width = align(pt->width0, halign);
|
|
|
|
|
if (pt->target == PIPE_TEXTURE_1D || pt->target == PIPE_TEXTURE_1D_ARRAY) {
|
|
|
|
|
for (int level = 1; level <= pt->last_level; level++)
|
|
|
|
|
width += align(u_minify(pt->width0, level), halign);
|
|
|
|
|
res->swr.pitch = util_format_get_blocksize(fmt);
|
|
|
|
|
res->swr.qpitch = util_format_get_nblocksx(fmt, width);
|
|
|
|
|
} else {
|
|
|
|
|
// The pitch is the overall width of the texture in bytes. Most of the
|
|
|
|
|
// time this is the pitch of level 0 since all the other levels fit
|
|
|
|
|
// underneath it. However in some degenerate situations, the width of
|
|
|
|
|
// level1 + level2 may be larger. In that case, we use those
|
|
|
|
|
// widths. This can happen if, e.g. halign is 32, and the width of level
|
|
|
|
|
// 0 is 32 or less. In that case, the aligned levels 1 and 2 will also
|
|
|
|
|
// be 32 each, adding up to 64.
|
|
|
|
|
unsigned valign = res->swr.valign * util_format_get_blockheight(fmt);
|
|
|
|
|
if (pt->last_level > 1) {
|
|
|
|
|
width = std::max<uint32_t>(
|
|
|
|
|
width,
|
|
|
|
|
align(u_minify(pt->width0, 1), halign) +
|
|
|
|
|
align(u_minify(pt->width0, 2), halign));
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
2016-11-09 17:16:36 -05:00
|
|
|
res->swr.pitch = util_format_get_stride(fmt, width);
|
|
|
|
|
|
|
|
|
|
// The qpitch is controlled by either the height of the second LOD, or
|
|
|
|
|
// the combination of all the later LODs.
|
|
|
|
|
unsigned height = align(pt->height0, valign);
|
|
|
|
|
if (pt->last_level == 1) {
|
|
|
|
|
height += align(u_minify(pt->height0, 1), valign);
|
|
|
|
|
} else if (pt->last_level > 1) {
|
|
|
|
|
unsigned level1 = align(u_minify(pt->height0, 1), valign);
|
|
|
|
|
unsigned level2 = 0;
|
|
|
|
|
for (int level = 2; level <= pt->last_level; level++) {
|
|
|
|
|
level2 += align(u_minify(pt->height0, level), valign);
|
|
|
|
|
}
|
|
|
|
|
height += std::max(level1, level2);
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
2016-11-09 17:16:36 -05:00
|
|
|
res->swr.qpitch = util_format_get_nblocksy(fmt, height);
|
|
|
|
|
}
|
2016-02-16 17:27:28 -06:00
|
|
|
|
2016-11-09 17:16:36 -05:00
|
|
|
if (pt->target == PIPE_TEXTURE_3D)
|
|
|
|
|
res->swr.depth = pt->depth0;
|
|
|
|
|
else
|
|
|
|
|
res->swr.depth = pt->array_size;
|
|
|
|
|
|
|
|
|
|
// Fix up swr format if necessary so that LOD offset computation works
|
|
|
|
|
if (res->swr.format == (SWR_FORMAT)-1) {
|
|
|
|
|
switch (util_format_get_blocksize(fmt)) {
|
|
|
|
|
default:
|
|
|
|
|
unreachable("Unexpected format block size");
|
|
|
|
|
case 1: res->swr.format = R8_UINT; break;
|
|
|
|
|
case 2: res->swr.format = R16_UINT; break;
|
|
|
|
|
case 4: res->swr.format = R32_UINT; break;
|
|
|
|
|
case 8:
|
|
|
|
|
if (util_format_is_compressed(fmt))
|
|
|
|
|
res->swr.format = BC4_UNORM;
|
|
|
|
|
else
|
|
|
|
|
res->swr.format = R32G32_UINT;
|
|
|
|
|
break;
|
|
|
|
|
case 16:
|
|
|
|
|
if (util_format_is_compressed(fmt))
|
|
|
|
|
res->swr.format = BC5_UNORM;
|
|
|
|
|
else
|
|
|
|
|
res->swr.format = R32G32B32A32_UINT;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-02-16 17:27:28 -06:00
|
|
|
|
2016-11-09 17:16:36 -05:00
|
|
|
for (int level = 0; level <= pt->last_level; level++) {
|
|
|
|
|
res->mip_offsets[level] =
|
|
|
|
|
ComputeSurfaceOffset<false>(0, 0, 0, 0, 0, level, &res->swr);
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
|
|
|
|
|
2017-11-20 11:32:55 -06:00
|
|
|
size_t total_size = (uint64_t)res->swr.depth * res->swr.qpitch *
|
|
|
|
|
res->swr.pitch * res->swr.numSamples;
|
2019-02-21 14:41:15 -06:00
|
|
|
|
|
|
|
|
// Let non-sampled textures (e.g. buffer objects) bypass the size limit
|
|
|
|
|
if (swr_resource_is_texture(&res->base) && total_size > SWR_MAX_TEXTURE_SIZE)
|
2016-11-09 17:16:36 -05:00
|
|
|
return false;
|
2016-02-16 17:27:28 -06:00
|
|
|
|
|
|
|
|
if (allocate) {
|
2017-09-07 15:17:23 -05:00
|
|
|
res->swr.xpBaseAddress = (gfxptr_t)AlignedMalloc(total_size, 64);
|
2017-11-20 11:32:55 -06:00
|
|
|
if (!res->swr.xpBaseAddress)
|
|
|
|
|
return false;
|
2016-02-16 17:27:28 -06:00
|
|
|
|
|
|
|
|
if (res->has_depth && res->has_stencil) {
|
2016-11-09 17:16:36 -05:00
|
|
|
res->secondary = res->swr;
|
2016-02-16 17:27:28 -06:00
|
|
|
res->secondary.format = R8_UINT;
|
2016-11-09 17:16:36 -05:00
|
|
|
res->secondary.pitch = res->swr.pitch / util_format_get_blocksize(fmt);
|
|
|
|
|
|
|
|
|
|
for (int level = 0; level <= pt->last_level; level++) {
|
|
|
|
|
res->secondary_mip_offsets[level] =
|
|
|
|
|
ComputeSurfaceOffset<false>(0, 0, 0, 0, 0, level, &res->secondary);
|
|
|
|
|
}
|
2016-02-16 17:27:28 -06:00
|
|
|
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
total_size = res->secondary.depth * res->secondary.qpitch *
|
|
|
|
|
res->secondary.pitch * res->secondary.numSamples;
|
|
|
|
|
|
2017-09-07 15:17:23 -05:00
|
|
|
res->secondary.xpBaseAddress = (gfxptr_t) AlignedMalloc(total_size, 64);
|
2017-11-20 11:32:55 -06:00
|
|
|
if (!res->secondary.xpBaseAddress) {
|
|
|
|
|
AlignedFree((void *)res->swr.xpBaseAddress);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-09 17:16:36 -05:00
|
|
|
return true;
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
|
|
|
|
|
2019-07-04 11:41:41 -04:00
|
|
|
static bool
|
2016-02-16 17:27:28 -06:00
|
|
|
swr_can_create_resource(struct pipe_screen *screen,
|
|
|
|
|
const struct pipe_resource *templat)
|
|
|
|
|
{
|
|
|
|
|
struct swr_resource res;
|
|
|
|
|
memset(&res, 0, sizeof(res));
|
|
|
|
|
res.base = *templat;
|
|
|
|
|
return swr_texture_layout(swr_screen(screen), &res, false);
|
|
|
|
|
}
|
|
|
|
|
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
/* Helper function that conditionally creates a single-sample resolve resource
|
|
|
|
|
* and attaches it to main multisample resource. */
|
2019-07-04 11:41:41 -04:00
|
|
|
static bool
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
swr_create_resolve_resource(struct pipe_screen *_screen,
|
|
|
|
|
struct swr_resource *msaa_res)
|
|
|
|
|
{
|
|
|
|
|
struct swr_screen *screen = swr_screen(_screen);
|
|
|
|
|
|
|
|
|
|
/* If resource is multisample, create a single-sample resolve resource */
|
|
|
|
|
if (msaa_res->base.nr_samples > 1 || (screen->msaa_force_enable &&
|
|
|
|
|
!(msaa_res->base.flags & SWR_RESOURCE_FLAG_ALT_SURFACE))) {
|
|
|
|
|
|
|
|
|
|
/* Create a single-sample copy of the resource. Copy the original
|
|
|
|
|
* resource parameters and set flag to prevent recursion when re-calling
|
|
|
|
|
* resource_create */
|
|
|
|
|
struct pipe_resource alt_template = msaa_res->base;
|
|
|
|
|
alt_template.nr_samples = 0;
|
|
|
|
|
alt_template.flags |= SWR_RESOURCE_FLAG_ALT_SURFACE;
|
|
|
|
|
|
|
|
|
|
/* Note: Display_target is a special single-sample resource, only the
|
|
|
|
|
* display_target has been created already. */
|
|
|
|
|
if (msaa_res->base.bind & (PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT
|
|
|
|
|
| PIPE_BIND_SHARED)) {
|
|
|
|
|
/* Allocate the multisample buffers. */
|
|
|
|
|
if (!swr_texture_layout(screen, msaa_res, true))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
/* Alt resource will only be bound as PIPE_BIND_RENDER_TARGET
|
|
|
|
|
* remove the DISPLAY_TARGET, SCANOUT, and SHARED bindings */
|
|
|
|
|
alt_template.bind = PIPE_BIND_RENDER_TARGET;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Allocate single-sample resolve surface */
|
|
|
|
|
struct pipe_resource *alt;
|
|
|
|
|
alt = _screen->resource_create(_screen, &alt_template);
|
|
|
|
|
if (!alt)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
/* Attach it to the multisample resource */
|
|
|
|
|
msaa_res->resolve_target = alt;
|
swr: move msaa resolve to generalized StoreTile
v3: list piglit tests fixed by this patch. Fixed typo Tim pointed out.
v2: Reword commit message to more closely adhere to community
guidelines.
This patch moves msaa resolve down into core/StoreTiles where the
surface format conversion routines are available. The previous
"experimental" resolve was limited to 8-bit unsigned render targets.
This fixes a number of piglit msaa tests by adding resolve support for
all the render target formats we support.
Specifically:
layered-rendering/gl-layer-render: fail->pass
layered-rendering/gl-layer-render-storage: fail->pass
multisample-formats *[2,4,8,16] gl_arb_texture_rg: crash->pass
multisample-formats *[2,4,8,16] gl_ext_texture_snorm: crash->pass
multisample-formats *[2,4,8,16] gl_arb_texture_float: fail->pass
multisample-formats *[2,4,8,16] gl_arb_texture_rg-float: fail->pass
MSAA is still disabled by default, but can be enabled with
"export SWR_MSAA_MAX_COUNT=4" (1,2,4,8,16 are options)
The default is 0, which is disabled.
This patch improves the number of multisample-formats supported by swr,
and fixes several crashes currently in the 17.1 branch. Therefore, it
should be considered for inclusion in the 17.1 stable release. Being
disabled by default, it poses no risk to most users of swr.
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
cc: mesa-stable@lists.freedesktop.org
2017-05-04 19:33:36 -05:00
|
|
|
|
|
|
|
|
/* Hang resolve surface state off the multisample surface state to so
|
|
|
|
|
* StoreTiles knows where to resolve the surface. */
|
2017-09-07 15:17:23 -05:00
|
|
|
msaa_res->swr.xpAuxBaseAddress = (gfxptr_t)&swr_resource(alt)->swr;
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true; /* success */
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-16 17:27:28 -06:00
|
|
|
static struct pipe_resource *
|
|
|
|
|
swr_resource_create(struct pipe_screen *_screen,
|
|
|
|
|
const struct pipe_resource *templat)
|
|
|
|
|
{
|
|
|
|
|
struct swr_screen *screen = swr_screen(_screen);
|
|
|
|
|
struct swr_resource *res = CALLOC_STRUCT(swr_resource);
|
|
|
|
|
if (!res)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
res->base = *templat;
|
|
|
|
|
pipe_reference_init(&res->base.reference, 1);
|
|
|
|
|
res->base.screen = &screen->base;
|
|
|
|
|
|
|
|
|
|
if (swr_resource_is_texture(&res->base)) {
|
|
|
|
|
if (res->base.bind & (PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT
|
|
|
|
|
| PIPE_BIND_SHARED)) {
|
|
|
|
|
/* displayable surface
|
|
|
|
|
* first call swr_texture_layout without allocating to finish
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
* filling out the SWR_SURFACE_STATE in res */
|
2016-02-16 17:27:28 -06:00
|
|
|
swr_texture_layout(screen, res, false);
|
|
|
|
|
if (!swr_displaytarget_layout(screen, res))
|
|
|
|
|
goto fail;
|
|
|
|
|
} else {
|
|
|
|
|
/* texture map */
|
|
|
|
|
if (!swr_texture_layout(screen, res, true))
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
|
|
|
|
|
/* If resource was multisample, create resolve resource and attach
|
|
|
|
|
* it to multisample resource. */
|
|
|
|
|
if (!swr_create_resolve_resource(_screen, res))
|
|
|
|
|
goto fail;
|
|
|
|
|
|
2016-02-16 17:27:28 -06:00
|
|
|
} else {
|
|
|
|
|
/* other data (vertex buffer, const buffer, etc) */
|
|
|
|
|
assert(util_format_get_blocksize(templat->format) == 1);
|
|
|
|
|
assert(templat->height0 == 1);
|
|
|
|
|
assert(templat->depth0 == 1);
|
|
|
|
|
assert(templat->last_level == 0);
|
|
|
|
|
|
|
|
|
|
/* Easiest to just call swr_texture_layout, as it sets up
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
* SWR_SURFACE_STATE in res */
|
2016-02-16 17:27:28 -06:00
|
|
|
if (!swr_texture_layout(screen, res, true))
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return &res->base;
|
|
|
|
|
|
|
|
|
|
fail:
|
|
|
|
|
FREE(res);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
swr_resource_destroy(struct pipe_screen *p_screen, struct pipe_resource *pt)
|
|
|
|
|
{
|
|
|
|
|
struct swr_screen *screen = swr_screen(p_screen);
|
2016-03-09 19:30:00 -06:00
|
|
|
struct swr_resource *spr = swr_resource(pt);
|
|
|
|
|
|
2016-12-12 19:24:59 -06:00
|
|
|
if (spr->display_target) {
|
|
|
|
|
/* If resource is display target, winsys manages the buffer and will
|
|
|
|
|
* free it on displaytarget_destroy. */
|
2016-08-06 16:41:42 +02:00
|
|
|
swr_fence_finish(p_screen, NULL, screen->flush_fence, 0);
|
2016-02-16 17:27:28 -06:00
|
|
|
|
|
|
|
|
struct sw_winsys *winsys = screen->winsys;
|
2016-03-09 19:30:00 -06:00
|
|
|
winsys->displaytarget_destroy(winsys, spr->display_target);
|
2016-02-16 17:27:28 -06:00
|
|
|
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
if (spr->swr.numSamples > 1) {
|
|
|
|
|
/* Free an attached resolve resource */
|
|
|
|
|
struct swr_resource *alt = swr_resource(spr->resolve_target);
|
2017-09-07 15:17:23 -05:00
|
|
|
swr_fence_work_free(screen->flush_fence, (void*)(alt->swr.xpBaseAddress), true);
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
|
|
|
|
|
/* Free multisample buffer */
|
2017-09-07 15:17:23 -05:00
|
|
|
swr_fence_work_free(screen->flush_fence, (void*)(spr->swr.xpBaseAddress), true);
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
}
|
2016-12-12 19:24:59 -06:00
|
|
|
} else {
|
2017-01-10 17:12:03 -06:00
|
|
|
/* For regular resources, defer deletion */
|
|
|
|
|
swr_resource_unused(pt);
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
|
|
|
|
|
if (spr->swr.numSamples > 1) {
|
|
|
|
|
/* Free an attached resolve resource */
|
|
|
|
|
struct swr_resource *alt = swr_resource(spr->resolve_target);
|
2017-09-07 15:17:23 -05:00
|
|
|
swr_fence_work_free(screen->flush_fence, (void*)(alt->swr.xpBaseAddress), true);
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
}
|
|
|
|
|
|
2017-09-07 15:17:23 -05:00
|
|
|
swr_fence_work_free(screen->flush_fence, (void*)(spr->swr.xpBaseAddress), true);
|
2017-01-10 17:12:03 -06:00
|
|
|
swr_fence_work_free(screen->flush_fence,
|
2017-09-07 15:17:23 -05:00
|
|
|
(void*)(spr->secondary.xpBaseAddress), true);
|
2017-06-30 22:24:46 -05:00
|
|
|
|
|
|
|
|
/* If work queue grows too large, submit a fence to force queue to
|
|
|
|
|
* drain. This is mainly to decrease the amount of memory used by the
|
|
|
|
|
* piglit streaming-texture-leak test */
|
|
|
|
|
if (screen->pipe && swr_fence(screen->flush_fence)->work.count > 64)
|
|
|
|
|
swr_fence_submit(swr_context(screen->pipe), screen->flush_fence);
|
2016-12-12 19:24:59 -06:00
|
|
|
}
|
2016-02-16 17:27:28 -06:00
|
|
|
|
2016-03-09 19:30:00 -06:00
|
|
|
FREE(spr);
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
swr_flush_frontbuffer(struct pipe_screen *p_screen,
|
|
|
|
|
struct pipe_resource *resource,
|
|
|
|
|
unsigned level,
|
|
|
|
|
unsigned layer,
|
|
|
|
|
void *context_private,
|
|
|
|
|
struct pipe_box *sub_box)
|
|
|
|
|
{
|
|
|
|
|
struct swr_screen *screen = swr_screen(p_screen);
|
|
|
|
|
struct sw_winsys *winsys = screen->winsys;
|
2016-03-09 19:30:00 -06:00
|
|
|
struct swr_resource *spr = swr_resource(resource);
|
2016-03-14 17:40:14 -05:00
|
|
|
struct pipe_context *pipe = screen->pipe;
|
2017-06-29 14:03:43 -05:00
|
|
|
struct swr_context *ctx = swr_context(pipe);
|
2016-02-16 17:27:28 -06:00
|
|
|
|
2016-03-09 19:30:00 -06:00
|
|
|
if (pipe) {
|
2016-08-06 16:41:42 +02:00
|
|
|
swr_fence_finish(p_screen, NULL, screen->flush_fence, 0);
|
2016-03-14 17:40:14 -05:00
|
|
|
swr_resource_unused(resource);
|
2017-06-29 14:03:43 -05:00
|
|
|
ctx->api.pfnSwrEndFrame(ctx->swrContext);
|
2016-03-09 19:30:00 -06:00
|
|
|
}
|
2016-02-16 17:27:28 -06:00
|
|
|
|
swr: move msaa resolve to generalized StoreTile
v3: list piglit tests fixed by this patch. Fixed typo Tim pointed out.
v2: Reword commit message to more closely adhere to community
guidelines.
This patch moves msaa resolve down into core/StoreTiles where the
surface format conversion routines are available. The previous
"experimental" resolve was limited to 8-bit unsigned render targets.
This fixes a number of piglit msaa tests by adding resolve support for
all the render target formats we support.
Specifically:
layered-rendering/gl-layer-render: fail->pass
layered-rendering/gl-layer-render-storage: fail->pass
multisample-formats *[2,4,8,16] gl_arb_texture_rg: crash->pass
multisample-formats *[2,4,8,16] gl_ext_texture_snorm: crash->pass
multisample-formats *[2,4,8,16] gl_arb_texture_float: fail->pass
multisample-formats *[2,4,8,16] gl_arb_texture_rg-float: fail->pass
MSAA is still disabled by default, but can be enabled with
"export SWR_MSAA_MAX_COUNT=4" (1,2,4,8,16 are options)
The default is 0, which is disabled.
This patch improves the number of multisample-formats supported by swr,
and fixes several crashes currently in the 17.1 branch. Therefore, it
should be considered for inclusion in the 17.1 stable release. Being
disabled by default, it poses no risk to most users of swr.
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
cc: mesa-stable@lists.freedesktop.org
2017-05-04 19:33:36 -05:00
|
|
|
/* Multisample resolved into resolve_target at flush with store_resource */
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
if (pipe && spr->swr.numSamples > 1) {
|
|
|
|
|
struct pipe_resource *resolve_target = spr->resolve_target;
|
|
|
|
|
|
|
|
|
|
/* Once resolved, copy into display target */
|
|
|
|
|
SWR_SURFACE_STATE *resolve = &swr_resource(resolve_target)->swr;
|
|
|
|
|
|
|
|
|
|
void *map = winsys->displaytarget_map(winsys, spr->display_target,
|
|
|
|
|
PIPE_TRANSFER_WRITE);
|
2017-09-07 15:17:23 -05:00
|
|
|
memcpy(map, (void*)(resolve->xpBaseAddress), resolve->pitch * resolve->height);
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
winsys->displaytarget_unmap(winsys, spr->display_target);
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-09 19:30:00 -06:00
|
|
|
debug_assert(spr->display_target);
|
|
|
|
|
if (spr->display_target)
|
2016-02-16 17:27:28 -06:00
|
|
|
winsys->displaytarget_display(
|
2016-03-09 19:30:00 -06:00
|
|
|
winsys, spr->display_target, context_private, sub_box);
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-01-22 12:09:28 -05:00
|
|
|
void
|
|
|
|
|
swr_destroy_screen_internal(struct swr_screen **screen)
|
|
|
|
|
{
|
|
|
|
|
struct pipe_screen *p_screen = &(*screen)->base;
|
|
|
|
|
|
|
|
|
|
swr_fence_finish(p_screen, NULL, (*screen)->flush_fence, 0);
|
|
|
|
|
swr_fence_reference(p_screen, &(*screen)->flush_fence, NULL);
|
|
|
|
|
|
|
|
|
|
JitDestroyContext((*screen)->hJitMgr);
|
|
|
|
|
|
|
|
|
|
if ((*screen)->pLibrary)
|
|
|
|
|
util_dl_close((*screen)->pLibrary);
|
|
|
|
|
|
|
|
|
|
FREE(*screen);
|
|
|
|
|
*screen = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-02-16 17:27:28 -06:00
|
|
|
static void
|
|
|
|
|
swr_destroy_screen(struct pipe_screen *p_screen)
|
|
|
|
|
{
|
|
|
|
|
struct swr_screen *screen = swr_screen(p_screen);
|
|
|
|
|
struct sw_winsys *winsys = screen->winsys;
|
|
|
|
|
|
|
|
|
|
fprintf(stderr, "SWR destroy screen!\n");
|
|
|
|
|
|
|
|
|
|
if (winsys->destroy)
|
|
|
|
|
winsys->destroy(winsys);
|
|
|
|
|
|
2018-01-22 12:09:28 -05:00
|
|
|
swr_destroy_screen_internal(&screen);
|
2016-02-16 17:27:28 -06:00
|
|
|
}
|
|
|
|
|
|
2017-07-12 15:04:46 -05:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
swr_validate_env_options(struct swr_screen *screen)
|
|
|
|
|
{
|
2017-07-12 15:04:47 -05:00
|
|
|
/* The client_copy_limit sets a maximum on the amount of user-buffer memory
|
|
|
|
|
* copied to scratch space on a draw. Past this, the draw will access
|
|
|
|
|
* user-buffer directly and then block. This is faster than queuing many
|
|
|
|
|
* large client draws. */
|
|
|
|
|
screen->client_copy_limit = SWR_CLIENT_COPY_LIMIT;
|
|
|
|
|
int client_copy_limit =
|
|
|
|
|
debug_get_num_option("SWR_CLIENT_COPY_LIMIT", SWR_CLIENT_COPY_LIMIT);
|
|
|
|
|
if (client_copy_limit > 0)
|
|
|
|
|
screen->client_copy_limit = client_copy_limit;
|
|
|
|
|
|
2017-07-12 15:04:46 -05:00
|
|
|
/* XXX msaa under development, disable by default for now */
|
2017-08-25 14:59:13 -05:00
|
|
|
screen->msaa_max_count = 1; /* was SWR_MAX_NUM_MULTISAMPLES; */
|
2017-07-12 15:04:46 -05:00
|
|
|
|
|
|
|
|
/* validate env override values, within range and power of 2 */
|
2017-08-25 14:59:13 -05:00
|
|
|
int msaa_max_count = debug_get_num_option("SWR_MSAA_MAX_COUNT", 1);
|
|
|
|
|
if (msaa_max_count != 1) {
|
|
|
|
|
if ((msaa_max_count < 1) || (msaa_max_count > SWR_MAX_NUM_MULTISAMPLES)
|
2017-11-13 11:17:41 -08:00
|
|
|
|| !util_is_power_of_two_or_zero(msaa_max_count)) {
|
2017-07-12 15:04:46 -05:00
|
|
|
fprintf(stderr, "SWR_MSAA_MAX_COUNT invalid: %d\n", msaa_max_count);
|
|
|
|
|
fprintf(stderr, "must be power of 2 between 1 and %d" \
|
2017-08-25 14:59:13 -05:00
|
|
|
" (or 1 to disable msaa)\n",
|
2017-07-12 15:04:46 -05:00
|
|
|
SWR_MAX_NUM_MULTISAMPLES);
|
2017-08-25 14:59:13 -05:00
|
|
|
msaa_max_count = 1;
|
2017-07-12 15:04:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fprintf(stderr, "SWR_MSAA_MAX_COUNT: %d\n", msaa_max_count);
|
2017-08-25 14:59:13 -05:00
|
|
|
if (msaa_max_count == 1)
|
2017-07-12 15:04:46 -05:00
|
|
|
fprintf(stderr, "(msaa disabled)\n");
|
|
|
|
|
|
|
|
|
|
screen->msaa_max_count = msaa_max_count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
screen->msaa_force_enable = debug_get_bool_option(
|
|
|
|
|
"SWR_MSAA_FORCE_ENABLE", false);
|
|
|
|
|
if (screen->msaa_force_enable)
|
|
|
|
|
fprintf(stderr, "SWR_MSAA_FORCE_ENABLE: true\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-02-16 17:27:28 -06:00
|
|
|
struct pipe_screen *
|
2016-11-17 16:21:12 -06:00
|
|
|
swr_create_screen_internal(struct sw_winsys *winsys)
|
2016-02-16 17:27:28 -06:00
|
|
|
{
|
|
|
|
|
struct swr_screen *screen = CALLOC_STRUCT(swr_screen);
|
|
|
|
|
|
|
|
|
|
if (!screen)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2016-12-05 11:32:19 -06:00
|
|
|
if (!lp_build_init()) {
|
|
|
|
|
FREE(screen);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-16 17:27:28 -06:00
|
|
|
screen->winsys = winsys;
|
|
|
|
|
screen->base.get_name = swr_get_name;
|
|
|
|
|
screen->base.get_vendor = swr_get_vendor;
|
|
|
|
|
screen->base.is_format_supported = swr_is_format_supported;
|
|
|
|
|
screen->base.context_create = swr_create_context;
|
|
|
|
|
screen->base.can_create_resource = swr_can_create_resource;
|
|
|
|
|
|
|
|
|
|
screen->base.destroy = swr_destroy_screen;
|
|
|
|
|
screen->base.get_param = swr_get_param;
|
|
|
|
|
screen->base.get_shader_param = swr_get_shader_param;
|
|
|
|
|
screen->base.get_paramf = swr_get_paramf;
|
|
|
|
|
|
|
|
|
|
screen->base.resource_create = swr_resource_create;
|
|
|
|
|
screen->base.resource_destroy = swr_resource_destroy;
|
|
|
|
|
|
|
|
|
|
screen->base.flush_frontbuffer = swr_flush_frontbuffer;
|
|
|
|
|
|
2017-07-14 15:01:35 -05:00
|
|
|
// Pass in "" for architecture for run-time determination
|
|
|
|
|
screen->hJitMgr = JitCreateContext(KNOB_SIMD_WIDTH, "", "swr");
|
2016-02-16 17:27:28 -06:00
|
|
|
|
|
|
|
|
swr_fence_init(&screen->base);
|
|
|
|
|
|
2017-07-12 15:04:46 -05:00
|
|
|
swr_validate_env_options(screen);
|
swr: Enable MSAA in OpenSWR software renderer
This patch enables multisample antialiasing in the OpenSWR software renderer.
MSAA is a proof-of-concept/work-in-progress with bug fixes and performance
on the way. We wanted to get the changes out now to allow several customers
to begin experimenting with MSAA in a software renderer. So as not to
impact current customers, MSAA is turned off by default - previous
functionality and performance remain intact. It is easily enabled via
environment variables, as described below.
It has only been tested with the glx-lib winsys. The intention is to
enable other state-trackers, both Windows and Linux and more fully support
FBOs.
There are 2 environment variables that affect behavior:
* SWR_MSAA_FORCE_ENABLE - force MSAA on, for apps that are not designed
for MSAA... Beware, results will vary. This is mainly for testing.
* SWR_MSAA_MAX_SAMPLE_COUNT - sets maximum supported number of
samples (1,2,4,8,16), or 0 to disable MSAA altogether.
(The default is currently 0.)
Reviewed-by: George Kyriazis <george.kyriazis@intel.com>
2017-04-13 17:40:11 -05:00
|
|
|
|
2016-02-16 17:27:28 -06:00
|
|
|
return &screen->base;
|
|
|
|
|
}
|