diff --git a/DEPS b/DEPS index 2f618b7c7c..f50ba597e8 100644 --- a/DEPS +++ b/DEPS @@ -90,7 +90,7 @@ deps = { # WGSL support 'third_party/tint': { - 'url': '{dawn_git}/tint@d3f75ca0e8be76c9e3c272d71310fa725cdc756a', + 'url': '{dawn_git}/tint@90ee6c436017621831ec94acaa4091dd67aac2b4', 'condition': 'dawn_standalone', }, diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp index 44db1cd8e8..6004ff75ae 100644 --- a/src/dawn_native/ShaderModule.cpp +++ b/src/dawn_native/ShaderModule.cpp @@ -47,77 +47,77 @@ namespace dawn_native { } #ifdef DAWN_ENABLE_WGSL - tint::ast::transform::VertexFormat ToTintVertexFormat(wgpu::VertexFormat format) { + tint::transform::VertexFormat ToTintVertexFormat(wgpu::VertexFormat format) { switch (format) { case wgpu::VertexFormat::UChar2: - return tint::ast::transform::VertexFormat::kVec2U8; + return tint::transform::VertexFormat::kVec2U8; case wgpu::VertexFormat::UChar4: - return tint::ast::transform::VertexFormat::kVec4U8; + return tint::transform::VertexFormat::kVec4U8; case wgpu::VertexFormat::Char2: - return tint::ast::transform::VertexFormat::kVec2I8; + return tint::transform::VertexFormat::kVec2I8; case wgpu::VertexFormat::Char4: - return tint::ast::transform::VertexFormat::kVec4I8; + return tint::transform::VertexFormat::kVec4I8; case wgpu::VertexFormat::UChar2Norm: - return tint::ast::transform::VertexFormat::kVec2U8Norm; + return tint::transform::VertexFormat::kVec2U8Norm; case wgpu::VertexFormat::UChar4Norm: - return tint::ast::transform::VertexFormat::kVec4U8Norm; + return tint::transform::VertexFormat::kVec4U8Norm; case wgpu::VertexFormat::Char2Norm: - return tint::ast::transform::VertexFormat::kVec2I8Norm; + return tint::transform::VertexFormat::kVec2I8Norm; case wgpu::VertexFormat::Char4Norm: - return tint::ast::transform::VertexFormat::kVec4I8Norm; + return tint::transform::VertexFormat::kVec4I8Norm; case wgpu::VertexFormat::UShort2: - return tint::ast::transform::VertexFormat::kVec2U16; + return tint::transform::VertexFormat::kVec2U16; case wgpu::VertexFormat::UShort4: - return tint::ast::transform::VertexFormat::kVec4U16; + return tint::transform::VertexFormat::kVec4U16; case wgpu::VertexFormat::Short2: - return tint::ast::transform::VertexFormat::kVec2I16; + return tint::transform::VertexFormat::kVec2I16; case wgpu::VertexFormat::Short4: - return tint::ast::transform::VertexFormat::kVec4I16; + return tint::transform::VertexFormat::kVec4I16; case wgpu::VertexFormat::UShort2Norm: - return tint::ast::transform::VertexFormat::kVec2U16Norm; + return tint::transform::VertexFormat::kVec2U16Norm; case wgpu::VertexFormat::UShort4Norm: - return tint::ast::transform::VertexFormat::kVec4U16Norm; + return tint::transform::VertexFormat::kVec4U16Norm; case wgpu::VertexFormat::Short2Norm: - return tint::ast::transform::VertexFormat::kVec2I16Norm; + return tint::transform::VertexFormat::kVec2I16Norm; case wgpu::VertexFormat::Short4Norm: - return tint::ast::transform::VertexFormat::kVec4I16Norm; + return tint::transform::VertexFormat::kVec4I16Norm; case wgpu::VertexFormat::Half2: - return tint::ast::transform::VertexFormat::kVec2F16; + return tint::transform::VertexFormat::kVec2F16; case wgpu::VertexFormat::Half4: - return tint::ast::transform::VertexFormat::kVec4F16; + return tint::transform::VertexFormat::kVec4F16; case wgpu::VertexFormat::Float: - return tint::ast::transform::VertexFormat::kF32; + return tint::transform::VertexFormat::kF32; case wgpu::VertexFormat::Float2: - return tint::ast::transform::VertexFormat::kVec2F32; + return tint::transform::VertexFormat::kVec2F32; case wgpu::VertexFormat::Float3: - return tint::ast::transform::VertexFormat::kVec3F32; + return tint::transform::VertexFormat::kVec3F32; case wgpu::VertexFormat::Float4: - return tint::ast::transform::VertexFormat::kVec4F32; + return tint::transform::VertexFormat::kVec4F32; case wgpu::VertexFormat::UInt: - return tint::ast::transform::VertexFormat::kU32; + return tint::transform::VertexFormat::kU32; case wgpu::VertexFormat::UInt2: - return tint::ast::transform::VertexFormat::kVec2U32; + return tint::transform::VertexFormat::kVec2U32; case wgpu::VertexFormat::UInt3: - return tint::ast::transform::VertexFormat::kVec3U32; + return tint::transform::VertexFormat::kVec3U32; case wgpu::VertexFormat::UInt4: - return tint::ast::transform::VertexFormat::kVec4U32; + return tint::transform::VertexFormat::kVec4U32; case wgpu::VertexFormat::Int: - return tint::ast::transform::VertexFormat::kI32; + return tint::transform::VertexFormat::kI32; case wgpu::VertexFormat::Int2: - return tint::ast::transform::VertexFormat::kVec2I32; + return tint::transform::VertexFormat::kVec2I32; case wgpu::VertexFormat::Int3: - return tint::ast::transform::VertexFormat::kVec3I32; + return tint::transform::VertexFormat::kVec3I32; case wgpu::VertexFormat::Int4: - return tint::ast::transform::VertexFormat::kVec4I32; + return tint::transform::VertexFormat::kVec4I32; } } - tint::ast::transform::InputStepMode ToTintInputStepMode(wgpu::InputStepMode mode) { + tint::transform::InputStepMode ToTintInputStepMode(wgpu::InputStepMode mode) { switch (mode) { case wgpu::InputStepMode::Vertex: - return tint::ast::transform::InputStepMode::kVertex; + return tint::transform::InputStepMode::kVertex; case wgpu::InputStepMode::Instance: - return tint::ast::transform::InputStepMode::kInstance; + return tint::transform::InputStepMode::kInstance; } } #endif @@ -252,17 +252,17 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); } - tint::ast::transform::VertexPullingTransform transform(&context, &module); - auto state = std::make_unique(); + tint::transform::VertexPullingTransform transform(&context, &module); + auto state = std::make_unique(); for (uint32_t i = 0; i < vertexState.vertexBufferCount; ++i) { auto& vertexBuffer = vertexState.vertexBuffers[i]; - tint::ast::transform::VertexBufferLayoutDescriptor layout; + tint::transform::VertexBufferLayoutDescriptor layout; layout.array_stride = vertexBuffer.arrayStride; layout.step_mode = ToTintInputStepMode(vertexBuffer.stepMode); for (uint32_t j = 0; j < vertexBuffer.attributeCount; ++j) { auto& attribute = vertexBuffer.attributes[j]; - tint::ast::transform::VertexAttributeDescriptor attr; + tint::transform::VertexAttributeDescriptor attr; attr.format = ToTintVertexFormat(attribute.format); attr.offset = attribute.offset; attr.shader_location = attribute.shaderLocation; @@ -277,7 +277,7 @@ namespace dawn_native { transform.SetPullingBufferBindingSet(pullingBufferBindingSet); if (!transform.Run()) { - errorStream << "Vertex pulling transform: " << transform.GetError(); + errorStream << "Vertex pulling transform: " << transform.error(); return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); } diff --git a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp index f7ac1f5dab..6b55fa2161 100644 --- a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp +++ b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp @@ -596,19 +596,19 @@ TEST_F(RenderPipelineValidationTest, EntryPointNameValidation) { DAWN_SKIP_TEST_IF(!HasWGSL()); wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"( - [[builtin position]] var position : vec4; + [[builtin(position)]] var position : vec4; + [[stage(vertex)]] fn vertex_main() -> void { position = vec4(0.0, 0.0, 0.0, 1.0); return; } - entry_point vertex = vertex_main; - [[location 0]] var color : vec4; + [[location(0)]] var color : vec4; + [[stage(fragment)]] fn fragment_main() -> void { color = vec4(1.0, 0.0, 0.0, 1.0); return; } - entry_point fragment = fragment_main; )"); utils::ComboRenderPipelineDescriptor descriptor(device); @@ -650,21 +650,20 @@ TEST_F(RenderPipelineValidationTest, VertexAttribCorrectEntryPoint) { DAWN_SKIP_TEST_IF(!HasWGSL()); wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"( - [[builtin position]] var position : vec4; - [[location 0]] var attrib0 : vec4; - [[location 1]] var attrib1 : vec4; + [[builtin(position)]] var position : vec4; + [[location(0)]] var attrib0 : vec4; + [[location(1)]] var attrib1 : vec4; + [[stage(vertex)]] fn vertex0() -> void { position = attrib0; return; } + [[stage(vertex)]] fn vertex1() -> void { position = attrib1; return; } - - entry_point vertex = vertex0; - entry_point vertex = vertex1; )"); utils::ComboRenderPipelineDescriptor descriptor(device); @@ -697,24 +696,25 @@ TEST_F(RenderPipelineValidationTest, VertexAttribCorrectEntryPoint) { } // Test that fragment output validation is for the correct entryPoint -TEST_F(RenderPipelineValidationTest, FragmentOutputCorrectEntryPoint) { +// +// TODO(crbug.com/tint/263): Re-enable once an issue is fixed with Tint. +TEST_F(RenderPipelineValidationTest, DISABLED_FragmentOutputCorrectEntryPoint) { DAWN_SKIP_TEST_IF(!HasWGSL()); wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"( - [[location 0]] var colorFloat : vec4; - [[location 0]] var colorUint : vec4; + [[location(0)]] var colorFloat : vec4; + [[location(0)]] var colorUint : vec4; + [[stage(fragment)]] fn fragmentFloat() -> void { colorFloat = vec4(0.0, 0.0, 0.0, 0.0); return; } + [[stage(fragment)]] fn fragmentUint() -> void { colorUint = vec4(0, 0, 0, 0); return; } - - entry_point fragment = fragmentFloat; - entry_point fragment = fragmentUint; )"); utils::ComboRenderPipelineDescriptor descriptor(device); @@ -751,7 +751,7 @@ TEST_F(RenderPipelineValidationTest, DISABLED_BindingsFromCorrectEntryPoint) { }; [[binding 0, set 0]] var var0 : Uniforms; [[binding 1, set 0]] var var1 : Uniforms; - [[builtin position]] var position : vec4; + [[builtin(position)]] var position : vec4; fn vertex0() -> void { position = var0.data;