Home | History | Annotate | Download | only in randomshaders
      1 #ifndef _RSGPARAMETERS_HPP
      2 #define _RSGPARAMETERS_HPP
      3 /*-------------------------------------------------------------------------
      4  * drawElements Quality Program Random Shader Generator
      5  * ----------------------------------------------------
      6  *
      7  * Copyright 2014 The Android Open Source Project
      8  *
      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
     12  *
     13  *      http://www.apache.org/licenses/LICENSE-2.0
     14  *
     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.
     20  *
     21  *//*!
     22  * \file
     23  * \brief Shader generator parameters.
     24  *//*--------------------------------------------------------------------*/
     25 
     26 #include "rsgDefs.hpp"
     27 
     28 #include <set>
     29 #include <string>
     30 #include <vector>
     31 
     32 namespace rsg
     33 {
     34 
     35 enum
     36 {
     37 	NUM_RESERVED_SHADER_INPUTS = 1 // Taken by dEQP_Position
     38 };
     39 
     40 enum Version
     41 {
     42 	VERSION_100,		//!< GLSL ES 1.0
     43 	VERSION_300,		//!< GLSL ES 3.0
     44 
     45 	VERSION_LAST
     46 };
     47 
     48 class ShaderParameters
     49 {
     50 public:
     51 	ShaderParameters (void)
     52 		: randomize						(false)
     53 		, maxStatementDepth				(2)
     54 		, maxStatementsPerBlock			(10)
     55 		, maxExpressionDepth			(5)
     56 		, maxCombinedVariableScalars	(32)
     57 		, maxUniformScalars				(512)
     58 		, maxInputVariables				(8)
     59 		, texLookupBaseWeight			(0.0f)
     60 		, maxSamplers					(8)
     61 		, useTexture2D					(false)
     62 		, useTextureCube				(false)
     63 	{
     64 	}
     65 
     66 	bool					randomize;					//!< If not enabled, only simple passthrough will be generated
     67 	int						maxStatementDepth;
     68 	int						maxStatementsPerBlock;
     69 	int						maxExpressionDepth;
     70 	int						maxCombinedVariableScalars;
     71 	int						maxUniformScalars;
     72 	int						maxInputVariables;
     73 
     74 	float					texLookupBaseWeight;
     75 	int						maxSamplers;
     76 	bool					useTexture2D;
     77 	bool					useTextureCube;
     78 };
     79 
     80 class ProgramParameters
     81 {
     82 public:
     83 	ProgramParameters (void)
     84 		: seed								(0)
     85 		, version							(VERSION_100)
     86 		, declarationStatementBaseWeight	(1.0f)
     87 		, useScalarConversions				(false)
     88 		, useSwizzle						(false)
     89 		, useComparisonOps					(false)
     90 		, useConditionals					(false)
     91 		, trigonometricBaseWeight			(0.0f)
     92 		, exponentialBaseWeight				(0.0f)
     93 	{
     94 	}
     95 
     96 	deUint32				seed;
     97 	Version					version;
     98 	ShaderParameters		vertexParameters;
     99 	ShaderParameters		fragmentParameters;
    100 
    101 	bool					declarationStatementBaseWeight;
    102 	bool					useScalarConversions;
    103 	bool					useSwizzle;
    104 	bool					useComparisonOps;
    105 	bool					useConditionals;
    106 
    107 	float					trigonometricBaseWeight;
    108 	float					exponentialBaseWeight;
    109 };
    110 
    111 } // rsg
    112 
    113 #endif // _RSGPARAMETERS_HPP
    114