GLSL最大指令数 [英] GLSL maximum number of instructions
本文介绍了GLSL最大指令数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有最大数量的汇编语言指令要加载到片段程序单元中? 我有一种从cpu移植到gpu的算法,显然它不适合gpu.
Is there a maximum number of assembly language instructions to be loaded into the fragment program unit? I have an algorithm on to port from cpu to gpu and apparently it doesn't fit on the gpu.
推荐答案
存在一些硬性限制和软性限制,其中一些并不立即显而易见:
There are several hard and soft limits, some of which are not immediately obvious:
- 指令槽:硬件可以在本地内存中容纳的指令总数.
- 已执行指令:将要执行的最大指令数(包括在循环中运行多次的指令)
- 一条GLSL指令可以映射到十几条或更多指令
- 根据优化程序的质量(例如乘加,点,lerp),几条GLSL指令可以映射到一条指令
- 有限的临时寄存器(仅32个)可能需要比SM4之前的硬件所需的指令更多的指令(对于4096,则没有这种问题). 如今,
- 打扰通常不需要额外的指令,但是在某些较旧的硬件上确实需要,并且在某些硬件上在某些情况下可以(尤其是gl_FragColor是这样的一种选择)
- 不管实际使用的指令如何,OpenGL 2.0兼容的硬件仅限于8个依赖纹理的获取(在可以执行OpenGL 2.1或更高版本的硬件上不受限制)
- Instruction slots: The total number of instructions that the hardware can accomodate in local memory.
- Executed instructions: The maximum number of instructions that will execute (including instructions that run several times in a loop)
- A single GLSL instruction can map to a dozen or more instructions
- Several GLSL instructions can map to a single instruction depending on the optimizer's quality (e.g. multiply-add, dot, lerp)
- Limited temp registers (only 32) may require more instructions than necessary on pre-SM4 hardware (no such problem with 4096).
- Swizzling usually does not cost extra instructions nowadays, but does on some older hardware, and may in some situations on some hardware (esp. gl_FragColor is such a candidate)
- Regardless of actual instructions, OpenGL 2.0 compatible hardware is limited to 8 dependent texture fetches (unlimited on hardware that can do OpenGL 2.1 or better)
您具有这些保证的下限(大多数卡具有更多下注):
You have these guaranteed minimums (most cards have more):
- 512个指令槽,用于支持OpenGL 2.x(SM3)的硬件上的顶点和像素着色器
- 65536已执行指令
- 512 instruction slots for vertex and pixel shaders on OpenGL 2.x (SM3) capable hardware
- 65536 executed instructions
- 65536执行的顶点着色器指令,无限像素着色器指令
这篇关于GLSL最大指令数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文