コード例 #1
0
ファイル: Dx11GraphicDevice.cpp プロジェクト: jpd002/Palleon
HANDLE CDx11GraphicDevice::GetOutputBufferSharedHandle()
{
	HRESULT result = S_OK;
	Framework::Win32::CComPtr<IDXGIResource> resource;
	assert(!m_outputBuffer.IsEmpty());
	result = m_outputBuffer->QueryInterface<IDXGIResource>(&resource);
	assert(SUCCEEDED(result));
	if(FAILED(result))
	{
		return INVALID_HANDLE_VALUE;
	}
	HANDLE sharedHandle = INVALID_HANDLE_VALUE;
	result = resource->GetSharedHandle(&sharedHandle);
	assert(SUCCEEDED(result));
	return sharedHandle;
}
コード例 #2
0
ファイル: Dx11Effect.cpp プロジェクト: jpd002/Palleon
void CDx11Effect::CompilePixelShader(const std::string& shaderText)
{
	assert(m_pixelShader.IsEmpty());

	Framework::Win32::CComPtr<ID3DBlob> pixelShaderCode;
	Framework::Win32::CComPtr<ID3DBlob> pixelShaderErrors;

	UINT compileFlags = 0;
#ifdef _DEBUG
	compileFlags |= D3DCOMPILE_DEBUG;
#endif

	HRESULT result = D3DCompile(shaderText.c_str(), shaderText.length() + 1, "ps", nullptr, nullptr, "PixelProgram",
		"ps_5_0", compileFlags, 0, &pixelShaderCode, &pixelShaderErrors);
	if(FAILED(result))
	{
		if(!pixelShaderErrors.IsEmpty())
		{
			OutputDebugStringA(shaderText.c_str());
			OutputDebugStringA("\r\n");
			OutputDebugStringA(reinterpret_cast<const char*>(pixelShaderErrors->GetBufferPointer()));
		}
		DebugBreak();
	}

	result = m_device->CreatePixelShader(pixelShaderCode->GetBufferPointer(), pixelShaderCode->GetBufferSize(), nullptr, &m_pixelShader);
	assert(SUCCEEDED(result));
}