Skip to content

Commit fa06527

Browse files
committed
material_compiler_compatibility_impl (forgot to push)
1 parent e8ca60a commit fa06527

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#ifndef _NBL_BUILTIN_GLSL_EXT_MITSUBA_LOADER_DESCRIPTORS_INCLUDED_
2+
#define _NBL_BUILTIN_GLSL_EXT_MITSUBA_LOADER_DESCRIPTORS_INCLUDED_
3+
4+
#define _NBL_VT_DESCRIPTOR_SET 0
5+
#define _NBL_VT_PAGE_TABLE_BINDING 0
6+
7+
#define _NBL_VT_FLOAT_VIEWS_BINDING 1
8+
#define _NBL_VT_FLOAT_VIEWS_COUNT _NBL_EXT_MITSUBA_LOADER_VT_STORAGE_VIEW_COUNT
9+
#define _NBL_VT_FLOAT_VIEWS
10+
11+
#define _NBL_VT_INT_VIEWS_BINDING 2
12+
#define _NBL_VT_INT_VIEWS_COUNT 0
13+
#define _NBL_VT_INT_VIEWS
14+
15+
#define _NBL_VT_UINT_VIEWS_BINDING 3
16+
#define _NBL_VT_UINT_VIEWS_COUNT 0
17+
#define _NBL_VT_UINT_VIEWS
18+
#include <nbl/builtin/glsl/virtual_texturing/descriptors.glsl>
19+
20+
layout(set = 0, binding = 2, std430) restrict readonly buffer VT_PrecomputedStuffSSBO
21+
{
22+
uint pgtab_sz_log2;
23+
float vtex_sz_rcp;
24+
float phys_pg_tex_sz_rcp[_NBL_VT_MAX_PAGE_TABLE_LAYERS];
25+
uint layer_to_sampler_ix[_NBL_VT_MAX_PAGE_TABLE_LAYERS];
26+
} VT_precomputed;
27+
28+
layout(set = 0, binding = 3, std430) restrict readonly buffer INSTR_BUF
29+
{
30+
nbl_glsl_MC_instr_t data[];
31+
} instr_buf;
32+
layout(set = 0, binding = 4, std430) restrict readonly buffer BSDF_BUF
33+
{
34+
nbl_glsl_MC_bsdf_data_t data[];
35+
} bsdf_buf;
36+
#include <nbl/builtin/glsl/ext/MitsubaLoader/instance_data_struct.glsl>
37+
layout(set = 0, binding = 5, row_major, std430) readonly restrict buffer InstDataBuffer {
38+
nbl_glsl_ext_Mitsuba_Loader_instance_data_t data[];
39+
} InstData;
40+
layout(set = 0, binding = 6, std430) restrict readonly buffer PREFETCH_INSTR_BUF
41+
{
42+
nbl_glsl_MC_prefetch_instr_t data[];
43+
} prefetch_instr_buf;
44+
45+
// Note: this GLSL header defines just those 3 material compiler functions.
46+
// The rest of them must still be defined by the user!
47+
nbl_glsl_MC_instr_t nbl_glsl_MC_fetchInstr(in uint ix)
48+
{
49+
return instr_buf.data[ix];
50+
}
51+
nbl_glsl_MC_prefetch_instr_t nbl_glsl_MC_fetchPrefetchInstr(in uint ix)
52+
{
53+
return prefetch_instr_buf.data[ix];
54+
}
55+
nbl_glsl_MC_bsdf_data_t nbl_glsl_MC_fetchBSDFData(in uint ix)
56+
{
57+
return bsdf_buf.data[ix];
58+
}
59+
60+
uint nbl_glsl_VT_layer2pid(in uint layer)
61+
{
62+
return VT_precomputed.layer_to_sampler_ix[layer];
63+
}
64+
uint nbl_glsl_VT_getPgTabSzLog2()
65+
{
66+
return VT_precomputed.pgtab_sz_log2;
67+
}
68+
float nbl_glsl_VT_getPhysPgTexSzRcp(in uint layer)
69+
{
70+
return VT_precomputed.phys_pg_tex_sz_rcp[layer];
71+
}
72+
float nbl_glsl_VT_getVTexSzRcp()
73+
{
74+
return VT_precomputed.vtex_sz_rcp;
75+
}
76+
#define _NBL_USER_PROVIDED_VIRTUAL_TEXTURING_FUNCTIONS_
77+
78+
#include <nbl/builtin/glsl/virtual_texturing/functions.glsl/7/8>
79+
80+
#endif

0 commit comments

Comments
 (0)