Minor code tweaks

このコミットが含まれているのは:
Sergio Pedri committed 2019-09-02 22:54:31 +02:00
1 親 585e83d5e2
コミット ee1d8bdf9d
2ファイル変更
+7 -6

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

+1
ファイルの表示
@@ -27,6 +27,7 @@ namespace ComputeSharp.Shaders.Renderer
using Stream stream = assembly.GetManifestResourceStream(filename);
using StreamReader reader = new StreamReader(stream);
Template = reader.ReadToEnd();
}
+6 -6
ファイルの表示
@@ -60,12 +60,6 @@ namespace ComputeSharp.Shaders
int threadsX, int threadsY, int threadsZ,
Action<ThreadIds> action)
{
// Calculate the dispatch values
int
groupsX = x / threadsX + (x % threadsX == 0 ? 0 : 1),
groupsY = y / threadsY + (y % threadsY == 0 ? 0 : 1),
groupsZ = z / threadsZ + (z % threadsZ == 0 ? 0 : 1);
// Try to get the cache shader
var key = (action.Method, threadsX, threadsY, threadsZ);
if (!ShadersCache.TryGetValue(key, out var shaderData))
@@ -114,6 +108,12 @@ namespace ComputeSharp.Shaders
using GraphicsResource variablesBuffer = device.AllocateConstantBufferFromReflectedValues(variables);
commandList.SetComputeRootDescriptorTable(0, variablesBuffer);
// Calculate the dispatch values
int
groupsX = x / threadsX + (x % threadsX == 0 ? 0 : 1),
groupsY = y / threadsY + (y % threadsY == 0 ? 0 : 1),
groupsZ = z / threadsZ + (z % threadsZ == 0 ? 0 : 1);
// Dispatch and wait for completion
commandList.Dispatch(groupsX, groupsY, groupsZ);
commandList.Flush();