Asm Shader Reference --- Shader Model 3.0 part
ps部分
概览
Instruction Set | |||||||||
Name | Description | Instruction slots | Setup | Arithmetic | Texture | Flow control | New | ||
abs - ps | 绝对值 | 1 | x | ||||||
add - ps | 加法运算 | 1 | x | ||||||
break - ps | 跳出一个循环 | 1 | x | ||||||
break_comp - ps | 通过一个比较跳出循环 | 3 | x | ||||||
breakp - ps | 基于一个断言跳出循环 | 3 | x | ||||||
call - ps | 调用一个子程序 | 2 | x | ||||||
callnz bool - ps | 如果一个boolean寄存器不为0的话调用一个子程序 | 3 | x | ||||||
callnz pred - ps | 如果一个predicate寄存器不为0的话调用一个子程序 | 3 | x | ||||||
cmp - ps | 以0为比较赋值 | 1 | x | ||||||
crs - ps | 叉积 | 2 | x | ||||||
dcl_samplerType (sm2, sm3 - ps asm) | 为采样器声明贴图维数 | 0 | x | ||||||
dcl_semantics (sm3 - ps asm) | 声明输入输出寄存器 | 0 | x | x | |||||
def - ps | 定义常量 | 0 | x | ||||||
defb - ps | 定义一个 Boolean 常量 | 0 | x | ||||||
defi - ps | 定义一个integer 常量 | 0 | x | ||||||
dp2add - ps | 2D 点积之后加法运算 | 2 | x | ||||||
dp3 - ps | 3D 点积 | 1 | x | ||||||
dp4 - ps | 4D 点积 | 1 | x | ||||||
dsx - ps | 改变x方向的比率 | 2 | x | ||||||
dsy - ps | 改变y方向的比率 | 2 | x | ||||||
else - ps | else块 | 1 | x | ||||||
endif - ps | if结束 | 1 | x | ||||||
endloop - ps | 结束loop | 2 | x | x | |||||
endrep - ps | 结束repeat | 2 | x | ||||||
exp - ps | 全精度计算2的幂 | 1 | x | ||||||
frc - ps | 小数部分 | 1 | x | ||||||
if bool - ps | if块 | 3 | x | ||||||
if_comp - ps | 比较形式的if | 3 | x | ||||||
if pred - ps | 断言形式的if | 3 | x | ||||||
label - ps | 标签 | 0 | x | ||||||
log - ps | 全精度计算log₂(x) | 1 | x | ||||||
loop - ps | 循环 | 3 | x | x | |||||
lrp - ps | 线性插值 | 2 | x | ||||||
m3x2 - ps | 3x2 乘法 | 2 | x | ||||||
m3x3 - ps | 3x3 乘法 | 3 | x | ||||||
m3x4 - ps | 3x4 乘法 | 4 | x | ||||||
m4x3 - ps | 4x3 乘法 | 3 | x | ||||||
m4x4 - ps | 4x4 乘法 | 4 | x | ||||||
mad - ps | 乘法之后加法运算 | 1 | x | ||||||
max - ps | 最大值 | 1 | x | ||||||
min - ps | 最小值 | 1 | x | ||||||
mov - ps | 赋值 | 1 | x | ||||||
mul - ps | 乘法 | 1 | x | ||||||
nop - ps | 无运算 | 1 | x | ||||||
nrm - ps | 单位化 | 3 | x | ||||||
pow - ps | 幂运算 | 3 | x | ||||||
ps | 版本 | 0 | x | ||||||
rcp - ps | 倒数 | 1 | x | ||||||
rep - ps | 循环 | 3 | x | ||||||
ret - ps | 对主函数或子程序做return处理 | 1 | x | ||||||
rsq - ps | 平方根的倒数 | 1 | x | ||||||
setp_comp | 设置断言寄存器 | 1 | x | ||||||
sincos - ps | Sin和cos | 8 | x | ||||||
sub - ps | 减法运算 | 1 | x | ||||||
texkill - ps | 中断像素渲染 | 2 | x | ||||||
texld - ps_2_0 and up | 采样一个贴图 | See note 1 | x | ||||||
texldb - ps | 根据w部分进行对贴图的level-of-detail bias采样 | 6 | x | ||||||
texldl - ps | 根据来自w通道的level-of-detail来采样图片 | See note 2 | x | x | |||||
texldd - ps | 用户提供一个剃度值来采样贴图 | 3 | x | ||||||
texldp - ps | 根据w部分进行对贴图的投影划分采样 | See note 3 | x | ||||||
部分函数细节
dcl_semantics (sm3 - ps asm)
语法
dcl_semantics [_centroid] dst[.write_mask]
示例
ps_3_0
; Declaring inputs
dcl_normal v0.xyz
dcl_blendweight v0.w ; Must be same reg# as normal,matching vshader packing
dcl_texcoord1 v1.y ; Mask can be any subset of mask from vshader semantic
dcl_texcoord0 v1.zw; Has to be same reg# as texcoord1, to match vshader
; Declaring samplers
dcl_2d s0
dcl_2d s1
def c0, 0, 0, 0, 0
mov r0.x, v1.y ; texcoord1
mov r0.y, c0
texld r0, r0, s0
texld r1, v1.zw, s1
...
(output regs in ps_3_0 are same as ps_2_0: oC0-oC3,oDepth)
texldl - ps
语法
texldl dst, src0, src1
用于mipmap处理
算法
在mipmap滤波方式为linear时
LOD = src0.w + LODBIAS;
if (LOD <= 0 )
{
LOD = 0;
Filter =MagFilter;
tex = Lookup(MAX(MAXMIPLEVEL, LOD), Filter );
}
else
{
Filter =MinFilter;
LOD = MAX(MAXMIPLEVEL, LOD );
tex = Lookup(Floor(LOD), Filter );
if( MipFilter ==LINEAR )
{
tex1 =Lookup( Ceil(LOD), Filter );
tex = (1 -frac(src0.w))*tex + frac(src0.w)*tex1;
}
}
vs部分
概览
Instruction Set | |||||||||
Name | Description | Instruction slots | Setup | Arithmetic | Texture | Flow control | New | ||
abs - vs | 绝对值 | 1 | x | ||||||
add - vs | 加法运算 | 1 | x | ||||||
break - vs | 跳出一个循环 - vs...endloop - vs 或者 rep...endrep 块 | 1 | x | ||||||
break_comp - vs | 通过一个比较跳出循环 - vs...endloop - vs or rep...endrep block, with a comparison | 3 | x | ||||||
breakp - vs | 跳出一个循环 - vs...endloop - vs 或 rep...endrep 块, 基于一个断言 | 3 | x | ||||||
call - vs | 调用一个子程序 | 2 | x | ||||||
callnz bool - vs | 如果一个boolean寄存器不为0的话调用一个子程序 | 3 | x | ||||||
callnz pred - vs | 如果一个predicate寄存器不为0的话调用一个子程序 | 3 | x | ||||||
crs - vs | 叉积 | 2 | x | ||||||
dcl_usage input (sm1, sm2, sm3 - vs asm) | 为采样器声明贴图维数 | 0 | x | ||||||
dcl_samplerType (sm3 - vs asm) | 为采样器声明贴图维数 | 0 | x | x | |||||
def - vs | 定义常量 | 0 | x | ||||||
defb - vs | 定义一个 Boolean 常量 | 0 | x | ||||||
defi - vs | 定义一个integer 常量 | 0 | x | ||||||
dp3 - vs | 3D 点积 | 1 | x | ||||||
dp4 - vs | 4D 点积 | 1 | x | ||||||
dst - vs | 计算距离向量 | 1 | x | ||||||
else - vs | Begin an else block | 1 | x | ||||||
endif - vs | 结束if - vs...else - vs block | 1 | x | ||||||
endloop - vs | 结束循环 - vs block | 2 | x | ||||||
endrep - vs | 结束 repeat 块 | 2 | x | ||||||
exp - vs | 全精度计算2的幂 | 1 | x | ||||||
exp - vs | 半精度计算2的幂 | 1 | x | ||||||
frc - vs | 小数部分 | 1 | x | ||||||
if bool - vs | Begin an if bool - vs block (using a Boolean condition) | 3 | x | ||||||
if_comp - vs | Begin an if bool - vs block, with a comparison | 3 | x | ||||||
if pred - vs | Begin an if bool - vs block with a predicate condition | 3 | x | ||||||
label - vs | 标签 | 0 | x | ||||||
lit - vs | 局部光照计算 | 3 | x | ||||||
log - vs | 全精度计算log₂(x) | 1 | x | ||||||
logp - vs | 半精度计算log₂(x) | 1 | x | ||||||
loop - vs | 循环 | 3 | x | ||||||
lrp - vs | 线性插值 | 2 | x | ||||||
m3x2 - vs | 3x2 乘法 | 2 | x | ||||||
m3x3 - vs | 3x3 乘法 | 3 | x | ||||||
m3x4 - vs | 3x4 乘法 | 4 | x | ||||||
m4x3 - vs | 4x3 乘法 | 3 | x | ||||||
m4x4 - vs | 4x4 乘法 | 4 | x | ||||||
mad - vs | 乘法之后加法运算 | 1 | x | ||||||
max - vs | 最大值 | 1 | x | ||||||
min - vs | 最小值 | 1 | x | ||||||
mov - vs | 赋值 | 1 | x | ||||||
mova - vs | 从浮点寄存器到地址寄存器(a0)移动数据 | 1 | x | ||||||
mul - vs | 乘法 | 1 | x | ||||||
nop - vs | 无运算 | 1 | x | ||||||
nrm - vs | 单位化 | 3 | x | ||||||
pow - vs | 幂运算 | 3 | x | ||||||
rcp - vs | 倒数 | 1 | x | ||||||
rep - vs | 循环 | 3 | x | ||||||
ret - vs | 对主函数或子程序做return处理 | 1 | x | ||||||
rsq - vs | 平方根的倒数 | 1 | x | ||||||
setp_comp - vs | 设置断言寄存器 | 1 | x | ||||||
sge - vs | 大于等于比较 | 1 | x | ||||||
sgn - vs | 返回符号 | 3 | x | ||||||
sincos - vs | Sin和cos | 8 | x | ||||||
slt - vs | 小于比较 | 1 | x | ||||||
sub - vs | 减法 | 1 | x | ||||||
texldl - vs | 根据用户可调level-of-detail载入贴图 | See note 1 | x | x | |||||
vs | 版本 | 0 | x | ||||||
---wolf96 2017/1/3
Asm Shader Reference --- Shader Model 3.0 part的更多相关文章
- Asm Shader Reference --- Shader Model 2.0 part
ps部分 ps_2_0 概览 Instruction Set Name Description Instruction slot ...
- Asm Shader Reference --- Shader Model 2.x part
ps部分 概览 Instruction Set Name Description Instruction slots S ...
- Asm Shader Reference --- Shader Model 1 part
ps部分 ps_1_1,ps_1_2,ps_1_3,ps_1_4 总览 Instruction Set ...
- 微软的HLSL Shader Model 6.0 compiler要转向LLVM了,开源的节奏. Apple/Khronos都有各自计划
So, Microsoft is making an opensource HLSL-to-almost-LLVM compiler, and Khronos is making an opensou ...
- Shader Model 3.0:Using Vertex Textures SM3:使用顶点纹理 (NVIDIA spec, 6800支持使用D3DFMT_R32F and D3DFMT_A32B32G32R32F的纹理格式实现Vertex Texture。)
翻译者 周波 zhoubo22@hotmail.com 版权所有 Philipp Gerasimov Randima (Randy) Fernando Simon Green NVIDIA Corpo ...
- Unity3D for VR 学习(9): Unity Shader 光照模型 (illumination model)
关于光照模型 所谓模型,一般是由学术算法发起, 经过大量实际数据验证而成的可靠公式 现在还记得2009年做TD-SCDMA移动通信算法的时候,曾经看过自由空间传播模型(Free space propa ...
- ePass1000 Full ActiveX Control Reference Manual Version 2.0
ePass1000 Full ActiveX Control Reference Manual Version 2.0 Error Code Value Return Status Descripti ...
- caffe编译时候出现 undefined reference to `TIFFReadRGBAStrip@LIBTIFF_4.0'
1.编译时候出现 make: * [.build_release/examples/siamese/convert_mnist_siamese_data.bin] Error 1 /usr/local ...
- Create a Basic Shader in Shader Forge
[Create a Basic Shader in Shader Forge] 1.打开ShaderForge.Window-> Shader Forge.(打开速度较慢) 2.通过NewSha ...
随机推荐
- PHP学习心得(一)——简介
PHP(“PHP: Hypertext Preprocessor”,超文本预处理器的字母缩写)是一种被广泛应用的开放源代码的多用途脚本语言,它可嵌入到 HTML中,尤其适合 web 开发. PHP 脚 ...
- python学习笔记——列表生成式与生成器
1.列表生成式(List Comprehensions) python中,列表生成式是用来创建列表的,相较于用循环实现更为简洁.举个例子,生成[1*1, 2*2, ... , 10*10],循环用三行 ...
- codeforces 633D - Fibonacci-ish 离散化 + 二分查询
Fibonacci-ish Yash has recently learnt about the Fibonacci sequence and is very excited about it. He ...
- OpenGL列主元矩阵的运算
大学线性代数课本是用的行主元矩阵,OpenGL使用的是列主元矩阵.有什么差别呢,对于线性代数学得不够扎实的孩纸来说,还挺烦的. 其实明白了就觉得很简单: 从课本的角度来看,平移矩阵是诸如这样的: 平移 ...
- ms flexbox 布局 (ko list)
<!DOCTYPE html> <html> <head> <title></title> <script src="js/ ...
- python 读取SQLServer数据插入到MongoDB数据库中
# -*- coding: utf-8 -*-import pyodbcimport osimport csvimport pymongofrom pymongo import ASCENDING, ...
- [转载]C#图片格式(JPG,BMP,PNG,GIF)等转换为ICO图标
using System; using System.Drawing; using System.Windows.Forms; using System.IO; namespace ICOTest { ...
- android 自定义按钮的外边框
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http: ...
- 李洪强iOS开发之-PCH文件的配置
pch 可以用来存储共享信息,比如设备屏幕的宽度,高度.版本号等等 公用信息 Xcode 老版本会自动为我们创建pch文件,新版本开始不自动创建了,如果需要使用可以自己手动创建 创建完成后可以在里面定 ...
- MMU、Icache、Dcache
http://blog.csdn.net/iodoo/article/details/8954014 i-cache(instruction cache)是指令高速缓冲存储器. Cache存储体:存放 ...