void RSP_VNAND(RSP::CPUState *rsp, unsigned vd, unsigned vs, unsigned vt, unsigned e)
{
   uint16_t *acc = rsp->cp2.acc.e;
   rsp_vect_t result = rsp_vnand(LOAD_VS(), LOAD_VT());
   write_acc_lo(acc, result);
   STORE_RESULT();
}
//
// VABS
//
void RSP_VABS(RSP::CPUState *rsp, unsigned vd, unsigned vs, unsigned vt, unsigned e)
{
   uint16_t *acc = rsp->cp2.acc.e;
   rsp_vect_t acc_lo;
   rsp_vect_t result = rsp_vabs(LOAD_VS(), LOAD_VT(), &acc_lo);
   write_acc_lo(acc, acc_lo);
   rsp_vect_write_operand(rsp->cp2.regs[vd].e, result);
}
//
// VADDC
//
void RSP_VADDC(RSP::CPUState *rsp, unsigned vd, unsigned vs, unsigned vt, unsigned e)
{
   uint16_t *acc = rsp->cp2.acc.e;
   rsp_vect_t sn;

   rsp_vect_t result = rsp_vaddc(LOAD_VS(), LOAD_VT(), rsp_vzero(), &sn);
   write_vco_hi(rsp->cp2.flags[RSP::RSP_VCO].e, rsp_vzero()); // TODO: Confirm.
   write_vco_lo(rsp->cp2.flags[RSP::RSP_VCO].e, sn);
   write_acc_lo(acc, result);
   STORE_RESULT();
}
//
// VSUBC
//
void RSP_VSUBC(RSP::CPUState *rsp, unsigned vd, unsigned vs, unsigned vt, unsigned e)
{
   uint16_t *acc = rsp->cp2.acc.e;
   rsp_vect_t eq, sn;

   rsp_vect_t result = rsp_vsubc(LOAD_VS(), LOAD_VT(), rsp_vzero(), &eq, &sn);

   write_vco_hi(rsp->cp2.flags[RSP::RSP_VCO].e, eq);
   write_vco_lo(rsp->cp2.flags[RSP::RSP_VCO].e, sn);
   write_acc_lo(acc, result);
   STORE_RESULT();
}
void RSP_VMULU(RSP::CPUState *rsp, unsigned vd, unsigned vs, unsigned vt, unsigned e)
{
   uint16_t *acc = rsp->cp2.acc.e;
   rsp_vect_t acc_lo, acc_md, acc_hi, result;

   result = rsp_vmulf_vmulu<true>(LOAD_VS(), LOAD_VT(), rsp_vzero(), &acc_lo, &acc_md, &acc_hi);

   write_acc_lo(acc, acc_lo);
   write_acc_md(acc, acc_md);
   write_acc_hi(acc, acc_hi);
   STORE_RESULT();
}
//
// VMRG
//
void RSP_VMRG(RSP::CPUState *rsp, unsigned vd, unsigned vs, unsigned vt, unsigned e)
{
   uint16_t *acc = rsp->cp2.acc.e;
   rsp_vect_t le;

   le = read_vcc_lo(rsp->cp2.flags[RSP::RSP_VCC].e);
   rsp_vect_t result = rsp_vmrg(LOAD_VS(), LOAD_VT(), le);
   write_vco_hi(rsp->cp2.flags[RSP::RSP_VCO].e, rsp_vzero());
   write_vco_lo(rsp->cp2.flags[RSP::RSP_VCO].e, rsp_vzero());
   write_acc_lo(acc, result);
   STORE_RESULT();
}
//
// VADD
//
void RSP_VADD(RSP::CPUState *rsp, unsigned vd, unsigned vs, unsigned vt, unsigned e)
{
   uint16_t *acc = rsp->cp2.acc.e;
   rsp_vect_t carry, acc_lo;

   carry = read_vco_lo(rsp->cp2.flags[RSP::RSP_VCO].e);
   rsp_vect_t result = rsp_vadd(LOAD_VS(), LOAD_VT(), carry, &acc_lo);

   write_vco_hi(rsp->cp2.flags[RSP::RSP_VCO].e, rsp_vzero());
   write_vco_lo(rsp->cp2.flags[RSP::RSP_VCO].e, rsp_vzero());
   write_acc_lo(acc, acc_lo);
   STORE_RESULT();
}
示例#8
0
文件: intro.cpp 项目: jannekai/4k
void IntroInit()
{
	InitializeRandomTable();

	ID3DBlob* pBlob = NULL;

	LOAD_CS(SHADER_HLSL, "CS", pBlob, g_pComputeShader);
	LOAD_VS(SHADER_HLSL, "VS", pBlob, g_pVertexShader);
	LOAD_PS(SHADER_HLSL, "PS", pBlob, g_pPixelShader);
			
	D3D11_BUFFER_DESC sbDesc;
	ZeroMem((char*) &sbDesc, sizeof(sbDesc));
	sbDesc.StructureByteStride = sizeof(Data);
	sbDesc.ByteWidth = sizeof(Data) * BUFFER_SIZE;
	sbDesc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
	sbDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
	sbDesc.Usage = D3D11_USAGE_DEFAULT;
	CHK(g_pDevice->CreateBuffer(&sbDesc, NULL, &g_pData));

	D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
	ZeroMem((char*) &srvDesc, sizeof(srvDesc));
	srvDesc.Format = DXGI_FORMAT_UNKNOWN;
	srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
	srvDesc.Buffer.NumElements = BUFFER_SIZE;
	CHK(g_pDevice->CreateShaderResourceView(g_pData, &srvDesc, &g_pDataSRV));

	D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc;
	ZeroMem((char*) &uavDesc, sizeof(uavDesc));
	uavDesc.Format = DXGI_FORMAT_UNKNOWN;
	uavDesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
	uavDesc.Buffer.NumElements = BUFFER_SIZE;
	CHK(g_pDevice->CreateUnorderedAccessView(g_pData, &uavDesc, &g_pDataUAV));

	D3D11_BUFFER_DESC cbDesc;

	ZeroMem((char*) &cbDesc, sizeof(cbDesc));
	cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
	cbDesc.Usage = D3D11_USAGE_DEFAULT;
	cbDesc.ByteWidth = sizeof(StaticConstants);
	CHK(g_pDevice->CreateBuffer(&cbDesc, NULL, &g_pStaticConstantBuffer));

	ZeroMem((char*) &cbDesc, sizeof(cbDesc));
	cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
	cbDesc.Usage = D3D11_USAGE_DEFAULT;
	cbDesc.ByteWidth = sizeof(FrameConstants);
	CHK(g_pDevice->CreateBuffer(&cbDesc, NULL, &g_pFrameConstantBuffer));
		
	g_pImmediateContext->IASetVertexBuffers(0, 0, NULL, NULL, NULL);
	g_pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);	
}
//
// VCH
//
void RSP_VCH(RSP::CPUState *rsp, unsigned vd, unsigned vs, unsigned vt, unsigned e)
{
   uint16_t *acc = rsp->cp2.acc.e;
   rsp_vect_t ge, le, sign, eq, vce;

   rsp_vect_t result = rsp_vch(LOAD_VS(), LOAD_VT(), rsp_vzero(), &ge, &le, &eq, &sign, &vce);

   write_vcc_hi(rsp->cp2.flags[RSP::RSP_VCC].e, ge);
   write_vcc_lo(rsp->cp2.flags[RSP::RSP_VCC].e, le);
   write_vco_hi(rsp->cp2.flags[RSP::RSP_VCO].e, eq);
   write_vco_lo(rsp->cp2.flags[RSP::RSP_VCO].e, sign);
   write_vce   (rsp->cp2.flags[RSP::RSP_VCE].e, vce);
   write_acc_lo(acc, result);
   STORE_RESULT();
}
//
// VMACF
// VMACU
//
void RSP_VMACF(RSP::CPUState *rsp, unsigned vd, unsigned vs, unsigned vt, unsigned e)
{
   uint16_t *acc = rsp->cp2.acc.e;
   rsp_vect_t acc_lo, acc_md, acc_hi, result;
   acc_lo = read_acc_lo(acc);
   acc_md = read_acc_md(acc);
   acc_hi = read_acc_hi(acc);

   result = rsp_vmacf_vmacu<false>(LOAD_VS(), LOAD_VT(), rsp_vzero(), &acc_lo, &acc_md, &acc_hi);

   write_acc_lo(acc, acc_lo);
   write_acc_md(acc, acc_md);
   write_acc_hi(acc, acc_hi);
   STORE_RESULT();
}
//
// VCR
//
void RSP_VCR(RSP::CPUState *rsp, unsigned vd, unsigned vs, unsigned vt, unsigned e)
{
   uint16_t *acc = rsp->cp2.acc.e;
   rsp_vect_t ge, le;

   rsp_vect_t result = rsp_vcr(LOAD_VS(), LOAD_VT(), rsp_vzero(), &ge, &le);

#ifdef INTENSE_DEBUG
   for (unsigned i = 0; i < 8; i++)
      fprintf(stderr, "VD[%d] = %d\n", i,
            reinterpret_cast<int16_t*>(&result)[i]);
#endif

   write_vcc_hi(rsp->cp2.flags[RSP::RSP_VCC].e, ge);
   write_vcc_lo(rsp->cp2.flags[RSP::RSP_VCC].e, le);
   write_vco_hi(rsp->cp2.flags[RSP::RSP_VCO].e, rsp_vzero());
   write_vco_lo(rsp->cp2.flags[RSP::RSP_VCO].e, rsp_vzero());
   write_vce   (rsp->cp2.flags[RSP::RSP_VCE].e, rsp_vzero());
   write_acc_lo(acc, result);
   STORE_RESULT();
}
//
// VCL
//
void RSP_VCL(RSP::CPUState *rsp, unsigned vd, unsigned vs, unsigned vt, unsigned e)
{
   uint16_t *acc = rsp->cp2.acc.e;
   rsp_vect_t ge, le, eq, sign, vce;

   ge = read_vcc_hi(rsp->cp2.flags[RSP::RSP_VCC].e);
   le = read_vcc_lo(rsp->cp2.flags[RSP::RSP_VCC].e);
   eq = read_vco_hi(rsp->cp2.flags[RSP::RSP_VCO].e);
   sign = read_vco_lo(rsp->cp2.flags[RSP::RSP_VCO].e);
   vce = read_vce(rsp->cp2.flags[RSP::RSP_VCE].e);

   rsp_vect_t result = rsp_vcl(LOAD_VS(), LOAD_VT(), rsp_vzero(), &ge, &le, eq, sign, vce);

   write_vcc_hi(rsp->cp2.flags[RSP::RSP_VCC].e, ge);
   write_vcc_lo(rsp->cp2.flags[RSP::RSP_VCC].e, le);
   write_vco_hi(rsp->cp2.flags[RSP::RSP_VCO].e, rsp_vzero());
   write_vco_lo(rsp->cp2.flags[RSP::RSP_VCO].e, rsp_vzero());
   write_vce   (rsp->cp2.flags[RSP::RSP_VCE].e, rsp_vzero());
   write_acc_lo(acc, result);
   STORE_RESULT();
}
示例#13
0
bool ZZshLoadExtraEffects() {
	bool bLoadSuccess = true;

	std::string depth_macro = BuildGlslMacro(true);
	std::string empty_macro = BuildGlslMacro(false);

	// DEBUG
	// Put them first so it is easier to get their program index in apitrace. Namely 3,4,5
	if (!LOAD_PS(empty_macro, "ZeroDebugPS", ppsDebug,  0)) bLoadSuccess = false;
	if (!LOAD_PS(empty_macro, "ZeroDebug2PS", ppsDebug2,  0)) bLoadSuccess = false;
	//if (!LOAD_PS(empty_macro, "ZeroDebug3PS", ppsDebug3,  0)) bLoadSuccess = false;

	const char* pvsshaders[4] = { "RegularVS", "TextureVS", "RegularFogVS", "TextureFogVS" };

	for (int i = 0; i < 4; ++i) {
		if (!LOAD_VS(empty_macro, pvsshaders[i], pvsStore[2 * i], 0)) bLoadSuccess = false;
		if (!LOAD_VS(empty_macro, pvsshaders[i], pvsStore[2 *i + 1 ], 1)) bLoadSuccess = false;
		if (!LOAD_VS(depth_macro, pvsshaders[i], pvsStore[2 *i + 8 ], 0)) bLoadSuccess = false;
		if (!LOAD_VS(depth_macro, pvsshaders[i], pvsStore[2 *i + 8 + 1], 1)) bLoadSuccess = false;
	}
	for (int i = 0; i < 16; ++i)
		pvs[i] = pvsStore[i].prog;

	if (!LOAD_VS(empty_macro, "BitBltVS", pvsBitBlt, 0)) bLoadSuccess = false;
	GL_REPORT_ERRORD();

	if (!LOAD_PS(empty_macro, "RegularPS", ppsRegular[0],  0)) bLoadSuccess = false;
	if (!LOAD_PS(empty_macro, "RegularFogPS", ppsRegular[1],  0)) bLoadSuccess = false;

	if( conf.mrtdepth ) {
		if (!LOAD_PS(depth_macro, "RegularPS", ppsRegular[2],  0)) bLoadSuccess = false;
		if (!bLoadSuccess) conf.mrtdepth = 0;

		if (!LOAD_PS(depth_macro, "RegularFogPS", ppsRegular[3],  0)) bLoadSuccess = false;
		if (!bLoadSuccess) conf.mrtdepth = 0;
	}

	if (!LOAD_PS(empty_macro, "BitBltPS", ppsBitBlt[0],  0)) bLoadSuccess = false;
	if (!LOAD_PS(empty_macro, "BitBltAAPS", ppsBitBlt[1],  0)) bLoadSuccess = false;
	if (!bLoadSuccess) {
		ZZLog::Error_Log("Failed to load BitBltAAPS, using BitBltPS.");
		if (!LOAD_PS(empty_macro, "BitBltPS", ppsBitBlt[1],  0)) bLoadSuccess = false;
	}

	if (!LOAD_PS(empty_macro, "BitBltDepthPS", ppsBitBltDepth,  0)) bLoadSuccess = false;
	if (!LOAD_PS(empty_macro, "CRTCTargPS", ppsCRTCTarg[0],  0)) bLoadSuccess = false;
	if (!LOAD_PS(empty_macro, "CRTCTargInterPS", ppsCRTCTarg[1],  0)) bLoadSuccess = false;

	g_bCRTCBilinear = true;
	if (!LOAD_PS(empty_macro, "CRTCPS", ppsCRTC[0],  0)) bLoadSuccess = false;
	if( !bLoadSuccess ) {
		// switch to simpler
		g_bCRTCBilinear = false;
		if (!LOAD_PS(empty_macro, "CRTCPS_Nearest", ppsCRTC[0],  0)) bLoadSuccess = false;
		if (!LOAD_PS(empty_macro, "CRTCInterPS_Nearest", ppsCRTC[0],  0)) bLoadSuccess = false;
	}
	else {
		if (!LOAD_PS(empty_macro, "CRTCInterPS", ppsCRTC[1],  0)) bLoadSuccess = false;
	}

	if( !bLoadSuccess )
		ZZLog::Error_Log("Failed to create CRTC shaders.");

	// if (!LOAD_PS(empty_macro, "CRTC24PS", ppsCRTC24[0],  0)) bLoadSuccess = false;
	// if (!LOAD_PS(empty_macro, "CRTC24InterPS", ppsCRTC24[1],  0)) bLoadSuccess = false;
	if (!LOAD_PS(empty_macro, "ZeroPS", ppsOne,  0)) bLoadSuccess = false;
	if (!LOAD_PS(empty_macro, "BaseTexturePS", ppsBaseTexture,  0)) bLoadSuccess = false;
	if (!LOAD_PS(empty_macro, "Convert16to32PS", ppsConvert16to32,  0)) bLoadSuccess = false;
	if (!LOAD_PS(empty_macro, "Convert32to16PS", ppsConvert32to16,  0)) bLoadSuccess = false;

	GL_REPORT_ERRORD();
	return true;
}
示例#14
0
bool ZZshLoadExtraEffects() {
	bool bLoadSuccess = true;
	char DefineString[DEFINE_STRING_SIZE] = "";
	const char* writedepth = "#define WRITE_DEPTH 1\n";	// should we write depth field


	const char* pvsshaders[4] = { "RegularVS", "TextureVS", "RegularFogVS", "TextureFogVS" };

	for (int i = 0; i < 4; ++i) {
		if (!LOAD_VS(DefineString, pvsshaders[i], pvsStore[2 * i], cgvProf, 0, "")) bLoadSuccess = false;
		if (!LOAD_VS(DefineString, pvsshaders[i], pvsStore[2 *i + 1 ], cgvProf, 1, "")) bLoadSuccess = false;
		if (!LOAD_VS(DefineString, pvsshaders[i], pvsStore[2 *i + 8 ], cgvProf, 0, writedepth)) bLoadSuccess = false;
		if (!LOAD_VS(DefineString, pvsshaders[i], pvsStore[2 *i + 8 + 1], cgvProf, 1, writedepth)) bLoadSuccess = false;
	}
	for (int i = 0; i < 16; ++i) 
		pvs[i] = pvsStore[i].prog;	

	if (!LOAD_VS(DefineString, "BitBltVS", pvsBitBlt, cgvProf, 0, "")) bLoadSuccess = false;
	GLint p;
	GL_REPORT_ERRORD();

	if (!LOAD_PS(DefineString, "RegularPS", ppsRegular[0], cgfProf, 0, "")) bLoadSuccess = false;
	if (!LOAD_PS(DefineString, "RegularFogPS", ppsRegular[1], cgfProf, 0, "")) bLoadSuccess = false;

	if( conf.mrtdepth ) {
		if (!LOAD_PS(DefineString, "RegularPS", ppsRegular[2], cgfProf, 0, writedepth)) bLoadSuccess = false;
		if (!bLoadSuccess) conf.mrtdepth = 0;
		
		if (!LOAD_PS(DefineString, "RegularFogPS", ppsRegular[3], cgfProf, 0, writedepth)) bLoadSuccess = false;
		if (!bLoadSuccess) conf.mrtdepth = 0;
	}

	if (!LOAD_PS(DefineString, "BitBltPS", ppsBitBlt[0], cgfProf, 0, "")) bLoadSuccess = false;
	if (!LOAD_PS(DefineString, "BitBltAAPS", ppsBitBlt[1], cgfProf, 0, "")) bLoadSuccess = false;
	if (!bLoadSuccess) {
		ZZLog::Error_Log("Failed to load BitBltAAPS, using BitBltPS.");
		if (!LOAD_PS(DefineString, "BitBltPS", ppsBitBlt[1], cgfProf, 0, "")) bLoadSuccess = false;
	}

	if (!LOAD_PS(DefineString, "BitBltDepthPS", ppsBitBltDepth, cgfProf, 0, "")) bLoadSuccess = false;
	if (!LOAD_PS(DefineString, "CRTCTargPS", ppsCRTCTarg[0], cgfProf, 0, "")) bLoadSuccess = false;
	if (!LOAD_PS(DefineString, "CRTCTargInterPS", ppsCRTCTarg[1], cgfProf, 0, "")) bLoadSuccess = false;
	
	g_bCRTCBilinear = true;
	if (!LOAD_PS(DefineString, "CRTCPS", ppsCRTC[0], cgfProf, 0, "")) bLoadSuccess = false;
	if( !bLoadSuccess ) {
		// switch to simpler
		g_bCRTCBilinear = false;
		if (!LOAD_PS(DefineString, "CRTCPS_Nearest", ppsCRTC[0], cgfProf, 0, "")) bLoadSuccess = false;
		if (!LOAD_PS(DefineString, "CRTCInterPS_Nearest", ppsCRTC[0], cgfProf, 0, "")) bLoadSuccess = false;
	}
	else {
		if (!LOAD_PS(DefineString, "CRTCInterPS", ppsCRTC[1], cgfProf, 0, "")) bLoadSuccess = false;
	}

	if( !bLoadSuccess )
		ZZLog::Error_Log("Failed to create CRTC shaders.");
	
	// if (!LOAD_PS(DefineString, "CRTC24PS", ppsCRTC24[0], cgfProf, 0, "")) bLoadSuccess = false;
	// if (!LOAD_PS(DefineString, "CRTC24InterPS", ppsCRTC24[1], cgfProf, 0, "")) bLoadSuccess = false;
	if (!LOAD_PS(DefineString, "ZeroPS", ppsOne, cgfProf, 0, "")) bLoadSuccess = false;
	if (!LOAD_PS(DefineString, "BaseTexturePS", ppsBaseTexture, cgfProf, 0, "")) bLoadSuccess = false;
	if (!LOAD_PS(DefineString, "Convert16to32PS", ppsConvert16to32, cgfProf, 0, "")) bLoadSuccess = false;
	if (!LOAD_PS(DefineString, "Convert32to16PS", ppsConvert32to16, cgfProf, 0, "")) bLoadSuccess = false;

	GL_REPORT_ERRORD();
	return true;
}
示例#15
0
bool ZZshLoadExtraEffects()
{
	const char* args[] = { NULL , NULL, NULL, NULL };
	char context0[255], context1[255];
	sprintf(context0, "-I%sctx0", EFFECT_DIR);
	sprintf(context1, "-I%sctx1", EFFECT_DIR);
	char* write_depth = "-DWRITE_DEPTH";
	bool bLoadSuccess = true;

	const char* pvsshaders[4] = { "RegularVS", "TextureVS", "RegularFogVS", "TextureFogVS" };

	for(int i = 0; i < 4; ++i) {
		args[0] = context0;
		args[1] = NULL;
		LOAD_VS(pvsshaders[i], pvs[2*i], cgvProf);
		args[0] = context1;
		LOAD_VS(pvsshaders[i], pvs[2*i+1], cgvProf);

		//if( conf.mrtdepth ) {
			args[0] = context0;
			args[1] = write_depth;
			LOAD_VS(pvsshaders[i], pvs[2*i+8], cgvProf);
			args[0] = context1;
			LOAD_VS(pvsshaders[i], pvs[2*i+8+1], cgvProf);
//		}
//		else {
//			pvs[2*i+8] = pvs[2*i+8+1] = NULL;
//		}
	}

	args[0] = context0;
	args[1] = NULL;
	LOAD_VS("BitBltVS", pvsBitBlt.prog, cgvProf);
	pvsBitBlt.sBitBltPos = cgGetNamedParameter(pvsBitBlt.prog, "g_fBitBltPos");
	pvsBitBlt.sBitBltTex = cgGetNamedParameter(pvsBitBlt.prog, "g_fBitBltTex");
	pvsBitBlt.fBitBltTrans = cgGetNamedParameter(pvsBitBlt.prog, "g_fBitBltTrans");

	LOAD_PS("RegularPS", ppsRegular[0], cgfProf);
	LOAD_PS("RegularFogPS", ppsRegular[1], cgfProf);

	if( conf.mrtdepth ) {
		args[0] = context0;
		args[1] = write_depth;
		LOAD_PS("RegularPS", ppsRegular[2], cgfProf);
		if( !bLoadSuccess )
			conf.mrtdepth = 0;
		LOAD_PS("RegularFogPS", ppsRegular[3], cgfProf);
		if( !bLoadSuccess )
			conf.mrtdepth = 0;
	}

	LOAD_PS("BitBltPS", ppsBitBlt[0], cgfProf);
	LOAD_PS("BitBltAAPS", ppsBitBlt[1], cgfProf);
	if( !bLoadSuccess ) {
		ZZLog::Error_Log("Failed to load BitBltAAPS, using BitBltPS.");
		LOAD_PS("BitBltPS", ppsBitBlt[1], cgfProf);
	}

	LOAD_PS("BitBltDepthPS", ppsBitBltDepth, cgfProf);
	LOAD_PS("CRTCTargPS", ppsCRTCTarg[0], cgfProf);
	LOAD_PS("CRTCTargInterPS", ppsCRTCTarg[1], cgfProf);

	g_bCRTCBilinear = true;
	LOAD_PS("CRTCPS", ppsCRTC[0], cgfProf);
	if( !bLoadSuccess ) {
		// switch to simpler
		g_bCRTCBilinear = false;
		LOAD_PS("CRTCPS_Nearest", ppsCRTC[0], cgfProf);
		LOAD_PS("CRTCInterPS_Nearest", ppsCRTC[0], cgfProf);
	}
	else {
		LOAD_PS("CRTCInterPS", ppsCRTC[1], cgfProf);
	}

	if( !bLoadSuccess )
		ZZLog::Error_Log("Failed to create CRTC shaders.");

//	LOAD_PS("CRTC24PS", ppsCRTC24[0], cgfProf); LOAD_PS("CRTC24InterPS", ppsCRTC24[1], cgfProf);
	LOAD_PS("ZeroPS", ppsOne, cgfProf);
	LOAD_PS("BaseTexturePS", ppsBaseTexture, cgfProf);
	LOAD_PS("Convert16to32PS", ppsConvert16to32, cgfProf);
	LOAD_PS("Convert32to16PS", ppsConvert32to16, cgfProf);

//	if( !conf.mrtdepth ) {
//		ZZLog::Error_Log("Disabling MRT depth writing,");
//		s_bWriteDepth = FALSE;
//	}

	return true;
}
示例#16
0
// called
bool ZZshLoadExtraEffects()
{
	SHADERHEADER* header;
	bool bLoadSuccess = true;

	const int vsshaders[4] = { SH_REGULARVS, SH_TEXTUREVS, SH_REGULARFOGVS, SH_TEXTUREFOGVS };

	for(int i = 0; i < 4; ++i) {
		LOAD_VS(vsshaders[i], pvs[2*i]);
		LOAD_VS((vsshaders[i] | SH_CONTEXT1), pvs[2*i+1]);
		//if( conf.mrtdepth ) {
			LOAD_VS((vsshaders[i] | SH_WRITEDEPTH), pvs[2*i+8]);
			LOAD_VS((vsshaders[i] | SH_WRITEDEPTH | SH_CONTEXT1), pvs[2*i+8+1]);
//		}
//		else {
//			pvs[2*i+8] = pvs[2*i+8+1] = NULL;
//		}
	}

	LOAD_VS(SH_BITBLTVS, pvsBitBlt.prog);
	pvsBitBlt.sBitBltPos = cgGetNamedParameter(pvsBitBlt.prog, "g_fBitBltPos");
	pvsBitBlt.sBitBltTex = cgGetNamedParameter(pvsBitBlt.prog, "g_fBitBltTex");
	pvsBitBlt.fBitBltTrans = cgGetNamedParameter(pvsBitBlt.prog, "g_fBitBltTrans");

	LOAD_PS(SH_REGULARPS, ppsRegular[0]);
	LOAD_PS(SH_REGULARFOGPS, ppsRegular[1]);

	if( conf.mrtdepth ) {
		LOAD_PS(SH_REGULARPS, ppsRegular[2]);
		if( !bLoadSuccess )
			conf.mrtdepth = 0;
		LOAD_PS(SH_REGULARFOGPS, ppsRegular[3]);
		if( !bLoadSuccess )
			conf.mrtdepth = 0;
	}

	LOAD_PS(SH_BITBLTPS, ppsBitBlt[0]);
	LOAD_PS(SH_BITBLTAAPS, ppsBitBlt[1]);
	if( !bLoadSuccess ) {
		ZZLog::Error_Log("Failed to load BitBltAAPS, using BitBltPS.");
		LOAD_PS(SH_BITBLTPS, ppsBitBlt[1]);
	}
	LOAD_PS(SH_BITBLTDEPTHPS, ppsBitBltDepth);
	LOAD_PS(SH_CRTCTARGPS, ppsCRTCTarg[0]);
	LOAD_PS(SH_CRTCTARGINTERPS, ppsCRTCTarg[1]);

	g_bCRTCBilinear = true;
	LOAD_PS(SH_CRTCPS, ppsCRTC[0]);
	if( !bLoadSuccess ) {
		// switch to simpler
		g_bCRTCBilinear = false;
		LOAD_PS(SH_CRTC_NEARESTPS, ppsCRTC[0]);
		LOAD_PS(SH_CRTCINTER_NEARESTPS, ppsCRTC[0]);
	}
	else {
		LOAD_PS(SH_CRTCINTERPS, ppsCRTC[1]);
	}

	if( !bLoadSuccess )
		ZZLog::Error_Log("Failed to create CRTC shaders.");

//	LOAD_PS(SH_CRTC24PS, ppsCRTC24[0]);
//	LOAD_PS(SH_CRTC24INTERPS, ppsCRTC24[1]);
	LOAD_PS(SH_ZEROPS, ppsOne);
	LOAD_PS(SH_BASETEXTUREPS, ppsBaseTexture);
	LOAD_PS(SH_CONVERT16TO32PS, ppsConvert16to32);
	LOAD_PS(SH_CONVERT32TO16PS, ppsConvert32to16);

	return true;
}