mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2024-11-27 21:14:17 +01:00
Merge pull request #981 from bunnei/cbuf-corrupt
maxwell_3d: Use correct const buffer size and check bounds.
This commit is contained in:
commit
9ceceb212f
@ -238,6 +238,8 @@ void Maxwell3D::ProcessCBBind(Regs::ShaderStage stage) {
|
|||||||
|
|
||||||
auto& buffer = shader.const_buffers[bind_data.index];
|
auto& buffer = shader.const_buffers[bind_data.index];
|
||||||
|
|
||||||
|
ASSERT(bind_data.index < Regs::MaxConstBuffers);
|
||||||
|
|
||||||
buffer.enabled = bind_data.valid.Value() != 0;
|
buffer.enabled = bind_data.valid.Value() != 0;
|
||||||
buffer.index = bind_data.index;
|
buffer.index = bind_data.index;
|
||||||
buffer.address = regs.const_buffer.BufferAddress();
|
buffer.address = regs.const_buffer.BufferAddress();
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
static constexpr size_t MaxShaderProgram = 6;
|
static constexpr size_t MaxShaderProgram = 6;
|
||||||
static constexpr size_t MaxShaderStage = 5;
|
static constexpr size_t MaxShaderStage = 5;
|
||||||
// Maximum number of const buffers per shader stage.
|
// Maximum number of const buffers per shader stage.
|
||||||
static constexpr size_t MaxConstBuffers = 16;
|
static constexpr size_t MaxConstBuffers = 18;
|
||||||
|
|
||||||
enum class QueryMode : u32 {
|
enum class QueryMode : u32 {
|
||||||
Write = 0,
|
Write = 0,
|
||||||
|
@ -659,7 +659,10 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint progr
|
|||||||
auto& buffer_draw_state =
|
auto& buffer_draw_state =
|
||||||
state.draw.const_buffers[static_cast<size_t>(stage)][used_buffer.GetIndex()];
|
state.draw.const_buffers[static_cast<size_t>(stage)][used_buffer.GetIndex()];
|
||||||
|
|
||||||
ASSERT_MSG(buffer.enabled, "Attempted to upload disabled constbuffer");
|
if (!buffer.enabled) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
buffer_draw_state.enabled = true;
|
buffer_draw_state.enabled = true;
|
||||||
buffer_draw_state.bindpoint = current_bindpoint + bindpoint;
|
buffer_draw_state.bindpoint = current_bindpoint + bindpoint;
|
||||||
|
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
|
|
||||||
|
#include "video_core/engines/maxwell_3d.h"
|
||||||
|
|
||||||
|
using Regs = Tegra::Engines::Maxwell3D::Regs;
|
||||||
|
|
||||||
namespace TextureUnits {
|
namespace TextureUnits {
|
||||||
|
|
||||||
struct TextureUnit {
|
struct TextureUnit {
|
||||||
@ -120,7 +124,7 @@ public:
|
|||||||
GLuint bindpoint;
|
GLuint bindpoint;
|
||||||
GLuint ssbo;
|
GLuint ssbo;
|
||||||
};
|
};
|
||||||
std::array<std::array<ConstBufferConfig, 16>, 5> const_buffers{};
|
std::array<std::array<ConstBufferConfig, Regs::MaxConstBuffers>, 5> const_buffers;
|
||||||
} draw;
|
} draw;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user