问题描述
很抱歉没有汇总代码,但我不知道错误可能在哪里。
如代码所示,我已使用设备的调试标志,并修复了Visual Studio(2017)输出窗口中显示的所有错误。
这是所有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 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,width,height,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,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,device_flags,D3D11_SDK_VERSION,&swap_chain_desc,&swap_chain,&device,&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(),&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(),&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);
// 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(),&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);
// Creating the input layout
ComPtr<ID3D11InputLayout> input_layout;
const D3D11_INPUT_ELEMENT_DESC input_layout_desc[] = {
{
"Position",DXGI_FORMAT_R32G32_FLOAT,D3D11_INPUT_PER_VERTEX_DATA,0
}
};
hr = device->CreateInputLayout(
input_layout_desc,(UINT)std::size(input_layout_desc),blob->GetBufferPointer(),&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,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;
}
这是顶点着色器代码:
float4 main(float2 pos : Position) : SV_Position
{
return float4(pos.x,pos.y,0.0f,1.0f);
}
这是像素着色器代码:
float4 main() : SV_Target
{
return float4(1.0f,1.0f);
}
最后,这是输出窗口:
'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).
欢迎任何调试想法或代码中可能出现的错误。 再次,我对所有代码的冗长表示歉意。 谢谢您的时间!
解决方法
基本上,我写的是IAGetVertexBuffers
而不是IASetVertexBuffers
。是的这样的白痴。
如果您在Direct3d / Directx方面遇到问题,则应完全检查此类内容。现在可以了。