Unique lease on a validated package shader and its independent parameter instance. @ownership Graphics owns the allocation and must outlive this lease; destroy/release leases before backend shutdown. @lifetime No resource pointer escapes. Draw inputs are borrowed only during the call. Reload builds a new lease. @thread Load, update, draw, release and destruction are graphics-thread affine, outside callbacks/reentrancy. 更多...
#include <EvpackShader.h>
类 | |
| struct | Impl |
Public 成员函数 | |
| ~EvpackShader () | |
| Evpack shader. | |
| EvpackShader (const EvpackShader &)=delete | |
| EvpackShader & | operator= (const EvpackShader &)=delete |
| const asset::ShaderAsset & | definition () const noexcept |
| Immutable CPU metadata borrowed until this lease is destroyed. | |
| Result< void > | setParameter (std::string_view name, std::span< const float > values) |
| Set one declared scalar/vector with exact finite component count; failure leaves it unchanged. | |
| Result< void > | drawMesh (graphics::Mesh &mesh, const std::array< float, 16 > &transform, OptionalRef< graphics::Texture > texture, const std::array< float, 4 > &tint) |
| Draw through the owning Graphics in an open 3D frame; all arguments are immediate borrowed inputs. | |
| Result< void > | drawSprite (OptionalRef< graphics::Texture > texture, const std::array< float, 4 > &rect, const std::array< float, 4 > &tint) |
| Draw a sprite in the active canvas; rect is x/y/width/height in pixels. | |
| Result< void > | release () |
| Release explicitly; failure retains the lease for retry. Destruction retries and reports errors. | |
静态 Public 成员函数 | |
| static Result< std::unique_ptr< EvpackShader > > | load (const asset::EvpackResourceReader &reader, const AssetRef &asset, const asset::EvpackCapabilities &capabilities, graphics::Graphics &graphics) |
| Validate then upload; failures preserve all existing instances. Reader is not retained. | |
详细描述
Unique lease on a validated package shader and its independent parameter instance. @ownership Graphics owns the allocation and must outlive this lease; destroy/release leases before backend shutdown. @lifetime No resource pointer escapes. Draw inputs are borrowed only during the call. Reload builds a new lease. @thread Load, update, draw, release and destruction are graphics-thread affine, outside callbacks/reentrancy.
在文件 EvpackShader.h 第 27 行定义.
构造及析构函数说明
◆ ~EvpackShader()
| eve::asset_graphics::EvpackShader::~EvpackShader | ( | ) |
◆ EvpackShader()
|
delete |
成员函数说明
◆ definition()
|
noexcept |
Immutable CPU metadata borrowed until this lease is destroyed.
在文件 EvpackShader.cpp 第 29 行定义.
◆ drawMesh()
| Result< void > eve::asset_graphics::EvpackShader::drawMesh | ( | graphics::Mesh & | mesh, |
| const std::array< float, 16 > & | transform, | ||
| OptionalRef< graphics::Texture > | texture, | ||
| const std::array< float, 4 > & | tint | ||
| ) |
Draw through the owning Graphics in an open 3D frame; all arguments are immediate borrowed inputs.
在文件 EvpackShader.cpp 第 93 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), finite, eve::InvalidArgument, mesh, eve::asset::Mesh3D, eve::StaleHandle, eve::Result< T >::success() , 以及 tint.
◆ drawSprite()
| Result< void > eve::asset_graphics::EvpackShader::drawSprite | ( | OptionalRef< graphics::Texture > | texture, |
| const std::array< float, 4 > & | rect, | ||
| const std::array< float, 4 > & | tint | ||
| ) |
Draw a sprite in the active canvas; rect is x/y/width/height in pixels.
在文件 EvpackShader.cpp 第 108 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), finite, eve::InvalidArgument, eve::asset::Sprite2D, eve::StaleHandle, eve::Result< T >::success() , 以及 tint.
◆ load()
|
static |
Validate then upload; failures preserve all existing instances. Reader is not retained.
在文件 EvpackShader.cpp 第 30 行定义.
引用了 error, eve::Diagnostic::error(), eve::Failed, eve::graphics::Graphics::getBackendName(), eve::asset::EvpackCapabilities::graphics, impl, eve::InvalidArgument, eve::graphics::Shader::kMaxFloats, eve::asset::loadShaderAsset(), eve::asset::Mesh3D, name, eve::graphics::Graphics::newMeshShaderFromSpv(), eve::graphics::Graphics::newShaderFromSpv(), eve::Unsupported , 以及 eve::asset_graphics::validateShaderAssetGpu().
◆ operator=()
|
delete |
◆ release()
| Result< void > eve::asset_graphics::EvpackShader::release | ( | ) |
Release explicitly; failure retains the lease for retry. Destruction retries and reports errors.
在文件 EvpackShader.cpp 第 123 行定义.
引用了 eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure() , 以及 eve::Result< T >::success().
被这些函数引用 ~EvpackShader().
◆ setParameter()
| Result< void > eve::asset_graphics::EvpackShader::setParameter | ( | std::string_view | name, |
| std::span< const float > | values | ||
| ) |
Set one declared scalar/vector with exact finite component count; failure leaves it unchanged.
在文件 EvpackShader.cpp 第 76 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::StaleHandle, eve::Result< T >::success(), value , 以及 values.
该类的文档由以下文件生成:
- src/modules/asset/graphics/EvpackShader.h
- src/modules/asset/graphics/EvpackShader.cpp