Hi,
is there any way how to generate textures in C# / Managed DX directly from the memory I'd need to point somehow directly to data I've saved into memory and because it's quite big amount of data and it needs to be repainted really quickly, I need to say the texture to be generated from memory (and so anytime I'd update memory the texture would change). Using stream means twice more fork and it's really slow.
Does anyone know how to solve it All I have is a pointer to memory and I need a texture.
Thanks

Textures from "raw" memory
zomi_ds
Anyway it seems to be exactly what I need - thank you very much
Rogas
Try this:
1. Create your textures for the slices in advanced.
2. Every time you have to update one slice call LockRectangle for the texture of this slice
3. You can now use the “InternalDataPointer“ property from the graphics stream to access the texture data.
4. After you have updated the slice call UnlockRectangle.
This will save you from copy the whole data twice.
cb_benton
I am mean directly after you have created the device. I am only want to make sure that you don’t create a new texture every time before you update a slice.
Corrado Cavalli
Unfortunately you can’t do this but I am sure there is a faster way to update your textures as that one you currently used.
At least you can do a fast copy from your raw memory to the texture memory without using the Write method of the graphics stream.
If you are willing to show some of your code that you use at the moment to transfer you raw data to the texture I will try to make a suggestion to solve it faster.
Have you try to move your calculations of this raw data to the GPU Sometimes this is possible.
George V. Reilly
How could I move it there Would I be able to acces the memory directly on graphic card
I just want to tell that the data is generated from a volume (unsafe code - allocated memory block of size about 2048^3 bytes) into slices (like 2d array but the same way allocated memory block) and these slices (up to 1024*1024) has to be rendered somehow (the data is 16 bit but it has to be transferred into 8 bit and rendered as R8G8B8A8 because the final version should work with more than one volume). Reading the data from volume and storing into slices is quite fast, filtering is really slow (I also tried to use FillTexture2DCallBack and it's slow because I have to controll the acces through the member attributes) and after the filtering I have to take all the data and store them into stream and let them be read by a function. The idea I have is that after the filtering (which I can optimize somehow) I wouldn't move the data somehow (copy up 33MB in realtime, several times per second is kind of ... slow :) but I would acces directly the texture memory and update it during filtering.
I have no idea how to make it because of a managed code (could I possibly use C++ this way and precompile the code to be able to call it from C# - that's the last option I'd like to use)