mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-16 00:50:05 +00:00
gl_rasterizer: Fix nullptr dereference on disabled buffers
This commit is contained in:
parent
7ecf64257a
commit
f7691ebe57
@ -162,6 +162,8 @@ public:
|
|||||||
return std::exchange(invalidated, false);
|
return std::exchange(invalidated, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual const BufferType* GetEmptyBuffer(std::size_t size) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void FlushObjectInner(const Buffer& entry) override {
|
void FlushObjectInner(const Buffer& entry) override {
|
||||||
DownloadBufferData(entry->GetBuffer(), 0, entry->GetSize(), entry->GetWritableHostPtr());
|
DownloadBufferData(entry->GetBuffer(), 0, entry->GetSize(), entry->GetWritableHostPtr());
|
||||||
@ -171,8 +173,6 @@ protected:
|
|||||||
|
|
||||||
virtual const BufferType* ToHandle(const BufferStorageType& storage) = 0;
|
virtual const BufferType* ToHandle(const BufferStorageType& storage) = 0;
|
||||||
|
|
||||||
virtual const BufferType* GetEmptyBuffer(std::size_t size) = 0;
|
|
||||||
|
|
||||||
virtual void UploadBufferData(const BufferStorageType& buffer, std::size_t offset,
|
virtual void UploadBufferData(const BufferStorageType& buffer, std::size_t offset,
|
||||||
std::size_t size, const u8* data) = 0;
|
std::size_t size, const u8* data) = 0;
|
||||||
|
|
||||||
|
@ -27,13 +27,13 @@ public:
|
|||||||
std::size_t stream_size);
|
std::size_t stream_size);
|
||||||
~OGLBufferCache();
|
~OGLBufferCache();
|
||||||
|
|
||||||
|
const GLuint* GetEmptyBuffer(std::size_t) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
OGLBuffer CreateBuffer(std::size_t size) override;
|
OGLBuffer CreateBuffer(std::size_t size) override;
|
||||||
|
|
||||||
const GLuint* ToHandle(const OGLBuffer& buffer) override;
|
const GLuint* ToHandle(const OGLBuffer& buffer) override;
|
||||||
|
|
||||||
const GLuint* GetEmptyBuffer(std::size_t) override;
|
|
||||||
|
|
||||||
void UploadBufferData(const OGLBuffer& buffer, std::size_t offset, std::size_t size,
|
void UploadBufferData(const OGLBuffer& buffer, std::size_t offset, std::size_t size,
|
||||||
const u8* data) override;
|
const u8* data) override;
|
||||||
|
|
||||||
|
@ -788,7 +788,7 @@ void RasterizerOpenGL::SetupConstBuffer(const Tegra::Engines::ConstBufferInfo& b
|
|||||||
const GLShader::ConstBufferEntry& entry) {
|
const GLShader::ConstBufferEntry& entry) {
|
||||||
if (!buffer.enabled) {
|
if (!buffer.enabled) {
|
||||||
// Set values to zero to unbind buffers
|
// Set values to zero to unbind buffers
|
||||||
bind_ubo_pushbuffer.Push(0, 0, 0);
|
bind_ubo_pushbuffer.Push(buffer_cache.GetEmptyBuffer(sizeof(float)), 0, sizeof(float));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user