yum-mirror/slang

Making it easier to work with shaders

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

Ellie Hermaszewskaformatf65d756bf

master
2.7 KiB77 linesraw
1// slang-artifact-representation.h
2#ifndef SLANG_ARTIFACT_REPRESENTATION_H
3#define SLANG_ARTIFACT_REPRESENTATION_H
4
5#include "slang-artifact.h"
6
7namespace Slang
8{
9
10/* Base interface for types that have a path. */
11class IPathArtifactRepresentation : public IArtifactRepresentation
12{
13    SLANG_COM_INTERFACE(
14        0xcb1c188c,
15        0x7e48,
16        0x43eb,
17        {0xb0, 0x9a, 0xa1, 0x6e, 0xef, 0xd4, 0x9b, 0xef});
18
19    /// The path
20    virtual SLANG_NO_THROW const char* SLANG_MCALL getPath() = 0;
21    /// Get type
22    virtual SLANG_NO_THROW SlangPathType SLANG_MCALL getPathType() = 0;
23    /// Returns the unique identity. If a unique identity is not supported
24    /// or available will return nullptr.
25    virtual SLANG_NO_THROW const char* SLANG_MCALL getUniqueIdentity() = 0;
26};
27
28/* Represents a path to a file  held on an ISlangFileSystem. */
29class IExtFileArtifactRepresentation : public IPathArtifactRepresentation
30{
31    SLANG_COM_INTERFACE(
32        0xacd65576,
33        0xb09d,
34        0x4ac9,
35        {0xa5, 0x93, 0xeb, 0xf8, 0x9b, 0xd7, 0x11, 0xfd});
36
37    /// File system that holds the item along the path.
38    virtual SLANG_NO_THROW ISlangFileSystemExt* SLANG_MCALL getFileSystem() = 0;
39};
40
41/*
42A representation as a file on the OS file system.  */
43class IOSFileArtifactRepresentation : public IPathArtifactRepresentation
44{
45public:
46    SLANG_COM_INTERFACE(
47        0xc7d7d3a4,
48        0x8683,
49        0x44b5,
50        {0x87, 0x96, 0xdf, 0xba, 0x9b, 0xc3, 0xf1, 0x7b});
51
52    /* Determines ownership and other characteristics of the OS 'file' */
53    enum class Kind
54    {
55        Reference, ///< References a file on the file system
56        NameOnly,  ///< Typically used for items that can be found by the 'system'. The path is just
57                   ///< a name, and cannot typically be loaded as a blob.
58        Owned,     ///< File is *owned* by this instance and will be deleted when goes out of scope
59        Lock, ///< An owned type, indicates potentially in part may only exist to 'lock' a path for
60              ///< a temporary file. Other files might exists based on the 'lock' path.
61        CountOf,
62    };
63
64    /// The the kind of file.
65    virtual SLANG_NO_THROW Kind SLANG_MCALL getKind() = 0;
66    /// Makes the file no longer owned. Only applicable for Owned/Lock and they will become
67    /// 'Reference'
68    virtual SLANG_NO_THROW void SLANG_MCALL disown() = 0;
69    /// Gets the 'lock file' if any associated with this file. Returns nullptr if there isn't one.
70    /// If this file is based on a 'lock file', the lock file must stay in scope at least as long as
71    /// this does.
72    virtual SLANG_NO_THROW IOSFileArtifactRepresentation* SLANG_MCALL getLockFile() = 0;
73};
74
75} // namespace Slang
76
77#endif