Pyrogenesis trunk
ShaderProgram.h
Go to the documentation of this file.
1/* Copyright (C) 2023 Wildfire Games.
2 * This file is part of 0 A.D.
3 *
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef INCLUDED_SHADERPROGRAM
19#define INCLUDED_SHADERPROGRAM
20
24#include "ps/CStr.h"
26
27#include <vector>
28
29/**
30 * A wrapper for backend shader program to handle high-level operations like
31 * file reloading and handling errors on reload.
32 */
34{
36
37public:
39 Renderer::Backend::IDevice* device, const CStr& name, const CShaderDefines& defines);
40
41 void Reload();
42
43 std::vector<VfsPath> GetFileDependencies() const;
44
46
47 // TODO: add reloadable handles.
48
49protected:
51 Renderer::Backend::IDevice* device, const CStr& name, const CShaderDefines& defines);
52
54 CStr m_Name;
56 std::unique_ptr<Renderer::Backend::IShaderProgram> m_BackendShaderProgram;
57};
58
59#endif // INCLUDED_SHADERPROGRAM
std::shared_ptr< CShaderProgram > CShaderProgramPtr
Definition: ShaderProgramPtr.h:26
Represents a mapping of name strings to value strings, for use with #if and #ifdef and similar condit...
Definition: ShaderDefines.h:147
A wrapper for backend shader program to handle high-level operations like file reloading and handling...
Definition: ShaderProgram.h:34
Renderer::Backend::IShaderProgram * GetBackendShaderProgram()
Definition: ShaderProgram.h:45
void Reload()
Definition: ShaderProgram.cpp:39
static CShaderProgramPtr Create(Renderer::Backend::IDevice *device, const CStr &name, const CShaderDefines &defines)
Definition: ShaderProgram.cpp:31
Renderer::Backend::IDevice * m_Device
Definition: ShaderProgram.h:53
CShaderDefines m_Defines
Definition: ShaderProgram.h:55
NONCOPYABLE(CShaderProgram)
std::vector< VfsPath > GetFileDependencies() const
Definition: ShaderProgram.cpp:47
CStr m_Name
Definition: ShaderProgram.h:54
CShaderProgram(Renderer::Backend::IDevice *device, const CStr &name, const CShaderDefines &defines)
Definition: ShaderProgram.cpp:24
std::unique_ptr< Renderer::Backend::IShaderProgram > m_BackendShaderProgram
Definition: ShaderProgram.h:56
Definition: IDevice.h:48
IShaderProgram is a container for multiple shaders of different types.
Definition: IShaderProgram.h:81