cyberorg012 / slimdx

Automatically exported from code.google.com/p/slimdx
MIT License
1 stars 0 forks source link

DataStream position is always 0 when reading #868

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi!

I ran into a problem using the DataStream class.

The context:
I compile an effect (profile fx_4_0) using this:
ShaderBytecode.CompileFromFile(f, "fx_4_0", ShaderFlags.OptimizationLevel3, 
EffectFlags.None, null, null);

then I want to store the bytecode into a file, so I read the DataStream 
contained in the ShaderByteCode class returned by CompileFromFile.
The problem is, when I read the data, the position of the stream remains 0.

Don't really know why it happens, I didn't have problems with the DataStream 
class in other circumstances... I also looked at the cpp code and the C# code 
(using reflector), and didn't see anything that could lead to this behavior, so 
I wonder if it has something to do with the way the ShaderByteCode class 
initializes the Data member.

Anyway you are the experts so I thought I'd write something about this problem.

Original issue reported on code.google.com by Pavel.Pe...@gmail.com on 8 Jun 2012 at 4:53

GoogleCodeExporter commented 8 years ago
There's no reason why this should be the case. Are you sure that's the behavior 
you were seeing?

Original comment by Mike.Popoloski on 20 Jul 2012 at 4:37

GoogleCodeExporter commented 8 years ago
I'm sorry but yes I'm sure, I spent half a day on this before I had to write a 
class derived from DataStream that gives me the correct position.
If it can help I can try to find the exact code I was using then and send it to 
you.
If you need other information feel free to ask ;)

Original comment by Pavel.Pe...@gmail.com on 20 Jul 2012 at 11:09

GoogleCodeExporter commented 8 years ago
Well if you know how to fix it, that's great. Just let me know what the problem 
was and I'll fix it in mainline.

Original comment by Mike.Popoloski on 20 Jul 2012 at 3:18

GoogleCodeExporter commented 8 years ago
I found a work around, not really a fix, but I'll dig this when I'll have some 
time

Original comment by Pavel.Pe...@gmail.com on 24 Jul 2012 at 3:15

GoogleCodeExporter commented 8 years ago
Without any info, I can't fix this. Closing as no repro. I'll reopen if you 
ever get back with specific information.

Original comment by Mike.Popoloski on 10 Sep 2012 at 2:06