From fb50fab76a723f46026474ea5bb0226c297d1fd5 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 8 Jun 2021 08:48:47 -0400 Subject: Fix RWTexture issues on CUDA (#1876) * #include an absolute path didn't work - because paths were taken to always be relative. * Re-enable CUDA RWTexture tests. Re-enable RWTexture1D test Make sure tests have only single mip for RWTexture (required for CUDA) * Fix issue with reading CUDA surface. Re-enable working CUDA RWTextureTest. Enable 1D case. --- source/slang/core.meta.slang | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang index 6b73630a3..afdd96029 100644 --- a/source/slang/core.meta.slang +++ b/source/slang/core.meta.slang @@ -934,6 +934,12 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) { sb << '.' << char(i + 'x'); } + + // Surface access is *byte* addressed in x in CUDA + if (i == 0) + { + sb << " * $E"; + } } if (isArray) { @@ -949,7 +955,9 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) sb << "Layered"; } sb << "read"; - sb << "<$T0>($0, ($1).x, ($1).y, ($1).z"; + + // Surface access is *byte* addressed in x in CUDA + sb << "<$T0>($0, ($1).x * $E, ($1).y, ($1).z"; if (isArray) { sb << ", int(($1).w)"; @@ -1090,12 +1098,12 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt) sb << ", ($1)"; if (vecCount > 1) { - sb << '.' << char(i + 'x'); - // Surface access is *byte* addressed in x in CUDA - if (i == 0) - { - sb << " * $E"; - } + sb << '.' << char(i + 'x'); + } + // Surface access is *byte* addressed in x in CUDA + if (i == 0) + { + sb << " * $E"; } } -- cgit v1.2.3