標本の印の位置を定数の式で表す

このコミットが含まれているのは:
routersys committed 2026-10-07 08:31:12 +09:00
1 親 27da67d503
コミット 424e2b0671
3ファイル変更
+16 -13

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

+4 -3
ファイルの表示
@@ -426,9 +426,10 @@ internal readonly partial struct InverseRowLightShader(
private bool TileHoldsSample(int tileIndex)
{
var entry = samples[sampleTilesOffset + (tileIndex >> 6)];
var bits = (tileIndex & 32) == 0 ? (uint)entry.X : (uint)entry.Y;
return ((bits >> (tileIndex & 31)) & 1u) != 0u;
var word = tileIndex / GpuTileConvolver.SampleTilesPerWord;
var entry = samples[sampleTilesOffset + word / GpuTileConvolver.WordsPerSampleEntry];
var bits = word % GpuTileConvolver.WordsPerSampleEntry == 0 ? (uint)entry.X : (uint)entry.Y;
return ((bits >> (tileIndex % GpuTileConvolver.SampleTilesPerWord)) & 1u) != 0u;
}
private Float4 Emit(int flat, Float4 value, int size, int mask, int originX, int originY, bool tileHoldsSample)
+8 -7
ファイルの表示
@@ -38,6 +38,8 @@ internal readonly record struct GpuTileJob(
internal sealed class GpuTileConvolver : IDisposable
{
public const int MaximumSamples = 16;
public const int SampleTilesPerWord = 32;
public const int WordsPerSampleEntry = 2;
readonly GraphicsDevice device;
readonly ReadWriteBuffer<Float4> spare;
@@ -158,11 +160,9 @@ internal sealed class GpuTileConvolver : IDisposable
return job;
}
const int SampleTilesPerEntry = 64;
void UploadSamples(ReadOnlySpan<Int2> sampleValues, in TilePlan plan)
{
var length = MaximumSamples + (plan.TileCount + SampleTilesPerEntry - 1) / SampleTilesPerEntry;
var length = MaximumSamples + (plan.TileCount + SampleTilesPerWord * WordsPerSampleEntry - 1) / (SampleTilesPerWord * WordsPerSampleEntry);
if (samples.Length < length)
{
samples.Dispose();
@@ -177,11 +177,12 @@ internal sealed class GpuTileConvolver : IDisposable
foreach (var sample in sampleValues)
{
var tile = plan.TileAt(plan.RegionX + sample.X, plan.RegionY + sample.Y);
ref var entry = ref staging[MaximumSamples + tile / SampleTilesPerEntry];
if ((tile & 32) == 0)
entry.X |= 1 << (tile & 31);
var word = tile / SampleTilesPerWord;
ref var entry = ref staging[MaximumSamples + word / WordsPerSampleEntry];
if (word % WordsPerSampleEntry == 0)
entry.X |= 1 << (tile % SampleTilesPerWord);
else
entry.Y |= 1 << (tile & 31);
entry.Y |= 1 << (tile % SampleTilesPerWord);
}
samples.CopyFrom(staging);
+4 -3
ファイルの表示
@@ -448,9 +448,10 @@ internal readonly partial struct InverseRowShader(
private bool TileHoldsSample(int tileIndex)
{
var entry = samples[sampleTilesOffset + (tileIndex >> 6)];
var bits = (tileIndex & 32) == 0 ? (uint)entry.X : (uint)entry.Y;
return ((bits >> (tileIndex & 31)) & 1u) != 0u;
var word = tileIndex / GpuTileConvolver.SampleTilesPerWord;
var entry = samples[sampleTilesOffset + word / GpuTileConvolver.WordsPerSampleEntry];
var bits = word % GpuTileConvolver.WordsPerSampleEntry == 0 ? (uint)entry.X : (uint)entry.Y;
return ((bits >> (tileIndex % GpuTileConvolver.SampleTilesPerWord)) & 1u) != 0u;
}
private Float4 Emit(int flat, Float4 value, int size, int mask, int originX, int originY, bool tileHoldsSample)