Skip to content

Commit d043a2b

Browse files
committed
More Win32 classic samples
1 parent 8007a89 commit d043a2b

35 files changed

+5274
-1
lines changed
1.24 KB
Binary file not shown.

PCSamples/IntroGraphics/SimpleBezierPC12/SimpleBezierPC12.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<RootNamespace>SimpleBezierPC12</RootNamespace>
1515
<ProjectGuid>{80635a81-c0ed-4eed-b484-7b7b2eb9c9f9}</ProjectGuid>
1616
<Keyword>Win32Proj</Keyword>
17-
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
17+
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
1818
</PropertyGroup>
1919
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2020
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//--------------------------------------------------------------------------------------
2+
// File: fractal.hlsl
3+
//
4+
// This is a compute shader that draws a Mandelbrot fractal.
5+
//
6+
// Copyright (c) Microsoft Corporation. All rights reserved.
7+
//--------------------------------------------------------------------------------------
8+
9+
RWTexture2D<float4> OutputTexture : register(u0);
10+
Texture2D ColorMapTexture : register(t0);
11+
SamplerState ColorMapSampler : register(s0);
12+
13+
cbuffer cb0
14+
{
15+
float4 g_MaxThreadIter : packoffset(c0);
16+
float4 g_Window : packoffset(c1);
17+
}
18+
19+
[numthreads(8, 8, 1)]
20+
void main(uint3 DTid : SV_DispatchThreadID)
21+
{
22+
float2 WindowLocal = ((float2)DTid.xy / g_MaxThreadIter.xy) * float2(1, -1) + float2(-0.5f, 0.5f);
23+
float2 coord = WindowLocal.xy * g_Window.xy + g_Window.zw;
24+
25+
uint maxiter = (uint)g_MaxThreadIter.z * 4;
26+
uint iter = 0;
27+
float2 constant = coord;
28+
float2 sq;
29+
do
30+
{
31+
float2 newvalue;
32+
sq = coord * coord;
33+
newvalue.x = sq.x - sq.y;
34+
newvalue.y = 2 * coord.y * coord.x;
35+
coord = newvalue + constant;
36+
iter++;
37+
} while (iter < maxiter && (sq.x + sq.y) < 4.0);
38+
39+
float colorIndex = frac((float)iter / g_MaxThreadIter.z);
40+
float4 SampledColor = ColorMapTexture.SampleLevel(ColorMapSampler, float2(colorIndex, 0), 0);
41+
42+
OutputTexture[DTid.xy] = SampledColor;
43+
}

0 commit comments

Comments
 (0)