载入中...
搜索中...
未找到
eve::graphics::webgpu 命名空间参考

类

struct  AdapterDone
 Instance + adapter resolved. 更多...
 
class  BindGroupLayoutBuilder
 Fluent builder for wgpu::BindGroupLayout. 更多...
 
class  Capabilities
 Read-only snapshot of WebGPU adapter/device limits and surface capabilities, queried once after device creation. 更多...
 
struct  DeviceDone
 Instance + adapter + device + queue + capability snapshot. 更多...
 
struct  GpuMesh
 Vertex/index buffers for one mesh. 更多...
 
struct  GpuShader
 A compiled shader: one WebGPU pipeline + layout. Also holds the WGSL sources so custom shaders can be re-pipelined for offscreen targets. 更多...
 
struct  GpuTexture
 Texture resources backed by a wgpu texture + view + sampler + bind groups. 更多...
 
class  Graphics
 EVENGINE_API_BACKENDS public API. 更多...
 
class  InitFlow
 Typed, blocking WebGPU initialization flow. 更多...
 
struct  InstanceDone
 Instance created, no adapter yet. 更多...
 
struct  Mesh3DClusteredUBO
 Clustered-forward mesh UBO (matches the Vulkan Mesh3DClusteredUBO and the WGSL clustered Frame block). 更多...
 
struct  Mesh3DUBO
 Frame UBO for the mesh3d pipeline. Mirrors the std140 layout of the WGSL Frame block and the legacy Vulkan Mesh3DUBO (so custom shader prefixes stay compatible). See wgsl_shaders.h. 更多...
 
struct  MeshVertex
 MeshVertex public API. 更多...
 
class  OffscreenCanvas
 Offscreen render target (RGBA8Unorm color, optional Depth32Float). 2D batches are flushed into the canvas texture by Graphics::flush2DToCanvas. 更多...
 
struct  PbrSpecializedSources
 Owning WGSL stages after unreachable texture operations and declarations are removed. 更多...
 
struct  PbrVariantLimits
 Device resource limits relevant to one extended PBR shader variant. 更多...
 
struct  PbrVariantPlan
 Stable resource-layout key and checked stage counts for a PBR snapshot. 更多...
 
struct  PbrVariantSources
 Reproducibly generated full PBR WGSL sources before resource specialization. 更多...
 
class  PipelineBuilder
 Fluent builder for wgpu::RenderPipeline. 更多...
 
class  SamplerBuilder
 Fluent builder for wgpu::Sampler. 更多...
 
struct  SkinPassUBO
 SkinPassUBO public API. 更多...
 

枚举

enum  PbrFragmentResourceFlag : std::uint32_t {
  PbrEnvironment = 1u << 0 , PbrShadows = 1u << 1 , PbrExtras = 1u << 2 , PbrColors = 1u << 3 ,
  PbrFadeNoise = 1u << 4
}
 PbrFragmentResourceFlag public API. 更多...
 
enum  PbrVertexResourceFlag : std::uint32_t { PbrVertexField = 1u << 0 , PbrMotionField = 1u << 1 , PbrMotionNoise = 1u << 2 }
 PbrVertexResourceFlag public API. 更多...
 

函数

void fillMeshAttributes (WGPUVertexAttribute(&attrs)[6])
 
Result< PbrVariantPlan > planPbrVariant (const PbrSurface &surface, bool environment, bool shadows, const PbrVariantLimits &limits={})
 Plan only resources reachable for an immutable PBR draw snapshot.
 
PbrVariantSources pbrVariantBaseSources ()
 Return immutable full PBR WGSL generated from the canonical GLSL implementation.
 
PbrSpecializedSources specializePbrVariantSources (const PbrVariantPlan &plan)
 Specialize the generated WGSL for the resource reachability encoded by a checked plan.
 
WGPUStringView sv (const char *s)
 Build a WGPUStringView from a C string (null-safe, length auto-computed).
 
WGPUStringView sv (const std::string &s)
 Build a WGPUStringView from a std::string.
 
wgpu::ShaderModule makeWgslModule (wgpu::Device &dev, const char *wgsl)
 Create an owning shader module; retain it until pipeline creation completes.
 

变量

const char * kColorVertWgsl
 
const char * kColorFragWgsl
 
const char * kTexturedVertWgsl
 
const char * kTexturedFragWgsl
 
const char * kCustom2DFragWgsl
 
const char * kLit2DVertWgsl
 
const char * kLit2DFragWgsl
 
const char * kMesh3DVertWgsl
 Immutable shader source. @borrowed Static storage; valid for the process lifetime.
 
const char * kMesh3DFragWgsl
 
const char * kMesh3DClusteredVertWgsl
 
const char * kMesh3DClusteredFragWgsl
 
const char * kMesh3DShadowVertWgsl
 Immutable shader source. @borrowed Static storage; valid for the process lifetime.
 
const char * kMesh3DShadowAlphaVertWgsl
 Immutable shader source. @borrowed Static storage; valid for the process lifetime.
 
const char * kMesh3DShadowAlphaFragWgsl
 
const char * kMesh3DGbufferVertWgsl
 Immutable shader source. @borrowed Static storage; valid for the process lifetime.
 
const char * kMesh3DGbufferFragWgsl
 Immutable GBuffer fill WGSL. @borrowed Static storage; valid for the process lifetime.
 
const char * kMesh3DGbufferAlphaFragWgsl
 Immutable GBuffer alpha-cutout WGSL. @borrowed Static storage; valid for the process lifetime.
 
const char * kDecalVertWgsl
 
const char * kDecalFragWgsl
 
const char * kSSAOFragWgsl
 
const char * kVoxelRectVertWgsl
 
const char * kVoxelRectFragWgsl
 
const char * kDeferredLightingVertWgsl
 Immutable deferred-lighting vertex WGSL. @borrowed Static storage; valid for the process lifetime.
 
const char * kDeferredLightingFragWgsl
 Immutable clustered deferred lighting fragment WGSL (core metallic-roughness PBR + CSM + clustered points; mirrors Vulkan deferred_lighting.frag). @borrowed Static storage; valid for the process lifetime.
 

枚举类型说明

◆ PbrFragmentResourceFlag

PbrFragmentResourceFlag public API.

枚举值
PbrEnvironment 
PbrShadows 
PbrExtras 
PbrColors 
PbrFadeNoise 

在文件 PbrVariantPlan.h 第 13 行定义.

◆ PbrVertexResourceFlag

PbrVertexResourceFlag public API.

枚举值
PbrVertexField 
PbrMotionField 
PbrMotionNoise 

在文件 PbrVariantPlan.h 第 22 行定义.

函数说明

◆ fillMeshAttributes()

void eve::graphics::webgpu::fillMeshAttributes ( WGPUVertexAttribute(&)  attrs[6])

在文件 Graphics.cpp 第 2766 行定义.

◆ makeWgslModule()

wgpu::ShaderModule eve::graphics::webgpu::makeWgslModule ( wgpu::Device &  dev,
const char *  wgsl 
)
inline

Create an owning shader module; retain it until pipeline creation completes.

参数
devBorrowed device used synchronously.
wgslBorrowed source; no pointer is retained after this call.
返回
Reference-counted shader module. Device error callbacks report validation errors.

在文件 wgpu_types.h 第 34 行定义.

引用了 desc.

◆ pbrVariantBaseSources()

PbrVariantSources eve::graphics::webgpu::pbrVariantBaseSources ( )

Return immutable full PBR WGSL generated from the canonical GLSL implementation.

返回
Process-lifetime views; callers must specialize resource declarations before pipeline creation. @thread Worker-safe and reentrant.

在文件 PbrVariantSource.cpp 第 104 行定义.

被这些函数引用 eve::graphics::webgpu::Graphics::debugValidatePbrVariantBaseSources() , 以及 specializePbrVariantSources().

◆ planPbrVariant()

Result< PbrVariantPlan > eve::graphics::webgpu::planPbrVariant ( const PbrSurface &  surface,
bool  environment,
bool  shadows,
const PbrVariantLimits &  limits = {} 
)

Plan only resources reachable for an immutable PBR draw snapshot.

参数
surfaceValidated material snapshot; texture pointers are inspected for presence only.
environmentTrue when the draw samples an environment cube.
shadowsTrue when the draw samples the shadow array.
limitsCaptured WebGPU per-stage device limits.
返回
A stable variant plan, or a structured Unsupported diagnostic before GPU mutation. @thread Worker-safe and reentrant; no texture pointer is dereferenced.

在文件 PbrVariantPlan.cpp 第 25 行定义.

引用了 eve::graphics::webgpu::PbrVariantPlan::canonicalSamplerRepresentatives, eve::graphics::webgpu::PbrVariantPlan::canonicalTextureMask, eve::graphics::Count, eve::graphics::webgpu::PbrVariantPlan::detailSamplerRepresentatives, eve::graphics::webgpu::PbrVariantPlan::detailTextureMask, eve::graphics::PbrVegetationAlpha::enabled, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::graphics::webgpu::PbrVariantPlan::fragmentFlags, eve::graphics::webgpu::PbrVariantPlan::fragmentSamplers, eve::graphics::webgpu::PbrVariantPlan::fragmentTextures, eve::graphics::GpuFields, limits, eve::graphics::PbrVegetationMotion::mode, eve::graphics::PbrVegetationMotion::noise, eve::graphics::PbrVegetationAlpha::noise, eve::graphics::Object, PbrColors, PbrEnvironment, PbrExtras, PbrFadeNoise, PbrMotionField, PbrMotionNoise, PbrShadows, PbrVertexField, resource, eve::graphics::PbrVegetationVertex::source, eve::Result< T >::success(), eve::graphics::PbrVegetationExtras::texture, eve::graphics::PbrVegetationColors::texture, eve::graphics::PbrVegetationVertex::texture, eve::graphics::PbrVegetationMotion::texture, eve::graphics::PbrVegetationDetail::textures, eve::graphics::PbrSurface::textures, u, eve::Unsupported, valid, eve::graphics::validatePbrSurface(), eve::graphics::PbrVegetationDetail::value, eve::graphics::PbrSurface::vegetationAlpha, eve::graphics::PbrSurface::vegetationColors, eve::graphics::PbrSurface::vegetationDetail, eve::graphics::PbrSurface::vegetationExtras, eve::graphics::PbrSurface::vegetationMotion, eve::graphics::PbrSurface::vegetationVertex, eve::graphics::webgpu::PbrVariantPlan::vertexFlags, eve::graphics::webgpu::PbrVariantPlan::vertexSamplers , 以及 eve::graphics::webgpu::PbrVariantPlan::vertexTextures.

被这些函数引用 eve::graphics::webgpu::Graphics::setMesh3DPbrSurface().

◆ specializePbrVariantSources()

PbrSpecializedSources eve::graphics::webgpu::specializePbrVariantSources ( const PbrVariantPlan &  plan)

◆ sv() [1/2]

◆ sv() [2/2]

WGPUStringView eve::graphics::webgpu::sv ( const std::string &  s)
inline

Build a WGPUStringView from a std::string.

在文件 wgpu_types.h 第 25 行定义.

引用了 s.

变量说明

◆ kColorFragWgsl

const char* eve::graphics::webgpu::kColorFragWgsl
inline
初始值:
= R"wgsl(
struct FSIn {
@location(0) color: vec4f,
};
@fragment
fn fs_main(in: FSIn) -> @location(0) vec4f {
return in.color;
}
)wgsl"

在文件 wgsl_shaders.h 第 32 行定义.

◆ kColorVertWgsl

const char* eve::graphics::webgpu::kColorVertWgsl
inline
初始值:
= R"wgsl(
struct VSIn {
@location(0) pos: vec2f,
@location(1) color: vec4f,
};
struct VSOut {
@builtin(position) pos: vec4f,
@location(0) color: vec4f,
};
@vertex
fn vs_main(in: VSIn) -> VSOut {
var out: VSOut;
out.pos = vec4f(in.pos, 0.0, 1.0);
out.color = in.color;
return out;
}
)wgsl"

在文件 wgsl_shaders.h 第 11 行定义.

◆ kCustom2DFragWgsl

const char* eve::graphics::webgpu::kCustom2DFragWgsl
inline
初始值:
= R"wgsl(
struct FSIn {
@location(0) color: vec4f,
@location(1) uv: vec2f,
};
struct Externals {
data: array<f32, 32>,
};
@group(0) @binding(0) var mainTex: texture_2d<f32>;
@group(0) @binding(2) var mainSamp: sampler;
@group(0) @binding(4) var<uniform> u: Externals;
@fragment
fn fs_main(in: FSIn) -> @location(0) vec4f {
return textureSample(mainTex, mainSamp, in.uv) * in.color;
}
)wgsl"

在文件 wgsl_shaders.h 第 86 行定义.

◆ kDecalFragWgsl

const char* eve::graphics::webgpu::kDecalFragWgsl
inline

在文件 wgsl_shaders.h 第 1733 行定义.

◆ kDecalVertWgsl

const char* eve::graphics::webgpu::kDecalVertWgsl
inline
初始值:
= R"wgsl(
@vertex
fn vs_main(@builtin(vertex_index) vertexIndex: u32) -> @builtin(position) vec4f {
let positions = array<vec2f, 3>(
vec2f(-1.0, -1.0), vec2f(3.0, -1.0), vec2f(-1.0, 3.0));
return vec4f(positions[vertexIndex], 0.0, 1.0);
}
)wgsl"

在文件 wgsl_shaders.h 第 1721 行定义.

◆ kDeferredLightingFragWgsl

const char* eve::graphics::webgpu::kDeferredLightingFragWgsl
inline

Immutable clustered deferred lighting fragment WGSL (core metallic-roughness PBR + CSM + clustered points; mirrors Vulkan deferred_lighting.frag). @borrowed Static storage; valid for the process lifetime.

在文件 wgsl_shaders.h 第 2175 行定义.

◆ kDeferredLightingVertWgsl

const char* eve::graphics::webgpu::kDeferredLightingVertWgsl
inline
初始值:
= R"wgsl(
struct VSOut {
@builtin(position) pos: vec4f,
};
@vertex
fn vs_main(@builtin(vertex_index) vid: u32) -> VSOut {
// Fullscreen triangle in WebGPU NDC (Y-up).
var p = vec2f(f32((vid << 1u) & 2u), f32(vid & 2u));
var out: VSOut;
out.pos = vec4f(p * 2.0 - 1.0, 0.0, 1.0);
return out;
}
)wgsl"

Immutable deferred-lighting vertex WGSL. @borrowed Static storage; valid for the process lifetime.

在文件 wgsl_shaders.h 第 2154 行定义.

◆ kLit2DFragWgsl

const char* eve::graphics::webgpu::kLit2DFragWgsl
inline

在文件 wgsl_shaders.h 第 134 行定义.

◆ kLit2DVertWgsl

const char* eve::graphics::webgpu::kLit2DVertWgsl
inline
初始值:
= R"wgsl(
struct VSIn {
@location(0) pos: vec2f,
@location(1) color: vec4f,
@location(2) uv: vec2f,
};
struct VSOut {
@builtin(position) pos: vec4f,
@location(0) color: vec4f,
@location(1) uv: vec2f,
@location(2) ndc: vec2f,
};
@vertex
fn vs_main(in: VSIn) -> VSOut {
var out: VSOut;
out.pos = vec4f(in.pos, 0.0, 1.0);
out.color = in.color;
out.uv = in.uv;
out.ndc = in.pos;
return out;
}
)wgsl"

在文件 wgsl_shaders.h 第 108 行定义.

◆ kMesh3DClusteredFragWgsl

const char* eve::graphics::webgpu::kMesh3DClusteredFragWgsl
inline

在文件 wgsl_shaders.h 第 1035 行定义.

◆ kMesh3DClusteredVertWgsl

const char* eve::graphics::webgpu::kMesh3DClusteredVertWgsl
inline

在文件 wgsl_shaders.h 第 959 行定义.

◆ kMesh3DFragWgsl

const char* eve::graphics::webgpu::kMesh3DFragWgsl
inline

在文件 wgsl_shaders.h 第 363 行定义.

被这些函数引用 eve::graphics::webgpu::Graphics::newMeshShaderFromWgsl().

◆ kMesh3DGbufferAlphaFragWgsl

const char* eve::graphics::webgpu::kMesh3DGbufferAlphaFragWgsl
inline

Immutable GBuffer alpha-cutout WGSL. @borrowed Static storage; valid for the process lifetime.

在文件 wgsl_shaders.h 第 1665 行定义.

◆ kMesh3DGbufferFragWgsl

const char* eve::graphics::webgpu::kMesh3DGbufferFragWgsl
inline

Immutable GBuffer fill WGSL. @borrowed Static storage; valid for the process lifetime.

在文件 wgsl_shaders.h 第 1609 行定义.

◆ kMesh3DGbufferVertWgsl

const char* eve::graphics::webgpu::kMesh3DGbufferVertWgsl
inline

Immutable shader source. @borrowed Static storage; valid for the process lifetime.

在文件 wgsl_shaders.h 第 1537 行定义.

◆ kMesh3DShadowAlphaFragWgsl

const char* eve::graphics::webgpu::kMesh3DShadowAlphaFragWgsl
inline
初始值:
= R"wgsl(
struct Push {
mvp: mat4x4f,
model: mat4x4f,
lodFade: vec4f,
skinInfo: vec4f,
};
@group(0) @binding(0) var<uniform> pc: Push;
@group(0) @binding(1) var albedoTexture: texture_2d<f32>;
@group(0) @binding(2) var albedoSampler: sampler;
@fragment
fn fs_main(@location(0) uv: vec2f, @builtin(position) fragCoord: vec4f) {
if (textureSample(albedoTexture, albedoSampler, uv).a < 0.05) { discard; }
if (pc.lodFade.z > 0.5) {
let h = fract(dot(floor(fragCoord.xy), vec2f(0.06711056, 0.00583715)));
let rejected = select((h < 1.0 - pc.lodFade.x), (h >= pc.lodFade.x),
pc.lodFade.y < 0.5);
if (rejected) { discard; }
}
}
)wgsl"

在文件 wgsl_shaders.h 第 1511 行定义.

◆ kMesh3DShadowAlphaVertWgsl

const char* eve::graphics::webgpu::kMesh3DShadowAlphaVertWgsl
inline

Immutable shader source. @borrowed Static storage; valid for the process lifetime.

在文件 wgsl_shaders.h 第 1463 行定义.

◆ kMesh3DShadowVertWgsl

const char* eve::graphics::webgpu::kMesh3DShadowVertWgsl
inline

Immutable shader source. @borrowed Static storage; valid for the process lifetime.

在文件 wgsl_shaders.h 第 1420 行定义.

◆ kMesh3DVertWgsl

const char* eve::graphics::webgpu::kMesh3DVertWgsl
inline

Immutable shader source. @borrowed Static storage; valid for the process lifetime.

在文件 wgsl_shaders.h 第 250 行定义.

被这些函数引用 eve::graphics::webgpu::Graphics::newHairShaderFromWgsl() , 以及 eve::graphics::webgpu::Graphics::newMeshShaderFromWgsl().

◆ kSSAOFragWgsl

const char* eve::graphics::webgpu::kSSAOFragWgsl
inline

在文件 wgsl_shaders.h 第 1986 行定义.

◆ kTexturedFragWgsl

const char* eve::graphics::webgpu::kTexturedFragWgsl
inline
初始值:
= R"wgsl(
struct FSIn {
@location(0) color: vec4f,
@location(1) uv: vec2f,
};
@group(0) @binding(0) var mainTex: texture_2d<f32>;
@group(0) @binding(2) var mainSamp: sampler;
@fragment
fn fs_main(in: FSIn) -> @location(0) vec4f {
return textureSample(mainTex, mainSamp, in.uv) * in.color;
}
)wgsl"

在文件 wgsl_shaders.h 第 69 行定义.

◆ kTexturedVertWgsl

const char* eve::graphics::webgpu::kTexturedVertWgsl
inline
初始值:
= R"wgsl(
struct VSIn {
@location(0) pos: vec2f,
@location(1) color: vec4f,
@location(2) uv: vec2f,
};
struct VSOut {
@builtin(position) pos: vec4f,
@location(0) color: vec4f,
@location(1) uv: vec2f,
};
@vertex
fn vs_main(in: VSIn) -> VSOut {
var out: VSOut;
out.pos = vec4f(in.pos, 0.0, 1.0);
out.color = in.color;
out.uv = in.uv;
return out;
}
)wgsl"

在文件 wgsl_shaders.h 第 45 行定义.

被这些函数引用 eve::graphics::webgpu::Graphics::newShaderFromWgsl().

◆ kVoxelRectFragWgsl

const char* eve::graphics::webgpu::kVoxelRectFragWgsl
inline
初始值:
= R"wgsl(
struct FSIn {
@location(0) uv: vec2f,
@location(1) tint: vec4f,
@location(2) vAO: f32,
@location(3) @interpolate(flat) atlasBase: vec2f,
@location(4) @interpolate(flat) tileScale: f32,
};
@group(0) @binding(1) var atlas: texture_2d<f32>;
@group(0) @binding(2) var atlasSamp: sampler;
@fragment
fn fs_main(in: FSIn) -> @location(0) vec4f {
// Vertex ambient occlusion (0..1): darkens corners near other voxels.
let aoShade = 0.35 + 0.65 * in.vAO;
let atlasUV = (in.atlasBase + fract(in.uv)) * in.tileScale;
let dx = dpdx(in.uv) * in.tileScale;
let dy = dpdy(in.uv) * in.tileScale;
return textureSampleGrad(atlas, atlasSamp, atlasUV, dx, dy) * in.tint * aoShade;
}
)wgsl"

在文件 wgsl_shaders.h 第 2128 行定义.

◆ kVoxelRectVertWgsl

const char* eve::graphics::webgpu::kVoxelRectVertWgsl
inline

在文件 wgsl_shaders.h 第 2059 行定义.