Khronos 發布 OpenGL 4.4、OpenCL 2.0 以及 OpenCL SPIR 1.2


一年一度的電腦圖學盛事、SIGGRAPH 又到了~而 Khronos 今年也針對了其管理的 Graphic API、OpenGL,以及平行計算用標準 OpenCL 進行了更新。

在繼去年推出 OpenGL 4.3 之後,今年 Khronos 也再度發布 OpenGL 4.4 的更新,讓 OpenGL 有更多的功能可以使用。官方的新聞是《Khronos Releases OpenGL 4.4 Specification》,他主要的新功能包括了:

  • Buffer Placement Control (GL_ARB_buffer_storage)

    Significantly enhances memory flexibility and efficiency through explicit control over the position of buffers in the graphics and system memory, together with cache behavior control – including the ability of the CPU to map a buffer for direct use by a GPU.

  • Efficient Asynchronous Queries (GL_ARB_query_buffer_object)

    Buffer objects can be the direct target of a query to avoid the CPU waiting for the result and stalling the graphics pipeline. This provides significantly boosted performance for applications that intend to subsequently use the results of queries on the GPU, such as dynamic quality reduction strategies based on performance metrics.

  • Shader Variable Layout (GL_ARB_enhanced_layouts)

    Detailed control over placement of shader interface variables, including the ability to pack vectors efficiently with scalar types. Includes full control over variable layout inside uniform blocks and enables shaders to specify transform feedback variables and buffer layout.

  • Efficient Multiple Object Binding (GL_ARB_multi_bind)

    New commands which enable an application to bind or unbind sets of objects with one API call instead of separate commands for each bind operation, amortizing the function call, name space lookup, and potential locking overhead.  The core rendering loop of many graphics applications frequently bind different sets of textures, samplers, images, vertex buffers, and uniform buffers and so this can significantly reduce CPU overhead and improve performance.

  • Streamlined Porting of Direct3D applications

    A number of core functions contribute to easier porting of applications and games written in Direct3D including GL_ARB_buffer_storage for buffer placement control, GL_ARB_vertex_type_10f_11f_11f_rev which creates a vertex data type that packs three components in a 32 bit value that provides a performance improvement for lower precision vertices and is a format used by Direct3D, and GL_ARB_texture_mirror_clamp_to_edge that provides a texture clamping mode also used by Direct3D.

同時,OpenGL 4.4 也提供了下列兩個新的 extension:

  • Bindless Texture Extension (GL_ARB_bindless_texture)

    Shaders can now access an effectively unlimited number of texture and image resources directly by virtual addresses.  This bindless texture approach avoids the application overhead due to explicitly binding a small window of accessible textures.  Ray tracing and global illumination algorithms are faster and simpler with unfettered access to a virtual world’s entire texture set.

  • Sparse Texture Extension (GL_ARB_sparse_texture)

    Enables handling of huge textures that are much larger than the GPUs physical memory by allowing an application to select which regions of the texture are resident for ‘mega-texture’ algorithms and very large data-set visualizations.

完整的規格文件,也已經可以在 OpenGL Registry 找到了。

如果要使用的話,nVIDIA 現在也有對應 OpenGL 4.4 的顯示卡驅動程式(Windows 版本編號為 326.29),可以下載使用了(網頁);不過要使用 OpenGL 4 以上的完整功能,應該是需要使用 GeForce 400/Fermi 以後的顯示晶片才可以了。而 GLEW 也已經推出了對應 OpenGL 4.4 的 GLEW 1.10.0 可以使用了~

另外,Khronos 也建立了正式的 OpenGL 一致性測試(conformance tests),可以用來驗證顯示卡的驅動程式,是否符合 OpenGL 的規範;這點對於減少不同廠商之間對於標準的實作差異,是相當有幫助的!

而除了 OpenGL 之外,Khronos 不但將 OpenCL 的版本由 OpenCL 1.2 更新到了 OpenCL 2.0,也發布了 OpenCL SPIR 1.2(Standard Portable Intermediate Representation),官方的新聞稿是《Khronos Releases OpenCL 2.0》。不過,這兩者的規格都還是暫時性的,官方網站也有提到可能會根據回應、再做出修改,並預計在六個月內完成最終版。

OpenCL 2.0 主要是定義了加強的執行模型(execution model),以及 C11 / C 11 記憶體模型的局部功能(a subset of the C11 and C 11 memory model),同步(synchronization)與 atomic operation。而下方則是 OpenCL 2.0 的更新、以及新增的功能:

  • Shared Virtual Memory

    Host and device kernels can directly share complex, pointer-containing data structures such as trees and linked lists, providing significant programming flexibility and eliminating costly data transfers between host and devices.

  • Dynamic Parallelism

    Device kernels can enqueue kernels to the same device with no host interaction, enabling flexible work scheduling paradigms and avoiding the need to transfer execution control and data between the device and host, often significantly offloading host processor bottlenecks.

  • Generic Address Space

    Functions can be written without specifying a named address space for arguments, especially useful for those arguments that are declared to be a pointer to a type, eliminating the need for multiple functions to be written for each named address space used in an application.

  • Images

    Improved image support including sRGB images and 3D image writes, the ability for kernels to read from and write to the same image, and the creation of OpenCL images from a mip-mapped or a multi-sampled OpenGL texture for improved OpenGL interop.

  • C11 Atomics

    A subset of C11 atomics and synchronization operations to enable assignments in one work-item to be visible to other work-items in a work-group, across work-groups executing on a device or for sharing data between the OpenCL device and host.

  • Pipes

    Pipes are memory objects that store data organized as a FIFO and OpenCL 2.0 provides built-in functions for kernels to read from or write to a pipe, providing straightforward programming of pipe data structures that can be highly optimized by OpenCL implementers.

  • Android Installable Client Driver Extension

    Enables OpenCL implementations to be discovered and loaded as a shared object on Android systems.

而 OpenCL SPIR 的「SPIR」則是「Standard Portable Intermediate Representation」的縮寫,他主要的功能是定義一個介於 OpenCL 的 C Kernel 以及、以及編譯好之後的 binary 之間的格式;透過這種資料,開發者就可以把自己寫的 OpenCL Kernel 程式先轉換成 SPIR 的標準,然後拿到不同的裝置上運行,而不需要把 kernel 的原始碼給別人、再針對裝置重新編譯。這對於要釋放非開放原始碼的程式來說,會是一個相對方便的選擇。

其他的介紹,可以參考《Khronos @ SIGGRAPH 2013: OpenGL 4.4, OpenCL 2.0, & OpenCL 1.2 SPIR Announced》。

Leave a Reply

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *