VERY experimental Nintendo Switch 2 emulator
C++
vp9: Mark functions with [[nodiscard]] where applicable
Lioncash0c2f517cd064
diff --git a/src/video_core/command_classes/codecs/vp9.cpp b/src/video_core/command_classes/codecs/vp9.cppindex aeb9866ded..42520f856f 100644--- a/src/video_core/command_classes/codecs/vp9.cpp+++ b/src/video_core/command_classes/codecs/vp9.cpp@@ -200,7 +200,7 @@ constexpr std::array<s32, 254> map_lut{// 6.2.14 Tile size calculation-s32 CalcMinLog2TileCols(s32 frame_width) {+[[nodiscard]] s32 CalcMinLog2TileCols(s32 frame_width) {const s32 sb64_cols = (frame_width + 63) / 64;s32 min_log2 = 0;@@ -211,7 +211,7 @@ s32 CalcMinLog2TileCols(s32 frame_width) {return min_log2;}-s32 CalcMaxLog2TileCols(s32 frame_width) {+[[nodiscard]] s32 CalcMaxLog2TileCols(s32 frame_width) {const s32 sb64_cols = (frame_width + 63) / 64;s32 max_log2 = 1;@@ -223,7 +223,7 @@ s32 CalcMaxLog2TileCols(s32 frame_width) {}// Recenters probability. Based on section 6.3.6 of VP9 Specification-s32 RecenterNonNeg(s32 new_prob, s32 old_prob) {+[[nodiscard]] s32 RecenterNonNeg(s32 new_prob, s32 old_prob) {if (new_prob > old_prob * 2) {return new_prob;}@@ -236,7 +236,7 @@ s32 RecenterNonNeg(s32 new_prob, s32 old_prob) {}// Adjusts old_prob depending on new_prob. Based on section 6.3.5 of VP9 Specification-s32 RemapProbability(s32 new_prob, s32 old_prob) {+[[nodiscard]] s32 RemapProbability(s32 new_prob, s32 old_prob) {new_prob--;old_prob--;diff --git a/src/video_core/command_classes/codecs/vp9.h b/src/video_core/command_classes/codecs/vp9.hindex 94e8f90902..76b5a8283c 100644--- a/src/video_core/command_classes/codecs/vp9.h+++ b/src/video_core/command_classes/codecs/vp9.h@@ -37,11 +37,11 @@ public:/// Signal the end of the bitstreamvoid End();- std::vector<u8>& GetBuffer() {+ [[nodiscard]] std::vector<u8>& GetBuffer() {return base_stream.GetBuffer();}- const std::vector<u8>& GetBuffer() const {+ [[nodiscard]] const std::vector<u8>& GetBuffer() const {return base_stream.GetBuffer();}@@ -75,10 +75,10 @@ public:void Flush();/// Returns byte_array- std::vector<u8>& GetByteArray();+ [[nodiscard]] std::vector<u8>& GetByteArray();/// Returns const byte_array- const std::vector<u8>& GetByteArray() const;+ [[nodiscard]] const std::vector<u8>& GetByteArray() const;private:/// Write bit_count bits from value into buffer@@ -104,7 +104,7 @@ public:std::vector<u8>& ComposeFrameHeader(NvdecCommon::NvdecRegisters& state);/// Returns true if the most recent frame was a hidden frame.- bool WasFrameHidden() const {+ [[nodiscard]] bool WasFrameHidden() const {return hidden;}@@ -141,17 +141,17 @@ private:void WriteMvProbabilityUpdate(VpxRangeEncoder& writer, u8 new_prob, u8 old_prob);/// Returns VP9 information from NVDEC provided offset and size- Vp9PictureInfo GetVp9PictureInfo(const NvdecCommon::NvdecRegisters& state);+ [[nodiscard]] Vp9PictureInfo GetVp9PictureInfo(const NvdecCommon::NvdecRegisters& state);/// Read and convert NVDEC provided entropy probs to Vp9EntropyProbs structvoid InsertEntropy(u64 offset, Vp9EntropyProbs& dst);/// Returns frame to be decoded after buffering- Vp9FrameContainer GetCurrentFrame(const NvdecCommon::NvdecRegisters& state);+ [[nodiscard]] Vp9FrameContainer GetCurrentFrame(const NvdecCommon::NvdecRegisters& state);/// Use NVDEC providied information to compose the headers for the current frame- std::vector<u8> ComposeCompressedHeader();- VpxBitStreamWriter ComposeUncompressedHeader();+ [[nodiscard]] std::vector<u8> ComposeCompressedHeader();+ [[nodiscard]] VpxBitStreamWriter ComposeUncompressedHeader();GPU& gpu;std::vector<u8> frame;