Skip to content

Commit 7855f46

Browse files
committed
Added material compiler GLSL to mitsuba loader global metadata
1 parent c66a184 commit 7855f46

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

examples_tests/18.MitsubaLoader/main.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -438,18 +438,8 @@ int main()
438438
}
439439
}
440440

441-
auto gpuVT = core::make_smart_refctd_ptr<video::IGPUVirtualTexture>(driver, globalMeta->VT.get());
441+
//auto gpuVT = core::make_smart_refctd_ptr<video::IGPUVirtualTexture>(driver, globalMeta->VT.get());
442442
auto gpuds0 = driver->getGPUObjectsFromAssets(&cpuds0.get(), &cpuds0.get()+1)->front();
443-
{
444-
auto count = gpuVT->getDescriptorSetWrites(nullptr, nullptr, nullptr);
445-
446-
auto writes = core::make_refctd_dynamic_array<core::smart_refctd_dynamic_array<video::IGPUDescriptorSet::SWriteDescriptorSet>>(count.first);
447-
auto info = core::make_refctd_dynamic_array<core::smart_refctd_dynamic_array<video::IGPUDescriptorSet::SDescriptorInfo>>(count.second);
448-
449-
gpuVT->getDescriptorSetWrites(writes->data(), info->data(), gpuds0.get());
450-
451-
driver->updateDescriptorSets(writes->size(), writes->data(), 0u, nullptr);
452-
}
453443

454444
auto gpuds1layout = driver->getGPUObjectsFromAssets(&ds1layout, &ds1layout+1)->front();
455445

include/irr/ext/MitsubaLoader/CGlobalMitsubaMetadata.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class CGlobalMitsubaMetadata : public core::IReferenceCounted
2626
core::vector<CElementSensor> sensors;
2727
core::vector<CElementEmitter> emitters;
2828
core::smart_refctd_ptr<asset::ICPUVirtualTexture> VT;
29+
30+
//has to go after #version and before required user-provided descriptors and functions
31+
std::string materialCompilerGLSL_declarations;
32+
//has to go after required user-provided descriptors and functions and before the rest of shader (especially entry point function)
33+
std::string materialCompilerGLSL_source;
2934
};
3035

3136

src/irr/ext/MitsubaLoader/CMitsubaLoader.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,9 @@ asset::SAssetBundle CMitsubaLoader::loadAsset(io::IReadFile* _file, const asset:
876876
getBuiltinAsset<asset::ICPUSpecializedShader, asset::IAsset::ET_SPECIALIZED_SHADER>(VERTEX_SHADER_CACHE_KEY, m_manager),
877877
std::move(fragShader)
878878
);
879+
ctx.globalMeta->materialCompilerGLSL_declarations = compResult.fragmentShaderSource_declarations;
880+
ctx.globalMeta->materialCompilerGLSL_source = compResult.fragmentShaderSource;
881+
879882
for (const SContext::shape_ass_type& mesh_ : meshes)
880883
{
881884
// need const_cast because core::set has only const iterators (or maybe we should reconsider if const smart_refctd_ptr::operator-> should return const ptr)

0 commit comments

Comments
 (0)