Rename AdapterGL -> PhysicalDeviceGL.

Bug: dawn:1774

Change-Id: Ic137524027eb519af4cb46396b9a8cea9e4cb7f4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130420
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White 2023-05-01 21:51:16 +00:00 committed by Dawn LUCI CQ
parent 556147c333
commit 8076b2ad73
6 changed files with 31 additions and 30 deletions

View File

@ -620,8 +620,6 @@ source_set("sources") {
] ]
sources += get_target_outputs(":opengl_loader_gen") sources += get_target_outputs(":opengl_loader_gen")
sources += [ sources += [
"opengl/AdapterGL.cpp",
"opengl/AdapterGL.h",
"opengl/BackendGL.cpp", "opengl/BackendGL.cpp",
"opengl/BackendGL.h", "opengl/BackendGL.h",
"opengl/BindGroupGL.cpp", "opengl/BindGroupGL.cpp",
@ -649,6 +647,8 @@ source_set("sources") {
"opengl/OpenGLVersion.h", "opengl/OpenGLVersion.h",
"opengl/PersistentPipelineStateGL.cpp", "opengl/PersistentPipelineStateGL.cpp",
"opengl/PersistentPipelineStateGL.h", "opengl/PersistentPipelineStateGL.h",
"opengl/PhysicalDeviceGL.cpp",
"opengl/PhysicalDeviceGL.h",
"opengl/PipelineGL.cpp", "opengl/PipelineGL.cpp",
"opengl/PipelineGL.h", "opengl/PipelineGL.h",
"opengl/PipelineLayoutGL.cpp", "opengl/PipelineLayoutGL.cpp",

View File

@ -488,8 +488,6 @@ if (DAWN_ENABLE_OPENGL)
target_sources(dawn_native PRIVATE target_sources(dawn_native PRIVATE
"${DAWN_INCLUDE_DIR}/dawn/native/OpenGLBackend.h" "${DAWN_INCLUDE_DIR}/dawn/native/OpenGLBackend.h"
${DAWN_NATIVE_OPENGL_AUTOGEN_SOURCES} ${DAWN_NATIVE_OPENGL_AUTOGEN_SOURCES}
"opengl/AdapterGL.cpp"
"opengl/AdapterGL.h"
"opengl/BackendGL.cpp" "opengl/BackendGL.cpp"
"opengl/BackendGL.h" "opengl/BackendGL.h"
"opengl/BindGroupGL.cpp" "opengl/BindGroupGL.cpp"
@ -517,6 +515,8 @@ if (DAWN_ENABLE_OPENGL)
"opengl/OpenGLVersion.h" "opengl/OpenGLVersion.h"
"opengl/PersistentPipelineStateGL.cpp" "opengl/PersistentPipelineStateGL.cpp"
"opengl/PersistentPipelineStateGL.h" "opengl/PersistentPipelineStateGL.h"
"opengl/PhysicalDeviceGL.cpp"
"opengl/PhysicalDeviceGL.h"
"opengl/PipelineGL.cpp" "opengl/PipelineGL.cpp"
"opengl/PipelineGL.h" "opengl/PipelineGL.h"
"opengl/PipelineLayoutGL.cpp" "opengl/PipelineLayoutGL.cpp"

View File

@ -22,9 +22,9 @@
#include "dawn/common/SystemUtils.h" #include "dawn/common/SystemUtils.h"
#include "dawn/native/Instance.h" #include "dawn/native/Instance.h"
#include "dawn/native/OpenGLBackend.h" #include "dawn/native/OpenGLBackend.h"
#include "dawn/native/opengl/AdapterGL.h"
#include "dawn/native/opengl/ContextEGL.h" #include "dawn/native/opengl/ContextEGL.h"
#include "dawn/native/opengl/EGLFunctions.h" #include "dawn/native/opengl/EGLFunctions.h"
#include "dawn/native/opengl/PhysicalDeviceGL.h"
namespace dawn::native::opengl { namespace dawn::native::opengl {
@ -97,7 +97,7 @@ ResultOrError<std::vector<Ref<PhysicalDeviceBase>>> Backend::DiscoverAdapters(
DAWN_INVALID_IF(options->getProc == nullptr, "AdapterDiscoveryOptions::getProc must be set"); DAWN_INVALID_IF(options->getProc == nullptr, "AdapterDiscoveryOptions::getProc must be set");
Ref<Adapter> adapter = AcquireRef(new Adapter( Ref<PhysicalDevice> adapter = AcquireRef(new PhysicalDevice(
GetInstance(), static_cast<wgpu::BackendType>(optionsBase->backendType), adapterToggles)); GetInstance(), static_cast<wgpu::BackendType>(optionsBase->backendType), adapterToggles));
DAWN_TRY(adapter->InitializeGLFunctions(options->getProc)); DAWN_TRY(adapter->InitializeGLFunctions(options->getProc));
DAWN_TRY(adapter->Initialize()); DAWN_TRY(adapter->Initialize());

View File

@ -19,7 +19,6 @@
namespace dawn::native::opengl { namespace dawn::native::opengl {
class Adapter;
class BindGroup; class BindGroup;
class BindGroupLayout; class BindGroupLayout;
class Buffer; class Buffer;
@ -27,6 +26,7 @@ class CommandBuffer;
class ComputePipeline; class ComputePipeline;
class Device; class Device;
class PersistentPipelineState; class PersistentPipelineState;
class PhysicalDevice;
class PipelineLayout; class PipelineLayout;
class QuerySet; class QuerySet;
class Queue; class Queue;
@ -38,7 +38,7 @@ class Texture;
class TextureView; class TextureView;
struct OpenGLBackendTraits { struct OpenGLBackendTraits {
using AdapterType = Adapter; using PhysicalDeviceType = PhysicalDevice;
using BindGroupType = BindGroup; using BindGroupType = BindGroup;
using BindGroupLayoutType = BindGroupLayout; using BindGroupLayoutType = BindGroupLayout;
using BufferType = Buffer; using BufferType = Buffer;

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "dawn/native/opengl/AdapterGL.h" #include "dawn/native/opengl/PhysicalDeviceGL.h"
#include <memory> #include <memory>
#include <string> #include <string>
@ -53,23 +53,23 @@ uint32_t GetVendorIdFromVendors(const char* vendor) {
} // anonymous namespace } // anonymous namespace
Adapter::Adapter(InstanceBase* instance, PhysicalDevice::PhysicalDevice(InstanceBase* instance,
wgpu::BackendType backendType, wgpu::BackendType backendType,
const TogglesState& adapterToggle) const TogglesState& adapterToggle)
: PhysicalDeviceBase(instance, backendType, adapterToggle) {} : PhysicalDeviceBase(instance, backendType, adapterToggle) {}
MaybeError Adapter::InitializeGLFunctions(void* (*getProc)(const char*)) { MaybeError PhysicalDevice::InitializeGLFunctions(void* (*getProc)(const char*)) {
// Use getProc to populate the dispatch table // Use getProc to populate the dispatch table
mEGLFunctions.Init(getProc); mEGLFunctions.Init(getProc);
return mFunctions.Initialize(getProc); return mFunctions.Initialize(getProc);
} }
bool Adapter::SupportsExternalImages() const { bool PhysicalDevice::SupportsExternalImages() const {
// Via dawn::native::opengl::WrapExternalEGLImage // Via dawn::native::opengl::WrapExternalEGLImage
return GetBackendType() == wgpu::BackendType::OpenGLES; return GetBackendType() == wgpu::BackendType::OpenGLES;
} }
MaybeError Adapter::InitializeImpl() { MaybeError PhysicalDevice::InitializeImpl() {
if (mFunctions.GetVersion().IsES()) { if (mFunctions.GetVersion().IsES()) {
ASSERT(GetBackendType() == wgpu::BackendType::OpenGLES); ASSERT(GetBackendType() == wgpu::BackendType::OpenGLES);
} else { } else {
@ -92,7 +92,7 @@ MaybeError Adapter::InitializeImpl() {
return {}; return {};
} }
void Adapter::InitializeSupportedFeaturesImpl() { void PhysicalDevice::InitializeSupportedFeaturesImpl() {
// TextureCompressionBC // TextureCompressionBC
{ {
// BC1, BC2 and BC3 are not supported in OpenGL or OpenGL ES core features. // BC1, BC2 and BC3 are not supported in OpenGL or OpenGL ES core features.
@ -149,12 +149,12 @@ void Adapter::InitializeSupportedFeaturesImpl() {
} }
} }
MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) { MaybeError PhysicalDevice::InitializeSupportedLimitsImpl(CombinedLimits* limits) {
GetDefaultLimits(&limits->v1); GetDefaultLimits(&limits->v1);
return {}; return {};
} }
void Adapter::SetupBackendDeviceToggles(TogglesState* deviceToggles) const { void PhysicalDevice::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {
const OpenGLFunctions& gl = mFunctions; const OpenGLFunctions& gl = mFunctions;
bool supportsBaseVertex = gl.IsAtLeastGLES(3, 2) || gl.IsAtLeastGL(3, 2); bool supportsBaseVertex = gl.IsAtLeastGLES(3, 2) || gl.IsAtLeastGL(3, 2);
@ -217,8 +217,8 @@ void Adapter::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {
gl.GetVersion().IsES()); gl.GetVersion().IsES());
} }
ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor, ResultOrError<Ref<DeviceBase>> PhysicalDevice::CreateDeviceImpl(const DeviceDescriptor* descriptor,
const TogglesState& deviceToggles) { const TogglesState& deviceToggles) {
EGLenum api = EGLenum api =
GetBackendType() == wgpu::BackendType::OpenGL ? EGL_OPENGL_API : EGL_OPENGL_ES_API; GetBackendType() == wgpu::BackendType::OpenGL ? EGL_OPENGL_API : EGL_OPENGL_ES_API;
std::unique_ptr<Device::Context> context; std::unique_ptr<Device::Context> context;
@ -226,8 +226,9 @@ ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor*
return Device::Create(this, descriptor, mFunctions, std::move(context), deviceToggles); return Device::Create(this, descriptor, mFunctions, std::move(context), deviceToggles);
} }
MaybeError Adapter::ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName feature, MaybeError PhysicalDevice::ValidateFeatureSupportedWithTogglesImpl(
const TogglesState& toggles) const { wgpu::FeatureName feature,
const TogglesState& toggles) const {
return {}; return {};
} }
} // namespace dawn::native::opengl } // namespace dawn::native::opengl

View File

@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#ifndef SRC_DAWN_NATIVE_OPENGL_ADAPTERGL_H_ #ifndef SRC_DAWN_NATIVE_OPENGL_PHYSICALDEVICEGL_H_
#define SRC_DAWN_NATIVE_OPENGL_ADAPTERGL_H_ #define SRC_DAWN_NATIVE_OPENGL_PHYSICALDEVICEGL_H_
#include "dawn/native/PhysicalDevice.h" #include "dawn/native/PhysicalDevice.h"
#include "dawn/native/opengl/EGLFunctions.h" #include "dawn/native/opengl/EGLFunctions.h"
@ -21,15 +21,15 @@
namespace dawn::native::opengl { namespace dawn::native::opengl {
class Adapter : public PhysicalDeviceBase { class PhysicalDevice : public PhysicalDeviceBase {
public: public:
Adapter(InstanceBase* instance, PhysicalDevice(InstanceBase* instance,
wgpu::BackendType backendType, wgpu::BackendType backendType,
const TogglesState& adapterToggle); const TogglesState& adapterToggle);
MaybeError InitializeGLFunctions(void* (*getProc)(const char*)); MaybeError InitializeGLFunctions(void* (*getProc)(const char*));
~Adapter() override = default; ~PhysicalDevice() override = default;
// PhysicalDeviceBase Implementation // PhysicalDeviceBase Implementation
bool SupportsExternalImages() const override; bool SupportsExternalImages() const override;
@ -52,4 +52,4 @@ class Adapter : public PhysicalDeviceBase {
} // namespace dawn::native::opengl } // namespace dawn::native::opengl
#endif // SRC_DAWN_NATIVE_OPENGL_ADAPTERGL_H_ #endif // SRC_DAWN_NATIVE_OPENGL_PHYSICALDEVICEGL_H_