-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13636 from hrydgard/reinterpret-framebuffer-formats
Reinterpret framebuffer formats as needed. Outrun reflections partial fix
- Loading branch information
Showing
45 changed files
with
773 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#pragma once | ||
|
||
#include <vector> | ||
|
||
// Like a const begin/end pair, just more convenient to use (and can only be used for linear array data). | ||
// Inspired by Rust's slices and Google's StringPiece. | ||
template <class T> | ||
struct Slice { | ||
// View some memory as a slice. | ||
Slice(const T *data, size_t size) : data_(data), size_(size) {} | ||
|
||
// Intentionally non-explicit. | ||
// View a const array as a slice. | ||
template<size_t N> | ||
Slice(const T(&data)[N]) : data_(data), size_(N) {} | ||
|
||
// Intentionally non-explicit. | ||
// View a const array as a slice. | ||
Slice(const std::vector<T> &data) : data_(data.data()), size_(data.size()) {} | ||
|
||
const T &operator[](size_t index) const { | ||
return data_[index]; | ||
} | ||
|
||
size_t size() const { | ||
return size_; | ||
} | ||
|
||
// "Iterators" | ||
const T *begin() const { | ||
return data_; | ||
} | ||
const T *end() const { | ||
return data_ + size_; | ||
} | ||
|
||
static Slice empty() { | ||
return Slice<T>(nullptr, 0); | ||
} | ||
|
||
bool is_empty() const { | ||
return size_ == 0; | ||
} | ||
|
||
private: | ||
const T *data_; | ||
size_t size_; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.