[Mesa-dev] [PATCH 5/7] swr/rast: Scope MEM_CLIENT enum for mem usages
Alok Hota
alok.hota at intel.com
Mon Dec 17 14:36:48 UTC 2018
Avoids confusion with other defaulted integer parameters
- fixed some unspecified usages
- removed unnecessary includes
- removed unecessary protected access specifier in buckets framework
---
.../drivers/swr/rasterizer/jitter/builder.h | 1 -
.../swr/rasterizer/jitter/builder_gfx_mem.cpp | 2 +-
.../swr/rasterizer/jitter/builder_gfx_mem.h | 20 ++++++-------
.../swr/rasterizer/jitter/builder_mem.cpp | 1 -
.../swr/rasterizer/jitter/builder_mem.h | 28 +++++++++----------
.../swr/rasterizer/jitter/fetch_jit.cpp | 26 ++++++++---------
6 files changed, 38 insertions(+), 40 deletions(-)
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder.h b/src/gallium/drivers/swr/rasterizer/jitter/builder.h
index a047f2a065f..0ce8d025b5c 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder.h
@@ -161,7 +161,6 @@ namespace SwrJit
#include "builder_math.h"
#include "builder_mem.h"
- protected:
void SetPrivateContext(Value* pPrivateContext)
{
mpPrivateContext = pPrivateContext;
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp
index c68f3b9a619..19eec7e99e0 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp
@@ -52,7 +52,7 @@ namespace SwrJit
void BuilderGfxMem::AssertGFXMemoryParams(Value* ptr, Builder::JIT_MEM_CLIENT usage)
{
- SWR_ASSERT(!(ptr->getType() == mInt64Ty && usage == MEM_CLIENT_INTERNAL),
+ SWR_ASSERT(!(ptr->getType() == mInt64Ty && usage == JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL),
"Internal memory should not be gfxptr_t.");
}
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.h b/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.h
index aefbbef9fba..4cf06253695 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.h
@@ -51,21 +51,21 @@ namespace SwrJit
virtual LoadInst* LOAD(Value* Ptr,
const char* Name,
Type* Ty = nullptr,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
virtual LoadInst* LOAD(Value* Ptr,
const Twine& Name = "",
Type* Ty = nullptr,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
virtual LoadInst* LOAD(Value* Ptr,
bool isVolatile,
const Twine& Name = "",
Type* Ty = nullptr,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
virtual LoadInst* LOAD(Value* BasePtr,
const std::initializer_list<uint32_t>& offset,
const llvm::Twine& Name = "",
Type* Ty = nullptr,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
virtual CallInst* MASKED_LOAD(Value* Ptr,
@@ -74,36 +74,36 @@ namespace SwrJit
Value* PassThru = nullptr,
const Twine& Name = "",
Type* Ty = nullptr,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
virtual Value* GATHERPS(Value* src,
Value* pBase,
Value* indices,
Value* mask,
uint8_t scale = 1,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
virtual Value* GATHERDD(Value* src,
Value* pBase,
Value* indices,
Value* mask,
uint8_t scale = 1,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
virtual void SCATTERPS(Value* pDst,
Value* vSrc,
Value* vOffsets,
Value* vMask,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
Value* TranslateGfxAddressForRead(Value* xpGfxAddress,
Type* PtrTy = nullptr,
const Twine& Name = "",
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
Value* TranslateGfxAddressForWrite(Value* xpGfxAddress,
Type* PtrTy = nullptr,
const Twine& Name = "",
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
protected:
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp
index 94489f1c7fd..a9d649092d4 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp
@@ -29,7 +29,6 @@
******************************************************************************/
#include "jit_pch.hpp"
#include "builder.h"
-#include "common/rdtsc_buckets.h"
#include <cstdarg>
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h
index 15def96cb76..c533984da30 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h
@@ -30,13 +30,13 @@
#pragma once
public:
-typedef enum _JIT_MEM_CLIENT
+enum class JIT_MEM_CLIENT
{
MEM_CLIENT_INTERNAL,
GFX_MEM_CLIENT_FETCH,
GFX_MEM_CLIENT_SAMPLER,
GFX_MEM_CLIENT_SHADER,
-} JIT_MEM_CLIENT;
+};
protected:
virtual Value* OFFSET_TO_NEXT_COMPONENT(Value* base, Constant* offset);
@@ -56,23 +56,23 @@ Value* IN_BOUNDS_GEP(Value* ptr, const std::initializer_list<Value*>& indexList)
Value* IN_BOUNDS_GEP(Value* ptr, const std::initializer_list<uint32_t>& indexList);
virtual LoadInst*
- LOAD(Value* Ptr, const char* Name, Type* Ty = nullptr, JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ LOAD(Value* Ptr, const char* Name, Type* Ty = nullptr, JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
virtual LoadInst* LOAD(Value* Ptr,
const Twine& Name = "",
Type* Ty = nullptr,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
virtual LoadInst*
- LOAD(Type* Ty, Value* Ptr, const Twine& Name = "", JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ LOAD(Type* Ty, Value* Ptr, const Twine& Name = "", JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
virtual LoadInst* LOAD(Value* Ptr,
bool isVolatile,
const Twine& Name = "",
Type* Ty = nullptr,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
virtual LoadInst* LOAD(Value* BasePtr,
const std::initializer_list<uint32_t>& offset,
const llvm::Twine& Name = "",
Type* Ty = nullptr,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
virtual CallInst* MASKED_LOAD(Value* Ptr,
unsigned Align,
@@ -80,7 +80,7 @@ virtual CallInst* MASKED_LOAD(Value* Ptr,
Value* PassThru = nullptr,
const Twine& Name = "",
Type* Ty = nullptr,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL)
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL)
{
return IRB()->CreateMaskedLoad(Ptr, Align, Mask, PassThru, Name);
}
@@ -101,14 +101,14 @@ void Gather4(const SWR_FORMAT format,
Value* mask,
Value* vGatherComponents[],
bool bPackedOutput,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
virtual Value* GATHERPS(Value* src,
Value* pBase,
Value* indices,
Value* mask,
uint8_t scale = 1,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
void GATHER4PS(const SWR_FORMAT_INFO& info,
Value* pSrcBase,
@@ -116,14 +116,14 @@ void GATHER4PS(const SWR_FORMAT_INFO& info,
Value* mask,
Value* vGatherComponents[],
bool bPackedOutput,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
virtual Value* GATHERDD(Value* src,
Value* pBase,
Value* indices,
Value* mask,
uint8_t scale = 1,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
void GATHER4DD(const SWR_FORMAT_INFO& info,
Value* pSrcBase,
@@ -131,7 +131,7 @@ void GATHER4DD(const SWR_FORMAT_INFO& info,
Value* mask,
Value* vGatherComponents[],
bool bPackedOutput,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
Value* GATHERPD(Value* src, Value* pBase, Value* indices, Value* mask, uint8_t scale = 1);
@@ -141,7 +141,7 @@ virtual void SCATTERPS(Value* pDst,
Value* vSrc,
Value* vOffsets,
Value* vMask,
- JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+ JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
void Shuffle8bpcGather4(const SWR_FORMAT_INFO& info,
Value* vGatherInput,
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
index 6feb1a76e63..a1bb518905f 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
@@ -202,7 +202,7 @@ Function* FetchJit::Create(const FETCH_COMPILE_STATE& fetchState)
break;
case R32_UINT:
(fetchState.bDisableIndexOOBCheck)
- ? vIndices = LOAD(indices, "", PointerType::get(mSimdInt32Ty, 0), GFX_MEM_CLIENT_FETCH)
+ ? vIndices = LOAD(indices, "", PointerType::get(mSimdInt32Ty, 0), JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH)
: vIndices = GetSimdValid32bitIndices(indices, pLastIndex);
break; // incoming type is already 32bit int
default:
@@ -378,7 +378,7 @@ void FetchJit::CreateGatherOddFormats(
Value* pGather;
if (info.bpp == 32)
{
- pGather = GATHERDD(VIMMED1(0), xpBase, pOffsets, pMask);
+ pGather = GATHERDD(VIMMED1(0), xpBase, pOffsets, pMask, 1, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH);
}
else
{
@@ -411,7 +411,7 @@ void FetchJit::CreateGatherOddFormats(
{
Value* pDst = BITCAST(GEP(pDstMem, C(lane)), PointerType::get(mInt8Ty, 0));
Value* xpSrc = ADD(xpBase, Z_EXT(index, xpBase->getType()));
- STORE(LOAD(xpSrc, "", mInt8PtrTy, GFX_MEM_CLIENT_FETCH), pDst);
+ STORE(LOAD(xpSrc, "", mInt8PtrTy, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH), pDst);
break;
}
@@ -419,7 +419,7 @@ void FetchJit::CreateGatherOddFormats(
{
Value* pDst = BITCAST(GEP(pDstMem, C(lane)), PointerType::get(mInt16Ty, 0));
Value* xpSrc = ADD(xpBase, Z_EXT(index, xpBase->getType()));
- STORE(LOAD(xpSrc, "", mInt16PtrTy, GFX_MEM_CLIENT_FETCH), pDst);
+ STORE(LOAD(xpSrc, "", mInt16PtrTy, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH), pDst);
break;
}
break;
@@ -429,12 +429,12 @@ void FetchJit::CreateGatherOddFormats(
// First 16-bits of data
Value* pDst = BITCAST(GEP(pDstMem, C(lane)), PointerType::get(mInt16Ty, 0));
Value* xpSrc = ADD(xpBase, Z_EXT(index, xpBase->getType()));
- STORE(LOAD(xpSrc, "", mInt16PtrTy, GFX_MEM_CLIENT_FETCH), pDst);
+ STORE(LOAD(xpSrc, "", mInt16PtrTy, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH), pDst);
// Last 8-bits of data
pDst = BITCAST(GEP(pDst, C(1)), PointerType::get(mInt8Ty, 0));
xpSrc = ADD(xpSrc, C(2));
- STORE(LOAD(xpSrc, "", mInt8PtrTy, GFX_MEM_CLIENT_FETCH), pDst);
+ STORE(LOAD(xpSrc, "", mInt8PtrTy, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH), pDst);
break;
}
@@ -806,7 +806,7 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE& fetchState,
vNewOffsets,
vGatherMask,
1,
- GFX_MEM_CLIENT_FETCH);
+ JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH);
}
else
{
@@ -948,7 +948,7 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE& fetchState,
if (compMask)
{
Value* vGatherResult = GATHERDD(
- gatherSrc, pStreamBaseGFX, vOffsets, vGatherMask, 1, GFX_MEM_CLIENT_FETCH);
+ gatherSrc, pStreamBaseGFX, vOffsets, vGatherMask, 1, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH);
// e.g. result of an 8x32bit integer gather for 8bit components
// 256i - 0 1 2 3 4 5 6 7
// xyzw xyzw xyzw xyzw xyzw xyzw xyzw xyzw
@@ -977,7 +977,7 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE& fetchState,
// if we have at least one component out of x or y to fetch
if (isComponentEnabled(compMask, 0) || isComponentEnabled(compMask, 1))
{
- vGatherResult[0] = GATHERDD(gatherSrc, pStreamBaseGFX, vOffsets, vGatherMask);
+ vGatherResult[0] = GATHERDD(gatherSrc, pStreamBaseGFX, vOffsets, vGatherMask, 1, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH);
// e.g. result of first 8x32bit integer gather for 16bit components
// 256i - 0 1 2 3 4 5 6 7
// xyxy xyxy xyxy xyxy xyxy xyxy xyxy xyxy
@@ -990,7 +990,7 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE& fetchState,
// offset base to the next components(zw) in the vertex to gather
pStreamBaseGFX = ADD(pStreamBaseGFX, C((int64_t)4));
- vGatherResult[1] = GATHERDD(gatherSrc, pStreamBaseGFX, vOffsets, vGatherMask);
+ vGatherResult[1] = GATHERDD(gatherSrc, pStreamBaseGFX, vOffsets, vGatherMask, 1, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH);
// e.g. result of second 8x32bit integer gather for 16bit components
// 256i - 0 1 2 3 4 5 6 7
// zwzw zwzw zwzw zwzw zwzw zwzw zwzw zwzw
@@ -1027,7 +1027,7 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE& fetchState,
if (compCtrl[i] == StoreSrc)
{
Value* pGather =
- GATHERDD(gatherSrc, pStreamBaseGFX, vOffsets, vGatherMask);
+ GATHERDD(gatherSrc, pStreamBaseGFX, vOffsets, vGatherMask, 1, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH);
if (conversionType == CONVERT_USCALED)
{
@@ -1124,7 +1124,7 @@ Value* FetchJit::GetSimdValidIndicesHelper(Value* pIndices, Value* pLastIndex)
// if valid, load the index. if not, load 0 from the stack
Value* pValid = SELECT(mask, pIndex, pZeroIndex);
- Value* index = LOAD(pValid, "valid index", Ty, GFX_MEM_CLIENT_FETCH);
+ Value* index = LOAD(pValid, "valid index", Ty, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH);
// zero extended index to 32 bits and insert into the correct simd lane
index = Z_EXT(index, mInt32Ty);
@@ -1199,7 +1199,7 @@ Value* FetchJit::GetSimdValid32bitIndices(Value* pIndices, Value* pLastIndex)
VIMMED1(0),
"vIndices",
PointerType::get(mSimdInt32Ty, 0),
- GFX_MEM_CLIENT_FETCH);
+ JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH);
}
//////////////////////////////////////////////////////////////////////////
--
2.17.1
More information about the mesa-dev
mailing list