Direct3d 11 Vs 12 a Performance Comparison Using Basic Geometry

Direct3d 11 Vs 12 a Performance Comparison Using Basic Geometry

Thesis no: BCS-2016-13 Direct3D 11 vs 12 A Performance Comparison Using Basic Geometry Mikael Olofsson Faculty of Computing Blekinge Institute of Technology SE371 79 Karlskrona, Sweden This thesis is submitted to the Faculty of Computing at Blekinge Institute of Technology in partial fulllment of the requirements for the degree of Bachelor of Science in Computer Science. The thesis is equivalent to 10 weeks of full-time studies. Contact Information: Author: Mikael Olofsson E-mail: [email protected] University advisor: Stefan Petersson Dept. of Creative Technologies Faculty of Computing Internet : www.bth.se Blekinge Institute of Technology Phone : +46 455 38 50 00 SE371 79 Karlskrona, Sweden Fax : +46 455 38 50 57 Abstract Context. Computer rendered imagery such as computer games is a eld with steady development. To render games an application pro- gramming interface (API) is used to communicate with a graphical processing unit (GPU). Both the interfaces and processing units are a part of the steady development in order to be able to push the limits of graphical rendering. Objectives. This thesis investigates if the Direct3D 12 API pro- vides higher rendering performance when compared to its predecessor Direct3D 11. Methods. The method used is an experiment, in which a bench- mark rendering basic shaded geometry using both of the APIs while measuring their performance was developed. The focus was aimed at testing API interaction and comparing Direct3D 11 against Direct3D 12. Results. Statistics gained from the benchmark suggest that in this experiment Direct3D 11 oered the best rendering performance in the majority of the cases tested, although Direct3D 12 had specic sce- narios where it performed better. Conclusions. As a conclusion the benchmark gave contradicting re- sults when compared to other studies. This could be dependent on the implementation, software or hardware used. In the tests Direct3D 12 was closer to its Direct3D 11 counterpart when more cores were used. A platform with more processing cores available to execute in parallel could reveal if Direct3D 12 could oer better performance in that ex- perimental setting. In this study Direct3D 12 was implemented as to imitate Direct3D 11. If the implementation was further aligned with Direct3D 12 recommendations other results might be observed. Fur- ther study could be conducted to give a better evaluation of rendering performance. Keywords: DirectX, Direct3D, rendering, performance, geometry i Contents Abstract i 1 Introduction 1 1.1 Background . 1 1.2 Research Question . 2 2 Programming Using Direct3D 3 2.1 Rendering Pipeline . 3 2.1.1 Primitives . 5 2.1.2 Shader Stages . 5 2.2 Immediate and Deferred Rendering . 6 3 Method 7 3.1 Benchmark . 7 3.1.1 Application Structure . 8 3.1.2 Test Denitions . 9 4 Performance Tests 10 4.1 Test Parameters . 10 4.2 Test 1 . 12 4.3 Test 1b . 13 4.4 Test 2 . 14 4.5 Test 2b . 15 4.6 Test 3 . 16 4.7 Test 3b . 17 4.8 Test 4 . 18 4.9 Test 4b . 19 5 Analysis and Discussion 20 5.1 Analysis . 20 5.2 Discussion . 20 6 Conclusions and Future Work 22 ii References 23 iii Chapter 1 Introduction This chapter introduces the thesis and a reason for the work done. A background to why the thesis topic was chosen and the research question that was derived from it can be found in this chapter. 1.1 Background "The Graphics Processing Unit (GPU) have become important in providing pro- cessing power for high performance computing applications" [1]. One example of an application that uses this power to its benet is a computer game. One of the challenges within this eld is to provide users with a pleasing graphical experience. To establish this the GPU is used to render geometry and present it to the user. For this to be done an API (application programming interface) that communicates with the GPU can be used. This thesis serves as a general benchmark comparison between two APIs. With evolving software it can be of importance to evaluate performance. The knowl- edge gained from evaluation could be used to decide whether to use a newer API or keep using the already existing choice. Direct3D 12 is the newest version of Direct3D. It is designed to be faster and more ecient than any previous version. In the world of PC gaming, the main program thread often does the most and sometimes all of the work. Direct3D 12 aims to make more ecient use of multi-core CPUs. One important factor when making the choice about which API to choose as a developer is that the majority of PC gaming hardware available already support Direct3D 12. This means that many users will be able to play games developed with Direct3D 12 without the need for additional hardware [2]. Based on previous work done within this area, Direct3D 12 should show a signif- icant improvement over its predecessor. In an article published on the DirectX Developer Blog the benchmark 3DMark got results which show improvement in CPU utilization and better distribution of work among threads [3]. 1 Chapter 1. Introduction 2 1.2 Research Question The goal within this thesis is to measure and compare performance between two APIs. This goal originates from the question: Will standard usage of Direct3D 12 have higher rendering performance when com- pared to an equivalent Direct3D 11 implementation? In order to evaluate the question an experiment was conducted. Since the re- search question revolves around "standard usage" this needs to be dened. For the purpose of this thesis this will be dened as rendering at shaded geometry using Direct3D according to MSDN documentation recommendations and the aim to keep the implementation of the Direct3D 12 API as close as possible to its Direct3D 11 counterpart. The rendering performance will be measured by the time required to render the geometry. To conduct the experiment a benchmark was developed using the C++ pro- gramming language. From this benchmark data, that can be used to evaluate performance, were generated. Chapter 2 Programming Using Direct3D In this chapter the basics of Direct3D is presented. This is intended to introduce the basic principles of the rendering pipeline and which parts that were used by the benchmark in the experiment and, the two types of rendering, immediate rendering and deferred rendering. 2.1 Rendering Pipeline The rendering pipeline refers to all the stages necessary to generate a 2D image given a geometric description of a scene with a positioned and oriented camera [4]. Figure 2.1 shows the stages available in this pipeline and the GPU memory resources on the right side. An arrow from the memory resource pool to a stage indicates that the stage can access the resources as input. The Pixel Shader stage and Output-Merger state has bidirectional arrows indicating that they both can read and write to the GPU resources. As seen in the gure most of the stages pass their output as input for the next stage in the pipeline; for example, the Input-Assembler reads geometric data from the resources and pass it to the Ver- tex Shader. For the purpose of this study only a few vital parts are used to render basic shaded geometry, these are shown in Figure 2.2. 3 Chapter 2. Programming Using Direct3D 4 Memory Resources (Buf%er, Texture& Constant Buffer) Input-Assembler Stage Vertex Shader Stage Hull Shader Stage Tessellator Stage Domain Shader Stage Geometry Shader Stage Stream Output Stage Rasterizer Stage Pixel Shader Stage utput-Merger Stage Figure 2.1: Stages of the rendering pipeline [4] Chapter 2. Programming Using Direct3D 5 Memory Resources (Buf!er, #exture" Constant Buffer) Input-Assembler Stage Vertex Shader Stage Rasterizer Stage Pixel Shader Stage Output-Merger Stage Figure 2.2: Simplied pipeline used in the benchmark application 2.1.1 Primitives Triangles, lines and points are three basic primitives that can be used to render geometry [5]. These primitives have in common that they can be dened from a number of vertices. Frank D. Luna states that "Mathematically, the vertices of a triangle are where two edges meet; the vertices of a line are the endpoints; for a single point, the point itself is the vertex." [5]. These primitives are the building blocks of 3D programming. The most common primitive in games is the triangle, which many objects are built from. Thus every improvement that can be made to the pipeline that allows for more ecient rendering of triangles is valuable for performance in programs that use many objects. 2.1.2 Shader Stages A shader is a program that is executed in parallell by the multiple cores of the graphics card [5]. These programs can be specied to align the visual output as needed for the application in mind. Dependent on the implementation these can be used as a part of rendering a simple 2D interface or used to render 3D objects with advanced lighting techniques. Chapter 2. Programming Using Direct3D 6 Vertex Shader The vertex shader program inputs a vertex and outputs a vertex. What hap- pens during this stage is dependent on the implementation of the program. A common case is that each input vertex is specied in world space and during the vertex shader stage it is transformed to homogeneous clip space in preparation for rendering the 2D representation of the world. Pixel Shader The pixel shader program is executed for each pixel fragment. This is the shader step that computes color according to the implementation, a simple implemen- tation could return a constant color or a color based on interpolated vertex at- tributes. More advanced techniques can also be set in motion such as per-pixel lighting, shadows and reections.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    29 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us