diff --git a/Source/WebKit/CMakeLists.txt b/Source/WebKit/CMakeLists.txt index 6fd0556b88ca..e475c759a16e 100644 --- a/Source/WebKit/CMakeLists.txt +++ b/Source/WebKit/CMakeLists.txt @@ -535,31 +535,69 @@ set(WebKit_SERIALIZATION_IN_FILES Shared/Cocoa/WebCoreArgumentCodersCocoa.serialization.in + Shared/WebGPU/WebGPUBindGroupDescriptor.serialization.in Shared/WebGPU/WebGPUBindGroupEntry.serialization.in + Shared/WebGPU/WebGPUBindGroupLayoutDescriptor.serialization.in + Shared/WebGPU/WebGPUBindGroupLayoutEntry.serialization.in Shared/WebGPU/WebGPUBlendComponent.serialization.in Shared/WebGPU/WebGPUBlendState.serialization.in Shared/WebGPU/WebGPUBufferBinding.serialization.in Shared/WebGPU/WebGPUBufferBindingLayout.serialization.in + Shared/WebGPU/WebGPUBufferDescriptor.serialization.in Shared/WebGPU/WebGPUCanvasConfiguration.serialization.in Shared/WebGPU/WebGPUColor.serialization.in Shared/WebGPU/WebGPUColorTargetState.serialization.in + Shared/WebGPU/WebGPUCommandBufferDescriptor.serialization.in + Shared/WebGPU/WebGPUCommandEncoderDescriptor.serialization.in + Shared/WebGPU/WebGPUCompilationMessage.serialization.in + Shared/WebGPU/WebGPUComputePassDescriptor.serialization.in Shared/WebGPU/WebGPUComputePassTimestampWrites.serialization.in + Shared/WebGPU/WebGPUComputePipelineDescriptor.serialization.in + Shared/WebGPU/WebGPUDepthStencilState.serialization.in + Shared/WebGPU/WebGPUDeviceDescriptor.serialization.in + Shared/WebGPU/WebGPUExtent3D.serialization.in + Shared/WebGPU/WebGPUExternalTextureBindingLayout.serialization.in + Shared/WebGPU/WebGPUExternalTextureDescriptor.serialization.in + Shared/WebGPU/WebGPUFragmentState.serialization.in + Shared/WebGPU/WebGPUImageCopyBuffer.serialization.in + Shared/WebGPU/WebGPUImageCopyExternalImage.serialization.in + Shared/WebGPU/WebGPUImageCopyTexture.serialization.in + Shared/WebGPU/WebGPUImageCopyTextureTagged.serialization.in + Shared/WebGPU/WebGPUImageDataLayout.serialization.in + Shared/WebGPU/WebGPUMultisampleState.serialization.in Shared/WebGPU/WebGPUObjectDescriptorBase.serialization.in - + Shared/WebGPU/WebGPUOrigin2D.serialization.in Shared/WebGPU/WebGPUOrigin3D.serialization.in + Shared/WebGPU/WebGPUOutOfMemoryError.serialization.in + Shared/WebGPU/WebGPUPipelineDescriptorBase.serialization.in + Shared/WebGPU/WebGPUPipelineLayoutDescriptor.serialization.in Shared/WebGPU/WebGPUPrimitiveState.serialization.in Shared/WebGPU/WebGPUProgrammableStage.serialization.in + Shared/WebGPU/WebGPUQuerySetDescriptor.serialization.in + Shared/WebGPU/WebGPURenderBundleDescriptor.serialization.in + Shared/WebGPU/WebGPURenderBundleEncoderDescriptor.serialization.in Shared/WebGPU/WebGPURenderPassColorAttachment.serialization.in Shared/WebGPU/WebGPURenderPassDepthStencilAttachment.serialization.in + Shared/WebGPU/WebGPURenderPassDescriptor.serialization.in + Shared/WebGPU/WebGPURenderPassLayout.serialization.in Shared/WebGPU/WebGPURenderPassTimestampWrites.serialization.in + Shared/WebGPU/WebGPURenderPipelineDescriptor.serialization.in + Shared/WebGPU/WebGPURequestAdapterOptions.serialization.in + Shared/WebGPU/WebGPUSamplerBindingLayout.serialization.in + Shared/WebGPU/WebGPUSamplerDescriptor.serialization.in + Shared/WebGPU/WebGPUShaderModuleCompilationHint.serialization.in + Shared/WebGPU/WebGPUShaderModuleDescriptor.serialization.in Shared/WebGPU/WebGPUStencilFaceState.serialization.in Shared/WebGPU/WebGPUStorageTextureBindingLayout.serialization.in Shared/WebGPU/WebGPUSupportedFeatures.serialization.in Shared/WebGPU/WebGPUSupportedLimits.serialization.in Shared/WebGPU/WebGPUTextureBindingLayout.serialization.in + Shared/WebGPU/WebGPUTextureDescriptor.serialization.in + Shared/WebGPU/WebGPUTextureViewDescriptor.serialization.in Shared/WebGPU/WebGPUValidationError.serialization.in Shared/WebGPU/WebGPUVertexAttribute.serialization.in Shared/WebGPU/WebGPUVertexBufferLayout.serialization.in + Shared/WebGPU/WebGPUVertexState.serialization.in Shared/WebsiteData/WebsiteDataFetchOption.serialization.in ) diff --git a/Source/WebKit/DerivedSources-input.xcfilelist b/Source/WebKit/DerivedSources-input.xcfilelist index 19e13321743b..41552ef804a2 100644 --- a/Source/WebKit/DerivedSources-input.xcfilelist +++ b/Source/WebKit/DerivedSources-input.xcfilelist @@ -155,6 +155,45 @@ $(PROJECT_DIR)/Shared/WebCoreArgumentCoders.serialization.in $(PROJECT_DIR)/Shared/WebEvent.serialization.in $(PROJECT_DIR)/Shared/WebExtensionContextParameters.serialization.in $(PROJECT_DIR)/Shared/WebExtensionControllerParameters.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUBindGroupDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUBindGroupLayoutDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUBindGroupLayoutEntry.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUBufferDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUCommandBufferDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUCommandEncoderDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUCompilationMessage.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUComputePassDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUComputePipelineDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUDepthStencilState.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUDeviceDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUExtent3D.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUExternalTextureBindingLayout.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUExternalTextureDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUFragmentState.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUImageCopyBuffer.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUImageCopyExternalImage.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUImageCopyTexture.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUImageCopyTextureTagged.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUImageDataLayout.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUMultisampleState.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUOrigin2D.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUOutOfMemoryError.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUPipelineDescriptorBase.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUPipelineLayoutDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUQuerySetDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPURenderBundleDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPURenderBundleEncoderDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPURenderPassDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPURenderPassLayout.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPURenderPipelineDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPURequestAdapterOptions.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUSamplerBindingLayout.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUSamplerDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUShaderModuleCompilationHint.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUShaderModuleDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUTextureDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUTextureViewDescriptor.serialization.in +$(PROJECT_DIR)/Shared/WebGPU/WebGPUVertexState.serialization.in $(PROJECT_DIR)/Shared/WebGPU/WebGPUBindGroupEntry.serialization.in $(PROJECT_DIR)/Shared/WebGPU/WebGPUBlendComponent.serialization.in $(PROJECT_DIR)/Shared/WebGPU/WebGPUBlendState.serialization.in diff --git a/Source/WebKit/DerivedSources.make b/Source/WebKit/DerivedSources.make index ad743a2b9c38..ad108d4a1235 100644 --- a/Source/WebKit/DerivedSources.make +++ b/Source/WebKit/DerivedSources.make @@ -476,6 +476,45 @@ SERIALIZATION_DESCRIPTION_FILES = \ Shared/mac/SecItemResponseData.serialization.in \ Shared/WebsiteDataStoreParameters.serialization.in \ Shared/WebsiteData/WebsiteDataFetchOption.serialization.in \ + Shared/WebGPU/WebGPUBindGroupDescriptor.serialization.in \ + Shared/WebGPU/WebGPUBindGroupLayoutDescriptor.serialization.in \ + Shared/WebGPU/WebGPUBindGroupLayoutEntry.serialization.in \ + Shared/WebGPU/WebGPUBufferDescriptor.serialization.in \ + Shared/WebGPU/WebGPUCommandBufferDescriptor.serialization.in \ + Shared/WebGPU/WebGPUCommandEncoderDescriptor.serialization.in \ + Shared/WebGPU/WebGPUCompilationMessage.serialization.in \ + Shared/WebGPU/WebGPUComputePassDescriptor.serialization.in \ + Shared/WebGPU/WebGPUComputePipelineDescriptor.serialization.in \ + Shared/WebGPU/WebGPUDepthStencilState.serialization.in \ + Shared/WebGPU/WebGPUDeviceDescriptor.serialization.in \ + Shared/WebGPU/WebGPUExtent3D.serialization.in \ + Shared/WebGPU/WebGPUExternalTextureBindingLayout.serialization.in \ + Shared/WebGPU/WebGPUExternalTextureDescriptor.serialization.in \ + Shared/WebGPU/WebGPUFragmentState.serialization.in \ + Shared/WebGPU/WebGPUImageCopyBuffer.serialization.in \ + Shared/WebGPU/WebGPUImageCopyExternalImage.serialization.in \ + Shared/WebGPU/WebGPUImageCopyTexture.serialization.in \ + Shared/WebGPU/WebGPUImageCopyTextureTagged.serialization.in \ + Shared/WebGPU/WebGPUImageDataLayout.serialization.in \ + Shared/WebGPU/WebGPUMultisampleState.serialization.in \ + Shared/WebGPU/WebGPUOrigin2D.serialization.in \ + Shared/WebGPU/WebGPUOutOfMemoryError.serialization.in \ + Shared/WebGPU/WebGPUPipelineDescriptorBase.serialization.in \ + Shared/WebGPU/WebGPUPipelineLayoutDescriptor.serialization.in \ + Shared/WebGPU/WebGPUQuerySetDescriptor.serialization.in \ + Shared/WebGPU/WebGPURenderBundleDescriptor.serialization.in \ + Shared/WebGPU/WebGPURenderBundleEncoderDescriptor.serialization.in \ + Shared/WebGPU/WebGPURenderPassDescriptor.serialization.in \ + Shared/WebGPU/WebGPURenderPassLayout.serialization.in \ + Shared/WebGPU/WebGPURenderPipelineDescriptor.serialization.in \ + Shared/WebGPU/WebGPURequestAdapterOptions.serialization.in \ + Shared/WebGPU/WebGPUSamplerBindingLayout.serialization.in \ + Shared/WebGPU/WebGPUSamplerDescriptor.serialization.in \ + Shared/WebGPU/WebGPUShaderModuleCompilationHint.serialization.in \ + Shared/WebGPU/WebGPUShaderModuleDescriptor.serialization.in \ + Shared/WebGPU/WebGPUTextureDescriptor.serialization.in \ + Shared/WebGPU/WebGPUTextureViewDescriptor.serialization.in \ + Shared/WebGPU/WebGPUVertexState.serialization.in \ Shared/WebGPU/WebGPUVertexBufferLayout.serialization.in \ Shared/WebGPU/WebGPUVertexAttribute.serialization.in \ Shared/WebGPU/WebGPUValidationError.serialization.in \ diff --git a/Source/WebKit/Scripts/generate-serializers.py b/Source/WebKit/Scripts/generate-serializers.py index f4dac280034e..8bb96f2e3039 100644 --- a/Source/WebKit/Scripts/generate-serializers.py +++ b/Source/WebKit/Scripts/generate-serializers.py @@ -27,11 +27,12 @@ class SerializedType(object): - def __init__(self, struct_or_class, namespace, name, parent_class, members, condition, attributes): + def __init__(self, struct_or_class, namespace, name, parent_class_name, members, condition, attributes): self.struct_or_class = struct_or_class self.namespace = namespace self.name = name - self.parent_class = parent_class + self.parent_class_name = parent_class_name + self.parent_class = None self.members = members self.condition = condition self.encoders = ['Encoder'] @@ -239,16 +240,150 @@ def generate_header(serialized_types, serialized_enums): def resolve_inheritance(serialized_types): result = [] for serialized_type in serialized_types: - if serialized_type.parent_class is not None: + if serialized_type.parent_class_name is not None: for possible_parent in serialized_types: - if possible_parent.namespace_and_name() == serialized_type.parent_class: - serialized_type.members = possible_parent.members + serialized_type.members - serialized_type.parent_class = len(possible_parent.members) + if possible_parent.namespace_and_name() == serialized_type.parent_class_name: + serialized_type.parent_class = possible_parent break result.append(serialized_type) return result +def check_type_members(type): + result = [] + if type.parent_class is not None: + result = result + check_type_members(type.parent_class) + for member in type.members: + if member.condition is not None: + result.append('#if ' + member.condition) + result.append(' static_assert(std::is_same_v>, ' + member.type + '>);') + if member.condition is not None: + result.append('#endif') + return result + + +def encode_type(type): + result = [] + if type.parent_class is not None: + result = result + encode_type(type.parent_class) + for member in type.members: + if member.condition is not None: + result.append('#if ' + member.condition) + if 'Nullable' in member.attributes: + result.append(' encoder << !!instance.' + member.name + ';') + result.append(' if (!!instance.' + member.name + ')') + result.append(' encoder << instance.' + member.name + ';') + elif member.unique_ptr_type() is not None: + result.append(' encoder << !!instance.' + member.name + ';') + result.append(' if (!!instance.' + member.name + ')') + result.append(' encoder << *instance.' + member.name + ';') + else: + result.append(' encoder << instance.' + member.name + ('()' if type.serialize_with_function_calls else '') + ';') + if 'ReturnEarlyIfTrue' in member.attributes: + result.append(' if (instance.' + member.name + ')') + result.append(' return;') + if member.condition is not None: + result.append('#endif') + return result + + +def decode_type(type): + result = [] + if type.parent_class is not None: + result = result + decode_type(type.parent_class) + for member in type.members: + if member.condition is not None: + result.append('#if ' + member.condition) + result.append(' std::optional<' + member.type + '> ' + sanitize_string_for_variable_name(member.name) + ';') + if 'Nullable' in member.attributes: + result.append(' std::optional has' + member.name + ';') + result.append(' decoder >> has' + member.name + ';') + result.append(' if (!has' + member.name + ')') + result.append(' return std::nullopt;') + result.append(' if (*has' + member.name + ') {') + result.append(' decoder >> ' + member.name + ';') + result.append(' if (!' + member.name + ')') + result.append(' return std::nullopt;') + result.append(' } else') + result.append(' ' + member.name + ' = std::optional<' + member.type + '> { ' + member.type + ' { } };') + elif member.unique_ptr_type() is not None: + result.append(' std::optional has' + sanitize_string_for_variable_name(member.name) + ';') + result.append(' decoder >> has' + sanitize_string_for_variable_name(member.name) + ';') + result.append(' if (!has' + sanitize_string_for_variable_name(member.name) + ')') + result.append(' return std::nullopt;') + result.append(' if (*has' + sanitize_string_for_variable_name(member.name) + ') {') + result.append(' std::optional<' + member.unique_ptr_type() + '> contents;') + result.append(' decoder >> contents;') + result.append(' if (!contents)') + result.append(' return std::nullopt;') + result.append(' ' + sanitize_string_for_variable_name(member.name) + '= makeUnique<' + member.unique_ptr_type() + '>(WTFMove(*contents));') + result.append(' } else') + result.append(' ' + sanitize_string_for_variable_name(member.name) + ' = std::optional<' + member.type + '> { ' + member.type + ' { } };') + else: + r = re.compile("SecureCodingAllowed=\\[(.*)\\]") + decodable_classes = [r.match(m).groups()[0] for m in list(filter(r.match, member.attributes))] + if len(decodable_classes) == 1: + match = re.search("RetainPtr<(.*)>", member.type) + assert match + result.append(' ' + sanitize_string_for_variable_name(member.name) + ' = IPC::decode<' + match.groups()[0] + '>(decoder, @[ ' + decodable_classes[0] + ' ]);') + result.append(' if (!' + sanitize_string_for_variable_name(member.name) + ')') + result.append(' return std::nullopt;') + if 'ReturnEarlyIfTrue' in member.attributes: + result.append(' if (*' + sanitize_string_for_variable_name(member.name) + ')') + result.append(' return { ' + type.namespace_and_name() + ' { } };') + else: + assert len(decodable_classes) == 0 + result.append(' decoder >> ' + sanitize_string_for_variable_name(member.name) + ';') + result.append(' if (!' + sanitize_string_for_variable_name(member.name) + ')') + result.append(' return std::nullopt;') + if 'ReturnEarlyIfTrue' in member.attributes: + result.append(' if (*' + sanitize_string_for_variable_name(member.name) + ')') + result.append(' return { ' + type.namespace_and_name() + ' { } };') + for attribute in member.attributes: + match = re.search(r'Validator=\'(.*)\'', attribute) + if match: + validator, = match.groups() + result.append('') + result.append(' if (!(' + validator + '))') + result.append(' return std::nullopt;') + continue + else: + match = re.search(r'Validator', attribute) + assert not match + if member.condition is not None: + result.append('#endif') + result.append('') + return result + + +def indent(indentation): + return ' ' * indentation + + +def construct_type(type, indentation): + result = [] + if type.create_using: + result.append(indent(indentation) + type.namespace_and_name() + '::' + type.create_using + '(') + elif type.return_ref: + result.append(indent(indentation) + type.namespace_and_name() + '::create(') + else: + result.append(indent(indentation) + type.namespace_and_name() + ' {') + if type.parent_class is not None: + result = result + construct_type(type.parent_class, indentation + 1) + [indent(indentation + 1) + ','] + for i in range(len(type.members)): + member = type.members[i] + if type.members[i].condition is not None: + result.append('#if ' + member.condition) + result.append(indent(indentation + 1) + 'WTFMove(*' + sanitize_string_for_variable_name(member.name) + ')' + ('' if i == len(type.members) - 1 else ',')) + if member.condition is not None: + result.append('#endif') + if type.create_using or type.return_ref: + result.append(indent(indentation) + ')') + else: + result.append(indent(indentation) + '}') + return result + + def generate_impl(serialized_types, serialized_enums, headers): serialized_types = resolve_inheritance(serialized_types) result = [] @@ -275,30 +410,8 @@ def generate_impl(serialized_types, serialized_enums, headers): result.append('') result.append('void ArgumentCoder<' + type.namespace_and_name() + '>::encode(' + encoder + '& encoder, const ' + type.namespace_and_name() + '& instance)') result.append('{') - for member in type.members: - if member.condition is not None: - result.append('#if ' + member.condition) - result.append(' static_assert(std::is_same_v>, ' + member.type + '>);') - if member.condition is not None: - result.append('#endif') - for member in type.members: - if member.condition is not None: - result.append('#if ' + member.condition) - if 'Nullable' in member.attributes: - result.append(' encoder << !!instance.' + member.name + ';') - result.append(' if (!!instance.' + member.name + ')') - result.append(' encoder << instance.' + member.name + ';') - elif member.unique_ptr_type() is not None: - result.append(' encoder << !!instance.' + member.name + ';') - result.append(' if (!!instance.' + member.name + ')') - result.append(' encoder << *instance.' + member.name + ';') - else: - result.append(' encoder << instance.' + member.name + ('()' if type.serialize_with_function_calls else '') + ';') - if 'ReturnEarlyIfTrue' in member.attributes: - result.append(' if (instance.' + member.name + ')') - result.append(' return;') - if member.condition is not None: - result.append('#endif') + result = result + check_type_members(type) + result = result + encode_type(type) result.append('}') result.append('') if type.return_ref: @@ -306,68 +419,7 @@ def generate_impl(serialized_types, serialized_enums, headers): else: result.append('std::optional<' + type.namespace_and_name() + '> ArgumentCoder<' + type.namespace_and_name() + '>::decode(Decoder& decoder)') result.append('{') - for member in type.members: - if member.condition is not None: - result.append('#if ' + member.condition) - result.append(' std::optional<' + member.type + '> ' + sanitize_string_for_variable_name(member.name) + ';') - if 'Nullable' in member.attributes: - result.append(' std::optional has' + member.name + ';') - result.append(' decoder >> has' + member.name + ';') - result.append(' if (!has' + member.name + ')') - result.append(' return std::nullopt;') - result.append(' if (*has' + member.name + ') {') - result.append(' decoder >> ' + member.name + ';') - result.append(' if (!' + member.name + ')') - result.append(' return std::nullopt;') - result.append(' } else') - result.append(' ' + member.name + ' = std::optional<' + member.type + '> { ' + member.type + ' { } };') - elif member.unique_ptr_type() is not None: - result.append(' std::optional has' + sanitize_string_for_variable_name(member.name) + ';') - result.append(' decoder >> has' + sanitize_string_for_variable_name(member.name) + ';') - result.append(' if (!has' + sanitize_string_for_variable_name(member.name) + ')') - result.append(' return std::nullopt;') - result.append(' if (*has' + sanitize_string_for_variable_name(member.name) + ') {') - result.append(' std::optional<' + member.unique_ptr_type() + '> contents;') - result.append(' decoder >> contents;') - result.append(' if (!contents)') - result.append(' return std::nullopt;') - result.append(' ' + sanitize_string_for_variable_name(member.name) + '= makeUnique<' + member.unique_ptr_type() + '>(WTFMove(*contents));') - result.append(' } else') - result.append(' ' + sanitize_string_for_variable_name(member.name) + ' = std::optional<' + member.type + '> { ' + member.type + ' { } };') - else: - r = re.compile("SecureCodingAllowed=\[(.*)\]") - decodable_classes = [r.match(m).groups()[0] for m in list(filter(r.match, member.attributes))] - if len(decodable_classes) == 1: - match = re.search("RetainPtr<(.*)>", member.type) - assert match - result.append(' ' + sanitize_string_for_variable_name(member.name) + ' = IPC::decode<' + match.groups()[0] + '>(decoder, @[ ' + decodable_classes[0] + ' ]);') - result.append(' if (!' + sanitize_string_for_variable_name(member.name) + ')') - result.append(' return std::nullopt;') - if 'ReturnEarlyIfTrue' in member.attributes: - result.append(' if (*' + sanitize_string_for_variable_name(member.name) + ')') - result.append(' return { ' + type.namespace_and_name() + ' { } };') - else: - assert len(decodable_classes) == 0 - result.append(' decoder >> ' + sanitize_string_for_variable_name(member.name) + ';') - result.append(' if (!' + sanitize_string_for_variable_name(member.name) + ')') - result.append(' return std::nullopt;') - if 'ReturnEarlyIfTrue' in member.attributes: - result.append(' if (*' + sanitize_string_for_variable_name(member.name) + ')') - result.append(' return { ' + type.namespace_and_name() + ' { } };') - for attribute in member.attributes: - match = re.search(r'Validator=\'(.*)\'', attribute) - if match: - validator, = match.groups() - result.append('') - result.append(' if (!(' + validator + '))') - result.append(' return std::nullopt;') - continue - else: - match = re.search(r'Validator', attribute) - assert not match - if member.condition is not None: - result.append('#endif') - result.append('') + result = result + decode_type(type) if type.populate_from_empty_constructor: result.append(' ' + type.namespace_and_name() + ' result;') for member in type.members: @@ -378,28 +430,9 @@ def generate_impl(serialized_types, serialized_enums, headers): result.append('#endif') result.append(' return { WTFMove(result) };') else: - if type.create_using: - result.append(' return { ' + type.namespace_and_name() + '::' + type.create_using + '(') - elif type.return_ref: - result.append(' return { ' + type.namespace_and_name() + '::create(') - else: - result.append(' return { ' + type.namespace_and_name() + ' {') - if type.parent_class is not None: - result.append(' {') - for i in range(len(type.members)): - member = type.members[i] - if type.members[i].condition is not None: - result.append('#if ' + member.condition) - additional_indentation = (' ' if type.parent_class is not None and type.parent_class > i else '') - result.append(additional_indentation + ' WTFMove(*' + sanitize_string_for_variable_name(member.name) + ')' + ('' if i == len(type.members) - 1 else ',')) - if member.condition is not None: - result.append('#endif') - if type.parent_class == i + 1: - result.append(' },') - if type.return_ref or type.create_using: - result.append(' ) };') - else: - result.append(' } };') + result.append(' return {') + result = result + construct_type(type, 2) + result.append(' };') result.append('}') if type.condition is not None: result.append('') @@ -517,7 +550,7 @@ def parse_serialized_types(file, file_name): member_condition = None struct_or_class = None underlying_type = None - parent_class = None + parent_class_name = None file_extension = "cpp" for line in file: @@ -538,7 +571,7 @@ def parse_serialized_types(file, file_name): if underlying_type is not None: serialized_enums.append(SerializedEnum(namespace, name, underlying_type, members, type_condition, attributes)) else: - serialized_types.append(SerializedType(struct_or_class, namespace, name, parent_class, members, type_condition, attributes)) + serialized_types.append(SerializedType(struct_or_class, namespace, name, parent_class_name, members, type_condition, attributes)) if namespace is not None and (attributes is None or 'CustomHeader' not in attributes and 'Nested' not in attributes): if namespace == 'WebKit': headers.append(ConditionalHeader('"' + name + '.h"', type_condition)) @@ -555,7 +588,7 @@ def parse_serialized_types(file, file_name): member_condition = None struct_or_class = None underlying_type = None - parent_class = None + parent_class_name = None continue match = re.search(r'headers?: (.*)', line) @@ -581,11 +614,11 @@ def parse_serialized_types(file, file_name): match = re.search(r'\[(.*)\] (struct|class) (.*)::(.*) : (.*) {', line) if match: - attributes, struct_or_class, namespace, name, parent_class = match.groups() + attributes, struct_or_class, namespace, name, parent_class_name = match.groups() continue match = re.search(r'(struct|class) (.*)::(.*) : (.*) {', line) if match: - struct_or_class, namespace, name, parent_class = match.groups() + struct_or_class, namespace, name, parent_class_name = match.groups() continue match = re.search(r'\[(.*)\] (struct|class) (.*)::(.*) {', line) if match: diff --git a/Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.cpp b/Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.cpp index b45fd0035b47..a6b0042d4e4b 100644 --- a/Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.cpp +++ b/Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.cpp @@ -38,7 +38,9 @@ #include #include #include +#include #include +#include #include namespace IPC { @@ -110,13 +112,15 @@ std::optional ArgumentCoder> { RetainPtr { } }; - return { Namespace::Subnamespace::StructName { - WTFMove(*firstMemberName), + return { + Namespace::Subnamespace::StructName { + WTFMove(*firstMemberName), #if ENABLE(SECOND_MEMBER) - WTFMove(*secondMemberName), + WTFMove(*secondMemberName), #endif - WTFMove(*nullableTestMember) - } }; + WTFMove(*nullableTestMember) + } + }; } #endif @@ -127,11 +131,13 @@ void ArgumentCoder::encode(Encoder& encoder, const Namesp static_assert(std::is_same_v>, bool>); static_assert(std::is_same_v>, int>); static_assert(std::is_same_v>, bool>); + static_assert(std::is_same_v>, RetainPtr>); encoder << instance.isNull; if (instance.isNull) return; encoder << instance.a; encoder << instance.b; + encoder << instance.dataDetectorResults; } std::optional ArgumentCoder::decode(Decoder& decoder) @@ -153,11 +159,19 @@ std::optional ArgumentCoder::decod if (!b) return std::nullopt; - return { Namespace::OtherClass { - WTFMove(*isNull), - WTFMove(*a), - WTFMove(*b) - } }; + std::optional> dataDetectorResults; + dataDetectorResults = IPC::decode(decoder, @[ NSArray.class, PAL::getDDScannerResultClass() ]); + if (!dataDetectorResults) + return std::nullopt; + + return { + Namespace::OtherClass { + WTFMove(*isNull), + WTFMove(*a), + WTFMove(*b), + WTFMove(*dataDetectorResults) + } + }; } @@ -199,11 +213,13 @@ std::optional> ArgumentCoder> { std::unique_ptr { } }; - return { Namespace::ReturnRefClass::create( - WTFMove(*functionCallmember1), - WTFMove(*functionCallmember2), - WTFMove(*uniqueMember) - ) }; + return { + Namespace::ReturnRefClass::create( + WTFMove(*functionCallmember1), + WTFMove(*functionCallmember2), + WTFMove(*uniqueMember) + ) + }; } @@ -302,9 +318,11 @@ std::optional ArgumentCoder::decode(Decoder& if (!a) return std::nullopt; - return { WithoutNamespace { - WTFMove(*a) - } }; + return { + WithoutNamespace { + WTFMove(*a) + } + }; } @@ -327,16 +345,18 @@ std::optional ArgumentCoder::encode(Encoder& encoder, const WebCore::InheritsFrom& instance) { static_assert(std::is_same_v>, int>); - static_assert(std::is_same_v>, int>); + static_assert(std::is_same_v>, float>); encoder << instance.a; encoder << instance.b; } @@ -348,22 +368,69 @@ std::optional ArgumentCoder::decod if (!a) return std::nullopt; - std::optional b; + std::optional b; decoder >> b; if (!b) return std::nullopt; - return { WebCore::InheritsFrom { - { - WTFMove(*a), - }, - WTFMove(*b) - } }; + return { + WebCore::InheritsFrom { + WithoutNamespace { + WTFMove(*a) + } + , + WTFMove(*b) + } + }; +} + + +void ArgumentCoder::encode(Encoder& encoder, const WebCore::InheritanceGrandchild& instance) +{ + static_assert(std::is_same_v>, int>); + static_assert(std::is_same_v>, float>); + static_assert(std::is_same_v>, double>); + encoder << instance.a; + encoder << instance.b; + encoder << instance.c; +} + +std::optional ArgumentCoder::decode(Decoder& decoder) +{ + std::optional a; + decoder >> a; + if (!a) + return std::nullopt; + + std::optional b; + decoder >> b; + if (!b) + return std::nullopt; + + std::optional c; + decoder >> c; + if (!c) + return std::nullopt; + + return { + WebCore::InheritanceGrandchild { + WebCore::InheritsFrom { + WithoutNamespace { + WTFMove(*a) + } + , + WTFMove(*b) + } + , + WTFMove(*c) + } + }; } void ArgumentCoder::encode(Encoder& encoder, const WTF::Seconds& instance) { + static_assert(std::is_same_v>, double>); encoder << instance.value(); } @@ -374,9 +441,32 @@ std::optional ArgumentCoder::decode(Decoder& decoder if (!value) return std::nullopt; - return { WTF::Seconds { - WTFMove(*value) - } }; + return { + WTF::Seconds { + WTFMove(*value) + } + }; +} + + +void ArgumentCoder::encode(Encoder& encoder, const WTF::CreateUsingClass& instance) +{ + static_assert(std::is_same_v>, double>); + encoder << instance.value; +} + +std::optional ArgumentCoder::decode(Decoder& decoder) +{ + std::optional value; + decoder >> value; + if (!value) + return std::nullopt; + + return { + WTF::CreateUsingClass::fromDouble( + WTFMove(*value) + ) + }; } } // namespace IPC diff --git a/Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.h b/Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.h index 67c8e965abb4..e4e090f5143b 100644 --- a/Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.h +++ b/Source/WebKit/Scripts/webkit/tests/GeneratedSerializers.h @@ -43,7 +43,9 @@ namespace Namespace { class EmptyConstructorNullable; } class WithoutNamespace; class WithoutNamespaceWithAttributes; namespace WebCore { class InheritsFrom; } +namespace WebCore { class InheritanceGrandchild; } namespace WTF { class Seconds; } +namespace WTF { class CreateUsingClass; } namespace IPC { @@ -90,11 +92,21 @@ template<> struct ArgumentCoder { static std::optional decode(Decoder&); }; +template<> struct ArgumentCoder { + static void encode(Encoder&, const WebCore::InheritanceGrandchild&); + static std::optional decode(Decoder&); +}; + template<> struct ArgumentCoder { static void encode(Encoder&, const WTF::Seconds&); static std::optional decode(Decoder&); }; +template<> struct ArgumentCoder { + static void encode(Encoder&, const WTF::CreateUsingClass&); + static std::optional decode(Decoder&); +}; + } // namespace IPC diff --git a/Source/WebKit/Scripts/webkit/tests/SerializedTypeInfo.cpp b/Source/WebKit/Scripts/webkit/tests/SerializedTypeInfo.cpp index 54efa9865b63..bdc1d9b80cdd 100644 --- a/Source/WebKit/Scripts/webkit/tests/SerializedTypeInfo.cpp +++ b/Source/WebKit/Scripts/webkit/tests/SerializedTypeInfo.cpp @@ -38,7 +38,9 @@ #include #include #include +#include #include +#include #include #if ENABLE(IPC_TESTING_API) @@ -57,6 +59,7 @@ Vector allSerializedTypes() "bool"_s, "int"_s, "bool"_s, + "RetainPtr"_s, } }, { "Namespace::ReturnRefClass"_s, { "double"_s, @@ -79,12 +82,17 @@ Vector allSerializedTypes() "int"_s, } }, { "WebCore::InheritsFrom"_s, { - "int"_s, - "int"_s, + "float"_s, + } }, + { "WebCore::InheritanceGrandchild"_s, { + "double"_s, } }, { "Seconds"_s, { "double"_s, } }, + { "CreateUsingClass"_s, { + "double"_s, + } }, }; } diff --git a/Source/WebKit/Scripts/webkit/tests/TestSerializedType.serialization.in b/Source/WebKit/Scripts/webkit/tests/TestSerializedType.serialization.in index 1ec1a4a403df..7d84e0cb1746 100644 --- a/Source/WebKit/Scripts/webkit/tests/TestSerializedType.serialization.in +++ b/Source/WebKit/Scripts/webkit/tests/TestSerializedType.serialization.in @@ -17,6 +17,7 @@ headers: "StructHeader.h" "FirstMemberType.h" "SecondMemberType.h" [ReturnEarlyIfTrue] bool isNull int a bool b + [SecureCodingAllowed=[NSArray.class, PAL::getDDScannerResultClass()]] RetainPtr dataDetectorResults; } [Return=Ref] class Namespace::ReturnRefClass { @@ -47,7 +48,11 @@ class WithoutNamespace { } class WebCore::InheritsFrom : WithoutNamespace { - int b; + float b; +} + +class WebCore::InheritanceGrandchild : WebCore::InheritsFrom { + double c; } #if ENABLE(BOOL_ENUM) @@ -74,3 +79,7 @@ enum class EnumNamespace::EnumType : uint16_t { class WTF::Seconds { double value() } + +[CreateUsing=fromDouble] class WTF::CreateUsingClass { + double value +} diff --git a/Source/WebKit/Shared/WebGPU/WebGPUBindGroupDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPUBindGroupDescriptor.h index 6a34d19d2d37..d84154bc5c2e 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUBindGroupDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUBindGroupDescriptor.h @@ -38,33 +38,6 @@ namespace WebKit::WebGPU { struct BindGroupDescriptor : public ObjectDescriptorBase { WebGPUIdentifier bindGroupLayout; Vector entries; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << bindGroupLayout; - encoder << entries; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - std::optional bindGroupLayout; - decoder >> bindGroupLayout; - if (!bindGroupLayout) - return std::nullopt; - - std::optional> entries; - decoder >> entries; - if (!entries) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase), WTFMove(*bindGroupLayout), WTFMove(*entries) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUBindGroupDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUBindGroupDescriptor.serialization.in new file mode 100644 index 000000000000..11984e887e55 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUBindGroupDescriptor.serialization.in @@ -0,0 +1,28 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::BindGroupDescriptor : WebKit::WebGPU::ObjectDescriptorBase { + WebKit::WebGPUIdentifier bindGroupLayout; + Vector entries; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutDescriptor.h index 47a2e02c3c65..07e52ffda725 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutDescriptor.h @@ -36,27 +36,6 @@ namespace WebKit::WebGPU { struct BindGroupLayoutDescriptor : public ObjectDescriptorBase { Vector entries; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << entries; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - std::optional> entries; - decoder >> entries; - if (!entries) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase), WTFMove(*entries) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutDescriptor.serialization.in new file mode 100644 index 000000000000..e85cb33b2942 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutDescriptor.serialization.in @@ -0,0 +1,27 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::BindGroupLayoutDescriptor : WebKit::WebGPU::ObjectDescriptorBase { + Vector entries; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutEntry.h b/Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutEntry.h index b5ef0526d1ae..7dacd1eda505 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutEntry.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutEntry.h @@ -47,57 +47,6 @@ struct BindGroupLayoutEntry { std::optional texture; std::optional storageTexture; std::optional externalTexture; - - template void encode(Encoder& encoder) const - { - encoder << binding; - encoder << visibility; - encoder << buffer; - encoder << sampler; - encoder << texture; - encoder << storageTexture; - encoder << externalTexture; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional binding; - decoder >> binding; - if (!binding) - return std::nullopt; - - std::optional visibility; - decoder >> visibility; - if (!visibility) - return std::nullopt; - - std::optional> buffer; - decoder >> buffer; - if (!buffer) - return std::nullopt; - - std::optional> sampler; - decoder >> sampler; - if (!sampler) - return std::nullopt; - - std::optional> texture; - decoder >> texture; - if (!texture) - return std::nullopt; - - std::optional> storageTexture; - decoder >> storageTexture; - if (!storageTexture) - return std::nullopt; - - std::optional> externalTexture; - decoder >> externalTexture; - if (!externalTexture) - return std::nullopt; - - return { { WTFMove(*binding), WTFMove(*visibility), WTFMove(*buffer), WTFMove(*sampler), WTFMove(*texture), WTFMove(*storageTexture), WTFMove(*externalTexture) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutEntry.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutEntry.serialization.in new file mode 100644 index 000000000000..dba23db9140a --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutEntry.serialization.in @@ -0,0 +1,34 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::BindGroupLayoutEntry { + PAL::WebGPU::Index32 binding; + PAL::WebGPU::ShaderStageFlags visibility; + + std::optional buffer; + std::optional sampler; + std::optional texture; + std::optional storageTexture; + std::optional externalTexture; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUBufferDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPUBufferDescriptor.h index a11d6ffbf542..580688e7f70a 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUBufferDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUBufferDescriptor.h @@ -38,39 +38,6 @@ struct BufferDescriptor : public ObjectDescriptorBase { PAL::WebGPU::Size64 size { 0 }; PAL::WebGPU::BufferUsageFlags usage; bool mappedAtCreation { false }; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << size; - encoder << usage; - encoder << mappedAtCreation; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - std::optional size; - decoder >> size; - if (!size) - return std::nullopt; - - std::optional usage; - decoder >> usage; - if (!usage) - return std::nullopt; - - std::optional mappedAtCreation; - decoder >> mappedAtCreation; - if (!mappedAtCreation) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase), WTFMove(*size), WTFMove(*usage), WTFMove(*mappedAtCreation) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUBufferDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUBufferDescriptor.serialization.in new file mode 100644 index 000000000000..1f135b2642d7 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUBufferDescriptor.serialization.in @@ -0,0 +1,29 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::BufferDescriptor : WebKit::WebGPU::ObjectDescriptorBase { + PAL::WebGPU::Size64 size; + PAL::WebGPU::BufferUsageFlags usage; + bool mappedAtCreation; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUCommandBufferDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPUCommandBufferDescriptor.h index df173c48fe3d..723c44a2f7c1 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUCommandBufferDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUCommandBufferDescriptor.h @@ -32,22 +32,7 @@ namespace WebKit::WebGPU { -struct CommandBufferDescriptor : public ObjectDescriptorBase { - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase) } }; - } -}; +struct CommandBufferDescriptor : public ObjectDescriptorBase { }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUCommandBufferDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUCommandBufferDescriptor.serialization.in new file mode 100644 index 000000000000..9d86cd726e0c --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUCommandBufferDescriptor.serialization.in @@ -0,0 +1,26 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::CommandBufferDescriptor : WebKit::WebGPU::ObjectDescriptorBase { +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUCommandEncoderDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPUCommandEncoderDescriptor.h index 18e4a0f10338..d88289592a76 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUCommandEncoderDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUCommandEncoderDescriptor.h @@ -32,22 +32,7 @@ namespace WebKit::WebGPU { -struct CommandEncoderDescriptor : public ObjectDescriptorBase { - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase) } }; - } -}; +struct CommandEncoderDescriptor : public ObjectDescriptorBase { }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUCommandEncoderDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUCommandEncoderDescriptor.serialization.in new file mode 100644 index 000000000000..4641d2d852c4 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUCommandEncoderDescriptor.serialization.in @@ -0,0 +1,26 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::CommandEncoderDescriptor : WebKit::WebGPU::ObjectDescriptorBase { +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUCompilationMessage.h b/Source/WebKit/Shared/WebGPU/WebGPUCompilationMessage.h index 297e89899a17..e8c8b462b04c 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUCompilationMessage.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUCompilationMessage.h @@ -41,51 +41,6 @@ struct CompilationMessage { uint64_t linePos { 0 }; uint64_t offset { 0 }; uint64_t length { 0 }; - - template void encode(Encoder& encoder) const - { - encoder << message; - encoder << type; - encoder << lineNum; - encoder << linePos; - encoder << offset; - encoder << length; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional message; - decoder >> message; - if (!message) - return std::nullopt; - - std::optional type; - decoder >> type; - if (!type) - return std::nullopt; - - std::optional lineNum; - decoder >> lineNum; - if (!lineNum) - return std::nullopt; - - std::optional linePos; - decoder >> linePos; - if (!linePos) - return std::nullopt; - - std::optional offset; - decoder >> offset; - if (!offset) - return std::nullopt; - - std::optional length; - decoder >> length; - if (!length) - return std::nullopt; - - return { { WTFMove(*message), WTFMove(*type), WTFMove(*lineNum), WTFMove(*linePos), WTFMove(*offset), WTFMove(*length) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUCompilationMessage.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUCompilationMessage.serialization.in new file mode 100644 index 000000000000..2a109628c1fd --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUCompilationMessage.serialization.in @@ -0,0 +1,32 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::CompilationMessage { + String message; + PAL::WebGPU::CompilationMessageType type; + uint64_t lineNum; + uint64_t linePos; + uint64_t offset; + uint64_t length; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUComputePassDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPUComputePassDescriptor.h index 5689be3cb121..f7d0a6484045 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUComputePassDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUComputePassDescriptor.h @@ -35,27 +35,6 @@ namespace WebKit::WebGPU { struct ComputePassDescriptor : public ObjectDescriptorBase { ComputePassTimestampWrites timestampWrites; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << timestampWrites; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - std::optional timestampWrites; - decoder >> timestampWrites; - if (!timestampWrites) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase), WTFMove(*timestampWrites) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUComputePassDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUComputePassDescriptor.serialization.in new file mode 100644 index 000000000000..7e030abeb9f5 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUComputePassDescriptor.serialization.in @@ -0,0 +1,27 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::ComputePassDescriptor : WebKit::WebGPU::ObjectDescriptorBase { + WebKit::WebGPU::ComputePassTimestampWrites timestampWrites; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUComputePassTimestampWrites.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUComputePassTimestampWrites.serialization.in index 97a9c15939c9..a32b7c405ab1 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUComputePassTimestampWrites.serialization.in +++ b/Source/WebKit/Shared/WebGPU/WebGPUComputePassTimestampWrites.serialization.in @@ -28,3 +28,4 @@ header: "WebGPUComputePassTimestampWrites.h" PAL::WebGPU::Size32 queryIndex PAL::WebGPU::ComputePassTimestampLocation location } +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUComputePipelineDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPUComputePipelineDescriptor.h index e1b1668374e1..c3ab883443e5 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUComputePipelineDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUComputePipelineDescriptor.h @@ -35,27 +35,6 @@ namespace WebKit::WebGPU { struct ComputePipelineDescriptor : public PipelineDescriptorBase { ProgrammableStage compute; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << compute; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional pipelineDescriptorBase; - decoder >> pipelineDescriptorBase; - if (!pipelineDescriptorBase) - return std::nullopt; - - std::optional compute; - decoder >> compute; - if (!compute) - return std::nullopt; - - return { { WTFMove(*pipelineDescriptorBase), WTFMove(*compute) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUComputePipelineDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUComputePipelineDescriptor.serialization.in new file mode 100644 index 000000000000..5c8dfd4754c8 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUComputePipelineDescriptor.serialization.in @@ -0,0 +1,27 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::ComputePipelineDescriptor : WebKit::WebGPU::PipelineDescriptorBase { + WebKit::WebGPU::ProgrammableStage compute; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUDepthStencilState.h b/Source/WebKit/Shared/WebGPU/WebGPUDepthStencilState.h index 4a8d944b62c8..f51f6df50a3c 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUDepthStencilState.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUDepthStencilState.h @@ -50,75 +50,6 @@ struct DepthStencilState { PAL::WebGPU::DepthBias depthBias { 0 }; float depthBiasSlopeScale { 0 }; float depthBiasClamp { 0 }; - - template void encode(Encoder& encoder) const - { - encoder << format; - encoder << depthWriteEnabled; - encoder << depthCompare; - encoder << stencilFront; - encoder << stencilBack; - encoder << stencilReadMask; - encoder << stencilWriteMask; - encoder << depthBias; - encoder << depthBiasSlopeScale; - encoder << depthBiasClamp; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional format; - decoder >> format; - if (!format) - return std::nullopt; - - std::optional depthWriteEnabled; - decoder >> depthWriteEnabled; - if (!depthWriteEnabled) - return std::nullopt; - - std::optional depthCompare; - decoder >> depthCompare; - if (!depthCompare) - return std::nullopt; - - std::optional stencilFront; - decoder >> stencilFront; - if (!stencilFront) - return std::nullopt; - - std::optional stencilBack; - decoder >> stencilBack; - if (!stencilBack) - return std::nullopt; - - std::optional> stencilReadMask; - decoder >> stencilReadMask; - if (!stencilReadMask) - return std::nullopt; - - std::optional> stencilWriteMask; - decoder >> stencilWriteMask; - if (!stencilWriteMask) - return std::nullopt; - - std::optional depthBias; - decoder >> depthBias; - if (!depthBias) - return std::nullopt; - - std::optional depthBiasSlopeScale; - decoder >> depthBiasSlopeScale; - if (!depthBiasSlopeScale) - return std::nullopt; - - std::optional depthBiasClamp; - decoder >> depthBiasClamp; - if (!depthBiasClamp) - return std::nullopt; - - return { { WTFMove(*format), WTFMove(*depthWriteEnabled), WTFMove(*depthCompare), WTFMove(*stencilFront), WTFMove(*stencilBack), WTFMove(*stencilReadMask), WTFMove(*stencilWriteMask), WTFMove(*depthBias), WTFMove(*depthBiasSlopeScale), WTFMove(*depthBiasClamp) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUDepthStencilState.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUDepthStencilState.serialization.in new file mode 100644 index 000000000000..5d04eeeaf7fe --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUDepthStencilState.serialization.in @@ -0,0 +1,40 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::DepthStencilState { + PAL::WebGPU::TextureFormat format; + + bool depthWriteEnabled; + PAL::WebGPU::CompareFunction depthCompare; + + WebKit::WebGPU::StencilFaceState stencilFront; + WebKit::WebGPU::StencilFaceState stencilBack; + + std::optional stencilReadMask; + std::optional stencilWriteMask; + + PAL::WebGPU::DepthBias depthBias; + float depthBiasSlopeScale; + float depthBiasClamp; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUDeviceDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPUDeviceDescriptor.h index bae40ec77fde..5e33659e509e 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUDeviceDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUDeviceDescriptor.h @@ -40,33 +40,6 @@ namespace WebKit::WebGPU { struct DeviceDescriptor : public ObjectDescriptorBase { Vector requiredFeatures; Vector> requiredLimits; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << requiredFeatures; - encoder << requiredLimits; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - std::optional> requiredFeatures; - decoder >> requiredFeatures; - if (!requiredFeatures) - return std::nullopt; - - std::optional>> requiredLimits; - decoder >> requiredLimits; - if (!requiredLimits) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase), WTFMove(*requiredFeatures), WTFMove(*requiredLimits) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUDeviceDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUDeviceDescriptor.serialization.in new file mode 100644 index 000000000000..a1cf276b5d94 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUDeviceDescriptor.serialization.in @@ -0,0 +1,28 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::DeviceDescriptor : WebKit::WebGPU::ObjectDescriptorBase { + Vector requiredFeatures; + Vector> requiredLimits; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUExtent3D.h b/Source/WebKit/Shared/WebGPU/WebGPUExtent3D.h index 0ed1c03eb1d1..fb84bc37a2ba 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUExtent3D.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUExtent3D.h @@ -38,33 +38,6 @@ struct Extent3DDict { PAL::WebGPU::IntegerCoordinate width { 0 }; PAL::WebGPU::IntegerCoordinate height { 0 }; PAL::WebGPU::IntegerCoordinate depthOrArrayLayers { 0 }; - - template void encode(Encoder& encoder) const - { - encoder << width; - encoder << height; - encoder << depthOrArrayLayers; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional width; - decoder >> width; - if (!width) - return std::nullopt; - - std::optional height; - decoder >> height; - if (!height) - return std::nullopt; - - std::optional depthOrArrayLayers; - decoder >> depthOrArrayLayers; - if (!depthOrArrayLayers) - return std::nullopt; - - return { { WTFMove(*width), WTFMove(*height), WTFMove(*depthOrArrayLayers) } }; - } }; using Extent3D = std::variant, Extent3DDict>; diff --git a/Source/WebKit/Shared/WebGPU/WebGPUExtent3D.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUExtent3D.serialization.in new file mode 100644 index 000000000000..a16ba31489e1 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUExtent3D.serialization.in @@ -0,0 +1,30 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +header: "WebGPUExtent3D.h" +[AdditionalEncoder=StreamConnectionEncoder, CustomHeader] struct WebKit::WebGPU::Extent3DDict { + PAL::WebGPU::IntegerCoordinate width; + PAL::WebGPU::IntegerCoordinate height; + PAL::WebGPU::IntegerCoordinate depthOrArrayLayers; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUExternalTextureBindingLayout.h b/Source/WebKit/Shared/WebGPU/WebGPUExternalTextureBindingLayout.h index 5aad4aeeda58..b6696ea92dbd 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUExternalTextureBindingLayout.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUExternalTextureBindingLayout.h @@ -31,16 +31,7 @@ namespace WebKit::WebGPU { -struct ExternalTextureBindingLayout { - template void encode(Encoder& encoder) const - { - } - - template static std::optional decode(Decoder& decoder) - { - return { { } }; - } -}; +struct ExternalTextureBindingLayout { }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUExternalTextureBindingLayout.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUExternalTextureBindingLayout.serialization.in new file mode 100644 index 000000000000..7ed02e32c560 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUExternalTextureBindingLayout.serialization.in @@ -0,0 +1,26 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::ExternalTextureBindingLayout { +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUExternalTextureDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPUExternalTextureDescriptor.h index e5753c4e5542..e1f2809f0422 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUExternalTextureDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUExternalTextureDescriptor.h @@ -35,27 +35,6 @@ namespace WebKit::WebGPU { struct ExternalTextureDescriptor : public ObjectDescriptorBase { PAL::WebGPU::PredefinedColorSpace colorSpace { PAL::WebGPU::PredefinedColorSpace::SRGB }; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << colorSpace; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - std::optional colorSpace; - decoder >> colorSpace; - if (!colorSpace) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase), WTFMove(*colorSpace) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUExternalTextureDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUExternalTextureDescriptor.serialization.in new file mode 100644 index 000000000000..8558bcc901e5 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUExternalTextureDescriptor.serialization.in @@ -0,0 +1,27 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::ExternalTextureDescriptor : WebKit::WebGPU::ObjectDescriptorBase { + PAL::WebGPU::PredefinedColorSpace colorSpace; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUFragmentState.h b/Source/WebKit/Shared/WebGPU/WebGPUFragmentState.h index c515e9bc86ef..0d02498b2ea9 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUFragmentState.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUFragmentState.h @@ -36,27 +36,6 @@ namespace WebKit::WebGPU { struct FragmentState : public ProgrammableStage { Vector> targets; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << targets; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional programmableStage; - decoder >> programmableStage; - if (!programmableStage) - return std::nullopt; - - std::optional>> targets; - decoder >> targets; - if (!targets) - return std::nullopt; - - return { { WTFMove(*programmableStage), WTFMove(*targets) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUFragmentState.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUFragmentState.serialization.in new file mode 100644 index 000000000000..4f166e5fc96b --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUFragmentState.serialization.in @@ -0,0 +1,27 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::FragmentState : WebKit::WebGPU::ProgrammableStage { + Vector> targets; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUImageCopyBuffer.h b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyBuffer.h index 8fd27859c235..fc152073e286 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUImageCopyBuffer.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyBuffer.h @@ -36,27 +36,6 @@ namespace WebKit::WebGPU { struct ImageCopyBuffer : public ImageDataLayout { WebGPUIdentifier buffer; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << buffer; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional imageDataLayout; - decoder >> imageDataLayout; - if (!imageDataLayout) - return std::nullopt; - - std::optional buffer; - decoder >> buffer; - if (!buffer) - return std::nullopt; - - return { { WTFMove(*imageDataLayout), WTFMove(*buffer) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUImageCopyBuffer.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyBuffer.serialization.in new file mode 100644 index 000000000000..4c1dc0435c6d --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyBuffer.serialization.in @@ -0,0 +1,27 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::ImageCopyBuffer : WebKit::WebGPU::ImageDataLayout { + WebKit::WebGPUIdentifier buffer; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUImageCopyExternalImage.h b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyExternalImage.h index f424b0095ab1..97d13b404fdb 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUImageCopyExternalImage.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyExternalImage.h @@ -37,27 +37,6 @@ struct ImageCopyExternalImage { // FIXME: Handle the source. std::optional origin; bool flipY { false }; - - template void encode(Encoder& encoder) const - { - encoder << origin; - encoder << flipY; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional> origin; - decoder >> origin; - if (!origin) - return std::nullopt; - - std::optional flipY; - decoder >> flipY; - if (!flipY) - return std::nullopt; - - return { { WTFMove(*origin), WTFMove(*flipY) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUImageCopyExternalImage.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyExternalImage.serialization.in new file mode 100644 index 000000000000..ce428228689c --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyExternalImage.serialization.in @@ -0,0 +1,28 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::ImageCopyExternalImage { + std::optional origin; + bool flipY; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUImageCopyTexture.h b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyTexture.h index 55f7a8d0f9d2..2f8515518b6b 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUImageCopyTexture.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyTexture.h @@ -41,39 +41,6 @@ struct ImageCopyTexture { PAL::WebGPU::IntegerCoordinate mipLevel { 0 }; std::optional origin; PAL::WebGPU::TextureAspect aspect { PAL::WebGPU::TextureAspect::All }; - - template void encode(Encoder& encoder) const - { - encoder << texture; - encoder << mipLevel; - encoder << origin; - encoder << aspect; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional texture; - decoder >> texture; - if (!texture) - return std::nullopt; - - std::optional mipLevel; - decoder >> mipLevel; - if (!mipLevel) - return std::nullopt; - - std::optional> origin; - decoder >> origin; - if (!origin) - return std::nullopt; - - std::optional aspect; - decoder >> aspect; - if (!aspect) - return std::nullopt; - - return { { WTFMove(*texture), WTFMove(*mipLevel), WTFMove(*origin), WTFMove(*aspect) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUImageCopyTexture.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyTexture.serialization.in new file mode 100644 index 000000000000..7b8750075945 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyTexture.serialization.in @@ -0,0 +1,30 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::ImageCopyTexture { + WebKit::WebGPUIdentifier texture; + PAL::WebGPU::IntegerCoordinate mipLevel; + std::optional origin; + PAL::WebGPU::TextureAspect aspect; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUImageCopyTextureTagged.h b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyTextureTagged.h index b735098a0dfa..cb5dec73b966 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUImageCopyTextureTagged.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyTextureTagged.h @@ -36,33 +36,6 @@ namespace WebKit::WebGPU { struct ImageCopyTextureTagged : public ImageCopyTexture { PAL::WebGPU::PredefinedColorSpace colorSpace { PAL::WebGPU::PredefinedColorSpace::SRGB }; bool premultipliedAlpha { false }; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << colorSpace; - encoder << premultipliedAlpha; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional imageCopyTexture; - decoder >> imageCopyTexture; - if (!imageCopyTexture) - return std::nullopt; - - std::optional colorSpace; - decoder >> colorSpace; - if (!colorSpace) - return std::nullopt; - - std::optional premultipliedAlpha; - decoder >> premultipliedAlpha; - if (!premultipliedAlpha) - return std::nullopt; - - return { { WTFMove(*imageCopyTexture), WTFMove(*colorSpace), WTFMove(*premultipliedAlpha) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUImageCopyTextureTagged.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyTextureTagged.serialization.in new file mode 100644 index 000000000000..8fe2b250f44f --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUImageCopyTextureTagged.serialization.in @@ -0,0 +1,28 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::ImageCopyTextureTagged : WebKit::WebGPU::ImageCopyTexture { + PAL::WebGPU::PredefinedColorSpace colorSpace; + bool premultipliedAlpha; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUImageDataLayout.h b/Source/WebKit/Shared/WebGPU/WebGPUImageDataLayout.h index 62b7876d0653..1fd98fb1fa8a 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUImageDataLayout.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUImageDataLayout.h @@ -36,33 +36,6 @@ struct ImageDataLayout { PAL::WebGPU::Size64 offset { 0 }; std::optional bytesPerRow; std::optional rowsPerImage; - - template void encode(Encoder& encoder) const - { - encoder << offset; - encoder << bytesPerRow; - encoder << rowsPerImage; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional offset; - decoder >> offset; - if (!offset) - return std::nullopt; - - std::optional> bytesPerRow; - decoder >> bytesPerRow; - if (!bytesPerRow) - return std::nullopt; - - std::optional> rowsPerImage; - decoder >> rowsPerImage; - if (!rowsPerImage) - return std::nullopt; - - return { { WTFMove(*offset), WTFMove(*bytesPerRow), WTFMove(*rowsPerImage) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUImageDataLayout.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUImageDataLayout.serialization.in new file mode 100644 index 000000000000..ed539a360207 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUImageDataLayout.serialization.in @@ -0,0 +1,29 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::ImageDataLayout { + PAL::WebGPU::Size64 offset; + std::optional bytesPerRow; + std::optional rowsPerImage; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUMultisampleState.h b/Source/WebKit/Shared/WebGPU/WebGPUMultisampleState.h index 69e1af743c43..19f8ac00b3e8 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUMultisampleState.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUMultisampleState.h @@ -36,33 +36,6 @@ struct MultisampleState { PAL::WebGPU::Size32 count { 1 }; PAL::WebGPU::SampleMask mask { 0xFFFFFFFF }; bool alphaToCoverageEnabled { false }; - - template void encode(Encoder& encoder) const - { - encoder << count; - encoder << mask; - encoder << alphaToCoverageEnabled; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional count; - decoder >> count; - if (!count) - return std::nullopt; - - std::optional mask; - decoder >> mask; - if (!mask) - return std::nullopt; - - std::optional alphaToCoverageEnabled; - decoder >> alphaToCoverageEnabled; - if (!alphaToCoverageEnabled) - return std::nullopt; - - return { { WTFMove(*count), WTFMove(*mask), WTFMove(*alphaToCoverageEnabled) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUMultisampleState.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUMultisampleState.serialization.in new file mode 100644 index 000000000000..f570b77a30da --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUMultisampleState.serialization.in @@ -0,0 +1,29 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::MultisampleState { + PAL::WebGPU::Size32 count; + PAL::WebGPU::SampleMask mask; + bool alphaToCoverageEnabled; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUObjectDescriptorBase.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUObjectDescriptorBase.serialization.in index 82ef19fea98b..307edf66802c 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUObjectDescriptorBase.serialization.in +++ b/Source/WebKit/Shared/WebGPU/WebGPUObjectDescriptorBase.serialization.in @@ -24,3 +24,4 @@ [AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::ObjectDescriptorBase { String label } +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUOrigin2D.h b/Source/WebKit/Shared/WebGPU/WebGPUOrigin2D.h index 2f2fc5ecf8f3..9cb352c59c40 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUOrigin2D.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUOrigin2D.h @@ -37,27 +37,6 @@ namespace WebKit::WebGPU { struct Origin2DDict { PAL::WebGPU::IntegerCoordinate x { 0 }; PAL::WebGPU::IntegerCoordinate y { 0 }; - - template void encode(Encoder& encoder) const - { - encoder << x; - encoder << y; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional x; - decoder >> x; - if (!x) - return std::nullopt; - - std::optional y; - decoder >> y; - if (!y) - return std::nullopt; - - return { { WTFMove(*x), WTFMove(*y) } }; - } }; using Origin2D = std::variant, Origin2DDict>; diff --git a/Source/WebKit/Shared/WebGPU/WebGPUOrigin2D.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUOrigin2D.serialization.in new file mode 100644 index 000000000000..9f650aabba94 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUOrigin2D.serialization.in @@ -0,0 +1,29 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +header: "WebGPUOrigin2D.h" +[AdditionalEncoder=StreamConnectionEncoder, CustomHeader] struct WebKit::WebGPU::Origin2DDict { + PAL::WebGPU::IntegerCoordinate x; + PAL::WebGPU::IntegerCoordinate y; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUOutOfMemoryError.h b/Source/WebKit/Shared/WebGPU/WebGPUOutOfMemoryError.h index 7545376b81fb..46298f2a7dbb 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUOutOfMemoryError.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUOutOfMemoryError.h @@ -31,16 +31,7 @@ namespace WebKit::WebGPU { -struct OutOfMemoryError { - template void encode(Encoder& encoder) const - { - } - - template static std::optional decode(Decoder& decoder) - { - return { { } }; - } -}; +struct OutOfMemoryError { }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUOutOfMemoryError.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUOutOfMemoryError.serialization.in new file mode 100644 index 000000000000..d862cea411cc --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUOutOfMemoryError.serialization.in @@ -0,0 +1,26 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::OutOfMemoryError { +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUPipelineDescriptorBase.h b/Source/WebKit/Shared/WebGPU/WebGPUPipelineDescriptorBase.h index 4d071f1cd63e..511b9d265242 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUPipelineDescriptorBase.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUPipelineDescriptorBase.h @@ -35,27 +35,6 @@ namespace WebKit::WebGPU { struct PipelineDescriptorBase : public ObjectDescriptorBase { WebGPUIdentifier layout; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << layout; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - std::optional layout; - decoder >> layout; - if (!layout) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase), WTFMove(*layout) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUPipelineDescriptorBase.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUPipelineDescriptorBase.serialization.in new file mode 100644 index 000000000000..8c878d7899fa --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUPipelineDescriptorBase.serialization.in @@ -0,0 +1,27 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::PipelineDescriptorBase : WebKit::WebGPU::ObjectDescriptorBase { + WebKit::WebGPUIdentifier layout; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUPipelineLayoutDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPUPipelineLayoutDescriptor.h index 5e430281af2b..38380b991969 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUPipelineLayoutDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUPipelineLayoutDescriptor.h @@ -36,27 +36,6 @@ namespace WebKit::WebGPU { struct PipelineLayoutDescriptor : public ObjectDescriptorBase { Vector bindGroupLayouts; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << bindGroupLayouts; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - std::optional> bindGroupLayouts; - decoder >> bindGroupLayouts; - if (!bindGroupLayouts) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase), WTFMove(*bindGroupLayouts) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUPipelineLayoutDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUPipelineLayoutDescriptor.serialization.in new file mode 100644 index 000000000000..0d6e80caccdd --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUPipelineLayoutDescriptor.serialization.in @@ -0,0 +1,27 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::PipelineLayoutDescriptor : WebKit::WebGPU::ObjectDescriptorBase { + Vector bindGroupLayouts; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUQuerySetDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPUQuerySetDescriptor.h index 0c0f9b8658d5..42d41738fca9 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUQuerySetDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUQuerySetDescriptor.h @@ -38,33 +38,6 @@ namespace WebKit::WebGPU { struct QuerySetDescriptor : public ObjectDescriptorBase { PAL::WebGPU::QueryType type { PAL::WebGPU::QueryType::Occlusion }; PAL::WebGPU::Size32 count { 0 }; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << type; - encoder << count; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - std::optional type; - decoder >> type; - if (!type) - return std::nullopt; - - std::optional count; - decoder >> count; - if (!count) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase), WTFMove(*type), WTFMove(*count) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUQuerySetDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUQuerySetDescriptor.serialization.in new file mode 100644 index 000000000000..7526a7738a9f --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUQuerySetDescriptor.serialization.in @@ -0,0 +1,28 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::QuerySetDescriptor : WebKit::WebGPU::ObjectDescriptorBase { + PAL::WebGPU::QueryType type; + PAL::WebGPU::Size32 count; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPURenderBundleDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPURenderBundleDescriptor.h index 73a2f08120c7..5a4b96d62a9b 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPURenderBundleDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPURenderBundleDescriptor.h @@ -32,22 +32,7 @@ namespace WebKit::WebGPU { -struct RenderBundleDescriptor : public ObjectDescriptorBase { - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase) } }; - } -}; +struct RenderBundleDescriptor : public ObjectDescriptorBase { }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPURenderBundleDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPURenderBundleDescriptor.serialization.in new file mode 100644 index 000000000000..4d6b5fce6708 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPURenderBundleDescriptor.serialization.in @@ -0,0 +1,26 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::RenderBundleDescriptor : WebKit::WebGPU::ObjectDescriptorBase { +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPURenderBundleEncoderDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPURenderBundleEncoderDescriptor.h index 4a9b4baa6344..08e87530b88c 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPURenderBundleEncoderDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPURenderBundleEncoderDescriptor.h @@ -35,33 +35,6 @@ namespace WebKit::WebGPU { struct RenderBundleEncoderDescriptor : public RenderPassLayout { bool depthReadOnly { false }; bool stencilReadOnly { false }; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << depthReadOnly; - encoder << stencilReadOnly; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional renderPassLayout; - decoder >> renderPassLayout; - if (!renderPassLayout) - return std::nullopt; - - std::optional depthReadOnly; - decoder >> depthReadOnly; - if (!depthReadOnly) - return std::nullopt; - - std::optional stencilReadOnly; - decoder >> stencilReadOnly; - if (!stencilReadOnly) - return std::nullopt; - - return { { WTFMove(*renderPassLayout), WTFMove(*depthReadOnly), WTFMove(*stencilReadOnly) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPURenderBundleEncoderDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPURenderBundleEncoderDescriptor.serialization.in new file mode 100644 index 000000000000..bbeab65fd481 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPURenderBundleEncoderDescriptor.serialization.in @@ -0,0 +1,28 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::RenderBundleEncoderDescriptor : WebKit::WebGPU::RenderPassLayout { + bool depthReadOnly; + bool stencilReadOnly; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPURenderPassDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPURenderPassDescriptor.h index acf687f3f444..fb11c7b04066 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPURenderPassDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPURenderPassDescriptor.h @@ -42,45 +42,6 @@ struct RenderPassDescriptor : public ObjectDescriptorBase { std::optional depthStencilAttachment; WebGPUIdentifier occlusionQuerySet; RenderPassTimestampWrites timestampWrites; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << colorAttachments; - encoder << depthStencilAttachment; - encoder << occlusionQuerySet; - encoder << timestampWrites; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - std::optional>> colorAttachments; - decoder >> colorAttachments; - if (!colorAttachments) - return std::nullopt; - - std::optional> depthStencilAttachment; - decoder >> depthStencilAttachment; - if (!depthStencilAttachment) - return std::nullopt; - - std::optional occlusionQuerySet; - decoder >> occlusionQuerySet; - if (!occlusionQuerySet) - return std::nullopt; - - std::optional timestampWrites; - decoder >> timestampWrites; - if (!timestampWrites) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase), WTFMove(*colorAttachments), WTFMove(*depthStencilAttachment), WTFMove(*occlusionQuerySet), WTFMove(*timestampWrites) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPURenderPassDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPURenderPassDescriptor.serialization.in new file mode 100644 index 000000000000..f8352b4de8fd --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPURenderPassDescriptor.serialization.in @@ -0,0 +1,30 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::RenderPassDescriptor : WebKit::WebGPU::ObjectDescriptorBase { + Vector> colorAttachments; + std::optional depthStencilAttachment; + WebKit::WebGPUIdentifier occlusionQuerySet; + WebKit::WebGPU::RenderPassTimestampWrites timestampWrites; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPURenderPassLayout.h b/Source/WebKit/Shared/WebGPU/WebGPURenderPassLayout.h index c6de2e50df8e..70cbbf1eb060 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPURenderPassLayout.h +++ b/Source/WebKit/Shared/WebGPU/WebGPURenderPassLayout.h @@ -39,39 +39,6 @@ struct RenderPassLayout : public ObjectDescriptorBase { Vector> colorFormats; std::optional depthStencilFormat; PAL::WebGPU::Size32 sampleCount { 1 }; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << colorFormats; - encoder << depthStencilFormat; - encoder << sampleCount; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - std::optional>> colorFormats; - decoder >> colorFormats; - if (!colorFormats) - return std::nullopt; - - std::optional> depthStencilFormat; - decoder >> depthStencilFormat; - if (!depthStencilFormat) - return std::nullopt; - - std::optional sampleCount; - decoder >> sampleCount; - if (!sampleCount) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase), WTFMove(*colorFormats), WTFMove(*depthStencilFormat), WTFMove(*sampleCount) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPURenderPassLayout.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPURenderPassLayout.serialization.in new file mode 100644 index 000000000000..bda4a6c47329 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPURenderPassLayout.serialization.in @@ -0,0 +1,29 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::RenderPassLayout : WebKit::WebGPU::ObjectDescriptorBase { + Vector> colorFormats; + std::optional depthStencilFormat; + PAL::WebGPU::Size32 sampleCount; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPURenderPipelineDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPURenderPipelineDescriptor.h index 4bc05886c2ea..e44f60a528e5 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPURenderPipelineDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPURenderPipelineDescriptor.h @@ -43,51 +43,6 @@ struct RenderPipelineDescriptor : public PipelineDescriptorBase { std::optional depthStencil; std::optional multisample; std::optional fragment; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << vertex; - encoder << primitive; - encoder << depthStencil; - encoder << multisample; - encoder << fragment; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional pipelineDescriptorBase; - decoder >> pipelineDescriptorBase; - if (!pipelineDescriptorBase) - return std::nullopt; - - std::optional vertex; - decoder >> vertex; - if (!vertex) - return std::nullopt; - - std::optional> primitive; - decoder >> primitive; - if (!primitive) - return std::nullopt; - - std::optional> depthStencil; - decoder >> depthStencil; - if (!depthStencil) - return std::nullopt; - - std::optional> multisample; - decoder >> multisample; - if (!multisample) - return std::nullopt; - - std::optional> fragment; - decoder >> fragment; - if (!fragment) - return std::nullopt; - - return { { WTFMove(*pipelineDescriptorBase), WTFMove(*vertex), WTFMove(*primitive), WTFMove(*depthStencil), WTFMove(*multisample), WTFMove(*fragment) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPURenderPipelineDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPURenderPipelineDescriptor.serialization.in new file mode 100644 index 000000000000..3b494bbcad61 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPURenderPipelineDescriptor.serialization.in @@ -0,0 +1,31 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::RenderPipelineDescriptor : WebKit::WebGPU::PipelineDescriptorBase { + WebKit::WebGPU::VertexState vertex; + std::optional primitive; + std::optional depthStencil; + std::optional multisample; + std::optional fragment; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPURequestAdapterOptions.h b/Source/WebKit/Shared/WebGPU/WebGPURequestAdapterOptions.h index ab544855230e..834cf87ccc69 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPURequestAdapterOptions.h +++ b/Source/WebKit/Shared/WebGPU/WebGPURequestAdapterOptions.h @@ -35,27 +35,6 @@ namespace WebKit::WebGPU { struct RequestAdapterOptions { std::optional powerPreference; bool forceFallbackAdapter { false }; - - template void encode(Encoder& encoder) const - { - encoder << powerPreference; - encoder << forceFallbackAdapter; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional> powerPreference; - decoder >> powerPreference; - if (!powerPreference) - return std::nullopt; - - std::optional forceFallbackAdapter; - decoder >> forceFallbackAdapter; - if (!forceFallbackAdapter) - return std::nullopt; - - return { { WTFMove(*powerPreference), WTFMove(*forceFallbackAdapter) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPURequestAdapterOptions.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPURequestAdapterOptions.serialization.in new file mode 100644 index 000000000000..f8e63899850a --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPURequestAdapterOptions.serialization.in @@ -0,0 +1,28 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::RequestAdapterOptions { + std::optional powerPreference; + bool forceFallbackAdapter; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUSamplerBindingLayout.h b/Source/WebKit/Shared/WebGPU/WebGPUSamplerBindingLayout.h index b14d30f7363c..78c76ec8f7fd 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUSamplerBindingLayout.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUSamplerBindingLayout.h @@ -34,21 +34,6 @@ namespace WebKit::WebGPU { struct SamplerBindingLayout { PAL::WebGPU::SamplerBindingType type { PAL::WebGPU::SamplerBindingType::Filtering }; - - template void encode(Encoder& encoder) const - { - encoder << type; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional type; - decoder >> type; - if (!type) - return std::nullopt; - - return { { WTFMove(*type) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUSamplerBindingLayout.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUSamplerBindingLayout.serialization.in new file mode 100644 index 000000000000..533702e3fc0c --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUSamplerBindingLayout.serialization.in @@ -0,0 +1,27 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::SamplerBindingLayout { + PAL::WebGPU::SamplerBindingType type; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUSamplerDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPUSamplerDescriptor.h index 4bb052791ce7..de526e877255 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUSamplerDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUSamplerDescriptor.h @@ -47,81 +47,6 @@ struct SamplerDescriptor : public ObjectDescriptorBase { float lodMaxClamp { 32 }; std::optional compare; uint16_t maxAnisotropy { 1 }; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << addressModeU; - encoder << addressModeV; - encoder << addressModeW; - encoder << magFilter; - encoder << minFilter; - encoder << mipmapFilter; - encoder << lodMinClamp; - encoder << lodMaxClamp; - encoder << compare; - encoder << maxAnisotropy; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - std::optional addressModeU; - decoder >> addressModeU; - if (!addressModeU) - return std::nullopt; - - std::optional addressModeV; - decoder >> addressModeV; - if (!addressModeV) - return std::nullopt; - - std::optional addressModeW; - decoder >> addressModeW; - if (!addressModeW) - return std::nullopt; - - std::optional magFilter; - decoder >> magFilter; - if (!magFilter) - return std::nullopt; - - std::optional minFilter; - decoder >> minFilter; - if (!minFilter) - return std::nullopt; - - std::optional mipmapFilter; - decoder >> mipmapFilter; - if (!mipmapFilter) - return std::nullopt; - - std::optional lodMinClamp; - decoder >> lodMinClamp; - if (!lodMinClamp) - return std::nullopt; - - std::optional lodMaxClamp; - decoder >> lodMaxClamp; - if (!lodMaxClamp) - return std::nullopt; - - std::optional> compare; - decoder >> compare; - if (!compare) - return std::nullopt; - - std::optional maxAnisotropy; - decoder >> maxAnisotropy; - if (!maxAnisotropy) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase), WTFMove(*addressModeU), WTFMove(*addressModeV), WTFMove(*addressModeW), WTFMove(*magFilter), WTFMove(*minFilter), WTFMove(*mipmapFilter), WTFMove(*lodMinClamp), WTFMove(*lodMaxClamp), WTFMove(*compare), WTFMove(*maxAnisotropy) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUSamplerDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUSamplerDescriptor.serialization.in new file mode 100644 index 000000000000..439801b8c933 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUSamplerDescriptor.serialization.in @@ -0,0 +1,36 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::SamplerDescriptor : WebKit::WebGPU::ObjectDescriptorBase { + PAL::WebGPU::AddressMode addressModeU; + PAL::WebGPU::AddressMode addressModeV; + PAL::WebGPU::AddressMode addressModeW; + PAL::WebGPU::FilterMode magFilter; + PAL::WebGPU::FilterMode minFilter; + PAL::WebGPU::FilterMode mipmapFilter; + float lodMinClamp; + float lodMaxClamp; + std::optional compare; + uint16_t maxAnisotropy; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUShaderModuleCompilationHint.h b/Source/WebKit/Shared/WebGPU/WebGPUShaderModuleCompilationHint.h index ed196dfbc548..7ef709b009bf 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUShaderModuleCompilationHint.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUShaderModuleCompilationHint.h @@ -34,21 +34,6 @@ namespace WebKit::WebGPU { struct ShaderModuleCompilationHint { WebGPUIdentifier pipelineLayout; - - template void encode(Encoder& encoder) const - { - encoder << pipelineLayout; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional pipelineLayout; - decoder >> pipelineLayout; - if (!pipelineLayout) - return std::nullopt; - - return { { WTFMove(*pipelineLayout) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUShaderModuleCompilationHint.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUShaderModuleCompilationHint.serialization.in new file mode 100644 index 000000000000..d6dafdfce4dc --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUShaderModuleCompilationHint.serialization.in @@ -0,0 +1,27 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::ShaderModuleCompilationHint { + WebKit::WebGPUIdentifier pipelineLayout; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUShaderModuleDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPUShaderModuleDescriptor.h index 5294ffb71a6d..260360535121 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUShaderModuleDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUShaderModuleDescriptor.h @@ -38,33 +38,6 @@ struct ShaderModuleDescriptor : public ObjectDescriptorBase { String code; // FIXME: Hook up the sourceMap. Vector> hints; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << code; - encoder << hints; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - std::optional code; - decoder >> code; - if (!code) - return std::nullopt; - - std::optional>> hints; - decoder >> hints; - if (!hints) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase), WTFMove(*code), WTFMove(*hints) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUShaderModuleDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUShaderModuleDescriptor.serialization.in new file mode 100644 index 000000000000..ffdb5505abdf --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUShaderModuleDescriptor.serialization.in @@ -0,0 +1,28 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::ShaderModuleDescriptor : WebKit::WebGPU::ObjectDescriptorBase { + String code; + Vector> hints; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUTextureDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPUTextureDescriptor.h index 9de7d64d85ef..661faee7d766 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUTextureDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUTextureDescriptor.h @@ -45,63 +45,6 @@ struct TextureDescriptor : public ObjectDescriptorBase { PAL::WebGPU::TextureFormat format { PAL::WebGPU::TextureFormat::R8unorm }; PAL::WebGPU::TextureUsageFlags usage; Vector viewFormats; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << size; - encoder << mipLevelCount; - encoder << sampleCount; - encoder << dimension; - encoder << format; - encoder << usage; - encoder << viewFormats; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - std::optional size; - decoder >> size; - if (!size) - return std::nullopt; - - std::optional mipLevelCount; - decoder >> mipLevelCount; - if (!mipLevelCount) - return std::nullopt; - - std::optional sampleCount; - decoder >> sampleCount; - if (!sampleCount) - return std::nullopt; - - std::optional dimension; - decoder >> dimension; - if (!dimension) - return std::nullopt; - - std::optional format; - decoder >> format; - if (!format) - return std::nullopt; - - std::optional usage; - decoder >> usage; - if (!usage) - return std::nullopt; - - std::optional> viewFormats; - decoder >> viewFormats; - if (!viewFormats) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase), WTFMove(*size), WTFMove(*mipLevelCount), WTFMove(*sampleCount), WTFMove(*dimension), WTFMove(*format), WTFMove(*usage), WTFMove(*viewFormats) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUTextureDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUTextureDescriptor.serialization.in new file mode 100644 index 000000000000..bb406f697c2d --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUTextureDescriptor.serialization.in @@ -0,0 +1,33 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::TextureDescriptor : WebKit::WebGPU::ObjectDescriptorBase { + WebKit::WebGPU::Extent3D size; + PAL::WebGPU::IntegerCoordinate mipLevelCount; + PAL::WebGPU::Size32 sampleCount; + PAL::WebGPU::TextureDimension dimension; + PAL::WebGPU::TextureFormat format; + PAL::WebGPU::TextureUsageFlags usage; + Vector viewFormats; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUTextureViewDescriptor.h b/Source/WebKit/Shared/WebGPU/WebGPUTextureViewDescriptor.h index f57add825c85..581fc144e9b5 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUTextureViewDescriptor.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUTextureViewDescriptor.h @@ -44,63 +44,6 @@ struct TextureViewDescriptor : public ObjectDescriptorBase { std::optional mipLevelCount; PAL::WebGPU::IntegerCoordinate baseArrayLayer { 0 }; std::optional arrayLayerCount; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << format; - encoder << dimension; - encoder << aspect; - encoder << baseMipLevel; - encoder << mipLevelCount; - encoder << baseArrayLayer; - encoder << arrayLayerCount; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional objectDescriptorBase; - decoder >> objectDescriptorBase; - if (!objectDescriptorBase) - return std::nullopt; - - std::optional> format; - decoder >> format; - if (!format) - return std::nullopt; - - std::optional> dimension; - decoder >> dimension; - if (!dimension) - return std::nullopt; - - std::optional aspect; - decoder >> aspect; - if (!aspect) - return std::nullopt; - - std::optional baseMipLevel; - decoder >> baseMipLevel; - if (!baseMipLevel) - return std::nullopt; - - std::optional> mipLevelCount; - decoder >> mipLevelCount; - if (!mipLevelCount) - return std::nullopt; - - std::optional baseArrayLayer; - decoder >> baseArrayLayer; - if (!baseArrayLayer) - return std::nullopt; - - std::optional> arrayLayerCount; - decoder >> arrayLayerCount; - if (!arrayLayerCount) - return std::nullopt; - - return { { WTFMove(*objectDescriptorBase), WTFMove(*format), WTFMove(*dimension), WTFMove(*aspect), WTFMove(*baseMipLevel), WTFMove(*mipLevelCount), WTFMove(*baseArrayLayer), WTFMove(*arrayLayerCount) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUTextureViewDescriptor.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUTextureViewDescriptor.serialization.in new file mode 100644 index 000000000000..c95f9f41fc7e --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUTextureViewDescriptor.serialization.in @@ -0,0 +1,33 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::TextureViewDescriptor : WebKit::WebGPU::ObjectDescriptorBase { + std::optional format; + std::optional dimension; + PAL::WebGPU::TextureAspect aspect; + PAL::WebGPU::IntegerCoordinate baseMipLevel; + std::optional mipLevelCount; + PAL::WebGPU::IntegerCoordinate baseArrayLayer; + std::optional arrayLayerCount; +}; +#endif diff --git a/Source/WebKit/Shared/WebGPU/WebGPUVertexState.h b/Source/WebKit/Shared/WebGPU/WebGPUVertexState.h index 370d2403b0c6..3fdb9c33f73b 100644 --- a/Source/WebKit/Shared/WebGPU/WebGPUVertexState.h +++ b/Source/WebKit/Shared/WebGPU/WebGPUVertexState.h @@ -36,27 +36,6 @@ namespace WebKit::WebGPU { struct VertexState : public ProgrammableStage { Vector> buffers; - - template void encode(Encoder& encoder) const - { - encoder << static_cast(*this); - encoder << buffers; - } - - template static std::optional decode(Decoder& decoder) - { - std::optional programmableStage; - decoder >> programmableStage; - if (!programmableStage) - return std::nullopt; - - std::optional>> buffers; - decoder >> buffers; - if (!buffers) - return std::nullopt; - - return { { WTFMove(*programmableStage), WTFMove(*buffers) } }; - } }; } // namespace WebKit::WebGPU diff --git a/Source/WebKit/Shared/WebGPU/WebGPUVertexState.serialization.in b/Source/WebKit/Shared/WebGPU/WebGPUVertexState.serialization.in new file mode 100644 index 000000000000..c95beb1adb89 --- /dev/null +++ b/Source/WebKit/Shared/WebGPU/WebGPUVertexState.serialization.in @@ -0,0 +1,27 @@ +# Copyright (C) 2022 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ENABLE(GPU_PROCESS) +[AdditionalEncoder=StreamConnectionEncoder] struct WebKit::WebGPU::VertexState : WebKit::WebGPU::ProgrammableStage { + Vector> buffers; +}; +#endif diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj index ab3bc0d36f16..767b86e6da5e 100644 --- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj +++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj @@ -5533,6 +5533,47 @@ 5CB9310626E839A90032B1C0 /* PrivateClickMeasurementManagerInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrivateClickMeasurementManagerInterface.cpp; sourceTree = ""; }; 5CB9310726E841CB0032B1C0 /* PrivateClickMeasurementXPCUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateClickMeasurementXPCUtilities.h; sourceTree = ""; }; 5CB9310826E841CB0032B1C0 /* PrivateClickMeasurementXPCUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PrivateClickMeasurementXPCUtilities.mm; sourceTree = ""; }; + 5CBA4ABB29020A3F00F70CCD /* WebGPUBindGroupDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUBindGroupDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4ABC29020A3F00F70CCD /* WebGPUExtent3D.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUExtent3D.serialization.in; sourceTree = ""; }; + 5CBA4ABD29020A3F00F70CCD /* WebGPUPipelineDescriptorBase.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUPipelineDescriptorBase.serialization.in; sourceTree = ""; }; + 5CBA4ABE29020A3F00F70CCD /* WebGPURenderBundleEncoderDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPURenderBundleEncoderDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4ABF29020A3F00F70CCD /* WebGPUShaderModuleDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUShaderModuleDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4AC029020A4000F70CCD /* WebGPUImageCopyTextureTagged.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUImageCopyTextureTagged.serialization.in; sourceTree = ""; }; + 5CBA4AC129020A4000F70CCD /* WebGPUComputePipelineDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUComputePipelineDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4AC229020A4000F70CCD /* WebGPUExternalTextureBindingLayout.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUExternalTextureBindingLayout.serialization.in; sourceTree = ""; }; + 5CBA4AC329020A4000F70CCD /* WebGPURequestAdapterOptions.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPURequestAdapterOptions.serialization.in; sourceTree = ""; }; + 5CBA4AC429020A4000F70CCD /* WebGPUTextureDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUTextureDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4AC529020A4000F70CCD /* WebGPUComputePassDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUComputePassDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4AC629020A4100F70CCD /* WebGPUMultisampleState.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUMultisampleState.serialization.in; sourceTree = ""; }; + 5CBA4AC729020A4100F70CCD /* WebGPUDepthStencilState.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUDepthStencilState.serialization.in; sourceTree = ""; }; + 5CBA4AC829020A4100F70CCD /* WebGPURenderPassDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPURenderPassDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4AC929020A4100F70CCD /* WebGPUCommandEncoderDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUCommandEncoderDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4ACA29020A4100F70CCD /* WebGPUStorageTextureBindingLayout.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUStorageTextureBindingLayout.serialization.in; sourceTree = ""; }; + 5CBA4ACB29020A4100F70CCD /* WebGPUDeviceDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUDeviceDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4ACC29020A4200F70CCD /* WebGPUBindGroupLayoutDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUBindGroupLayoutDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4ACD29020A4200F70CCD /* WebGPUFragmentState.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUFragmentState.serialization.in; sourceTree = ""; }; + 5CBA4ACE29020A4200F70CCD /* WebGPUPipelineLayoutDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUPipelineLayoutDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4ACF29020A4200F70CCD /* WebGPUQuerySetDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUQuerySetDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4AD029020A4200F70CCD /* WebGPURenderPassLayout.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPURenderPassLayout.serialization.in; sourceTree = ""; }; + 5CBA4AD129020A4200F70CCD /* WebGPUBufferDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUBufferDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4AD229020A4300F70CCD /* WebGPUImageDataLayout.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUImageDataLayout.serialization.in; sourceTree = ""; }; + 5CBA4AD329020A4300F70CCD /* WebGPUExternalTextureDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUExternalTextureDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4AD429020A4300F70CCD /* WebGPUImageCopyTexture.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUImageCopyTexture.serialization.in; sourceTree = ""; }; + 5CBA4AD529020A4300F70CCD /* WebGPUImageCopyExternalImage.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUImageCopyExternalImage.serialization.in; sourceTree = ""; }; + 5CBA4AD629020A4300F70CCD /* WebGPUImageCopyBuffer.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUImageCopyBuffer.serialization.in; sourceTree = ""; }; + 5CBA4AD729020A4400F70CCD /* WebGPUSamplerBindingLayout.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUSamplerBindingLayout.serialization.in; sourceTree = ""; }; + 5CBA4AD829020A4400F70CCD /* WebGPUSamplerDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUSamplerDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4AD929020A4400F70CCD /* WebGPUTextureViewDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUTextureViewDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4ADA29020A4400F70CCD /* WebGPUOrigin2D.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUOrigin2D.serialization.in; sourceTree = ""; }; + 5CBA4ADB29020A4400F70CCD /* WebGPURenderBundleDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPURenderBundleDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4ADC29020A4400F70CCD /* WebGPURenderPipelineDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPURenderPipelineDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4ADD29020A4400F70CCD /* WebGPUVertexState.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUVertexState.serialization.in; sourceTree = ""; }; + 5CBA4ADE29020A4500F70CCD /* WebGPUPrimitiveState.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUPrimitiveState.serialization.in; sourceTree = ""; }; + 5CBA4ADF29020A4500F70CCD /* WebGPUCompilationMessage.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUCompilationMessage.serialization.in; sourceTree = ""; }; + 5CBA4AE029020A4500F70CCD /* WebGPUCommandBufferDescriptor.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUCommandBufferDescriptor.serialization.in; sourceTree = ""; }; + 5CBA4AE129020A4500F70CCD /* WebGPUOutOfMemoryError.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUOutOfMemoryError.serialization.in; sourceTree = ""; }; + 5CBA4AE229020A4500F70CCD /* WebGPUBindGroupLayoutEntry.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUBindGroupLayoutEntry.serialization.in; sourceTree = ""; }; + 5CBA4AE329020A4500F70CCD /* WebGPUShaderModuleCompilationHint.serialization.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUShaderModuleCompilationHint.serialization.in; sourceTree = ""; }; 5CBC9B891C6524A500A8FDCF /* NetworkDataTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkDataTask.h; sourceTree = ""; }; 5CBC9B8B1C65257300A8FDCF /* NetworkDataTaskCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkDataTaskCocoa.mm; sourceTree = ""; }; 5CBE908F26D7FB62005A2E95 /* PrivateClickMeasurementDebugInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateClickMeasurementDebugInfo.h; sourceTree = ""; }; @@ -8791,13 +8832,16 @@ children = ( 1C98C0962746210E002CCB78 /* WebGPUBindGroupDescriptor.cpp */, 1CB7468B27439CB700F19874 /* WebGPUBindGroupDescriptor.h */, + 5CBA4ABB29020A3F00F70CCD /* WebGPUBindGroupDescriptor.serialization.in */, 1C98C0B02746267C002CCB78 /* WebGPUBindGroupEntry.cpp */, 1CB7468A27439CB600F19874 /* WebGPUBindGroupEntry.h */, 02F705E928D1CC51008C89EF /* WebGPUBindGroupEntry.serialization.in */, 1C98C0B12746267C002CCB78 /* WebGPUBindGroupLayoutDescriptor.cpp */, 1CB7466A27439CAF00F19874 /* WebGPUBindGroupLayoutDescriptor.h */, + 5CBA4ACC29020A4200F70CCD /* WebGPUBindGroupLayoutDescriptor.serialization.in */, 1C98C0CF27462681002CCB78 /* WebGPUBindGroupLayoutEntry.cpp */, 1CB7469527439CB900F19874 /* WebGPUBindGroupLayoutEntry.h */, + 5CBA4AE229020A4500F70CCD /* WebGPUBindGroupLayoutEntry.serialization.in */, 1C98C0C52746267F002CCB78 /* WebGPUBlendComponent.cpp */, 1CB7467827439CB200F19874 /* WebGPUBlendComponent.h */, 02F705E528D1C05C008C89EF /* WebGPUBlendComponent.serialization.in */, @@ -8812,6 +8856,7 @@ 02789EF628D3FC3200F77E40 /* WebGPUBufferBindingLayout.serialization.in */, 1C98C0A92746267B002CCB78 /* WebGPUBufferDescriptor.cpp */, 1CB7466627439CAE00F19874 /* WebGPUBufferDescriptor.h */, + 5CBA4AD129020A4200F70CCD /* WebGPUBufferDescriptor.serialization.in */, 1C98C09A27462678002CCB78 /* WebGPUCanvasConfiguration.cpp */, 1CB7467F27439CB400F19874 /* WebGPUCanvasConfiguration.h */, 02789EF728D3FF4800F77E40 /* WebGPUCanvasConfiguration.serialization.in */, @@ -8823,71 +8868,96 @@ 02789EF928D4055700F77E40 /* WebGPUColorTargetState.serialization.in */, 1C98C0A227462679002CCB78 /* WebGPUCommandBufferDescriptor.cpp */, 1CB7468327439CB500F19874 /* WebGPUCommandBufferDescriptor.h */, + 5CBA4AE029020A4500F70CCD /* WebGPUCommandBufferDescriptor.serialization.in */, 1C98C0BD2746267E002CCB78 /* WebGPUCommandEncoderDescriptor.cpp */, 1CB7469227439CB900F19874 /* WebGPUCommandEncoderDescriptor.h */, + 5CBA4AC929020A4100F70CCD /* WebGPUCommandEncoderDescriptor.serialization.in */, 1C98C0C827462680002CCB78 /* WebGPUCompilationMessage.cpp */, 1C98C07B2744B416002CCB78 /* WebGPUCompilationMessage.h */, + 5CBA4ADF29020A4500F70CCD /* WebGPUCompilationMessage.serialization.in */, 1C98C0D227462681002CCB78 /* WebGPUComputePassDescriptor.cpp */, 1CB7469727439CBA00F19874 /* WebGPUComputePassDescriptor.h */, + 5CBA4AC529020A4000F70CCD /* WebGPUComputePassDescriptor.serialization.in */, 1C98C0C22746267F002CCB78 /* WebGPUComputePassTimestampWrites.cpp */, 1CB7468927439CB600F19874 /* WebGPUComputePassTimestampWrites.h */, 02789EFB28D42E9900F77E40 /* WebGPUComputePassTimestampWrites.serialization.in */, 1C98C0C727462680002CCB78 /* WebGPUComputePipelineDescriptor.cpp */, 1CB7467627439CB100F19874 /* WebGPUComputePipelineDescriptor.h */, + 5CBA4AC129020A4000F70CCD /* WebGPUComputePipelineDescriptor.serialization.in */, 1CB746A42743ADBA00F19874 /* WebGPUConvertFromBackingContext.h */, 1CB7464727437A7F00F19874 /* WebGPUConvertToBackingContext.h */, 1C98C0B82746267D002CCB78 /* WebGPUDepthStencilState.cpp */, 1CB7467127439CB000F19874 /* WebGPUDepthStencilState.h */, + 5CBA4AC729020A4100F70CCD /* WebGPUDepthStencilState.serialization.in */, 1C98C0D727462682002CCB78 /* WebGPUDeviceDescriptor.cpp */, 1CB7468527439CB500F19874 /* WebGPUDeviceDescriptor.h */, + 5CBA4ACB29020A4100F70CCD /* WebGPUDeviceDescriptor.serialization.in */, 1C98C0C02746267E002CCB78 /* WebGPUError.cpp */, 1C98C07E2744B9DB002CCB78 /* WebGPUError.h */, 1C98C0B92746267D002CCB78 /* WebGPUExtent3D.cpp */, 1CB7468727439CB600F19874 /* WebGPUExtent3D.h */, + 5CBA4ABC29020A3F00F70CCD /* WebGPUExtent3D.serialization.in */, 1C98C0C42746267F002CCB78 /* WebGPUExternalTextureBindingLayout.cpp */, 1CB7466F27439CB000F19874 /* WebGPUExternalTextureBindingLayout.h */, + 5CBA4AC229020A4000F70CCD /* WebGPUExternalTextureBindingLayout.serialization.in */, 1C98C0BA2746267D002CCB78 /* WebGPUExternalTextureDescriptor.cpp */, 1CB7468627439CB500F19874 /* WebGPUExternalTextureDescriptor.h */, + 5CBA4AD329020A4300F70CCD /* WebGPUExternalTextureDescriptor.serialization.in */, 1C98C0BC2746267E002CCB78 /* WebGPUFragmentState.cpp */, 1CB7467A27439CB200F19874 /* WebGPUFragmentState.h */, + 5CBA4ACD29020A4200F70CCD /* WebGPUFragmentState.serialization.in */, 1CB7464927437FC500F19874 /* WebGPUIdentifier.h */, 1C98C0AD2746267B002CCB78 /* WebGPUImageCopyBuffer.cpp */, 1CB7467D27439CB300F19874 /* WebGPUImageCopyBuffer.h */, + 5CBA4AD629020A4300F70CCD /* WebGPUImageCopyBuffer.serialization.in */, 1C98C0C62746267F002CCB78 /* WebGPUImageCopyExternalImage.cpp */, 1CB7466827439CAE00F19874 /* WebGPUImageCopyExternalImage.h */, + 5CBA4AD529020A4300F70CCD /* WebGPUImageCopyExternalImage.serialization.in */, 1C98C0CE27462681002CCB78 /* WebGPUImageCopyTexture.cpp */, 1CB7469B27439CBB00F19874 /* WebGPUImageCopyTexture.h */, + 5CBA4AD429020A4300F70CCD /* WebGPUImageCopyTexture.serialization.in */, 1C98C09D27462678002CCB78 /* WebGPUImageCopyTextureTagged.cpp */, 1CB7467427439CB100F19874 /* WebGPUImageCopyTextureTagged.h */, + 5CBA4AC029020A4000F70CCD /* WebGPUImageCopyTextureTagged.serialization.in */, 1C98C0A32746267A002CCB78 /* WebGPUImageDataLayout.cpp */, 1CB7469F27439CBC00F19874 /* WebGPUImageDataLayout.h */, + 5CBA4AD229020A4300F70CCD /* WebGPUImageDataLayout.serialization.in */, 1C98C0C927462680002CCB78 /* WebGPUMultisampleState.cpp */, 1CB7466927439CAE00F19874 /* WebGPUMultisampleState.h */, + 5CBA4AC629020A4100F70CCD /* WebGPUMultisampleState.serialization.in */, 1C98C0D827462682002CCB78 /* WebGPUObjectDescriptorBase.cpp */, 1CB7466C27439CAF00F19874 /* WebGPUObjectDescriptorBase.h */, 02F705E328D1B4AD008C89EF /* WebGPUObjectDescriptorBase.serialization.in */, 1C98C0BF2746267E002CCB78 /* WebGPUOrigin2D.cpp */, 1CB7467027439CB000F19874 /* WebGPUOrigin2D.h */, + 5CBA4ADA29020A4400F70CCD /* WebGPUOrigin2D.serialization.in */, 1C98C0A027462679002CCB78 /* WebGPUOrigin3D.cpp */, 1CB746A027439CBD00F19874 /* WebGPUOrigin3D.h */, 5CAB7DE228B86FB8002282A6 /* WebGPUOrigin3D.serialization.in */, 1C98C0C12746267F002CCB78 /* WebGPUOutOfMemoryError.cpp */, 1C98C07C2744B991002CCB78 /* WebGPUOutOfMemoryError.h */, + 5CBA4AE129020A4500F70CCD /* WebGPUOutOfMemoryError.serialization.in */, 1C98C09F27462679002CCB78 /* WebGPUPipelineDescriptorBase.cpp */, 1CB7469427439CB900F19874 /* WebGPUPipelineDescriptorBase.h */, + 5CBA4ABD29020A3F00F70CCD /* WebGPUPipelineDescriptorBase.serialization.in */, 1C98C0B52746267D002CCB78 /* WebGPUPipelineLayoutDescriptor.cpp */, 1CB7469827439CBB00F19874 /* WebGPUPipelineLayoutDescriptor.h */, + 5CBA4ACE29020A4200F70CCD /* WebGPUPipelineLayoutDescriptor.serialization.in */, 1C98C09B27462678002CCB78 /* WebGPUPrimitiveState.cpp */, 1CB7466D27439CAF00F19874 /* WebGPUPrimitiveState.h */, + 5CBA4ADE29020A4500F70CCD /* WebGPUPrimitiveState.serialization.in */, 1C98C09C27462678002CCB78 /* WebGPUProgrammableStage.cpp */, 1CB7468827439CB600F19874 /* WebGPUProgrammableStage.h */, 02789F0028D4401D00F77E40 /* WebGPUProgrammableStage.serialization.in */, 1C98C0A127462679002CCB78 /* WebGPUQuerySetDescriptor.cpp */, 1CB7469E27439CBC00F19874 /* WebGPUQuerySetDescriptor.h */, + 5CBA4ACF29020A4200F70CCD /* WebGPUQuerySetDescriptor.serialization.in */, 1C98C0B42746267C002CCB78 /* WebGPURenderBundleDescriptor.cpp */, 1CB7468227439CB400F19874 /* WebGPURenderBundleDescriptor.h */, + 5CBA4ADB29020A4400F70CCD /* WebGPURenderBundleDescriptor.serialization.in */, 1C98C0A82746267A002CCB78 /* WebGPURenderBundleEncoderDescriptor.cpp */, 1CB7467B27439CB300F19874 /* WebGPURenderBundleEncoderDescriptor.h */, + 5CBA4ABE29020A3F00F70CCD /* WebGPURenderBundleEncoderDescriptor.serialization.in */, 1C98C0D627462682002CCB78 /* WebGPURenderPassColorAttachment.cpp */, 1CB7469D27439CBC00F19874 /* WebGPURenderPassColorAttachment.h */, 02789F0128D4453300F77E40 /* WebGPURenderPassColorAttachment.serialization.in */, @@ -8896,28 +8966,37 @@ 02789F0228D4491600F77E40 /* WebGPURenderPassDepthStencilAttachment.serialization.in */, 1C98C0A72746267A002CCB78 /* WebGPURenderPassDescriptor.cpp */, 1CB7466E27439CB000F19874 /* WebGPURenderPassDescriptor.h */, + 5CBA4AC829020A4100F70CCD /* WebGPURenderPassDescriptor.serialization.in */, 1C98C0C32746267F002CCB78 /* WebGPURenderPassLayout.cpp */, 1CB7469127439CB800F19874 /* WebGPURenderPassLayout.h */, + 5CBA4AD029020A4200F70CCD /* WebGPURenderPassLayout.serialization.in */, 1C98C09E27462679002CCB78 /* WebGPURenderPassTimestampWrites.cpp */, 1CB7469927439CBB00F19874 /* WebGPURenderPassTimestampWrites.h */, 02789F0328D44B8F00F77E40 /* WebGPURenderPassTimestampWrites.serialization.in */, 1C98C0D527462682002CCB78 /* WebGPURenderPipelineDescriptor.cpp */, 1CB7468E27439CB800F19874 /* WebGPURenderPipelineDescriptor.h */, + 5CBA4ADC29020A4400F70CCD /* WebGPURenderPipelineDescriptor.serialization.in */, 1C98C0D127462681002CCB78 /* WebGPURequestAdapterOptions.cpp */, 1CB7468C27439CB700F19874 /* WebGPURequestAdapterOptions.h */, + 5CBA4AC329020A4000F70CCD /* WebGPURequestAdapterOptions.serialization.in */, 1C98C0B72746267D002CCB78 /* WebGPUSamplerBindingLayout.cpp */, 1CB7466727439CAE00F19874 /* WebGPUSamplerBindingLayout.h */, + 5CBA4AD729020A4400F70CCD /* WebGPUSamplerBindingLayout.serialization.in */, 1C98C0CC27462680002CCB78 /* WebGPUSamplerDescriptor.cpp */, 1CB7468D27439CB700F19874 /* WebGPUSamplerDescriptor.h */, + 5CBA4AD829020A4400F70CCD /* WebGPUSamplerDescriptor.serialization.in */, 1CEF45BB27BCA46A00C3A6BC /* WebGPUShaderModuleCompilationHint.cpp */, 1CEF45BC27BCA46A00C3A6BC /* WebGPUShaderModuleCompilationHint.h */, + 5CBA4AE329020A4500F70CCD /* WebGPUShaderModuleCompilationHint.serialization.in */, 1C98C09927462678002CCB78 /* WebGPUShaderModuleDescriptor.cpp */, 1CB7466B27439CAF00F19874 /* WebGPUShaderModuleDescriptor.h */, + 5CBA4ABF29020A3F00F70CCD /* WebGPUShaderModuleDescriptor.serialization.in */, 1C98C0CA27462680002CCB78 /* WebGPUStencilFaceState.cpp */, 1CB7467327439CB100F19874 /* WebGPUStencilFaceState.h */, 02789EFD28D432B600F77E40 /* WebGPUStencilFaceState.serialization.in */, 1C98C0B62746267D002CCB78 /* WebGPUStorageTextureBindingLayout.cpp */, 1CB7469627439CBA00F19874 /* WebGPUStorageTextureBindingLayout.h */, + 5CBA4ACA29020A4100F70CCD /* WebGPUStorageTextureBindingLayout.serialization.in */, 1C98C0D327462682002CCB78 /* WebGPUSupportedFeatures.cpp */, 1C98C0792744A1CC002CCB78 /* WebGPUSupportedFeatures.h */, 0237C21428C168D10018A851 /* WebGPUSupportedFeatures.serialization.in */, @@ -8929,8 +9008,10 @@ 02789EFF28D4388D00F77E40 /* WebGPUTextureBindingLayout.serialization.in */, 1C98C0AE2746267B002CCB78 /* WebGPUTextureDescriptor.cpp */, 1CB7468127439CB400F19874 /* WebGPUTextureDescriptor.h */, + 5CBA4AC429020A4000F70CCD /* WebGPUTextureDescriptor.serialization.in */, 1C98C0CB27462680002CCB78 /* WebGPUTextureViewDescriptor.cpp */, 1CB7468027439CB400F19874 /* WebGPUTextureViewDescriptor.h */, + 5CBA4AD929020A4400F70CCD /* WebGPUTextureViewDescriptor.serialization.in */, 1C98C09827462678002CCB78 /* WebGPUValidationError.cpp */, 1C98C07D2744B9B7002CCB78 /* WebGPUValidationError.h */, 5CD4F01B28B6A20700F9ECEA /* WebGPUValidationError.serialization.in */, @@ -8942,6 +9023,7 @@ 02789F0528D44ED800F77E40 /* WebGPUVertexBufferLayout.serialization.in */, 1C98C0CD27462681002CCB78 /* WebGPUVertexState.cpp */, 1CB7469A27439CBB00F19874 /* WebGPUVertexState.h */, + 5CBA4ADD29020A4400F70CCD /* WebGPUVertexState.serialization.in */, ); path = WebGPU; sourceTree = "";