26 lines
904 B
C++
26 lines
904 B
C++
#pragma once
|
|
#include "slang-com-ptr.h"
|
|
#include <string>
|
|
|
|
class slang_handle
|
|
{
|
|
public:
|
|
Slang::ComPtr<slang::IModule> module;
|
|
Slang::ComPtr<slang::IComponentType> program;
|
|
Slang::ComPtr<slang::IEntryPoint> entry_point;
|
|
static constexpr int target_index = 0; // only one target
|
|
|
|
bool init_slang_module(const std::string& module_name, const std::string& entry_name);
|
|
[[nodiscard]] Slang::ComPtr<slang::IBlob> get_entry_point_code() const;
|
|
[[nodiscard]] const char* get_entry_point_name() const
|
|
{
|
|
slang::ProgramLayout* layout = program->getLayout(0);
|
|
const auto entry_reflection = layout->getEntryPointByIndex(entry_point_index_);
|
|
return entry_reflection->getName();
|
|
}
|
|
[[nodiscard]] SlangStage get_shader_type() const { return shader_type_; }
|
|
private:
|
|
int entry_point_index_ = -1;
|
|
SlangStage shader_type_ = SLANG_STAGE_NONE;
|
|
};
|