• Non ci sono risultati.

computazioniper frammento

N/A
N/A
Protected

Academic year: 2021

Condividi "computazioniper frammento"

Copied!
2
0
0

Testo completo

(1)

1

Computer Graphics

Marco Tarini

Università dell’Insubria Corso di Laurea in Informatica Anno Accademico 2014/15

Meshes? In Video RAM !

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 4 / 1 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

Reminder: Colli di bottiglia...

Fr am m en ti & at tri bu ti in te rp ol at i

Screen buffer

rasterizer lines rasterizer

triangles rasterizer points

co m pu ta zi on i pe r f ra m m en to

Qui? Allora applicazione

“transofrm limited”

(o “gemoetry limited”)

QUI?

Allora applicazione

“fill limited”

(pipeline di rendering semplificata)

Ve rti ci & lo ro a ttr ib ut i Ve rti ci p or ie tta ti & at tri bu ti co m pu ta ti co m pu ta zi on i pe r v er tic e

Reminder:

Schema (semplificato) di: “PC con scheda video”

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 4 / 1 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

BUS

CPU

ALU

(central)

RAM

Disk Scheda video

bus interno bus interno

(scheda video) (sch. video) RAM GPU

a.k.a.

System RAM or CPU RAM

a.k.a.

Video RAM or GPU RAM

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 4 / 1 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

Colli di bottiglia:

può essere anche la comunicazione!

Fr am m en ti & at tri bu ti in te rp ol at i

Screen buffer

rasterizer lines rasterizer

triangles rasterizer points

co m pu ta zi on i pe r f ra m m en to

collo di bottiglia qui?

applicazione BUS LIMITED (o BANDWIDTH LIMITED)

Ve rti ci p or ie tta ti & at tri bu ti co m pu ta ti co m pu ta zi on i pe r v er tic e

Ve rti ci & lo ro a ttr ib ut i

SY ST EM R AM

(2)

2

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 4 / 1 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

“Geometry on board”

Fr am m en ti & at tri bu ti in te rp ol at i

Screen buffer

rasterizer lines rasterizer

triangles rasterizer points

co m pu ta zi on i pe r f ra m m en to

SY ST EM R AM

solo tantoogni

Ve rti ci & lo ro a ttr ib ut i Ve rti ci p or ie tta ti & at tri bu ti co m pu ta ti co m pu ta zi on i pe r v er tic e

Buffers per tenere

le mesh (in GPU RAM!)

Meshes in GPU ram

• Idea: tenere le mesh

(geometria + attributi + connettività) direttamente a bordo della RAM

della Scheda Video («video RAM», «GPU RAM»)

• Vantaggi:

– non si consuma banda (del bus fra sch. madre e video)!

• Svantaggi:

– duplicazione («mirroring») ? (SytemRAM + VideoRAM) – occhio alle modifiche

(specializzare strutture dati per mesh che si modificano spesso, e non)

• Cmq, scelta obbligata in molti API

– (fra cui vers recenti di OpenGL, WebGL, GL-ES,…)

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 4 / 1 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

Meshes in GPU ram: nelle API

• In OpenGL

– Display list (deprecate)

– Vertex Buffer Objects (VBO) + Vertex Array – …

• In WebGL – Vertex Buffers

• (geometria + attributi della mesh)

• NB: in WebGL terminology, geometry is just another attribute – Index buffer

• connettività della mesh (opzionale)

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 4 / 1 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

Back compatibility notes:

• Good old “Immediate Mode”

– Mesh in System RAM,

mandate attr. il bus vertice a vertice – Vecchia scuola OpenGL

• (deprecato da Ver 2.0 in poi)

• (non supportato in ES, WebGL)

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 4 / 1 5 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

glBegin( GL_TRIANGLES );

glColor3f(1.0f, 0.0f, 0.0f); glVertex2f(0.0f, 1.0f);

glColor3f(0.0f, 1.0f, 0.0f); glVertex2f(0.87f, -0.5f);

glColor3f(0.0f, 0.0f, 1.0f); glVertex2f(-0.87f, -0.5f);

glEnd();

attrib 1movertice pos 1movertice

Riferimenti

Documenti correlati

TILE_WIDTH=16, all the 256 threads of a thread block are involved in filling the upper part of the shared memory above the green line, while 145 are involved in filling the

• Historically BLAS has been developed in Fortran, and to maintain compatibility CuBLAS uses column-major. storage, and

More specifically, the GPU is especially well-suited to address problems that can be expressed as data-parallel computations the same program is executed on many data elements

• In fact, threads in a block can access a very fast shared (private) memory, visible only inside the block. • Then we could just read blockDim.x items to the shared

• When all threads of a warp execute a load instruction, if all accessed locations fall into the same burst section, only one DRAM request will be made and the access is fully

In the first iteration of the while loop, each thread index the input buffer using its global thread index: Thread 0 accesses element 0, Thread 1. accesses element

regione che contiene una copia di diversi siti di restrizione.. Vettori

Figure matematiche virtuali, denomi- nate “frattali”, in ragione della loro peculiarità che risiede nel conservare la stessa forma a tutte le scale di grandezza: la loro