Today we will be looking at the RenderInterface. I’ve struggled a bit with deciding if it is worth covering this piece of the code or not, as most of the stuff described will likely feel kind of obvious. In the end I still decided to keep it to give a more complete picture of how everything fits together. Feel free to skim through it or sit tight and wait for the coming two posts that will dive into the data-driven aspects of the Stingray renderer.
The glue layer
The RenderInterface is responsible for tying together a bunch of rendering sub-systems. Some of which we have covered in earlier posts (like e.g the RenderDevice) and a bunch of other, more high-level, systems that forms the foundation of our data-driven rendering architecture.
The RenderInterface has a bunch of various responsibilities, including:
-
Tracking of windows and swap chains.
While windows are managed by the simulation thread, swap chains are managed by the render thread. The
RenderInterfaceis responsible for creating the swap chains and keep track of the mapping between a window and a swap chain. It is also responsible for signaling resizing and other state information from the window to the renderer. -
Managing of
RenderWorlds.As mentioned in the Overview post, the renderer has its own representation of game
WorldscalledRenderWorlds. TheRenderInterfaceis responsible for creating, updating and destroying theRenderWorlds. -
Owner of the four main building blocks of our data-driven rendering architecture:
LayerManager,ResourceGeneratorManager,RenderResourceSet,RenderSettingsWill be covered in the next post (I’ve talked about them in various presentations before [1] [2]).
-
Owner of the shader manager.
Centralized repository for all available/loaded shaders. Controls scheduling for loading, unload and hot-reloading of shaders.
-
Owner of the render resource streamer.
While all resource loading is asynchronous in Stingray (See [3]), the resource streamer I’m referring to in this context is responsible for dynamically loading in/out mip-levels of textures based on their screen coverage. Since this streaming system piggybacks on the view frustum culling system, it is owned and updated by the
RenderInterface.
The interface
In addition to being the glue layer, the RenderInterface is also the interface to communicate with the renderer from other threads (simulation, resource streaming, etc.). The renderer operates under its own “controller thread” (as covered in the Overview post), and exposes two different types of functions: blocking and non-blocking.
Blocking functions
Blocking functions will enforce a flush of all outstanding rendering work (i.e. synchronize the calling thread with the rendering thread), allowing the caller to operate directly on the state of the renderer. This is mainly a convenience path when doing bigger state changes / reconfiguring the entire renderer, and should typically not be used during game simulation as it might cause stuttering in the frame rate.
Typical operations that are blocking:
-
Opening and closing of the
RenderDevice.Sets up / shuts down the graphics API by calling the appropriate functions on the
RenderDevice. -
Creation and destruction of the swap chains.
Creating and destroying swap chains associated to a
Window. Done by forwarding the calls to theRenderDevice. -
Loading of the
render_config/ configuring the data-driven rendering pipe.The
render_configis a configuration file describing how the renderer should work for a specific project. It describes the entire flow of a rendered frame and without it the renderer won’t know what to do. It is theRenderInterfaceresponsibility to make sure that all the different sub-systems (LayerManager,ResourceGeneratorManager,RenderResourceSet,RenderSettings) are set up correctly from the loadedrender_config. More on this topic in the next post. -
Loading, unloading and reloading of shaders.
The shader system doesn’t have a thread safe interface and is only meant to be accessed from the rendering thread. Therefor any loading, unloading and reloading of shaders needs to synchronize with the rendering thread.
-
Registering and unregistering of
WorldsCreates or destroys a corresponding
RenderWorldand sets up mapping information to go fromWorld*toRenderWorld*.
Non-blocking functions
Non-blocking functions communicates by posting messages to a ring-buffer that the rendering thread consumes. Since the renderer has its own representation of a “World” there is not much communication over this ring-buffer, in a normal frame we usually don’t have more than 10-20 messages posted.
Typical operations that are non-blocking:
-
Rendering of a
World.void render_world(World &world, const Camera &camera, const Viewport &viewport, const ShadingEnvironment &shading_env, uint32_t swap_chain);Main interface for rendering of a world viewed from a certain
Camerainto a certainViewport. TheShadingEnvironmentis basically just a set of shader constants and resources defined in data (usually containing a description of the lighting environment, post effects and similar).swap_chainis a handle referencing which window that will present the final result.When the user calls this function a
RenderWorldMsgwill be created and posted to the ring buffer holding handles to the rendering representations for the world, camera, viewport and shading environment. When the message is consumed by rendering thread it will enter the first of the three stages described in the Overview post - Culling. -
Reflection of state from a
Worldto theRenderWorld.Reflects the “state delta” (from the last frame) for all objects on the simulation thread over to the render thread. For more details see [4].
-
Synchronization.
uint32_t create_fence(); void wait_for_fence(uint32_t fence);Synchronization methods for making sure the renderer is finished processing up to a certain point. Used to handle blocking calls and to make sure the simulation doesn’t run more than one frame ahead of the renderer.
-
Presenting a swap chain.
void present_frame(uint32_t swap_chain = 0);When the user is done with all rendering for a frame (i.e has no more
render_worldcalls to do), the application will present the result by looping over all swap chains touched (i.e referenced in a previous call torender_world) and posting one or manyPresentFrameMsgmessages to the renderer. -
Providing statistics from the
RenderDevice.As mentioned in the
RenderContextpost, we gather various statistics and (if possible) GPU timings in theRenderDevice. Exactly what is gathered depends on the implementation of theRenderDevice. TheRenderInterfaceis responsible for providing a non blocking interface for retrieving the statistics. Note: the statistics returned will be 2 frames old as we update them after the rendering thread is done processing a frame (GPU timings are even older). This typically doesn’t matter though as usually they don’t fluctuate much from one frame to another. -
Executing user callbacks.
typedef void (*Callback)(void *user_data); void run_callback(Callback callback, void *user, uint32_t user_data_size);Generic callback mechanics to easily inject code to be executed by the rendering thread.
-
Creation, dispatching and releasing of
RenderContextsandRenderResourceContexts.While most systems tends to create, dispatch and release
RenderContextsandRenderResourceContextsfrom the rendering thread there can be use cases for doing it from another thread (e.g. the resource thread createsRenderResourceContexts). TheRenderInterfaceprovides the necessary functions for doing so in a thread-safe way without having to block the rendering thread.
Wrap up
The RenderInterface in itself doesn’t get more interesting than that. Something needs to be responsible for coupling of various rendering systems and manage the interface for communicating with the controlling thread of the renderer - the RenderInterface is that something.
In the next post we will walk through the various components building the foundation of the data-driven rendering architecture and go through some examples of how to configure them to do something fun from the render_config file.
Stay tuned.
Excellent series of posts! Really learned a lot! But i've got one question. Can the engine have multiple Worlds active at once? for example, have the Level in one World and an Overlay GUI in another World?
ReplyDeleteReally appreciate the great and inspirational reading of the series,
ReplyDeleteeagerly waiting for the next post!
I have some questions about memory management though.
After reading the older referenced post "State Reflection" I found myself wondering: who actually owns the RenderMeshObject? I can see that the
WorldRenderInterface allocates RenderMeshObjects and in the end the pointer ends up in the RenderWorld.
The real question is then: In which order are Worlds destroyed and how do you
deallocate the memory if the WorldRenderInterface who allocated the resource does not have pointers to all its allocated RenderMeshObjects (the RenderWorld have all the pointers, but it does not know which allocator the memory belongs to)?
Is the missing piece here that both WorldRenderInterface and RenderWorld
are using the same allocator?
Sorry if it was wrong to ask these questions here and not in the actual article about "State Reflection".
@Dihara Yes, you can have any number of worlds active at once. It's up to the user to decide how she wants to render them.
ReplyDelete@esse Yup, correct. The WorldRenderInterface has a reference to the RenderWorld allocator. Memory for all objects associated with a RenderWorld comes from the same allocator. Next post will be up in an hour or so. Stay tuned. :)
Thanks for your reply, everything makes sense now :)
DeleteWoho post #7 has arrived, this will be a great evening!
This article is very much helpful and i hope this will be an useful information for the needed one. Keep on updating these kinds of informative things...
ReplyDeleteAndroid App Development Company
You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...
ReplyDeletePHP training in chennai
I just want to say that all the information you have given here is awesome...great and nice blog thanks sharing..Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...
ReplyDeleteWeb Design Development Company
Web design Company in Chennai
Web development Company in Chennai
it is really amazing...thanks for sharing....provide more useful information...
ReplyDeleteMobile app development company
These ways are very simple and very much useful, as a beginner level these helped me a lot thanks fore sharing these kinds of useful and knowledgeable information.
ReplyDeleteiOS App Development Company
Office Setup
ReplyDeleteoffice.com/setup
www.office.com/setup
Office Com Setup
Printer Tech Support
www.norton.com/setup
hp Printer Tech Support
Printer Technical Support number
www.norton.com/setup
norton com setup
I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.
ReplyDeleteFitness SMS
Fitness Text
Salon SMS
Salon Text
Investor Relation SMS
Investor Relation Text
MS Office setup is very easy to install, download and redeem. Use of MS Office is also simple and the user can learn the use of it easily. Online help option is also available in all application of the MS Office which provides an instant guideline.
ReplyDeleteoffice.com setup
www.office.com
www office com setup
How you install or reinstall Office 365 or Office 2016 depends on whether your Office product is part of an Office for home or Office for business plan. If you're not sure what you have, see what office.com setup products are included in each plan and then follow the steps for your product. The steps below also apply if you're installing a single, stand-alone Office application such as Access 2016 or Visio 2016. Need Help with office.com/ setup Enter Product Key?
ReplyDeleteoffice.com set up
office com setup
microsoft office product
McAfee provides security for all sorts of users. They supply services and products for home and office at home, enterprise businesses with over 250 workers, and small organizations with under 250 employees, and also venture opportunities.
ReplyDeletemcafee.com activate
mcafee com activate
mcafee activate
We are providing help and support for Microsoft office Setup and activation. Call us or email us the error or problem, our one of the expert contact you with the suitable perfect solution. Get the MS Office application suite and as per your need and see how it is easy to work with Microsoft Office.
ReplyDeleteOffice.com setup
www office com setup
Install Office
setup.office.com
ReplyDeleteBefore you plan to install the Office 2016 or Office 365 on your device be it a Computer, Laptop, Mobile Phone or a Tablet, you are required to take few important steps on of them is to remove any existing Office installations from your PC. Just like the previous Office products, Office 2016 & 365 will conflict with the previously installed versions. So, it becomes necessary to remove the previous office files properly.
setup.office.com
www.office.com/setup
office.com
www.office.com/myaccount
ReplyDeleteTo Setup retail card please visit official website Www.Office.Com/Setup. Office Retail Cards allow you to download your security product from the internet instead of installing from a CD, ensuring recent versions.
www.office.com/myaccount
www.office.com/setup
Microsoft Office product
Fantastic Article ! Thanks for sharing this Lovely Post !!
ReplyDeleteOffice.com/setup - Instructions for Office Setup Installation with the help of this Blog. Get the installation help for Microsoft Office Follow the bearing on the page. you can download and introduce Office, Help with the installation process of Windows 10, Installation process for Office 365 Home
ReplyDeleteFor Installation Help Please Visit...
www.office.com/setup
office setup
Very Nice Blog Updation Keep Updating !!
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteBest Valuable Information check this Latest Modapkbooster
ReplyDeleteAOS TV
Thoptv Apk
blackmart
Ac market
Live Net Tv
King root Apk
Apk's
https://acmarket.xyz/
ReplyDeleteAc market
Ac market apk
Ac market net
Ac market latest version
Ac market download apk
Ac market downloading
Ac market ios
Yahoo Mail users have been seeing their accounts broken into for months. While Yahoo says it has plugged at least two separate security holes leading to accounts getting hijacked, it appears the problem persists. For get full solution yahoo helpline support
ReplyDeleteThank you for sharing this great post, I am very impressed with your post, the information provided is meticulous and easy to understand. I will regularly follow your next post.
ReplyDeleteThanks
Cpa offers
APTRON offers amazon web services training with decision of numerous training areas crosswise over Gurgaon. Our aws training focuses are outfitted with lab offices and amazing framework. We have the best Amazon Web Services (AWS) Training Institute in Gurgaon and furthermore give amazon cloud aws certification training way for our understudies in Gurgaon.
ReplyDeleteFor More Info:- AWS course in Gurgaon
very high quality and useful content .keep sharing such informative informationMovers And Packers In Delhi
ReplyDeleteThanks for amazing information. The post is about Render Interface which is added value to my knowledge. There are few more information about Render Interface that can be covered here.
ReplyDeleteHire software developers
Hire Full Stack Developers
Hire OpenCart Developer
hire opencart developers
hire virtual assistants in india
best digital marketing company in India
Hire Magento Developer
Hire FrontEnd Developer
wedding anniversary wishes wife
ReplyDeleteSky HD(DailyNewsScoop)
ReplyDeleteSky HD (not connected to UK TV channel) only works on Android and is essentially a copy of PlayBox HD. It doesn't have a lot of originality, but it works very well and seems to be reliable.
CinemaBox
CinemaBox is basically another Showbox clone. Add the ability to watch content offline, which is great if you don't always have WiFi access or are planning a long vacation in the woods but want to take some movies with you. CinemaBox is available on both Android and iOS.
Online religion research paper writing services are very difficult to complete and many students are always searching for Religion Research Paper Services companies to help them complete their custom religion essay writing services.
ReplyDeleteWOW! I Love it...
ReplyDeleteand i thing thats good for you >>
LISA BLACKPINK คว้าที่ 1 สวยสุดในเอเชีย 2020
Thank you!
A good website is useful.
ReplyDeletedavorpalo.com/
gp32us.com/
Suggest good information in this message, click here.
ReplyDeletesupremebet.xyz
easybugtracker.com
If you are the one looking for technical help in AOL mail then call us today at AOL Mail Support Number and get connected with our award-winning team of AOL Mail Services. They are capable of resolving the technical bugs and issues.
ReplyDeleteAOL Mail Support Number
Recover Hacked AOL Mail Account
Forgot AOL Mail Password
Change AOL Email Password
Recover AOL Password
Reset AOL Mail Password
Install AOL Desktop Gold
Download AOL Desktop Gold
AOL Desktop Gold Update Error
AOL Shield Pro Support
I think this article is useful to everyone.
ReplyDeleteสล็อต Slot online ฟรีเครดิต ไม่ต้องฝาก 2019"
ซื้อหวยออนไลน์ เว็บไหนดี"
หวยออนไลน์ lottovip"
หวยฮานอย เล่นยังไง"
Wow! I really enjoyed reading your article. I would like to read some more which I hope you will keep sharing.
ReplyDeleteDownload HP Support Assistant 2021
Download HP Support Assistant
HP Support Assistant
HP Printer Support Assistant
Download HP Printer Support Assistant
click on one of the sites below to get a variety of the best tips and tricks in life.
ReplyDeleteresult togel
I have been on your site quite often but have not gone through this stuff. I like the information and want to speak about the same over my social channels. Hope you don't mind sharing your piece on my social network.
ReplyDeleteOffshore Software Development
app development
Front End Developer
I have just come across your post and I believe this is exactly what I am looking for. I want an economics assignment help from a tutor who can guarantee me a top grade. Do you charge per page or does it depend on the
ReplyDeletebulk of the economics homework help being completed? More to that if the work is not good enough do you offer free corrections.
Matlab Assignment Help helped me to complete my seventh Matlab assignment, which was also the best-performed! It scored 92/100, which I've never scored before on any other assignment/exam in my lifetime. Otherwise, their service was as quick as usual. The delivery was also on time. I'm now requesting to use this same programmer multiple times. He seems the best in Image Processing tasks. Meanwhile, I'll ask for more Matlab Homework Help soon.
ReplyDeleteI am looking for a Statistics Assignment Help expert for Statistics Homework Help. I have struggled enough with statistics and therefore I just can't do it anymore on my own. . I have come across your post and I think you are the right person to provide me with SPSS homework help. Let me know how much you charge per assignment so that I can hire you today.
ReplyDeleteBesides my C course, I have a job and family, both of which compete to get my time. I couldn't find sufficient time for the challenging C assignments, and these people came in and saved my skin. I must commend them for the genius Programming Assignment Help. Their C Homework Help tutors did the best job and got me shining grades.
ReplyDeleteHi, other than economics assignment help are there other subjects that you cover? I am having several assignments one needs an economics homework help expert and the other one needs a financial expert. If you can guarantee quality work on both then I can hire you to complete them. All I am sure of is that I can hire you for the economics one but the finance one I am not sure.
ReplyDeleteMe and my classmates took too long to understand Matlab Assignment Help pricing criteria. we're always grateful for unique solutions on their Matlab assignments. Matlab Homework Help experts have the right experience and qualifications to work on any programming student's homework. They help us in our project.
ReplyDeleteHey STATA homework help expert, I need to know if you can conduct the Kappa measurement of agreement. This is what is in my assignment. I can only hire someone for statistics assignment help if they are aware of the kappa measurement of agreement. If you can do it, then reply to me with a few lines of what the kappa measure of agreement is. Let me know also how much you charge for statistics homework help in SAS.
ReplyDeleteThe ardent Programming Homework Help tutor that nailed down my project was very passionate. He answered my Python questions with long, self-explanatory solutions that make it easy for any average student to revise. Moreover, he didn't hesitate to answer other questions, too, even though they weren't part of the exam. If all Python Homework Help experts can be like this then they can trend as the best Programming school ever online.
ReplyDeleteSuch a great Information. Thanks for sharing with us.
ReplyDeleteAkshi Engineers Pvt. Ltd. is a major producer, exporter, and retailer of bar separating shears in India. The Bar Dividing Shear machine is easy to use and maintain. It is specially designed for shearing and cutting in steel rolling mills.
Thanks for the great content and sharing. Oflox is the best Digital Marketing Write For Us platform.
ReplyDeleteHello. Please check the task I have just sent and reply as soon as possible. I want an adjustment assignment done within a period of one week. I have worked with an Accounting Homework Help tutor from your team and therefore I know it’s possible to complete it within that period. Let me know the cost so that I can settle it now as your Accounting Assignment Help experts work on it.
ReplyDeleteThat is a huge number of students. Are they from the same country or different countries? I also want your math assignment help. I want to perform in my assignments and since this is what you have been doing for years, I believe you are the right person for me. Let me know how much you charge for your math homework help services.
ReplyDeleteI don’t have time to look for another expert and therefore I am going to hire you with the hope that I will get quality economics assignment help .Being aneconomics homework help professor I expect that your solutions are first class. All I want to tell you is that if the solutions are not up to the mark I am going to cancel the project.
ReplyDeleteHey there, I need an Statistics Homework Help expert to help me understand the topic of piecewise regression. In our lectures, the concept seemed very hard, and I could not understand it completely. I need someone who can explain to me in a simpler way that I can understand the topic. he/she should explain to me which is the best model, the best data before the model and how to fit the model using SPSS. If you can deliver quality work then you would be my official Statistics Assignment Help partner.
ReplyDeleteBrilliant Information. I apprecaite your skills and your knowledge. Thanks for sharing this information.
ReplyDeleteAre you looking for fine-tuned Rolling Mill Drives & Automation control solutions to increase process stability, reduce downtime, and ensure consistent product quality? Don't need to go anywhere. The Akshi automation team brings together a rare combination of long production process expertise and electrical device knowledge to ensure that our technology solutions boost mill efficiency, ensure reliable production, and deliver premium product quality.
ReplyDeleteI’m glad to find another amazing app development blogger.
on demand service app development
google 1861
ReplyDeletegoogle 1862
google 1863
google 1864
google 1865
google 1866
A new type of investment That is ready to make money continuously With the best casino services.
ReplyDeleteเว็บสล็อตแตกง่าย
หวยออนไลน์ 2021
เว็บบาคาร่า อันดับ 1
ReplyDeletejoker123
ฝากถอนไวมาก