else:
if type == 'BYTE' or type == 'char' or type == 'uint8_t' or type == 'int8_t' or type == 'bool':
llvm_type = 'Type::getInt8Ty(ctx)'
- elif type == 'UINT64' or type == 'INT64' or type == 'uint64_t' or type == 'int64_t':
+ elif type == 'UINT64' or type == 'INT64' or type == 'uint64_t' or type == 'int64_t' or type == 'gfxptr_t':
llvm_type = 'Type::getInt64Ty(ctx)'
elif type == 'UINT16' or type == 'int16_t' or type == 'uint16_t':
llvm_type = 'Type::getInt16Ty(ctx)'
#include "common/formats.h"
#include "common/intrin.h"
+using gfxptr_t = unsigned long long;
#include <functional>
#include <algorithm>
//////////////////////////////////////////////////////////////////////////
struct SWR_SURFACE_STATE
{
- uint8_t *pBaseAddress;
+ gfxptr_t xpBaseAddress;
SWR_SURFACE_TYPE type; // @llvm_enum
SWR_FORMAT format; // @llvm_enum
uint32_t width;
uint32_t lodOffsets[2][15]; // lod offsets for sampled surfaces
- uint8_t *pAuxBaseAddress; // Used for compression, append/consume counter, etc.
+ gfxptr_t xpAuxBaseAddress; // Used for compression, append/consume counter, etc.
SWR_AUX_MODE auxMode; // @llvm_enum
resolveColor[3] *= oneOverNumSamples;
// Use the resolve surface state
- SWR_SURFACE_STATE* pResolveSurface = (SWR_SURFACE_STATE*)pDstSurface->pAuxBaseAddress;
+ SWR_SURFACE_STATE* pResolveSurface = (SWR_SURFACE_STATE*)pDstSurface->xpAuxBaseAddress;
uint8_t *pDst = (uint8_t*)ComputeSurfaceAddress<false, false>((x + rx), (y + ry),
pResolveSurface->arrayIndex + renderTargetArrayIndex, pResolveSurface->arrayIndex + renderTargetArrayIndex,
0, pResolveSurface->lod, pResolveSurface);
}
}
- if (pDstSurface->pAuxBaseAddress)
+ if (pDstSurface->xpAuxBaseAddress)
{
uint32_t sampleOffset = KNOB_TILE_X_DIM * KNOB_TILE_Y_DIM * (FormatTraits<SrcFormat>::bpp / 8);
// Store each raster tile from the hot tile to the destination surface.
INLINE
void* ComputeSurfaceAddress(uint32_t x, uint32_t y, uint32_t z, uint32_t array, uint32_t sampleNum, uint32_t lod, const SWR_SURFACE_STATE *pState)
{
- return pState->pBaseAddress + ComputeSurfaceOffset<UseCachedOffsets>(x, y, z, array, sampleNum, lod, pState);
+ return (void*)(pState->xpBaseAddress + ComputeSurfaceOffset<UseCachedOffsets>(x, y, z, array, sampleNum, lod, pState));
}
for (int y = box->y; y < box->y + box->height; y++) {
if (spr->base.format == PIPE_FORMAT_Z24_UNORM_S8_UINT) {
for (int x = box->x; x < box->x + box->width; x++)
- spr->swr.pBaseAddress[zbase + 4 * x + 3] =
- spr->secondary.pBaseAddress[sbase + x];
+ ((uint8_t*)(spr->swr.xpBaseAddress))[zbase + 4 * x + 3] =
+ ((uint8_t*)(spr->secondary.xpBaseAddress))[sbase + x];
} else if (spr->base.format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT) {
for (int x = box->x; x < box->x + box->width; x++)
- spr->swr.pBaseAddress[zbase + 8 * x + 4] =
- spr->secondary.pBaseAddress[sbase + x];
+ ((uint8_t*)(spr->swr.xpBaseAddress))[zbase + 8 * x + 4] =
+ ((uint8_t*)(spr->secondary.xpBaseAddress))[sbase + x];
}
zbase += spr->swr.pitch;
sbase += spr->secondary.pitch;
*transfer = pt;
- return spr->swr.pBaseAddress + offset + spr->mip_offsets[level];
+ return (void*)(spr->swr.xpBaseAddress + offset + spr->mip_offsets[level]);
}
static void
for (int y = box.y; y < box.y + box.height; y++) {
if (spr->base.format == PIPE_FORMAT_Z24_UNORM_S8_UINT) {
for (int x = box.x; x < box.x + box.width; x++)
- spr->secondary.pBaseAddress[sbase + x] =
- spr->swr.pBaseAddress[zbase + 4 * x + 3];
+ ((uint8_t*)(spr->secondary.xpBaseAddress))[sbase + x] =
+ ((uint8_t*)(spr->swr.xpBaseAddress))[zbase + 4 * x + 3];
} else if (spr->base.format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT) {
for (int x = box.x; x < box.x + box.width; x++)
- spr->secondary.pBaseAddress[sbase + x] =
- spr->swr.pBaseAddress[zbase + 8 * x + 4];
+ ((uint8_t*)(spr->secondary.xpBaseAddress))[sbase + x] =
+ ((uint8_t*)(spr->swr.xpBaseAddress))[zbase + 8 * x + 4];
}
zbase += spr->swr.pitch;
sbase += spr->secondary.pitch;
struct SWR_SURFACE_STATE *renderTarget = &pDC->renderTargets[attachment];
/* Only proceed if there's a valid surface to store to */
- if (renderTarget->pBaseAddress) {
+ if (renderTarget->xpBaseAddress) {
swr_update_draw_context(ctx);
SWR_RECT full_rect =
{0, 0,
swr_draw_context *pDC = &ctx->swrDC;
SWR_SURFACE_STATE *renderTargets = pDC->renderTargets;
for (uint32_t i = 0; i < SWR_NUM_ATTACHMENTS; i++)
- if (renderTargets[i].pBaseAddress == spr->swr.pBaseAddress ||
- (spr->secondary.pBaseAddress &&
- renderTargets[i].pBaseAddress == spr->secondary.pBaseAddress)) {
+ if (renderTargets[i].xpBaseAddress == spr->swr.xpBaseAddress ||
+ (spr->secondary.xpBaseAddress &&
+ renderTargets[i].xpBaseAddress == spr->secondary.xpBaseAddress)) {
swr_store_render_target(pipe, i, post_tile_state);
/* Mesa thinks depth/stencil are fused, so we'll never get an
assert(!swr_resource_is_texture(resource));
- return swr_r->swr.pBaseAddress;
+ return (uint8_t*)(swr_r->swr.xpBaseAddress);
}
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)
return false;
if (allocate) {
- res->swr.pBaseAddress = (uint8_t *)AlignedMalloc(total_size, 64);
+ res->swr.xpBaseAddress = (gfxptr_t)AlignedMalloc(total_size, 64);
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);
}
}
/* 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
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);
}
jit_tex->width = res->width0;
jit_tex->height = res->height0;
- jit_tex->base_ptr = swr->pBaseAddress;
+ jit_tex->base_ptr = (uint8_t*)swr->xpBaseAddress;
if (view->target != PIPE_BUFFER) {
jit_tex->first_level = view->u.tex.first_level;
jit_tex->last_level = view->u.tex.last_level;
struct SWR_SURFACE_STATE *rt = &pDC->renderTargets[attachment];
/* Do nothing if the render target hasn't changed */
- if ((!sf || !sf->texture) && rt->pBaseAddress == nullptr)
+ if ((!sf || !sf->texture) && (void*)(rt->xpBaseAddress) == nullptr)
return false;
/* Deal with disabling RT up front */
const SWR_SURFACE_STATE *swr_surface = &swr->swr;
SWR_FORMAT fmt = mesa_to_swr_format(sf->format);
- if (attachment == SWR_ATTACHMENT_STENCIL && swr->secondary.pBaseAddress) {
+ if (attachment == SWR_ATTACHMENT_STENCIL && swr->secondary.xpBaseAddress) {
swr_surface = &swr->secondary;
fmt = swr_surface->format;
}
- if (rt->pBaseAddress == swr_surface->pBaseAddress &&
+ if (rt->xpBaseAddress == swr_surface->xpBaseAddress &&
rt->format == fmt &&
rt->lod == sf->u.tex.level &&
rt->arrayIndex == sf->u.tex.first_layer)
bool need_fence = false;
/* StoreTile for changed target */
- if (rt->pBaseAddress) {
+ if (rt->xpBaseAddress) {
/* If changing attachment to a new target, mark tiles as
* INVALID so they are reloaded from surface. */
swr_store_render_target(&ctx->pipe, attachment, SWR_TILE_INVALID);