46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
// Copyright (c) 2024 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#pragma once
|
|
#include "dawn.hpp"
|
|
#include "slang.h"
|
|
#include "slang-gfx.h"
|
|
#include "slang-com-ptr.h"
|
|
using namespace slang;
|
|
|
|
namespace Dawn {
|
|
class ShaderManager;
|
|
|
|
struct ShaderManagerSlangString : public ISlangBlob {
|
|
std::string str;
|
|
uint32_t refs = 0;
|
|
|
|
void const* getBufferPointer() override;
|
|
size_t getBufferSize() override;
|
|
SlangResult queryInterface(SlangUUID const& uuid, void** outObject) override;
|
|
uint32_t addRef() override;
|
|
uint32_t release() override;
|
|
};
|
|
|
|
struct ShaderManagerSlangFileSystem : public ISlangFileSystem {
|
|
private:
|
|
std::weak_ptr<ShaderManager> sm;
|
|
uint32_t refs = 0;
|
|
|
|
public:
|
|
SlangResult loadFile(
|
|
const char* path,
|
|
ISlangBlob** outBlob
|
|
) override;
|
|
|
|
SlangResult queryInterface(SlangUUID const& uuid, void** outObject) override;
|
|
|
|
uint32_t addRef() override;
|
|
uint32_t release() override;
|
|
void * castAs(SlangUUID const& uuid) override;
|
|
|
|
friend class ShaderManager;
|
|
};
|
|
} |