summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGeorge Kyriazis <[email protected]>2018-01-19 15:46:58 -0600
committerGeorge Kyriazis <[email protected]>2018-01-19 16:48:41 -0600
commit4660e131527d2aff879d5b5bda7cf3e9635e796b (patch)
tree2023e76bed1c94be68654515e16740f5b1dd673c /src
parent079ae3c48dda02101f1776e03c0c401df6b21ff7 (diff)
swr/rast: Add private state parameter in fetcher
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/frontend.cpp8
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/state.h4
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp3
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp39
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.h16
5 files changed, 41 insertions, 29 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
index ed8ce151c39..727b7105cdf 100644
--- a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
@@ -1720,13 +1720,13 @@ void ProcessDraw(
// 1. Execute FS/VS for a single SIMD.
AR_BEGIN(FEFetchShader, pDC->drawId);
#if USE_SIMD16_SHADERS
- state.pfnFetchFunc(fetchInfo_lo, vin);
+ state.pfnFetchFunc(GetPrivateState(pDC), fetchInfo_lo, vin);
#else
- state.pfnFetchFunc(fetchInfo_lo, vin_lo);
+ state.pfnFetchFunc(GetPrivateState(pDC), fetchInfo_lo, vin_lo);
if ((i + KNOB_SIMD_WIDTH) < endVertex) // 1/2 of KNOB_SIMD16_WIDTH
{
- state.pfnFetchFunc(fetchInfo_hi, vin_hi);
+ state.pfnFetchFunc(GetPrivateState(pDC), fetchInfo_hi, vin_hi);
}
#endif
AR_END(FEFetchShader, 0);
@@ -1968,7 +1968,7 @@ void ProcessDraw(
// 1. Execute FS/VS for a single SIMD.
AR_BEGIN(FEFetchShader, pDC->drawId);
- state.pfnFetchFunc(fetchInfo, vout);
+ state.pfnFetchFunc(GetPrivateState(pDC), fetchInfo, vout);
AR_END(FEFetchShader, 0);
// forward fetch generated vertex IDs to the vertex shader
diff --git a/src/gallium/drivers/swr/rasterizer/core/state.h b/src/gallium/drivers/swr/rasterizer/core/state.h
index d11ffc69b01..c93c37b4687 100644
--- a/src/gallium/drivers/swr/rasterizer/core/state.h
+++ b/src/gallium/drivers/swr/rasterizer/core/state.h
@@ -873,9 +873,9 @@ static_assert(sizeof(SWR_BLEND_STATE) == 36, "Invalid SWR_BLEND_STATE size");
/// FUNCTION POINTERS FOR SHADERS
#if USE_SIMD16_SHADERS
-typedef void(__cdecl *PFN_FETCH_FUNC)(SWR_FETCH_CONTEXT& fetchInfo, simd16vertex& out);
+typedef void(__cdecl *PFN_FETCH_FUNC)(HANDLE hPrivateData, SWR_FETCH_CONTEXT& fetchInfo, simd16vertex& out);
#else
-typedef void(__cdecl *PFN_FETCH_FUNC)(SWR_FETCH_CONTEXT& fetchInfo, simdvertex& out);
+typedef void(__cdecl *PFN_FETCH_FUNC)(HANDLE hPrivateData, SWR_FETCH_CONTEXT& fetchInfo, simdvertex& out);
#endif
typedef void(__cdecl *PFN_VERTEX_FUNC)(HANDLE hPrivateData, SWR_VS_CONTEXT* pVsContext);
typedef void(__cdecl *PFN_HS_FUNC)(HANDLE hPrivateData, SWR_HS_CONTEXT* pHsContext);
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index 40ca6441213..fbca1a74a72 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -125,6 +125,9 @@ JitManager::JitManager(uint32_t simdWidth, const char *arch, const char* core)
// typedef void(__cdecl *PFN_FETCH_FUNC)(SWR_FETCH_CONTEXT& fetchInfo, simdvertex& out);
#endif
std::vector<Type*> fsArgs;
+
+ fsArgs.push_back(PointerType::get(Type::getVoidTy(mContext), 0));
+
fsArgs.push_back(PointerType::get(Gen_SWR_FETCH_CONTEXT(this), 0));
#if USE_SIMD16_SHADERS
fsArgs.push_back(PointerType::get(Gen_simd16vertex(this), 0));
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
index ad70cbe95d3..d835f2d0296 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
@@ -127,6 +127,7 @@ struct FetchJit : public Builder
void CreateGatherOddFormats(SWR_FORMAT format, Value* pMask, Value* pBase, Value* offsets, Value* result[4]);
void ConvertFormat(SWR_FORMAT format, Value *texels[4]);
+ Value* mpPrivateContext;
Value* mpFetchInfo;
};
@@ -145,6 +146,9 @@ Function* FetchJit::Create(const FETCH_COMPILE_STATE& fetchState)
auto argitr = fetch->arg_begin();
// Fetch shader arguments
+ mpPrivateContext = &*argitr; ++argitr;
+ mpPrivateContext->setName("privateContext");
+
mpFetchInfo = &*argitr; ++argitr;
mpFetchInfo->setName("fetchInfo");
Value* pVtxOut = &*argitr;
@@ -2806,8 +2810,10 @@ Value *FetchJit::GenerateCompCtrlVector16(const ComponentControl ctrl)
Value *pId = BITCAST(LOAD(GEP(mpFetchInfo, { 0, SWR_FETCH_CONTEXT_CurInstance })), mFP32Ty);
return VBROADCAST_16(pId);
}
+
+
case StoreSrc:
- default:
+ default:
SWR_INVALID("Invalid component control");
return VUNDEF_I_16();
}
@@ -2822,15 +2828,15 @@ Value *FetchJit::GenerateCompCtrlVector(const ComponentControl ctrl)
{
switch (ctrl)
{
- case NoStore:
- return VUNDEF_I();
- case Store0:
- return VIMMED1(0);
- case Store1Fp:
- return VIMMED1(1.0f);
- case Store1Int:
- return VIMMED1(1);
- case StoreVertexId:
+ case NoStore:
+ return VUNDEF_I();
+ case Store0:
+ return VIMMED1(0);
+ case Store1Fp:
+ return VIMMED1(1.0f);
+ case Store1Int:
+ return VIMMED1(1);
+ case StoreVertexId:
{
#if USE_SIMD16_SHADERS
Value *pId;
@@ -2847,15 +2853,17 @@ Value *FetchJit::GenerateCompCtrlVector(const ComponentControl ctrl)
#endif
return pId;
}
- case StoreInstanceId:
+ case StoreInstanceId:
{
Value *pId = BITCAST(LOAD(GEP(mpFetchInfo, { 0, SWR_FETCH_CONTEXT_CurInstance })), mFP32Ty);
return VBROADCAST(pId);
}
- case StoreSrc:
- default:
- SWR_INVALID("Invalid component control");
- return VUNDEF_I();
+
+
+ case StoreSrc:
+ default:
+ SWR_INVALID("Invalid component control");
+ return VUNDEF_I();
}
}
@@ -2908,6 +2916,7 @@ PFN_FETCH_FUNC JitFetchFunc(HANDLE hJitMgr, const HANDLE hFunc)
pJitMgr->DumpAsm(const_cast<llvm::Function*>(func), "final");
+
return pfnFetch;
}
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.h b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.h
index 18fa96357b8..e334c20c5ee 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.h
@@ -46,12 +46,12 @@ struct INPUT_ELEMENT_DESC
uint32_t StreamIndex : 6;
uint32_t InstanceEnable : 1;
uint32_t InstanceStrideEnable : 1;
- uint32_t ComponentControl0 : 3;
- uint32_t ComponentControl1 : 3;
- uint32_t ComponentControl2 : 3;
- uint32_t ComponentControl3 : 3;
+ uint32_t ComponentControl0 : 4;
+ uint32_t ComponentControl1 : 4;
+ uint32_t ComponentControl2 : 4;
+ uint32_t ComponentControl3 : 4;
uint32_t ComponentPacking : 4;
- uint32_t _reserved : 18;
+ uint32_t _reserved : 14;
};
uint64_t bits;
};
@@ -87,7 +87,7 @@ enum ComponentControl
Store1Fp = 3,
Store1Int = 4,
StoreVertexId = 5,
- StoreInstanceId = 6
+ StoreInstanceId = 6,
};
//////////////////////////////////////////////////////////////////////////
@@ -126,9 +126,9 @@ struct FETCH_COMPILE_STATE
if (bForceSequentialAccessEnable != other.bForceSequentialAccessEnable) return false;
if (bInstanceIDOffsetEnable != other.bInstanceIDOffsetEnable) return false;
- for(uint32_t i = 0; i < numAttribs; ++i)
+ for (uint32_t i = 0; i < numAttribs; ++i)
{
- if((layout[i].bits != other.layout[i].bits) ||
+ if ((layout[i].bits != other.layout[i].bits) ||
(((layout[i].InstanceEnable == 1) || (layout[i].InstanceStrideEnable == 1)) &&
(layout[i].InstanceAdvancementState != other.layout[i].InstanceAdvancementState))){
return false;