Jump to content
  • Advertisement

DX11 Papers for data structures in hlsl without CUDA

Recommended Posts

20 hours ago, Sebastian Werema said:

Do you know any papers that cover custom data structures like lists or binary trees implemented in hlsl without CUDA that work perfectly fine no matter how many threads try to use them at any given time?

HLSL is not a great fit for general purpose solutions for such containers. But if you are looking for a specific technique, then it has great tools to implement a custom fit solution. Lists can be efficiently created using atomics and wave intrinsics, and I also heard of octrees being implemented. Maybe ask if you have anything specific in mind and more people could help? :)

Edited by turanszkij

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
  • Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By chiffre
      In general my questions pertain to the differences between floating- and fixed-point data. Additionally I would like to understand when it can be advantageous to prefer fixed-point representation over floating-point representation in the context of vertex data and how the hardware deals with the different data-types. I believe I should be able to reduce the amount of data (bytes) necessary per vertex by choosing the most opportune representations for my vertex attributes. Thanks ahead of time if you, the reader, are considering the effort of reading this and helping me.
      I found an old topic that shows this is possible in principal, but I am not sure I understand what the pitfalls are when using fixed-point representation and whether there are any hardware-based performance advantages/disadvantages.
      (TLDR at bottom)
      The Actual Post:
      To my understanding HLSL/D3D11 offers not just the traditional floating point model in half-,single-, and double-precision, but also the fixed-point model in form of signed/unsigned normalized integers in 8-,10-,16-,24-, and 32-bit variants. Both models offer a finite sequence of "grid-points". The obvious difference between the two models is that the fixed-point model offers a constant spacing between values in the normalized range of [0,1] or [-1,1], while the floating point model allows for smaller "deltas" as you get closer to 0, and larger "deltas" the further you are away from 0.
      To add some context, let me define a struct as an example:
      struct VertexData { float[3] position; //3x32-bits float[2] texCoord; //2x32-bits float[3] normals; //3x32-bits } //Total of 32 bytes Every vertex gets a position, a coordinate on my texture, and a normal to do some light calculations. In this case we have 8x32=256bits per vertex. Since the texture coordinates lie in the interval [0,1] and the normal vector components are in the interval [-1,1] it would seem useful to use normalized representation as suggested in the topic linked at the top of the post. The texture coordinates might as well be represented in a fixed-point model, because it seems most useful to be able to sample the texture in a uniform manner, as the pixels don't get any "denser" as we get closer to 0. In other words the "delta" does not need to become any smaller as the texture coordinates approach (0,0). A similar argument can be made for the normal-vector, as a normal vector should be normalized anyway, and we want as many points as possible on the sphere around (0,0,0) with a radius of 1, and we don't care about precision around the origin. Even if we have large textures such as 4k by 4k (or the maximum allowed by D3D11, 16k by 16k) we only need as many grid-points on one axis, as there are pixels on one axis. An unsigned normalized 14 bit integer would be ideal, but because it is both unsupported and impractical, we will stick to an unsigned normalized 16 bit integer. The same type should take care of the normal vector coordinates, and might even be a bit overkill.
      struct VertexData { float[3] position; //3x32-bits uint16_t[2] texCoord; //2x16bits uint16_t[3] normals; //3x16bits } //Total of 22 bytes Seems like a good start, and we might even be able to take it further, but before we pursue that path, here is my first question: can the GPU even work with the data in this format, or is all I have accomplished minimizing CPU-side RAM usage? Does the GPU have to convert the texture coordinates back to a floating-point model when I hand them over to the sampler in my pixel shader? I have looked up the data types for HLSL and I am not sure I even comprehend how to declare the vertex input type in HLSL. Would the following work?
      struct VertexInputType { float3 pos; //this one is obvious unorm half2 tex; //half corresponds to a 16-bit float, so I assume this is wrong, but this the only 16-bit type I found on the linked MSDN site snorm half3 normal; //same as above } I assume this is possible somehow, as I have found input element formats such as: DXGI_FORMAT_R16G16B16A16_SNORM and DXGI_FORMAT_R16G16B16A16_UNORM (also available with a different number of components, as well as different component lengths). I might have to avoid 3-component vectors because there is no 3-component 16-bit input element format, but that is the least of my worries. The next question would be: what happens with my normals if I try to do lighting calculations with them in such a normalized-fixed-point format? Is there no issue as long as I take care not to mix floating- and fixed-point data? Or would that work as well? In general this gives rise to the question: how does the GPU handle fixed-point arithmetic? Is it the same as integer-arithmetic, and/or is it faster/slower than floating-point arithmetic?
      Assuming that we still have a valid and useful VertexData format, how far could I take this while remaining on the sensible side of what could be called optimization? Theoretically I could use the an input element format such as DXGI_FORMAT_R10G10B10A2_UNORM to pack my normal coordinates into a 10-bit fixed-point format, and my verticies (in object space) might even be representable in a 16-bit unsigned normalized fixed-point format. That way I could end up with something like the following struct:
      struct VertexData { uint16_t[3] pos; //3x16bits uint16_t[2] texCoord; //2x16bits uint32_t packedNormals; //10+10+10+2bits } //Total of 14 bytes Could I use a vertex structure like this without too much performance-loss on the GPU-side? If the GPU has to execute some sort of unpacking algorithm in the background I might as well let it be. In the end I have a functioning deferred renderer, but I would like to reduce the memory footprint of the huge amount of vertecies involved in rendering my landscape. 
      TLDR: I have a lot of vertices that I need to render and I want to reduce the RAM-usage without introducing crazy compression/decompression algorithms to the CPU or GPU. I am hoping to find a solution by involving fixed-point data-types, but I am not exactly sure how how that would work.
    • By tones31
      Hello. I am looking for an unpaid, hobbiest game developer to help me continue to work on a fully functional game prototype built in PlayCanvas that I have built as a hobby. I intend to release and monetize the game once it is complete.
      About the Game
      The game is entitled "Battle Runes."  It is some strange mixture of scrabble and word search, but instead of English letters it uses Viking runes. Each rune represents an English letter. The game takes place on a board, which is a grid of any size (4x4 for example). Not all squares on the grid are required to exist (there can be holes) but there can never be an incomplete path from one square to the other. The game starts with all squares on the board populated by random Runes. The player clicks and drags Runes around the board from one square to the other, costing them "moves" in the process. Runes can also be stacked vertically if they are the same, which adds both literal and figurative depth to the game. The main point-scoring mechanic is to create English words (like "war", "hello", "sky", etc...) using the viking Runes. Words are automatically found by the game using any of the 8 cardinal directions, just like a word search. Points are rewarded to the player for each word they create, and they get bonus points if a word has extra Runes stack on top.
      The current PlayCanvas prototype is actually the third revision of this game, but it is the one that has made the most progress. The first two revisions were in Unity, and were actually multiplayer games. I abandoned Unity when I found PlayCanvas and ended up rewriting the entire thing in a few weeks versus the few months it took me with Unity. Obviously the advantage was Javascript.
      Who Am I
      I am a full time software developer with a job at an engineering firm. I code daily in C, C++, Javascript, and PHP. I am a full stack developer, creating UI, and backends on Linux, Windows, and even embedded devices (hence the C and C++). I had no idea how to program 5 years ago, and have been learning every language I can get my hands on since. I have worked my way up in my company from a software tester to my current full stack position. 

      I went to game design school about 10 years go to be an artist, so I also have a lot of 3D and 2D experience. But I rarely do that anymore, hence the amazing artwork you will see in the below screenshots. Eventually I will find an artist to replace all prototype assets.

      Why I Need You
      The game concept came from a good friend of mine who, at some point, was heavily involved in the design of the game. He has since floated away from the picture. As I enjoy focusing on programming mechanics, I need someone to help me continue to define the game, including at least a few major modifications. Currently, the game is functional. You can actually win in Adventure Mode or play "forever" in Arcade Mode. The problem is.. the game isn't really that fun. I played a lot of Farm Hero and Juice Jam, and these games kept me coming back because of the challenge and allure. Currently, the game is challenging, but mostly out of bad design. It also feels like the game is really missing some core mechanics. 
      Thus, I am looking for someone who wants to spend time playing the game and figuring out some new mechanics, major or minor, to implement. This must be more than "you should make it like this game.." I am looking for someone who really wants to develop a fun game.
      You Are a Good Fit If...
      1. You really enjoy the design aspect of game development
      2. You have original ideas, but know how to borrow existing mechanics from good games
      3. You have 2-5 hours per week to analyze the game, discuss ideas via voice chat, and create a technical document for the game mechanics
      4. You have strong writing skills (technically) 
      Strong story writing skills for Adventure Mode
      Private PlayCanvas account
      I always hesitate to share the game outright, because literally all the source code can be stolen when using PlayCanvas. I currently have a private account on PlayCanvas to protect this, but will share a temporary public version for those interested by PM only. So here are some screenshots (please enjoy the prototype models and art :] )

      Screenshot 1
      Level 1 starts out with an easy board. Currently, the player is trying to create the word "air" as represented by the secondary word board. Lots of "i"s available. One "a". But no "r"s. In order to get an "r", the player will have to start stacking similar Runes on top of each other to free up space. New Runes fall from the sky to fill empty squares!

      Screenshot 2
      As an example of the main mechanic, dragging and dropping Runes around, the player has clicked the "s" and has swapped it with the "i" (for no real reason..!). Without committing the move, the game has given the player a preview of what would happen if they swapped the "s" and "i".

      Screenshot 3
      In this screenshot, you can see Rune stacking in effect. The player has stacked a bunch of "i"s on top of each other... there's no limit, and it can get pretty funny when you stack lots of runes (queue gravity!).

      Screenshot 4
      Arcade Mode produces completely random boards, but ensures that there are no unreachable squares, thanks to a really amazing JS pathfinding library. You can actually see the pathfinding library in action (follow the blue highlights). Currently the player has swapped the "g" (looks like  <>) and the "b". The pathfinding highlights all the moves the player would have to make if they could only move a Rune one square at a time. This swap will cost 6 moves. Thankfully the pathfinding library finds the shortest path!!

      Thank you for reading this far. Please PM or reply here if you would like more information.
    • By cozzie
      Hi all,
      I was wondering it it matters in which order you draw 2D and 3D items, looking at the BeginDraw/EndDraw calls on a D2D rendertarget.
      The order in which you do the actual draw calls is clear, 3D first then 2D, means the 2D (DrawText in this case) is in front of the 3D scene.
      The question is mainly about when to call the BeginDraw and EndDraw.
      Note that I'm drawing D2D stuff through a DXGI surface linked to the 3D RT.
      Option 1:
      A - Begin frame, clear D3D RT
      B - Draw 3D
      C - BeginDraw D2D RT
      D - Draw 2D
      E - EndDraw D2D RT
      F - Present
      Option 2:
      A - Begin frame, clear D3D RT + BeginDraw D2D RT
      B - Draw 3D
      C - Draw 2D
      D - EndDraw D2D RT
      E- Present
      Would there be a difference (performance/issue?) in using option 2? (versus 1)
      Any input is appreciated.
    • By SomeoneRichards
      Hi there.
      I'm looking for some quick opinions, advice or other comments on my custom engine architecture.
      For better or for worse, I have ended up with an ECS engine. I didn't intend to go this way, but countless searched through Google and the forum seem to confirm that this is the case. I have entities (mere Ids), components (pure data) and systems (holding raw resources and functionality) to operate on them. To be honest, I'm fairly happy with it.
      However, I have yet to implement any actual logic into my 'game', and have been looking around for details on the various ways of handling interactivity, specifically, interactively between entities and components.
      A topic that comes up a lot is events and event queues. I have not liked these. I don't want to add functionality to entities or components, and I don't like the idea of callbacks or event calling firing all over the place. So, I have been puzzling over this for the last two or so days. Eventually, I gave up on the musing and came to accept that some kind of event system is going to be needed. So, I had another look at the bitSquid blog (recommended on this forum), and something occurred to me. Isn't an event really just another form of entity? If it isn't, why isn't it?
      I also realised that I already have something pretty similar running in my engine now. Specifically, my (admitted quite naive) implementation works more or less like this. The scene hands a list of physicalComponents and their corresponding placementComponents, and the collisionDetection sub-system iterates through them, looking for collisions. If it finds one, it creates a collision, adds it to the list, and moves on to the next one. Once it is finished, the collisionResolution sub-system goes through the list, and handles the collisions - again, currently very naively, by bouncing the objects off of one another.
      So, I am wondering if I can just use this same approach to handle logical interactions. Entities with logical requirements have a collection of components related to interactivity (the range, the effect, and so on), and the various sub-systems iterate through potential candidates. If it notices an interaction, it creates an interactionEntity (with the necessary data) and the interactions are processed by the next sub-system.
      I guess I'm looking for some feedback on this idea before I start implementing it. The hope i for more granularity in the components, and the ability to add a logical scripting system which combines various components into potential interactions, and omits the need for any kind of event system. Or am I just repeating the general idea of events and event queues in a slightly more complicated way?
      Additionally, any comments or commentary on this approach (ECS, and so on), would be very gratefully received. I've pretty much run out of resources at this point.
    • By Eios
      I have coded small games and put some of the features from them into a platform game. But I know my art is not appealing and I don't want to plan the story and cut scenes out. That is why I am posting on the collaboration forum to see if anyone wants to make a game out of this.
      Only hobbyists apply. Please don't change your mind about it being a hobby. PM me when making your application.
      My platform engine includes:

      Camera and Movement
      Moveable camera and not binded to player when pressing middle mouse button. Bug free jump. Player direction following mouse cursor. Keyboard movement controls. Mouse movement controls. Environment
      Good collisions. Platforms and diagonal slopes. Stored Statistics
      Level up with statistics. Health bars. Save system. Gameplay
      Basic attack. Self heal. Attack and pull enemies back. Attack and throw enemies in the air. Enemy patrolling area. Enemy getting alerted and starting it's attack stance. Enemy dies and vanishes. Platform jump puzzle. Live cut scenes. Essential Rooms
      Zoning to a new room. Loading rooms. Menu with sounds. Game over room. (Randomized rooms). (Pick who you want to play room). Continue room. Pick a room to play again room. Text Dialogue
      Interacting with NPC displays a message. Ending conversation with a key press. Text typing itself. Fast forwarding text with a key hold. Next text message with a key press. Integrations
      Steam Integration.
  • Advertisement

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!