swr_blit(struct pipe_context *pipe, const struct pipe_blit_info *blit_info)
{
struct swr_context *ctx = swr_context(pipe);
+ /* Make a copy of the const blit_info, so we can modify it */
struct pipe_blit_info info = *blit_info;
- if (blit_info->render_condition_enable && !swr_check_render_cond(pipe))
+ if (info.render_condition_enable && !swr_check_render_cond(pipe))
return;
if (info.src.resource->nr_samples > 1 && info.dst.resource->nr_samples <= 1
&& !util_format_is_depth_or_stencil(info.src.resource->format)
&& !util_format_is_pure_integer(info.src.resource->format)) {
- debug_printf("swr: color resolve unimplemented\n");
- return;
+ debug_printf("swr_blit: color resolve : %d -> %d\n",
+ info.src.resource->nr_samples, info.dst.resource->nr_samples);
+
+ /* Resolve is done as part of the surface store. */
+ swr_store_dirty_resource(pipe, info.src.resource, SWR_TILE_RESOLVED);
+
+ struct pipe_resource *src_resource = info.src.resource;
+ struct pipe_resource *resolve_target =
+ swr_resource(src_resource)->resolve_target;
+
+ /* The resolve target becomes the new source for the blit. */
+ info.src.resource = resolve_target;
}
if (util_try_blit_via_copy_region(pipe, &info)) {
}
if (ctx->active_queries) {
- SwrEnableStatsFE(ctx->swrContext, FALSE);
- SwrEnableStatsBE(ctx->swrContext, FALSE);
+ ctx->api.pfnSwrEnableStatsFE(ctx->swrContext, FALSE);
+ ctx->api.pfnSwrEnableStatsBE(ctx->swrContext, FALSE);
}
util_blitter_save_vertex_buffer_slot(ctx->blitter, ctx->vertex_buffer);
util_blitter_blit(ctx->blitter, &info);
if (ctx->active_queries) {
- SwrEnableStatsFE(ctx->swrContext, TRUE);
- SwrEnableStatsBE(ctx->swrContext, TRUE);
+ ctx->api.pfnSwrEnableStatsFE(ctx->swrContext, TRUE);
+ ctx->api.pfnSwrEnableStatsBE(ctx->swrContext, TRUE);
}
}
/* Idle core after destroying buffer resources, but before deleting
* context. Destroying resources has potentially called StoreTiles.*/
- SwrWaitForIdle(ctx->swrContext);
+ ctx->api.pfnSwrWaitForIdle(ctx->swrContext);
if (ctx->swrContext)
- SwrDestroyContext(ctx->swrContext);
+ ctx->api.pfnSwrDestroyContext(ctx->swrContext);
delete ctx->blendJIT;
if (!pDC)
return;
- struct swr_query_result *pqr = (struct swr_query_result *)pDC->pStats;
+ struct swr_query_result *pqr = pDC->pStats;
SWR_STATS *pSwrStats = &pqr->core;
if (!pDC)
return;
- struct swr_query_result *pqr = (struct swr_query_result *)pDC->pStats;
+ struct swr_query_result *pqr = pDC->pStats;
SWR_STATS_FE *pSwrStats = &pqr->coreFE;
p_atomic_add(&pSwrStats->IaVertices, pStats->IaVertices);
AlignedMalloc(sizeof(struct swr_context), KNOB_SIMD_BYTES);
memset(ctx, 0, sizeof(struct swr_context));
+ swr_screen(p_screen)->pfnSwrGetInterface(ctx->api);
+ ctx->swrDC.pAPI = &ctx->api;
+
ctx->blendJIT =
new std::unordered_map<BLEND_COMPILE_STATE, PFN_BLEND_JIT_FUNC>;
createInfo.pfnClearTile = swr_StoreHotTileClear;
createInfo.pfnUpdateStats = swr_UpdateStats;
createInfo.pfnUpdateStatsFE = swr_UpdateStatsFE;
- ctx->swrContext = SwrCreateContext(&createInfo);
-
- /* Init Load/Store/ClearTiles Tables */
- swr_InitMemoryModule();
+ ctx->swrContext = ctx->api.pfnSwrCreateContext(&createInfo);
- InitBackendFuncTables();
+ ctx->api.pfnSwrInit();
if (ctx->swrContext == NULL)
goto fail;