summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/modules/webgpu/gpu_texture_usage.cc
blob: bd6d3c4e90edab1272556571df139fa1411d3071 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/modules/webgpu/gpu_texture_usage.h"

#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"

namespace blink {

namespace {
void AddConsoleWarning(ExecutionContext* execution_context,
                       const char* message) {
  if (execution_context) {
    auto* console_message = MakeGarbageCollected<ConsoleMessage>(
        mojom::blink::ConsoleMessageSource::kRendering,
        mojom::blink::ConsoleMessageLevel::kWarning, message);
    execution_context->AddConsoleMessage(console_message);
  }
}
}  // namespace

// static
unsigned GPUTextureUsage::SAMPLED(ExecutionContext* execution_context) {
  AddConsoleWarning(execution_context,
                    "GPUTextureUsage.SAMPLED is deprecated. "
                    "Use GPUTextureUsage.TEXTURE_BINDING instead.");
  return kTextureBinding;
}

// static
unsigned GPUTextureUsage::STORAGE(ExecutionContext* execution_context) {
  AddConsoleWarning(execution_context,
                    "GPUTextureUsage.STORAGE is deprecated. "
                    "Use GPUTextureUsage.STORAGE_BINDING instead.");
  return kStorageBinding;
}

}  // namespace blink