Commit d043a2bc authored by Chuck Walbourn's avatar Chuck Walbourn
Browse files

More Win32 classic samples

parent 8007a893
Loading
Loading
Loading
Loading
+1.24 KiB (132 KiB)

File changed.

No diff preview for this file type.

+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
    <RootNamespace>SimpleBezierPC12</RootNamespace>
    <ProjectGuid>{80635a81-c0ed-4eed-b484-7b7b2eb9c9f9}</ProjectGuid>
    <Keyword>Win32Proj</Keyword>
    <WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
    <WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+43 −0
Original line number Diff line number Diff line
//--------------------------------------------------------------------------------------
// File: fractal.hlsl
//
// This is a compute shader that draws a Mandelbrot fractal.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------

RWTexture2D<float4> OutputTexture : register(u0);
Texture2D ColorMapTexture : register(t0);
SamplerState ColorMapSampler : register(s0);

cbuffer cb0
{
	float4 g_MaxThreadIter : packoffset(c0);
	float4 g_Window : packoffset(c1);
}

[numthreads(8, 8, 1)]
void main(uint3 DTid : SV_DispatchThreadID)
{
	float2 WindowLocal = ((float2)DTid.xy / g_MaxThreadIter.xy) * float2(1, -1) + float2(-0.5f, 0.5f);
	float2 coord = WindowLocal.xy * g_Window.xy + g_Window.zw;

	uint maxiter = (uint)g_MaxThreadIter.z * 4;
	uint iter = 0;
	float2 constant = coord;
	float2 sq;
	do
	{
		float2 newvalue;
		sq = coord * coord;
		newvalue.x = sq.x - sq.y;
		newvalue.y = 2 * coord.y * coord.x;
		coord = newvalue + constant;
		iter++;
	} while (iter < maxiter && (sq.x + sq.y) < 4.0);

	float colorIndex = frac((float)iter / g_MaxThreadIter.z);
	float4 SampledColor = ColorMapTexture.SampleLevel(ColorMapSampler, float2(colorIndex, 0), 0);

	OutputTexture[DTid.xy] = SampledColor;
}
 No newline at end of file
+645 −0

File added.

Preview size limit exceeded, changes collapsed.

+112 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading