GPU programming BASICS (6) gpu asm vertex rendering preliminary

Source: Internet
Author: User

I think this question should have something to do with compilation .... Some people may think that the importance of assembly is very low when learning games, especially when there are so many advanced languages... Error... Why is it wrong? Look for a book .. Click here... Read this articleArticleIt should be a bit of a compilation basis, just compile it yourself

In the early stages of GPU-programmable real-time rendering, before HLSL and CG languages appeared, GPU-based rendering was performed in a language similar to the ASM of assembly, which is difficult to get started, however, like an assembly language, it is more efficient than an advanced rendering language for the same reason, because the advanced language requires compilation. Let's take two minutes to briefly introduce the basic syntax and functions of vertex and pixel ASM language.

If you ask why you want to learn it, it is no harm for me to use one more course. Then I will tell you, because it used to be in this language, in addition, some people prefer this method, so many GPU programming books on the market are written Using ASM to find out how long it will not take, if you have learned the assembly, you can scan it. If you don't read it, you may miss a lot of wonderful things. Topic (I found that talking nonsense before the topic will make me a pleasure .... Khan ):

The first is the input and output of the vertex shader, that is, the overall architecture,

The following is a brief explanation. The vertex shader runs each vertex once. The main input is vertex. The registers include the input registers and output registers. The input registers include

An address register A0 is a special register that can index constants. Specifically, it sets the address register as the index value when processing each vertex, you can use the appropriate constants. A lot of people may not understand this, but it is actually very simple. When I use an instance, I will understand it at a glance.

12 temporary read/write registers R0 ~ R11 is a register used to store data in complex computing processes. Note that the registers and vertex color finder are not consecutive.

Constant register C (n), at least 256, which is of the floating point type. It stores four-dimensional vectors and is readable and can be used externally.ProgramWrite, the most common purpose is to set the transformation matrix and other data that affects the vertex.

Vertex element register V0 ~ V16, floating point type, is a four-dimensional vector that is readable and used to input vertex data.

Next is the output register, as follows: opos: The final vertex position after the output transformation, that is, the screen Coordinate

Od1 ~ 2, two color outputs, diffuse reflection and mirror reflection, four-dimensional Vector

Ot1 ~ 8. Texture output registers and four-dimensional Vectors

Ofog, output atomization value, float type

Opts, vertex size, floating point type

Then there are common vertex coloring machine commands. If you do not need to write them, give the figure:

 

 

 

Cut... Why can't all of them be uploaded? Bad blogs, and articles saved as drafts cannot be published. Isn't it because I am too sb to get it ?! Cut ...... BS ..

PS: the figure in this article comes to the "Real Time Rendering tricks and techniques in DirectX" online with an e-book. You can take a look at it. This book is all written in ASM. It's wonderful. Getting started, all the improvements are good... Do it yourself ....

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/gamedevers/archive/2007/08/11/1738618.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.