1 // Copyright (C) 2024 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include "common.h"
18 #include "sample_base.h"
19 
20 namespace cuttlefish {
21 
22 class FullscreenColor : public SampleBase {
23  public:
24   static Result<std::unique_ptr<SampleBase>> Create();
25 
26   Result<Ok> StartUp() override;
27   Result<Ok> CleanUp() override;
28 
29   Result<Ok> CreateSwapchainDependents(const SwapchainInfo& /*info*/) override;
30   Result<Ok> DestroySwapchainDependents() override;
31 
32   Result<Ok> RecordFrame(const FrameInfo& frame) override;
33 
34  private:
35   FullscreenColor() = default;
36 
37   vkhpp::UniqueRenderPass mRenderpass;
38   struct SwapchainImageObjects {
39     vkhpp::Extent2D extent;
40     vkhpp::UniqueFramebuffer framebuffer;
41   };
42   std::vector<SwapchainImageObjects> mSwapchainImageObjects;
43 
44   vkhpp::UniqueShaderModule mVertShaderModule;
45   vkhpp::UniqueShaderModule mFragShaderModule;
46   vkhpp::UniquePipelineLayout mPipelineLayout;
47   vkhpp::UniquePipeline mPipeline;
48 };
49 
50 }  // namespace cuttlefish