of 74
8/9/2019 NVIDIA OpenGL Beyond Porting
1/74
Beyond Porting
How Modern OpenGL can
Radically Reduce Driver
8/9/2019 NVIDIA OpenGL Beyond Porting
2/74
Who are we?
Cass veritt! "#$D$% Corporation
&ohn McDonald! "#$D$% Corporation
8/9/2019 NVIDIA OpenGL Beyond Porting
3/74
What will we cover?
Dyna'ic Bu((er Generation
((icient )e*ture Manage'ent
$ncreasing Draw Call Count
8/9/2019 NVIDIA OpenGL Beyond Porting
4/74
Dyna'ic Bu((er Generation
Pro+le'Our goal is to generate dyna'ic geo'etry directly in place,
$t will +e used one ti'e! and will +e co'pletely regenerated
Particle syste's are the 'ost co''on e*a'ple
#egetation - (oliage also co''on
8/9/2019 NVIDIA OpenGL Beyond Porting
5/74
)ypical .olution
voidUpdateParticleData(uint_dstBuf) {
BindBuffer(ARRAY_BUFFER, _dstBuf);
access !AP_U"#Y"$%R&"'ED !AP_*R'+E_B'+;
forparticle inallParticles {
data#ie -etParticle#ie(particle);
void. dst !apBuffer(ARRAY_BUFFER, offset, data#ie
(.(Particle.)dst) .particle; Un/apBuffer(ARRAY_BUFFER);
offset 0 data#ie;
1
1;
22 "o3 render 3it4 ever5t4in67
8/9/2019 NVIDIA OpenGL Beyond Porting
6/74
)he horror
void UpdateParticleData(uint _dstBuf) {
BindBuffer(ARRAY_BUFFER, _dstBuf);
access !AP_U"#Y"$%R&"'ED !AP_*R'+E_B'+;
for particle in allParticles {
data#ie -etParticle#ie(particle);
void. dst !apBuffer(ARRAY_BUFFER, offset, data#ie
(.(Particle.)dst) .particle; Un/apBuffer(ARRAY_BUFFER);
offset 0 data#ie;
1
1;
22 "o3 render 3it4 ever5t4in67
+4is is soslow.
8/9/2019 NVIDIA OpenGL Beyond Porting
7/74
Driver interlude
/irst! a 0uic1 interlude on 'odern GL drivers
$n the application 2client3 thread! the driver is very thin$t si'ply pac1ages wor1 to hand o(( to the server thread,
)he server thread does the real processing$t turns co''and se0uences into push +u((er (rag'ents,
8/9/2019 NVIDIA OpenGL Beyond Porting
8/74
Healthy Driver $nteraction #isuali4ed
Application
Driver (Client)
GPU
Driver (Server)
Thread separator
Component separator
State Change
Action Method
Present
8/9/2019 NVIDIA OpenGL Beyond Porting
9/74
M%P56".7"CHRO"$8D
%voids an application9GP6 sync point 2a CP69GP6 sy
But causes the Client and .erver threads to seriali4e)his (orces all pending wor1 in the server thread to co'plet
$t:s 0uite e*pensive 2al'ost always needs to +e avoided3
8/9/2019 NVIDIA OpenGL Beyond Porting
10/74
Healthy Driver $nteraction #isuali4ed
Application
Driver (Client)
GPU
Driver (Server)
Thread separator
Component separator
State Change
Action Method
Present
8/9/2019 NVIDIA OpenGL Beyond Porting
11/74
Client9.erver .tall o( .adness
Application
Driver (Client)
GPU
Driver (Server)
Thread separator
Component separator
State Change
Action Method
Present
8/9/2019 NVIDIA OpenGL Beyond Porting
12/74
$t:s o1ay
;< What:s +etter than 'apping in an unsynchroni4ed '
%< =eeping around a pointer to GP69visi+le 'e'ory fo
$ntroducing< %RB5+u((er5storage
8/9/2019 NVIDIA OpenGL Beyond Porting
13/74
%RB5+u((er5storage
Conceptually si'ilar to %RB5te*ture5storage 2+ut (or
Creates an i''uta+le pointer to storage (or a +u((er)he pointer is i''uta+le! the contents are not,
.o Bu((erData cannot +e called>Bu((er.u+Data is still o1ay
%llows (or e*tra in(or'ation at create ti'e,
/or our usage! we care a+out the PR.$.)") and CO+its,
PR.$.)")< %llow this +u((er to +e 'apped while the GP6
COHR")< Client writes to this +u((er should +e i''ediatethe GP6,
http
8/9/2019 NVIDIA OpenGL Beyond Porting
14/74
%RB5+u((er5storage cont:d
%lso a((ects the 'apping +ehavior 2pass persistent an
+its to MapBu((erRange3Persistently 'apped +u((ers are good (or