#include "dawn/native/CopyTextureForBrowserHelper.h"
#include <utility>
#include "dawn/common/Log.h"
#include "dawn/native/BindGroup.h"
#include "dawn/native/BindGroupLayout.h"
#include "dawn/native/Buffer.h"
#include "dawn/native/CommandBuffer.h"
#include "dawn/native/CommandEncoder.h"
#include "dawn/native/CommandValidation.h"
#include "dawn/native/Device.h"
#include "dawn/native/ExternalTexture.h"
#include "dawn/native/InternalPipelineStore.h"
#include "dawn/native/Queue.h"
#include "dawn/native/RenderPassEncoder.h"
#include "dawn/native/RenderPipeline.h"
#include "dawn/native/Sampler.h"
#include "dawn/native/Texture.h"
#include "dawn/native/ValidationUtils_autogen.h"
#include "dawn/native/utils/WGPUHelpers.h"
namespace dawn::native {
namespace {
static const char sCopyForBrowserShader[] = …;
struct GammaTransferParamsInternal { … };
struct Uniform { … };
static_assert …;
enum class SourceTextureType { … };
struct TextureInfo { … };
MaybeError ValidateCopyTextureSourceFormat(const wgpu::TextureFormat srcFormat) { … }
MaybeError ValidateCopyForBrowserDestinationFormat(const wgpu::TextureFormat dstFormat) { … }
RenderPipelineBase* GetCachedCopyTexturePipeline(InternalPipelineStore* store,
wgpu::TextureFormat dstFormat) { … }
RenderPipelineBase* GetCachedCopyExternalTexturePipeline(InternalPipelineStore* store,
wgpu::TextureFormat dstFormat) { … }
ResultOrError<Ref<RenderPipelineBase>> CreateCopyForBrowserPipeline(
DeviceBase* device,
wgpu::TextureFormat dstFormat,
ShaderModuleBase* shaderModule,
const char* fragmentEntryPoint) { … }
ResultOrError<ShaderModuleBase*> GetOrCreateCopyForBrowserShaderModule(
DeviceBase* device,
InternalPipelineStore* store) { … }
ResultOrError<RenderPipelineBase*> GetOrCreateCopyTextureForBrowserPipeline(
DeviceBase* device,
wgpu::TextureFormat dstFormat) { … }
ResultOrError<RenderPipelineBase*> GetOrCreateCopyExternalTextureForBrowserPipeline(
DeviceBase* device,
wgpu::TextureFormat dstFormat) { … }
bool IsSrgbDstFormat(wgpu::TextureFormat format) { … }
template <typename T>
MaybeError DoCopyForBrowser(DeviceBase* device,
const TextureInfo* sourceInfo,
T* sourceResource,
const ImageCopyTexture* destination,
const Extent3D* copySize,
const CopyTextureForBrowserOptions* options,
RenderPipelineBase* pipeline) { … }
MaybeError ValidateCopyForBrowserDestination(DeviceBase* device,
const ImageCopyTexture& destination,
const Extent3D& copySize,
const CopyTextureForBrowserOptions& options) { … }
MaybeError ValidateCopyForBrowserOptions(const CopyTextureForBrowserOptions& options) { … }
}
MaybeError ValidateCopyTextureForBrowser(DeviceBase* device,
const ImageCopyTexture* source,
const ImageCopyTexture* destination,
const Extent3D* copySize,
const CopyTextureForBrowserOptions* options) { … }
MaybeError ValidateCopyExternalTextureForBrowser(DeviceBase* device,
const ImageCopyExternalTexture* source,
const ImageCopyTexture* destination,
const Extent3D* copySize,
const CopyTextureForBrowserOptions* options) { … }
MaybeError DoCopyExternalTextureForBrowser(DeviceBase* device,
const ImageCopyExternalTexture* source,
const ImageCopyTexture* destination,
const Extent3D* copySize,
const CopyTextureForBrowserOptions* options) { … }
MaybeError DoCopyTextureForBrowser(DeviceBase* device,
const ImageCopyTexture* source,
const ImageCopyTexture* destination,
const Extent3D* copySize,
const CopyTextureForBrowserOptions* options) { … }
}