/**
 ******************************************************************************
 * Xenia : Xbox 360 Emulator Research Project                                 *
 ******************************************************************************
 * Copyright 2022 Ben Vanik. All rights reserved.                             *
 * Released under the BSD license - see LICENSE in the root for more details. *
 ******************************************************************************
 */

#include "xesl.xesli"

xesl_pushConstants_begin(b0, space0)
  // If the layout is changed, update the base offset in all guest output pixel
  // shaders!
  xesl_float2 xe_triangle_strip_rect_offset;
  // Can be negative.
  xesl_float2 xe_triangle_strip_rect_size;
xesl_pushConstants_end

xesl_entry_outputs_begin
  xesl_entry_output_position
xesl_entry_outputs_end_stageInputs_begin
xesl_entry_stageInputs_end_bindings_begin_vertex
  xesl_pushConstants_binding(buffer(0))
xesl_entry_bindings_end_inputs_begin
  xesl_entry_input_vertexID
xesl_entry_inputs_end_code_begin
  xesl_Position =
      xesl_float4(
          xesl_pushConstant(xe_triangle_strip_rect_offset) +
              xesl_float2((xesl_uint2(xesl_VertexID, xesl_VertexID) >>
                           xesl_uint2(0u, 1u)) & 1u) *
              xesl_pushConstant(xe_triangle_strip_rect_size),
          0.0, 1.0);
xesl_entry_code_end
