James-Jones / HLSLCrossCompiler

Other
468 stars 81 forks source link

Assertion failing during convert #4

Closed braddabug closed 10 years ago

braddabug commented 10 years ago

This probably more of a user error than an issue, but I can't seem to get anything to convert. I either get a failed assertion in GetConstantBufferFromBindingPoint() (psShaderInfo->ui32NumConstantBuffers is always 0) or a crash in AddUserOutput() (psSignature is null when the switch tries to access it), depending on exactly which shader I try to convert.

I'm not compiling the HLSL with the strip_reflect or strip_debug options. Is there anything stupid that I'm forgetting to do?

James-Jones commented 10 years ago

Are you using the HLSLcc executable or compiling into a lib? Are you using the lasted code on the main branch? Does runall.py script in tests\ work for you? Run that script inside the tests directory with the hlslcc binary built in bin\ or bin\debug or bin\release. The basic steps for offline-compiling are: fxc /T shader-model /Fc asm-file-to-create /Fo object-file-to-create /E entry-point-func (not needed if called main()) hlsl-file HLSLcc -in=object-file -out=glsl-file-to-create If you are still having trouble you could create a gist for me to look at with the shader you are using (hlsl, bin and asm), the fxc command line you used and the HLSLcc command line.

braddabug commented 10 years ago

I was trying to embed the code within my own tool, but I also tried with HLSLcc and had the same problem. I got a fresh zip today and tried everything again, and same problem.

Here is a gist with the fx and asm files. I'm still trying to figure out how to upload the bin file (I don't know git at all. git says the file is committed, but it's not showing up). https://gist.github.com/braddabug/0f5c31b71f679138e396

Edit: I finally got shader.o committed.

James-Jones commented 10 years ago

AlphaTestEffect with ps_4_0 was ok but found a problem with p_4_0_level_9_1. I have pushed a fix, please confirm it fixes your problem.

braddabug commented 10 years ago

Thanks! I think this solved my problem. I'll close the issue.