From 036c8b6247c063d0fb06b5d6e0c491d5a91778d8 Mon Sep 17 00:00:00 2001 From: George Kyriazis Date: Thu, 1 Feb 2018 22:12:22 -0600 Subject: [PATCH] swr/rast: Renamed variable in vertexbufferstate Reviewed-by: Bruce Cherniak --- src/gallium/drivers/swr/rasterizer/core/state.h | 2 +- .../drivers/swr/rasterizer/jitter/fetch_jit.cpp | 10 ++++++---- src/gallium/drivers/swr/swr_state.cpp | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/core/state.h b/src/gallium/drivers/swr/rasterizer/core/state.h index c8995b313f9..d959c64361d 100644 --- a/src/gallium/drivers/swr/rasterizer/core/state.h +++ b/src/gallium/drivers/swr/rasterizer/core/state.h @@ -555,7 +555,7 @@ struct SWR_VERTEX_BUFFER_STATE { uint32_t index; uint32_t pitch; - const uint8_t *pData; + gfxptr_t xpData; uint32_t size; uint32_t numaNode; uint32_t minVertex; // min vertex (for bounds checking) diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp index 9bb62976f60..aa2d4c36571 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp @@ -445,7 +445,7 @@ void FetchJit::JitLoadVertices(const FETCH_COMPILE_STATE &fetchState, Value* str } // load SWR_VERTEX_BUFFER_STATE::pData - Value *stream = LOAD(streams, {ied.StreamIndex, SWR_VERTEX_BUFFER_STATE_pData}); + Value *stream = LOAD(streams, {ied.StreamIndex, SWR_VERTEX_BUFFER_STATE_xpData}); // load SWR_VERTEX_BUFFER_STATE::pitch Value *stride = LOAD(streams, {ied.StreamIndex, SWR_VERTEX_BUFFER_STATE_pitch}); @@ -933,10 +933,10 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE &fetchState, SWR_ASSERT((info.bpp != 0), "Unsupported format in JitGatherVertices."); uint32_t bpc = info.bpp / info.numComps; ///@todo Code below assumes all components are same size. Need to fix. - Value *stream = LOAD(streams, {ied.StreamIndex, SWR_VERTEX_BUFFER_STATE_pData}); + Value *stream = LOAD(streams, {ied.StreamIndex, SWR_VERTEX_BUFFER_STATE_xpData}); // VGATHER* takes an *i8 src pointer - Value *pStreamBase = BITCAST(stream, PointerType::get(mInt8Ty, 0)); + Value *pStreamBase = INT_TO_PTR(stream, PointerType::get(mInt8Ty, 0)); Value *stride = LOAD(streams, {ied.StreamIndex, SWR_VERTEX_BUFFER_STATE_pitch}); #if USE_SIMD16_GATHERS @@ -1039,6 +1039,7 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE &fetchState, // calculate byte offset to the start of the VB Value* baseOffset = MUL(Z_EXT(startOffset, mInt64Ty), Z_EXT(stride, mInt64Ty)); pStreamBase = GEP(pStreamBase, baseOffset); + Value* pStreamBaseGFX = ADD(stream, baseOffset); // if we have a start offset, subtract from max vertex. Used for OOB check maxVertex = SUB(Z_EXT(maxVertex, mInt64Ty), Z_EXT(startOffset, mInt64Ty)); @@ -1364,7 +1365,7 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE &fetchState, // But, we know that elements must be aligned for FETCH. :) // Right shift the offset by a bit and then scale by 2 to remove the sign extension. Value *vShiftedOffsets = LSHR(vOffsets, 1); - vVertexElements[currentVertexElement++] = GATHERPS(gatherSrc, pStreamBase, vShiftedOffsets, vGatherMask, 2); + vVertexElements[currentVertexElement++] = GATHERPS(gatherSrc, pStreamBaseGFX, vShiftedOffsets, vGatherMask, 2); } else { @@ -1385,6 +1386,7 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE &fetchState, // offset base to the next component in the vertex to gather pStreamBase = GEP(pStreamBase, C((char)4)); + pStreamBaseGFX = ADD(pStreamBaseGFX, C((int64_t)4)); #endif } } diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index d320c901168..d11323ef2e7 100644 --- a/src/gallium/drivers/swr/swr_state.cpp +++ b/src/gallium/drivers/swr/swr_state.cpp @@ -1325,7 +1325,7 @@ swr_update_derived(struct pipe_context *pipe, swrVertexBuffers[i] = {0}; swrVertexBuffers[i].index = i; swrVertexBuffers[i].pitch = pitch; - swrVertexBuffers[i].pData = p_data; + swrVertexBuffers[i].xpData = (gfxptr_t) p_data; swrVertexBuffers[i].size = size; swrVertexBuffers[i].minVertex = min_vertex_index; swrVertexBuffers[i].maxVertex = elems; -- 2.30.2