mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-16 16:21:02 +00:00
OpenGL: fixed nv4097_clear_surface implementation
minor improvements
This commit is contained in:
parent
1e7ded2163
commit
6cd62a9fd0
@ -1139,12 +1139,30 @@ void GLGSRender::onexit_thread()
|
|||||||
|
|
||||||
void nv4097_clear_surface(u32 arg, GLGSRender* renderer)
|
void nv4097_clear_surface(u32 arg, GLGSRender* renderer)
|
||||||
{
|
{
|
||||||
|
if ((arg & 0xf3) == 0)
|
||||||
|
{
|
||||||
|
//do nothing
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
|
||||||
|
/*
|
||||||
u16 clear_x = rsx::method_registers[NV4097_SET_CLEAR_RECT_HORIZONTAL];
|
u16 clear_x = rsx::method_registers[NV4097_SET_CLEAR_RECT_HORIZONTAL];
|
||||||
u16 clear_y = rsx::method_registers[NV4097_SET_CLEAR_RECT_VERTICAL];
|
u16 clear_y = rsx::method_registers[NV4097_SET_CLEAR_RECT_VERTICAL];
|
||||||
u16 clear_w = rsx::method_registers[NV4097_SET_CLEAR_RECT_HORIZONTAL] >> 16;
|
u16 clear_w = rsx::method_registers[NV4097_SET_CLEAR_RECT_HORIZONTAL] >> 16;
|
||||||
u16 clear_h = rsx::method_registers[NV4097_SET_CLEAR_RECT_VERTICAL] >> 16;
|
u16 clear_h = rsx::method_registers[NV4097_SET_CLEAR_RECT_VERTICAL] >> 16;
|
||||||
|
glScissor(clear_x, clear_y, clear_w, clear_h);
|
||||||
|
*/
|
||||||
|
|
||||||
//glScissor(clear_x, clear_y, clear_w, clear_h);
|
u32 scissor_horizontal = rsx::method_registers[NV4097_SET_SCISSOR_HORIZONTAL];
|
||||||
|
u32 scissor_vertical = rsx::method_registers[NV4097_SET_SCISSOR_VERTICAL];
|
||||||
|
u16 scissor_x = scissor_horizontal;
|
||||||
|
u16 scissor_w = scissor_horizontal >> 16;
|
||||||
|
u16 scissor_y = scissor_vertical;
|
||||||
|
u16 scissor_h = scissor_vertical >> 16;
|
||||||
|
|
||||||
|
glScissor(scissor_x, scissor_y, scissor_w, scissor_h);
|
||||||
|
|
||||||
GLbitfield mask = 0;
|
GLbitfield mask = 0;
|
||||||
|
|
||||||
@ -1164,7 +1182,7 @@ void nv4097_clear_surface(u32 arg, GLGSRender* renderer)
|
|||||||
{
|
{
|
||||||
u8 clear_stencil = rsx::method_registers[NV4097_SET_ZSTENCIL_CLEAR_VALUE] & 0xff;
|
u8 clear_stencil = rsx::method_registers[NV4097_SET_ZSTENCIL_CLEAR_VALUE] & 0xff;
|
||||||
|
|
||||||
glStencilMask(0xff);
|
__glcheck glStencilMask(rsx::method_registers[NV4097_SET_STENCIL_MASK]);
|
||||||
glClearStencil(clear_stencil);
|
glClearStencil(clear_stencil);
|
||||||
|
|
||||||
mask |= GLenum(gl::buffers::stencil);
|
mask |= GLenum(gl::buffers::stencil);
|
||||||
@ -1178,18 +1196,15 @@ void nv4097_clear_surface(u32 arg, GLGSRender* renderer)
|
|||||||
u8 clear_g = clear_color >> 8;
|
u8 clear_g = clear_color >> 8;
|
||||||
u8 clear_b = clear_color;
|
u8 clear_b = clear_color;
|
||||||
|
|
||||||
glColorMask(arg & 0x20, arg & 0x40, arg & 0x80, arg & 0x10);
|
glColorMask(((arg & 0x20) ? 1 : 0), ((arg & 0x40) ? 1 : 0), ((arg & 0x80) ? 1 : 0), ((arg & 0x10) ? 1 : 0));
|
||||||
glClearColor(clear_r / 255.f, clear_g / 255.f, clear_b / 255.f, clear_a / 255.f);
|
glClearColor(clear_r / 255.f, clear_g / 255.f, clear_b / 255.f, clear_a / 255.f);
|
||||||
|
|
||||||
mask |= GLenum(gl::buffers::color);
|
mask |= GLenum(gl::buffers::color);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mask)
|
renderer->init_buffers();
|
||||||
{
|
renderer->draw_fbo.clear(gl::buffers(mask));
|
||||||
renderer->read_buffers();
|
renderer->write_buffers();
|
||||||
renderer->draw_fbo.clear(gl::buffers(mask));
|
|
||||||
renderer->write_buffers();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using rsx_method_impl_t = void(*)(u32, GLGSRender*);
|
using rsx_method_impl_t = void(*)(u32, GLGSRender*);
|
||||||
|
@ -19,7 +19,7 @@ namespace gl
|
|||||||
{
|
{
|
||||||
bind_as(target::read_frame_buffer);
|
bind_as(target::read_frame_buffer);
|
||||||
dst.bind_as(target::draw_frame_buffer);
|
dst.bind_as(target::draw_frame_buffer);
|
||||||
glBlitFramebuffer(
|
__glcheck glBlitFramebuffer(
|
||||||
src_area.x1, src_area.y1, src_area.x2, src_area.y2,
|
src_area.x1, src_area.y1, src_area.x2, src_area.y2,
|
||||||
dst_area.x1, dst_area.y1, dst_area.x2, dst_area.y2,
|
dst_area.x1, dst_area.y1, dst_area.x2, dst_area.y2,
|
||||||
(GLbitfield)buffers_, (GLenum)filter_);
|
(GLbitfield)buffers_, (GLenum)filter_);
|
||||||
@ -64,18 +64,13 @@ namespace gl
|
|||||||
{
|
{
|
||||||
save_binding_state save(*this);
|
save_binding_state save(*this);
|
||||||
GLenum buf = buffer.id();
|
GLenum buf = buffer.id();
|
||||||
glDrawBuffers(1, &buf);
|
__glcheck glDrawBuffers(1, &buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::draw_buffers(const std::initializer_list<attachment>& indexes) const
|
void fbo::draw_buffers(const std::initializer_list<attachment>& indexes) const
|
||||||
{
|
{
|
||||||
save_binding_state save(*this);
|
save_binding_state save(*this);
|
||||||
std::vector<GLenum> ids;
|
__glcheck glDrawBuffers((GLsizei)indexes.size(), (const GLenum*)indexes.begin());
|
||||||
|
|
||||||
for (auto &index : indexes)
|
|
||||||
ids.push_back(index.id());
|
|
||||||
|
|
||||||
glDrawBuffers((GLsizei)ids.size(), ids.data());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::draw_arrays(draw_mode mode, GLsizei count, GLint first) const
|
void fbo::draw_arrays(draw_mode mode, GLsizei count, GLint first) const
|
||||||
@ -99,19 +94,19 @@ namespace gl
|
|||||||
void fbo::draw_elements(draw_mode mode, GLsizei count, indices_type type, const GLvoid *indices) const
|
void fbo::draw_elements(draw_mode mode, GLsizei count, indices_type type, const GLvoid *indices) const
|
||||||
{
|
{
|
||||||
save_binding_state save(*this);
|
save_binding_state save(*this);
|
||||||
glDrawElements((GLenum)mode, count, (GLenum)type, indices);
|
__glcheck glDrawElements((GLenum)mode, count, (GLenum)type, indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::draw_elements(const buffer& buffer, draw_mode mode, GLsizei count, indices_type type, const GLvoid *indices) const
|
void fbo::draw_elements(const buffer& buffer, draw_mode mode, GLsizei count, indices_type type, const GLvoid *indices) const
|
||||||
{
|
{
|
||||||
buffer.bind(buffer::target::array);
|
buffer.bind(buffer::target::array);
|
||||||
glDrawElements((GLenum)mode, count, (GLenum)type, indices);
|
__glcheck glDrawElements((GLenum)mode, count, (GLenum)type, indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::draw_elements(draw_mode mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
|
void fbo::draw_elements(draw_mode mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
|
||||||
{
|
{
|
||||||
indices.bind(buffer::target::element_array);
|
indices.bind(buffer::target::element_array);
|
||||||
glDrawElements((GLenum)mode, count, (GLenum)type, (GLvoid*)indices_buffer_offset);
|
__glcheck glDrawElements((GLenum)mode, count, (GLenum)type, (GLvoid*)indices_buffer_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::draw_elements(const buffer& buffer_, draw_mode mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
|
void fbo::draw_elements(const buffer& buffer_, draw_mode mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user