Remove optional references

This commit is contained in:
Frederic Laing
2018-10-24 23:34:34 +02:00
committed by Frederic Laing
parent f53f5e9fee
commit daed975c89
9 changed files with 14 additions and 13 deletions

View File

@@ -4,6 +4,7 @@
#pragma once
#include <functional>
#include <map>
#include <memory>
#include <optional>

View File

@@ -70,7 +70,7 @@ void BufferQueue::QueueBuffer(u32 slot, BufferTransformFlags transform,
itr->crop_rect = crop_rect;
}
std::optional<const BufferQueue::Buffer&> BufferQueue::AcquireBuffer() {
std::optional<const BufferQueue::Buffer> BufferQueue::AcquireBuffer() {
auto itr = std::find_if(queue.begin(), queue.end(), [](const Buffer& buffer) {
return buffer.status == Buffer::Status::Queued;
});

View File

@@ -78,7 +78,7 @@ public:
const IGBPBuffer& RequestBuffer(u32 slot) const;
void QueueBuffer(u32 slot, BufferTransformFlags transform,
const MathUtil::Rectangle<int>& crop_rect);
std::optional<const Buffer&> AcquireBuffer();
std::optional<const Buffer> AcquireBuffer();
void ReleaseBuffer(u32 slot);
u32 Query(QueryType type);

View File

@@ -1455,7 +1455,7 @@ public:
Type type;
};
static std::optional<const Matcher&> Decode(Instruction instr) {
static std::optional<const Matcher> Decode(Instruction instr) {
static const auto table{GetDecodeTable()};
const auto matches_instruction = [instr](const auto& matcher) {
@@ -1463,7 +1463,7 @@ public:
};
auto iter = std::find_if(table.begin(), table.end(), matches_instruction);
return iter != table.end() ? std::optional<const Matcher&>(*iter) : std::nullopt;
return iter != table.end() ? std::optional<const Matcher>(*iter) : std::nullopt;
}
private:

View File

@@ -29,7 +29,7 @@ public:
virtual ~RendererBase();
/// Swap buffers (render frame)
virtual void SwapBuffers(std::optional<const Tegra::FramebufferConfig&> framebuffer) = 0;
virtual void SwapBuffers(std::optional<const Tegra::FramebufferConfig> framebuffer) = 0;
/// Initialize the renderer
virtual bool Init() = 0;

View File

@@ -37,7 +37,7 @@ layout(std140) uniform vs_config {
ProgramResult program =
Decompiler::DecompileProgram(setup.program.code, PROGRAM_OFFSET,
Maxwell3D::Regs::ShaderStage::Vertex, "vertex")
.value_or(std::nullopt);
.value_or(ProgramResult());
out += program.first;
@@ -45,7 +45,7 @@ layout(std140) uniform vs_config {
ProgramResult program_b =
Decompiler::DecompileProgram(setup.program.code_b, PROGRAM_OFFSET,
Maxwell3D::Regs::ShaderStage::Vertex, "vertex_b")
.value_or(std::nullopt);
.value_or(ProgramResult());
out += program_b.first;
}
@@ -90,7 +90,7 @@ ProgramResult GenerateGeometryShader(const ShaderSetup& setup) {
ProgramResult program =
Decompiler::DecompileProgram(setup.program.code, PROGRAM_OFFSET,
Maxwell3D::Regs::ShaderStage::Geometry, "geometry")
.value_or(std::nullopt);
.value_or(ProgramResult());
out += R"(
out gl_PerVertex {
vec4 gl_Position;
@@ -124,7 +124,7 @@ ProgramResult GenerateFragmentShader(const ShaderSetup& setup) {
ProgramResult program =
Decompiler::DecompileProgram(setup.program.code, PROGRAM_OFFSET,
Maxwell3D::Regs::ShaderStage::Fragment, "fragment")
.value_or(std::nullopt);
.value_or(ProgramResult());
out += R"(
layout(location = 0) out vec4 FragColor0;
layout(location = 1) out vec4 FragColor1;

View File

@@ -115,7 +115,7 @@ RendererOpenGL::RendererOpenGL(Core::Frontend::EmuWindow& window)
RendererOpenGL::~RendererOpenGL() = default;
/// Swap buffers (render frame)
void RendererOpenGL::SwapBuffers(std::optional<const Tegra::FramebufferConfig&> framebuffer) {
void RendererOpenGL::SwapBuffers(std::optional<const Tegra::FramebufferConfig> framebuffer) {
ScopeAcquireGLContext acquire_context{render_window};
Core::System::GetInstance().GetPerfStats().EndSystemFrame();

View File

@@ -51,7 +51,7 @@ public:
~RendererOpenGL() override;
/// Swap buffers (render frame)
void SwapBuffers(std::optional<const Tegra::FramebufferConfig&> framebuffer) override;
void SwapBuffers(std::optional<const Tegra::FramebufferConfig> framebuffer) override;
/// Initialize the renderer
bool Init() override;

View File

@@ -1560,7 +1560,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
}
}
boost::optional<u64> GMainWindow::SelectRomFSDumpTarget(
std::optional<u64> GMainWindow::SelectRomFSDumpTarget(
const FileSys::RegisteredCacheUnion& installed, u64 program_id) {
const auto dlc_entries =
installed.ListEntriesFilter(FileSys::TitleType::AOC, FileSys::ContentRecordType::Data);
@@ -1587,7 +1587,7 @@ boost::optional<u64> GMainWindow::SelectRomFSDumpTarget(
this, tr("Select RomFS Dump Target"),
tr("Please select which RomFS you would like to dump."), list, 0, false, &ok);
if (!ok) {
return boost::none;
return {};
}
return romfs_tids[list.indexOf(res)];