mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 21:41:26 +12:00
gl: Stub dynamic sample count when creating textures
This commit is contained in:
parent
9a7b8e41eb
commit
808f67a3b2
10 changed files with 25 additions and 21 deletions
|
@ -229,13 +229,13 @@ void GLGSRender::on_init_thread()
|
||||||
|
|
||||||
// Array stream buffer
|
// Array stream buffer
|
||||||
{
|
{
|
||||||
m_gl_persistent_stream_buffer = std::make_unique<gl::texture>(GL_TEXTURE_BUFFER, 0, 0, 0, 0, GL_R8UI);
|
m_gl_persistent_stream_buffer = std::make_unique<gl::texture>(GL_TEXTURE_BUFFER, 0, 0, 0, 0, 0, GL_R8UI);
|
||||||
gl_state.bind_texture(GL_STREAM_BUFFER_START + 0, GL_TEXTURE_BUFFER, m_gl_persistent_stream_buffer->id());
|
gl_state.bind_texture(GL_STREAM_BUFFER_START + 0, GL_TEXTURE_BUFFER, m_gl_persistent_stream_buffer->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register stream buffer
|
// Register stream buffer
|
||||||
{
|
{
|
||||||
m_gl_volatile_stream_buffer = std::make_unique<gl::texture>(GL_TEXTURE_BUFFER, 0, 0, 0, 0, GL_R8UI);
|
m_gl_volatile_stream_buffer = std::make_unique<gl::texture>(GL_TEXTURE_BUFFER, 0, 0, 0, 0, 0, GL_R8UI);
|
||||||
gl_state.bind_texture(GL_STREAM_BUFFER_START + 1, GL_TEXTURE_BUFFER, m_gl_volatile_stream_buffer->id());
|
gl_state.bind_texture(GL_STREAM_BUFFER_START + 1, GL_TEXTURE_BUFFER, m_gl_volatile_stream_buffer->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,19 +244,19 @@ void GLGSRender::on_init_thread()
|
||||||
std::array<u32, 8> pixeldata = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
std::array<u32, 8> pixeldata = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
|
||||||
// 1D
|
// 1D
|
||||||
auto tex1D = std::make_unique<gl::texture>(GL_TEXTURE_1D, 1, 1, 1, 1, GL_RGBA8);
|
auto tex1D = std::make_unique<gl::texture>(GL_TEXTURE_1D, 1, 1, 1, 1, 1, GL_RGBA8);
|
||||||
tex1D->copy_from(pixeldata.data(), gl::texture::format::rgba, gl::texture::type::uint_8_8_8_8, {});
|
tex1D->copy_from(pixeldata.data(), gl::texture::format::rgba, gl::texture::type::uint_8_8_8_8, {});
|
||||||
|
|
||||||
// 2D
|
// 2D
|
||||||
auto tex2D = std::make_unique<gl::texture>(GL_TEXTURE_2D, 1, 1, 1, 1, GL_RGBA8);
|
auto tex2D = std::make_unique<gl::texture>(GL_TEXTURE_2D, 1, 1, 1, 1, 1, GL_RGBA8);
|
||||||
tex2D->copy_from(pixeldata.data(), gl::texture::format::rgba, gl::texture::type::uint_8_8_8_8, {});
|
tex2D->copy_from(pixeldata.data(), gl::texture::format::rgba, gl::texture::type::uint_8_8_8_8, {});
|
||||||
|
|
||||||
// 3D
|
// 3D
|
||||||
auto tex3D = std::make_unique<gl::texture>(GL_TEXTURE_3D, 1, 1, 1, 1, GL_RGBA8);
|
auto tex3D = std::make_unique<gl::texture>(GL_TEXTURE_3D, 1, 1, 1, 1, 1, GL_RGBA8);
|
||||||
tex3D->copy_from(pixeldata.data(), gl::texture::format::rgba, gl::texture::type::uint_8_8_8_8, {});
|
tex3D->copy_from(pixeldata.data(), gl::texture::format::rgba, gl::texture::type::uint_8_8_8_8, {});
|
||||||
|
|
||||||
// CUBE
|
// CUBE
|
||||||
auto texCUBE = std::make_unique<gl::texture>(GL_TEXTURE_CUBE_MAP, 1, 1, 1, 1, GL_RGBA8);
|
auto texCUBE = std::make_unique<gl::texture>(GL_TEXTURE_CUBE_MAP, 1, 1, 1, 1, 1, GL_RGBA8);
|
||||||
texCUBE->copy_from(pixeldata.data(), gl::texture::format::rgba, gl::texture::type::uint_8_8_8_8, {});
|
texCUBE->copy_from(pixeldata.data(), gl::texture::format::rgba, gl::texture::type::uint_8_8_8_8, {});
|
||||||
|
|
||||||
m_null_textures[GL_TEXTURE_1D] = std::move(tex1D);
|
m_null_textures[GL_TEXTURE_1D] = std::move(tex1D);
|
||||||
|
|
|
@ -216,7 +216,7 @@ namespace gl
|
||||||
|
|
||||||
gl::texture_view* ui_overlay_renderer::load_simple_image(rsx::overlays::image_info* desc, bool temp_resource, u32 owner_uid)
|
gl::texture_view* ui_overlay_renderer::load_simple_image(rsx::overlays::image_info* desc, bool temp_resource, u32 owner_uid)
|
||||||
{
|
{
|
||||||
auto tex = std::make_unique<gl::texture>(GL_TEXTURE_2D, desc->w, desc->h, 1, 1, GL_RGBA8);
|
auto tex = std::make_unique<gl::texture>(GL_TEXTURE_2D, desc->w, desc->h, 1, 1, 1, GL_RGBA8);
|
||||||
tex->copy_from(desc->get_data(), gl::texture::format::rgba, gl::texture::type::uint_8_8_8_8, {});
|
tex->copy_from(desc->get_data(), gl::texture::format::rgba, gl::texture::type::uint_8_8_8_8, {});
|
||||||
|
|
||||||
GLenum remap[] = { GL_RED, GL_ALPHA, GL_BLUE, GL_GREEN };
|
GLenum remap[] = { GL_RED, GL_ALPHA, GL_BLUE, GL_GREEN };
|
||||||
|
@ -301,7 +301,7 @@ namespace gl
|
||||||
// Create font file
|
// Create font file
|
||||||
const std::vector<u8> glyph_data = font->get_glyph_data();
|
const std::vector<u8> glyph_data = font->get_glyph_data();
|
||||||
|
|
||||||
auto tex = std::make_unique<gl::texture>(GL_TEXTURE_2D_ARRAY, font_size.width, font_size.height, font_size.depth, 1, GL_R8);
|
auto tex = std::make_unique<gl::texture>(GL_TEXTURE_2D_ARRAY, font_size.width, font_size.height, font_size.depth, 1, 1, GL_R8);
|
||||||
tex->copy_from(glyph_data.data(), gl::texture::format::r, gl::texture::type::ubyte, {});
|
tex->copy_from(glyph_data.data(), gl::texture::format::r, gl::texture::type::ubyte, {});
|
||||||
|
|
||||||
GLenum remap[] = { GL_RED, GL_RED, GL_RED, GL_RED };
|
GLenum remap[] = { GL_RED, GL_RED, GL_RED, GL_RED };
|
||||||
|
|
|
@ -115,7 +115,7 @@ gl::texture* GLGSRender::get_present_source(gl::present_surface_info* info, cons
|
||||||
{
|
{
|
||||||
if (!flip_image || flip_image->size2D() != sizeu{ info->width, info->height })
|
if (!flip_image || flip_image->size2D() != sizeu{ info->width, info->height })
|
||||||
{
|
{
|
||||||
flip_image = std::make_unique<gl::texture>(GL_TEXTURE_2D, info->width, info->height, 1, 1, expected_format);
|
flip_image = std::make_unique<gl::texture>(GL_TEXTURE_2D, info->width, info->height, 1, 1, 1, expected_format);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -449,7 +449,7 @@ void gl::render_target::load_memory(gl::command_context& cmd)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto tmp = std::make_unique<gl::texture>(GL_TEXTURE_2D, subres.width_in_block, subres.height_in_block, 1, 1, static_cast<GLenum>(get_internal_format()), format_class());
|
auto tmp = std::make_unique<gl::texture>(GL_TEXTURE_2D, subres.width_in_block, subres.height_in_block, 1, 1, 1, static_cast<GLenum>(get_internal_format()), format_class());
|
||||||
gl::upload_texture(cmd, tmp.get(), get_gcm_format(), is_swizzled, { subres });
|
gl::upload_texture(cmd, tmp.get(), get_gcm_format(), is_swizzled, { subres });
|
||||||
|
|
||||||
gl::g_hw_blitter->scale_image(cmd, tmp.get(), this,
|
gl::g_hw_blitter->scale_image(cmd, tmp.get(), this,
|
||||||
|
|
|
@ -429,7 +429,7 @@ namespace gl
|
||||||
image_region.height *= dst_region.depth;
|
image_region.height *= dst_region.depth;
|
||||||
scratch = std::make_unique<gl::texture>(
|
scratch = std::make_unique<gl::texture>(
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
image_region.x + image_region.width, image_region.y + image_region.height, 1, 1,
|
image_region.x + image_region.width, image_region.y + image_region.height, 1, 1, 1,
|
||||||
static_cast<GLenum>(dst->get_internal_format()), dst->format_class());
|
static_cast<GLenum>(dst->get_internal_format()), dst->format_class());
|
||||||
|
|
||||||
scratch_view = std::make_unique<gl::nil_texture_view>(scratch.get());
|
scratch_view = std::make_unique<gl::nil_texture_view>(scratch.get());
|
||||||
|
@ -445,7 +445,7 @@ namespace gl
|
||||||
{
|
{
|
||||||
scratch = std::make_unique<gl::texture>(
|
scratch = std::make_unique<gl::texture>(
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
image_region.x + image_region.width, 1, 1, 1,
|
image_region.x + image_region.width, 1, 1, 1, 1,
|
||||||
static_cast<GLenum>(dst->get_internal_format()), dst->format_class());
|
static_cast<GLenum>(dst->get_internal_format()), dst->format_class());
|
||||||
|
|
||||||
scratch_view = std::make_unique<gl::nil_texture_view>(scratch.get());
|
scratch_view = std::make_unique<gl::nil_texture_view>(scratch.get());
|
||||||
|
|
|
@ -266,7 +266,7 @@ namespace gl
|
||||||
gl::texture* _dst = dst_image;
|
gl::texture* _dst = dst_image;
|
||||||
if (src_image->get_internal_format() != dst_image->get_internal_format() || slice.level != 0 || slice.dst_z != 0) [[ unlikely ]]
|
if (src_image->get_internal_format() != dst_image->get_internal_format() || slice.level != 0 || slice.dst_z != 0) [[ unlikely ]]
|
||||||
{
|
{
|
||||||
tmp = std::make_unique<texture>(GL_TEXTURE_2D, dst_rect.x2, dst_rect.y2, 1, 1, static_cast<GLenum>(slice.src->get_internal_format()));
|
tmp = std::make_unique<texture>(GL_TEXTURE_2D, dst_rect.x2, dst_rect.y2, 1, 1, 1, static_cast<GLenum>(slice.src->get_internal_format()));
|
||||||
_dst = tmp.get();
|
_dst = tmp.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,7 @@ namespace gl
|
||||||
|
|
||||||
if (!scaled_texture)
|
if (!scaled_texture)
|
||||||
{
|
{
|
||||||
scaled_texture = std::make_unique<gl::texture>(GL_TEXTURE_2D, real_width, real_height, 1, 1, static_cast<GLenum>(ifmt));
|
scaled_texture = std::make_unique<gl::texture>(GL_TEXTURE_2D, real_width, real_height, 1, 1, 1, static_cast<GLenum>(ifmt));
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool linear_interp = is_depth_texture() ? false : true;
|
const bool linear_interp = is_depth_texture() ? false : true;
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace gl
|
||||||
if (static_cast<gl::texture::internal_format>(internal_fmt) != src->get_internal_format())
|
if (static_cast<gl::texture::internal_format>(internal_fmt) != src->get_internal_format())
|
||||||
{
|
{
|
||||||
const u16 internal_width = static_cast<u16>(src->width() * xfer_info.src_scaling_hint);
|
const u16 internal_width = static_cast<u16>(src->width() * xfer_info.src_scaling_hint);
|
||||||
typeless_src = std::make_unique<texture>(GL_TEXTURE_2D, internal_width, src->height(), 1, 1, internal_fmt);
|
typeless_src = std::make_unique<texture>(GL_TEXTURE_2D, internal_width, src->height(), 1, 1, 1, internal_fmt);
|
||||||
copy_typeless(cmd, typeless_src.get(), src);
|
copy_typeless(cmd, typeless_src.get(), src);
|
||||||
|
|
||||||
real_src = typeless_src.get();
|
real_src = typeless_src.get();
|
||||||
|
@ -85,7 +85,7 @@ namespace gl
|
||||||
if (static_cast<gl::texture::internal_format>(internal_fmt) != dst->get_internal_format())
|
if (static_cast<gl::texture::internal_format>(internal_fmt) != dst->get_internal_format())
|
||||||
{
|
{
|
||||||
const auto internal_width = static_cast<u16>(dst->width() * xfer_info.dst_scaling_hint);
|
const auto internal_width = static_cast<u16>(dst->width() * xfer_info.dst_scaling_hint);
|
||||||
typeless_dst = std::make_unique<texture>(GL_TEXTURE_2D, internal_width, dst->height(), 1, 1, internal_fmt);
|
typeless_dst = std::make_unique<texture>(GL_TEXTURE_2D, internal_width, dst->height(), 1, 1, 1, internal_fmt);
|
||||||
copy_typeless(cmd, typeless_dst.get(), dst);
|
copy_typeless(cmd, typeless_dst.get(), dst);
|
||||||
|
|
||||||
real_dst = typeless_dst.get();
|
real_dst = typeless_dst.get();
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace gl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
texture::texture(GLenum target, GLuint width, GLuint height, GLuint depth, GLuint mipmaps, GLenum sized_format, rsx::format_class format_class)
|
texture::texture(GLenum target, GLuint width, GLuint height, GLuint depth, GLuint mipmaps, GLubyte samples, GLenum sized_format, rsx::format_class format_class)
|
||||||
{
|
{
|
||||||
glGenTextures(1, &m_id);
|
glGenTextures(1, &m_id);
|
||||||
|
|
||||||
|
@ -62,8 +62,11 @@ namespace gl
|
||||||
m_height = height;
|
m_height = height;
|
||||||
m_depth = depth;
|
m_depth = depth;
|
||||||
m_mipmaps = mipmaps;
|
m_mipmaps = mipmaps;
|
||||||
|
m_samples = samples;
|
||||||
m_aspect_flags = image_aspect::color;
|
m_aspect_flags = image_aspect::color;
|
||||||
|
|
||||||
|
ensure(width > 0 && height > 0 && depth > 0 && mipmaps > 0 && samples > 0, "Invalid OpenGL texture definition.");
|
||||||
|
|
||||||
switch (storage_fmt)
|
switch (storage_fmt)
|
||||||
{
|
{
|
||||||
case GL_DEPTH_COMPONENT16:
|
case GL_DEPTH_COMPONENT16:
|
||||||
|
@ -223,7 +226,7 @@ namespace gl
|
||||||
{
|
{
|
||||||
// Worst case scenario. For some reason, EXT_dsa does not have glGetTextureSubImage
|
// Worst case scenario. For some reason, EXT_dsa does not have glGetTextureSubImage
|
||||||
const auto target_ = static_cast<GLenum>(m_target);
|
const auto target_ = static_cast<GLenum>(m_target);
|
||||||
texture tmp{ target_, region.width, region.height, region.depth, 1, static_cast<GLenum>(m_internal_format) };
|
texture tmp{ target_, region.width, region.height, region.depth, 1, 1, static_cast<GLenum>(m_internal_format) };
|
||||||
glCopyImageSubData(m_id, target_, level, region.x, region.y, region.z, tmp.id(), target_, 0, 0, 0, 0,
|
glCopyImageSubData(m_id, target_, level, region.x, region.y, region.z, tmp.id(), target_, 0, 0, 0, 0,
|
||||||
region.width, region.height, region.depth);
|
region.width, region.height, region.depth);
|
||||||
|
|
||||||
|
|
|
@ -183,6 +183,7 @@ namespace gl
|
||||||
GLuint m_height = 0;
|
GLuint m_height = 0;
|
||||||
GLuint m_depth = 0;
|
GLuint m_depth = 0;
|
||||||
GLuint m_mipmaps = 0;
|
GLuint m_mipmaps = 0;
|
||||||
|
GLubyte m_samples = 0;
|
||||||
GLuint m_pitch = 0;
|
GLuint m_pitch = 0;
|
||||||
GLuint m_compressed = GL_FALSE;
|
GLuint m_compressed = GL_FALSE;
|
||||||
GLuint m_aspect_flags = 0;
|
GLuint m_aspect_flags = 0;
|
||||||
|
@ -197,7 +198,7 @@ namespace gl
|
||||||
texture(const texture&) = delete;
|
texture(const texture&) = delete;
|
||||||
texture(texture&& texture_) = delete;
|
texture(texture&& texture_) = delete;
|
||||||
|
|
||||||
texture(GLenum target, GLuint width, GLuint height, GLuint depth, GLuint mipmaps, GLenum sized_format, rsx::format_class format_class = rsx::RSX_FORMAT_CLASS_UNDEFINED);
|
texture(GLenum target, GLuint width, GLuint height, GLuint depth, GLuint mipmaps, GLubyte samples, GLenum sized_format, rsx::format_class format_class = rsx::RSX_FORMAT_CLASS_UNDEFINED);
|
||||||
virtual ~texture();
|
virtual ~texture();
|
||||||
|
|
||||||
// Getters/setters
|
// Getters/setters
|
||||||
|
@ -276,9 +277,9 @@ namespace gl
|
||||||
return m_pitch;
|
return m_pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr GLubyte samples() const
|
GLubyte samples() const
|
||||||
{
|
{
|
||||||
return 1;
|
return m_samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLboolean compressed() const
|
GLboolean compressed() const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue