force_render_red.h 1.7 KB

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