GPU/D3D11: Fix uniform buffer creation on Win7

This commit is contained in:
Connor McLaughlin 2020-03-07 16:05:54 +10:00
parent eb6dbbfb13
commit 6fa8031569
2 changed files with 10 additions and 2 deletions

View file

@ -212,7 +212,7 @@ bool GPU_HW_D3D11::CreateVertexBuffer()
bool GPU_HW_D3D11::CreateUniformBuffer() bool GPU_HW_D3D11::CreateUniformBuffer()
{ {
return m_uniform_stream_buffer.Create(m_device.Get(), D3D11_BIND_CONSTANT_BUFFER, UNIFORM_BUFFER_SIZE); return m_uniform_stream_buffer.Create(m_device.Get(), D3D11_BIND_CONSTANT_BUFFER, MAX_UNIFORM_BUFFER_SIZE);
} }
bool GPU_HW_D3D11::CreateTextureBuffer() bool GPU_HW_D3D11::CreateTextureBuffer()
@ -403,7 +403,9 @@ bool GPU_HW_D3D11::CompileShaders()
void GPU_HW_D3D11::UploadUniformBlock(const void* data, u32 data_size) void GPU_HW_D3D11::UploadUniformBlock(const void* data, u32 data_size)
{ {
const auto res = m_uniform_stream_buffer.Map(m_context.Get(), m_uniform_stream_buffer.GetSize(), data_size); Assert(data_size <= MAX_UNIFORM_BUFFER_SIZE);
const auto res = m_uniform_stream_buffer.Map(m_context.Get(), MAX_UNIFORM_BUFFER_SIZE, data_size);
std::memcpy(res.pointer, data, data_size); std::memcpy(res.pointer, data, data_size);
m_uniform_stream_buffer.Unmap(m_context.Get(), data_size); m_uniform_stream_buffer.Unmap(m_context.Get(), data_size);

View file

@ -38,6 +38,12 @@ protected:
void UpdateVRAMReadTexture() override; void UpdateVRAMReadTexture() override;
private: private:
enum : u32
{
// Currently we don't stream uniforms, instead just re-map the buffer every time and let the driver take care of it.
MAX_UNIFORM_BUFFER_SIZE = 64
};
void SetCapabilities(); void SetCapabilities();
bool CreateFramebuffer(); bool CreateFramebuffer();
void ClearFramebuffer(); void ClearFramebuffer();