GLSlang compiler. GLSlang Front-End GL Shading Language compiler front end developed by 3DLabs. Redistribution and use in source and binary forms, with.

Slides:



Advertisements
Similar presentations
Vilmos Zsombori , Shanghai
Advertisements

CPSC 388 – Compiler Design and Construction
Software & Services Group, Developer Products Division Copyright© 2010, Intel Corporation. All rights reserved. *Other brands and names are the property.
Prof. Amr Goneid, AUC1 Analysis & Design of Algorithms (CSCE 321) Prof. Amr Goneid Department of Computer Science, AUC Part R4. Disjoint Sets.
School of Computing and Engineering, University of Huddersfield LANGUAGE TRANSLATORS: WEEK 10 LECTURE: symbol tables TUTORIAL: Pen and paper exercises.
Informationsteknologi Wednesday, December 12, 2007Computer Graphics - Class 171 Today’s class OpenGL Shading Language.
Lecture 01 - Introduction Eran Yahav 1. 2 Who? Eran Yahav Taub 734 Tel: Monday 13:30-14:30
TM Pro64™: Performance Compilers For IA-64™ Jim Dehnert Principal Engineer 5 June 2000.
1 Semantic Processing. 2 Contents Introduction Introduction A Simple Compiler A Simple Compiler Scanning – Theory and Practice Scanning – Theory and Practice.
Reference Book: Modern Compiler Design by Grune, Bal, Jacobs and Langendoen Wiley 2000.
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
Multiple-Subscripted Array
Compiler Construction1 A Compulsory Module for Students in Computer Science Department Faculty of IT / Al – Al Bayt University First Semester 2009/2010.
Mohan Sridharan Based on slides created by Edward Angel GLSL I 1 CS4395: Computer Graphics.
CPSC 388 – Compiler Design and Construction Lecture: MWF 11:00am-12:20pm, Room 106 Colton.
Chapter 17 Programming Tools The Architecture of Computer Hardware and Systems Software: An Information Technology Approach 3rd Edition, Irv Englander.
An Introduction to the OpenGL Shading Language Benj Lipchak Rob Simpson Bill Licea-Kane.
CS 153: Concepts of Compiler Design August 24 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
A Non-Photorealistic Fragment Shader in OpenGL 2.0 Bert Freudenberg Institut für Simulation und Graphik University of Magdeburg, Germany.
Functionality of LANCE Software structure C frontend
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 2.
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
Joey Paquet, 2000, 2002, 2007, Concordia University Department of Computer Science COMP 442/6421 Compiler Design.
MIT Intermediate Formats Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
1.  10% Assignments/ class participation  10% Pop Quizzes  05% Attendance  25% Mid Term  50% Final Term 2.
CS 152: Programming Language Paradigms April 2 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak
Joey Paquet, 2000, Lecture 10 Introduction to Code Generation and Intermediate Representations.
1. 2 Preface In the time since the 1986 edition of this book, the world of compiler design has changed significantly 3.
Introduction to Code Generation and Intermediate Representations
Overview of Previous Lesson(s) Over View  A program must be translated into a form in which it can be executed by a computer.  The software systems.
1 Compiler Design (40-414)  Main Text Book: Compilers: Principles, Techniques & Tools, 2 nd ed., Aho, Lam, Sethi, and Ullman, 2007  Evaluation:  Midterm.
Chapter 1 Introduction Study Goals: Master: the phases of a compiler Understand: what is a compiler Know: interpreter,compiler structure.
Shaders in OpenGL Marshall Hahn. Introduction to Shaders in OpenGL In this talk, the basics of OpenGL Shading Language will be covered. This includes.
Chapter 1 Introduction. Chapter 1 -- Introduction2  Def: Compiler --  a program that translates a program written in a language like Pascal, C, PL/I,
The Model of Compilation Natawut Nupairoj, Ph.D. Department of Computer Engineering Chulalongkorn University.
1 Compiler & its Phases Krishan Kumar Asstt. Prof. (CSE) BPRCE, Gohana.
Week 3 Lecture 4: Part 2: GLSL I Based on Interactive Computer Graphics (Angel) - Chapter 9.
C H A P T E R T W O Linking Syntax And Semantics Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
Overview of Previous Lesson(s) Over View 3 Model of a Compiler Front End.
Week 7 - Wednesday.  What did we talk about last time?  Recursive running time  Master Theorem  Symbol tables.
OpenGL Shading Language
Compilers Computer Symbol Table Output Scanner (lexical analysis)
Compiler Construction CPCS302 Dr. Manal Abdulaziz.
Programming Language Concepts (CIS 635) Elsa L Gunter 4303 GITC NJIT,
Programming with OpenGL Part 3: Shaders Ed Angel Professor of Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.
Copyright © 2012 Pearson Education, Inc. Chapter 10 Advanced Topics.
CS 404Ahmed Ezzat 1 CS 404 Introduction to Compiler Design Lecture 10 Ahmed Ezzat.
LLVM IR, File - Praakrit Pradhan. Overview The LLVM bitcode has essentially two things A bitstream container format Encoding of LLVM IR.
Objective of the course Understanding the fundamentals of the compilation technique Assist you in writing you own compiler (or any part of compiler)
Single Static Assignment Intermediate Representation (or SSA IR) Many examples and pictures taken from Wikipedia.
Lecture 9 Symbol Table and Attributed Grammars
CS 404 Introduction to Compiler Design
Introduction to Compiler Construction
Intermediate code Jakub Yaghob
Constructing Precedence Table
Compiler Construction (CS-636)
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Compiler Construction
Introduction to the C Language
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
Chapter 6 Intermediate-Code Generation
Compilers B V Sai Aravind (11CS10008).
CMPE 152: Compiler Design August 21/23 Lab
Programming with OpenGL Part 3: Shaders
Chapter 1 Introduction.
CS 480/680 Computer Graphics GLSL Overview.
Review: What is an activation record?
CS 480/680 Fall 2011 Dr. Frederick C Harris, Jr. Computer Graphics
Presentation transcript:

GLSlang compiler

GLSlang Front-End GL Shading Language compiler front end developed by 3DLabs. Redistribution and use in source and binary forms, with or without modification, are permitted. Ready to build on Linux and Windows  Windows → Requires Visual Studio.NET  Linux → Compilation problems with libc versión in fargas By now compiled in Visual Studio.NET

GLSlang compiler source code It´s completely machine independent code Code is parsed by flex/bison, with the aid of a symbol table and an intermediate representation The intermediate representation (IR) is very high-level, and represented as an in memory tree  No lose information from the original program  In the IR constants are propogated and folded... ... and some dead code is eliminated.

GLSlang compiler source code The back-end compiler has to traverse the IR-tree and create an internal object code representation. It has to derive from TCompiler : class TGenericCompiler : public TCompiler { public: TGenericCompiler(EShLanguage l, int dOptions) : TCompiler(l, infoSink), debugOptions(dOptions) { } virtual bool compile(TIntermNode* root); TInfoSink infoSink; int debugOptions; };

GLSlang compiler source code intermediate.h has the definition of the IR tree. Nodes in the IR tree are defined as a hierarchy of classes derived from TIntermNode. Example: class TIntermLoop : public TIntermNode; represents a loop in the tree. class TIntermOperator : public TIntermTyped; represents an operator in the tree.

GLSlang generic compiler output A little back end is implemented Only to print a brief description of the IR tree. Example (the glslang code): varying vec3 color; void main() { color = vec3(1.0, 1.0, 1.0); gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; }

GLSlang generic compiler output #### BEGIN COMPILER 0 INFO LOG #### 0:? Sequence 0:37 Function Definition: main( (void) 0:37 Function Parameters: 0:39 Sequence 0:39 move second child to first child (3-component vector of float) 0:39 'color' (varying 3-component vector of float) 0:39 Construct vec3 (const 3-component vector of float) 0: (const float) 0:41 move second child to first child (4-component vector of float) 0:41 'gl_Position' (Position 4-component vector of float) 0:41 matrix-times-vector (4-component vector of float) 0:41 'gl_ModelViewProjectionMatrix' (uniform 4X4 matrix of float) 0:41 'gl_Vertex' (attribute 4-component vector of float) #### END COMPILER 0 INFO LOG #### #### BEGIN LINKER INFO LOG #### #### END LINKER INFO LOG #### The output: