From f6a242c6b7ad1909c2ed6239b6c6b9d64354b418 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Mon, 29 May 2017 10:54:20 +0200 Subject: [PATCH] [IMaterialTechniqueSet] Correctly write all arguments --- .../AssetInterfaces/IMaterialTechniqueSet.cpp | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/Components/Modules/AssetInterfaces/IMaterialTechniqueSet.cpp b/src/Components/Modules/AssetInterfaces/IMaterialTechniqueSet.cpp index d5ec7bbb..3031b965 100644 --- a/src/Components/Modules/AssetInterfaces/IMaterialTechniqueSet.cpp +++ b/src/Components/Modules/AssetInterfaces/IMaterialTechniqueSet.cpp @@ -102,7 +102,31 @@ namespace Assets if (pass->args) { buffer->align(Utils::Stream::ALIGN_4); + Game::MaterialShaderArgument* destArgs = buffer->dest(); buffer->saveArray(pass->args, pass->perPrimArgCount + pass->perObjArgCount + pass->stableArgCount); + + for(int k = 0; k < pass->perPrimArgCount + pass->perObjArgCount + pass->stableArgCount; ++k) + { + Game::MaterialShaderArgument* arg = &pass->args[k]; + Game::MaterialShaderArgument* destArg = &destArgs[k]; + + if(arg->type == 1 || arg->type == 7) + { + if (builder->hasPointer(arg->u.literalConst)) + { + destArg->u.literalConst = builder->getPointer(arg->u.literalConst); + } + else + { + buffer->align(Utils::Stream::ALIGN_4); + builder->storePointer(arg->u.literalConst); + + buffer->saveArray(arg->u.literalConst, 4); + Utils::Stream::ClearPointer(&destArg->u.literalConst); + } + } + } + Utils::Stream::ClearPointer(&destPass->args); } }