gVirtualXRay  2.0.10
VirtualX-RayImagingLibraryonGPU
Shader.inl
Go to the documentation of this file.
1 /*
2 
3 Copyright (c) 2014, Dr Franck P. Vidal (franck.p.vidal@fpvidal.net),
4 http://www.fpvidal.net/
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14 this list of conditions and the following disclaimer in the documentation and/or
15 other materials provided with the distribution.
16 
17 3. Neither the name of the Bangor University nor the names of its contributors
18 may be used to endorse or promote products derived from this software without
19 specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 
32 */
33 
34 
62 //******************************************************************************
63 // namespace
64 //******************************************************************************
65 namespace gVirtualXRay {
66 
67 
68  //--------------------------------------------------------------------
69  inline void Shader::setLabels(const std::string& aVertexShaderLabel,
70  const std::string& aFragmentShaderLabel)
71  //--------------------------------------------------------------------
72  {
73  m_vertex_shader_label = aVertexShaderLabel;
74  m_fragment_shader_label = aFragmentShaderLabel;
75  }
76 
77 
78 //------------------------------------------------------------------
79 inline void Shader::setLabel(const std::string& aComputeShaderLabel)
80 //------------------------------------------------------------------
81 {
82  m_compute_shader_label = aComputeShaderLabel;
83 }
84 
85 
86 //--------------------------------------------------
87 inline unsigned int Shader::getProgramHandle() const
88 //--------------------------------------------------
89 {
90  return (m_shader_program_id);
91 }
92 
93 
94 //---------------------------------
95 inline bool Shader::isValid() const
96 //---------------------------------
97 {
98  return (m_valid);
99 }
100 
101 
102 //---------------------------------------------
104 //---------------------------------------------
105 {
107 }
108 
109 
110 //-----------------------------------------------
112 //-----------------------------------------------
113 {
115 }
116 
117 
118 //----------------------------------------------
120 //----------------------------------------------
121 {
123 }
124 
125 
126 } // namespace gVirtualXRay
void releaseComputeSourceMemory()
Release the memory held by the compute shader.
Definition: Shader.inl:119
void releaseFragmentSourceMemory()
Release the memory held by the fragment shader.
Definition: Shader.inl:111
unsigned int m_shader_program_id
ID of the shader program.
Definition: Shader.h:376
int m_vertex_source_number_of_lines
Number of line of the vertex shader.
Definition: Shader.h:350
void setLabel(const std::string &aComputeShaderLabel)
Set the compute shader label. This is useful for debugging.
Definition: Shader.inl:79
bool isValid() const
Accessor on the validity status of the shader.
Definition: Shader.inl:95
char ** m_fragment_source
Source code of the fragment shader.
Definition: Shader.h:354
std::string m_vertex_shader_label
Label of the vertex shader.
Definition: Shader.h:322
char ** m_vertex_source
Source code of the vertex shader.
Definition: Shader.h:346
int m_fragment_source_number_of_lines
Number of line of the fragment shader.
Definition: Shader.h:358
int m_compute_source_number_of_lines
Number of line of the vertex shader.
Definition: Shader.h:366
std::string m_compute_shader_label
Label of the compute shader.
Definition: Shader.h:330
unsigned int getProgramHandle() const
Accessor on the shader program handle.
Definition: Shader.inl:87
char ** m_compute_source
Source code of the vertex shader.
Definition: Shader.h:362
void releaseSourceMemory(int &aLineNumber, char **&aShaderSource)
Release the memory held by the vertex shader or the fragment shader.
std::string m_fragment_shader_label
Label of the fragment shader.
Definition: Shader.h:326
void setLabels(const std::string &aVertexShaderLabel, const std::string &aFragmentShaderLabel)
Set the vertex and fragment shader labels. This is useful for debugging.
Definition: Shader.inl:69
void releaseVertexSourceMemory()
Release the memory held by the vertex shader.
Definition: Shader.inl:103