Shader linking i guess
This commit is contained in:
14
funnyassets/shaders/funny_basic_pbr.shader
Normal file
14
funnyassets/shaders/funny_basic_pbr.shader
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "macros.hlsl"
|
||||
|
||||
COMMON
|
||||
{
|
||||
|
||||
}
|
||||
CALLABLE
|
||||
{
|
||||
#include "textures.hlsl"
|
||||
float4 brdfMain()
|
||||
{
|
||||
return float4(1);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "macros.hlsl"
|
||||
|
||||
BRDF
|
||||
CALLABLE
|
||||
{
|
||||
float4 brdfMain()
|
||||
float4 CallableMain()
|
||||
{
|
||||
return float4(1);
|
||||
}
|
||||
|
||||
10
funnyassets/shaders/funny_shared.hlsl
Normal file
10
funnyassets/shaders/funny_shared.hlsl
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef FUNNY_SHARED_HLSL
|
||||
#define FUNNY_SHARED_HLSL
|
||||
|
||||
struct FunnyShaderInput_t
|
||||
{
|
||||
uint m_uInstance;
|
||||
float2 m_vTexcoord;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,15 +16,37 @@
|
||||
#endif
|
||||
|
||||
#ifdef RAY_SHADER
|
||||
#define RAY using namespace RAYShader; namespace RAYShader
|
||||
#define RAY using namespace RayShader; namespace RayShader
|
||||
#else
|
||||
#define RAY namespace RAYShader_DO_NOT_USE
|
||||
#define RAY namespace RayShader_DO_NOT_USE
|
||||
#endif
|
||||
|
||||
#ifdef BRDF_SHADER
|
||||
#define BRDF using namespace BRDFShader; namespace BRDFShader
|
||||
#ifdef CALLABLE_SHADER
|
||||
#define CALLABLE using namespace CallableShader; namespace CallableShader
|
||||
#else
|
||||
#define BRDF namespace BRDFShader_DO_NOT_USE
|
||||
#define CALLABLE namespace CallableShader_DO_NOT_USE
|
||||
#endif
|
||||
|
||||
float4 Test()
|
||||
{
|
||||
return float4(1,0.5,1,1);
|
||||
}
|
||||
|
||||
#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
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
#include "macros.hlsl"
|
||||
#include "funny_shared.hlsl"
|
||||
|
||||
|
||||
USE_CALLABLE_SHADERS;
|
||||
|
||||
COMMON {
|
||||
cbuffer CameraInfo
|
||||
|
||||
@@ -5,6 +5,11 @@ struct MeshPayload
|
||||
{
|
||||
float3 m_vColor;
|
||||
}
|
||||
struct RayPayload
|
||||
{
|
||||
float3 m_vOrigin;
|
||||
float3 m_vDirection;
|
||||
};
|
||||
|
||||
RAY
|
||||
{
|
||||
@@ -14,8 +19,14 @@ RAY
|
||||
RWTexture2D<float> g_tIndirectImage;
|
||||
|
||||
|
||||
|
||||
void rayMain()
|
||||
{
|
||||
RayPayload p = {};
|
||||
RunShaderResult_t<MeshPayload> m = RunShader<MeshPayload, RayPayload>(0, p);
|
||||
m.val.m_vColor;
|
||||
printf("%f\n", m.val.m_vColor.x);
|
||||
|
||||
/*
|
||||
uint2 pixel = DispatchRaysIndex().xy;
|
||||
MeshPayload p;
|
||||
|
||||
0
funnyassets/shaders/mesh_trace_gen.h
Normal file
0
funnyassets/shaders/mesh_trace_gen.h
Normal file
Reference in New Issue
Block a user