You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
2.2 KiB
C++
62 lines
2.2 KiB
C++
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project.
|
|
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
|
|
#include <Code/src/TressFX/TressFXCommon.h>
|
|
|
|
#include <Rendering/HairDispatchItem.h>
|
|
#include <Rendering/HairRenderObject.h>
|
|
#include <Passes/HairSkinningComputePass.h>
|
|
|
|
#include <Atom/RPI.Public/Shader/ShaderResourceGroup.h>
|
|
#include <Atom/RPI.Public/Shader/Shader.h>
|
|
#include <Atom/RPI.Public/Buffer/Buffer.h>
|
|
|
|
#include <Atom/RHI/Factory.h>
|
|
#include <Atom/RHI/BufferView.h>
|
|
|
|
#include <limits>
|
|
|
|
namespace AZ
|
|
{
|
|
namespace Render
|
|
{
|
|
namespace Hair
|
|
{
|
|
|
|
HairDispatchItem::~HairDispatchItem()
|
|
{
|
|
}
|
|
|
|
// Reference in the code above that tackles handling of the different dispatches possible
|
|
// This one is targeting the per vertex dispatches for now.
|
|
void HairDispatchItem::InitSkinningDispatch(
|
|
RPI::Shader* shader,
|
|
RPI::ShaderResourceGroup* hairGenerationSrg,
|
|
RPI::ShaderResourceGroup* hairSimSrg,
|
|
uint32_t elementsAmount )
|
|
{
|
|
m_shader = shader;
|
|
RHI::DispatchDirect dispatchArgs(
|
|
elementsAmount, 1, 1,
|
|
TRESSFX_SIM_THREAD_GROUP_SIZE, 1, 1
|
|
);
|
|
m_dispatchItem.m_arguments = dispatchArgs;
|
|
RHI::PipelineStateDescriptorForDispatch pipelineDesc;
|
|
m_shader->GetVariant(RPI::ShaderAsset::RootShaderVariantStableId).ConfigurePipelineState(pipelineDesc);
|
|
m_dispatchItem.m_pipelineState = m_shader->AcquirePipelineState(pipelineDesc);
|
|
m_dispatchItem.m_shaderResourceGroupCount = 2; // the per pass will be added by each pass.
|
|
m_dispatchItem.m_shaderResourceGroups = {
|
|
hairGenerationSrg->GetRHIShaderResourceGroup(), // Static generation data
|
|
hairSimSrg->GetRHIShaderResourceGroup() // Dynamic data changed between passes
|
|
};
|
|
}
|
|
|
|
} // namespace Hair
|
|
} // namespace Render
|
|
} // namespace AZ
|