| 1 |
// Copyright (c) 2019 Google LLC. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
// Utility class used to generate SPIR-V code strings for tests |
| 16 |
|
| 17 |
#include <string> |
| 18 |
#include <vector> |
| 19 |
|
| 20 |
namespace spvtools { |
| 21 |
namespace val { |
| 22 |
|
| 23 |
struct EntryPoint { |
| 24 |
std::string name; |
| 25 |
std::string execution_model; |
| 26 |
std::string execution_modes; |
| 27 |
std::string body; |
| 28 |
std::string interfaces; |
| 29 |
}; |
| 30 |
|
| 31 |
class CodeGenerator { |
| 32 |
public: |
| 33 |
static CodeGenerator GetDefaultShaderCodeGenerator(); |
| 34 |
static CodeGenerator GetWebGPUShaderCodeGenerator(); |
| 35 |
|
| 36 |
std::string Build() const; |
| 37 |
|
| 38 |
std::vector<EntryPoint> entry_points_; |
| 39 |
std::string capabilities_; |
| 40 |
std::string extensions_; |
| 41 |
std::string memory_model_; |
| 42 |
std::string before_types_; |
| 43 |
std::string types_; |
| 44 |
std::string after_types_; |
| 45 |
std::string add_at_the_end_; |
| 46 |
}; |
| 47 |
|
| 48 |
} // namespace val |
| 49 |
} // namespace spvtools |