yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
67fca7c4
vulkan-sdk-1.4.357.0
1///////////// 2// GLOBALS // 3///////////// 4cbuffer TessellationBuffer : register ( b0 ) 5{ 6float tessellationAmount ; 7float3 padding ; 8} ; 9 10 11////////////// 12// TYPEDEFS // 13////////////// 14struct HullInputType 15{ 16float3 position : POSITION ; 17float4 color : COLOR ; 18} ; 19 20struct ConstantOutputType 21{ 22float edges [ 3 ] : SV_TessFactor ; 23float inside : SV_InsideTessFactor ; 24} ; 25 26struct HullOutputType 27{ 28float3 position : POSITION ; 29float4 color : COLOR ; 30} ; 31 32 33//////////////////////////////////////////////////////////////////////////////// 34// Patch Constant Function 35//////////////////////////////////////////////////////////////////////////////// 36ConstantOutputType ColorPatchConstantFunction ( InputPatch < HullInputType , 3 > inputPatch , uint patchId : SV_PrimitiveID ) 37{ 38ConstantOutputType output ; 39 40 41// Set the tessellation factors for the three edges of the triangle. 42output . edges [ 0 ] = tessellationAmount ; 43output . edges [ 1 ] = tessellationAmount ; 44output . edges [ 2 ] = tessellationAmount ; 45 46// Set the tessellation factor for tessallating inside the triangle. 47output . inside = tessellationAmount ; 48 49return output ; 50} 51 52 53//////////////////////////////////////////////////////////////////////////////// 54// Hull Shader 55//////////////////////////////////////////////////////////////////////////////// 56[ domain ( "tri" )] 57[ partitioning ( "integer" )] 58[ outputtopology ( "triangle_cw" )] 59[ outputcontrolpoints ( 3 )] 60[ patchconstantfunc ( "ColorPatchConstantFunction" )] 61 62HullOutputType main ( InputPatch < HullInputType , 3 > patch , uint pointId : SV_OutputControlPointID , uint patchId : SV_PrimitiveID ) 63{ 64HullOutputType output ; 65 66// Set the position for this control point as the output position. 67output . position = patch [ pointId ] . position ; 68 69// Set the input color as the output color. 70output . color = patch [ pointId ] . color ; 71 72return output ; 73} 74