mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 07:38:56 +02:00
fix openg
This commit is contained in:
parent
c59eac5029
commit
8cf1302a9f
6 changed files with 44 additions and 47 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
|
|
@ -12,18 +12,12 @@
|
|||
#include "video_core/renderer_opengl/gl_buffer_cache.h"
|
||||
#include "video_core/renderer_opengl/gl_device.h"
|
||||
#include "video_core/renderer_opengl/maxwell_to_gl.h"
|
||||
#include "video_core/renderer_opengl/gl_rasterizer.h"
|
||||
|
||||
namespace OpenGL {
|
||||
namespace {
|
||||
using VideoCore::Surface::PixelFormat;
|
||||
|
||||
struct BindlessSSBO {
|
||||
GLuint64EXT address;
|
||||
GLsizei length;
|
||||
GLsizei padding;
|
||||
};
|
||||
static_assert(sizeof(BindlessSSBO) == sizeof(GLuint) * 4);
|
||||
|
||||
constexpr std::array PROGRAM_LUT{
|
||||
GL_VERTEX_PROGRAM_NV, GL_TESS_CONTROL_PROGRAM_NV, GL_TESS_EVALUATION_PROGRAM_NV,
|
||||
GL_GEOMETRY_PROGRAM_NV, GL_FRAGMENT_PROGRAM_NV,
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ using Shader::ImageBufferDescriptor;
|
|||
using Tegra::Texture::TexturePair;
|
||||
using VideoCommon::ImageId;
|
||||
|
||||
constexpr u32 MAX_TEXTURES = 64;
|
||||
constexpr u32 MAX_IMAGES = 16;
|
||||
constexpr u32 MAX_COMPUTE_TEXTURES = 64;
|
||||
constexpr u32 MAX_COMPUTE_IMAGES = 16;
|
||||
|
||||
size_t ComputePipelineKey::Hash() const noexcept {
|
||||
return static_cast<size_t>(
|
||||
|
|
@ -56,10 +56,10 @@ ComputePipeline::ComputePipeline(const Device& device, TextureCache& texture_cac
|
|||
num_image_buffers = Shader::NumDescriptors(info.image_buffer_descriptors);
|
||||
|
||||
const u32 num_textures{num_texture_buffers + Shader::NumDescriptors(info.texture_descriptors)};
|
||||
ASSERT(num_textures <= MAX_TEXTURES);
|
||||
ASSERT(num_textures <= MAX_COMPUTE_TEXTURES);
|
||||
|
||||
const u32 num_images{num_image_buffers + Shader::NumDescriptors(info.image_descriptors)};
|
||||
ASSERT(num_images <= MAX_IMAGES);
|
||||
ASSERT(num_images <= MAX_COMPUTE_IMAGES);
|
||||
|
||||
const bool is_glasm{assembly_program.handle != 0};
|
||||
const u32 num_storage_buffers{Shader::NumDescriptors(info.storage_buffers_descriptors)};
|
||||
|
|
@ -92,11 +92,11 @@ void ComputePipeline::Configure() {
|
|||
}
|
||||
texture_cache.SynchronizeComputeDescriptors();
|
||||
|
||||
boost::container::static_vector<VideoCommon::ImageViewInOut, MAX_TEXTURES + MAX_IMAGES> views;
|
||||
boost::container::static_vector<VideoCommon::SamplerId, MAX_TEXTURES> samplers;
|
||||
std::array<GLuint, MAX_TEXTURES> gl_samplers;
|
||||
std::array<GLuint, MAX_TEXTURES> textures;
|
||||
std::array<GLuint, MAX_IMAGES> images;
|
||||
boost::container::static_vector<VideoCommon::ImageViewInOut, MAX_COMPUTE_TEXTURES + MAX_COMPUTE_IMAGES> views;
|
||||
boost::container::static_vector<VideoCommon::SamplerId, MAX_COMPUTE_TEXTURES> samplers;
|
||||
std::array<GLuint, MAX_COMPUTE_TEXTURES> gl_samplers;
|
||||
std::array<GLuint, MAX_COMPUTE_TEXTURES> textures;
|
||||
std::array<GLuint, MAX_COMPUTE_IMAGES> images;
|
||||
GLsizei sampler_binding{};
|
||||
GLsizei texture_binding{};
|
||||
GLsizei image_binding{};
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ using Shader::TextureDescriptor;
|
|||
using Tegra::Texture::TexturePair;
|
||||
using VideoCommon::ImageId;
|
||||
|
||||
constexpr u32 MAX_TEXTURES = 64;
|
||||
constexpr u32 MAX_IMAGES = 8;
|
||||
constexpr u32 MAX_GRAPHICS_TEXTURES = 64;
|
||||
constexpr u32 MAX_GRAPHICS_IMAGES = 8;
|
||||
|
||||
GLenum Stage(size_t stage_index) {
|
||||
switch (stage_index) {
|
||||
|
|
@ -221,8 +221,8 @@ GraphicsPipeline::GraphicsPipeline(const Device& device, TextureCache& texture_c
|
|||
info.storage_buffers_descriptors, [](const auto& desc) { return desc.is_written; });
|
||||
uses_local_memory |= info.uses_local_memory;
|
||||
}
|
||||
ASSERT(num_textures <= MAX_TEXTURES);
|
||||
ASSERT(num_images <= MAX_IMAGES);
|
||||
ASSERT(num_textures <= MAX_GRAPHICS_TEXTURES);
|
||||
ASSERT(num_images <= MAX_GRAPHICS_IMAGES);
|
||||
|
||||
const auto backend = ::Settings::values.renderer_backend.GetValue();
|
||||
const bool assembly_shaders = backend == Settings::RendererBackend::OpenGL_GLASM;
|
||||
|
|
@ -278,8 +278,8 @@ GraphicsPipeline::GraphicsPipeline(const Device& device, TextureCache& texture_c
|
|||
|
||||
template <typename Spec>
|
||||
bool GraphicsPipeline::ConfigureImpl(bool is_indexed) {
|
||||
std::array<VideoCommon::ImageViewInOut, MAX_TEXTURES + MAX_IMAGES> views;
|
||||
std::array<VideoCommon::SamplerId, MAX_TEXTURES> samplers;
|
||||
std::array<VideoCommon::ImageViewInOut, MAX_GRAPHICS_TEXTURES + MAX_GRAPHICS_IMAGES> views;
|
||||
std::array<VideoCommon::SamplerId, MAX_GRAPHICS_TEXTURES> samplers;
|
||||
size_t views_index{};
|
||||
size_t samplers_index{};
|
||||
|
||||
|
|
@ -452,9 +452,9 @@ bool GraphicsPipeline::ConfigureImpl(bool is_indexed) {
|
|||
GLsizei texture_binding = 0;
|
||||
GLsizei image_binding = 0;
|
||||
GLsizei sampler_binding{};
|
||||
std::array<GLuint, MAX_TEXTURES> textures;
|
||||
std::array<GLuint, MAX_IMAGES> images;
|
||||
std::array<GLuint, MAX_TEXTURES> gl_samplers;
|
||||
std::array<GLuint, MAX_GRAPHICS_TEXTURES> textures;
|
||||
std::array<GLuint, MAX_GRAPHICS_IMAGES> images;
|
||||
std::array<GLuint, MAX_GRAPHICS_TEXTURES> gl_samplers;
|
||||
const auto prepare_stage{[&](size_t stage) {
|
||||
buffer_cache.runtime.SetImagePointers(&textures[texture_binding], &images[image_binding]);
|
||||
buffer_cache.BindHostStageBuffers(stage);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: 2015 Citra Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
|
@ -256,7 +259,7 @@ private:
|
|||
BlitImageHelper blit_image;
|
||||
|
||||
boost::container::static_vector<u32, MAX_IMAGE_VIEWS> image_view_indices;
|
||||
std::array<ImageViewId, MAX_IMAGE_VIEWS> image_view_ids;
|
||||
std::array<VideoCommon::ImageViewId, MAX_IMAGE_VIEWS> image_view_ids;
|
||||
boost::container::static_vector<GLuint, MAX_TEXTURES> sampler_handles;
|
||||
std::array<GLuint, MAX_TEXTURES> texture_handles{};
|
||||
std::array<GLuint, MAX_IMAGES> image_handles{};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
||||
|
|
@ -1103,7 +1103,7 @@ bool Image::ScaleDown(bool ignore) {
|
|||
}
|
||||
|
||||
ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewInfo& info,
|
||||
ImageId image_id_, Image& image, const SlotVector<Image>&)
|
||||
ImageId image_id_, Image& image, const Common::SlotVector<Image>&)
|
||||
: VideoCommon::ImageViewBase{info, image.info, image_id_, image.gpu_addr},
|
||||
views{runtime.null_image_views} {
|
||||
const Device& device = runtime.device;
|
||||
|
|
@ -1130,18 +1130,18 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI
|
|||
swizzle[3] = info.w_source;
|
||||
}
|
||||
switch (info.type) {
|
||||
case ImageViewType::e1DArray:
|
||||
case VideoCommon::ImageViewType::e1DArray:
|
||||
flat_range.extent.layers = 1;
|
||||
[[fallthrough]];
|
||||
case ImageViewType::e1D:
|
||||
case VideoCommon::ImageViewType::e1D:
|
||||
SetupView(Shader::TextureType::Color1D);
|
||||
SetupView(Shader::TextureType::ColorArray1D);
|
||||
break;
|
||||
case ImageViewType::e2DArray:
|
||||
case VideoCommon::ImageViewType::e2DArray:
|
||||
flat_range.extent.layers = 1;
|
||||
[[fallthrough]];
|
||||
case ImageViewType::e2D:
|
||||
case ImageViewType::Rect:
|
||||
case VideoCommon::ImageViewType::e2D:
|
||||
case VideoCommon::ImageViewType::Rect:
|
||||
if (True(flags & VideoCommon::ImageViewFlagBits::Slice)) {
|
||||
// 2D and 2D array views on a 3D textures are used exclusively for render targets
|
||||
ASSERT(info.range.extent.levels == 1);
|
||||
|
|
@ -1157,41 +1157,41 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI
|
|||
SetupView(Shader::TextureType::ColorArray2D);
|
||||
}
|
||||
break;
|
||||
case ImageViewType::e3D:
|
||||
case VideoCommon::ImageViewType::e3D:
|
||||
SetupView(Shader::TextureType::Color3D);
|
||||
break;
|
||||
case ImageViewType::CubeArray:
|
||||
case VideoCommon::ImageViewType::CubeArray:
|
||||
flat_range.extent.layers = 6;
|
||||
[[fallthrough]];
|
||||
case ImageViewType::Cube:
|
||||
case VideoCommon::ImageViewType::Cube:
|
||||
SetupView(Shader::TextureType::ColorCube);
|
||||
SetupView(Shader::TextureType::ColorArrayCube);
|
||||
break;
|
||||
case ImageViewType::Buffer:
|
||||
case VideoCommon::ImageViewType::Buffer:
|
||||
ASSERT(false);
|
||||
break;
|
||||
}
|
||||
switch (info.type) {
|
||||
case ImageViewType::e1D:
|
||||
case VideoCommon::ImageViewType::e1D:
|
||||
default_handle = Handle(Shader::TextureType::Color1D);
|
||||
break;
|
||||
case ImageViewType::e1DArray:
|
||||
case VideoCommon::ImageViewType::e1DArray:
|
||||
default_handle = Handle(Shader::TextureType::ColorArray1D);
|
||||
break;
|
||||
case ImageViewType::e2D:
|
||||
case ImageViewType::Rect:
|
||||
case VideoCommon::ImageViewType::e2D:
|
||||
case VideoCommon::ImageViewType::Rect:
|
||||
default_handle = Handle(Shader::TextureType::Color2D);
|
||||
break;
|
||||
case ImageViewType::e2DArray:
|
||||
case VideoCommon::ImageViewType::e2DArray:
|
||||
default_handle = Handle(Shader::TextureType::ColorArray2D);
|
||||
break;
|
||||
case ImageViewType::e3D:
|
||||
case VideoCommon::ImageViewType::e3D:
|
||||
default_handle = Handle(Shader::TextureType::Color3D);
|
||||
break;
|
||||
case ImageViewType::Cube:
|
||||
case VideoCommon::ImageViewType::Cube:
|
||||
default_handle = Handle(Shader::TextureType::ColorCube);
|
||||
break;
|
||||
case ImageViewType::CubeArray:
|
||||
case VideoCommon::ImageViewType::CubeArray:
|
||||
default_handle = Handle(Shader::TextureType::ColorArrayCube);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -2178,7 +2178,7 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI
|
|||
}
|
||||
}
|
||||
|
||||
ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewInfo& info, ImageId image_id_, Image& image, const SlotVector<Image>& slot_imgs)
|
||||
ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewInfo& info, ImageId image_id_, Image& image, const Common::SlotVector<Image>& slot_imgs)
|
||||
: ImageView{runtime, info, image_id_, image}
|
||||
{
|
||||
slot_images = &slot_imgs;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue