Skip to main content
GameDev.net gamedev.net
🔒 Locked

Howto use ams instructions inside HLSL function? [DX9, sm3.0]

Started by 51mon Aug 30, 2009 at 1:42 PM 2 replies 1.9k views
Original Post
51mon
51mon
Hi I searched but had problems to find this info. I want to incorporate some asm code in my HLSL code. The head of my function looks like this: void PSCSM( in float dist, in float4x4 coordLightSpaceArray, out float shadow) I tried to use asm_fragment together with input registers v_dist and v_coordLightSpaceArray But I get the error message: "error X2005: Invalid input register 'v_dist' specified" Can I solve this somehow? Or can I use implementation with the "asm" keyword instead? How do I bind HLSL variables to the registers in that case? If anybody knew the answers to my questions I would be sooo thrilled :) Thanks [Edited by - 51mon on August 30, 2009 3:56:30 PM]
Erik Rufelt
Erik Rufelt
What shader model and API are you using?
ASM is no longer supported in shader model 4.

If you're using an earlier version you can check Writing HLSL Shaders in Direct3D 9, if you haven't already done so, where asm_fragment is discussed at the bottom of the page. Not sure if it helps..

EDIT: I see in your topic now that you're using sm3.0 =)
51mon
51mon
Quote:
Original post by Erik Rufelt
What shader model and API are you using?
ASM is no longer supported in shader model 4.

If you're using an earlier version you can check Writing HLSL Shaders in Direct3D 9, if you haven't already done so, where asm_fragment is discussed at the bottom of the page. Not sure if it helps..

EDIT: I see in your topic now that you're using sm3.0 =)


Thanks, but I already checked that page out. I got problems with mapping the function parameters to the assembly code. When I put "v_" in front of them I got the X2005 error.
51mon
51mon
Hi again
I changed the v_dist for r_dist(etc), that makes sense when I think about it. I still got problems to connect the assembly implemented function to the HLSL code, though.

So what I'm trying to do, is to have one function implemented with assembly code. Then I want that function to be called by several high level implemented (HLSL) functions. How do I do it?


Thanks

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.