2019-04-10 20:56:12 +02:00
|
|
|
// Copyright 2019 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstddef>
|
2019-04-30 05:09:51 +02:00
|
|
|
#include "common/common_types.h"
|
2019-11-19 01:38:15 +01:00
|
|
|
#include "video_core/engines/shader_type.h"
|
2019-04-10 20:56:12 +02:00
|
|
|
|
|
|
|
namespace OpenGL {
|
|
|
|
|
2019-11-19 01:38:15 +01:00
|
|
|
static constexpr u32 EmulationUniformBlockBinding = 0;
|
|
|
|
|
|
|
|
class Device final {
|
2019-04-10 20:56:12 +02:00
|
|
|
public:
|
2019-11-19 01:38:15 +01:00
|
|
|
struct BaseBindings final {
|
|
|
|
u32 uniform_buffer{};
|
|
|
|
u32 shader_storage_buffer{};
|
|
|
|
u32 sampler{};
|
|
|
|
u32 image{};
|
|
|
|
};
|
|
|
|
|
2019-04-30 05:09:51 +02:00
|
|
|
explicit Device();
|
|
|
|
explicit Device(std::nullptr_t);
|
2019-04-10 20:56:12 +02:00
|
|
|
|
2019-11-19 01:38:15 +01:00
|
|
|
const BaseBindings& GetBaseBindings(std::size_t stage_index) const noexcept {
|
|
|
|
return base_bindings[stage_index];
|
|
|
|
}
|
|
|
|
|
|
|
|
const BaseBindings& GetBaseBindings(Tegra::Engines::ShaderType shader_type) const noexcept {
|
|
|
|
return GetBaseBindings(static_cast<std::size_t>(shader_type));
|
|
|
|
}
|
|
|
|
|
2019-04-10 20:56:12 +02:00
|
|
|
std::size_t GetUniformBufferAlignment() const {
|
|
|
|
return uniform_buffer_alignment;
|
|
|
|
}
|
|
|
|
|
2019-06-01 22:41:55 +02:00
|
|
|
std::size_t GetShaderStorageBufferAlignment() const {
|
|
|
|
return shader_storage_alignment;
|
|
|
|
}
|
|
|
|
|
2019-04-30 05:09:51 +02:00
|
|
|
u32 GetMaxVertexAttributes() const {
|
|
|
|
return max_vertex_attributes;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 GetMaxVaryings() const {
|
|
|
|
return max_varyings;
|
|
|
|
}
|
|
|
|
|
2019-08-10 04:50:21 +02:00
|
|
|
bool HasWarpIntrinsics() const {
|
|
|
|
return has_warp_intrinsics;
|
|
|
|
}
|
|
|
|
|
2019-11-08 00:03:50 +01:00
|
|
|
bool HasShaderBallot() const {
|
|
|
|
return has_shader_ballot;
|
|
|
|
}
|
|
|
|
|
2019-07-08 01:36:42 +02:00
|
|
|
bool HasVertexViewportLayer() const {
|
|
|
|
return has_vertex_viewport_layer;
|
|
|
|
}
|
|
|
|
|
2019-09-18 06:07:01 +02:00
|
|
|
bool HasImageLoadFormatted() const {
|
|
|
|
return has_image_load_formatted;
|
|
|
|
}
|
|
|
|
|
2020-03-15 00:21:26 +01:00
|
|
|
bool HasASTC() const {
|
|
|
|
return has_astc;
|
|
|
|
}
|
|
|
|
|
2019-04-10 23:03:52 +02:00
|
|
|
bool HasVariableAoffi() const {
|
|
|
|
return has_variable_aoffi;
|
|
|
|
}
|
|
|
|
|
2019-05-24 01:19:56 +02:00
|
|
|
bool HasComponentIndexingBug() const {
|
|
|
|
return has_component_indexing_bug;
|
|
|
|
}
|
|
|
|
|
2019-08-31 08:03:35 +02:00
|
|
|
bool HasPreciseBug() const {
|
|
|
|
return has_precise_bug;
|
|
|
|
}
|
|
|
|
|
2019-11-02 08:08:31 +01:00
|
|
|
bool HasFastBufferSubData() const {
|
|
|
|
return has_fast_buffer_sub_data;
|
|
|
|
}
|
|
|
|
|
2020-05-18 03:32:49 +02:00
|
|
|
bool UseAssemblyShaders() const {
|
|
|
|
return use_assembly_shaders;
|
|
|
|
}
|
|
|
|
|
2019-04-10 20:56:12 +02:00
|
|
|
private:
|
2019-04-10 23:03:52 +02:00
|
|
|
static bool TestVariableAoffi();
|
2019-08-31 08:03:35 +02:00
|
|
|
static bool TestPreciseBug();
|
2019-04-10 23:03:52 +02:00
|
|
|
|
2019-11-19 01:38:15 +01:00
|
|
|
std::array<BaseBindings, Tegra::Engines::MaxShaderTypes> base_bindings;
|
2019-04-10 20:56:12 +02:00
|
|
|
std::size_t uniform_buffer_alignment{};
|
2019-06-01 22:41:55 +02:00
|
|
|
std::size_t shader_storage_alignment{};
|
2019-04-30 05:09:51 +02:00
|
|
|
u32 max_vertex_attributes{};
|
|
|
|
u32 max_varyings{};
|
2019-08-10 04:50:21 +02:00
|
|
|
bool has_warp_intrinsics{};
|
2019-11-08 00:03:50 +01:00
|
|
|
bool has_shader_ballot{};
|
2019-07-08 01:36:42 +02:00
|
|
|
bool has_vertex_viewport_layer{};
|
2019-09-18 06:07:01 +02:00
|
|
|
bool has_image_load_formatted{};
|
2020-03-15 00:21:26 +01:00
|
|
|
bool has_astc{};
|
2019-04-10 23:03:52 +02:00
|
|
|
bool has_variable_aoffi{};
|
2019-05-24 01:19:56 +02:00
|
|
|
bool has_component_indexing_bug{};
|
2019-08-31 08:03:35 +02:00
|
|
|
bool has_precise_bug{};
|
2019-11-02 08:08:31 +01:00
|
|
|
bool has_fast_buffer_sub_data{};
|
2020-05-18 03:32:49 +02:00
|
|
|
bool use_assembly_shaders{};
|
2019-04-10 20:56:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace OpenGL
|