HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RV_Utils.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: RV_Utils.h ( RV Library, C++)
7  *
8  * COMMENTS:
9  * Utility functions for RV.
10  */
11 #ifndef RV_Utils_h
12 #define RV_Utils_h
13 
14 #include "RV_API.h"
15 
16 #include "RV_Type.h"
17 #include "RV_TypePtrs.h"
18 
19 #include <UT/UT_Vector3.h>
20 #include <UT/UT_Matrix4.h>
21 #include <UT/UT_UniquePtr.h>
22 #include <SYS/SYS_Types.h>
23 
24 class RV_Render;
25 class RV_ShaderBlock;
26 class RV_ShaderProgram;
28 class RV_VKImage;
29 class PXL_Lookup;
30 class PXL_Raster;
31 
33 
34 namespace RV_Utils
35 {
36 /// Returns an 8b RGBA 64x64 texture with 0-1 random values in all comps.
38  unsigned int seed,
39  bool interp,
40  int size = 64);
41 /// Returns an 8b RGBA size^3 3D texture with 0-1 random values
43  unsigned int seed,
44  bool interp,
45  int size = 32);
46 /// Returns an 8b RGBA size^2 2D texture array of size 'num_layers'
48  unsigned int seed,
49  bool interp,
50  int num_layers,
51  int size = 64 );
52 /// Create a new 2D image from a 2D multisample image by increasing the
53 /// resolution of the 2D image to show all samples.
55  RV_VKImage *ms_image);
56 
57 /// Create resources for color correction in HOUcolorCorrect().
59  RV_ShaderProgram *sh,
60  int set_number,
61  const PXL_Lookup *lut,
62  fpreal brightness,
63  fpreal bright_shift,
64  fpreal gamma,
65  fpreal alpha_scale,
66  exint &lut_version,
69  UT_UniquePtr<RV_VKImage> &main_lut_image,
70  UT_UniquePtr<RV_VKImage> &pre_lut_image);
71 
72 extern RV_API bool matchesRaster(const RV_VKImage &img,
73  const PXL_Raster &raster);
74 
75 extern RV_API void setupRaster(RV_VKImage &img,
76  PXL_Raster &raster,
77  bool alloc = true);
78 
79 extern RV_API void
81  const PXL_Lookup *lut,
82  UT_UniquePtr<RV_VKImage> &main_lut,
83  UT_UniquePtr<RV_VKImage> &pre); // optionally generated prelut
84 
85 /// Create lower mipmaps for a cubemap texture. image must be a latlong map
86 extern RV_API void
88  RV_VKImage *tex, RV_GPUType format_type, int vsize);
89 
90 extern RV_API bool initShaders(RV_Instance* inst);
91 extern RV_API void cleanupShaders();
92 };
93 
94 #endif
A collection of Vulkan UBO, SSBO, and Image shader bindings (descriptor set)
RV_API RV_VKImagePtr getRandomTextureArray(RV_Render *r, unsigned int seed, bool interp, int num_layers, int size=64)
Returns an 8b RGBA size^2 2D texture array of size 'num_layers'.
RV_API void generateCubeMips(RV_Render *r, UT_UniquePtr< PXL_Raster > &latlong_image, RV_VKImage *tex, RV_GPUType format_type, int vsize)
Create lower mipmaps for a cubemap texture. image must be a latlong map.
int64 exint
Definition: SYS_Types.h:125
UT_UniquePtr< RV_VKImage > RV_VKImagePtr
Definition: RV_TypePtrs.h:59
RV_API void createLUTTexture(RV_Render *r, const PXL_Lookup *lut, UT_UniquePtr< RV_VKImage > &main_lut, UT_UniquePtr< RV_VKImage > &pre)
RV_API UT_UniquePtr< RV_VKImage > resolveMSTexture(RV_Render *r, RV_VKImage *ms_image)
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
RV_API void setupRaster(RV_VKImage &img, PXL_Raster &raster, bool alloc=true)
RV_API bool matchesRaster(const RV_VKImage &img, const PXL_Raster &raster)
constexpr auto set(type rhs) -> int
Definition: core.h:610
RV_API bool setupColorCorrection(RV_Render *r, RV_ShaderProgram *sh, int set_number, const PXL_Lookup *lut, fpreal brightness, fpreal bright_shift, fpreal gamma, fpreal alpha_scale, exint &lut_version, UT_UniquePtr< RV_ShaderVariableSet > &set, UT_UniquePtr< RV_ShaderBlock > &block, UT_UniquePtr< RV_VKImage > &main_lut_image, UT_UniquePtr< RV_VKImage > &pre_lut_image)
Create resources for color correction in HOUcolorCorrect().
RV_API void cleanupShaders()
#define RV_API
Definition: RV_API.h:10
HUSD_API const char * raster()
Handle to the main interface of Vulkan.
Definition: RV_Instance.h:44
GLint void * img
Definition: glcorearb.h:556
RV_API bool initShaders(RV_Instance *inst)
GLsizeiptr size
Definition: glcorearb.h:664
UT_UniquePtr< RV_VKImage > RV_VKImagePtr
Definition: RV_Utils.h:30
RV_GPUType
Definition: RV_Type.h:40
fpreal64 fpreal
Definition: SYS_Types.h:278
RV_API RV_VKImagePtr getRandomTexture(RV_Render *r, unsigned int seed, bool interp, int size=64)
Returns an 8b RGBA 64x64 texture with 0-1 random values in all comps.
GLboolean r
Definition: glcorearb.h:1222
RV_API RV_VKImagePtr getRandomTexture3D(RV_Render *r, unsigned int seed, bool interp, int size=32)
Returns an 8b RGBA size^3 3D texture with 0-1 random values.