Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

139 Neutral

About Daban

  • Rank
  1. Daban

    dynamic branching in GPU

    I found some other threads similar to my question, so please ignore this one. Sorry.
  2. Can you explain, why dynamic branching in GPU is considered as an expensive operation? How many instructions (or in other criteria) does it usually cost? Thanks.
  3. Good for me! I managed to remove one of my render targets. Now my engine extracts view space position from the same depth stencil buffer which is used for stencil operations. For anyone who don’t know how to create a read only view to depth stencil buffer, this is the gist: ID3D11Texture2D *Texture; D3D11_TEXTURE2D_DESC TextureDescription; ID3D11DepthStencilView *DepthStencilView; D3D11_DEPTH_STENCIL_VIEW_DESC DepthStencilViewDescription; ID3D11DepthStencilView *DepthStencilViewReadOnly; D3D11_DEPTH_STENCIL_VIEW_DESC DepthStencilViewReadOnlyDescription; ID3D11ShaderResourceView *ShaderResourceView; D3D11_SHADER_RESOURCE_VIEW_DESC ShaderResourceViewDescription; TextureDescription.ArraySize = 1; TextureDescription.CPUAccessFlags = 0; TextureDescription.MipLevels = 1; TextureDescription.MiscFlags = 0; TextureDescription.Usage = D3D11_USAGE_DEFAULT; TextureDescription.Format = DXGI_FORMAT_R24G8_TYPELESS; TextureDescription.BindFlags = D3D11_BIND_DEPTH_STENCIL|D3D11_BIND_SHADER_RESOURCE; TextureDescription.Height = Height; TextureDescription.Width = Width; TextureDescription.SampleDesc.Count = SampleCount; TextureDescription.SampleDesc.Quality = SampleQuality; // Create the actual resource Device->CreateTexture2D(&TextureDescription, nullptr, &Texture); // Create Read-Write view, GPU can write to this view because the resource is created with “D3D11_USAGE_DEFAULT” usage and we don’t use any flag with view description. DepthStencilViewDescription.Flags = 0; DepthStencilViewDescription.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMS; Device->CreateDepthStencilView(Texture, &DepthStencilViewDescription, &DepthStencilView); // Create Read Only view, we use non-zero flags. DepthStencilViewReadOnlyDescription.Flags = D3D11_DSV_READ_ONLY_DEPTH; // there is another flag for stencil buffer DepthStencilViewReadOnlyDescription.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; Device->CreateDepthStencilView(Texture, &DepthStencilViewReadOnlyDescription, &DepthStencilViewReadOnly); ShaderResourceViewDescription.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS; ShaderResourceViewDescription.Format = DXGI_FORMAT_R24_UNORM_X8_TYPELESS; Device->CreateShaderResourceView(Texture, &ShaderResourceViewDescription, &ShaderResourceView); Now we can use the shader resource view and the read only depth stencil view simultaneously. I didn’t compile the code, so there may be some syntax errors etc… Thank you very much, that was awesome!
  4. I have seen some examples of using tiled approach, but I'm not sure how to implement that. Let me check google. thaks.
  5. I have seen some examples of using tiled approach, but I'm not sure how to implement that. Let me check google. thaks.
  6. Please check my approach for deferred shading algorithm (DX 11) and see if it is possible to optimize it. Generate G-Buffer. Also use a separate depth stencil buffer. Since this buffer is required for lighting pass, we can’t just create a shader resource view of it, so store view space depth as 16 bit float in one of the render targets. Switch to single render target mode, still using the same depth stencil buffer we used for scene rendering. Draw a screen aligned quad, use “0.25 * albedo” to simulate scene ambient lighting. Where albedo is diffuse color from G-Buffer. For each light in the list (assuming the list is optimized) draw light volume mesh (in two passes) in order to detect pixels inside the light volume (use depth stencil buffer). Draw a screen aligned quad again, but this time use a lighting algorithm appropriate for current light type (use G-Buffer to retrieve view space depth). While using stencil buffer restricts the calculations to where they should be applied, but this step requires switching between meshes and shaders and render states (light volume <=> quad and associated shaders with them). I also have a problem with step D. If camera was inside the light volume, front faces of the mesh would be discarded and this ruins everything. Thank you.
  7. It's a shame! I didn't know that. I had better google it. Thank you very much.
  8. Ok, it makes sense. Since size of XMVECTOR is small enough, we can work with itself rather than its address. But I think we can’t say the same for any type of data. Can we?
  9. Thank you so much. About 1st question, Yes, I mean the reason for passing arguments by value and reference instead of using pointers.
  10. Hi every one; Considering XNA Math library, the API functions don’t use pointers with XMVECTOR. Why? ID3D11Device:: CreatInputLayout wants to check our vertex shader for compatibility with the defined vertex layout, so it is necessary to have a vertex shader at mesh creation time. While one may use the layout with different shaders, what is the necessity of this rule and is there any way to get rid of that? Thank you.
  11. Yes it would be impossible if I wanted to do all that, myself alone, but I want an app that provides the basic parts of an editor and allow users add their own code. Actually I did that!
  12. All of them! of course it requires programming tools and my editor allow users add thier own "Editing Code" by making a plugin.
  13. Recently I tried to develop a level editor for my small homemade game engine. As you know stuff like this is very time consuming and in most cases the result compared to the commercial soft wares is poor. After hours of work, using different developing packages, I came to an Idea and that is about developing a general purpose editor. I know this can't be a new one, but if you Google it, you won't get anything considerable. I tried and made a basic version of an editor that allows end users make their own editor by combining tools that my general purpose editor provides. It comes with mechanisms for UI customization, defining custom options, implementing commands, developing plugins and etc. My editor is too poor to share it with others, but I want to know what you think about the whole Idea. Thank you for your attention.
  • 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!