HoviTron Video Pipeline
Shader.h
Go to the documentation of this file.
1/* ----------------------
2* Copyright 2023 Université Libre de Bruxelles(ULB), Universidad Politécnica de Madrid(UPM), CREAL, Deutsches Zentrum für Luft - und Raumfahrt(DLR)
3
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at < http://www.apache.org/licenses/LICENSE-2.0>
7
8* Unless required by applicable law or agreed to in writing, software
9* distributed under the License is distributed on an "AS IS" BASIS,
10* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11* See the License for the specific language governing permissionsand
12* limitations under the License.
13---------------------- */
14
15
16/*****************************************************************/
24#pragma once
25
26#include <string>
27#include <map>
28#include <vector>
29
30#ifdef __ANDROID__
31#include <android_native_app_glue.h>
32#else
33#include <fstream>
34#endif
35
36
42 class Shader {
43 public:
45 char *source;
47 size_t size;
48#ifndef NDEBUG
50 std::string name;
51#endif
52 private:
53 };
54
64 {
65 public:
67 static ShadersList & getInstance();
69 Shader const& operator () (const char* name) const;
70
71
72#ifdef __ANDROID__
78 void loadShaders(struct android_app* app);
79#else
81 void loadShaders();
82#endif
83 private:
84#ifdef __ANDROID__
86 void readShader(AAssetManager* assetManager, std::string shaderName);
87#else
89 void readShader(std::string & shaderName);
90#endif
93
95 std::vector<std::string> namesList =
96 {
97 //Warping
98 "synthesis.vert", "synthesis.geom", "synthesis.frag",
99 "synthesisPrev.geom", "synthesisPrev.frag",
100 //Blending
101 "blending.vert" , "blendingFinal.frag", "blending.frag", "blendingFirst.frag", "blendingFirstFinal.frag",
102 //For blending with depth
103 "blendingFinalD.frag","blendingD.frag", "blendingFirstD.frag", "blendingFirstFinalD.frag"
104 };
105
107 std::map<std::string, Shader> m_shaders;
108
109 };
110
111
112
Class that represents SPIR-V shader.
Definition: Shader.h:42
char * source
Definition: Shader.h:45
size_t size
Definition: Shader.h:47
std::string name
Definition: Shader.h:50
Class that loads SPIR-V shader from files and make their content available to the rest of the code.
Definition: Shader.h:64
void loadShaders()
Definition: Shader.cpp:68
Shader const & operator()(const char *name) const
Definition: Shader.cpp:103
static ShadersList & getInstance()
Definition: Shader.cpp:99