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

 

 

 




  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
本书为 TNT DOS-Extender 8.0 的参考手册之一。 386|ASM Reference Manual (386|ASM 宏汇编参考工具) Phar Lap 的宏汇编语言的 x86 系列微处理器的技术参考书。 ---------------------------------------------------------- 欢迎使用 TNT DOS-Extender 和 TNT Realtime DOS-Extender,这是 Phar Lap 的最新的那个年代曾经屡获殊荣 DOS 扩展器技术! 这个产品为运行在 MS-DOS 或 PC-DOS 的程序提供了32位 x86 保护模式运行环境。 TNT Realtime DOS-Extender 支持DOS下多线程序的运行时程序。 TNT DOS-Extender Reference Manual 参考手册详细介绍了应用程序需要的保护模式环境。 System Requirements 386, 486, Pentium 或更高处理器 2 MB 扩展内存 10 MB 剩余硬盘空间 MS-DOS 3.0 或以上版本 32-bit C/C++编译链接工具,可使用 Borland C++、Visual C++、Watcom C/C++、Open Watcom C/C++(推荐)等32位编译工具 TNT DOS-Extender 可以使用下面的编译和链接工具的组合: Microsoft Visual C/C++ for Windows and Windows NT, 32位版本编译器和链接器 (CL and LINK) Microsoft Visual C/C++ for Windows and Windows NT, 32版本编译器和Phar Lap连接器(TNT链接器) (CL and 386LINK) MetaWare High C/C++ 编译器和Phar Lap连接器(TNT链接器) (HC386 and 386LINK) Open-Watcom C/C++32 编译器和Phar Lap连接器(TNT链接器) (WCC386 and 386LINK) TNT DOS-Extender 包括下面的文档 TNT DOS-Extender Reference Manual(参考手册) 保护模式环境详细介绍(各种参数)、编程介绍 C/C++ User’s Guide to TNT DOS-Extender (用户指南) A tutorial style guide to developing C and C++ programs for TNT DOS-Extender, including instructions for building programs using the Microsoft Visual C/C++ for Windows and Windows NT, 32-bit Edition compiler, the MetaWare High C/C++ compiler, and the WATCOM C/C++32 compiler. Libraries and System Calls Reference (库和系统调用参考) Complete documentation on the C-callable TNT DOS-Extender system calls in DOSX32.LIB, the C-callable MS-DOS and BIOS system calls in DOS32.LIB, the C-callable NtStyle Win32 API subset, and the register-based software interrupt interface for TNT DOS-Extender, MS-DOS, and BIOS system calls. Utilities Reference Manual (工具参考手册) A reference on the utility programs included with the TNT DOS-Extender SDK, including: the 386|LINK linker; the 386|LIB librarian; the REBIND binder utility program; the PLSTRIP symbol table strip utility; the CFIG386 configuration utility; the MAPEXE executable file dump program; and t

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值