1
\$\begingroup\$

The DX Shader Model 5.0 has a lod instruction. It returns "the LOD (level of detail) that would be used for texture filtering".

Does HLSL have a built-in intrinsic that can do the same? I know I could evaluate the LOD manually, but I'm wondering if there's a better way.

\$\endgroup\$
  • \$\begingroup\$ What? You refer to a hlsl instruction and then ask if the same one is available? could you clear up your question abit? \$\endgroup\$ – Tordin Nov 15 '13 at 13:35
  • \$\begingroup\$ @Tordin They seem to be referring to an existing DX Shader Model instruction and want to know if GLSL has a similar one. I've edited to clarify. \$\endgroup\$ – Anko Nov 15 '13 at 13:40
  • \$\begingroup\$ @Anko No, there is Shader Model Assembly and HLSL. The first one is like x86 assembly and HLSL is like C language. So we generally write shaders in HLSL and it is compiled to asm code by DirectX (which can be viewed using Shader Dump feature). \$\endgroup\$ – michalo2882 Nov 15 '13 at 15:17
  • \$\begingroup\$ Finally found it! It's Object.CalculateLevelOfDetail not listed under Shader Model 5 Reference, but under 4. \$\endgroup\$ – michalo2882 Nov 15 '13 at 15:58
  • \$\begingroup\$ @michalo2882 Yeah, the organization of the MSDN docs is kind of annoying - SM5 includes everything in SM4, so the SM5 docs only have the stuff that was new in SM5. Anyway, you should post an answer to your question and accept it. \$\endgroup\$ – Nathan Reed Nov 15 '13 at 17:40
1
\$\begingroup\$

Finally found it! It's Object.CalculateLevelOfDetail. It's not listed under Shader Model 5 Reference, but under 4.

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.