GithubHelp home page GithubHelp logo

Comments (3)

jenatali avatar jenatali commented on June 2, 2024 1

Sorry for the silence, we saw this, but haven't had a chance to put together samples. Hopefully we'll get to it eventually but I don't have a timeframe I can promise.

from d3d12translationlayer.

sodaboy581 avatar sodaboy581 commented on June 2, 2024

Sorry for the silence, we saw this, but haven't had a chance to put together samples. Hopefully we'll get to it eventually but I don't have a timeframe I can promise.

I can't even get Direct3DCreate9On12 to make a 9on12 device. It ALWAYS creates a D3D9 one. I have no idea why.

I have some test code like so...

IDXGIAdapter1* TryD3D12()
{
	HRESULT hr;

	// -- Create the Device -- //

	IDXGIFactory4* dxgiFactory;
	hr = CreateDXGIFactory1(IID_PPV_ARGS(&dxgiFactory));
	if (FAILED(hr))
	{
		return NULL;
	}

	IDXGIAdapter1* adapter; // adapters are the graphics card (this includes the embedded graphics on the motherboard)

	int adapterIndex = 0; // we'll start looking for directx 12  compatible graphics devices starting at index 0

	// find first hardware gpu that supports d3d 12
	while (dxgiFactory->EnumAdapters1(adapterIndex, &adapter) != DXGI_ERROR_NOT_FOUND)
	{
		DXGI_ADAPTER_DESC1 desc;
		adapter->GetDesc1(&desc);

		if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE)
		{
			// we dont want a software device
			adapterIndex++; // add this line here. Its not currently in the downloadable project
			continue;
		}

		// we want a device that is compatible with direct3d 12 (feature level 11 or higher)
		hr = D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_11_0, _uuidof(ID3D12Device), nullptr);
		if (SUCCEEDED(hr))
		{
			debug(L"Adapter description: %s", desc.Description);
			debug(L"Adapter LUID: %llx", desc.AdapterLuid);
			return adapter;
		}

		adapterIndex++;
	}

	return NULL;
}


IDirect3D9* d3d = nullptr;

	{
			IDirect3DDevice9On12* d3dtest = NULL;
			D3D9ON12_ARGS dArgs;
			ID3D12Device* d3d12 = NULL;
			IDXGIAdapter1* adapter;

			if ((adapter = TryD3D12()) != NULL)
			{
				D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&d3d12));
				LUID adapter_LUID = d3d12->GetAdapterLuid();
				ZeroMemory(&dArgs, sizeof(D3D9ON12_ARGS));
				dArgs.Enable9On12 = TRUE;
				dArgs.pD3D12Device = d3d12;
				d3d = Direct3DCreate9On12(D3D_SDK_VERSION, &dArgs, 1);
				debug(L"D3D12 memory address: %08X", d3d12);
				debug(L"D3D12 device LUID: %llx", adapter_LUID);
				debug(L"D3D9 memory address: %08X", d3d);
				debug(L"Query interface returned %08X", d3d->QueryInterface(IID_PPV_ARGS(&d3dtest)));
				debug(L"IDirect3DDevice9On12 interface memory address: %08X", d3dtest);

			}
	}

Log output is:

[08-16-2022, 06:49:19] Adapter description: NVIDIA GeForce RTX 3090
[08-16-2022, 06:49:19] Adapter LUID: 9fa8
[08-16-2022, 06:49:19] D3D12 memory address: 034B0348
[08-16-2022, 06:49:19] D3D12 device LUID: 9fa8
[08-16-2022, 06:49:19] D3D9 memory address: 054222E0
[08-16-2022, 06:49:19] Query interface returned 80004002
[08-16-2022, 06:49:19] IDirect3DDevice9On12 interface memory address: 00000000

I've even tried simplifying it like so:

ZeroMemory(&dArgs, sizeof(D3D9ON12_ARGS));
dArgs.Enable9On12 = TRUE;
d3d = Direct3DCreate9On12(D3D_SDK_VERSION, &dArgs, 1);
d3d->QueryInterface(IID_PPV_ARGS(&d3dtest))

.. But I still get E_NOINTERFACE. :(

Any ideas why this doesn't work?

Do you HAVE to be running a Windows insider build for it to function? I'm just trying to see performance on Windows 11.

from d3d12translationlayer.

sodaboy581 avatar sodaboy581 commented on June 2, 2024

Do you HAVE to be running a Windows insider build for it to function? I'm just trying to see performance on Windows 11.

Woops, I'm dumb, I needed to call QueryInterface on the IDirect3DDevice9 device and NOT the Direct3D9 interface. HA!

from d3d12translationlayer.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.