载入中...
搜索中...
未找到
GraphicsShaders.cpp
浏览该文件的文档.
71 device.PopErrorScope(wgpu::CallbackMode::AllowProcessEvents, [&](wgpu::PopErrorScopeStatus result,
96wgpu::RenderPipeline buildPipelineFromWgsl(wgpu::Device& dev, wgpu::PipelineLayout layout, WGPUTextureFormat format,
146 vertexModule = dev.CreateShaderModule(reinterpret_cast<const wgpu::ShaderModuleDescriptor*>(&md));
152 vertexModule = dev.CreateShaderModule(reinterpret_cast<const wgpu::ShaderModuleDescriptor*>(&md));
162 fragmentModule = dev.CreateShaderModule(reinterpret_cast<const wgpu::ShaderModuleDescriptor*>(&md));
198Shader* Graphics::newShaderFromSpv(const std::vector<uint32_t>& vertSpv, const std::vector<uint32_t>& fragSpv) {
209Shader* Graphics::newShaderFromSpvFile(const std::string& vertPath, const std::string& fragPath) {
243Shader* Graphics::newMeshShaderFromSpv(const std::vector<uint32_t>& vertSpv, const std::vector<uint32_t>& fragSpv) {
251Shader* Graphics::newMeshShaderFromWgsl(const std::string& vertWgsl, const std::string& fragWgsl) {
263 gpu->mesh3dPipeline = buildPipelineFromWgsl(device, mesh3dPipelineLayout, sceneColorFormat, vert, frag,
269 throw Exception("newMeshShaderFromWgsl: %s", error.empty() ? "pipeline allocation failed" : error.c_str());
273 gpu->mesh3dXrayPipeline = buildPipelineFromWgsl(device, mesh3dPipelineLayout, sceneColorFormat, vert, frag,
291eve::Result<void> Graphics::configureMeshShaderSurface(Shader& shader, BlendMode blend, bool depthWrite,
297 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "Expected an owned WebGPU mesh shader"));
344 throw Exception("newShaderFromWgsl: %s", error.empty() ? "pipeline allocation failed" : error.c_str());
351 buildPipelineFromWgsl(device, tex2DPipelineLayout, WGPUTextureFormat(surfaceFormat), vert, fragWgsl, false,
354 buildPipelineFromWgsl(device, tex2DPipelineLayout, WGPUTextureFormat_RGBA8Unorm, vert, fragWgsl, false,
356 gpu->hdrOffscreenPipeline = createPipelineForShader(gpu.get(), wgpu::TextureFormat::RGBA16Float, false, false,
359 buildPipelineFromWgsl(device, tex2DPipelineLayout, WGPUTextureFormat_RGBA16Float, vert, fragWgsl, false,
362 if (!error.empty() || !gpu->offscreenPipeline || !gpu->swapchainOpaquePipeline || !gpu->offscreenOpaquePipeline ||
376wgpu::RenderPipeline Graphics::createPipelineForShader(GpuShader* gs, wgpu::TextureFormat format, bool depth,
384 return buildPipelineFromWgsl(device, layout, WGPUTextureFormat(format), gs->wgslVert, gs->wgslFrag, depth, blend,
388Shader* Graphics::newHairShaderFromSpv(const std::vector<uint32_t>& vertSpv, const std::vector<uint32_t>& fragSpv) {
396Shader* Graphics::newHairShaderFromWgsl(const std::string& vertWgsl, const std::string& fragWgsl) {
406 buildPipelineFromWgsl(device, mesh3dPipelineLayout, sceneColorFormat, gpu->wgslVert, gpu->wgslFrag, true,
Local-probe upload record kept off the high-fanout IGraphics3D header.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
@ eMesh3D
@ eSprite2D
Shader * newMeshShader(const std::string &vertGlsl, const std::string &fragGlsl) override
Creates a mesh shader. @ownership Caller deletes unless documented otherwise.
Definition GraphicsShaders.cpp:316
Shader * newShaderFromSpvFile(const std::string &vertPath, const std::string &fragPath) override
Creates a shader from spv file. @ownership Caller deletes unless documented otherwise.
Definition GraphicsShaders.cpp:209
Shader * newMeshShaderFromWgsl(const std::string &vertWgsl, const std::string &fragWgsl) override
Creates a mesh shader from wgsl. @ownership Caller deletes unless documented otherwise.
Definition GraphicsShaders.cpp:251
Shader * newHairShaderFromWgsl(const std::string &vertWgsl, const std::string &fragWgsl) override
Creates a hair shader from wgsl. @ownership Caller deletes unless documented otherwise.
Definition GraphicsShaders.cpp:396
Shader * newMeshShaderFromSpv(const std::vector< uint32_t > &vertSpv, const std::vector< uint32_t > &fragSpv) override
Creates a mesh shader from spv. @ownership Caller deletes unless documented otherwise.
Definition GraphicsShaders.cpp:243
Shader * newHairShaderFromSpv(const std::vector< uint32_t > &vertSpv, const std::vector< uint32_t > &fragSpv) override
Creates a hair shader from spv. @ownership Caller deletes unless documented otherwise.
Definition GraphicsShaders.cpp:388
Shader * newShaderFromSpv(const std::vector< uint32_t > &vertSpv, const std::vector< uint32_t > &fragSpv) override
Creates a shader from spv. @ownership Caller deletes unless documented otherwise.
Definition GraphicsShaders.cpp:198
eve::Result< void > configureMeshShaderSurface(Shader &shader, BlendMode blend, bool depthWrite, bool doubleSided) override
Configure mesh shader surface.
Definition GraphicsShaders.cpp:291
Shader * newShader(const std::string &vertGlsl, const std::string &fragGlsl) override
Creates a shader. @ownership Caller deletes unless documented otherwise.
Definition GraphicsShaders.cpp:235
Shader * newShaderFromWgsl(const std::string &vertWgsl, const std::string &fragWgsl) override
Creates a shader from wgsl. @ownership Caller deletes unless documented otherwise.
Definition GraphicsShaders.cpp:324
void fillMeshAttributes(WGPUVertexAttribute(&attrs)[6])
Internal WebGPU pipeline/descriptor helper; render-thread only.
Definition GraphicsPipelineSupport.cpp:94
WGPUBlendState alphaBlend()
Internal WebGPU pipeline/descriptor helper; render-thread only.
Definition GraphicsPipelineSupport.cpp:35
WGPUShaderModuleDescriptor mdDesc(const std::string &code)
Internal WebGPU pipeline/descriptor helper; render-thread only.
Definition GraphicsPipelineSupport.cpp:18
WGPUStringView sv(const char *s)
Build a WGPUStringView from a C string (null-safe, length auto-computed).
Definition wgpu_types.h:20
const char * kMesh3DVertWgsl
Immutable shader source. @borrowed Static storage; valid for the process lifetime.
Definition wgsl_shaders.h:250
std::vector< int64_t > attrs(const Node &n, const char *key, std::vector< int64_t > fallback)
Attrs.
Definition OnnxInternal.h:143
@ InvalidArgument
@ Failed
@ Alpha
A compiled shader: one WebGPU pipeline + layout. Also holds the WGSL sources so custom shaders can be...
Definition Graphics.h:177