yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Ellie Hermaszewskaformatf65d756bf

master
1.8 KiB59 linesraw
1// slang-artifact-handler-impl.h
2#ifndef SLANG_ARTIFACT_HANDLER_IMPL_H
3#define SLANG_ARTIFACT_HANDLER_IMPL_H
4
5#include "../core/slang-com-object.h"
6#include "slang-artifact-representation.h"
7#include "slang-artifact.h"
8
9namespace Slang
10{
11
12class DefaultArtifactHandler : public ComBaseObject, public IArtifactHandler
13{
14public:
15    SLANG_NO_THROW uint32_t SLANG_MCALL addRef() SLANG_OVERRIDE { return 1; }
16    SLANG_NO_THROW uint32_t SLANG_MCALL release() SLANG_OVERRIDE { return 1; }
17    SLANG_NO_THROW SlangResult SLANG_MCALL queryInterface(SlangUUID const& uuid, void** outObject)
18        SLANG_OVERRIDE;
19
20    // ICastable
21    SLANG_NO_THROW void* SLANG_MCALL castAs(const Guid& guid) SLANG_OVERRIDE;
22
23    // IArtifactHandler
24    SLANG_NO_THROW SlangResult SLANG_MCALL expandChildren(IArtifact* container) SLANG_OVERRIDE;
25    SLANG_NO_THROW SlangResult SLANG_MCALL getOrCreateRepresentation(
26        IArtifact* artifact,
27        const Guid& guid,
28        ArtifactKeep keep,
29        ICastable** outCastable) SLANG_OVERRIDE;
30
31    static IArtifactHandler* getSingleton() { return &g_singleton; }
32
33protected:
34    SlangResult _loadSharedLibrary(IArtifact* artifact, ISlangSharedLibrary** outSharedLibrary);
35    SlangResult _createOSFile(
36        IArtifact* artifact,
37        ArtifactKeep intermediateKeep,
38        IOSFileArtifactRepresentation** outFileRep);
39
40    void* getInterface(const Guid& uuid);
41    void* getObject(const Guid& uuid);
42
43    SlangResult _addRepresentation(
44        IArtifact* artifact,
45        ArtifactKeep keep,
46        ISlangUnknown* rep,
47        ICastable** outCastable);
48    SlangResult _addRepresentation(
49        IArtifact* artifact,
50        ArtifactKeep keep,
51        ICastable* castable,
52        ICastable** outCastable);
53
54    static DefaultArtifactHandler g_singleton;
55};
56
57} // namespace Slang
58
59#endif