목록Programing (136)
공부중
// Main message handler for the sample. LRESULT CALLBACK Win32Application::WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { DXSample* pSample = reinterpret_cast(GetWindowLongPtr(hWnd, GWLP_USERDATA)); switch (message) { case WM_CREATE: { // Save the DXSample* passed in to CreateWindow. LPCREATESTRUCT pCreateStruct = reinterpret_cast(lParam); SetWindowLongPtr(hWnd, GWLP_USERDAT..
코드는 아래와 같다. #include #include //unique_ptr int main() { int foo = 100; //unique_ptr std::unique_ptr unique_ptr_value1{ new int }; //std::unique_ptr unique_ptr_value2{ &foo };//Runtime Error // 동적으로 할당하지 않은 주소를 넣으면 해제시 문제 발생 *unique_ptr_value1 = 1000; std::cout
코드는 아래와 같다. #include #include int main() { int testArray[] = { 0,1,2,3,4,5,6,7,8,9 }; for (int i : testArray) { std::cout
C++14에서 생긴 내용이라고 한다. 코드는 아래와 같다. #include int main() { //C++14 2진수 리터럴 int binary = 0b01010101; //1+4+16+64 == 85 std::cout
// Create synchronization objects and wait until assets have been uploaded to the GPU. { ThrowIfFailed(m_device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&m_fence))); m_fenceValue = 1; // Create an event handle to use for frame synchronization. m_fenceEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); if (m_fenceEvent == nullptr) { ThrowIfFailed(HRESULT_FROM_WIN32(GetLastError())); }..
이번 글에서 볼 코드 전문이다. // Create the command list. ThrowIfFailed(m_device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, m_commandAllocator.Get(), m_pipelineState.Get(), IID_PPV_ARGS(&m_commandList))); // Command lists are created in the recording state, but there is nothing // to record yet. The main loop expects it to be closed, so close it now. ThrowIfFailed(m_commandList->Close()); // Crea..
이번에 볼 코드는 아래와 같다 // Create the pipeline state, which includes compiling and loading shaders. { ComPtr vertexShader; ComPtr pixelShader; #if defined(_DEBUG) // Enable better shader debugging with the graphics debugging tools. UINT compileFlags = D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION; #else UINT compileFlags = 0; #endif ThrowIfFailed(D3DCompileFromFile(GetAssetFullPath(L"shaders.hlsl").c..
Win32Aplication.cpp 에서 Win32Application::Run() 함수 내부를 살펴보는데 그중 우리가 살펴봐야할것들은 전달인자로 받은 sample에서 호출하는 멤버함수들이다. 먼저 OnInit 함수부터 살펴보면... void D3D12HelloTriangle::OnInit() { LoadPipeline(); LoadAssets(); } 특별히 달라진 내용은 없다. LoadPipeline( )을 보자 void D3D12HelloTriangle::LoadPipeline() { UINT dxgiFactoryFlags = 0; #if defined(_DEBUG) // Enable the debug layer (requires the Graphics Tools "optional feature")..