prototype for spirv linking

This commit is contained in:
2026-04-30 22:03:31 +03:00
parent 9569555347
commit 386c2fc045
10 changed files with 120 additions and 34 deletions

View File

@@ -27,26 +27,29 @@
#define CALLABLE namespace CallableShader_DO_NOT_USE
#endif
float4 Test()
/*
* we kinda want to lookup OpExecuteCallableKHR inside of runtime linker
* and replace _CallShader with our own
* but stupid slangc can't do noinline
* so we have to do id += 1 and id -= 1
* overall trick 5/10
*/
[noinline]
void _CallShader2<Payload>( uint32_t id, inout Payload data )
{
return float4(1,0.5,1,1);
id -= 1;
spirv_asm
{
OpExecuteCallableKHR $id $data;
};
}
#ifndef USE_CALLABLE_SHADERS
#define USE_CALLABLE_SHADERS
#endif
struct RunShaderResult_t<A>
{
A val;
};
[noinline]
[builtin]
RunShaderResult_t<A> RunShader<A, B>( uint32_t id, B data ) where optional B
void _CallShader<Payload>( uint32_t id, inout Payload data )
{
return {};
id += 1;
_CallShader2(id, data);
}
#define CallShader _CallShader
#endif