forked from NVIDIA-RTX/RTXNTC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphicsPasses.h
More file actions
102 lines (89 loc) · 3.18 KB
/
GraphicsPasses.h
File metadata and controls
102 lines (89 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
* SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: LicenseRef-NvidiaProprietary
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*/
#pragma once
#include <nvrhi/nvrhi.h>
#include <libntc/ntc.h>
#include "Utils.h"
struct GraphicsResourcesForTexture
{
std::string name;
nvrhi::TextureHandle color;
nvrhi::StagingTextureHandle stagingColor;
nvrhi::TextureHandle blocks;
nvrhi::StagingTextureHandle stagingBlocks;
nvrhi::TextureHandle bc;
ntc::SharedTextureWrapper sharedTexture;
GraphicsResourcesForTexture(ntc::IContext* context)
: sharedTexture(context)
{ }
};
struct GraphicsResourcesForTextureSet
{
std::vector<GraphicsResourcesForTexture> perTexture;
nvrhi::BufferHandle accelerationBuffer;
nvrhi::BufferHandle accelerationStagingBuffer;
};
class GraphicsDecompressionPass;
bool CreateGraphicsResourcesFromMetadata(
ntc::IContext* context,
nvrhi::IDevice* device,
ntc::ITextureSetMetadata* metadata,
int mipLevels,
bool enableCudaSharing,
GraphicsResourcesForTextureSet& resources);
bool DecompressTextureSetWithGraphicsAPI(
nvrhi::ICommandList* commandList,
nvrhi::ITimerQuery* timerQuery,
GraphicsDecompressionPass& gdp,
ntc::IContext* context,
ntc::ITextureSetMetadata* metadata,
ntc::IStream* inputFile,
int mipLevels,
GraphicsResourcesForTextureSet const& graphicsResources);
bool CopyTextureSetDataIntoGraphicsTextures(
ntc::IContext* context,
ntc::ITextureSet* textureSet,
ntc::TextureDataPage page,
bool allMipLevels,
bool onlyBlockCompressedFormats,
GraphicsResourcesForTextureSet const& graphicsResources);
bool SaveGraphicsStagingTextures(
ntc::ITextureSetMetadata* metadata,
nvrhi::IDevice* device,
char const* savePath,
ImageContainer const userProvidedContainer,
bool saveMips,
GraphicsResourcesForTextureSet const& graphicsResources);
bool BlockCompressAndSaveGraphicsTextures(
ntc::IContext* context,
ntc::ITextureSetMetadata* metadata,
nvrhi::IDevice* device,
nvrhi::ICommandList* commandList,
nvrhi::ITimerQuery* timerQuery,
char const* savePath,
int userProvidedBcQuality,
int benchmarkIterations,
GraphicsResourcesForTextureSet const& graphicsResources);
bool OptimizeBlockCompression(
ntc::IContext* context,
ntc::ITextureSetMetadata* textureSetMetadata,
nvrhi::IDevice* device,
nvrhi::ICommandList* commandList,
float psnrThreshold,
GraphicsResourcesForTextureSet const& graphicsResources);
bool ComputePsnrForBlockCompressedTextureSet(
ntc::IContext* context,
ntc::ITextureSetMetadata* textureSetMetadata,
nvrhi::IDevice* device,
nvrhi::ICommandList* commandList,
GraphicsResourcesForTextureSet const& graphicsResources,
float& outTargetPsnr);