开发者

Offloading to HLSL/GPU without displaying?

开发者 https://www.devze.com 2022-12-27 03:10 出处:网络
As far as I know, certain mathematical functions like FFTs and perlin noise, etc. can be much 开发者_Python百科faster when done on the GPU as a pixel shader. My question is, if I wanted to exploit thi

As far as I know, certain mathematical functions like FFTs and perlin noise, etc. can be much 开发者_Python百科faster when done on the GPU as a pixel shader. My question is, if I wanted to exploit this to calculate results and stream to bitmaps, could I do it without needing to actually display it in Silverlight or something?

More specifically, I was thinking of using this for large terrain generation involving lots of perlin and other noises, and post-processing like high passes and deriving normals from heightmaps, etc, etc.


The short answer is yes. The longer answer is that you can set (for example) a texture as the render target, which deposits your results there.

Unless you're really set on using a shader to do the calculation, you might want to consider using something that's actually designed for this kind of job such as Cuda or OpenCL.


Hmm its a good question.

Anything that can be displayed can be rendered using an instance of WriteableBitmap and its Render method. You can access the output using the Pixels byte array property.

However (assuming GPU acceleration is turned on and the content is appropriately marked to make use of the GPU) whether such a render will actually make use of the GPU when going to a WriteableBitmap instead of the display I don't know.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号