Jump to content
  • Advertisement

KittensWithSpikes

Member
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

413 Neutral

About KittensWithSpikes

  • Rank
    Newbie
  1. Hello I am quite new to direct X. I am current reading and going through Introduction to 3d game programming with direct x 11    When finishing debugging an application I get some live objects that are still around. I have tried using the debug layer to try and tracking down where leaks are happening, but I cannot seem to find them. I am currently using WRL::ComPtr on the D3D11 interfaces.    The application is the bare minimum of a D3D11 Application.   I have include the relevant code here.   D3DApp.cpp D3DApp::~D3DApp() { if (mp_immediateContext) mp_immediateContext->ClearState(); #if defined(REPORT_LIVE_OBJECTS) ComPtr<ID3D11Debug> debug; mp_d3dDevice.As(&debug); debug->ReportLiveDeviceObjects(D3D11_RLDO_DETAIL); #endif } void D3DApp::OnWindowResize() { if (mp_renderTargetView) mp_renderTargetView.Get()->Release(); if (mp_depthStencilView) mp_depthStencilView.Get()->Release(); if (mp_depthStencilBuffer) mp_depthStencilBuffer.Get()->Release(); mp_swapChain->ResizeBuffers(1, m_clientWidth, m_clientHeight, DXGI_FORMAT_R8G8B8A8_UNORM, 0); ComPtr<ID3D11Texture2D> backBuffer; mp_swapChain->GetBuffer(0,__uuidof(ID3D11Texture2D), (void**)backBuffer.GetAddressOf()); mp_d3dDevice->CreateRenderTargetView(backBuffer.Get(), nullptr, mp_renderTargetView.GetAddressOf()); D3D11_TEXTURE2D_DESC desc; desc.Width = m_clientWidth; desc.Height = m_clientHeight; desc.ArraySize = 1; desc.MipLevels = 1; desc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; if (m_enable4xMsaa) { desc.SampleDesc.Count = 4; desc.SampleDesc.Quality = m_4xmsaaQuality - 1; } else { desc.SampleDesc.Count = 1; desc.SampleDesc.Quality = 0; } desc.Usage = D3D11_USAGE_DEFAULT; desc.CPUAccessFlags = 0; desc.MiscFlags = 0; desc.BindFlags = D3D11_BIND_DEPTH_STENCIL; HRESULT hr = mp_d3dDevice->CreateTexture2D(&desc, nullptr, mp_depthStencilBuffer.GetAddressOf()); if (FAILED(hr)) { MessageBox(nullptr, L"Failed to create a depth stencil buffer!", L"D3D ERROR", MB_OK); return; } hr = mp_d3dDevice->CreateDepthStencilView(mp_depthStencilBuffer.Get(), nullptr, mp_depthStencilView.GetAddressOf()); if (FAILED(hr)) { MessageBox(nullptr, L"Failed to create a depth stencil view!", L"D3D ERROR", MB_OK); return; } mp_immediateContext->OMSetRenderTargets(1, mp_renderTargetView.GetAddressOf(), mp_depthStencilView.Get()); m_viewPort.TopLeftX = 0; m_viewPort.TopLeftY = 0; m_viewPort.MinDepth = 0.0; m_viewPort.MaxDepth = 1.0; m_viewPort.Width = static_cast<FLOAT>(m_clientWidth); m_viewPort.Height = static_cast<FLOAT>(m_clientHeight); mp_immediateContext->RSSetViewports(1, &m_viewPort); } bool D3DApp::InitializeD3D() { UINT deviceFlags = 0; #if defined(DEBUG) || defined(_DEBUG) deviceFlags |= D3D11_CREATE_DEVICE_DEBUG; #endif D3D_FEATURE_LEVEL featureLevel; HRESULT hr = D3D11CreateDevice(nullptr, m_d3dDriverType, 0, deviceFlags, nullptr, 0, D3D11_SDK_VERSION, mp_d3dDevice.GetAddressOf(), &featureLevel, mp_immediateContext.GetAddressOf()); if (FAILED(hr)) { MessageBox(nullptr, L"Failed to create a D3D11 Device!", L"D3D ERROR", MB_OK); return false; } if (m_enable4xMsaa) { hr = mp_d3dDevice->CheckMultisampleQualityLevels(DXGI_FORMAT_R8G8B8A8_UNORM, 4, &m_4xmsaaQuality); if (FAILED(hr)) { MessageBox(nullptr, L"The GPU does not support 4x MSAA", L"D3D ERROR", MB_OK); return false; } } DXGI_SWAP_CHAIN_DESC swapDesc; ZeroMemory(&swapDesc, sizeof(DXGI_SWAP_CHAIN_DESC)); swapDesc.BufferCount = 1; swapDesc.BufferDesc.Width = m_clientWidth; swapDesc.BufferDesc.Height = m_clientHeight; swapDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; swapDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; swapDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED; swapDesc.BufferDesc.RefreshRate.Numerator = 60; swapDesc.BufferDesc.RefreshRate.Denominator = 1; swapDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapDesc.OutputWindow = m_windowHandle; if (m_enable4xMsaa) { swapDesc.SampleDesc.Count = 4; swapDesc.SampleDesc.Quality = m_4xmsaaQuality - 1; } else { swapDesc.SampleDesc.Count = 1; swapDesc.SampleDesc.Quality = 0; } swapDesc.Windowed = true; swapDesc.Flags = 0; swapDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; ComPtr<IDXGIDevice> dxgiDevice = nullptr; hr = mp_d3dDevice.As(&dxgiDevice); if (FAILED(hr)) { MessageBox(nullptr, L"Could not create DXGI device", L"D3D ERROR", MB_OK); return false; } ComPtr<IDXGIAdapter> dxgiAdapter = nullptr; hr = dxgiDevice->GetParent(__uuidof(IDXGIAdapter), (void**)dxgiAdapter.GetAddressOf()); if (FAILED(hr)) { MessageBox(nullptr, L"Could not obtain dxgi adapter", L"D3D ERROR", MB_OK); return false; } ComPtr<IDXGIFactory> dxgiFactory = nullptr; hr = dxgiAdapter->GetParent(__uuidof(dxgiFactory), (void**)dxgiFactory.GetAddressOf()); if (FAILED(hr)) { MessageBox(nullptr, L"Could not obtain dxgi factory", L"D3D ERROR", MB_OK); return false; } hr = dxgiFactory->CreateSwapChain(mp_d3dDevice.Get(), &swapDesc, mp_swapChain.GetAddressOf()); if (FAILED(hr)) { MessageBox(nullptr, L"Could not create swap chain", L"D3D ERROR", MB_OK); return false; } OnWindowResize(); return true; } D3DTestApp.cpp void D3DTestApp::Render() { float color[4] = { 0.0, 0.0, 1.0, 1.0 }; mp_immediateContext->ClearRenderTargetView(mp_renderTargetView.Get(), color); mp_immediateContext->ClearDepthStencilView(mp_depthStencilView.Get(), D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0); // DRAW mp_swapChain->Present(0, 0); } and here is the warnings 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 0x006E4AF4, Refcount: 3. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x006EB000, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x007BA010, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x0296C8AC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x0296CD54, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x0296CF9C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x0296D334, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x0296D544, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x0296D760, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x007BCFEC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x0296E7FC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x0296EA94, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x0296FE84, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object at 0x0297054C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN] D3D11 WARNING: Live Object : 13 [ STATE_CREATION WARNING #0: UNKNOWN] No memory leaks detected. Visual Leak Detector is now exiting. DXGI WARNING: Live Producer at 0x006D6780, Refcount: 4. [ STATE_CREATION WARNING #0: ] DXGI WARNING: Live Object at 0x006D8E40, Refcount: 2. [ STATE_CREATION WARNING #0: ] DXGI WARNING: Live Object : 1 [ STATE_CREATION WARNING #0: ] Now one of my questions i if these live object have a ref count of 0 should they be not be cleaned up?   Any help or advice would be greatly appreciated. Thank you for your time.
  2. KittensWithSpikes

    How can I learn Java ?

    if you want to learn java I would recommend this book   Starting Out with Java: From Control Structures through Objects    http://www.amazon.com/Starting-Out-Java-Control-Structures/dp/0132855836/ref=sr_1_4?s=books&ie=UTF8&qid=1403295913&sr=1-4&keywords=Starting+Out+with+Java%3A+From+Control+Structures+through+Data+Structures   It is a good book. we used it in our first year of college. this is also assuming you have no previous background in programming.   Then when you're  conformable programming, you could try something on a smaller scale, such as something like pong, pacman, tetris or a space invaders. these games will help you understand the fundamentals of 2d game programming.   Don't go rushing into something that will be over your head right away, like an RTS. The problems you will face in the above games will be more than enough to keep you busy. Good luck, Happy coding!
  3. KittensWithSpikes

    RPG Maker - Free weekend on Steam

    all .png    if that is what your asking
  4. KittensWithSpikes

    Double ended link list help

    Thanks SiCrane, I have not implemented any kind of remove functions yet, only insertions. Although I do see how the remove functions could make my Destroy Function more clean and simple. I really appreciate the help you guys have given me ;).
  5. KittensWithSpikes

    Double ended link list help

    rip-off thanks for pointing me in the right direction,    OK so after of bit of trial and error I have come up with this solution.   I wanted to know if this is valid? I mean it works with no errors. but then I am not sure if I am leaking memory or doing something im not supposed to.   thanks again for the help guys   LinkedList& LinkedList::operator=(const LinkedList& rhs) { if(this == &rhs) return *this; this->Destroy(); LinkedNode* rhsNode = nullptr; LinkedNode* node = nullptr; LinkedNode* temp = nullptr; rhsNode = rhs.mFirst; while(rhsNode != nullptr) { node = new LinkedNode; if(IsEmpty()) { mFirst = node; mLast = node; node->data = rhsNode->data; mFirst->previous = nullptr; mLast->next = nullptr; } else { temp = mLast; mLast = node; temp-> next = mLast; mLast->previous = temp; mLast->data = rhsNode->data; } rhsNode =rhsNode->next; } mLast->next = nullptr; rhsNode =nullptr; node = nullptr; temp = nullptr; return *this; } Scottlowe, thanks for your interesting link. The reason I am building my own double ended linked list is to use this as an exercise. I don't plan to use these data structure projects in any project but to learn. 
  6. KittensWithSpikes

    Double ended link list help

    Hi I'm currently working on a double ended link list and currently testing it as I implement it.   There are three  parts of code I'm Fuzzy on   First is the copy constructor and second is the assignment operator. the third is the implementation of the destroy  member function(deleting the list)   Currently this is the implantation I have for the assignment operator.   LinkedList& LinkedList::operator=(const LinkedList& rhs) { if(this == &rhs) return *this; this->Destroy(); this->mFirst = rhs.mFirst; this->mLast = rhs.mLast; return *this; }   As for the copy constructor, I am not sure how to implement it .   then the destroy member function   void LinkedList::Destroy() { LinkedNode* current = nullptr; if(!IsEmpty()) { current = mLast->previous; while(current != nullptr) { delete mLast; current->next = nullptr; mLast = current; current = mLast->previous; } delete mFirst; mLast = nullptr; mFirst = nullptr; } } Here is my Main function   int main() { LinkedList list; list.InsertFirst(5); list.InsertFirst(24); list.InsertFirst(32); LinkedList list2; list2.InsertFirst(1); list2.InsertFirst(2); list2.InsertFirst(3); list2.InsertFirst(4); list2.InsertFirst(5); LinkedNode* current; current = list.GetFirst(); while (current != nullptr) { cout << current->data << endl; current = current->next; } cout << endl; list = list2; current = list.GetFirst(); while (current != nullptr) { cout << current->data << endl; current = current->next; } cout << endl; }   now when executing this I get an error: debug assertion failed expression _block_type_is_valid(pHead->nBlockUse)   I'm unsure what this is error is I tried debugging for a while but not sure where things are going wrong. I believe it has something to do with deleting invalid memory.   i know it has something to do with the destroy  member function and copy assignment operator, as if i remove list = list2 from the main function everything works fine.     I appreciate any input/help on this          
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!