Cg Language
What is Cg?
C for Graphics. Cg is the high level language for programming GPUs, developed
by NVIDIA in close collaboration with Microsoft.
Who maintains the Cg Language Specification?
NVIDIA maintains the Cg Language Specification and will continue to work with
Microsoft to maintain compatibility with the DirectX High Level Shading
Language (HLSL).
Is Cg open or proprietary?
The Cg Language Specification is published and is open in the sense that other
vendors may implement products based on it. To encourage this, an open-source
implementation of a Cg compiler front-end is expected to be available by
Siggraph ’02.
Vendor implementations of Cg compilers are typically proprietary and owned by
their creators. NVIDIA has developed the NVIDIA Cg Compiler, and we expect
other vendors to develop their own Cg compiler products.
Does Cg replace OpenGL?
No, Cg operates as a layer above OpenGL. Cg Compilers output assembly code in
the formats defined by OpenGL extensions such as ARB_vertex_program and
NV_vertex_program, and in the format defined by OpenGL 1.4.
Does Cg replace DirectX?
No, this language operates as a layer above the DirectX Vertex and Pixel
Shader APIs, and creates the shader code necessary to run standard VS1.1 or
PS1.1 shaders.
What’s the difference between the Cg Language and a Cg Compiler?
The Cg language has a syntax and grammar suitable for real-time programmable
GPUs.
A Cg Compiler is an application that accepts Cg Language input, and produces
output in one of several standard assembly language formats that are accepted
by modern programmable GPUs.
What is NVIDIA's involvement in the future of OpenGL?
NVIDIA is committed to the advancement of OpenGL, and will actively work to
the next natural stage in the evolution of OpenGL. NVIDIA proposed and is
leading the development of OpenGL 1.4, whose primary component is an assembly
language interface to programmable GPU vertex hardware. Upon successful
completion of this OpenGL revision, NVIDIA will work with the ARB to define
and develop the next revision of OpenGL, with fragment/pixel programmability
as its expected core capability.
Will NVIDIA offer the Cg Language Specification to the OpenGL ARB?
Not directly, because Cg operates as a layer above both the OpenGLand DirectX
APIs, it is not appropriate to offer Cg to the ARB. To facilitate the use of
Cg in the OpenGL community, NVIDIA will actively lead an effort to develop an
ARB fragment programming extension. NVIDIA will continue to work with
interested parties to further evolve the Cg language.
When will NVIDIA support OpenGL 2.0?
NVIDIA is committed to supporting all OpenGL standards, after they are
approved by the ARB. NVIDIA proposed and is leading the development of OpenGL
1.4, whose primary component is an assembly language interface to programmable
GPU vertex hardware. Upon successful completion of this OpenGL revision,
NVIDIA willwork with the ARB to define and develop the next revision of
OpenGL, with fragment/pixel programmability as its expected core capability.
We will continue to contribute toward all of the future revisions of OpenGL.
Platforms
What platforms does NVIDIA’s Cg Compiler support?
Windows (DirectX 8, DirectX 9, OpenGL)
Linux (OpenGL)
Mac OS X (OpenGL - ARB_vertex_program support, upon ARB ratification)
Xbox (through offline compilation of DirectX 8 Vertex and Pixel Shaders)
What about other platforms?
NVIDIA will provide source code for key of the NVIDIA Cg Compiler front-end to
enable rapid adoption for alternative platforms.
How will Cg support future GPUs?
Cg is designed to provide support for very sophisticated programmable GPUs and
NVIDIA expects Cg to be a key enabling technology, allowing developers to
access and use future, increasingly programmable GPU architectures.
NVIDIA Cg Toolkit
What is NVIDIA providing to developers?
NVIDIA is initially providing developers with the NVIDIA Cg Toolkit 1.0
(Public Beta) comprised of:
NVIDIA Cg Compiler Public Beta 1.0 (supporting DirectX 8: Vertex and Pixel
Shaders, OpenGL NV_vertex_program)
Cg Language Specification 1.0
NVIDIA Cg Standard Library 1.0
NVIDIA Cg Runtime Libraries (supporting DirectX 8 and OpenGL 1.0)
Cg User’s Manual 1.0
NVIDIA Cg Browser 4.0 (with many example shaders and demos)
Will there be other versions of the tookit?
Later versions of the NVIDIA Cg Toolkit will support and include:
Increasing optimization of the compiler
NVIDIA Cg Compiler for DirectX 9 and OpenGL for future GPU architectures
Comprehensive courseware and examples
Support for CgFX
Will the NVIDIA Cg Compiler perform any platform specific optimizations?
Yes, the NVIDIA Cg Compiler will aggressively optimize shaders for multiple
target GPU architectures.
Who is Using Cg?
Hundreds of developers endorse Cg:
Hundreds of developers began training on an earlier incarnation of Cg
beginning late in 2001, and many contributed to the evolution of the language
prior to this public release.
Some developers supporting Cg include: Auran, Bethesda Softworks, Beyond
Games, Bioware, Blizzard Entertainment, Cat Daddy, CodeCult, Codemasters,
Contraband, Core Design, Croteam, Cryptic Studios, Crytek, Dark Black,
Destineer, Electronic Arts, Elixir, EMG, Ensemble Studios, Fox Interactive,
Grin, Headgate, High Voltage, Inevitable, Ion Storm, Kaboom, Kuju, Lego Media,
Lionhead, Lithtech, Massive, Maxis, Nadeo, NAMCO, NemoSoft, Novalogic,
Pivotal, Rage Sheffield, Relic Entertainment, Ritual, Sega-AM2 Co. Ltd., Sony
Online Entertainment, SpinVector, Steel Monkeys, Valve, Vupine and more.
Middleware developers are endorsing Cg: NDL, Criterion, Intrinsic Graphics
DCC applications and tools vendors, like Right Hemisphere’s Deep Exploration
product, Alias|Wavefront Maya, Discreet 3ds max, SOFTIMAGE|XSI and NewTek
LightWave 3D, are embedding Cg into the digital artist’s workflow.