|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#if !(defined(NVDR_TORCH) && defined(__CUDACC__))
|
|
#include "framework.h"
|
|
#include "glutil.h"
|
|
|
|
|
|
|
|
|
|
struct RasterizeGLState // Must be initializable by memset to zero.
|
|
{
|
|
int width;
|
|
int height;
|
|
int depth;
|
|
int posCount;
|
|
int triCount;
|
|
GLContext glctx;
|
|
GLuint glFBO;
|
|
GLuint glColorBuffer[2];
|
|
GLuint glPrevOutBuffer;
|
|
GLuint glDepthStencilBuffer;
|
|
GLuint glVAO;
|
|
GLuint glTriBuffer;
|
|
GLuint glPosBuffer;
|
|
GLuint glProgram;
|
|
GLuint glProgramDP;
|
|
GLuint glVertexShader;
|
|
GLuint glGeometryShader;
|
|
GLuint glFragmentShader;
|
|
GLuint glFragmentShaderDP;
|
|
cudaGraphicsResource_t cudaColorBuffer[2];
|
|
cudaGraphicsResource_t cudaPrevOutBuffer;
|
|
cudaGraphicsResource_t cudaPosBuffer;
|
|
cudaGraphicsResource_t cudaTriBuffer;
|
|
int enableDB;
|
|
int enableZModify;
|
|
};
|
|
|
|
|
|
|
|
|
|
void rasterizeInitGLContext(NVDR_CTX_ARGS, RasterizeGLState& s, int cudaDeviceIdx);
|
|
void rasterizeResizeBuffers(NVDR_CTX_ARGS, RasterizeGLState& s, bool& changes, int posCount, int triCount, int width, int height, int depth);
|
|
void rasterizeRender(NVDR_CTX_ARGS, RasterizeGLState& s, cudaStream_t stream, const float* posPtr, int posCount, int vtxPerInstance, const int32_t* triPtr, int triCount, const int32_t* rangesPtr, int width, int height, int depth, int peeling_idx);
|
|
void rasterizeCopyResults(NVDR_CTX_ARGS, RasterizeGLState& s, cudaStream_t stream, float** outputPtr, int width, int height, int depth);
|
|
void rasterizeReleaseBuffers(NVDR_CTX_ARGS, RasterizeGLState& s);
|
|
|
|
|
|
#endif
|
|
|