/*
 * Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
 *
 * SPDX-License-Identifier: MIT
 */

#ifndef _OCL_Mandelbrot_H_
#define _OCL_Mandelbrot_H_

#include "OCLTestImp.h"

class OCLPerfMandelbrot : public OCLTestImp {
 public:
  OCLPerfMandelbrot();
  virtual ~OCLPerfMandelbrot();

 public:
  virtual void open(unsigned int test, char* units, double& conversion, unsigned int deviceID);
  virtual void run(void);
  virtual unsigned int close(void);

  std::string shader_;
  void setData(cl_mem buffer, unsigned int data);
  void checkData(cl_mem buffer);

  cl_context context_;
  cl_command_queue cmd_queue_;
  cl_program program_;
  cl_kernel kernel_;
  cl_mem outBuffer_;
  cl_int error_;
  cl_device_id device;

  unsigned int width_;
  unsigned int bufSize_;
  bool doubleSupport;
  bool skip;
  unsigned int maxIter;
  unsigned int shaderIdx;
  unsigned int coordIdx;
  unsigned long long totalIters;
  bool isAMD;
  static const unsigned int numLoops = 10;
};

class OCLPerfAsyncMandelbrot : public OCLPerfMandelbrot {
 public:
  OCLPerfAsyncMandelbrot();
  virtual ~OCLPerfAsyncMandelbrot();

  virtual void open(unsigned int test, char* units, double& conversion, unsigned int deviceID);
  virtual void run(void);
  virtual unsigned int close(void);

  cl_command_queue cmd_queue2_;
  cl_mem outBuffer2_;
};

#endif  // _OCL_Mandelbrot_H_
