1#ifndef NXDK_PGRAPH_TESTS_TEST_HOST_H 
    2#define NXDK_PGRAPH_TESTS_TEST_HOST_H 
    4#include <debug_output.h> 
    6#include <pbkit/pbkit.h> 
    7#include <printf/printf.h> 
   14#include "pushbuffer.h" 
   16#include "texture_format.h" 
   17#include "texture_stage.h" 
   18#include "vertex_buffer.h" 
   19#include "xbox_math_types.h" 
   21using namespace XboxMath;
 
   22using namespace PBKitPlusPlus;
 
   24namespace PBKitPlusPlus {
 
   25class VertexShaderProgram;
 
   35  TestHost(std::shared_ptr<FTPLogger> ftp_logger, uint32_t framebuffer_width, uint32_t framebuffer_height,
 
   36           uint32_t max_texture_width, uint32_t max_texture_height, uint32_t max_texture_depth = 4);
 
   39  void FinishDraw(
bool allow_saving, 
const std::string &output_directory, 
const std::string &suite_name,
 
   40                  const std::string &name, 
bool save_zbuffer = 
false);
 
   48  static std::string 
SaveTexture(
const std::string &output_directory, 
const std::string &name, 
const uint8_t *texture,
 
   49                                 uint32_t width, uint32_t height, uint32_t pitch, uint32_t bits_per_pixel,
 
   50                                 SDL_PixelFormatEnum format);
 
   52  static std::string 
SaveRawTexture(
const std::string &output_directory, 
const std::string &name,
 
   53                                    const uint8_t *texture, uint32_t width, uint32_t height, uint32_t pitch,
 
   54                                    uint32_t bits_per_pixel);
 
   56  [[nodiscard]] std::string 
SaveZBuffer(
const std::string &output_directory, 
const std::string &name) 
const;
 
   62  inline float CenterX(
float item_width, 
bool pixel_align = 
true) {
 
   63    float ret = (GetFramebufferWidthF() - item_width) * 0.5f;
 
 
   72  inline float CenterY(
float item_height, 
bool pixel_align = 
true) {
 
   73    float ret = (GetFramebufferHeightF() - item_height) * 0.5f;
 
 
   84  static std::string PrepareSaveFile(std::string output_directory, 
const std::string &filename,
 
   85                                     const std::string &ext = 
".png");
 
   86  static std::string SaveBackBuffer(
const std::string &output_directory, 
const std::string &name);
 
   89  bool save_results_{
true};
 
   91  std::shared_ptr<FTPLogger> ftp_logger_;
 
 
Definition test_host.h:33
static std::string SaveRawTexture(const std::string &output_directory, const std::string &name, const uint8_t *texture, uint32_t width, uint32_t height, uint32_t pitch, uint32_t bits_per_pixel)
Saves the given region of memory as a flat binary file.
Definition test_host.cpp:174
float CenterY(float item_height, bool pixel_align=true)
Returns a Y coordinate sufficient to center a primitive with the given height within the framebuffer.
Definition test_host.h:72
bool GetSaveResults() const
Returns the current override flag to allow/prevent artifact saving.
Definition test_host.h:43
static void EnsureFolderExists(const std::string &folder_path)
Creates the given directory if it does not already exist.
Definition test_host.cpp:44
static std::string SaveTexture(const std::string &output_directory, const std::string &name, const uint8_t *texture, uint32_t width, uint32_t height, uint32_t pitch, uint32_t bits_per_pixel, SDL_PixelFormatEnum format)
Saves the given texture to the filesystem as a PNG file.
Definition test_host.cpp:150
float CenterX(float item_width, bool pixel_align=true)
Returns an X coordinate sufficient to center a primitive with the given width within the framebuffer.
Definition test_host.h:62
void FinishDraw(bool allow_saving, const std::string &output_directory, const std::string &suite_name, const std::string &name, bool save_zbuffer=false)
Marks drawing as completed, potentially causing artifacts (framebuffer, z/stencil-buffer) to be saved...
Definition test_host.cpp:200
void SetSaveResults(bool enable=true)
Sets the override flag to prevent artifact saving during FinishDraw.
Definition test_host.h:45
std::string SaveZBuffer(const std::string &output_directory, const std::string &name) const
Saves the Z/Stencil buffer to the filesystem/.
Definition test_host.cpp:137
static std::string GetDrawPrimitiveName(DrawPrimitive primitive)
Returns a string name for the given DrawPrimitive.
Definition test_host.cpp:239