Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rdparty/dxc/dxc
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Copyright (C) 2018-2026 - DevSH Graphics Programming Sp. z O.O.
// This file is part of the "Nabla Engine".
// For conditions of distribution and use, see copyright notice in nabla.h
#ifndef _NBL_ASSET_MATERIAL_COMPILER_V3_C_REFERENCE_UNIDIRECTIONAL_PATH_TRACING_H_INCLUDED_
#define _NBL_ASSET_MATERIAL_COMPILER_V3_C_REFERENCE_UNIDIRECTIONAL_PATH_TRACING_H_INCLUDED_

#include "nbl/asset/material_compiler3/IBackend.h"

namespace nbl::asset::material_compiler3
{

//template<uint32_t hash0, uint32_t hash1, uint32_t hash2, uint32_t hash3, uint32_t hash4, uint32_t hash5, uint32_t hash6, uint32_t hash7>
struct OrientedMaterial
{
uint32_t emitter_id;
uint32_t prefetch_offset;
uint32_t prefetch_count;
uint32_t instr_offset;
uint32_t rem_pdf_count;
uint32_t nprecomp_count;
uint32_t genchoice_count;

core::blake3_hash_t hash;

struct stream_t
{
uint32_t first;
uint32_t count;
};
stream_t get_rem_and_pdf() const { return { instr_offset, rem_pdf_count }; }
stream_t get_gen_choice() const { return { instr_offset + rem_pdf_count, genchoice_count }; }
stream_t get_norm_precomp() const { return { instr_offset + rem_pdf_count + genchoice_count, nprecomp_count }; }
stream_t get_tex_prefetch() const { return { prefetch_offset, prefetch_count }; }
};

class CReferenceUnidirectionalPathTracing : public IBackend
{
public:
struct CResult : public IBackend::IResult
{
//has to go after #version and before required user-provided descriptors and functions
std::string fragmentShaderSource_declarations;
//has to go after required user-provided descriptors and functions and before the rest of shader (especially entry point function)
std::string fragmentShaderSource;
};

CResult compile(const CTrueIR* ir, const std::span<const CTrueIR::SMaterialHandle> materials);

private:
std::string getHashAs4UintsString(const CTrueIR::INode* node, const CTrueIR* ir, const std::string& separator = ",") const;

void getAlbedoHLSLCode(std::ostringstream& sstr, const CTrueIR::INode* node, const CTrueIR* ir);

void getNormalHLSLCode(std::ostringstream& sstr, const CTrueIR::INode* node, const CTrueIR* ir);

void getAOVThroughputHLSLCode(std::ostringstream& sstr, const CTrueIR::INode* node, const CTrueIR* ir);

void getTransparencyHLSLCode(std::ostringstream& sstr, const CTrueIR::INode* node, const CTrueIR* ir);

void getGenerateHLSLCode(std::ostringstream& sstr, const CTrueIR::INode* node, const CTrueIR* ir);

void getQuotientWeightHLSLCode(std::ostringstream& sstr, const CTrueIR::INode* node, const CTrueIR* ir);

void getEvalWeightHLSLCode(std::ostringstream& sstr, const CTrueIR::INode* node, const CTrueIR* ir);

void getEmissionHLSLCode(std::ostringstream& sstr, const CTrueIR::INode* node, const CTrueIR* ir);
};

}

#endif
25 changes: 25 additions & 0 deletions include/nbl/asset/material_compiler3/IBackend.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (C) 2018-2026 - DevSH Graphics Programming Sp. z O.O.
// This file is part of the "Nabla Engine".
// For conditions of distribution and use, see copyright notice in nabla.h
#ifndef _NBL_ASSET_MATERIAL_COMPILER_V3_I_BACKEND_H_INCLUDED_
#define _NBL_ASSET_MATERIAL_COMPILER_V3_I_BACKEND_H_INCLUDED_

#include "nbl/asset/material_compiler3/CTrueIR.h"

namespace nbl::asset::material_compiler3
{

class IBackend
{
public:
struct IResult// : public core::IReferenceCounted
{

};

IResult compile(const CTrueIR*, const std::span<const CTrueIR::SMaterialHandle>);
};

}

#endif
1 change: 1 addition & 0 deletions src/nbl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ set(NBL_ASSET_SOURCES
# Materials
asset/material_compiler3/CFrontendIR.cpp
asset/material_compiler3/CTrueIR.cpp
asset/material_compiler3/CReferenceUnidirectionalPathTracing.cpp

# Shaders
asset/utils/ISPIRVOptimizer.cpp
Expand Down
Loading
Loading