Spaces:
Runtime error
Runtime error
// Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. | |
// | |
// NVIDIA CORPORATION and its licensors retain all intellectual property | |
// and proprietary rights in and to this software, related documentation | |
// and any modifications thereto. Any use, reproduction, disclosure or | |
// distribution of this software and related documentation without an express | |
// license agreement from NVIDIA CORPORATION is strictly prohibited. | |
//------------------------------------------------------------------------ | |
// Constants. | |
//------------------------------------------------------------------------ | |
// CUDA kernel params. | |
struct TextureKernelParams | |
{ | |
const float* tex[TEX_MAX_MIP_LEVEL]; // Incoming texture buffer with mip levels. | |
const float* uv; // Incoming texcoord buffer. | |
const float* uvDA; // Incoming uv pixel diffs or NULL. | |
const float* mipLevelBias; // Incoming mip level bias or NULL. | |
const float* dy; // Incoming output gradient. | |
float* out; // Outgoing texture data. | |
float* gradTex[TEX_MAX_MIP_LEVEL]; // Outgoing texture gradients with mip levels. | |
float* gradUV; // Outgoing texcoord gradient. | |
float* gradUVDA; // Outgoing texcoord pixel differential gradient. | |
float* gradMipLevelBias; // Outgoing mip level bias gradient. | |
int enableMip; // If true, we have uv_da and/or mip_level_bias input(s), and a mip tensor. | |
int filterMode; // One of the TEX_MODE_ constants. | |
int boundaryMode; // One of the TEX_BOUNDARY_MODE_ contants. | |
int texConst; // If true, texture is known to be constant. | |
int mipLevelLimit; // Mip level limit coming from the op. | |
int channels; // Number of texture channels. | |
int imgWidth; // Image width. | |
int imgHeight; // Image height. | |
int texWidth; // Texture width. | |
int texHeight; // Texture height. | |
int texDepth; // Texture depth. | |
int n; // Minibatch size. | |
int mipLevelMax; // Maximum mip level index. Zero if mips disabled. | |
int mipLevelOut; // Mip level being calculated in builder kernel. | |
}; | |
//------------------------------------------------------------------------ | |
// C++ helper function prototypes. | |
void raiseMipSizeError(NVDR_CTX_ARGS, const TextureKernelParams& p); | |
int calculateMipInfo(NVDR_CTX_ARGS, TextureKernelParams& p, int* mipOffsets); | |
//------------------------------------------------------------------------ | |
// Macros. | |
//------------------------------------------------------------------------ | |