Handling depth sorting key and hardware instancing (2024)

Graphics and GPU Programming Programming

Started by lipsryme March 27, 2013 03:31 PM

21 comments, last by Adaline 11years, 2months ago

lipsryme

1,522

Author

March 27, 2013 03:31 PM

Is it even possible ?

I'm creating draw calls as a pair of <sort key, ptr to draw call data> which I then sort after the key that stores my depth (32bit unsigned integer). Now as I would create a draw call for let's say an instance of 10000 objects how would I be able to sort these 10000 objects after their depth when it's just a single draw call that I'm creating.

Advertisem*nt

Krohm

5,051

March 27, 2013 04:06 PM

It does not work that way. You have no guarantee on the order of execution (much less on the order of completion) inside a single draw-call.

It's really simple. Multiple execution units --> race conditions. You see those GPU blocks on every article each time a new GPU is released.

The only decent way to do order-independant-transparency is using D3D11 linked lists in my opinion.

edit: wrong!

Previously "Krohm"

What are you trying to accomplish with this? I have to agree with Krohm, there is no way to sort the order that your instances are going to be rendered, unless you are directly using an explicit sorting mechanism (i.e. depth sorting with a depth buffer!). Depending on what you are trying to do, there might be some alternative suggestions that we could make...

Jason Zink :: DirectX MVP

Direct3D 11 engine on CodePlex: Hieroglyph 3

Direct3D Books: Practical Rendering and Computation with Direct3D 11, Programming Vertex, Geometry, and Pixel Shaders
Articles: Dual-Paraboloid Mapping Article :: Parallax Occlusion Mapping Article (original):: Fast Silhouettes Article

Games: Lunar Rift

lipsryme

1,522

Author

March 27, 2013 05:19 PM

Well I'm trying to sort my draw calls. But in that case it seems I will have to give up on sorting them. I just find it interesting that in the frostbite 2.0 paper they say that they just assume everything as instanced. So they also just give up on sorting opaques front to back?

Jason Z

6,437

March 27, 2013 05:23 PM

Don't they use a variant of deferred rendering? If so, then it is very likely that they do a depth pre-pass which would make it not so important to have depth sorting. I haven't read through the paper yet though - do you have a link to it?

Jason Zink :: DirectX MVP

Direct3D 11 engine on CodePlex: Hieroglyph 3

Direct3D Books: Practical Rendering and Computation with Direct3D 11, Programming Vertex, Geometry, and Pixel Shaders
Articles: Dual-Paraboloid Mapping Article :: Parallax Occlusion Mapping Article (original):: Fast Silhouettes Article

Games: Lunar Rift

lipsryme

1,522

Author

March 27, 2013 07:30 PM

I'm having a similar problem now with opaque / transparent objects. In a deferred renderer I'd render them seperately as a forward pass after the opaque + lighting, correct? But what happens if there's 200 of the same plane, but 1 of them is now being changed (by the user) to be transparent.

So before I had an instancegroup of 200 objects. The only solution would be to remove this object from the previous instance group and add it to a new one I guess ? But then I'd have to always check for every object if it has changed from opaque to transparent during runtime. This sounds very complicated...

MJP

20,297

March 27, 2013 08:46 PM

It does not work that way. You have no guarantee on the order of execution (much less on the order of completion) inside a single draw-call.

It's really simple. Multiple execution units --> race conditions. You see those GPU blocks on every article each time a new GPU is released.

The only decent way to do order-independant-transparency is using D3D11 linked lists in my opinion.


The order that a primitive is rasterized and written to a render target is the same as the order in which you submit those primitives. This is part of the DX spec, and is guaranteed by the hardware. In fact the hardware has to jump through a lot of hoops to maintain this guarantee while still making use of multiple hardware units. This means that if you were able to perfectly sort all primitives in a mesh by depth, you would get perfect transparency. The same goes for multiple instances in a single draw call. The only case that's totally impossible to handle without OIT is the case of intersecting primitives.

Jason Z

6,437

March 28, 2013 01:29 AM

It does not work that way. You have no guarantee on the order of execution (much less on the order of completion) inside a single draw-call.

It's really simple. Multiple execution units --> race conditions. You see those GPU blocks on every article each time a new GPU is released.

The only decent way to do order-independant-transparency is using D3D11 linked lists in my opinion.


The order that a primitive is rasterized and written to a render target is the same as the order in which you submit those primitives. This is part of the DX spec, and is guaranteed by the hardware. In fact the hardware has to jump through a lot of hoops to maintain this guarantee while still making use of multiple hardware units. This means that if you were able to perfectly sort all primitives in a mesh by depth, you would get perfect transparency. The same goes for multiple instances in a single draw call. The only case that's totally impossible to handle without OIT is the case of intersecting primitives.

Are you sure about this behavior? How can this be assured when multiple primitives are being rasterized in parallel? There is also some gray area regarding generated primitives too (via tessellation or the geometry shader) as they can be generated in parallel instances of the shaders...

I have always heard that the order is roughly equivalent to the order they are submitted in, but that they are explicitly not guaranteed to be processed in exact order.

Jason Zink :: DirectX MVP

Direct3D 11 engine on CodePlex: Hieroglyph 3

Direct3D Books: Practical Rendering and Computation with Direct3D 11, Programming Vertex, Geometry, and Pixel Shaders
Articles: Dual-Paraboloid Mapping Article :: Parallax Occlusion Mapping Article (original):: Fast Silhouettes Article

Games: Lunar Rift

JohnnyCode

1,084

March 28, 2013 04:14 AM

I have always heard that the order is roughly equivalent to the order they are submitted in, but that they are explicitly not guaranteed to be processed in exact order.

It is guranteed at least at successive Pass::Begin Pass::End encapsuled instructions, but I have tested multiple DrawIndexedPrimitive in one pass (to save some overhead), and it was successive I can tell (since I did stencil shadow 2 back front passes). But as you said, I am not sure of this, and it seems I will implement it in 2 passes, to avoid breaking my game on some GPUs or drivers. Do not know, I cannot test profile all GPUs and I just don't trust them, I wanna sleep well. Interesting topic.

MJP

20,297

March 28, 2013 06:15 AM

It does not work that way. You have no guarantee on the order of execution (much less on the order of completion) inside a single draw-call.

It's really simple. Multiple execution units --> race conditions. You see those GPU blocks on every article each time a new GPU is released.

The only decent way to do order-independant-transparency is using D3D11 linked lists in my opinion.


The order that a primitive is rasterized and written to a render target is the same as the order in which you submit those primitives. This is part of the DX spec, and is guaranteed by the hardware. In fact the hardware has to jump through a lot of hoops to maintain this guarantee while still making use of multiple hardware units. This means that if you were able to perfectly sort all primitives in a mesh by depth, you would get perfect transparency. The same goes for multiple instances in a single draw call. The only case that's totally impossible to handle without OIT is the case of intersecting primitives.

Are you sure about this behavior? How can this be assured when multiple primitives are being rasterized in parallel? There is also some gray area regarding generated primitives too (via tessellation or the geometry shader) as they can be generated in parallel instances of the shaders...

I have always heard that the order is roughly equivalent to the order they are submitted in, but that they are explicitly not guaranteed to be processed in exact order.


Definitely. You're never guaranteed about the order in which vertices/primitives/pixels are processed in the shader units, but the ROPS will guarantee that the final results written to the render target match the triangle submission order (which is often done by buffering and re-ordering pending writes from pixel shaders). This is even true for geometry shaders, which is a big part of what makes them so slow.

Handling depth sorting key and hardware instancing (2024)
Top Articles
How to Make Gluhwein (German Mulled Wine Recipe)
Easy & Delicious Brookies Recipe - Half-Scratched
Mw2 Other Apps Vram
19 Awesome Things to Do in Redmond, Oregon
Behind the Screens: Understanding the Wisconsin Volleyball Team Leak
Cmx Cinemas Gift Card Balance
Which is better, bonds or treasury bills?
Mit 5G Internet zu Hause genießen
Ropro Cloud Play
Bomei Massage
Wat is 7x7? De gouden regel voor uw PowerPoint-presentatie
Scholar Dollar Nmsu
How 'The Jordan Rules' inspired template for Raiders' 'Mahomes Rules'
Www Craigslist Antelope Valley
Tyrone Unblocked Games Bitlife
Natural Appetite Suppressant Tea Fat Loss Diet Plan For Male Bodybuilding (Safe) << Silbonah
18002226885
Gina's Pizza Port Charlotte Fl
Equity Livestock Monroe Market Report
Lima Crime Stoppers
Watch My Best Friend's Exorcism Online Free
Reapers Tax Barotrauma
Palindromic Sony Console For Short Crossword Clue 6 Letters: Composer Of
Baby | Voeding | Voeding het eerste jaar; borstvoeding
Left Periprosthetic Femur Fracture Icd 10
Brublackvip
Rugrats in Paris: The Movie | Rotten Tomatoes
Korslien Auction
Harry Potter 3 123Movies
Most Popular Pub food in Lipetsk, Lipetsk Oblast, Russia
Solarmovies Rick And Morty
Acadis Portal Missouri
Probation中文
Tires Shop Santoyo
Sierra Vista Jail Mugshots
Star News Mugshots
TWENTY/20 TAPHOUSE, Somerset - Menu, Prices & Restaurant Reviews - Order Online Food Delivery - Tripadvisor
Kutty Com Movies
Puppies For Sale in Netherlands (98) | Petzlover
Top 100 Golfclubs - Albrecht Golf Guide bei 1Golf.eu
C Spire Express Pay
Sallisaw Bin Store
Showbiz Waxahachie Bowling Hours
Wyoming Roads Cameras
Power Outage Chehalis
Gaylia puss*r Davis
Azpeople Self Service
Vorschau: Battle for Azeroth – eine Tour durch Drustvar
Csuf Mail
Lubbock Avalanche Journal Newspaper Obituaries
NBA 2K: 10 Unpopular Opinions About The Games, According To Reddit
Latest Posts
Article information

Author: Laurine Ryan

Last Updated:

Views: 6425

Rating: 4.7 / 5 (77 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Laurine Ryan

Birthday: 1994-12-23

Address: Suite 751 871 Lissette Throughway, West Kittie, NH 41603

Phone: +2366831109631

Job: Sales Producer

Hobby: Creative writing, Motor sports, Do it yourself, Skateboarding, Coffee roasting, Calligraphy, Stand-up comedy

Introduction: My name is Laurine Ryan, I am a adorable, fair, graceful, spotless, gorgeous, homely, cooperative person who loves writing and wants to share my knowledge and understanding with you.