Grindstone Game Engine
v0.2.0
An open source game engine and toolkit.
Toggle main menu visibility
Loading...
Searching...
No Matches
NsightAftermathShaderDatabase.h
1
//*********************************************************
2
//
3
// Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
4
//
5
// Permission is hereby granted, free of charge, to any person obtaining a
6
// copy of this software and associated documentation files (the "Software"),
7
// to deal in the Software without restriction, including without limitation
8
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
// and/or sell copies of the Software, and to permit persons to whom the
10
// Software is furnished to do so, subject to the following conditions:
11
//
12
// The above copyright notice and this permission notice shall be included in
13
// all copies or substantial portions of the Software.
14
//
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
// DEALINGS IN THE SOFTWARE.
22
//
23
//*********************************************************
24
25
#pragma once
26
27
#include <vector>
28
#include <map>
29
#include <mutex>
30
31
#include "NsightAftermathHelpers.h"
32
33
//*********************************************************
34
// Implements a very simple shader database to help demonstrate
35
// how to use the Nsight Aftermath GPU crash dump decoder API.
36
//
37
// In a real world scenario this would be part of an offline
38
// analysis tool. This is for demonstration purposes only!
39
//
40
class
ShaderDatabase
41
{
42
public
:
43
ShaderDatabase();
44
~ShaderDatabase();
45
46
// Initialize the shader database
47
void
Initialize(
bool
applicationUsesStrippedShaders);
48
49
// Find a shader bytecode binary by shader hash.
50
bool
FindShaderBinary(
const
GFSDK_Aftermath_ShaderBinaryHash& shaderHash, std::vector<uint8_t>& shader)
const
;
51
52
// Find a source shader debug info by shader debug name generated by the DXC compiler.
53
bool
FindShaderBinaryWithDebugData(
const
GFSDK_Aftermath_ShaderDebugName& shaderDebugName, std::vector<uint8_t>& shader)
const
;
54
55
private
:
56
57
void
AddShaderBinary(
const
char
* shaderFilePath);
58
void
AddShaderBinaryWithDebugInfo(
const
char
* strippedShaderFilePath,
const
char
* shaderFilePath);
59
60
static
bool
ReadFile(
const
char
* filename, std::vector<uint8_t>& data);
61
62
// List of shader binaries by ShaderBinaryHash.
63
std::map<GFSDK_Aftermath_ShaderBinaryHash, std::vector<uint8_t>> m_shaderBinaries;
64
65
// List of available shader binaries with source debug information by ShaderDebugName.
66
std::map<GFSDK_Aftermath_ShaderDebugName, std::vector<uint8_t>> m_shaderBinariesWithDebugInfo;
67
};
plugins
Grindstone.RHI.Vulkan
include
GpuCrashTracker
NsightAftermathShaderDatabase.h
Generated by
1.17.0