mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 12:42:41 +01:00
Merge pull request #1254 from DHrpcs3/master
rsx thread & OpenGL renderer fixes
This commit is contained in:
commit
3f6b826ab0
@ -968,14 +968,8 @@ void GLGSRender::end()
|
||||
#endif
|
||||
}
|
||||
|
||||
gl::vao vao;
|
||||
vao.create();
|
||||
|
||||
gl::buffer vbo;
|
||||
vbo.create(vertex_arrays_data.size(), vertex_arrays_data.data());
|
||||
|
||||
vao.array_buffer = vbo;
|
||||
vao.bind();
|
||||
m_vbo.data(vertex_arrays_data.size(), vertex_arrays_data.data());
|
||||
m_vao.bind();
|
||||
|
||||
for (int index = 0; index < rsx::limits::vertex_count; ++index)
|
||||
{
|
||||
@ -1008,7 +1002,7 @@ void GLGSRender::end()
|
||||
if (vertex_info.array)
|
||||
{
|
||||
__glcheck m_program.attribs[location] =
|
||||
(vao + vertex_arrays_offsets[index])
|
||||
(m_vao + vertex_arrays_offsets[index])
|
||||
.config(gl_types[vertex_info.type], vertex_info.size, gl_normalized[vertex_info.type]);
|
||||
}
|
||||
else
|
||||
@ -1036,13 +1030,11 @@ void GLGSRender::end()
|
||||
|
||||
if (vertex_index_array.empty())
|
||||
{
|
||||
draw_fbo.draw_arrays(gl::draw_mode(draw_mode - 1), vertex_draw_count);\
|
||||
draw_fbo.draw_arrays(gl::draw_mode(draw_mode - 1), vertex_draw_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl::buffer index_buffer;
|
||||
index_buffer.create(vertex_index_array.size(), vertex_index_array.data());
|
||||
vao.element_array_buffer = index_buffer;
|
||||
m_ebo.data(vertex_index_array.size(), vertex_index_array.data());
|
||||
|
||||
u32 indexed_type = rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4;
|
||||
|
||||
@ -1065,6 +1057,12 @@ void GLGSRender::oninit_thread()
|
||||
LOG_NOTICE(Log::RSX, (const char*)glGetString(GL_VENDOR));
|
||||
|
||||
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
|
||||
m_vao.create();
|
||||
m_vbo.create();
|
||||
m_ebo.create();
|
||||
|
||||
m_vao.array_buffer = m_vbo;
|
||||
m_vao.element_array_buffer = m_ebo;
|
||||
}
|
||||
|
||||
void GLGSRender::onexit_thread()
|
||||
@ -1088,6 +1086,15 @@ void GLGSRender::onexit_thread()
|
||||
|
||||
if (m_flip_tex_color)
|
||||
m_flip_tex_color.remove();
|
||||
|
||||
if (m_vbo)
|
||||
m_vbo.remove();
|
||||
|
||||
if (m_ebo)
|
||||
m_ebo.remove();
|
||||
|
||||
if (m_vao)
|
||||
m_vao.remove();
|
||||
}
|
||||
|
||||
void nv4097_clear_surface(u32 arg, GLGSRender* renderer)
|
||||
|
@ -76,6 +76,10 @@ private:
|
||||
gl::fbo m_flip_fbo;
|
||||
gl::texture m_flip_tex_color;
|
||||
|
||||
gl::buffer m_vbo;
|
||||
gl::buffer m_ebo;
|
||||
gl::vao m_vao;
|
||||
|
||||
public:
|
||||
GLGSRender();
|
||||
|
||||
|
@ -381,6 +381,7 @@ namespace gl
|
||||
|
||||
private:
|
||||
GLuint m_id = GL_NONE;
|
||||
GLsizei m_size = 0;
|
||||
target m_target = target::array;
|
||||
|
||||
public:
|
||||
@ -466,6 +467,7 @@ namespace gl
|
||||
target target_ = current_target();
|
||||
save_binding_state save(target_, *this);
|
||||
glBufferData((GLenum)target_, size, data_, GL_STREAM_COPY);
|
||||
m_size = size;
|
||||
}
|
||||
|
||||
void sub_data(GLintptr offset, GLsizeiptr size, const void* data_ = nullptr)
|
||||
@ -491,6 +493,11 @@ namespace gl
|
||||
m_id = 0;
|
||||
}
|
||||
|
||||
GLsizei size() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
uint id() const
|
||||
{
|
||||
return m_id;
|
||||
@ -1924,6 +1931,11 @@ namespace gl
|
||||
{
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_locations.clear();
|
||||
}
|
||||
|
||||
GLint location(const std::string &name)
|
||||
{
|
||||
auto finded = m_locations.find(name);
|
||||
@ -2054,6 +2066,7 @@ namespace gl
|
||||
void set_id(uint id)
|
||||
{
|
||||
uniforms.clear();
|
||||
attribs.clear();
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
|
@ -819,7 +819,7 @@ namespace rsx
|
||||
|
||||
auto &data = vertex_arrays[index];
|
||||
|
||||
if (info.frequency)
|
||||
if (info.frequency > 1)
|
||||
{
|
||||
LOG_ERROR(RSX, "%s: frequency is not null (%d, index=%d)", __FUNCTION__, info.frequency, index);
|
||||
}
|
||||
@ -916,6 +916,10 @@ namespace rsx
|
||||
for (auto &vertex_array : vertex_arrays)
|
||||
vertex_array.clear();
|
||||
|
||||
//disable all vertex data
|
||||
for (auto &vertex_info : vertex_arrays_info)
|
||||
vertex_info.size = 0;
|
||||
|
||||
transform_constants.clear();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user