Custom GPU program. 更多...
#include <Shader.h>
Public 类型 | |
| enum class | Kind { eSprite2D , eMesh3D } |
| enum | ShaderType { eCompute , eVertex , eFragment , eGeometry , eTessCtrl , eTessEval } |
Public 成员函数 | |
| Shader () | |
| ~Shader () | |
| Shader (const Shader &)=delete | |
| Shader & | operator= (const Shader &)=delete |
| Kind | getKind () const |
| void | setKind (Kind k) |
| void | setXray (bool x) |
| X-ray mesh shader. When true, drawMeshShader renders this mesh a second pass over the already-lit scene with depth test/write disabled and alpha blending, letting occluded (behind-building) silhouettes show through. The shader itself samples G-buffer scene depth to discard visible pixels. | |
| bool | isXray () const |
| int | declareFloat (const std::string &name) |
| Reserve sequential float slots in the push-constant block. Returns start index. | |
| int | declareVec2 (const std::string &name) |
| int | declareVec3 (const std::string &name) |
| int | declareVec4 (const std::string &name) |
| int | declareMatrix (const std::string &name) |
| void | sendFloat (const std::string &name, float x) |
| void | sendVec2 (const std::string &name, float x, float y) |
| void | sendVec3 (const std::string &name, float x, float y, float z) |
| void | sendVec4 (const std::string &name, float x, float y, float z, float w) |
| void | sendMatrix (const std::string &name, const glm::mat4 &m) |
| int | sendToVar (const std::string &name, const void *data, size_t size) |
| Low-level blob write into a declared uniform (size must match declaration). | |
| int | getFromVar (const std::string &name, void *data, size_t size) const |
| bool | hasUniform (const std::string &name) const |
| int | getUniformIndex (const std::string &name) const |
| int | getUniformFloatCount (const std::string &name) const |
| const float * | pushConstantData () const |
| uint32_t | pushConstantSize () const |
| int | usedFloats () const |
| const std::vector< uint32_t > & | vertexSpirv () const |
| const std::vector< uint32_t > & | fragmentSpirv () const |
| void | setSpirv (std::vector< uint32_t > vert, std::vector< uint32_t > frag) |
Public 属性 | |
| void * | gpuHandle = nullptr |
静态 Public 属性 | |
| static constexpr int | kMaxFloats = 32 |
| static constexpr uint32_t | kPushConstantBytes = uint32_t(kMaxFloats * sizeof(float)) |
详细描述
Custom GPU program.
2D sprites (newShader / newShaderFromSpv): Vertex = TexturedVertex; MainTex @ set0 binding0; optional push-constant data[32].
3D meshes (newMeshShader / newMeshShaderFromSpv): Vertex = MeshVertex; Frame UBO @ binding0 + albedo @ binding1 (same as mesh3d); optional push-constant data[32] for style knobs.
Hair/fur cards (newHairShader / newHairShaderFromSpv): Same layout as mesh shaders; pipeline uses alpha blend, no back-face cull, no depth write.
Stylized grass (newGrassShader): Mesh3D layout + CSM shadow bindings. Alpha-tested billboards (depth write on). See graphics/Grass.h.
成员枚举类型说明
◆ Kind
|
strong |
◆ ShaderType
构造及析构函数说明
◆ Shader() [1/2]
|
default |
◆ ~Shader()
|
default |
◆ Shader() [2/2]
|
delete |
成员函数说明
◆ declareFloat()
| int eve::graphics::Shader::declareFloat | ( | const std::string & | name | ) |
Reserve sequential float slots in the push-constant block. Returns start index.
在文件 Shader.cpp 第 30 行定义.
引用了 name.
被这些函数引用 eve::graphics::newWaterfallShader() , 以及 eve::graphics::newWaterShader().
◆ declareMatrix()
| int eve::graphics::Shader::declareMatrix | ( | const std::string & | name | ) |
在文件 Shader.cpp 第 34 行定义.
引用了 name.
◆ declareVec2()
| int eve::graphics::Shader::declareVec2 | ( | const std::string & | name | ) |
在文件 Shader.cpp 第 31 行定义.
引用了 name.
◆ declareVec3()
| int eve::graphics::Shader::declareVec3 | ( | const std::string & | name | ) |
在文件 Shader.cpp 第 32 行定义.
引用了 name.
被这些函数引用 eve::graphics::newWaterfallShader() , 以及 eve::graphics::newWaterShader().
◆ declareVec4()
| int eve::graphics::Shader::declareVec4 | ( | const std::string & | name | ) |
在文件 Shader.cpp 第 33 行定义.
引用了 name.
◆ fragmentSpirv()
|
inline |
◆ getFromVar()
| int eve::graphics::Shader::getFromVar | ( | const std::string & | name, |
| void * | data, | ||
| size_t | size | ||
| ) | const |
在文件 Shader.cpp 第 71 行定义.
被这些函数引用 eve::graphics::AmbientOcclusion::getFloat(), eve::graphics::AntiAliasing::getFloat(), eve::graphics::GlobalIllumination::getFloat(), eve::graphics::Outline::getFloat(), eve::graphics::ScreenSpaceReflection::getFloat(), eve::graphics::Volumetric::getFloat() , 以及 eve::stylize::StylePass::getFloat().
◆ getKind()
◆ getUniformFloatCount()
| int eve::graphics::Shader::getUniformFloatCount | ( | const std::string & | name | ) | const |
在文件 Shader.cpp 第 54 行定义.
◆ getUniformIndex()
| int eve::graphics::Shader::getUniformIndex | ( | const std::string & | name | ) | const |
在文件 Shader.cpp 第 48 行定义.
◆ hasUniform()
| bool eve::graphics::Shader::hasUniform | ( | const std::string & | name | ) | const |
在文件 Shader.cpp 第 46 行定义.
引用了 name.
被这些函数引用 eve::graphics::AmbientOcclusion::applyOverlay(), eve::graphics::Material::bind(), eve::graphics::AmbientOcclusion::getFloat(), eve::graphics::GlobalIllumination::getFloat(), eve::graphics::ScreenSpaceReflection::getFloat(), eve::graphics::Volumetric::getFloat(), eve::graphics::AmbientOcclusion::hasParam(), eve::graphics::AntiAliasing::hasParam(), eve::graphics::GlobalIllumination::hasParam(), eve::graphics::Outline::hasParam(), eve::graphics::ScreenSpaceReflection::hasParam(), eve::graphics::Volumetric::hasParam(), eve::stylize::StylePass::hasParam(), eve::graphics::AmbientOcclusion::setFloat(), eve::graphics::GlobalIllumination::setFloat(), eve::graphics::ScreenSpaceReflection::setFloat(), eve::graphics::Volumetric::setFloat() , 以及 eve::graphics::AmbientOcclusion::setThickness().
◆ isXray()
◆ operator=()
◆ pushConstantData()
◆ pushConstantSize()
◆ sendFloat()
| void eve::graphics::Shader::sendFloat | ( | const std::string & | name, |
| float | x | ||
| ) |
在文件 Shader.cpp 第 82 行定义.
引用了 name, sendToVar() , 以及 x.
被这些函数引用 eve::graphics::GlobalIllumination::applyFromDepth(), eve::graphics::AmbientOcclusion::applyFromGBuffer(), eve::graphics::GlobalIllumination::applyFromScene(), eve::graphics::AmbientOcclusion::applyOverlay(), eve::graphics::GrassField::bake(), eve::graphics::Material::bind(), eve::graphics::Water::bindParams(), eve::graphics::Waterfall::bindParams(), eve::graphics::AmbientOcclusion::blur(), eve::spritestack::SpriteStackBatch::render(), eve::spritestack::SpriteStack3D::render(), eve::graphics::AmbientOcclusion::setCamera(), eve::graphics::GlobalIllumination::setCamera(), eve::graphics::ScreenSpaceReflection::setCamera(), eve::graphics::Volumetric::setCamera(), eve::graphics::Outline::setClip(), eve::graphics::Outline::setColor(), eve::graphics::Volumetric::setDensity(), eve::graphics::Outline::setDepthSensitivity(), eve::graphics::Outline::setDepthThreshold(), eve::graphics::ScreenSpaceReflection::setEnabled(), eve::graphics::AmbientOcclusion::setFloat(), eve::graphics::AntiAliasing::setFloat(), eve::graphics::GlobalIllumination::setFloat(), eve::graphics::Outline::setFloat(), eve::graphics::ScreenSpaceReflection::setFloat(), eve::graphics::Volumetric::setFloat(), eve::stylize::StylePass::setFloat(), eve::graphics::Volumetric::setFogColor(), eve::graphics::Volumetric::setFogEnd(), eve::graphics::Volumetric::setFogHeight(), eve::graphics::Volumetric::setFogHeightFalloff(), eve::graphics::Volumetric::setFogNoise(), eve::graphics::Volumetric::setFogStart(), eve::graphics::AmbientOcclusion::setIntensity(), eve::graphics::Volumetric::setIntensity(), eve::graphics::GlobalIllumination::setLightColor(), eve::graphics::GlobalIllumination::setLightDirection(), eve::graphics::Volumetric::setLightDirection(), eve::graphics::Volumetric::setLightScreenUV(), eve::graphics::Outline::setNormalThreshold(), eve::graphics::Volumetric::setShaftColor(), eve::graphics::Outline::setSoftness(), eve::graphics::AmbientOcclusion::setThickness() , 以及 eve::graphics::Outline::setWidth().
◆ sendMatrix()
| void eve::graphics::Shader::sendMatrix | ( | const std::string & | name, |
| const glm::mat4 & | m | ||
| ) |
◆ sendToVar()
| int eve::graphics::Shader::sendToVar | ( | const std::string & | name, |
| const void * | data, | ||
| size_t | size | ||
| ) |
Low-level blob write into a declared uniform (size must match declaration).
在文件 Shader.cpp 第 60 行定义.
被这些函数引用 sendFloat(), sendMatrix(), sendVec2(), sendVec3() , 以及 sendVec4().
◆ sendVec2()
| void eve::graphics::Shader::sendVec2 | ( | const std::string & | name, |
| float | x, | ||
| float | y | ||
| ) |
在文件 Shader.cpp 第 84 行定义.
引用了 name, sendToVar(), v, x , 以及 y.
◆ sendVec3()
| void eve::graphics::Shader::sendVec3 | ( | const std::string & | name, |
| float | x, | ||
| float | y, | ||
| float | z | ||
| ) |
在文件 Shader.cpp 第 89 行定义.
引用了 name, sendToVar(), v, x, y , 以及 z.
被这些函数引用 eve::graphics::Water::bindParams() , 以及 eve::graphics::Waterfall::bindParams().
◆ sendVec4()
| void eve::graphics::Shader::sendVec4 | ( | const std::string & | name, |
| float | x, | ||
| float | y, | ||
| float | z, | ||
| float | w | ||
| ) |
在文件 Shader.cpp 第 94 行定义.
引用了 name, sendToVar(), v, w, x, y , 以及 z.
被这些函数引用 eve::spritestack::SpriteStackBatch::render() , 以及 eve::spritestack::SpriteStack3D::render().
◆ setKind()
◆ setSpirv()
|
inline |
◆ setXray()
|
inline |
X-ray mesh shader. When true, drawMeshShader renders this mesh a second pass over the already-lit scene with depth test/write disabled and alpha blending, letting occluded (behind-building) silhouettes show through. The shader itself samples G-buffer scene depth to discard visible pixels.
引用了 x.
被这些函数引用 eve::stylize::createMeshShader().
◆ usedFloats()
◆ vertexSpirv()
|
inline |
类成员变量说明
◆ gpuHandle
| void* eve::graphics::Shader::gpuHandle = nullptr |
Backend-private GPU object (vulkan::GpuShader*).
被这些函数引用 eve::stylize::createMeshShader(), eve::stylize::createPostShader(), eve::graphics::grass::createShader() , 以及 eve::graphics::hair::createShader().
◆ kMaxFloats
◆ kPushConstantBytes
|
staticconstexpr |
该类的文档由以下文件生成:
- src/modules/graphics/Shader.h
- src/modules/graphics/Shader.cpp