Esempio n. 1
0
	//レンダリングターゲットを開始する
	void DefaultRenderTarget::StartRenderTarget(){
		auto Dev = App::GetApp()->GetDeviceResources();
		auto pD3D11Device = Dev->GetD3DDevice();
		auto pD3D11DeviceContext = Dev->GetD3DDeviceContext();

		ID3D11RenderTargetView* pV = pImpl->m_D3D11RenderTargetView.Get();
		//レンダリングターゲットとステンシルを設定
		pD3D11DeviceContext->OMSetRenderTargets(1, &pV, pImpl->m_DepthStencilView.Get());
		//ビューポートの設定
		if (pImpl->m_Stage.expired()){
			throw BaseException(
				L"ステージが無効です",
				L"if (pImpl->m_Stage.expired())",
				L"DefaultRenderTarget::StartRenderTarget()"
				);
		}
		auto StagePtr = pImpl->m_Stage.lock();

		pD3D11DeviceContext->RSSetViewports(1, StagePtr->GetTargetViewPortRealPtr());

		//シェーダーリソースビューのクリア
		ID3D11ShaderResourceView* pNull[1] = { nullptr };
		pD3D11DeviceContext->PSSetShaderResources(0, _countof(pNull), pNull);
		pD3D11DeviceContext->PSSetShaderResources(1, _countof(pNull), pNull);
		//シェーダーは指定しない
		pD3D11DeviceContext->VSSetShader(nullptr, nullptr, 0);
		pD3D11DeviceContext->PSSetShader(nullptr, nullptr, 0);
		pD3D11DeviceContext->GSSetShader(nullptr, nullptr, 0);
		//ブレンドは指定しない
		pD3D11DeviceContext->OMSetBlendState(nullptr, nullptr, 0xffffffff);

	}
Esempio n. 2
0
void GSDevice10::StretchRect(Texture& st, const GSVector4& sr, Texture& dt, const GSVector4& dr, ID3D10PixelShader* ps, ID3D10Buffer* ps_cb, ID3D10BlendState* bs, bool linear)
{
	BeginScene();

	// om

	OMSetDepthStencilState(m_convert.dss, 0);
	OMSetBlendState(bs, 0);
	OMSetRenderTargets(dt, NULL);

	// ia

	float left = dr.x * 2 / dt.GetWidth() - 1.0f;
	float top = 1.0f - dr.y * 2 / dt.GetHeight();
	float right = dr.z * 2 / dt.GetWidth() - 1.0f;
	float bottom = 1.0f - dr.w * 2 / dt.GetHeight();

	GSVertexPT1 vertices[] =
	{
		{GSVector4(left, top, 0.5f, 1.0f), GSVector2(sr.x, sr.y)},
		{GSVector4(right, top, 0.5f, 1.0f), GSVector2(sr.z, sr.y)},
		{GSVector4(left, bottom, 0.5f, 1.0f), GSVector2(sr.x, sr.w)},
		{GSVector4(right, bottom, 0.5f, 1.0f), GSVector2(sr.z, sr.w)},
	};

	D3D10_BOX box = {0, 0, 0, sizeof(vertices), 1, 1};

	m_dev->UpdateSubresource(m_convert.vb, 0, &box, vertices, 0, 0);

	IASetVertexBuffer(m_convert.vb, sizeof(vertices[0]));
	IASetInputLayout(m_convert.il);
	IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);

	// vs

	VSSetShader(m_convert.vs, NULL);

	// gs

	GSSetShader(NULL);

	// ps

	PSSetShader(ps, ps_cb);
	PSSetSamplerState(linear ? m_convert.ln : m_convert.pt, NULL);
	PSSetShaderResources(st, NULL);

	// rs

	RSSet(dt.GetWidth(), dt.GetHeight());

	//

	DrawPrimitive(countof(vertices));

	//

	EndScene();
}
Esempio n. 3
0
void SkeletalMeshRenderer::render()
{
	//should have an update check and recall set if updated.
	if(drawBuffers_.size() > 0 && isRendering())
	{
		auto context = Sly::display->getContext();
		auto display = Sly::display;

		const unsigned int stride = sizeof(MeshVertex);
		const unsigned int offset = 0;

		context->IASetInputLayout(inputLayout_);
		context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);	

		display->setRasterizerState(rasterizerState_);
		display->setSamplerStates(samplerStates_);
		display->setBlendState(blendState_);
		display->setDepthStencilState(depthStencilState_);

		context->VSSetShader(vertexShader_, nullptr, 0);
		context->HSSetShader(hullShader_, nullptr, 0);
		context->DSSetShader(domainShader_, nullptr, 0);
		context->GSSetShader(geometryShader_, nullptr, 0);
		context->PSSetShader(pixelShader_, nullptr, 0);

		const auto meshTransform = (transform_) ? XMLoadFloat4x4(transform_) : XMMatrixIdentity();	//Default to identity if null (same for subMeshTransform)

		for(auto b = drawBuffers_.begin(); b != drawBuffers_.end(); ++b)
		{
			const auto subMeshTransform = ((*b)->transform) ? XMLoadFloat4x4((*b)->transform) : XMMatrixIdentity(); 
			const auto transform = meshTransform * subMeshTransform;
			auto materialBuffer = display->getConstantBuffer("material");
			auto worldBuffer = display->getConstantBuffer("world");

			MaterialCB materialCB = { (*b)->material->diffuse, (*b)->material->specular };
			materialBuffer->update(context, &materialCB , sizeof(MaterialCB));
		
			WorldCB worldCB;
			XMStoreFloat4x4(&worldCB.world, transform);
			worldBuffer->update(context, &worldCB, sizeof(WorldCB));

			context->VSSetConstantBuffers(0, 1, &worldBuffer->buffer);
			context->PSSetConstantBuffers(3, 1, &materialBuffer->buffer);

			context->VSSetConstantBuffers(0, 1, &worldBuffer->buffer);
			context->PSSetConstantBuffers(3, 1, &materialBuffer->buffer);

			ID3D11ShaderResourceView* srvs[4] = { (*b)->material->diffuseMap, (*b)->material->normalMap, (*b)->material->specularMap, (*b)->material->environmentMap};
			context->PSSetShaderResources(0, 4, srvs);

			context->IASetVertexBuffers(0, 1, &(*b)->vertexBuffer, &stride, &offset );	//maybe able to group these together 
			context->IASetIndexBuffer((*b)->indexBuffer, DXGI_FORMAT_R32_UINT, 0);
			context->DrawIndexed((*b)->drawCount, 0, 0);		
		}
	}
}
Esempio n. 4
0
void GSDevice11::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, ID3D11BlendState* bs, bool linear)
{
	BeginScene();

	GSVector2i ds = dt->GetSize();

	// om

	OMSetDepthStencilState(m_convert.dss, 0);
	OMSetBlendState(bs, 0);
	OMSetRenderTargets(dt, NULL);

	// ia

	float left = dr.x * 2 / ds.x - 1.0f;
	float top = 1.0f - dr.y * 2 / ds.y;
	float right = dr.z * 2 / ds.x - 1.0f;
	float bottom = 1.0f - dr.w * 2 / ds.y;

	GSVertexPT1 vertices[] =
	{
		{GSVector4(left, top, 0.5f, 1.0f), GSVector2(sr.x, sr.y)},
		{GSVector4(right, top, 0.5f, 1.0f), GSVector2(sr.z, sr.y)},
		{GSVector4(left, bottom, 0.5f, 1.0f), GSVector2(sr.x, sr.w)},
		{GSVector4(right, bottom, 0.5f, 1.0f), GSVector2(sr.z, sr.w)},
	};

	IASetVertexBuffer(vertices, sizeof(vertices[0]), countof(vertices));
	IASetInputLayout(m_convert.il);
	IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);

	// vs

	VSSetShader(m_convert.vs, NULL);

	// gs

	GSSetShader(NULL);

	// ps

	PSSetShaderResources(st, NULL);
	PSSetSamplerState(linear ? m_convert.ln : m_convert.pt, NULL);
	PSSetShader(ps, ps_cb);

	//

	DrawPrimitive();

	//

	EndScene();

	PSSetShaderResources(NULL, NULL);
}
Esempio n. 5
0
void GSDevice11::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1 (&iaVertices)[4], bool datm)
{
	const GSVector2i& size = rt->GetSize();

	if(GSTexture* t = CreateRenderTarget(size.x, size.y, rt->IsMSAA()))
	{
		// sfex3 (after the capcom logo), vf4 (first menu fading in), ffxii shadows, rumble roses shadows, persona4 shadows

		BeginScene();

		ClearStencil(ds, 0);

		// om

		OMSetDepthStencilState(m_date.dss, 1);
		OMSetBlendState(m_date.bs, 0);
		OMSetRenderTargets(t, ds);

		// ia

		IASetVertexBuffer(iaVertices, sizeof(iaVertices[0]), countof(iaVertices));
		IASetInputLayout(m_convert.il);
		IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);

		// vs

		VSSetShader(m_convert.vs, NULL);

		// gs

		GSSetShader(NULL);

		// ps

		GSTexture* rt2 = rt->IsMSAA() ? Resolve(rt) : rt;

		PSSetShaderResources(rt2, NULL);
		PSSetSamplerState(m_convert.pt, NULL);
		PSSetShader(m_convert.ps[datm ? 2 : 3], NULL);

		//

		DrawPrimitive();

		//

		EndScene();

		Recycle(t);

		if(rt2 != rt) Recycle(rt2);
	}
}
Esempio n. 6
0
	//レンダリングターゲットを終了する
	void DefaultRenderTarget::EndRenderTarget(){
		auto Dev = App::GetApp()->GetDeviceResources();
		auto pD3D11Device = Dev->GetD3DDevice();
		auto pD3D11DeviceContext = Dev->GetD3DDeviceContext();
		//ステータスのポインタ
		//auto RenderStatePtr = App::GetApp()->GetRenderState();
		//シェーダーリソースビューのクリア
		ID3D11ShaderResourceView* pNull[1] = { nullptr };
		pD3D11DeviceContext->PSSetShaderResources(0, _countof(pNull), pNull);
		pD3D11DeviceContext->PSSetShaderResources(1, _countof(pNull), pNull);
		//シェーダーは指定しない
		pD3D11DeviceContext->VSSetShader(nullptr, nullptr, 0);
		pD3D11DeviceContext->PSSetShader(nullptr, nullptr, 0);
		pD3D11DeviceContext->GSSetShader(nullptr, nullptr, 0);
		//ブレンドは指定しない
		pD3D11DeviceContext->OMSetBlendState(nullptr, nullptr, 0xffffffff);
	}
Esempio n. 7
0
	//レンダリングターゲットを終了する
	void ShadowMapRenderTarget::EndRenderTarget(){
		//デバイスとコンテキストインターフェイスの取得
		auto Dev = App::GetApp()->GetDeviceResources();
		auto pD3D11Device = Dev->GetD3DDevice();
		auto pD3D11DeviceContext = Dev->GetD3DDeviceContext();
		//レンダリングターゲットは深度ステンシルビューのみ指定
		ID3D11RenderTargetView* pnullView = nullptr;
		pD3D11DeviceContext->OMSetRenderTargets(1, &pnullView, nullptr);
		//ビューポートの設定
		pD3D11DeviceContext->RSSetViewports(1, &pImpl->m_ViewPort);
		//ラスタライザステートの設定(設定解除)
		pD3D11DeviceContext->RSSetState(nullptr);
		//シェーダーは指定しない
		//頂点シェーダの設定(ここでは指定しない)
		pD3D11DeviceContext->VSSetShader(nullptr, nullptr, 0);
		//ピクセルシェーダの設定(使用しない)
		pD3D11DeviceContext->PSSetShader(nullptr, nullptr, 0);
		//ジオメトリシェーダの設定(使用しない)
		pD3D11DeviceContext->GSSetShader(nullptr, nullptr, 0);
	}
Esempio n. 8
0
	void overlay::render()
	{
		uint32_t stride = sizeof(overlay::vertex_t);
		uint32_t offset = 0;

		auto context = d3d_device::instance()->get_context();

		context->IASetVertexBuffers(0, 1, vertex_buffer.GetAddressOf(), &stride, &offset);
		context->IASetIndexBuffer(index_buffer.Get(), DXGI_FORMAT_R32_UINT, 0);
		context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
		context->IASetInputLayout(input_layout.Get());

		context->VSSetConstantBuffers(0, 1, const_buffer.GetAddressOf());
		context->VSSetShader(vertex_shader.Get(), nullptr, 0);

		context->PSSetShaderResources(0, 1, frame.GetAddressOf());
		context->PSSetShader(pixel_shader.Get(), nullptr, 0);
		context->PSSetSamplers(0, 1, sampler_state.GetAddressOf());

		context->DrawIndexed(vertex_count, 0, 0);
	}
Esempio n. 9
0
    virtual void render() override
    {
        auto imc = mRenderer->getImmediateContext();
        auto vs = std::dynamic_pointer_cast<TB::DirectXShader>(mVertexShader);
        auto ps = std::dynamic_pointer_cast<TB::DirectXShader>(mPixelShader);
        auto tex = std::dynamic_pointer_cast<TB::DirectXTexture>(mTexture);

        ID3D11Buffer* constants[] = { mViewConstants, nullptr, mWorldConstants };
        ID3D11ShaderResourceView* srvs[] =  { *tex };
        ID3D11SamplerState* samplers[] = { TB::DirectXSamplerState::get() };

        imc->RSSetState(TB::DirectXRasterizerState::get());
        imc->VSSetConstantBuffers(0, 3, constants);
        imc->VSSetShader(*vs, nullptr, 0);
        imc->PSSetConstantBuffers(0, 3, constants);
        imc->PSSetShader(*ps, nullptr, 0);
        imc->PSSetShaderResources(0, 1, srvs);
        imc->PSSetSamplers(0, 1, samplers);

        mRenderer->clear(mRenderer->getBackBufferRTV(), math::float4(0.0f, 0.0f, 0.0f, 0.0f));
        mRenderer->clear(mRenderer->getBackBufferDSV());
        mScene->render();
    }
Esempio n. 10
0
	void GameObject::Draw(){
		//ゲームステージが無効ならリターン
		if (m_GameStgae.expired()){
			return;
		}
		//デバイスの取得
		auto Dev = App::GetApp()->GetDeviceResources();
		auto pDx11Device = Dev->GetD3DDevice();
		auto pID3D11DeviceContext = Dev->GetD3DDeviceContext();
		//ステータスのポインタ
		auto RenderStatePtr = Dev->GetRenderState();
		auto Stage = m_GameStgae.lock();
		auto ViewPtr = Stage->GetView();
		//ビューからカメラを取り出す
		auto PtrCamera = ViewPtr->GetCamera();
		//カメラの取得
		Matrix4X4 View, Proj;
		View = PtrCamera->GetViewMatrix();
		Proj = PtrCamera->GetProjMatrix();

		//コンスタントバッファの設定
		Texture3DConstantBuffer cb1;
		//行列の設定(転置する)
		cb1.Model = Matrix4X4EX::Transpose(m_WorldMatrix);
		cb1.View = Matrix4X4EX::Transpose(View);
		cb1.Projection = Matrix4X4EX::Transpose(Proj);
		//ライトの設定
		//ステージから0番目のライトを取り出す
		auto PtrLight = ViewPtr->GetMultiLight()->GetLight(0);
		cb1.LightDir = PtrLight->GetDirectional();
		cb1.LightDir.w = 1.0f;

		//コンスタントバッファの更新
		pID3D11DeviceContext->UpdateSubresource(CBTexture3D::GetPtr()->GetBuffer(), 0, nullptr, &cb1, 0, 0);
		//ストライドとオフセット
		UINT stride = sizeof(VertexPositionNormalTexture);
		UINT offset = 0;
		//頂点バッファの設定
		pID3D11DeviceContext->IASetVertexBuffers(0, 1, m_VertexBuffer.GetAddressOf(), &stride, &offset);
		//インデックスバッファのセット
		pID3D11DeviceContext->IASetIndexBuffer(m_IndexBuffer.Get(), DXGI_FORMAT_R16_UINT, 0);
		//描画方法(3角形)
		pID3D11DeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
		//透明処理
		pID3D11DeviceContext->OMSetBlendState(RenderStatePtr->GetAlphaBlendEx(), nullptr, 0xffffffff);
		//デプスステンシルは使用する
		pID3D11DeviceContext->OMSetDepthStencilState(RenderStatePtr->GetDepthDefault(), 0);
		//シェーダの設定
		pID3D11DeviceContext->VSSetShader(VSTexture3D::GetPtr()->GetShader(), nullptr, 0);
		pID3D11DeviceContext->PSSetShader(PSTexture3D::GetPtr()->GetShader(), nullptr, 0);
		//リニアサンプラーを設定
		ID3D11SamplerState* samplerState = RenderStatePtr->GetLinearClamp();
		pID3D11DeviceContext->PSSetSamplers(0, 1, &samplerState);
		for (auto& m : m_Materials){
			//テクスチャを設定
			pID3D11DeviceContext->PSSetShaderResources(0, 1, m.m_ShaderResView.GetAddressOf());
			//インプットレイアウトの設定
			pID3D11DeviceContext->IASetInputLayout(VSTexture3D::GetPtr()->GetInputLayout());
			//コンスタントバッファの設定
			ID3D11Buffer* pConstantBuffer = CBTexture3D::GetPtr()->GetBuffer();
			pID3D11DeviceContext->VSSetConstantBuffers(0, 1, &pConstantBuffer);
			pID3D11DeviceContext->PSSetConstantBuffers(0, 1, &pConstantBuffer);
			//レンダリングステート
			pID3D11DeviceContext->RSSetState(RenderStatePtr->GetCullFront());
			//描画
			pID3D11DeviceContext->DrawIndexed(m.m_IndexCount, m.m_StartIndex, 0);
			//レンダリングステート
			pID3D11DeviceContext->RSSetState(RenderStatePtr->GetCullBack());
			//描画
			pID3D11DeviceContext->DrawIndexed(m.m_IndexCount, m.m_StartIndex,0);
		}
		//後始末
		Dev->InitializeStates(RenderStatePtr);
	}
Esempio n. 11
0
void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, ID3D11BlendState* bs, bool linear)
{
	if(!sTex || !dTex)
	{
		ASSERT(0);
		return;
	}

	BeginScene();

	GSVector2i ds = dTex->GetSize();

	// om

	OMSetDepthStencilState(m_convert.dss, 0);
	OMSetBlendState(bs, 0);
	OMSetRenderTargets(dTex, NULL);

	// ia

	float left = dRect.x * 2 / ds.x - 1.0f;
	float top = 1.0f - dRect.y * 2 / ds.y;
	float right = dRect.z * 2 / ds.x - 1.0f;
	float bottom = 1.0f - dRect.w * 2 / ds.y;

	GSVertexPT1 vertices[] =
	{
		{GSVector4(left, top, 0.5f, 1.0f), GSVector2(sRect.x, sRect.y)},
		{GSVector4(right, top, 0.5f, 1.0f), GSVector2(sRect.z, sRect.y)},
		{GSVector4(left, bottom, 0.5f, 1.0f), GSVector2(sRect.x, sRect.w)},
		{GSVector4(right, bottom, 0.5f, 1.0f), GSVector2(sRect.z, sRect.w)},
	};



	IASetVertexBuffer(vertices, sizeof(vertices[0]), countof(vertices));
	IASetInputLayout(m_convert.il);
	IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);

	// vs

	VSSetShader(m_convert.vs, NULL);


	// gs
	/* NVIDIA HACK!!!!
	Not sure why, but having the Geometry shader disabled causes the strange stretching in recent drivers*/

	GSSelector sel;
	//Don't use shading for stretching, we're just passing through - Note: With Win10 it seems to cause other bugs when shading is off if any of the coords is greater than 0
	//I really don't know whats going on there, but this seems to resolve it mostly (if not all, not tester a lot of games, only BIOS, FFXII and VP2)
	//sel.iip = (sRect.y > 0.0f || sRect.w > 0.0f) ? 1 : 0; 
	//sel.prim = 2; //Triangle Strip
	//SetupGS(sel);

	GSSetShader(NULL, NULL);

	/*END OF HACK*/
	
	//

	// ps

	PSSetShaderResources(sTex, NULL);
	PSSetSamplerState(linear ? m_convert.ln : m_convert.pt, NULL);
	PSSetShader(ps, ps_cb);

	//

	DrawPrimitive();

	//

	EndScene();

	PSSetShaderResources(NULL, NULL);
}
Esempio n. 12
0
void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSelector ssel)
{
    hash_map<uint32, CComPtr<ID3D11PixelShader> >::const_iterator i = m_ps.find(sel);

    if(i == m_ps.end())
    {
        string str[21];

        str[0] = format("%d", sel.fst);
        str[1] = format("%d", sel.wms);
        str[2] = format("%d", sel.wmt);
        str[3] = format("%d", sel.fmt);
        str[4] = format("%d", sel.aem);
        str[5] = format("%d", sel.tfx);
        str[6] = format("%d", sel.tcc);
        str[7] = format("%d", sel.atst);
        str[8] = format("%d", sel.fog);
        str[9] = format("%d", sel.clr1);
        str[10] = format("%d", sel.fba);
        str[11] = format("%d", sel.aout);
        str[12] = format("%d", sel.ltf);
        str[13] = format("%d", sel.colclip);
        str[14] = format("%d", sel.date);
        str[15] = format("%d", sel.spritehack);
        str[16] = format("%d", sel.tcoffsethack);
        str[17] = format("%d", sel.point_sampler);
        str[18] = format("%d", sel.shuffle);
        str[19] = format("%d", sel.read_ba);
        str[20] = format("%d", sel.p4_ultrahack);

        D3D11_SHADER_MACRO macro[] =
        {
            {"PS_FST", str[0].c_str()},
            {"PS_WMS", str[1].c_str()},
            {"PS_WMT", str[2].c_str()},
            {"PS_FMT", str[3].c_str()},
            {"PS_AEM", str[4].c_str()},
            {"PS_TFX", str[5].c_str()},
            {"PS_TCC", str[6].c_str()},
            {"PS_ATST", str[7].c_str()},
            {"PS_FOG", str[8].c_str()},
            {"PS_CLR1", str[9].c_str()},
            {"PS_FBA", str[10].c_str()},
            {"PS_AOUT", str[11].c_str()},
            {"PS_LTF", str[12].c_str()},
            {"PS_COLCLIP", str[13].c_str()},
            {"PS_DATE", str[14].c_str()},
            {"PS_SPRITEHACK", str[15].c_str()},
            {"PS_TCOFFSETHACK", str[16].c_str()},
            {"PS_POINT_SAMPLER", str[17].c_str()},
            {"PS_SHUFFLE", str[18].c_str()},
            {"PS_READ_BA", str[19].c_str()},
            {"PS_P4_ULTRAHACK", str[20].c_str()},
            {NULL, NULL},
        };

        CComPtr<ID3D11PixelShader> ps;

        CompileShader(IDR_TFX_FX, "ps_main", macro, &ps);

        m_ps[sel] = ps;

        i = m_ps.find(sel);
    }

    if(m_ps_cb_cache.Update(cb))
    {
        ID3D11DeviceContext* ctx = m_ctx;

        ctx->UpdateSubresource(m_ps_cb, 0, NULL, cb, 0, 0);
    }

    CComPtr<ID3D11SamplerState> ss0, ss1;

    if(sel.tfx != 4)
    {
        if(!(sel.fmt < 3 && sel.wms < 3 && sel.wmt < 3))
        {
            ssel.ltf = 0;
        }

        hash_map<uint32, CComPtr<ID3D11SamplerState> >::const_iterator i = m_ps_ss.find(ssel);

        if(i != m_ps_ss.end())
        {
            ss0 = i->second;
        }
        else
        {
            D3D11_SAMPLER_DESC sd, af;

            memset(&sd, 0, sizeof(sd));

            af.Filter = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
            sd.Filter = ssel.ltf ? af.Filter : D3D11_FILTER_MIN_MAG_MIP_POINT;

            sd.AddressU = ssel.tau ? D3D11_TEXTURE_ADDRESS_WRAP : D3D11_TEXTURE_ADDRESS_CLAMP;
            sd.AddressV = ssel.tav ? D3D11_TEXTURE_ADDRESS_WRAP : D3D11_TEXTURE_ADDRESS_CLAMP;
            sd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
            sd.MinLOD = -FLT_MAX;
            sd.MaxLOD = FLT_MAX;
            sd.MaxAnisotropy = theApp.GetConfig("MaxAnisotropy", 0);
            sd.ComparisonFunc = D3D11_COMPARISON_NEVER;

            m_dev->CreateSamplerState(&sd, &ss0);

            m_ps_ss[ssel] = ss0;
        }

        if(sel.fmt >= 3)
        {
            ss1 = m_palette_ss;
        }
    }

    PSSetSamplerState(ss0, ss1, sel.date ? m_rt_ss : NULL);

    PSSetShader(i->second, m_ps_cb);
}
Esempio n. 13
0
	void CustomDrawBox::Draw(){
		//デバイスの取得
		auto Dev = App::GetApp()->GetDeviceResources();
		auto pDx11Device = Dev->GetD3DDevice();
		auto pID3D11DeviceContext = Dev->GetD3DDeviceContext();
		//ステータスのポインタ
		auto RenderStatePtr = GetStage()->GetRenderState();

		auto PtrT = GetComponent<Transform>();
		//ステージからカメラを取り出す
		auto PtrCamera = GetStage()->GetTargetCamera();
		//カメラの取得
		Matrix4X4 View, Proj, WorldViewProj;
		View = PtrCamera->GetViewMatrix();
		Proj = PtrCamera->GetProjMatrix();


		//ストライドとオフセット
		UINT stride = sizeof(VertexPositionNormalTexture);
		UINT offset = 0;
		//頂点バッファの設定
		auto PtrMeshResource = App::GetApp()->GetResource<MeshResource>(L"DEFAULT_CUBE");
		pID3D11DeviceContext->IASetVertexBuffers(0, 1, PtrMeshResource->GetVertexBuffer().GetAddressOf(), &stride, &offset);
		//インデックスバッファのセット
		pID3D11DeviceContext->IASetIndexBuffer(PtrMeshResource->GetIndexBuffer().Get(), DXGI_FORMAT_R16_UINT, 0);
		//描画方法(3角形)
		pID3D11DeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
		//ステータスのポインタ
		//テクスチャを取得
		ID3D11ShaderResourceView* pNull[1] = { 0 };
		ID3D11SamplerState* pNullSR[1] = { 0 };
		//テクスチャを設定
		auto PtrTextureResource = App::GetApp()->GetResource<TextureResource>(L"TRACE_TX");
		pID3D11DeviceContext->PSSetShaderResources(0, 1, PtrTextureResource->GetShaderResourceView().GetAddressOf());
		//リニアサンプラーを設定
		ID3D11SamplerState* samplerState = RenderStatePtr->GetLinearClamp();
		pID3D11DeviceContext->PSSetSamplers(0, 1, &samplerState);
		//半透明処理
		pID3D11DeviceContext->OMSetBlendState(RenderStatePtr->GetAlphaBlendEx(), nullptr, 0xffffffff);

		//デプスステンシルは使用する
		pID3D11DeviceContext->OMSetDepthStencilState(RenderStatePtr->GetDepthDefault(), 0);
		//シェーダの設定
		pID3D11DeviceContext->VSSetShader(m_VirtexShader->GetShader(), nullptr, 0);
		pID3D11DeviceContext->PSSetShader(m_PixelShader->GetShader(), nullptr, 0);
		//インプットレイアウトの設定
		pID3D11DeviceContext->IASetInputLayout(m_VirtexShader->GetInputLayout());



		//コンスタントバッファの設定
		ConstantBuffer cb1;
		ZeroMemory(&cb1, sizeof(cb1));
		//行列の設定(転置する)
		cb1.World = Matrix4X4EX::Transpose(PtrT->GetWorldMatrix());;
		cb1.View = Matrix4X4EX::Transpose(View);
		cb1.Projection = Matrix4X4EX::Transpose(Proj);
		//ライトの設定
		//ステージから0番目のライトを取り出す
		auto PtrLight = GetStage()->GetTargetLight(0);
		cb1.LightDir = PtrLight->GetDirectional();
		//xとzだけ逆にする
		cb1.LightDir.x *= -1.0f;
		cb1.LightDir.z *= -1.0f;
		cb1.LightDir.w = 1.0f;
		//トータルタイムをコンスタントバッファに渡す
		float ElapsedTime = App::GetApp()->GetElapsedTime();
		m_TotalTime += ElapsedTime;
		if (m_TotalTime >= 1.0f){
			m_TotalTime = 0.0f;
		}
		cb1.Param.x = m_TotalTime;
		//コンスタントバッファの更新
		pID3D11DeviceContext->UpdateSubresource(m_ConstantBuffer->GetBuffer(), 0, nullptr, &cb1, 0, 0);
		//コンスタントバッファの設定
		ID3D11Buffer* pConstantBuffer = m_ConstantBuffer->GetBuffer();
		pID3D11DeviceContext->VSSetConstantBuffers(0, 1, &pConstantBuffer);
		pID3D11DeviceContext->PSSetConstantBuffers(0, 1, &pConstantBuffer);

		//レンダリングステート
		pID3D11DeviceContext->RSSetState(RenderStatePtr->GetCullFront());
		//内側描画
		pID3D11DeviceContext->DrawIndexed(PtrMeshResource->GetNumIndicis(), 0, 0);

		//ライトの向きを変える
		cb1.LightDir = PtrLight->GetDirectional();
		cb1.LightDir.w = 1.0f;

		//コンスタントバッファの更新
		pID3D11DeviceContext->UpdateSubresource(m_ConstantBuffer->GetBuffer(), 0, nullptr, &cb1, 0, 0);
		//コンスタントバッファの設定
		pConstantBuffer = m_ConstantBuffer->GetBuffer();
		pID3D11DeviceContext->VSSetConstantBuffers(0, 1, &pConstantBuffer);
		pID3D11DeviceContext->PSSetConstantBuffers(0, 1, &pConstantBuffer);

		//レンダリングステート
		pID3D11DeviceContext->RSSetState(RenderStatePtr->GetCullBack());
		//描画(外側)
		pID3D11DeviceContext->DrawIndexed(PtrMeshResource->GetNumIndicis(), 0, 0);
		//後始末
		Dev->InitializeStates(RenderStatePtr);


	}
Esempio n. 14
0
void GSDevice9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSelector ssel)
{
	if(cb->WH.z > 0 && cb->WH.w > 0 && (sel.wms == 3 || sel.wmt == 3))
	{
		GSVector4i size(cb->WH);

		if(sel.wms == 3)
		{
			if(GSTexture* t = CreateMskFix(size.z, cb->MskFix.x, cb->MskFix.z))
			{
				m_dev->SetTexture(3, *(GSTexture9*)t);
			}
		}

		if(sel.wmt == 3)
		{
			if(GSTexture* t = CreateMskFix(size.w, cb->MskFix.y, cb->MskFix.w))
			{
				m_dev->SetTexture(4, *(GSTexture9*)t);
			}
		}
	}

	hash_map<uint32, CComPtr<IDirect3DPixelShader9> >::const_iterator i = m_ps.find(sel);

	if(i == m_ps.end())
	{
		string str[17];

		str[0] = format("%d", sel.fst);
		str[1] = format("%d", sel.wms);
		str[2] = format("%d", sel.wmt);
		str[3] = format("%d", sel.fmt);
		str[4] = format("%d", sel.aem);
		str[5] = format("%d", sel.tfx);
		str[6] = format("%d", sel.tcc);
		str[7] = format("%d", sel.atst);
		str[8] = format("%d", sel.fog);
		str[9] = format("%d", sel.clr1);
		str[10] = format("%d", sel.rt);
		str[11] = format("%d", sel.ltf);
		str[12] = format("%d", sel.colclip);
		str[13] = format("%d", sel.date);
		str[14] = format("%d", sel.spritehack);
		str[15] = format("%d", sel.tcoffsethack);
		str[16] = format("%d", sel.point_sampler);

		D3DXMACRO macro[] =
		{
			{"PS_FST", str[0].c_str()},
			{"PS_WMS", str[1].c_str()},
			{"PS_WMT", str[2].c_str()},
			{"PS_FMT", str[3].c_str()},
			{"PS_AEM", str[4].c_str()},
			{"PS_TFX", str[5].c_str()},
			{"PS_TCC", str[6].c_str()},
			{"PS_ATST", str[7].c_str()},
			{"PS_FOG", str[8].c_str()},
			{"PS_CLR1", str[9].c_str()},
			{"PS_RT", str[10].c_str()},
			{"PS_LTF", str[11].c_str()},
			{"PS_COLCLIP", str[12].c_str()},
			{"PS_DATE", str[13].c_str()},
			{"PS_SPRITEHACK", str[14].c_str()},
			{"PS_TCOFFSETHACK", str[15].c_str()},
			{"PS_POINT_SAMPLER", str[16].c_str()},
			{NULL, NULL},
		};

		CComPtr<IDirect3DPixelShader9> ps;

		CompileShader(IDR_TFX_FX, "ps_main", macro, &ps);

		m_ps[sel] = ps;

		i = m_ps.find(sel);
	}

	PSSetShader(i->second, (const float*)cb, sizeof(*cb) / sizeof(GSVector4));

	Direct3DSamplerState9* ss = NULL;

	if(sel.tfx != 4)
	{
		if(!(sel.fmt < 3 && sel.wms < 3 && sel.wmt < 3))
		{
			ssel.ltf = 0;
		}

		hash_map<uint32, Direct3DSamplerState9* >::const_iterator i = m_ps_ss.find(ssel);

		if(i != m_ps_ss.end())
		{
			ss = i->second;
		}
		else
		{
			ss = new Direct3DSamplerState9();

			memset(ss, 0, sizeof(*ss));

			ss->Anisotropic[0] = !!theApp.GetConfig("AnisotropicFiltering", 0) && !theApp.GetConfig("paltex", 0) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR;
			ss->Anisotropic[1] = !!theApp.GetConfig("AnisotropicFiltering", 0) && !theApp.GetConfig("paltex", 0) ? D3DTEXF_ANISOTROPIC : D3DTEXF_POINT;
			ss->FilterMin[0] = ssel.ltf ? ss->Anisotropic[0] : D3DTEXF_POINT;
			ss->FilterMag[0] = ssel.ltf ? ss->Anisotropic[0] : D3DTEXF_POINT;
			ss->FilterMip[0] = ssel.ltf ? ss->Anisotropic[0] : D3DTEXF_POINT;
			ss->FilterMin[1] = ss->Anisotropic[1];
			ss->FilterMag[1] = ss->Anisotropic[1];
			ss->FilterMip[1] = ss->Anisotropic[1];
			ss->AddressU = ssel.tau ? D3DTADDRESS_WRAP : D3DTADDRESS_CLAMP;
			ss->AddressV = ssel.tav ? D3DTADDRESS_WRAP : D3DTADDRESS_CLAMP;
			ss->MaxAnisotropy = theApp.GetConfig("MaxAnisotropy", 0);
			ss->MaxLOD = FLT_MAX;


			m_ps_ss[ssel] = ss;
		}
	}

	PSSetSamplerState(ss);
}
Esempio n. 15
0
/**
* Callback to draw things in world space.
***/
void OSVR_DirectMode::DrawWorld(void* userData, osvr::renderkit::GraphicsLibrary cLibrary, osvr::renderkit::RenderBuffer cBuffers,
	osvr::renderkit::OSVR_ViewportDescription sViewport, OSVR_PoseState pose, osvr::renderkit::OSVR_ProjectionMatrix sProjection, OSVR_TimeValue deadline)
{
	static int nEye = 0;
	static float fAspect = 1.0f;

	// Make sure our pointers are filled in correctly.  The config file selects
	// the graphics library to use, and may not match our needs.
	if (cLibrary.D3D11 == nullptr)
	{
		std::cerr << "SetupDisplay: No D3D11 GraphicsLibrary" << std::endl;
		return;
	}
	if (cBuffers.D3D11 == nullptr)
	{
		std::cerr << "SetupDisplay: No D3D11 RenderBuffer" << std::endl;
		return;
	}

	// auto pcContext = cLibrary.D3D11->context;
	auto pcDevice = cLibrary.D3D11->device;
	auto pcContext = cLibrary.D3D11->context;

	// create all bool
	bool bAllCreated = true;

	// create vertex shader
	if (!m_pcVertexShader11)
	{
		if (FAILED(Create2DVertexShader(pcDevice, &m_pcVertexShader11, &m_pcVertexLayout11)))
		{
			OutputDebugString(L"FAILED");
			bAllCreated = false;
		}
	}
	// create pixel shader... 
	if (!m_pcPixelShader11)
	{
		if (FAILED(CreatePixelShaderEffect(pcDevice, &m_pcPixelShader11, PixelShaderTechnique::FullscreenGammaCorrection)))
			bAllCreated = false;
	}
	// Create vertex buffer
	if (!m_pcVertexBuffer11)
	{
		if (FAILED(CreateFullScreenVertexBuffer(pcDevice, &m_pcVertexBuffer11)))
			bAllCreated = false;
	}
	// create constant buffer
	if (!m_pcConstantBufferDirect11)
	{
		if (FAILED(CreateMatrixConstantBuffer(pcDevice, &m_pcConstantBufferDirect11)))
			bAllCreated = false;
	}
	// sampler ?
	if (!m_pcSamplerState)
	{
		bAllCreated = false;
	}


	if ((bAllCreated) && (m_sStereoTextureViews.m_ppcTexView11[nEye]))
	{
		// Set the input layout
		pcContext->IASetInputLayout(m_pcVertexLayout11);

		// Set vertex buffer
		UINT stride = sizeof(TexturedVertex);
		UINT offset = 0;
		pcContext->IASetVertexBuffers(0, 1, &m_pcVertexBuffer11, &stride, &offset);

		// get orthographic matrix from projection and normalize it by its width (since we use a fullscreen shader here)
		float afProjectionD3D[16];
		osvr::renderkit::OSVR_Projection_to_D3D(afProjectionD3D, sProjection);
		D3DXMATRIX sProj(afProjectionD3D);

		// due to the aspect ratio (90° horizontal, 90° vertical) of the HDK we adjust the screen by 
		// the height, not by the width... in this case we need to set a higher FOV by following formular:
		// V = 2 * arctan( tan(H / 2) * aspectratio ) - so we get V 90° and H 121°
		sProj.m[0][0] = sProj.m[0][0] * fAspect; // < incorporate game screen aspect ratio;
		sProj.m[0][1] = 0.0f;
		sProj.m[0][3] = sProj.m[0][2];
		sProj.m[0][2] = 0.0f;

		sProj.m[1][0] = 0.0f;
		sProj.m[1][1] = sProj.m[1][1];
		sProj.m[1][3] = sProj.m[1][2];
		sProj.m[1][2] = 0.0f;

		sProj.m[2][0] = 0.0f;
		sProj.m[2][1] = 0.0f;
		sProj.m[2][2] = 1.0f; // 1.0f here... fullscreen shader !
		sProj.m[2][3] = 0.0f;

		sProj.m[3][0] = 0.0f;
		sProj.m[3][1] = 0.0f;
		sProj.m[3][2] = 0.0f;
		sProj.m[3][3] = 1.0f;

		// zoom out ?
		if (m_pbZoomOut)
		{
			if (*m_pbZoomOut)
			{
				sProj.m[0][0] /= 2.0f;
				sProj.m[1][1] /= 2.0f;
			}
		}

		// Set constant buffer, first update it... scale and translate the left and right image
		pcContext->UpdateSubresource((ID3D11Resource*)m_pcConstantBufferDirect11, 0, NULL, &sProj, 0, 0);
		pcContext->VSSetConstantBuffers(0, 1, &m_pcConstantBufferDirect11);

		// Set primitive topology
		pcContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

		// texture connected ?
		if ((m_sStereoTextureViews.m_ppcTexView11[nEye]) && (*m_sStereoTextureViews.m_ppcTexView11[nEye]))
		{
			if (m_eMethod == OSVR_DirectModeMethods::OSVR_D3D11_use_Game_Device)
			{
				// set texture, sampler state
				pcContext->PSSetShaderResources(0, 1, m_sStereoTextureViews.m_ppcTexView11[nEye]);
				pcContext->PSSetSamplers(0, 1, &m_pcSamplerState);
			}
			else
			{
				ID3D11Resource* pcResource = nullptr;
				(*m_sStereoTextureViews.m_ppcTexView11[nEye])->GetResource(&pcResource);

				if (!m_sStereoTextureCopies.m_pcTex11Copy[nEye])
				{
					// get the description and create the copy texture
					D3D11_TEXTURE2D_DESC sDesc;
					((ID3D11Texture2D*)pcResource)->GetDesc(&sDesc);
					sDesc.MiscFlags |= D3D11_RESOURCE_MISC_SHARED;
					sDesc.BindFlags |= D3D11_BIND_SHADER_RESOURCE;
					if (FAILED(((ID3D11Device*)m_pcGameDevice)->CreateTexture2D(&sDesc, NULL, (ID3D11Texture2D**)&m_sStereoTextureCopies.m_pcTex11Copy[nEye])))
					{
						OutputDebugString(L"StereoSplitterDX10 : Failed to create twin texture !");
						return;
					}

					// aspect ratio
					fAspect = (float)sDesc.Width / (float)sDesc.Height;

					// TODO !! DX9 // DX10 !!

					// get shared handle
					IDXGIResource* pcDXGIResource(NULL);
					m_sStereoTextureCopies.m_pcTex11Copy[nEye]->QueryInterface(__uuidof(IDXGIResource), (void**)&pcDXGIResource);
					HANDLE sharedHandle;
					if (pcDXGIResource)
					{
						pcDXGIResource->GetSharedHandle(&sharedHandle);
						pcDXGIResource->Release();
					}
					else OutputDebugString(L"Failed to query IDXGIResource.");

					// open the shared handle with the temporary device
					ID3D11Resource* pcResourceShared;
					pcDevice->OpenSharedResource(sharedHandle, __uuidof(ID3D11Resource), (void**)(&pcResourceShared));
					if (pcResourceShared)
					{
						pcResourceShared->QueryInterface(__uuidof(ID3D11Texture2D), (void**)(&m_sStereoFrameTextures.m_pcFrameTexture[nEye]));
						pcResourceShared->Release();
					}
					else OutputDebugString(L"Could not open shared resource.");

					// create shader resource view
					if (m_sStereoFrameTextures.m_pcFrameTexture[nEye])
					{
						D3D11_SHADER_RESOURCE_VIEW_DESC sDescSRV;
						ZeroMemory(&sDescSRV, sizeof(D3D11_SHADER_RESOURCE_VIEW_DESC));
						sDescSRV.Format = sDesc.Format;
						sDescSRV.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
						sDescSRV.Texture2D.MostDetailedMip = 0;
						sDescSRV.Texture2D.MipLevels = 1;
						if (FAILED(pcDevice->CreateShaderResourceView(m_sStereoFrameTextures.m_pcFrameTexture[nEye], &sDescSRV, &m_sSteroFrameTextureSRViews.m_pcFrameTextureSRView[nEye])))
							OutputDebugString(L"Failed to create shader resource view.");
					}
					else OutputDebugString(L"No Texture available.");
				}
				else
				{
					// copy the frame tex to shared texture
					m_pcGameDeviceContext->CopyResource(m_sStereoTextureCopies.m_pcTex11Copy[nEye], pcResource);
					if (pcResource) pcResource->Release();

					// set texture, sampler state
					pcContext->PSSetShaderResources(0, 1, &m_sSteroFrameTextureSRViews.m_pcFrameTextureSRView[nEye]);
					pcContext->PSSetSamplers(0, 1, &m_pcSamplerState);
				}
			}
		}

		// set shaders
		pcContext->VSSetShader(m_pcVertexShader11, 0, 0);
		pcContext->PSSetShader(m_pcPixelShader11, 0, 0);

		// Render a triangle
		pcContext->Draw(6, 0);

		// switch eye for next call
		nEye = !nEye;
	}
}
Esempio n. 16
0
	void SpriteBase::OnDraw() {
		auto TexPtr = App::GetApp()->GetResource<TextureResource>(m_TextureResName);
		auto Dev = App::GetApp()->GetDeviceResources();
		auto pD3D11DeviceContext = Dev->GetD3DDeviceContext();
		auto RenderState = Dev->GetRenderState();
		//ワールド行列の決定
		Mat4x4 World;
		World.affineTransformation2D(
			m_Scale,			//スケーリング
			Vec2(0, 0),		//回転の中心(重心)
			m_Rot,				//回転角度
			m_Pos				//位置
		);
		//射影行列の決定
		float w = static_cast<float>(App::GetApp()->GetGameWidth());
		float h = static_cast<float>(App::GetApp()->GetGameHeight());
		Mat4x4 Proj(XMMatrixOrthographicLH(w, h, -1.0, 1.0f));
		//行列の合成
		World *= Proj;
		//コンスタントバッファの準備
		SpriteConstantBuffer sb;
		//エミッシブ加算。
		sb.Emissive = m_Emissive;
		//行列の設定
		sb.World = World;
		//コンスタントバッファの更新
		pD3D11DeviceContext->UpdateSubresource(CBSprite::GetPtr()->GetBuffer(), 0, nullptr, &sb, 0, 0);

		//ストライドとオフセット
		UINT stride = sizeof(VertexPositionColorTexture);
		UINT offset = 0;
		//頂点バッファのセット
		pD3D11DeviceContext->IASetVertexBuffers(0, 1, m_SquareMesh->GetVertexBuffer().GetAddressOf(), &stride, &offset);
		//インデックスバッファのセット
		pD3D11DeviceContext->IASetIndexBuffer(m_SquareMesh->GetIndexBuffer().Get(), DXGI_FORMAT_R16_UINT, 0);

		//描画方法(3角形)
		pD3D11DeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

		//コンスタントバッファの設定
		ID3D11Buffer* pConstantBuffer = CBSprite::GetPtr()->GetBuffer();
		ID3D11Buffer* pNullConstantBuffer = nullptr;
		//頂点シェーダに渡す
		pD3D11DeviceContext->VSSetConstantBuffers(0, 1, &pConstantBuffer);
		//ピクセルシェーダに渡す
		pD3D11DeviceContext->PSSetConstantBuffers(0, 1, &pConstantBuffer);
		//シェーダの設定
		pD3D11DeviceContext->VSSetShader(VSPCTSprite::GetPtr()->GetShader(), nullptr, 0);
		pD3D11DeviceContext->PSSetShader(PSPCTSprite::GetPtr()->GetShader(), nullptr, 0);
		//インプットレイアウトの設定
		pD3D11DeviceContext->IASetInputLayout(VSPCTSprite::GetPtr()->GetInputLayout());
		//ブレンドステート
		switch (m_BlendState) {
		case BlendState::Opaque:
			pD3D11DeviceContext->OMSetBlendState(RenderState->GetOpaque(), nullptr, 0xffffffff);
			break;
		case BlendState::Trace:
			pD3D11DeviceContext->OMSetBlendState(RenderState->GetAlphaBlendEx(), nullptr, 0xffffffff);
			break;
		case BlendState::Additive:
			pD3D11DeviceContext->OMSetBlendState(RenderState->GetAdditive(), nullptr, 0xffffffff);
			break;
		}
		//デプスステンシルステート
		pD3D11DeviceContext->OMSetDepthStencilState(RenderState->GetDepthNone(), 0);
		//ラスタライザステート
		pD3D11DeviceContext->RSSetState(RenderState->GetCullBack());

		//テクスチャとサンプラーの設定
		ID3D11ShaderResourceView* pNull[1] = { 0 };
		pD3D11DeviceContext->PSSetShaderResources(0, 1, TexPtr->GetShaderResourceView().GetAddressOf());
		//ラッピングサンプラー
		ID3D11SamplerState* pSampler = RenderState->GetLinearWrap();
		pD3D11DeviceContext->PSSetSamplers(0, 1, &pSampler);

		//描画
		pD3D11DeviceContext->DrawIndexed(m_SquareMesh->GetNumIndicis(), 0, 0);
		//後始末
		Dev->InitializeStates();
	}