shader: Unify shader stage types
This commit is contained in:
parent
257d2aab74
commit
395bed3a0a
15 changed files with 37 additions and 55 deletions
|
@ -17,6 +17,7 @@
|
|||
#include "common/logging/log.h"
|
||||
#include "common/scope_exit.h"
|
||||
#include "common/settings.h"
|
||||
#include "shader_recompiler/stage.h"
|
||||
#include "video_core/renderer_opengl/gl_device.h"
|
||||
#include "video_core/renderer_opengl/gl_resource_manager.h"
|
||||
|
||||
|
@ -59,16 +60,18 @@ bool HasExtension(std::span<const std::string_view> extensions, std::string_view
|
|||
return std::ranges::find(extensions, extension) != extensions.end();
|
||||
}
|
||||
|
||||
std::array<u32, Tegra::Engines::MaxShaderTypes> BuildMaxUniformBuffers() noexcept {
|
||||
std::array<u32, Tegra::Engines::MaxShaderTypes> max;
|
||||
std::ranges::transform(LIMIT_UBOS, max.begin(),
|
||||
[](GLenum pname) { return GetInteger<u32>(pname); });
|
||||
std::array<u32, Shader::MaxStageTypes> BuildMaxUniformBuffers() noexcept {
|
||||
std::array<u32, Shader::MaxStageTypes> max;
|
||||
std::ranges::transform(LIMIT_UBOS, max.begin(), &GetInteger<u32>);
|
||||
return max;
|
||||
}
|
||||
|
||||
bool IsASTCSupported() {
|
||||
static constexpr std::array targets = {GL_TEXTURE_2D, GL_TEXTURE_2D_ARRAY};
|
||||
static constexpr std::array formats = {
|
||||
static constexpr std::array targets{
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE_2D_ARRAY,
|
||||
};
|
||||
static constexpr std::array formats{
|
||||
GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
|
||||
GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
|
||||
GL_COMPRESSED_RGBA_ASTC_6x6_KHR, GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
|
||||
|
@ -84,11 +87,10 @@ bool IsASTCSupported() {
|
|||
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
|
||||
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
|
||||
};
|
||||
static constexpr std::array required_support = {
|
||||
static constexpr std::array required_support{
|
||||
GL_VERTEX_TEXTURE, GL_TESS_CONTROL_TEXTURE, GL_TESS_EVALUATION_TEXTURE,
|
||||
GL_GEOMETRY_TEXTURE, GL_FRAGMENT_TEXTURE, GL_COMPUTE_TEXTURE,
|
||||
};
|
||||
|
||||
for (const GLenum target : targets) {
|
||||
for (const GLenum format : formats) {
|
||||
for (const GLenum support : required_support) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <cstddef>
|
||||
#include "common/common_types.h"
|
||||
#include "video_core/engines/shader_type.h"
|
||||
#include "shader_recompiler/stage.h"
|
||||
|
||||
namespace OpenGL {
|
||||
|
||||
|
@ -16,8 +16,8 @@ public:
|
|||
|
||||
[[nodiscard]] std::string GetVendorName() const;
|
||||
|
||||
u32 GetMaxUniformBuffers(Tegra::Engines::ShaderType shader_type) const noexcept {
|
||||
return max_uniform_buffers[static_cast<std::size_t>(shader_type)];
|
||||
u32 GetMaxUniformBuffers(Shader::Stage stage) const noexcept {
|
||||
return max_uniform_buffers[static_cast<size_t>(stage)];
|
||||
}
|
||||
|
||||
size_t GetUniformBufferAlignment() const {
|
||||
|
@ -148,8 +148,7 @@ private:
|
|||
static bool TestVariableAoffi();
|
||||
static bool TestPreciseBug();
|
||||
|
||||
std::string vendor_name;
|
||||
std::array<u32, Tegra::Engines::MaxShaderTypes> max_uniform_buffers{};
|
||||
std::array<u32, Shader::MaxStageTypes> max_uniform_buffers{};
|
||||
size_t uniform_buffer_alignment{};
|
||||
size_t shader_storage_alignment{};
|
||||
u32 max_vertex_attributes{};
|
||||
|
@ -181,6 +180,8 @@ private:
|
|||
bool has_sparse_texture_2{};
|
||||
bool warp_size_potentially_larger_than_guest{};
|
||||
bool need_fastmath_off{};
|
||||
|
||||
std::string vendor_name;
|
||||
};
|
||||
|
||||
} // namespace OpenGL
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "core/memory.h"
|
||||
#include "video_core/engines/kepler_compute.h"
|
||||
#include "video_core/engines/maxwell_3d.h"
|
||||
#include "video_core/engines/shader_type.h"
|
||||
#include "video_core/memory_manager.h"
|
||||
#include "video_core/renderer_opengl/gl_device.h"
|
||||
#include "video_core/renderer_opengl/gl_query_cache.h"
|
||||
|
@ -40,7 +39,6 @@ namespace OpenGL {
|
|||
using Maxwell = Tegra::Engines::Maxwell3D::Regs;
|
||||
using GLvec4 = std::array<GLfloat, 4>;
|
||||
|
||||
using Tegra::Engines::ShaderType;
|
||||
using VideoCore::Surface::PixelFormat;
|
||||
using VideoCore::Surface::SurfaceTarget;
|
||||
using VideoCore::Surface::SurfaceType;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "shader_recompiler/profile.h"
|
||||
#include "video_core/engines/kepler_compute.h"
|
||||
#include "video_core/engines/maxwell_3d.h"
|
||||
#include "video_core/engines/shader_type.h"
|
||||
#include "video_core/memory_manager.h"
|
||||
#include "video_core/renderer_opengl/gl_rasterizer.h"
|
||||
#include "video_core/renderer_opengl/gl_resource_manager.h"
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "shader_recompiler/host_translate_info.h"
|
||||
#include "shader_recompiler/object_pool.h"
|
||||
#include "shader_recompiler/profile.h"
|
||||
#include "video_core/engines/shader_type.h"
|
||||
#include "video_core/renderer_opengl/gl_compute_pipeline.h"
|
||||
#include "video_core/renderer_opengl/gl_graphics_pipeline.h"
|
||||
#include "video_core/renderer_opengl/gl_shader_context.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue