Updated mustached template to support automatic bounds check

このコミットが含まれているのは:
Sergio Pedri committed 2019-08-12 16:42:18 +02:00
1 親 3939c0eac1
コミット 6fc7cd4e9d
3ファイル変更
+12 -7

検索条件に一致するファイルはありません

+3 -3
ファイルの表示
@@ -18,17 +18,17 @@ namespace ComputeSharp.Shaders.Renderer.Models
/// <summary>
/// Gets or sets the number of threads in the X group
/// </summary>
public int ThreadsX { get; set; }
public int NumThreadsX { get; set; }
/// <summary>
/// Gets or sets the number of threads in the Y group
/// </summary>
public int ThreadsY { get; set; }
public int NumThreadsY { get; set; }
/// <summary>
/// Gets or sets the number of threads in the Z group
/// </summary>
public int ThreadsZ { get; set; }
public int NumThreadsZ { get; set; }
/// <summary>
/// Gets or sets the name for the threads id variable used in the shader
+6 -1
ファイルの表示
@@ -18,6 +18,11 @@ cbuffer {{FieldName}}Buffer : register(b{{ConstantBufferIndex}})
{{/FieldsList}}
{{!Shader entry point}}
[Shader("compute")]
[NumThreads({{ThreadsX}}, {{ThreadsY}}, {{ThreadsZ}})]
[NumThreads({{NumThreadsX}}, {{NumThreadsY}}, {{NumThreadsZ}})]
void CSMain(uint3 {{ThreadsIdsVariableName}} : SV_DispatchThreadId)
{
if ({{ThreadsIdsVariableName}}.x < {{ThreadsX}} &&
{{ThreadsIdsVariableName}}.y < {{ThreadsY}} &&
{{ThreadsIdsVariableName}}.z < {{ThreadsZ}})
{{&ShaderBody}}
}
+3 -3
ファイルの表示
@@ -31,9 +31,9 @@ namespace ComputeSharp.Shaders
ShaderInfo shaderInfo = new ShaderInfo
{
FieldsList = shaderLoader.FieldsInfo,
ThreadsX = numThreads.X,
ThreadsY = numThreads.Y,
ThreadsZ = numThreads.Z,
NumThreadsX = numThreads.X,
NumThreadsY = numThreads.Y,
NumThreadsZ = numThreads.Z,
ThreadsIdsVariableName = shaderLoader.ThreadsIdsVariableName,
ShaderBody = shaderLoader.MethodBody
};