#include "util/u_cpu_detect.h"
#include "util/u_format_s3tc.h"
#include "util/u_string.h"
+#include "util/u_screen.h"
#include "state_tracker/sw_winsys.h"
#include <stdio.h>
#include <map>
-/* MSVC case instensitive compare */
-#if defined(PIPE_CC_MSVC)
- #define strcasecmp lstrcmpiA
-#endif
-
/*
* Max texture sizes
* XXX Check max texture size values against core and sampler.
*/
-#define SWR_MAX_TEXTURE_SIZE (4 * 1024 * 1024 * 1024ULL) /* 4GB */
-#define SWR_MAX_TEXTURE_2D_LEVELS 14 /* 8K x 8K for now */
+#define SWR_MAX_TEXTURE_SIZE (2 * 1024 * 1024 * 1024ULL) /* 2GB */
+#define SWR_MAX_TEXTURE_2D_SIZE 8192
#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 */
+/* Default max client_copy_limit */
+#define SWR_CLIENT_COPY_LIMIT 8192
+
/* 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)
swr_get_name(struct pipe_screen *screen)
{
static char buf[100];
- util_snprintf(buf, sizeof(buf), "SWR (LLVM %u.%u, %u bits)",
- HAVE_LLVM >> 8, HAVE_LLVM & 0xff,
- lp_native_vector_width );
+ snprintf(buf, sizeof(buf), "SWR (LLVM " MESA_LLVM_VERSION_STRING ", %u bits)",
+ lp_native_vector_width);
return buf;
}
return "Intel Corporation";
}
-static boolean
+static bool
swr_is_format_supported(struct pipe_screen *_screen,
enum pipe_format format,
enum pipe_texture_target target,
unsigned sample_count,
+ unsigned storage_sample_count,
unsigned bind)
{
struct swr_screen *screen = swr_screen(_screen);
|| target == PIPE_TEXTURE_CUBE
|| target == PIPE_TEXTURE_CUBE_ARRAY);
+ if (MAX2(1, sample_count) != MAX2(1, storage_sample_count))
+ return false;
+
format_desc = util_format_description(format);
if (!format_desc)
- return FALSE;
+ return false;
if ((sample_count > screen->msaa_max_count)
- || !util_is_power_of_two(sample_count))
- return FALSE;
+ || !util_is_power_of_two_or_zero(sample_count))
+ return false;
if (bind & PIPE_BIND_DISPLAY_TARGET) {
if (!winsys->is_displaytarget_format_supported(winsys, bind, format))
- return FALSE;
+ return false;
}
if (bind & PIPE_BIND_RENDER_TARGET) {
if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS)
- return FALSE;
+ return false;
if (mesa_to_swr_format(format) == (SWR_FORMAT)-1)
- return FALSE;
+ return false;
/*
* Although possible, it is unnatural to render into compressed or YUV
* inside the state trackers.
*/
if (format_desc->block.width != 1 || format_desc->block.height != 1)
- return FALSE;
+ return false;
}
if (bind & PIPE_BIND_DEPTH_STENCIL) {
if (format_desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS)
- return FALSE;
+ return false;
if (mesa_to_swr_format(format) == (SWR_FORMAT)-1)
- return FALSE;
+ return false;
}
if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC ||
format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC) {
- return FALSE;
+ return false;
}
if (format_desc->layout == UTIL_FORMAT_LAYOUT_ETC &&
format != PIPE_FORMAT_ETC1_RGB8) {
- return FALSE;
+ return false;
}
- if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
- return util_format_s3tc_enabled;
+ 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) {
+ return false;
+ }
}
return TRUE;
/* limits */
case PIPE_CAP_MAX_RENDER_TARGETS:
return PIPE_MAX_COLOR_BUFS;
- case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
- return SWR_MAX_TEXTURE_2D_LEVELS;
+ case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
+ return SWR_MAX_TEXTURE_2D_SIZE;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
return SWR_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return 2048;
case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS:
return SWR_MAX_TEXTURE_ARRAY_LAYERS;
+ case PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET:
case PIPE_CAP_MIN_TEXEL_OFFSET:
return -8;
+ case PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET:
case PIPE_CAP_MAX_TEXEL_OFFSET:
return 7;
+ case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
+ return 4;
case PIPE_CAP_GLSL_FEATURE_LEVEL:
return 330;
+ case PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY:
+ return 140;
case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
return 16;
case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
return 65536;
case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
- return 0;
- case PIPE_CAP_MAX_VIEWPORTS:
return 1;
+ case PIPE_CAP_MAX_VIEWPORTS:
+ return KNOB_NUM_VIEWPORTS_SCISSORS;
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_NATIVE;
- case PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET:
- case PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET:
+ case PIPE_CAP_DEPTH_CLIP_DISABLE_SEPARATE:
return 0;
/* supported features */
case PIPE_CAP_NPOT_TEXTURES:
case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
- case PIPE_CAP_TWO_SIDED_STENCIL:
- case PIPE_CAP_SM3:
+ case PIPE_CAP_FRAGMENT_SHADER_TEXTURE_LOD:
+ case PIPE_CAP_FRAGMENT_SHADER_DERIVATIVES:
+ case PIPE_CAP_VERTEX_SHADER_SATURATE:
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:
- case PIPE_CAP_TEXTURE_SHADOW_MAP:
+ case PIPE_CAP_TEXTURE_MIRROR_CLAMP_TO_EDGE:
case PIPE_CAP_TEXTURE_SWIZZLE:
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
case PIPE_CAP_INDEP_BLEND_ENABLE:
case PIPE_CAP_MIXED_COLORBUFFER_FORMATS:
case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
case PIPE_CAP_USER_VERTEX_BUFFERS:
- case PIPE_CAP_USER_CONSTANT_BUFFERS:
case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS:
case PIPE_CAP_QUERY_TIMESTAMP:
case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
case PIPE_CAP_CULL_DISTANCE:
case PIPE_CAP_CUBE_MAP_ARRAY:
case PIPE_CAP_DOUBLES:
+ case PIPE_CAP_TEXTURE_QUERY_LOD:
+ case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS:
return 1;
/* MSAA support
- * If user has explicitly set max_sample_count = 0 (via SWR_MSAA_MAX_COUNT)
- * then disable all MSAA support and go back to old caps. */
+ * 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. */
case PIPE_CAP_TEXTURE_MULTISAMPLE:
case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
- return swr_screen(screen)->msaa_max_count ? 1 : 0;
+ return (swr_screen(screen)->msaa_max_count > 1) ? 1 : 0;
case PIPE_CAP_FAKE_SW_MSAA:
- return swr_screen(screen)->msaa_max_count ? 0 : 1;
+ return (swr_screen(screen)->msaa_max_count > 1) ? 0 : 1;
+
+ /* 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;
/* unsupported features */
case PIPE_CAP_ANISOTROPIC_FILTER:
case PIPE_CAP_COMPUTE:
case PIPE_CAP_TGSI_VS_LAYER_VIEWPORT:
case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS:
- 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:
case PIPE_CAP_TGSI_TEXCOORD:
case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
- case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
case PIPE_CAP_TEXTURE_GATHER_SM5:
- case PIPE_CAP_TEXTURE_QUERY_LOD:
case PIPE_CAP_SAMPLE_SHADING:
case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
case PIPE_CAP_TGSI_TXQS:
case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
case PIPE_CAP_SHAREABLE_SHADERS:
- case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS:
case PIPE_CAP_DRAW_PARAMETERS:
case PIPE_CAP_TGSI_PACK_HALF_FLOAT:
case PIPE_CAP_MULTI_DRAW_INDIRECT:
case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
- case PIPE_CAP_TGSI_FS_FBFETCH:
+ case PIPE_CAP_FBFETCH:
case PIPE_CAP_TGSI_MUL_ZERO_WINS:
case PIPE_CAP_INT64:
case PIPE_CAP_INT64_DIVMOD:
case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
case PIPE_CAP_POST_DEPTH_COVERAGE:
case PIPE_CAP_BINDLESS_TEXTURE:
+ case PIPE_CAP_NIR_SAMPLERS_AS_DEREF:
+ case PIPE_CAP_QUERY_SO_OVERFLOW:
+ case PIPE_CAP_MEMOBJ:
+ case PIPE_CAP_LOAD_CONSTBUF:
+ case PIPE_CAP_TGSI_ANY_REG_AS_ADDRESS:
+ case PIPE_CAP_TILE_RASTER_ORDER:
+ case PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
+ case PIPE_CAP_FRAMEBUFFER_MSAA_CONSTRAINTS:
+ case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
+ case PIPE_CAP_CONTEXT_PRIORITY_MASK:
+ case PIPE_CAP_FENCE_SIGNAL:
+ case PIPE_CAP_CONSTBUF0_FLAGS:
+ case PIPE_CAP_PACKED_UNIFORMS:
+ 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:
+ case PIPE_CAP_PROGRAMMABLE_SAMPLE_LOCATIONS:
+ case PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET:
+ case PIPE_CAP_IMAGE_LOAD_FORMATTED:
+ case PIPE_CAP_TGSI_ATOMINC_WRAP:
return 0;
+ case PIPE_CAP_MAX_GS_INVOCATIONS:
+ return 32;
+ case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
+ return 1 << 27;
+ case PIPE_CAP_MAX_VARYINGS:
+ return 32;
case PIPE_CAP_VENDOR_ID:
return 0xFFFFFFFF;
return (int)(system_memory >> 20);
}
+ default:
+ return u_pipe_screen_get_param_defaults(screen, param);
}
-
- /* should only get here on unhandled cases */
- debug_printf("Unexpected PIPE_CAP %d query\n", param);
- return 0;
}
static int
return 0.0;
case PIPE_CAPF_MAX_TEXTURE_LOD_BIAS:
return 16.0; /* arbitrary */
- case PIPE_CAPF_GUARD_BAND_LEFT:
- case PIPE_CAPF_GUARD_BAND_TOP:
- case PIPE_CAPF_GUARD_BAND_RIGHT:
- case PIPE_CAPF_GUARD_BAND_BOTTOM:
- return 0.0;
+ case PIPE_CAPF_MIN_CONSERVATIVE_RASTER_DILATE:
+ case PIPE_CAPF_MAX_CONSERVATIVE_RASTER_DILATE:
+ case PIPE_CAPF_CONSERVATIVE_RASTER_DILATE_GRANULARITY:
+ return 0.0f;
}
/* should only get here on unhandled cases */
debug_printf("Unexpected PIPE_CAPF %d query\n", param);
return it->second;
}
-static boolean
+static bool
swr_displaytarget_layout(struct swr_screen *screen, struct swr_resource *res)
{
struct sw_winsys *winsys = screen->winsys;
&stride);
if (dt == NULL)
- return FALSE;
+ return false;
void *map = winsys->displaytarget_map(winsys, dt, 0);
res->display_target = dt;
- res->swr.pBaseAddress = (uint8_t*) map;
+ res->swr.xpBaseAddress = (gfxptr_t)map;
/* Clear the display target surface */
if (map)
winsys->displaytarget_unmap(winsys, dt);
- return TRUE;
+ return true;
}
static bool
swr_texture_layout(struct swr_screen *screen,
struct swr_resource *res,
- boolean allocate)
+ bool allocate)
{
struct pipe_resource *pt = &res->base;
ComputeSurfaceOffset<false>(0, 0, 0, 0, 0, level, &res->swr);
}
- size_t total_size = res->swr.depth * res->swr.qpitch * res->swr.pitch *
- res->swr.numSamples;
- if (total_size > SWR_MAX_TEXTURE_SIZE)
+ size_t total_size = (uint64_t)res->swr.depth * res->swr.qpitch *
+ res->swr.pitch * res->swr.numSamples;
+
+ // 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)
return false;
if (allocate) {
- res->swr.pBaseAddress = (uint8_t *)AlignedMalloc(total_size, 64);
+ res->swr.xpBaseAddress = (gfxptr_t)AlignedMalloc(total_size, 64);
+ if (!res->swr.xpBaseAddress)
+ return false;
if (res->has_depth && res->has_stencil) {
res->secondary = res->swr;
total_size = res->secondary.depth * res->secondary.qpitch *
res->secondary.pitch * res->secondary.numSamples;
- res->secondary.pBaseAddress = (uint8_t *) AlignedMalloc(total_size,
- 64);
+ res->secondary.xpBaseAddress = (gfxptr_t) AlignedMalloc(total_size, 64);
+ if (!res->secondary.xpBaseAddress) {
+ AlignedFree((void *)res->swr.xpBaseAddress);
+ return false;
+ }
}
}
return true;
}
-static boolean
+static bool
swr_can_create_resource(struct pipe_screen *screen,
const struct pipe_resource *templat)
{
/* Helper function that conditionally creates a single-sample resolve resource
* and attaches it to main multisample resource. */
-static boolean
+static bool
swr_create_resolve_resource(struct pipe_screen *_screen,
struct swr_resource *msaa_res)
{
/* Hang resolve surface state off the multisample surface state to so
* StoreTiles knows where to resolve the surface. */
- msaa_res->swr.pAuxBaseAddress = (uint8_t *)&swr_resource(alt)->swr;
+ msaa_res->swr.xpAuxBaseAddress = (gfxptr_t)&swr_resource(alt)->swr;
}
return true; /* success */
if (spr->swr.numSamples > 1) {
/* Free an attached resolve resource */
struct swr_resource *alt = swr_resource(spr->resolve_target);
- swr_fence_work_free(screen->flush_fence, alt->swr.pBaseAddress, true);
+ swr_fence_work_free(screen->flush_fence, (void*)(alt->swr.xpBaseAddress), true);
/* Free multisample buffer */
- swr_fence_work_free(screen->flush_fence, spr->swr.pBaseAddress, true);
+ swr_fence_work_free(screen->flush_fence, (void*)(spr->swr.xpBaseAddress), true);
}
} else {
/* For regular resources, defer deletion */
if (spr->swr.numSamples > 1) {
/* Free an attached resolve resource */
struct swr_resource *alt = swr_resource(spr->resolve_target);
- swr_fence_work_free(screen->flush_fence, alt->swr.pBaseAddress, true);
+ swr_fence_work_free(screen->flush_fence, (void*)(alt->swr.xpBaseAddress), true);
}
- swr_fence_work_free(screen->flush_fence, spr->swr.pBaseAddress, true);
+ swr_fence_work_free(screen->flush_fence, (void*)(spr->swr.xpBaseAddress), true);
swr_fence_work_free(screen->flush_fence,
- spr->secondary.pBaseAddress, true);
+ (void*)(spr->secondary.xpBaseAddress), true);
/* 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
struct sw_winsys *winsys = screen->winsys;
struct swr_resource *spr = swr_resource(resource);
struct pipe_context *pipe = screen->pipe;
+ struct swr_context *ctx = swr_context(pipe);
if (pipe) {
swr_fence_finish(p_screen, NULL, screen->flush_fence, 0);
swr_resource_unused(resource);
- SwrEndFrame(swr_context(pipe)->swrContext);
+ ctx->api.pfnSwrEndFrame(ctx->swrContext);
}
/* Multisample resolved into resolve_target at flush with store_resource */
void *map = winsys->displaytarget_map(winsys, spr->display_target,
PIPE_TRANSFER_WRITE);
- memcpy(map, resolve->pBaseAddress, resolve->pitch * resolve->height);
+ memcpy(map, (void*)(resolve->xpBaseAddress), resolve->pitch * resolve->height);
winsys->displaytarget_unmap(winsys, spr->display_target);
}
}
+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;
+}
+
+
static void
swr_destroy_screen(struct pipe_screen *p_screen)
{
fprintf(stderr, "SWR destroy screen!\n");
- swr_fence_finish(p_screen, NULL, screen->flush_fence, 0);
- swr_fence_reference(p_screen, &screen->flush_fence, NULL);
-
- JitDestroyContext(screen->hJitMgr);
-
if (winsys->destroy)
winsys->destroy(winsys);
- FREE(screen);
+ swr_destroy_screen_internal(&screen);
+}
+
+
+static void
+swr_validate_env_options(struct swr_screen *screen)
+{
+ /* 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;
+
+ /* XXX msaa under development, disable by default for now */
+ screen->msaa_max_count = 1; /* was SWR_MAX_NUM_MULTISAMPLES; */
+
+ /* validate env override values, within range and power of 2 */
+ 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)
+ || !util_is_power_of_two_or_zero(msaa_max_count)) {
+ fprintf(stderr, "SWR_MSAA_MAX_COUNT invalid: %d\n", msaa_max_count);
+ fprintf(stderr, "must be power of 2 between 1 and %d" \
+ " (or 1 to disable msaa)\n",
+ SWR_MAX_NUM_MULTISAMPLES);
+ msaa_max_count = 1;
+ }
+
+ fprintf(stderr, "SWR_MSAA_MAX_COUNT: %d\n", msaa_max_count);
+ if (msaa_max_count == 1)
+ 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");
}
-PUBLIC
+
struct pipe_screen *
swr_create_screen_internal(struct sw_winsys *winsys)
{
screen->base.flush_frontbuffer = swr_flush_frontbuffer;
- screen->hJitMgr = JitCreateContext(KNOB_SIMD_WIDTH, KNOB_ARCH_STR, "swr");
+ // Pass in "" for architecture for run-time determination
+ screen->hJitMgr = JitCreateContext(KNOB_SIMD_WIDTH, "", "swr");
swr_fence_init(&screen->base);
- util_format_s3tc_init();
-
- /* XXX msaa under development, disable by default for now */
- screen->msaa_max_count = 0; /* was SWR_MAX_NUM_MULTISAMPLES; */
-
- /* validate env override values, within range and power of 2 */
- int msaa_max_count = debug_get_num_option("SWR_MSAA_MAX_COUNT", 0);
- if (msaa_max_count) {
- if ((msaa_max_count < 0) || (msaa_max_count > SWR_MAX_NUM_MULTISAMPLES)
- || !util_is_power_of_two(msaa_max_count)) {
- fprintf(stderr, "SWR_MSAA_MAX_COUNT invalid: %d\n", msaa_max_count);
- fprintf(stderr, "must be power of 2 between 1 and %d" \
- " (or 0 to disable msaa)\n",
- SWR_MAX_NUM_MULTISAMPLES);
- msaa_max_count = 0;
- }
-
- fprintf(stderr, "SWR_MSAA_MAX_COUNT: %d\n", msaa_max_count);
- if (!msaa_max_count)
- 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");
+ swr_validate_env_options(screen);
return &screen->base;
}
-