yuzu/src/video_core/renderer_opengl/gl_device.h

164 lines
4.0 KiB
C
Raw Normal View History

2020-12-28 19:15:37 +04:00
// Copyright 2019 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <cstddef>
#include "common/common_types.h"
#include "video_core/engines/shader_type.h"
namespace OpenGL {
2021-01-17 06:19:34 +04:00
class Device {
2020-12-28 19:15:37 +04:00
public:
2021-01-17 06:19:34 +04:00
struct BaseBindings {
2020-12-28 19:15:37 +04:00
u32 uniform_buffer{};
u32 shader_storage_buffer{};
u32 sampler{};
u32 image{};
};
2021-01-19 03:14:45 +04:00
explicit Device();
2020-12-28 19:15:37 +04:00
explicit Device(std::nullptr_t);
2021-06-23 16:35:57 +04:00
[[nodiscard]] std::string GetVendorName() const;
2020-12-28 19:15:37 +04:00
u32 GetMaxUniformBuffers(Tegra::Engines::ShaderType shader_type) const noexcept {
return max_uniform_buffers[static_cast<std::size_t>(shader_type)];
}
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));
}
size_t GetUniformBufferAlignment() const {
return uniform_buffer_alignment;
}
size_t GetShaderStorageBufferAlignment() const {
return shader_storage_alignment;
}
u32 GetMaxVertexAttributes() const {
return max_vertex_attributes;
}
u32 GetMaxVaryings() const {
return max_varyings;
}
u32 GetMaxComputeSharedMemorySize() const {
return max_compute_shared_memory_size;
}
bool HasWarpIntrinsics() const {
return has_warp_intrinsics;
}
bool HasShaderBallot() const {
return has_shader_ballot;
}
bool HasVertexViewportLayer() const {
return has_vertex_viewport_layer;
}
bool HasImageLoadFormatted() const {
return has_image_load_formatted;
}
bool HasTextureShadowLod() const {
return has_texture_shadow_lod;
}
bool HasVertexBufferUnifiedMemory() const {
return has_vertex_buffer_unified_memory;
}
bool HasASTC() const {
return has_astc;
}
bool HasVariableAoffi() const {
return has_variable_aoffi;
}
bool HasComponentIndexingBug() const {
return has_component_indexing_bug;
}
bool HasPreciseBug() const {
return has_precise_bug;
}
2021-01-04 12:36:39 +04:00
bool HasBrokenTextureViewFormats() const {
return has_broken_texture_view_formats;
}
2020-12-28 19:15:37 +04:00
bool HasFastBufferSubData() const {
return has_fast_buffer_sub_data;
}
bool HasNvViewportArray2() const {
return has_nv_viewport_array2;
}
bool HasDebuggingToolAttached() const {
return has_debugging_tool_attached;
}
bool UseAssemblyShaders() const {
return use_assembly_shaders;
}
bool UseAsynchronousShaders() const {
return use_asynchronous_shaders;
}
2021-01-21 04:01:05 +04:00
bool UseDriverCache() const {
return use_driver_cache;
}
2021-02-25 03:56:10 +04:00
bool HasDepthBufferFloat() const {
return has_depth_buffer_float;
}
2020-12-28 19:15:37 +04:00
private:
static bool TestVariableAoffi();
static bool TestPreciseBug();
2021-06-23 16:35:57 +04:00
std::string vendor_name;
2020-12-28 19:15:37 +04:00
std::array<u32, Tegra::Engines::MaxShaderTypes> max_uniform_buffers{};
std::array<BaseBindings, Tegra::Engines::MaxShaderTypes> base_bindings{};
size_t uniform_buffer_alignment{};
size_t shader_storage_alignment{};
u32 max_vertex_attributes{};
u32 max_varyings{};
u32 max_compute_shared_memory_size{};
bool has_warp_intrinsics{};
bool has_shader_ballot{};
bool has_vertex_viewport_layer{};
bool has_image_load_formatted{};
bool has_texture_shadow_lod{};
bool has_vertex_buffer_unified_memory{};
bool has_astc{};
bool has_variable_aoffi{};
bool has_component_indexing_bug{};
bool has_precise_bug{};
2021-01-04 12:36:39 +04:00
bool has_broken_texture_view_formats{};
2020-12-28 19:15:37 +04:00
bool has_fast_buffer_sub_data{};
bool has_nv_viewport_array2{};
bool has_debugging_tool_attached{};
bool use_assembly_shaders{};
bool use_asynchronous_shaders{};
2021-01-21 04:01:05 +04:00
bool use_driver_cache{};
2021-02-25 03:56:10 +04:00
bool has_depth_buffer_float{};
2020-12-28 19:15:37 +04:00
};
} // namespace OpenGL