コード例 #1
0
ファイル: GSTextureFXOGL.cpp プロジェクト: clbr/gsdxsdl
void GSDeviceOGL::CreateTextureFX()
{
	m_vs_cb = new GSUniformBufferOGL(g_vs_cb_index, sizeof(VSConstantBuffer));
	m_ps_cb = new GSUniformBufferOGL(g_ps_cb_index, sizeof(PSConstantBuffer));

	// warning 1 sampler by image unit. So you cannot reuse m_ps_ss...
	m_palette_ss = CreateSampler(false, false, false);
	glBindSampler(1, m_palette_ss);

	// Pre compile all Geometry & Vertex Shader
	// It might cost a seconds at startup but it would reduce benchmark pollution
	GL_PUSH("Compile GS");

	for (uint32 key = 0; key < countof(m_gs); key++) {
		GSSelector sel(key);
		if (sel.point == sel.sprite)
			m_gs[key] = 0;
		else
			m_gs[key] = CompileGS(GSSelector(key));
	}

	GL_POP();

	GL_PUSH("Compile VS");

	for (uint32 key = 0; key < countof(m_vs); key++) {
		// wildhack is only useful if both TME and FST are enabled.
		VSSelector sel(key);
		if (sel.wildhack && (!sel.tme || !sel.fst))
			m_vs[key] = 0;
		else
			m_vs[key] = CompileVS(sel, !GLLoader::found_GL_ARB_clip_control);
	}

	GL_POP();

	// Enable all bits for stencil operations. Technically 1 bit is
	// enough but buffer is polluted with noise. Clear will be limited
	// to the mask.
	glStencilMask(0xFF);
	for (uint32 key = 0; key < countof(m_om_dss); key++) {
		m_om_dss[key] = CreateDepthStencil(OMDepthStencilSelector(key));
	}

	// Help to debug FS in apitrace
	m_apitrace = CompilePS(PSSelector());
}
コード例 #2
0
ファイル: GSTextureFXOGL.cpp プロジェクト: mbishop0051/pcsx2
void GSDeviceOGL::CreateTextureFX()
{
	GL_PUSH("CreateTextureFX");

	m_vs_cb = new GSUniformBufferOGL(g_vs_cb_index, sizeof(VSConstantBuffer));
	m_ps_cb = new GSUniformBufferOGL(g_ps_cb_index, sizeof(PSConstantBuffer));

	// warning 1 sampler by image unit. So you cannot reuse m_ps_ss...
	m_palette_ss = CreateSampler(false, false, false);
	gl_BindSampler(1, m_palette_ss);

	// Pre compile all Geometry & Vertex Shader
	// It might cost a seconds at startup but it would reduce benchmark pollution
	m_gs = CompileGS();

	int logz = theApp.GetConfig("logz", 1);
	// Don't do it in debug build, so it can still be tested
#ifndef _DEBUG
	if (GLLoader::found_GL_ARB_clip_control && logz) {
		fprintf(stderr, "Your driver supports advance depth. Logz will be disabled\n");
		logz = 0;
	} else if (!GLLoader::found_GL_ARB_clip_control && !logz) {
		fprintf(stderr, "Your driver DOESN'T support advance depth (GL_ARB_clip_control)\n It is higly recommmended to enable logz\n");
	}
#endif
	for (uint32 key = 0; key < VSSelector::size(); key++) {
		// wildhack is only useful if both TME and FST are enabled.
		VSSelector sel(key);
		if (sel.wildhack && (!sel.tme || !sel.fst))
			m_vs[key] = 0;
		else
			m_vs[key] = CompileVS(sel, logz);
	}

	// Enable all bits for stencil operations. Technically 1 bit is
	// enough but buffer is polluted with noise. Clear will be limited
	// to the mask.
	glStencilMask(0xFF);
	for (uint32 key = 0; key < OMDepthStencilSelector::size(); key++)
		m_om_dss[key] = CreateDepthStencil(OMDepthStencilSelector(key));

	// Help to debug FS in apitrace
	m_apitrace = CompilePS(PSSelector());

	GL_POP();
}
コード例 #3
0
ファイル: GSTextureFXOGL.cpp プロジェクト: jimmyleith/pcsx2
void GSDeviceOGL::CreateTextureFX()
{
    m_vs_cb = new GSUniformBufferOGL(g_vs_cb_index, sizeof(VSConstantBuffer));
    m_ps_cb = new GSUniformBufferOGL(g_ps_cb_index, sizeof(PSConstantBuffer));

    // warning 1 sampler by image unit. So you cannot reuse m_ps_ss...
    m_palette_ss = CreateSampler(false, false, false);
    gl_BindSampler(1, m_palette_ss);

    GSInputLayoutOGL vert_format[] =
    {
        {0 , 2 , GL_FLOAT          , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(0) }  ,
        {1 , 4 , GL_UNSIGNED_BYTE  , GL_TRUE  , sizeof(GSVertex) , (const GLvoid*)(8) }  ,
        {2 , 1 , GL_FLOAT          , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(12) } ,
        {3 , 2 , GL_UNSIGNED_SHORT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(16) } ,
        {4 , 1 , GL_UNSIGNED_INT   , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(20) } ,
        {5 , 2 , GL_UNSIGNED_SHORT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(24) } ,
        {6 , 4 , GL_UNSIGNED_BYTE  , GL_TRUE  , sizeof(GSVertex) , (const GLvoid*)(28) } ,
    };
    m_vb = new GSVertexBufferStateOGL(sizeof(GSVertex), vert_format, countof(vert_format));

    // Pre compile all Geometry & Vertex Shader
    // It might cost a seconds at startup but it would reduce benchmark pollution
    m_gs = CompileGS();

    for (uint32 key = 0; key < VSSelector::size(); key++)
        m_vs[key] = CompileVS(VSSelector(key));

    for (uint32 key = 0; key < OMDepthStencilSelector::size(); key++)
        m_om_dss[key] = CreateDepthStencil(OMDepthStencilSelector(key));

    // Help to debug FS in apitrace
    m_apitrace = CompilePS(PSSelector());

    // VS gl_position.z => [-1,-1]
    // FS depth => [0, 1]
    // because of -1 we loose lot of precision for small GS value
    // This extension allow FS depth to range from -1 to 1. So
    // gl_position.z could range from [0, 1]
    if (GLLoader::found_GL_NV_depth_buffer_float) {
        gl_DepthRangedNV(-1.0f, 1.0f);
    }
}
コード例 #4
0
ファイル: GSTextureFXOGL.cpp プロジェクト: tsiru/pcsx2
void GSDeviceOGL::CreateTextureFX()
{
	m_vs_cb = new GSUniformBufferOGL(g_vs_cb_index, sizeof(VSConstantBuffer));
	m_ps_cb = new GSUniformBufferOGL(g_ps_cb_index, sizeof(PSConstantBuffer));

	// warning 1 sampler by image unit. So you cannot reuse m_ps_ss...
	m_palette_ss = CreateSampler(false, false, false);
	gl_BindSampler(1, m_palette_ss);

	GSInputLayoutOGL vert_format[] =
	{
		{0 , 2 , GL_FLOAT          , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(0) }  ,
		{1 , 4 , GL_UNSIGNED_BYTE  , GL_TRUE  , sizeof(GSVertex) , (const GLvoid*)(8) }  ,
		{2 , 1 , GL_FLOAT          , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(12) } ,
		{3 , 2 , GL_UNSIGNED_SHORT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(16) } ,
		{4 , 1 , GL_UNSIGNED_INT   , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(20) } ,
		{5 , 2 , GL_UNSIGNED_SHORT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(24) } ,
		{6 , 4 , GL_UNSIGNED_BYTE  , GL_TRUE  , sizeof(GSVertex) , (const GLvoid*)(28) } ,
	};
	m_vb = new GSVertexBufferStateOGL(sizeof(GSVertex), vert_format, countof(vert_format));

	// Pre compile all Geometry & Vertex Shader
	// It might cost a seconds at startup but it would reduce benchmark pollution
	m_gs = CompileGS();

	for (uint32 key = 0; key < VSSelector::size(); key++)
		m_vs[key] = CompileVS(VSSelector(key));

	for (uint32 key = 0; key < OMDepthStencilSelector::size(); key++)
		m_om_dss[key] = CreateDepthStencil(OMDepthStencilSelector(key));

	// Help to debug FS in apitrace
	m_apitrace = CompilePS(PSSelector());

	if (!!theApp.GetConfig("GL_NV_Depth", 0)) {
		gl_DepthRangedNV(-1.0f, 1.0f);
	}
}