Personal Profile

Direct3D

Direct3D 12 vs OpenGL: A quick Test

Direct3D 12 vs OpenGL: A quick Test

Direct3D 12 vs OpenGL: A quick Test

GeeXLab, the successor of GLSL Hacker, comes with the support of Direct3D 12. It’s not a full support but most of the basic things are available: command lists (CL), pipeline state objects (PSO), constant buffers (CB) and HLSL shaders.

An introduction to Direct3D programming with GeeXLab is available HERE.

Since GeeXLab is now available with an OpenGL and a Direct3D 12 renderers, here is a quick benchmark that shows the difference of performance between Direct3D 12 and OpenGL 3.2 in a very simple scene: a phong-textured mesh (a torus to be original) is rendered with various polygon density. This test uses one command list, one PSO, one HLSL program, one mesh and one texture.


GeeXLab - Direct3D 12 vs OpenGL

You can download both GeeXLab (version 0.9.3.0+ is recommended) and the test from THIS PAGE. The test is available in the host_api/Direct3D12_vs_OpenGL/ folder of the code sample pack (files: 09-lighting-mesh-d3d12.xml and 09-lighting-mesh-gl32.xml).

You can change the number of polygons by editing the source code of both files: lines 76-84 (09-lighting-mesh-d3d12.xml) and 47-54 (09-lighting-mesh-gl32.xml).

The results of this test should be taken with caution because it’s my first implementation of a Direct3D 12 plugin for GeeXLab and graphics drivers are also constantly updated. I will update this post as soon as I find bugs or bring some optimizations in GeeXLab that can change the results.

Testbed:

  • CPU: Intel Core i5 6600K @3.5GHz
  • Motherboard: ASUS Z170 Pro Gaming
  • RAM: 8GB DDR4 Corsair Vengeance
  • OS: Windows 10 64-bit
  • Drivers:
    • Radeon R9 290X: Catalyst 15.10 beta
    • GeForce GTX 970: R358.50
    • HD Graphics 530: v4279

Clock speeds: stock values for the CPU, memory and graphics cards.

The FPS in the following tables are the average framerates.

Direct3D 12 results

Triangles AMD Radeon R9 290X
(avg FPS / GPU load)
NVIDIA GeForce GTX 970
(avg FPS / GPU load)
Intel HD Graphics 530
(avg FPS)
800 9100 / 40% 5500 / 25% 1360
5’000 8200 / 45% 5300 / 35% 1220
20’000 5800 / 60% 5100 / 45% 1100
80’000 2400 / 80% 2600 / 70% 850
320’000 720 / 90% 700 / 85% 500
500’000 480 / 98% 480 / 90% 400
2’000’000 130 / 100% 130 / 97% 160

OpenGL 3.2 results

Triangles AMD Radeon R9 290X
(avg FPS / GPU load)
NVIDIA GeForce GTX 970
(avg FPS / GPU load)
Intel HD Graphics 530
(avg FPS)
800 4600 / 25% 3700 / 35% 1220
5’000 4300 / 25% 3600 / 35% 1160
20’000 4200 / 25% 3600 / 36% 1060
80’000 4100 / 30% 3600 / 58% 840
320’000 4100 / 46% 2800 / 87% 500
500’000 3200 / 70% 2200 / 90% 420
2’000’000 1000 / 100% 930 / 95% 180


Direct3D 12 vs OpenGL - benchmark results

According to this test, Direct3D 12 is faster than OpenGL when the number of triangles is low. AMD Radeon cards are particularly fast! Around 80K polygons, Direct3D offers the same kind of performance than OpenGL. Above 80K polygons, OpenGL is faster. The case of Intel GPU is interesting because it has more or less the same performances in D3D12 and GL. What’s more for a mesh of 2-million polygons, The Intel GPU is faster than a GTX 970 or a R9 290X in D3D12! It looks like for many polygons, there is a CPU-bottleneck somewhere in the D3D12 rendering pipeline that does not reflect the real power of GPUs.

The results are similar with latest drivers (R361.43 / Crimson 15.12).

I also did a simple draw stress test: a quad is rendered 100, 400 and 4000 times. No hardware instancing is used, each quad is rendered with its own draw call. I only tested on my dev system, with a GeForce GTX 960 + R361.43.


GeeXLab - Direct3D 12 vs OpenGL

The test is available in the host_api/Direct3D12_vs_OpenGL/ folder of the code sample pack (files: 08-drawstress-d3d12.xml and 08-drawstress-opengl.xml).

In this test, a quad is made up of 4 vertices and 2 triangles.

To change the number of quads, edit the xml file and look for the lines:

quads = {x=10, y=10, size=10.0} -- 100 quads
--quads = {x=40, y=10, size=10.0} -- 400 quads
--quads = {x=100, y=40, size=10.0} -- 4000 quads

Direct3D 12

Num quads GeForce GTX 960 (R361.43)
(avg FPS / GPU load)
100 2900 / 20%
400 1070 / 26%
4000 180 / 20%

OpenGL 3.2

Num quads GeForce GTX 960 (R361.43)
(avg FPS / GPU load)
100 1840 / 58%
400 730 / 30%
4000 97 / 20%

GeeXLab is maybe not the best tool for this kind of test (a loop with 4000 iterations) because of the overhead of the virtual machine (Lua and host API functions calls). A C/C++ based test should be better. But this GeeXLab test shows that we can draw more objects with Direct3D 12 than with OpenGL. This is particularly visible with 4000 quads: D3D12 is twice faster: 180FPS for D3D12 against 97 FPS for OpenGL.

What is Direct3D 12?

DirectX 12 introduces the next version of Direct3D, the 3D graphics API at the heart of DirectX. This version of Direct3D is faster and more efficient than any previous version. Direct3D 12 enables richer scenes, more objects, more complex effects, and full utilization of modern GPU hardware.

What makes Direct3D 12 better?

Direct3D 12 provides a lower level of hardware abstraction than ever before, which allows developers to significantly improve the multi-thread scaling and CPU utilization of their titles. With Direct3D 12, titles are responsible for their memory management. In addition, by using Direct3D 12, games and titles benefit from reduced GPU overhead via features such as command queues and lists, descriptor tables, and concise pipeline state objects.

Direct3D 12, and Direct3D 11.3, introduce a set of new features for the rendering pipeline: conservative rasterization to enable reliable hit detection, volume-tiled resources to enable streamed three dimension resources to be treated as if they were all in video memory, rasterizer ordered views to enable reliable transparency rendering, setting the stencil reference within a shader to enable special shadowing and other effects, and also improved texture mapping and typed Unordered Access View (UAV) loads.

Who is Direct3D 12 for?

Direct3D 12 provides four main benefits to graphics developers (compared with Direct3D 11): vastly reduced CPU overhead, significantly improved power consumption, up to around twenty percent improvement in GPU efficiency, and cross-platform development for a Windows 10 device (PC, tablet, console or phone).

Direct3D 12 is certainly for advanced graphics programmers, it requires a fine level of tuning and significant graphics expertise. Direct3D 12 is designed to make full use of multi-threading, careful CPU/GPU synchronization, and the transition and re-use of resources from one purpose to another. All techniques that require a considerable amount of memory level programming skill.

Another advantage that Direct3D 12 has is its small API footprint. There are around 200 methods, and about one third of these do all the heavy lifting. This means that a graphics developer should be able to educate themselves on – and master – the full API set without the weight of having to memorize a great volume of API calls.

Direct3D 12 does not replace Direct3D 11. The new rendering features of Direct3D 12 are available in Direct3D 11.3. Direct3D 11.3 is a low level graphics engine API, and Direct3D 12 goes even deeper.

There are at least two ways a development team can approach a Direct3D 12 title.

For a project that takes full advantage of the benefits of Direct3D 12, a highly customized Direct3D 12 game engine should be developed from the ground up.

One approach is that if graphics developers understand the use and re-use of resources within their titles, and can take advantage of this by minimizing uploading and copying, then a highly efficient engine can be developed and customized for these titles. The performance improvements could be very considerable, freeing up CPU time to increase the number of draw calls, and so adding more luster to graphics rendering.

The programming investment is significant, and debugging and instrumentation of the project should be considered from the very start: threading, synchronization and other timing bugs can be challenging.

A shorter term approach would be to address known bottlenecks in a Direct3D 11 title; these can be addressed by using the 11on12 or interop techniques enabling the two APIs to work together. This approach minimizes the changes necessary to an existing Direct3D 11 graphics engine, however the performance gains will be limited to the relief of the bottleneck that the Direct3D 12 code addresses.

Direct3D 12 is all about dramatic graphics engine performance: ease of development, high level constructs, and compiler support have been scaled back to enable this. Driver support and ease of debugging remain on a par with Direct3D 11.

Direct3D 12 is new territory, for the inquisitive expert to explore.

What’s New in OpenGL 4.5 and OpenGL Shading Language 4.5

The OpenGL 4.5 and OpenGL Shading Language 4.50 Specifications were released on August 11, 2014.

New features of OpenGL 4.5 include:

  • Direct State Access (DSA)
    object accessors enable state to be queried and modified without binding objects to contexts, for increased application and middleware efficiency and flexibility;
  • Flush Control
    applications can control flushing of pending commands before context switching – enabling high-performance multithreaded applications;
  • Robustness
    providing a secure platform for applications such as WebGL browsers, including preventing a GPU reset affecting any other running applications;
  • OpenGL ES 3.1 API and shader compatibility
    to enable the easy development and execution of the latest OpenGL ES applications on desktop systems;
  • DX11 emulation features
    for easier porting of applications between OpenGL and Direct3D.

New extensions to OpenGL 4.5 include:

  • GL_ARB_clip_control
  • GL_ARB_cull_distance
  • GL_ARB_ES3_1_compatibility
  • GL_ARB_conditional_render_inverted
  • GL_KHR_context_flush_control
  • GL_ARB_derivative_control
  • GL_ARB_direct_state_access
  • GL_ARB_get_texture_sub_image
  • GL_KHR_robustness
  • GL_ARB_shader_texture_image_samples
  • GL_ARB_texture_barrier

API & GLSL specifications



Popular Pages
  • CV Resume Ahmadrezar Razian-سید احمدرضا رضیان-رزومه Resume Full name Sayed Ahmadreza Razian Nationality Iran Age 36 (Sep 1982) Website ahmadrezarazian.ir  Email ...
  • CV Resume Ahmadrezar Razian-سید احمدرضا رضیان-رزومه معرفی نام و نام خانوادگی سید احمدرضا رضیان محل اقامت ایران - اصفهان سن 33 (متولد 1361) پست الکترونیکی ahmadrezarazian@gmail.com درجات علمی...
  • Nokte feature image Nokte – نکته نرم افزار کاربردی نکته نسخه 1.0.8 (رایگان) نرم افزار نکته جهت یادداشت برداری سریع در میزکار ویندوز با قابلیت ذخیره سازی خودکار با پنل ساده و کم ح...
  • Tianchi-The Purchase and Redemption Forecasts-Big Data-Featured Tianchi-The Purchase and Redemption Forecasts 2015 Special Prize – Tianchi Golden Competition (2015)  “The Purchase and Redemption Forecasts” in Big data (Alibaba Group) Among 4868 teams. Introd...
  • Brick and Mortar Store Recommendation with Budget Constraints-Featured Tianchi-Brick and Mortar Store Recommendation with Budget Constraints Ranked 5th – Tianchi Competition (2016) “Brick and Mortar Store Recommendation with Budget Constraints” (IJCAI Socinf 2016-New York,USA)(Alibaba Group...
  • Drowning Detection by Image Processing-Featured Drowning Detection by Image Processing In this research, I design an algorithm for image processing of a swimmer in pool. This algorithm diagnostics the swimmer status. Every time graph sho...
  • Shangul Mangul Habeangur,3d Game,AI,Ahmadreza razian,boz,boz boze ghandi,شنگول منگول حبه انگور,بازی آموزشی کودکان,آموزش شهروندی,آموزش ترافیک,آموزش بازیافت Shangul Mangul HabeAngur Shangul Mangul HabeAngur (City of Goats) is a game for child (4-8 years). they learn how be useful in the city and respect to people. Persian n...
  • 1st National Conference on Computer Games-Challenges and Opportunities 2016-Featured 1st National Conference on Computer Games-Challenges and Opportunities 2016 According to the public relations and information center of the presidency vice presidency for science and technology affairs, the University of Isfah...
  • Design an algorithm to improve edges and image enhancement for under-sea color images in Persian Gulf-Featured 3rd International Conference on The Persian Gulf Oceanography 2016 Persian Gulf and Hormuz strait is one of important world geographical areas because of large oil mines and oil transportation,so it has strategic and...
  • 2nd Symposium on psychological disorders in children and adolescents 2016 2nd Symposium on psychological disorders in children and adolescents 2016 2nd Symposium on psychological disorders in children and adolescents 2016 Faculty of Nursing and Midwifery – University of Isfahan – 2 Aug 2016 - Ass...
  • MyCity-Featured My City This game is a city simulation in 3d view. Gamer must progress the city and create building for people. This game is simular the Simcity.
  • GPU vs CPU Featured CUDA Optimizing raytracing algorithm using CUDA Abstract Now, there are many codes to generate images using raytracing algorithm, which can run on CPU or GPU in single or multi-thread methods. In t...
Popular posts
Interested
About me

My name is Sayed Ahmadreza Razian and I am a graduate of the master degree in Artificial intelligence .
Click here to CV Resume page

Related topics such as image processing, machine vision, virtual reality, machine learning, data mining, and monitoring systems are my research interests, and I intend to pursue a PhD in one of these fields.

جهت نمایش صفحه معرفی و رزومه کلیک کنید

My Scientific expertise
  • Image processing
  • Machine vision
  • Machine learning
  • Pattern recognition
  • Data mining - Big Data
  • CUDA Programming
  • Game and Virtual reality

Download Nokte as Free


Coming Soon....

Greatest hits

The fear of death is the most unjustified of all fears, for there’s no risk of accident for someone who’s dead.

Albert Einstein

Gravitation is not responsible for people falling in love.

Albert Einstein

Imagination is more important than knowledge.

Albert Einstein

You are what you believe yourself to be.

Paulo Coelho

It’s the possibility of having a dream come true that makes life interesting.

Paulo Coelho

Waiting hurts. Forgetting hurts. But not knowing which decision to take can sometimes be the most painful.

Paulo Coelho

One day you will wake up and there won’t be any more time to do the things you’ve always wanted. Do it now.

Paulo Coelho

Anyone who has never made a mistake has never tried anything new.

Albert Einstein


Site by images
Recent News Posts