// 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);
// 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
/// 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);
// 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));
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;
};
auto argitr = fetch->arg_begin();
// Fetch shader arguments
+ mpPrivateContext = &*argitr; ++argitr;
+ mpPrivateContext->setName("privateContext");
+
mpFetchInfo = &*argitr; ++argitr;
mpFetchInfo->setName("fetchInfo");
Value* pVtxOut = &*argitr;
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();
}
{
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;
#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();
}
}
pJitMgr->DumpAsm(const_cast<llvm::Function*>(func), "final");
+
return pfnFetch;
}
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;
};
Store1Fp = 3,
Store1Int = 4,
StoreVertexId = 5,
- StoreInstanceId = 6
+ StoreInstanceId = 6,
};
//////////////////////////////////////////////////////////////////////////
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;