#ifndef MACROS_H
#define MACROS_H

#define COMMON using namespace Common; namespace Common

#ifdef VS_SHADER
#define VS using namespace VertexShader; namespace VertexShader 
#else
#define VS namespace VertexShader_DO_NOT_USE
#endif

#ifdef PS_SHADER
#define PS using namespace PixelShader; namespace PixelShader 
#else
#define PS namespace PixelShader_DO_NOT_USE
#endif

#ifdef CS_SHADER
#define CS using namespace ComputeShader; namespace ComputeShader 
#else
#define CS namespace ComputeShader_DO_NOT_USE
#endif

#ifdef RAY_SHADER
#define RAY using namespace RayShader; namespace RayShader 
#else
#define RAY namespace RayShader_DO_NOT_USE
#endif

#ifdef CALLABLE_SHADER
#define CALLABLE using namespace CallableShader; namespace CallableShader 
#else
#define CALLABLE namespace CallableShader_DO_NOT_USE
#endif

/* 
 * 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 )
{
	id -= 1;
	spirv_asm
	{
		OpExecuteCallableKHR $id $data;
	};
}

[noinline]
void _CallShader<Payload>( uint32_t id, inout Payload data )
{
	id += 1;
	_CallShader2(id, data);
}
#define CallShader _CallShader

#endif
