Port HLSL to x86 Assembly

Started by
13 comments, last by TheChubu 10 years, 2 months ago

Thanks to all.

DX11 WARP runs very well (and slow but that's not the problem, right?), however that's not quite just what OP asked, I guess..

Well... he said "I need to recreate in the CPU, some of the calculations done in the GPU." which... I'm not sure exactly what he has in mind TBH. I just thought I'd mention it as an option, but you are correct in that it is not a HLSL to x86 assembly converted in the sense that the assembly could then be extracted and used elsewhere, though I imagine somewhere deep inside is a hlsl bytecode to assembly converter. So... ummm ya, without more info from the OP I'm not really sure TBH.

I need to recreate all shader instructions in the CPU. My idea was porting all opcodes generated by the shader to x86. And run it in the CPU to replicate it.

HLSL Bytecode and x86 seem very similar, I am not familiar with HLSL but I code in ASM, that's why I was thinking of porting it.

Advertisement

HLSL isn't too far syntactically from c++. If it's just some calculations you need you could probably put that code in a separate file, and #include it into both your HLSL and c++ code files. You might need a bit of macro magic to make everything work.

There are sampling instructions which do various kinds of texture filtering and then there are vector instructions, fences and many things, which you'd have to emulate in SW.

HLSL compiles to D3D bytecode, which still isn't really "assembly" and that gets compiled (JIT) to real HW ASM. Do you want to emulate this in SW or what is the reason? I don't understand how the fact that you code in ASM helps you, since you'll have to get familiar with HLSL (which is C++ "like") anyway.

There are sampling instructions which do various kinds of texture filtering and then there are vector instructions, fences and many things, which you'd have to emulate in SW.

HLSL compiles to D3D bytecode, which still isn't really "assembly" and that gets compiled (JIT) to real HW ASM. Do you want to emulate this in SW or what is the reason? I don't understand how the fact that you code in ASM helps you, since you'll have to get familiar with HLSL (which is C++ "like") anyway.

I am dissasembling the shader code, and that's why they seem very similar. I will follow your advices

I read the thread title as "Port HTML to x86 assembly", that would be quite the experience :D

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

This topic is closed to new replies.

Advertisement