Jump to content
  • Advertisement

blackslayer

Member
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

100 Neutral

About blackslayer

  • Rank
    Newbie
  1. blackslayer

    ID3D10ShaderResourceView* and std::map

    Ok, I'll keep moving with my map then. As for now it will be enough to me having this performance. Thanks.
  2. blackslayer

    ID3D10ShaderResourceView* and std::map

    Well tried written above. FPS still falls, maybe I need something else.
  3. blackslayer

    ID3D10ShaderResourceView* and std::map

    Sounds like a good idea, I'll try to implement like you said. Thanks man:)
  4. blackslayer

    ID3D10ShaderResourceView* and std::map

    While in release build it's about 3000 but it's because there isn't much things in scene: only textured level, and camera for now. But the question is about why storing ID3D19ShaderResourceView* in std::map slows down the game? Not about how large my FPS or how do I measure it.
  5. Hi. I've madea simple Texture Manager for DrectX 10 using ID3D10ShaderResourceView and std::map.I just want it be simple for my small demos. Here is how I organazied it: class TextureManager { private: static class TextureManager *m_TextureManager; map<wstring, ID3D10ShaderResourceView*, less<wstring> > textures; map<wstring, ID3D10ShaderResourceView*, less<wstring> >::iterator iter; ID3D10Device* md3dDevice; public: TextureManager (void); ~TextureManager (void); static TextureManager *GetManager(); bool addTexture(wstring path); void deleteTexture(wstring path); void clearTextures(); void setDevice(ID3D10Device* dev); void checkDevice(); ID3D10ShaderResourceView* GetTextureView(wstring path); ID3D10Device* getDevice(); ID3D10ShaderResourceView* TexView; }; [color="#000000"]it's a singleton class, [color="#000000"]addTexture and GetTextureView implemented like this: bool TextureManager::addTexture(wstring path) { checkDevice(); iter=textures.find(path.c_str()); if(iter==textures.end()) { HRESULT hr=D3DX10CreateShaderResourceViewFromFile(md3dDevice, path.c_str(), NULL, NULL, &TexView, NULL); if(hr!=S_OK) return false; textures.insert( pair<wstring,ID3D10ShaderResourceView*>(path.c_str(),TexView)); return true; } return false; } ID3D10ShaderResourceView* TextureManager::GetTextureView(wstring path) { checkDevice(); iter=textures.find(path.c_str()); if(iter==textures.end()) if(!addTexture(path.c_str())) return NULL; return textures[path.c_str()]; } [color="#000000"]The problem is when I'm using my manager's function GetTextureView to set new texture into shader like this: [color="#000000"]mfxVar->SetResource(txr_man->GetTextureView(filenames[texIndex].c_str())); [color="#000000"]I got my application 200-300 FPS down :[color="#000000"]( If I use just an [color="#000000"]ID3D10ShaderResourceView*[color="#000000"]array in application,instead of texture manager FPS looks good. Can't understand why putting [color="#000000"]ID3D10ShaderResourceView [color="#000000"]into <map>decreases FPS. Sure I can get rid of <map> just using an array of [color="#000000"]ID3D10ShaderResourceView [color="#000000"]in my manager while keeping it's functionality, but then I can't resize my texture array. Someone have any ideas about?
  6. Hi guys. Need help on following: I'm trying to remake bsp loader from gametutorials.com source to work with direct3d 10. They use OpenGl Everything looks fine with file opening and reading but I can't render level correctly. I've created the vertex buffer and index buffer from bsp data structures: Vert *vertices=new Vert[m_numOfVerts]; for(int j=0; j<m_numOfVerts; j++) { vertices[j].pos=m_pVerts[j].vPosition; } D3D10_BUFFER_DESC vbd; vbd.Usage = D3D10_USAGE_IMMUTABLE; vbd.ByteWidth = sizeof(Vert) * m_numOfVerts; vbd.BindFlags = D3D10_BIND_VERTEX_BUFFER; vbd.CPUAccessFlags = 0; vbd.MiscFlags = 0; D3D10_SUBRESOURCE_DATA vinitData; vinitData.pSysMem = vertices; md3dDevice->CreateBuffer(&vbd, &vinitData, &mVB); UINT stride = sizeof(Vert); UINT offset = 0; md3dDevice->IASetVertexBuffers(0, 1, &mVB, &stride, &offset); D3D10_BUFFER_DESC ibd; ibd.Usage = D3D10_USAGE_IMMUTABLE; ibd.ByteWidth = sizeof(int) * m_numOfIndices; ibd.BindFlags = D3D10_BIND_INDEX_BUFFER; ibd.CPUAccessFlags = 0; ibd.MiscFlags = 0; D3D10_SUBRESOURCE_DATA iinitData; iinitData.pSysMem = m_pIndices; md3dDevice->CreateBuffer(&ibd, &iinitData, &mIB); md3dDevice->IASetIndexBuffer(mIB, DXGI_FORMAT_R32_UINT, 0); and using this code to render vertices: void CQuake3BSP::DrawScene() { int i = m_numOfFaces; //count of faces from bsp file while(i--) { if(m_pFaces.type != FACE_POLYGON) continue; //check if face is of FACE_POLYGON type tBSPFace *pFace = &m_pFaces; //get a pointer to current face md3dDevice->DrawIndexed(pFace->numOfIndices,pFace->startIndex,0); /draw face from start face index } } I set primitive topology to D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST. When I render I see only an xz plane on the screen, and not a level from bsp. Can't understand what am I doing wrong:( Maybe I've mistaken turning the code they used in Opengl for rendering: glVertexPointer(3, GL_FLOAT, sizeof(tBSPVertex), &(m_pVerts[pFace->startVertIndex].vPosition)); glDrawElements(GL_TRIANGLES, pFace->numOfIndices, GL_UNSIGNED_INT, &(m_pIndices[pFace->startIndex]) ); into a directx code: md3dDevice->DrawIndexed(pFace->numOfIndices,pFace->startIndex,0); because I don't know Opengl.All I need is to render vertices without any optimization and textures Any help is appreciated.
  • 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!