Some slang progress

This commit is contained in:
2024-12-17 12:32:44 -06:00
parent b3c2e0114f
commit b5958189cf
33 changed files with 617 additions and 255 deletions

View File

@@ -0,0 +1,46 @@
// 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;
};
}