[英](C++) Direct3D 11 Draw() function doesn't work, despite checking all HRESULTs
I'm sorry for not summarizing the code, but I have no clue where the error might be.我很抱歉没有总结代码,但我不知道错误可能在哪里。
As the code shows, I have used the debugging flag for the device and I have fixed all the errors that showed up in the output window of Visual Studio (2017).如代码所示,我使用了设备的调试标志,并修复了 Visual Studio (2017) 输出窗口中显示的所有错误。
This is all the C++ code:这是所有的 C++ 代码:
#pragma once
#pragma comment(lib, "d3d11")
#pragma comment(lib, "D3DCompiler")
#include <Windows.h>
#include <string>
#include <d3d11.h>
#include <d3dcompiler.h>
#include <wrl\client.h>
#include <comdef.h>
using namespace Microsoft::WRL;
#define CHECK_OK(hr) if (hr == S_OK)
#define CHECK_FAIL(hr) if (hr != S_OK)
#define CLASS_NAME "d3dwindow"
bool running = 1;
DXGI_SWAP_CHAIN_DESC CreateSwapChainDesc(HWND window, int width, int height) {
DXGI_SWAP_CHAIN_DESC scd = {};
scd.BufferDesc.Width = width;
scd.BufferDesc.Height = height;
scd.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
scd.BufferDesc.RefreshRate.Numerator = 0;
scd.BufferDesc.RefreshRate.Denominator = 0;
scd.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
scd.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
scd.SampleDesc.Count = 1;
scd.SampleDesc.Quality = 0;
scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
scd.BufferCount = 1;
scd.OutputWindow = window;
scd.Windowed = 1;
scd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
scd.Flags = 0;
return scd;
}
LRESULT CALLBACK WindowProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam) {
switch (message) {
case WM_DESTROY:
running = 0;
break;
default:
break;
}
return DefWindowProcA(window, message, wparam, lparam);
}
HWND CreateHwnd(const char *name, int width, int height, HINSTANCE instance = 0) {
WNDCLASSA window_class = { 0 };
window_class.lpfnWndProc = WindowProc;
window_class.lpszClassName = CLASS_NAME;
RegisterClassA(&window_class);
HWND window = CreateWindowA(CLASS_NAME, name, WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, width, height, 0, 0, instance, 0);
UpdateWindow(window);
return window;
}
struct Vertex {
float x, y;
};
int WINAPI WinMain(HINSTANCE instance, HINSTANCE prev_instance, LPSTR cmd_line, int arg_num) {
ComPtr<ID3D11Device> device;
ComPtr<IDXGISwapChain> swap_chain;
ComPtr<ID3D11DeviceContext> context;
ComPtr<ID3D11RenderTargetView> target;
HWND window = CreateHwnd("D3D", 800, 600, instance);
DXGI_SWAP_CHAIN_DESC swap_chain_desc = CreateSwapChainDesc(window, 800, 600);
HRESULT hr;
UINT device_flags = 0;
device_flags |= D3D11_CREATE_DEVICE_DEBUG;
// Creating the device and swap chain
hr = D3D11CreateDeviceAndSwapChain(
0,
D3D_DRIVER_TYPE_HARDWARE,
0,
device_flags,
0,
0,
D3D11_SDK_VERSION,
&swap_chain_desc,
&swap_chain,
&device,
0,
&context
);
CHECK_FAIL(hr) {
OutputDebugString("Failed: ");
_com_error err(hr);
OutputDebugString(err.ErrorMessage());
OutputDebugString("\n");
}
// Getting the back buffer
ComPtr<ID3D11Resource> back_buffer;
hr = swap_chain->GetBuffer(0, __uuidof(ID3D11Resource), &back_buffer);
CHECK_FAIL(hr) {
OutputDebugString("\nFailed to get the back buffer.\n");
return 0;
}
// Creating the render target view
hr = device->CreateRenderTargetView(
back_buffer.Get(),
0,
&target
);
// Binding the render target view
context->OMSetRenderTargets(1, target.GetAddressOf(), 0);
CHECK_FAIL(hr) {
OutputDebugString("\nFailed to create the render target.\n");
return 0;
}
const float color[] = { 0.1f, 0.2f, 0.4f, 1.0f };
Vertex vertices[] = {
{ 0.0f, 0.5f },
{ 0.5f, -0.5f },
{ -0.5f, -0.5f }
};
ComPtr<ID3D11Buffer> vertex_buffer;
D3D11_BUFFER_DESC buffer_desc = { 0 };
buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
buffer_desc.Usage = D3D11_USAGE_DEFAULT;
buffer_desc.CPUAccessFlags = 0;
buffer_desc.MiscFlags = 0;
buffer_desc.ByteWidth = sizeof(vertices);
buffer_desc.StructureByteStride = sizeof(Vertex);
D3D11_SUBRESOURCE_DATA subres_data = { 0 };
subres_data.pSysMem = vertices;
hr = device->CreateBuffer(&buffer_desc, &subres_data, &vertex_buffer);
CHECK_FAIL(hr) {
OutputDebugString("Failed to create vertex buffer.\n");
return 0;
}
// Bind the vertex buffer
UINT stride = sizeof(Vertex);
UINT offset = 0;
context->IAGetVertexBuffers(0, 1, vertex_buffer.GetAddressOf(), &stride, &offset);
// Creating the pixel shader
ComPtr<ID3D11PixelShader> pixel_shader;
ComPtr<ID3DBlob> blob;
hr = D3DReadFileToBlob(L"PixelShader.cso", &blob);
CHECK_FAIL(hr) {
OutputDebugString("Failed to read the pixel shader.\n");
return 0;
}
hr = device->CreatePixelShader(
blob->GetBufferPointer(),
blob->GetBufferSize(),
0,
&pixel_shader
);
CHECK_FAIL(hr) {
OutputDebugString("Failed to create the pixel shader.\n");
return 0;
}
// Binding the pixel shader
context->PSSetShader(pixel_shader.Get(), 0, 0);
// Creating the vertex shader
ComPtr<ID3D11VertexShader> vertex_shader;
hr = D3DReadFileToBlob(L"VertexShader.cso", &blob);
CHECK_FAIL(hr) {
OutputDebugString("Failed to read the vertex shader file.\n");
return 0;
}
hr = device->CreateVertexShader(
blob->GetBufferPointer(),
blob->GetBufferSize(),
0,
&vertex_shader
);
CHECK_FAIL(hr) {
OutputDebugString("Failed to create the vertex shader.\n");
return 0;
}
// Binding the vertex shader
context->VSSetShader(vertex_shader.Get(), 0, 0);
// Creating the input layout
ComPtr<ID3D11InputLayout> input_layout;
const D3D11_INPUT_ELEMENT_DESC input_layout_desc[] = {
{
"Position",
0,
DXGI_FORMAT_R32G32_FLOAT,
0,
0,
D3D11_INPUT_PER_VERTEX_DATA,
0
}
};
hr = device->CreateInputLayout(
input_layout_desc,
(UINT)std::size(input_layout_desc),
blob->GetBufferPointer(),
blob->GetBufferSize(),
&input_layout
);
CHECK_FAIL(hr) {
OutputDebugString("Failed to create the input layout.\n");
return 0;
}
// Binding the input layout
context->IASetInputLayout(input_layout.Get());
// Creating a viewport
D3D11_VIEWPORT viewport;
viewport.Width = 800;
viewport.Height = 600;
viewport.MinDepth = 0;
viewport.MaxDepth = 1;
viewport.TopLeftX = 0;
viewport.TopLeftY = 0;
// Binding the viewport
context->RSSetViewports(1, &viewport);
// Setting the draw mode / topology
context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
MSG message;
while (running) {
if (PeekMessageA(&message, window, 0, 0, PM_REMOVE)) {
TranslateMessage(&message);
DispatchMessage(&message);
}
else {
}
context->ClearRenderTargetView(target.Get(), color);
context->Draw(3, 0);
// Getting the error info from Present()
CHECK_FAIL(hr = swap_chain->Present(1, 0)) {
if (hr == DXGI_ERROR_DEVICE_REMOVED) {
hr = device->GetDeviceRemovedReason();
_com_error err(hr);
OutputDebugString("\n");
OutputDebugString(err.ErrorMessage());
}
else {
_com_error err(hr);
OutputDebugString("\n");
OutputDebugString(err.ErrorMessage());
}
}
Sleep(1);
}
return 0;
}
Here is the vertex shader code:这是顶点着色器代码:
float4 main(float2 pos : Position) : SV_Position
{
return float4(pos.x, pos.y, 0.0f, 1.0f);
}
And here is the pixel shader code:这是像素着色器代码:
float4 main() : SV_Target
{
return float4(1.0f, 0.0f, 0.0f, 1.0f);
}
Finally, this the output window:最后,这是输出窗口:
'D3D.exe' (Win32): Loaded 'C:\Users\alexb\source\repos\D3D\Debug\D3D.exe'. Symbols loaded.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\win32u.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32full.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp_win.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbase.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\d3d11.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\D3DCompiler_47.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ucrtbased.dll'
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dxgi.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptsp.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\DXCore.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\TextInputFramework.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreUIComponents.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreMessaging.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntmarta.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WinTypes.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WinTypes.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\WinTypes.dll'
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\iertutil.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\DXGIDebug.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ResourcePolicyClient.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ResourcePolicyClient.dll'
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\windows.storage.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\powrprof.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\umpdc.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvam.inf_amd64_2dd4c250764257ac\nvdlist.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\version.dll'
'D3D.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nvam.inf_amd64_2dd4c250764257ac\nvdlist.dll'
'D3D.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvam.inf_amd64_2dd4c250764257ac\nvldumd.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wintrust.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imagehlp.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rsaenh.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcrypt.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvam.inf_amd64_2dd4c250764257ac\nvwgf2um.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
'D3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
The thread 0x2a20 has exited with code 0 (0x0).
'D3D.exe' (Win32): Loaded 'C:\Program Files\NVIDIA Corporation\Ansel\Tools\NvCameraWhitelisting32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\shell32.dll'
'D3D.exe' (Win32): Unloaded 'C:\Program Files\NVIDIA Corporation\Ansel\Tools\NvCameraWhitelisting32.dll'
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\d3d11_3SDKLayers.dll'. Cannot find or open the PDB file.
DXGI WARNING: IDXGIFactory::CreateSwapChain: Blt-model swap effects (DXGI_SWAP_EFFECT_DISCARD and DXGI_SWAP_EFFECT_SEQUENTIAL) are legacy swap effects that are predominantly superceded by their flip-model counterparts (DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL and DXGI_SWAP_EFFECT_FLIP_DISCARD). Please consider updating your application to leverage flip-model swap effects to benefit from modern presentation enhancements. More information is available at http://aka.ms/dxgiflipmodel. [ MISCELLANEOUS WARNING #294: ]
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\igdlh64.inf_amd64_28d80681d3523b1c\igd10iumd32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ncrypt.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntasn1.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\igdlh64.inf_amd64_28d80681d3523b1c\igc32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file.
The thread 0x3914 has exited with code 0 (0x0).
The thread 0x2ec0 has exited with code 0 (0x0).
The thread 0x2150 has exited with code 0 (0x0).
The thread 0x1714 has exited with code 0 (0x0).
The thread 0x262c has exited with code 0 (0x0).
The thread 0x1718 has exited with code 0 (0x0).
The thread 0x19e4 has exited with code 0 (0x0).
The thread 0x2790 has exited with code 0 (0x0).
The thread 0x2bc4 has exited with code 0 (0x0).
The thread 0x5f8 has exited with code 0 (0x0).
The thread 0x19fc has exited with code 0 (0x0).
The thread 0x1f88 has exited with code 0 (0x0).
The thread 0xbe0 has exited with code 0 (0x0).
The thread 0x1fb4 has exited with code 0 (0x0).
The thread 0x2928 has exited with code 0 (0x0).
D3D11 WARNING: Process is terminating. Using simple reporting. Please call ReportLiveObjects() at runtime for standard reporting. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Producer at 0x0374E91C, Refcount: 2. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0375A848, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x00BBB288, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x00BC153C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x00BC198C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x00BC1BB4, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x00BC1F14, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x00BA3344, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x00BC3068, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x00BC3B2C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x00BC84AC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x00BC8654, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x00BCC384, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x00BCA2BC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x00BCA9BC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x037BE304, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x037BE42C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x0BCCD164, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object : 17 [ STATE_CREATION WARNING #0: UNKNOWN]
DXGI WARNING: Live Producer at 0x00B5FA2C, Refcount: 5. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object at 0x00B630E0, Refcount: 2. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object at 0x00BCC980, Refcount: 1. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object : 2 [ STATE_CREATION WARNING #0: ]
The program '[9440] D3D.exe' has exited with code 0 (0x0).
Any ideas for debugging or possible errors in my code are welcome.欢迎任何调试或我的代码中可能出现的错误的想法。 Again, I apologize for how lengthy all the code is.
再次,对于所有代码的冗长,我深表歉意。 Thank you for you time!
谢谢你的时间!
Basically I wrote IAGetVertexBuffers
instead of IASetVertexBuffers
.基本上我写的是
IAGetVertexBuffers
而不是IASetVertexBuffers
。 Yep.是的。 Such an idiot.
这样的白痴。 If you're having problems with direct3d/directx you should totally check for this kind of stuff.
如果您在使用 direct3d/directx 时遇到问题,您应该完全检查此类内容。 Now it works.
现在它起作用了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.