/src/ogre/Components/RTShaderSystem/src/OgreShaderProgramSet.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | ----------------------------------------------------------------------------- |
3 | | This source file is part of OGRE |
4 | | (Object-oriented Graphics Rendering Engine) |
5 | | For the latest info, see http://www.ogre3d.org/ |
6 | | |
7 | | Copyright (c) 2000-2014 Torus Knot Software Ltd |
8 | | Permission is hereby granted, free of charge, to any person obtaining a copy |
9 | | of this software and associated documentation files (the "Software"), to deal |
10 | | in the Software without restriction, including without limitation the rights |
11 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
12 | | copies of the Software, and to permit persons to whom the Software is |
13 | | furnished to do so, subject to the following conditions: |
14 | | |
15 | | The above copyright notice and this permission notice shall be included in |
16 | | all copies or substantial portions of the Software. |
17 | | |
18 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19 | | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
20 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
21 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
22 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
23 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
24 | | THE SOFTWARE. |
25 | | ----------------------------------------------------------------------------- |
26 | | */ |
27 | | |
28 | | #include "OgreShaderPrecompiledHeaders.h" |
29 | | |
30 | | namespace Ogre { |
31 | | namespace RTShader { |
32 | | |
33 | | //----------------------------------------------------------------------------- |
34 | 0 | ProgramSet::ProgramSet() {} |
35 | | |
36 | | //----------------------------------------------------------------------------- |
37 | 0 | ProgramSet::~ProgramSet() {} |
38 | | |
39 | | //----------------------------------------------------------------------------- |
40 | | void ProgramSet::setCpuProgram(std::unique_ptr<Program>&& program) |
41 | 0 | { |
42 | 0 | switch(program->getType()) |
43 | 0 | { |
44 | 0 | case GPT_VERTEX_PROGRAM: |
45 | 0 | mVSCpuProgram = std::move(program); |
46 | 0 | break; |
47 | 0 | case GPT_FRAGMENT_PROGRAM: |
48 | 0 | mPSCpuProgram = std::move(program); |
49 | 0 | break; |
50 | 0 | default: |
51 | 0 | OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", ""); |
52 | 0 | break; |
53 | 0 | } |
54 | 0 | } |
55 | | |
56 | | //----------------------------------------------------------------------------- |
57 | | Program* ProgramSet::getCpuProgram(GpuProgramType type) const |
58 | 0 | { |
59 | 0 | switch(type) |
60 | 0 | { |
61 | 0 | case GPT_VERTEX_PROGRAM: |
62 | 0 | return mVSCpuProgram.get(); |
63 | 0 | case GPT_FRAGMENT_PROGRAM: |
64 | 0 | return mPSCpuProgram.get(); |
65 | 0 | default: |
66 | 0 | return NULL; |
67 | 0 | } |
68 | 0 | } |
69 | | //----------------------------------------------------------------------------- |
70 | | void ProgramSet::setGpuProgram(const GpuProgramPtr& program) |
71 | 0 | { |
72 | 0 | switch(program->getType()) |
73 | 0 | { |
74 | 0 | case GPT_VERTEX_PROGRAM: |
75 | 0 | mVSGpuProgram = program; |
76 | 0 | break; |
77 | 0 | case GPT_FRAGMENT_PROGRAM: |
78 | 0 | mPSGpuProgram = program; |
79 | 0 | break; |
80 | 0 | default: |
81 | 0 | OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", ""); |
82 | 0 | break; |
83 | 0 | } |
84 | 0 | } |
85 | | |
86 | | //----------------------------------------------------------------------------- |
87 | | const GpuProgramPtr& ProgramSet::getGpuProgram(GpuProgramType type) const |
88 | 0 | { |
89 | 0 | switch(type) |
90 | 0 | { |
91 | 0 | case GPT_VERTEX_PROGRAM: |
92 | 0 | return mVSGpuProgram; |
93 | 0 | break; |
94 | 0 | case GPT_FRAGMENT_PROGRAM: |
95 | 0 | return mPSGpuProgram; |
96 | 0 | break; |
97 | 0 | default: |
98 | 0 | break; |
99 | 0 | } |
100 | | |
101 | 0 | static GpuProgramPtr nullPtr; |
102 | 0 | return nullPtr; |
103 | 0 | } |
104 | | |
105 | | } |
106 | | } |