shader/registry: Address feedback

merge-requests/60/head
ReinUsesLisp 2020-03-02 01:08:10 +07:00
parent b1061afed9
commit b1acb4f73f
3 changed files with 18 additions and 13 deletions

@ -57,7 +57,7 @@ using TextureIR = std::variant<TextureOffset, TextureDerivates, TextureArgument>
constexpr u32 MAX_CONSTBUFFER_ELEMENTS = constexpr u32 MAX_CONSTBUFFER_ELEMENTS =
static_cast<u32>(Maxwell::MaxConstBufferSize) / (4 * sizeof(float)); static_cast<u32>(Maxwell::MaxConstBufferSize) / (4 * sizeof(float));
std::string_view CommonDeclarations = R"(#define ftoi floatBitsToInt constexpr std::string_view CommonDeclarations = R"(#define ftoi floatBitsToInt
#define ftou floatBitsToUint #define ftou floatBitsToUint
#define itof intBitsToFloat #define itof intBitsToFloat
#define utof uintBitsToFloat #define utof uintBitsToFloat

@ -5,6 +5,7 @@
#include <algorithm> #include <algorithm>
#include <tuple> #include <tuple>
#include "common/assert.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "video_core/engines/kepler_compute.h" #include "video_core/engines/kepler_compute.h"
#include "video_core/engines/maxwell_3d.h" #include "video_core/engines/maxwell_3d.h"
@ -144,4 +145,14 @@ bool Registry::HasEqualKeys(const Registry& rhs) const {
std::tie(rhs.keys, rhs.bound_samplers, rhs.bindless_samplers); std::tie(rhs.keys, rhs.bound_samplers, rhs.bindless_samplers);
} }
const GraphicsInfo& Registry::GetGraphicsInfo() const {
ASSERT(stage != Tegra::Engines::ShaderType::Compute);
return graphics_info;
}
const ComputeInfo& Registry::GetComputeInfo() const {
ASSERT(stage == Tegra::Engines::ShaderType::Compute);
return compute_info;
}
} // namespace VideoCommon::Shader } // namespace VideoCommon::Shader

@ -85,6 +85,12 @@ public:
/// Returns true if the keys are equal to the other ones in the registry. /// Returns true if the keys are equal to the other ones in the registry.
bool HasEqualKeys(const Registry& rhs) const; bool HasEqualKeys(const Registry& rhs) const;
/// Returns graphics information from this shader
const GraphicsInfo& GetGraphicsInfo() const;
/// Returns compute information from this shader
const ComputeInfo& GetComputeInfo() const;
/// Gives an getter to the const buffer keys in the database. /// Gives an getter to the const buffer keys in the database.
const KeyMap& GetKeys() const { const KeyMap& GetKeys() const {
return keys; return keys;
@ -105,18 +111,6 @@ public:
return bound_buffer; return bound_buffer;
} }
/// Returns compute information from this shader
const GraphicsInfo& GetGraphicsInfo() const {
ASSERT(stage != Tegra::Engines::ShaderType::Compute);
return graphics_info;
}
/// Returns compute information from this shader
const ComputeInfo& GetComputeInfo() const {
ASSERT(stage == Tegra::Engines::ShaderType::Compute);
return compute_info;
}
/// Obtains access to the guest driver's profile. /// Obtains access to the guest driver's profile.
VideoCore::GuestDriverProfile& AccessGuestDriverProfile() { VideoCore::GuestDriverProfile& AccessGuestDriverProfile() {
return engine ? engine->AccessGuestDriverProfile() : stored_guest_driver_profile; return engine ? engine->AccessGuestDriverProfile() : stored_guest_driver_profile;