1 #ifndef _RSGEXECUTIONCONTEXT_HPP
2 #define _RSGEXECUTIONCONTEXT_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Random Shader Generator
5 * ----------------------------------------------------
7 * Copyright 2014 The Android Open Source Project
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief Shader Execution Context.
24 *//*--------------------------------------------------------------------*/
26 #include "rsgDefs.hpp"
27 #include "rsgVariable.hpp"
28 #include "rsgVariableValue.hpp"
29 #include "rsgSamplers.hpp"
42 typedef ConstStridedValueAccess<EXEC_VEC_WIDTH> ExecConstValueAccess;
43 typedef StridedValueAccess<EXEC_VEC_WIDTH> ExecValueAccess;
44 typedef ValueStorage<EXEC_VEC_WIDTH> ExecValueStorage;
46 typedef std::map<const Variable*, ExecValueStorage*> VarValueMap;
51 ExecMaskStorage (bool initVal = true);
53 ExecValueAccess getValue (void);
54 ExecConstValueAccess getValue (void) const;
57 Scalar m_data[EXEC_VEC_WIDTH];
60 class ExecutionContext
63 ExecutionContext (const Sampler2DMap& samplers2D, const SamplerCubeMap& samplersCube);
64 ~ExecutionContext (void);
66 ExecValueAccess getValue (const Variable* variable);
67 const Sampler2D& getSampler2D (const Variable* variable) const;
68 const SamplerCube& getSamplerCube (const Variable* variable) const;
70 ExecConstValueAccess getExecutionMask (void) const;
72 void andExecutionMask (ExecConstValueAccess value); // Pushes computed value
73 void pushExecutionMask (ExecConstValueAccess value);
75 void popExecutionMask (void);
78 ExecutionContext (const ExecutionContext& other);
79 ExecutionContext& operator= (const ExecutionContext& other);
81 VarValueMap m_varValues;
82 const Sampler2DMap& m_samplers2D;
83 const SamplerCubeMap& m_samplersCube;
84 std::vector<ExecMaskStorage> m_execMaskStack;
87 void assignMasked (ExecValueAccess dst, ExecConstValueAccess src, ExecConstValueAccess mask);
91 #endif // _RSGEXECUTIONCONTEXT_HPP