solstice-solver

Solver library of the solstice app
git clone git://git.meso-star.com/solstice-solver.git
Log | Files | Refs | README | LICENSE

ssol_device_c.h (2346B)


      1 /* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com)
      2  * Copyright (C) 2016, 2018 CNRS
      3  *
      4  * This program is free software: you can redistribute it and/or modify
      5  * it under the terms of the GNU General Public License as published by
      6  * the Free Software Foundation, either version 3 of the License, or
      7  * (at your option) any later version.
      8  *
      9  * This program is distributed in the hope that it will be useful,
     10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     12  * GNU General Public License for more details.
     13  *
     14  * You should have received a copy of the GNU General Public License
     15  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     16 
     17 #ifndef SSOL_DEVICE_C_H
     18 #define SSOL_DEVICE_C_H
     19 
     20 #include <rsys/dynamic_array.h>
     21 #include <rsys/free_list.h>
     22 #include <rsys/ref_count.h>
     23 
     24 #define DARRAY_NAME byte
     25 #define DARRAY_DATA char
     26 #define DARRAY_ALIGNMENT 16
     27 #include <rsys/dynamic_array.h>
     28 
     29 #define DARRAY_NAME tile
     30 #define DARRAY_DATA struct darray_byte
     31 #define DARRAY_FUNCTOR_INIT darray_byte_init
     32 #define DARRAY_FUNCTOR_RELEASE darray_byte_release
     33 #define DARRAY_FUNCTOR_COPY darray_byte_copy
     34 #define DARRAY_FUNCTOR_COPY_AND_RELEASE darray_byte_copy_and_release
     35 #include <rsys/dynamic_array.h>
     36 
     37 struct scpr_mesh;
     38 struct s3d_device;
     39 
     40 struct ssol_device {
     41   struct logger* logger;
     42   struct mem_allocator* allocator;
     43   struct mem_allocator* bsdf_allocators; /* Per thread allocator */
     44   unsigned nthreads;
     45   int verbose;
     46 
     47   /* Per thread draw tile used by the draw function */
     48   struct darray_tile tiles;
     49 
     50   struct s3d_device* s3d;
     51   struct scpr_mesh* scpr_mesh; /* Use to clip quadric mesh */
     52   struct scpr_device* scpr_device;
     53 
     54   ref_T ref;
     55 };
     56 
     57 /* Conditionally log a message on the LOG_ERROR stream of the device logger,
     58  * with respect to the device verbose flag */
     59 extern LOCAL_SYM void
     60 log_error
     61   (struct ssol_device* dev,
     62    const char* msg,
     63    ...)
     64 #ifdef COMPILER_GCC
     65   __attribute((format(printf, 2, 3)))
     66 #endif
     67 ;
     68 
     69 /* Conditionally log a message on the LOG_WARNING stream of the device logger,
     70  * with respect to the device verbose flag */
     71 extern LOCAL_SYM void
     72 log_warning
     73   (struct ssol_device* dev,
     74    const char* msg,
     75    ...)
     76 #ifdef COMPILER_GCC
     77     __attribute((format(printf, 2, 3)))
     78 #endif
     79 ;
     80 
     81 #endif /* SSOL_DEVICE_C_H */
     82