SlideShare a Scribd company logo
1 of 29
Download to read offline
Woden 2: Developing a modern 3D
graphics engine
Ronie Salgado
Universidad de Chile
Talk Outline: Foundations
● Why rewriting Woden?
– OpenGL problems
– Classic graphics API (OpenGL, Direct 3D except 12)
– “Modern” PC architecture
– Modern graphics API (Vulkan, Direct 3D 12 and Metal)
● Core abstraction layers
– AbstractGPU
– Dastrel (Data Stream Language)
– Slovim (Dastrel back-end)
Talk Outline: Woden 2 Layers
● WodenMath library
● Core
– Pipeline state cache
– Resource cache
– GPU resource management
● Basic layers
– Scene graph
– Woden athens backend
● Application layers
– Woden Roassal ported to Woden 2
– Woden 2 Game System
– Level Editor
Why rewriting Woden 2?
● OpenGL is very complex.
● OpenGL drivers are very buggy!
– NVIDIA does not follow strictly the spec.
– AMD is very strict.
– Intel, OS specific behavior.
● OpenGL uses a thread local context.
● OpenGL is old.
● GLSL compiler is in the driver.
Choose a desktop OpenGL version
OpenGL GLSL
1.2 Not available
2.0 1.10
2.1 1.20
3.0 1.30
3.1 1.40
3.2 1.50
3.3 3.30
4.0 4.00
4.1 4.10
4.2 4.30
4.4 4.40
4.5 4.50
Classic graphics API
Canvas
Shader
CPU
● Set shader, depth buffer state, ...
● Set texture.
● Set vertex buffer.
● Set index buffer.
● Draw indexed elements.
GPU/CP
“Modern” PC Architecture
CPU
RAM
IOMMU VRAM
GPU
CP
Modern Low-Level Graphics API
CPU
CPCommand List
Pipeline State Object
Vertex BufferUniform Buffer Index Buffer
GPUMMap
Texture
Descriptor Set
DMA
Core Abstraction Layers
● AbstractGPU
– https://github.com/ronsaldo/abstract-gpu
● Dastrel (Data Stream Language)
– http://smalltalkhub.com/#!/~ronsaldo/Dastrel
● Slovim (LLVM inspired typed SSA form)
– http://smalltalkhub.com/#!/~ronsaldo/Slovim
AbstractGPU
● Abstraction above Vulkan, Metal and D3D 12.
● API in C inspired by OpenCL
● Implementation in C++
● XML spec for headers and bindings
● Mostly tested with Vulkan in Linux
Dastrel (Data Stream Language)
● Intended to be a semi-visual language
● Statically typed
● Syntax inspired by C, Rust, Swift and Smalltalk
● Dumb type inference
● Compiler front-end written in Pharo
● Emits Slovim SSA form
Dastrel Sample
import environment;
import fragment;
import material;
import lighting;
code_block(fragment) main
{
let N = normalize(FragmentInput.normal);
let V = normalize(-FragmentInput.position);
color: FragmentOutput.color <== forwardLightingModel
albedo: FragmentInput.color*MaterialState.albedo
fresnel: MaterialState.fresnel smoothness: MaterialState.smoothness
normal: N viewVector: V position: FragmentInput.position;
}
Dastrel Sample
struct ObjectStateData
{
matrix: float4x4;
inverseMatrix: float4x4;
color: float4;
visible: int;
}
uniform(set=0, binding=0) ObjectState
{
objectState: ObjectStateData;
}
buffer(set=0, binding=1) InstanceObjectState
{
instanceStates: ObjectStateData[];
}
uniform(set=1, binding=0) CameraState
{
inverseViewMatrix: float4x4;
viewMatrix: float4x4;
projectionMatrix: float4x4;
currentTime: float;
}
Dastrel
function transformPositionToWorld(position: float3) -> float4
{
using ObjectState;
using InstanceObjectState;
using VertexStage;
return objectState.matrix *
(instanceStates[instanceID].matrix * float4(position, 1.0f));
}
Slovim
● LLVM style SSA form in Pharo.
● Strongly typed.
● Some very basics optimizations.
● Backends for:
– Spir-V (Done)
– GLSL (Done for Vulkan, missing OpenGL)
– C++ (For testing/experimenting)
– HLSL (To be done)
– Metal Shading Language (To be done)
WodenMath
● 3D graphics linear algebra
– Vectors (2D, 3D, 4D)
– Complex
– Quaternions
– Matrices (3x3 and 4x4)
● Same memory layout as C/GPU structures.
● Optimized using Lowcode extended bytecodes.
WodenMath
● 3D graphics linear algebra
– Vectors (2D, 3D, 4D)
– Complex
– Quaternions
– Matrices (3x3 and 4x4)
● Same memory layout as C/GPU structures.
● Optimized using Lowcode extended bytecodes.
WodenMath
Woden 2 Core
● WTEngine is the main entry point
● WTPipelineStateCache loads PSO from JSON
● WTResourceCache for loading files
● WTApplication provides support for Morphic
and OSWindow
● They are wrappers above the AbstractGPU
object for supporting image session saving and
restoring
Woden 2 Core Utilities
● Custom bitmap font format
● Mesh building
● Some GPU structures matching shader
definitions
– WTObjectState
– WTCameraState
– WTLightSourceData
● 3D Model with skeletal animation loading
How do I get Woden 2
● https://github.com/ronsaldo/woden2
● newImage.sh builds dependencies and creates
a Woden 2 image
● Warning: this currently requires a modified VM
at https://github.com/ronsaldo/pharo-vm-
lowcode
Woden 2 Scene Graph
● Simpler than the scene graph in Woden 1.
● Only rendering a 3D scene (except for
WTSNodeModel)
WTFPSSampleApplicationCube
3D Scene Rendering
● Standard forward rendering.
● WTSForwardSceneRenderer
● Command lists are reused if the scene topology
does ot change
● Shadows and a deferred shading renderer are
not yet implemented
Woden 2 Athens Backend
Woden Roassal
Game System
Level Editor
● Bloc over Woden 2
Where is Woden 2?
● https://github.com/ronsaldo/woden2
● But, it requires a modified Pharo VM
● https://github.com/ronsaldo/pharo-vm-lowcode

More Related Content

What's hot

Lighting Shading by John Hable
Lighting Shading by John HableLighting Shading by John Hable
Lighting Shading by John Hable
Naughty Dog
 
Creating A Character in Uncharted: Drake's Fortune
Creating A Character in Uncharted: Drake's FortuneCreating A Character in Uncharted: Drake's Fortune
Creating A Character in Uncharted: Drake's Fortune
Naughty Dog
 
Uncharted 2: Character Pipeline
Uncharted 2: Character PipelineUncharted 2: Character Pipeline
Uncharted 2: Character Pipeline
Naughty Dog
 
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphic
anku2266
 

What's hot (20)

Hable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr LightingHable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr Lighting
 
Lighting Shading by John Hable
Lighting Shading by John HableLighting Shading by John Hable
Lighting Shading by John Hable
 
SPU-Based Deferred Shading in BATTLEFIELD 3 for Playstation 3
SPU-Based Deferred Shading in BATTLEFIELD 3 for Playstation 3SPU-Based Deferred Shading in BATTLEFIELD 3 for Playstation 3
SPU-Based Deferred Shading in BATTLEFIELD 3 for Playstation 3
 
Filmic Tonemapping for Real-time Rendering - Siggraph 2010 Color Course
Filmic Tonemapping for Real-time Rendering - Siggraph 2010 Color CourseFilmic Tonemapping for Real-time Rendering - Siggraph 2010 Color Course
Filmic Tonemapping for Real-time Rendering - Siggraph 2010 Color Course
 
Creating A Character in Uncharted: Drake's Fortune
Creating A Character in Uncharted: Drake's FortuneCreating A Character in Uncharted: Drake's Fortune
Creating A Character in Uncharted: Drake's Fortune
 
From Image Processing To Computer Vision
From Image Processing To Computer VisionFrom Image Processing To Computer Vision
From Image Processing To Computer Vision
 
Uncharted 2: Character Pipeline
Uncharted 2: Character PipelineUncharted 2: Character Pipeline
Uncharted 2: Character Pipeline
 
Color
ColorColor
Color
 
Unit-1 basics of computer graphics
Unit-1 basics of computer graphicsUnit-1 basics of computer graphics
Unit-1 basics of computer graphics
 
Halftoning in Computer Graphics
Halftoning  in Computer GraphicsHalftoning  in Computer Graphics
Halftoning in Computer Graphics
 
Decima Engine: Visibility in Horizon Zero Dawn
Decima Engine: Visibility in Horizon Zero DawnDecima Engine: Visibility in Horizon Zero Dawn
Decima Engine: Visibility in Horizon Zero Dawn
 
I. Hill climbing algorithm II. Steepest hill climbing algorithm
I. Hill climbing algorithm II. Steepest hill climbing algorithmI. Hill climbing algorithm II. Steepest hill climbing algorithm
I. Hill climbing algorithm II. Steepest hill climbing algorithm
 
Graphics pipeline and rendering
Graphics pipeline and renderingGraphics pipeline and rendering
Graphics pipeline and rendering
 
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
 
3D Graphics & Rendering in Computer Graphics
3D Graphics & Rendering in Computer Graphics3D Graphics & Rendering in Computer Graphics
3D Graphics & Rendering in Computer Graphics
 
Overview of the graphics system
Overview of the graphics systemOverview of the graphics system
Overview of the graphics system
 
03.Scan Conversion.ppt
03.Scan Conversion.ppt03.Scan Conversion.ppt
03.Scan Conversion.ppt
 
Rendering Techniques in Rise of the Tomb Raider
Rendering Techniques in Rise of the Tomb RaiderRendering Techniques in Rise of the Tomb Raider
Rendering Techniques in Rise of the Tomb Raider
 
Lighting you up in Battlefield 3
Lighting you up in Battlefield 3Lighting you up in Battlefield 3
Lighting you up in Battlefield 3
 
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphic
 

Viewers also liked

Replicated Service Objects -- A Strategy for Distributed Applications
Replicated Service Objects -- A Strategy for Distributed ApplicationsReplicated Service Objects -- A Strategy for Distributed Applications
Replicated Service Objects -- A Strategy for Distributed Applications
ESUG
 
Human Action Recognition Based on Spacio-temporal features
Human Action Recognition Based on Spacio-temporal featuresHuman Action Recognition Based on Spacio-temporal features
Human Action Recognition Based on Spacio-temporal features
nikhilus85
 
What is 3 d modeling unit 66
What is 3 d modeling   unit 66What is 3 d modeling   unit 66
What is 3 d modeling unit 66
Richard Marshall
 
Orthographic projection
Orthographic projectionOrthographic projection
Orthographic projection
laura_gerold
 

Viewers also liked (20)

Replicated Service Objects -- A Strategy for Distributed Applications
Replicated Service Objects -- A Strategy for Distributed ApplicationsReplicated Service Objects -- A Strategy for Distributed Applications
Replicated Service Objects -- A Strategy for Distributed Applications
 
GemStone/64 product update and road map
GemStone/64 product update and road mapGemStone/64 product update and road map
GemStone/64 product update and road map
 
Perfection & Feedback Loops or: why worse is better
Perfection & Feedback Loops or: why worse is betterPerfection & Feedback Loops or: why worse is better
Perfection & Feedback Loops or: why worse is better
 
Lub: a DSL for Dynamic Context Oriented Programming
Lub: a DSL for Dynamic Context Oriented ProgrammingLub: a DSL for Dynamic Context Oriented Programming
Lub: a DSL for Dynamic Context Oriented Programming
 
Introduction to Direct 3D 12 by Ivan Nevraev
Introduction to Direct 3D 12 by Ivan NevraevIntroduction to Direct 3D 12 by Ivan Nevraev
Introduction to Direct 3D 12 by Ivan Nevraev
 
Interactive Graphic Storytelling: “How the Internet Impacts the Graphic Novel”
Interactive Graphic Storytelling: “How the Internet Impacts the Graphic Novel” Interactive Graphic Storytelling: “How the Internet Impacts the Graphic Novel”
Interactive Graphic Storytelling: “How the Internet Impacts the Graphic Novel”
 
Human Action Recognition Based on Spacio-temporal features
Human Action Recognition Based on Spacio-temporal featuresHuman Action Recognition Based on Spacio-temporal features
Human Action Recognition Based on Spacio-temporal features
 
Pelican Mapping - FOSS4G 2011
Pelican Mapping - FOSS4G 2011Pelican Mapping - FOSS4G 2011
Pelican Mapping - FOSS4G 2011
 
UP200 dental 3d scanner with dental CAD
UP200 dental 3d scanner with dental CADUP200 dental 3d scanner with dental CAD
UP200 dental 3d scanner with dental CAD
 
Special Photo Effects
Special Photo EffectsSpecial Photo Effects
Special Photo Effects
 
Radiosity algorithm
Radiosity algorithmRadiosity algorithm
Radiosity algorithm
 
GLSL Shading with OpenSceneGraph
GLSL Shading with OpenSceneGraphGLSL Shading with OpenSceneGraph
GLSL Shading with OpenSceneGraph
 
Shtanchaev_SPEKTR
Shtanchaev_SPEKTRShtanchaev_SPEKTR
Shtanchaev_SPEKTR
 
Steel monkeys: Unity3D глазами программиста графики
Steel monkeys: Unity3D глазами программиста графикиSteel monkeys: Unity3D глазами программиста графики
Steel monkeys: Unity3D глазами программиста графики
 
Shells
ShellsShells
Shells
 
Typography on the Web
Typography on the WebTypography on the Web
Typography on the Web
 
Quadtree In Game
Quadtree In GameQuadtree In Game
Quadtree In Game
 
What is 3 d modeling unit 66
What is 3 d modeling   unit 66What is 3 d modeling   unit 66
What is 3 d modeling unit 66
 
Orthographic projection
Orthographic projectionOrthographic projection
Orthographic projection
 
Building a DIY 3D Scanner
Building a DIY 3D ScannerBuilding a DIY 3D Scanner
Building a DIY 3D Scanner
 

Similar to Woden 2: Developing a modern 3D graphics engine in Smalltalk

Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computing
Arka Ghosh
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computing
Arka Ghosh
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computing
Arka Ghosh
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computing
Arka Ghosh
 
Graphics processing uni computer archiecture
Graphics processing uni computer archiectureGraphics processing uni computer archiecture
Graphics processing uni computer archiecture
Haris456
 

Similar to Woden 2: Developing a modern 3D graphics engine in Smalltalk (20)

Developing games and graphic visualizations in Pascal
Developing games and graphic visualizations in PascalDeveloping games and graphic visualizations in Pascal
Developing games and graphic visualizations in Pascal
 
Computer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming IComputer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming I
 
Syysgraph 2018 - Modern Graphics Abstractions & Real-Time Ray Tracing
Syysgraph 2018 - Modern Graphics Abstractions & Real-Time Ray TracingSyysgraph 2018 - Modern Graphics Abstractions & Real-Time Ray Tracing
Syysgraph 2018 - Modern Graphics Abstractions & Real-Time Ray Tracing
 
GPU Programming with Java
GPU Programming with JavaGPU Programming with Java
GPU Programming with Java
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computing
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computing
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computing
 
Newbie’s guide to_the_gpgpu_universe
Newbie’s guide to_the_gpgpu_universeNewbie’s guide to_the_gpgpu_universe
Newbie’s guide to_the_gpgpu_universe
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computing
 
One Year of Porting - Post-mortem of two Linux/SteamOS launches
One Year of Porting - Post-mortem of two Linux/SteamOS launchesOne Year of Porting - Post-mortem of two Linux/SteamOS launches
One Year of Porting - Post-mortem of two Linux/SteamOS launches
 
Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011
 
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio [Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
 
Graphics processing uni computer archiecture
Graphics processing uni computer archiectureGraphics processing uni computer archiecture
Graphics processing uni computer archiecture
 
Ceph RBD Update - June 2021
Ceph RBD Update - June 2021Ceph RBD Update - June 2021
Ceph RBD Update - June 2021
 
Javascript Update May 2013
Javascript Update May 2013Javascript Update May 2013
Javascript Update May 2013
 
Cuda Architecture
Cuda ArchitectureCuda Architecture
Cuda Architecture
 
Docker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12xDocker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12x
 
Introduction to Docker (as presented at December 2013 Global Hackathon)
Introduction to Docker (as presented at December 2013 Global Hackathon)Introduction to Docker (as presented at December 2013 Global Hackathon)
Introduction to Docker (as presented at December 2013 Global Hackathon)
 
Challenges in GPU compilers
Challenges in GPU compilersChallenges in GPU compilers
Challenges in GPU compilers
 
Rohit Yadav - The future of the CloudStack Virtual Router
Rohit Yadav - The future of the CloudStack Virtual RouterRohit Yadav - The future of the CloudStack Virtual Router
Rohit Yadav - The future of the CloudStack Virtual Router
 

More from ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
ESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
ESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
ESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
ESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
ESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
ESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
ESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
ESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
ESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
ESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
ESUG
 

More from ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Recently uploaded

Recently uploaded (20)

Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

Woden 2: Developing a modern 3D graphics engine in Smalltalk

  • 1. Woden 2: Developing a modern 3D graphics engine Ronie Salgado Universidad de Chile
  • 2. Talk Outline: Foundations ● Why rewriting Woden? – OpenGL problems – Classic graphics API (OpenGL, Direct 3D except 12) – “Modern” PC architecture – Modern graphics API (Vulkan, Direct 3D 12 and Metal) ● Core abstraction layers – AbstractGPU – Dastrel (Data Stream Language) – Slovim (Dastrel back-end)
  • 3. Talk Outline: Woden 2 Layers ● WodenMath library ● Core – Pipeline state cache – Resource cache – GPU resource management ● Basic layers – Scene graph – Woden athens backend ● Application layers – Woden Roassal ported to Woden 2 – Woden 2 Game System – Level Editor
  • 4. Why rewriting Woden 2? ● OpenGL is very complex. ● OpenGL drivers are very buggy! – NVIDIA does not follow strictly the spec. – AMD is very strict. – Intel, OS specific behavior. ● OpenGL uses a thread local context. ● OpenGL is old. ● GLSL compiler is in the driver.
  • 5. Choose a desktop OpenGL version OpenGL GLSL 1.2 Not available 2.0 1.10 2.1 1.20 3.0 1.30 3.1 1.40 3.2 1.50 3.3 3.30 4.0 4.00 4.1 4.10 4.2 4.30 4.4 4.40 4.5 4.50
  • 6. Classic graphics API Canvas Shader CPU ● Set shader, depth buffer state, ... ● Set texture. ● Set vertex buffer. ● Set index buffer. ● Draw indexed elements. GPU/CP
  • 8. Modern Low-Level Graphics API CPU CPCommand List Pipeline State Object Vertex BufferUniform Buffer Index Buffer GPUMMap Texture Descriptor Set DMA
  • 9. Core Abstraction Layers ● AbstractGPU – https://github.com/ronsaldo/abstract-gpu ● Dastrel (Data Stream Language) – http://smalltalkhub.com/#!/~ronsaldo/Dastrel ● Slovim (LLVM inspired typed SSA form) – http://smalltalkhub.com/#!/~ronsaldo/Slovim
  • 10. AbstractGPU ● Abstraction above Vulkan, Metal and D3D 12. ● API in C inspired by OpenCL ● Implementation in C++ ● XML spec for headers and bindings ● Mostly tested with Vulkan in Linux
  • 11. Dastrel (Data Stream Language) ● Intended to be a semi-visual language ● Statically typed ● Syntax inspired by C, Rust, Swift and Smalltalk ● Dumb type inference ● Compiler front-end written in Pharo ● Emits Slovim SSA form
  • 12. Dastrel Sample import environment; import fragment; import material; import lighting; code_block(fragment) main { let N = normalize(FragmentInput.normal); let V = normalize(-FragmentInput.position); color: FragmentOutput.color <== forwardLightingModel albedo: FragmentInput.color*MaterialState.albedo fresnel: MaterialState.fresnel smoothness: MaterialState.smoothness normal: N viewVector: V position: FragmentInput.position; }
  • 13. Dastrel Sample struct ObjectStateData { matrix: float4x4; inverseMatrix: float4x4; color: float4; visible: int; } uniform(set=0, binding=0) ObjectState { objectState: ObjectStateData; } buffer(set=0, binding=1) InstanceObjectState { instanceStates: ObjectStateData[]; } uniform(set=1, binding=0) CameraState { inverseViewMatrix: float4x4; viewMatrix: float4x4; projectionMatrix: float4x4; currentTime: float; }
  • 14. Dastrel function transformPositionToWorld(position: float3) -> float4 { using ObjectState; using InstanceObjectState; using VertexStage; return objectState.matrix * (instanceStates[instanceID].matrix * float4(position, 1.0f)); }
  • 15. Slovim ● LLVM style SSA form in Pharo. ● Strongly typed. ● Some very basics optimizations. ● Backends for: – Spir-V (Done) – GLSL (Done for Vulkan, missing OpenGL) – C++ (For testing/experimenting) – HLSL (To be done) – Metal Shading Language (To be done)
  • 16. WodenMath ● 3D graphics linear algebra – Vectors (2D, 3D, 4D) – Complex – Quaternions – Matrices (3x3 and 4x4) ● Same memory layout as C/GPU structures. ● Optimized using Lowcode extended bytecodes.
  • 17. WodenMath ● 3D graphics linear algebra – Vectors (2D, 3D, 4D) – Complex – Quaternions – Matrices (3x3 and 4x4) ● Same memory layout as C/GPU structures. ● Optimized using Lowcode extended bytecodes.
  • 19. Woden 2 Core ● WTEngine is the main entry point ● WTPipelineStateCache loads PSO from JSON ● WTResourceCache for loading files ● WTApplication provides support for Morphic and OSWindow ● They are wrappers above the AbstractGPU object for supporting image session saving and restoring
  • 20. Woden 2 Core Utilities ● Custom bitmap font format ● Mesh building ● Some GPU structures matching shader definitions – WTObjectState – WTCameraState – WTLightSourceData ● 3D Model with skeletal animation loading
  • 21. How do I get Woden 2 ● https://github.com/ronsaldo/woden2 ● newImage.sh builds dependencies and creates a Woden 2 image ● Warning: this currently requires a modified VM at https://github.com/ronsaldo/pharo-vm- lowcode
  • 22. Woden 2 Scene Graph ● Simpler than the scene graph in Woden 1. ● Only rendering a 3D scene (except for WTSNodeModel)
  • 24. 3D Scene Rendering ● Standard forward rendering. ● WTSForwardSceneRenderer ● Command lists are reused if the scene topology does ot change ● Shadows and a deferred shading renderer are not yet implemented
  • 25. Woden 2 Athens Backend
  • 28. Level Editor ● Bloc over Woden 2
  • 29. Where is Woden 2? ● https://github.com/ronsaldo/woden2 ● But, it requires a modified Pharo VM ● https://github.com/ronsaldo/pharo-vm-lowcode