mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-05-17 07:21:43 +00:00
44 lines
1.2 KiB
Plaintext
44 lines
1.2 KiB
Plaintext
#options GAME(IW4, IW5)
|
|
|
|
#filename "Game/" + GAME + "/Techset/PixelShaderDumper" + GAME + ".cpp"
|
|
|
|
#set DUMPER_HEADER "\"PixelShaderDumper" + GAME + ".h\""
|
|
|
|
#if GAME == "IW4"
|
|
#define FEATURE_IW4
|
|
#define IS_DX9
|
|
#elif GAME == "IW5"
|
|
#define FEATURE_IW5
|
|
#define IS_DX9
|
|
#endif
|
|
|
|
// This file was templated.
|
|
// See PixelShaderDumper.cpp.template.
|
|
// Do not modify, changes will be lost.
|
|
|
|
#include DUMPER_HEADER
|
|
|
|
#include "Shader/ShaderCommon.h"
|
|
|
|
#include <type_traits>
|
|
|
|
using namespace GAME;
|
|
|
|
#set CLASS_NAME "PixelShaderDumper" + GAME
|
|
|
|
namespace techset
|
|
{
|
|
void CLASS_NAME::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetPixelShader::Type>& asset)
|
|
{
|
|
const auto& shader = *asset.Asset();
|
|
const auto shaderFile = context.OpenAssetFile(shader::GetFileNameForPixelShaderAssetName(shader.name));
|
|
|
|
if (!shaderFile)
|
|
return;
|
|
|
|
shaderFile->write(reinterpret_cast<const char*>(shader.prog.loadDef.program),
|
|
static_cast<std::streamsize>(shader.prog.loadDef.programSize)
|
|
* sizeof(std::remove_pointer_t<decltype(GfxPixelShaderLoadDef::program)>));
|
|
}
|
|
} // namespace techset
|