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 #ifndef SOURCE_FORCE_RENDER_RED_H_ 16 #define SOURCE_FORCE_RENDER_RED_H_ 17 18 #include <vector> 19 20 #include "source/fuzz/protobufs/spirvfuzz_protobufs.h" 21 #include "spirv-tools/libspirv.hpp" 22 23 namespace spvtools { 24 namespace fuzz { 25 26 // Requires |binary_in| to be a valid SPIR-V module with Shader capability, 27 // containing an entry point with the Fragment execution model, and a single 28 // output variable of type vec4. 29 // 30 // Turns the body of this entry point into effectively: 31 // 32 // output_variable = vec4(1.0, 0.0, 0.0, 1.0); 33 // if (false) { 34 // original_body 35 // } 36 // 37 // If suitable facts about values of uniforms are available, the 'false' will 38 // instead become: 'u > v', where 'u' and 'v' are pieces of uniform data for 39 // which it is known that 'u < v' holds. 40 bool ForceRenderRed( 41 const spv_target_env& target_env, spv_validator_options validator_options, 42 const std::vector<uint32_t>& binary_in, 43 const spvtools::fuzz::protobufs::FactSequence& initial_facts, 44 const MessageConsumer& message_consumer, std::vector<uint32_t>* binary_out); 45 46 } // namespace fuzz 47 } // namespace spvtools 48 49 #endif // SOURCE_FORCE_RENDER_RED_H_ 50