/**
 ******************************************************************************
 * 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)
  xesl_float2 xe_coordinate_space_size_inv;
xesl_pushConstants_end

xesl_entry_outputs_begin
  xesl_entry_output(xesl_float2, xe_out_texcoord, 0, TEXCOORD)
  xesl_entry_output(xesl_float4, xe_out_color, 1, COLOR)
  xesl_entry_output_position
xesl_entry_outputs_end_stageInputs_begin
  xesl_entry_stageInput_vertex(xesl_float2, xe_in_position, 0, POSITION)
  xesl_entry_stageInput_vertex(xesl_float2, xe_in_texcoord, 1, TEXCOORD)
  xesl_entry_stageInput_vertex(xesl_float4, xe_in_color, 2, COLOR)
xesl_entry_stageInputs_end_bindings_begin_vertex
  xesl_pushConstants_binding(buffer(0))
xesl_entry_bindings_end_inputs_begin
  xesl_entry_input_stageInputs
xesl_entry_inputs_end_code_begin
  xesl_Output(xe_out_texcoord) = xesl_StageInput(xe_in_texcoord);
  xesl_Output(xe_out_color) = xesl_StageInput(xe_in_color);
  xesl_Position =
      xesl_float4(xesl_StageInput(xe_in_position) *
                      xesl_pushConstant(xe_coordinate_space_size_inv) *
                      xesl_float2(2.0, 2.0 * XESL_Y_SCREEN_DIRECTION) -
                      xesl_float2(1.0, XESL_Y_SCREEN_DIRECTION),
                  0.0, 1.0);
xesl_entry_code_end
