aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Shader/ShaderProgram.cs
blob: 9e62491bfc4b0ff70234dbec416aaf293e5bcdd8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using Ryujinx.Graphics.Shader.Translation;
using System;

namespace Ryujinx.Graphics.Shader
{
    public class ShaderProgram
    {
        public ShaderProgramInfo Info { get; }
        public TargetLanguage Language { get; }

        public string Code { get; private set; }
        public byte[] BinaryCode { get; }

        private ShaderProgram(ShaderProgramInfo info, TargetLanguage language)
        {
            Info = info;
            Language = language;
        }

        public ShaderProgram(ShaderProgramInfo info, TargetLanguage language, string code) : this(info, language)
        {
            Code = code;
        }

        public ShaderProgram(ShaderProgramInfo info, TargetLanguage language, byte[] binaryCode) : this(info, language)
        {
            BinaryCode = binaryCode;
        }

        public void Prepend(string line)
        {
            Code = line + Environment.NewLine + Code;
        }
    }
}