WebGLContextAttributes.h 858 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibJS/Forward.h>
  8. namespace Web::WebGL {
  9. enum class WebGLPowerPreference {
  10. Default,
  11. LowPower,
  12. HighPerformance,
  13. };
  14. // https://www.khronos.org/registry/webgl/specs/latest/1.0/#WEBGLCONTEXTATTRIBUTES
  15. struct WebGLContextAttributes {
  16. bool alpha { true };
  17. bool depth { true };
  18. bool stencil { false };
  19. bool antialias { true };
  20. bool premultiplied_alpha { true };
  21. bool preserve_drawing_buffer { false };
  22. WebGLPowerPreference power_preference { WebGLPowerPreference::Default };
  23. bool fail_if_major_performance_caveat { false };
  24. bool desynchronized { false };
  25. };
  26. JS::ThrowCompletionOr<WebGLContextAttributes> convert_value_to_context_attributes_dictionary(JS::VM&, JS::Value value);
  27. }