[Mesa-dev] [PATCH] gallium/swr: remove use of BYTE from swr driver

Cherniak, Bruce bruce.cherniak at intel.com
Wed Mar 9 20:44:46 UTC 2016


Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>




On 3/8/16, 11:50 AM, "mesa-dev on behalf of Tim Rowley" <mesa-dev-bounces at lists.freedesktop.org on behalf of timothy.o.rowley at intel.com> wrote:

>Remove use of a win32-style type leaked from the swr rasterizer.
>---
> src/gallium/drivers/swr/swr_memory.h    | 8 ++++----
> src/gallium/drivers/swr/swr_scratch.cpp | 8 ++++----
> src/gallium/drivers/swr/swr_screen.cpp  | 4 ++--
> src/gallium/drivers/swr/swr_state.cpp   | 8 ++++----
> 4 files changed, 14 insertions(+), 14 deletions(-)
>
>diff --git a/src/gallium/drivers/swr/swr_memory.h b/src/gallium/drivers/swr/swr_memory.h
>index d116781..65fc169 100644
>--- a/src/gallium/drivers/swr/swr_memory.h
>+++ b/src/gallium/drivers/swr/swr_memory.h
>@@ -28,14 +28,14 @@ void LoadHotTile(
>     SWR_FORMAT dstFormat,
>     SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
>     UINT x, UINT y, uint32_t renderTargetArrayIndex,
>-    BYTE *pDstHotTile);
>+    uint8_t *pDstHotTile);
> 
> void StoreHotTile(
>     SWR_SURFACE_STATE *pDstSurface,
>     SWR_FORMAT srcFormat,
>     SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
>     UINT x, UINT y, uint32_t renderTargetArrayIndex,
>-    BYTE *pSrcHotTile);
>+    uint8_t *pSrcHotTile);
> 
> void StoreHotTileClear(
>     SWR_SURFACE_STATE *pDstSurface,
>@@ -49,7 +49,7 @@ swr_LoadHotTile(HANDLE hPrivateContext,
>                 SWR_FORMAT dstFormat,
>                 SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
>                 UINT x, UINT y,
>-                uint32_t renderTargetArrayIndex, BYTE* pDstHotTile)
>+                uint32_t renderTargetArrayIndex, uint8_t* pDstHotTile)
> {
>    // Grab source surface state from private context
>    swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
>@@ -63,7 +63,7 @@ swr_StoreHotTile(HANDLE hPrivateContext,
>                  SWR_FORMAT srcFormat,
>                  SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
>                  UINT x, UINT y,
>-                 uint32_t renderTargetArrayIndex, BYTE* pSrcHotTile)
>+                 uint32_t renderTargetArrayIndex, uint8_t* pSrcHotTile)
> {
>    // Grab destination surface state from private context
>    swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
>diff --git a/src/gallium/drivers/swr/swr_scratch.cpp b/src/gallium/drivers/swr/swr_scratch.cpp
>index e6c448c..28eb2ac 100644
>--- a/src/gallium/drivers/swr/swr_scratch.cpp
>+++ b/src/gallium/drivers/swr/swr_scratch.cpp
>@@ -58,14 +58,14 @@ swr_copy_to_scratch_space(struct swr_context *ctx,
>          }
> 
>          if (!space->base) {
>-            space->base = (BYTE *)align_malloc(space->current_size, 4);
>+            space->base = (uint8_t *)align_malloc(space->current_size, 4);
>             space->head = (void *)space->base;
>          }
>       }
> 
>       /* Wrap */
>-      if (((BYTE *)space->head + size)
>-          >= ((BYTE *)space->base + space->current_size)) {
>+      if (((uint8_t *)space->head + size)
>+          >= ((uint8_t *)space->base + space->current_size)) {
>          /*
>           * TODO XXX: Should add a fence on wrap.  Assumption is that
>           * current_space >> size, and there are at least MAX_DRAWS_IN_FLIGHT
>@@ -78,7 +78,7 @@ swr_copy_to_scratch_space(struct swr_context *ctx,
>       }
> 
>       ptr = space->head;
>-      space->head = (BYTE *)space->head + size;
>+      space->head = (uint8_t *)space->head + size;
>    }
> 
>    /* Copy user_buffer to scratch */
>diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
>index f0d48cd..89de17a 100644
>--- a/src/gallium/drivers/swr/swr_screen.cpp
>+++ b/src/gallium/drivers/swr/swr_screen.cpp
>@@ -537,7 +537,7 @@ swr_texture_layout(struct swr_screen *screen,
>    res->swr.pitch = res->row_stride[0];
> 
>    if (allocate) {
>-      res->swr.pBaseAddress = (BYTE *)_aligned_malloc(total_size, 64);
>+      res->swr.pBaseAddress = (uint8_t *)_aligned_malloc(total_size, 64);
> 
>       if (res->has_depth && res->has_stencil) {
>          SWR_FORMAT_INFO finfo = GetFormatInfo(res->secondary.format);
>@@ -550,7 +550,7 @@ swr_texture_layout(struct swr_screen *screen,
>          res->secondary.numSamples = (1 << pt->nr_samples);
>          res->secondary.pitch = res->alignedWidth * finfo.Bpp;
> 
>-         res->secondary.pBaseAddress = (BYTE *)_aligned_malloc(
>+         res->secondary.pBaseAddress = (uint8_t *)_aligned_malloc(
>             res->alignedHeight * res->secondary.pitch, 64);
>       }
>    }
>diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp
>index 49035b5..706bf10 100644
>--- a/src/gallium/drivers/swr/swr_state.cpp
>+++ b/src/gallium/drivers/swr/swr_state.cpp
>@@ -1032,12 +1032,12 @@ swr_update_derived(struct swr_context *ctx,
>          pDC->num_constantsVS[i] = cb->buffer_size;
>          if (cb->buffer)
>             pDC->constantVS[i] =
>-               (const float *)((const BYTE *)cb->buffer + cb->buffer_offset);
>+               (const float *)((const uint8_t *)cb->buffer + cb->buffer_offset);
>          else {
>             /* Need to copy these constants to scratch space */
>             if (cb->user_buffer && cb->buffer_size) {
>                const void *ptr =
>-                  ((const BYTE *)cb->user_buffer + cb->buffer_offset);
>+                  ((const uint8_t *)cb->user_buffer + cb->buffer_offset);
>                uint32_t size = AlignUp(cb->buffer_size, 4);
>                ptr = swr_copy_to_scratch_space(
>                   ctx, &ctx->scratch->vs_constants, ptr, size);
>@@ -1057,12 +1057,12 @@ swr_update_derived(struct swr_context *ctx,
>          pDC->num_constantsFS[i] = cb->buffer_size;
>          if (cb->buffer)
>             pDC->constantFS[i] =
>-               (const float *)((const BYTE *)cb->buffer + cb->buffer_offset);
>+               (const float *)((const uint8_t *)cb->buffer + cb->buffer_offset);
>          else {
>             /* Need to copy these constants to scratch space */
>             if (cb->user_buffer && cb->buffer_size) {
>                const void *ptr =
>-                  ((const BYTE *)cb->user_buffer + cb->buffer_offset);
>+                  ((const uint8_t *)cb->user_buffer + cb->buffer_offset);
>                uint32_t size = AlignUp(cb->buffer_size, 4);
>                ptr = swr_copy_to_scratch_space(
>                   ctx, &ctx->scratch->fs_constants, ptr, size);
>-- 
>2.5.0
>
>_______________________________________________
>mesa-dev mailing list
>mesa-dev at lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list