Created
March 17, 2021 15:33
-
-
Save GuyInGrey/7301b05423459c3f5a77b7cdfea14df0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public readonly struct MandelbrotShader : IComputeShader | |
{ | |
public readonly ReadWriteTexture2D<Rgba32, Float4> image; | |
public readonly Float4 viewport; | |
public readonly int maxIterations; | |
public readonly float power; | |
public MandelbrotShader( | |
ReadWriteTexture2D<Rgba32, Float4> image, | |
Float4 viewport, | |
int maxIterations, | |
float power | |
) { | |
this.image = image; | |
this.viewport = viewport; | |
this.maxIterations = maxIterations; | |
this.power = power; | |
} | |
public void Execute() | |
{ | |
var pX = ThreadIds.X; | |
var pY = ThreadIds.Y; | |
var cX = Hlsl.Lerp(pX / image.Width, viewport.X, viewport.W); | |
var cY = Hlsl.Lerp(pY / image.Height, viewport.Y, viewport.Z); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment