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"
37 constexpr int EXEC_VEC_WIDTH = 64;
39 typedef ConstStridedValueAccess<EXEC_VEC_WIDTH> ExecConstValueAccess;
40 typedef StridedValueAccess<EXEC_VEC_WIDTH> ExecValueAccess;
41 typedef ValueStorage<EXEC_VEC_WIDTH> ExecValueStorage;
43 typedef std::map<const Variable*, ExecValueStorage*> VarValueMap;
48 ExecMaskStorage (bool initVal = true);
50 ExecValueAccess getValue (void);
51 ExecConstValueAccess getValue (void) const;
54 Scalar m_data[EXEC_VEC_WIDTH];
57 class ExecutionContext
60 ExecutionContext (const Sampler2DMap& samplers2D, const SamplerCubeMap& samplersCube);
61 ~ExecutionContext (void);
63 ExecValueAccess getValue (const Variable* variable);
64 const Sampler2D& getSampler2D (const Variable* variable) const;
65 const SamplerCube& getSamplerCube (const Variable* variable) const;
67 ExecConstValueAccess getExecutionMask (void) const;
69 void andExecutionMask (ExecConstValueAccess value); // Pushes computed value
70 void pushExecutionMask (ExecConstValueAccess value);
72 void popExecutionMask (void);
75 ExecutionContext (const ExecutionContext& other);
76 ExecutionContext& operator= (const ExecutionContext& other);
78 VarValueMap m_varValues;
79 const Sampler2DMap& m_samplers2D;
80 const SamplerCubeMap& m_samplersCube;
81 std::vector<ExecMaskStorage> m_execMaskStack;
84 void assignMasked (ExecValueAccess dst, ExecConstValueAccess src, ExecConstValueAccess mask);
88 #endif // _RSGEXECUTIONCONTEXT_HPP