Make CreateRenderPipelineAsync use Descriptor2
Since it isn't used by anyone yet we can make a breaking change to CreateRenderPipelineAsync to immediately start using RenderPipelineDescriptor2. Bug: dawn:1177501 Change-Id: I9f88c6fc1b325b7a9356536e2a071d4f17abd6ea Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45280 Commit-Queue: Brandon Jones <bajones@chromium.org> Auto-Submit: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Brandon Jones <bajones@chromium.org>
This commit is contained in:
parent
6b80743d3f
commit
8ac6a481a3
|
@ -703,7 +703,7 @@
|
|||
"name": "create render pipeline async",
|
||||
"returns": "void",
|
||||
"args": [
|
||||
{"name": "descriptor", "type": "render pipeline descriptor", "annotation": "const*"},
|
||||
{"name": "descriptor", "type": "render pipeline descriptor 2", "annotation": "const*"},
|
||||
{"name": "callback", "type": "create render pipeline async callback"},
|
||||
{"name": "userdata", "type": "void", "annotation": "*"}
|
||||
]
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
{ "name": "device id", "type": "ObjectId" },
|
||||
{ "name": "request serial", "type": "uint64_t" },
|
||||
{ "name": "pipeline object handle", "type": "ObjectHandle", "handle_type": "render pipeline"},
|
||||
{ "name": "descriptor", "type": "render pipeline descriptor", "annotation": "const*"}
|
||||
{ "name": "descriptor", "type": "render pipeline descriptor 2", "annotation": "const*"}
|
||||
],
|
||||
"device pop error scope": [
|
||||
{ "name": "device id", "type": "ObjectId" },
|
||||
|
|
|
@ -758,7 +758,7 @@ namespace dawn_native {
|
|||
|
||||
return result;
|
||||
}
|
||||
void DeviceBase::CreateRenderPipelineAsync(const RenderPipelineDescriptor* descriptor,
|
||||
void DeviceBase::CreateRenderPipelineAsync(const RenderPipelineDescriptor2* descriptor,
|
||||
WGPUCreateRenderPipelineAsyncCallback callback,
|
||||
void* userdata) {
|
||||
RenderPipelineBase* result = nullptr;
|
||||
|
|
|
@ -149,7 +149,7 @@ namespace dawn_native {
|
|||
void CreateComputePipelineAsync(const ComputePipelineDescriptor* descriptor,
|
||||
WGPUCreateComputePipelineAsyncCallback callback,
|
||||
void* userdata);
|
||||
void CreateRenderPipelineAsync(const RenderPipelineDescriptor* descriptor,
|
||||
void CreateRenderPipelineAsync(const RenderPipelineDescriptor2* descriptor,
|
||||
WGPUCreateRenderPipelineAsyncCallback callback,
|
||||
void* userdata);
|
||||
RenderBundleEncoder* CreateRenderBundleEncoder(
|
||||
|
|
|
@ -277,7 +277,7 @@ namespace dawn_wire { namespace client {
|
|||
return true;
|
||||
}
|
||||
|
||||
void Device::CreateRenderPipelineAsync(WGPURenderPipelineDescriptor const* descriptor,
|
||||
void Device::CreateRenderPipelineAsync(WGPURenderPipelineDescriptor2 const* descriptor,
|
||||
WGPUCreateRenderPipelineAsyncCallback callback,
|
||||
void* userdata) {
|
||||
if (client->IsDisconnected()) {
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace dawn_wire { namespace client {
|
|||
void CreateComputePipelineAsync(WGPUComputePipelineDescriptor const* descriptor,
|
||||
WGPUCreateComputePipelineAsyncCallback callback,
|
||||
void* userdata);
|
||||
void CreateRenderPipelineAsync(WGPURenderPipelineDescriptor const* descriptor,
|
||||
void CreateRenderPipelineAsync(WGPURenderPipelineDescriptor2 const* descriptor,
|
||||
WGPUCreateRenderPipelineAsyncCallback callback,
|
||||
void* userdata);
|
||||
|
||||
|
|
|
@ -149,10 +149,11 @@ namespace dawn_wire { namespace server {
|
|||
SerializeCommand(cmd);
|
||||
}
|
||||
|
||||
bool Server::DoDeviceCreateRenderPipelineAsync(ObjectId deviceId,
|
||||
uint64_t requestSerial,
|
||||
ObjectHandle pipelineObjectHandle,
|
||||
const WGPURenderPipelineDescriptor* descriptor) {
|
||||
bool Server::DoDeviceCreateRenderPipelineAsync(
|
||||
ObjectId deviceId,
|
||||
uint64_t requestSerial,
|
||||
ObjectHandle pipelineObjectHandle,
|
||||
const WGPURenderPipelineDescriptor2* descriptor) {
|
||||
auto* device = DeviceObjects().Get(deviceId);
|
||||
if (device == nullptr) {
|
||||
return false;
|
||||
|
|
|
@ -137,7 +137,7 @@ TEST_P(CreatePipelineAsyncTest, CreateComputePipelineFailed) {
|
|||
TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateRenderPipelineAsync) {
|
||||
constexpr wgpu::TextureFormat kRenderAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
|
||||
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
|
@ -148,10 +148,10 @@ TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateRenderPipelineAsync) {
|
|||
[[stage(fragment)]] fn main() -> void {
|
||||
o_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||
})");
|
||||
renderPipelineDescriptor.vertexStage.module = vsModule;
|
||||
renderPipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
renderPipelineDescriptor.cColorStates[0].format = kRenderAttachmentFormat;
|
||||
renderPipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
renderPipelineDescriptor.vertex.module = vsModule;
|
||||
renderPipelineDescriptor.cFragment.module = fsModule;
|
||||
renderPipelineDescriptor.cTargets[0].format = kRenderAttachmentFormat;
|
||||
renderPipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
|
||||
device.CreateRenderPipelineAsync(
|
||||
&renderPipelineDescriptor,
|
||||
|
@ -207,7 +207,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineFailed) {
|
|||
|
||||
constexpr wgpu::TextureFormat kRenderAttachmentFormat = wgpu::TextureFormat::Depth32Float;
|
||||
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
|
@ -218,10 +218,10 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineFailed) {
|
|||
[[stage(fragment)]] fn main() -> void {
|
||||
o_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||
})");
|
||||
renderPipelineDescriptor.vertexStage.module = vsModule;
|
||||
renderPipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
renderPipelineDescriptor.cColorStates[0].format = kRenderAttachmentFormat;
|
||||
renderPipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
renderPipelineDescriptor.vertex.module = vsModule;
|
||||
renderPipelineDescriptor.cFragment.module = fsModule;
|
||||
renderPipelineDescriptor.cTargets[0].format = kRenderAttachmentFormat;
|
||||
renderPipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
|
||||
device.CreateRenderPipelineAsync(
|
||||
&renderPipelineDescriptor,
|
||||
|
@ -271,7 +271,7 @@ TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateComputePipeli
|
|||
// Verify there is no error when the device is released before the callback of
|
||||
// CreateRenderPipelineAsync() is called.
|
||||
TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateRenderPipelineAsync) {
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
|
@ -282,10 +282,10 @@ TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateRenderPipelin
|
|||
[[stage(fragment)]] fn main() -> void {
|
||||
o_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||
})");
|
||||
renderPipelineDescriptor.vertexStage.module = vsModule;
|
||||
renderPipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
renderPipelineDescriptor.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
renderPipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
renderPipelineDescriptor.vertex.module = vsModule;
|
||||
renderPipelineDescriptor.cFragment.module = fsModule;
|
||||
renderPipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
renderPipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
|
||||
device.CreateRenderPipelineAsync(
|
||||
&renderPipelineDescriptor,
|
||||
|
|
|
@ -235,21 +235,21 @@ TEST_F(UnsafeAPIValidationTest, CreateComputePipelineAsyncDisallowed) {
|
|||
|
||||
// Check that CreateRenderPipelineAsync is disallowed as part of unsafe APIs
|
||||
TEST_F(UnsafeAPIValidationTest, CreateRenderPipelineAsyncDisallowed) {
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
desc.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
utils::ComboRenderPipelineDescriptor2 desc;
|
||||
desc.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
})");
|
||||
desc.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
desc.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[location(0)]] var<out> o_color : vec4<f32>;
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
o_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||
})");
|
||||
desc.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
desc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
|
||||
// Control case: CreateRenderPipeline is allowed.
|
||||
device.CreateRenderPipeline(&desc);
|
||||
device.CreateRenderPipeline2(&desc);
|
||||
// TODO(bajones): Enable this when the deprecation warning is re-enabled in Device.cpp.
|
||||
// EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&desc));
|
||||
|
||||
|
|
|
@ -157,14 +157,14 @@ TEST_F(WireCreatePipelineAsyncTest, CreateRenderPipelineAsyncSuccess) {
|
|||
WGPUShaderModule apiVsModule = api.GetNewShaderModule();
|
||||
EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiVsModule));
|
||||
|
||||
WGPURenderPipelineDescriptor pipelineDescriptor{};
|
||||
pipelineDescriptor.vertexStage.module = vsModule;
|
||||
pipelineDescriptor.vertexStage.entryPoint = "main";
|
||||
WGPURenderPipelineDescriptor2 pipelineDescriptor{};
|
||||
pipelineDescriptor.vertex.module = vsModule;
|
||||
pipelineDescriptor.vertex.entryPoint = "main";
|
||||
|
||||
WGPUProgrammableStageDescriptor fragmentStage = {};
|
||||
fragmentStage.module = vsModule;
|
||||
fragmentStage.entryPoint = "main";
|
||||
pipelineDescriptor.fragmentStage = &fragmentStage;
|
||||
WGPUFragmentState fragment = {};
|
||||
fragment.module = vsModule;
|
||||
fragment.entryPoint = "main";
|
||||
pipelineDescriptor.fragment = &fragment;
|
||||
|
||||
wgpuDeviceCreateRenderPipelineAsync(device, &pipelineDescriptor,
|
||||
ToMockCreateRenderPipelineAsyncCallback, this);
|
||||
|
@ -190,14 +190,14 @@ TEST_F(WireCreatePipelineAsyncTest, CreateRenderPipelineAsyncError) {
|
|||
WGPUShaderModule apiVsModule = api.GetNewShaderModule();
|
||||
EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiVsModule));
|
||||
|
||||
WGPURenderPipelineDescriptor pipelineDescriptor{};
|
||||
pipelineDescriptor.vertexStage.module = vsModule;
|
||||
pipelineDescriptor.vertexStage.entryPoint = "main";
|
||||
WGPURenderPipelineDescriptor2 pipelineDescriptor{};
|
||||
pipelineDescriptor.vertex.module = vsModule;
|
||||
pipelineDescriptor.vertex.entryPoint = "main";
|
||||
|
||||
WGPUProgrammableStageDescriptor fragmentStage = {};
|
||||
fragmentStage.module = vsModule;
|
||||
fragmentStage.entryPoint = "main";
|
||||
pipelineDescriptor.fragmentStage = &fragmentStage;
|
||||
WGPUFragmentState fragment = {};
|
||||
fragment.module = vsModule;
|
||||
fragment.entryPoint = "main";
|
||||
pipelineDescriptor.fragment = &fragment;
|
||||
|
||||
wgpuDeviceCreateRenderPipelineAsync(device, &pipelineDescriptor,
|
||||
ToMockCreateRenderPipelineAsyncCallback, this);
|
||||
|
@ -224,14 +224,14 @@ TEST_F(WireCreatePipelineAsyncTest, CreateRenderPipelineAsyncThenDisconnect) {
|
|||
WGPUShaderModule apiVsModule = api.GetNewShaderModule();
|
||||
EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiVsModule));
|
||||
|
||||
WGPUProgrammableStageDescriptor fragmentStage = {};
|
||||
fragmentStage.module = vsModule;
|
||||
fragmentStage.entryPoint = "main";
|
||||
WGPUFragmentState fragment = {};
|
||||
fragment.module = vsModule;
|
||||
fragment.entryPoint = "main";
|
||||
|
||||
WGPURenderPipelineDescriptor pipelineDescriptor{};
|
||||
pipelineDescriptor.vertexStage.module = vsModule;
|
||||
pipelineDescriptor.vertexStage.entryPoint = "main";
|
||||
pipelineDescriptor.fragmentStage = &fragmentStage;
|
||||
WGPURenderPipelineDescriptor2 pipelineDescriptor{};
|
||||
pipelineDescriptor.vertex.module = vsModule;
|
||||
pipelineDescriptor.vertex.entryPoint = "main";
|
||||
pipelineDescriptor.fragment = &fragment;
|
||||
|
||||
wgpuDeviceCreateRenderPipelineAsync(device, &pipelineDescriptor,
|
||||
ToMockCreateRenderPipelineAsyncCallback, this);
|
||||
|
@ -285,14 +285,14 @@ TEST_F(WireCreatePipelineAsyncTest, CreateRenderPipelineAsyncAfterDisconnect) {
|
|||
WGPUShaderModule apiVsModule = api.GetNewShaderModule();
|
||||
EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiVsModule));
|
||||
|
||||
WGPUProgrammableStageDescriptor fragmentStage = {};
|
||||
fragmentStage.module = vsModule;
|
||||
fragmentStage.entryPoint = "main";
|
||||
WGPUFragmentState fragment = {};
|
||||
fragment.module = vsModule;
|
||||
fragment.entryPoint = "main";
|
||||
|
||||
WGPURenderPipelineDescriptor pipelineDescriptor{};
|
||||
pipelineDescriptor.vertexStage.module = vsModule;
|
||||
pipelineDescriptor.vertexStage.entryPoint = "main";
|
||||
pipelineDescriptor.fragmentStage = &fragmentStage;
|
||||
WGPURenderPipelineDescriptor2 pipelineDescriptor{};
|
||||
pipelineDescriptor.vertex.module = vsModule;
|
||||
pipelineDescriptor.vertex.entryPoint = "main";
|
||||
pipelineDescriptor.fragment = &fragment;
|
||||
|
||||
FlushClient();
|
||||
|
||||
|
@ -335,14 +335,14 @@ TEST_F(WireCreatePipelineAsyncTest, DeviceDeletedBeforeCallback) {
|
|||
WGPUShaderModule apiModule = api.GetNewShaderModule();
|
||||
EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiModule));
|
||||
|
||||
WGPURenderPipelineDescriptor pipelineDescriptor{};
|
||||
pipelineDescriptor.vertexStage.module = module;
|
||||
pipelineDescriptor.vertexStage.entryPoint = "main";
|
||||
WGPURenderPipelineDescriptor2 pipelineDescriptor{};
|
||||
pipelineDescriptor.vertex.module = module;
|
||||
pipelineDescriptor.vertex.entryPoint = "main";
|
||||
|
||||
WGPUProgrammableStageDescriptor fragmentStage = {};
|
||||
fragmentStage.module = module;
|
||||
fragmentStage.entryPoint = "main";
|
||||
pipelineDescriptor.fragmentStage = &fragmentStage;
|
||||
WGPUFragmentState fragment = {};
|
||||
fragment.module = module;
|
||||
fragment.entryPoint = "main";
|
||||
pipelineDescriptor.fragment = &fragment;
|
||||
|
||||
wgpuDeviceCreateRenderPipelineAsync(device, &pipelineDescriptor,
|
||||
ToMockCreateRenderPipelineAsyncCallback, this);
|
||||
|
|
Loading…
Reference in New Issue