mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 14:31:24 +12:00
gl: Implement multisampled image creation
This commit is contained in:
parent
82981384d5
commit
2a4bd6a7fc
7 changed files with 65 additions and 0 deletions
|
@ -492,6 +492,7 @@ target_sources(rpcs3_emu PRIVATE
|
||||||
RSX/GL/GLPipelineCompiler.cpp
|
RSX/GL/GLPipelineCompiler.cpp
|
||||||
RSX/GL/GLPresent.cpp
|
RSX/GL/GLPresent.cpp
|
||||||
RSX/GL/GLRenderTargets.cpp
|
RSX/GL/GLRenderTargets.cpp
|
||||||
|
RSX/GL/GLResolveHelper.cpp
|
||||||
RSX/GL/GLShaderInterpreter.cpp
|
RSX/GL/GLShaderInterpreter.cpp
|
||||||
RSX/GL/GLTexture.cpp
|
RSX/GL/GLTexture.cpp
|
||||||
RSX/GL/GLTextureCache.cpp
|
RSX/GL/GLTextureCache.cpp
|
||||||
|
|
|
@ -259,6 +259,10 @@ OPENGL_PROC(PFNGLTEXSTORAGE1DPROC, TexStorage1D);
|
||||||
OPENGL_PROC(PFNGLTEXSTORAGE2DPROC, TexStorage2D);
|
OPENGL_PROC(PFNGLTEXSTORAGE2DPROC, TexStorage2D);
|
||||||
OPENGL_PROC(PFNGLTEXSTORAGE3DPROC, TexStorage3D);
|
OPENGL_PROC(PFNGLTEXSTORAGE3DPROC, TexStorage3D);
|
||||||
|
|
||||||
|
// ARB_texture_multisample
|
||||||
|
OPENGL_PROC(PFNGLTEXSTORAGE2DMULTISAMPLEPROC, TexStorage2DMultisample);
|
||||||
|
OPENGL_PROC(PFNGLTEXSTORAGE3DMULTISAMPLEPROC, TexStorage3DMultisample);
|
||||||
|
|
||||||
// Texture_View
|
// Texture_View
|
||||||
OPENGL_PROC(PFNGLTEXTUREVIEWPROC, TextureView);
|
OPENGL_PROC(PFNGLTEXTUREVIEWPROC, TextureView);
|
||||||
|
|
||||||
|
|
15
rpcs3/Emu/RSX/GL/GLResolveHelper.cpp
Normal file
15
rpcs3/Emu/RSX/GL/GLResolveHelper.cpp
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "GLResolveHelper.h"
|
||||||
|
|
||||||
|
namespace gl
|
||||||
|
{
|
||||||
|
void resolve_image(gl::command_context& cmd, gl::viewable_image* dst, gl::viewable_image* src)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void unresolve_image(gl::command_context& cmd, gl::viewable_image* dst, gl::viewable_image* src)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
10
rpcs3/Emu/RSX/GL/GLResolveHelper.h
Normal file
10
rpcs3/Emu/RSX/GL/GLResolveHelper.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "GLCompute.h"
|
||||||
|
#include "GLOverlays.h"
|
||||||
|
|
||||||
|
namespace gl
|
||||||
|
{
|
||||||
|
void resolve_image(gl::command_context& cmd, gl::viewable_image* dst, gl::viewable_image* src);
|
||||||
|
void unresolve_image(gl::command_context& cmd, gl::viewable_image* dst, gl::viewable_image* src);
|
||||||
|
}
|
|
@ -21,6 +21,22 @@ namespace gl
|
||||||
|
|
||||||
texture::texture(GLenum target, GLuint width, GLuint height, GLuint depth, GLuint mipmaps, GLubyte samples, 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)
|
||||||
{
|
{
|
||||||
|
// Upgrade targets for MSAA
|
||||||
|
if (samples > 1)
|
||||||
|
{
|
||||||
|
switch (target)
|
||||||
|
{
|
||||||
|
case GL_TEXTURE_2D:
|
||||||
|
target = GL_TEXTURE_2D_MULTISAMPLE;
|
||||||
|
break;
|
||||||
|
case GL_TEXTURE_2D_ARRAY:
|
||||||
|
target = GL_TEXTURE_2D_MULTISAMPLE_ARRAY;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fmt::throw_exception("MSAA is only supported on 2D images. Target=0x%x", target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
glGenTextures(1, &m_id);
|
glGenTextures(1, &m_id);
|
||||||
|
|
||||||
// Must bind to initialize the new texture
|
// Must bind to initialize the new texture
|
||||||
|
@ -40,10 +56,19 @@ namespace gl
|
||||||
glTexStorage2D(target, mipmaps, storage_fmt, width, height);
|
glTexStorage2D(target, mipmaps, storage_fmt, width, height);
|
||||||
depth = 1;
|
depth = 1;
|
||||||
break;
|
break;
|
||||||
|
case GL_TEXTURE_2D_MULTISAMPLE:
|
||||||
|
ensure(mipmaps == 1);
|
||||||
|
glTexStorage2DMultisample(target, samples, storage_fmt, width, height, GL_TRUE);
|
||||||
|
depth = 1;
|
||||||
|
break;
|
||||||
case GL_TEXTURE_3D:
|
case GL_TEXTURE_3D:
|
||||||
case GL_TEXTURE_2D_ARRAY:
|
case GL_TEXTURE_2D_ARRAY:
|
||||||
glTexStorage3D(target, mipmaps, storage_fmt, width, height, depth);
|
glTexStorage3D(target, mipmaps, storage_fmt, width, height, depth);
|
||||||
break;
|
break;
|
||||||
|
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
|
||||||
|
ensure(mipmaps == 1);
|
||||||
|
glTexStorage3DMultisample(target, samples, storage_fmt, width, height, depth, GL_TRUE);
|
||||||
|
break;
|
||||||
case GL_TEXTURE_BUFFER:
|
case GL_TEXTURE_BUFFER:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -149,6 +174,8 @@ namespace gl
|
||||||
|
|
||||||
void texture::copy_from(const void* src, texture::format format, texture::type type, int level, const coord3u region, const pixel_unpack_settings& pixel_settings)
|
void texture::copy_from(const void* src, texture::format format, texture::type type, int level, const coord3u region, const pixel_unpack_settings& pixel_settings)
|
||||||
{
|
{
|
||||||
|
ensure(m_samples == 1, "Transfer operations are unsupported on multisampled textures.");
|
||||||
|
|
||||||
pixel_settings.apply();
|
pixel_settings.apply();
|
||||||
|
|
||||||
switch (const auto target_ = static_cast<GLenum>(m_target))
|
switch (const auto target_ = static_cast<GLenum>(m_target))
|
||||||
|
@ -193,6 +220,8 @@ namespace gl
|
||||||
|
|
||||||
void texture::copy_from(buffer& buf, u32 gl_format_type, u32 offset, u32 length)
|
void texture::copy_from(buffer& buf, u32 gl_format_type, u32 offset, u32 length)
|
||||||
{
|
{
|
||||||
|
ensure(m_samples == 1, "Transfer operations are unsupported on multisampled textures.");
|
||||||
|
|
||||||
if (get_target() != target::textureBuffer)
|
if (get_target() != target::textureBuffer)
|
||||||
fmt::throw_exception("OpenGL error: texture cannot copy from buffer");
|
fmt::throw_exception("OpenGL error: texture cannot copy from buffer");
|
||||||
|
|
||||||
|
@ -206,6 +235,8 @@ namespace gl
|
||||||
|
|
||||||
void texture::copy_to(void* dst, texture::format format, texture::type type, int level, const coord3u& region, const pixel_pack_settings& pixel_settings) const
|
void texture::copy_to(void* dst, texture::format format, texture::type type, int level, const coord3u& region, const pixel_pack_settings& pixel_settings) const
|
||||||
{
|
{
|
||||||
|
ensure(m_samples == 1, "Transfer operations are unsupported on multisampled textures.");
|
||||||
|
|
||||||
pixel_settings.apply();
|
pixel_settings.apply();
|
||||||
const auto& caps = get_driver_caps();
|
const auto& caps = get_driver_caps();
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
<ClInclude Include="Emu\RSX\GL\GLGSRender.h" />
|
<ClInclude Include="Emu\RSX\GL\GLGSRender.h" />
|
||||||
<ClInclude Include="Emu\RSX\GL\GLProcTable.h" />
|
<ClInclude Include="Emu\RSX\GL\GLProcTable.h" />
|
||||||
<ClInclude Include="Emu\RSX\GL\GLProgramBuffer.h" />
|
<ClInclude Include="Emu\RSX\GL\GLProgramBuffer.h" />
|
||||||
|
<ClInclude Include="Emu\RSX\GL\GLResolveHelpers.h" />
|
||||||
<ClInclude Include="Emu\RSX\GL\glutils\blitter.h" />
|
<ClInclude Include="Emu\RSX\GL\glutils\blitter.h" />
|
||||||
<ClInclude Include="Emu\RSX\GL\glutils\buffer_object.h" />
|
<ClInclude Include="Emu\RSX\GL\glutils\buffer_object.h" />
|
||||||
<ClInclude Include="Emu\RSX\GL\glutils\capabilities.h" />
|
<ClInclude Include="Emu\RSX\GL\glutils\capabilities.h" />
|
||||||
|
@ -95,6 +96,7 @@
|
||||||
<ClCompile Include="Emu\RSX\GL\GLGSRender.cpp" />
|
<ClCompile Include="Emu\RSX\GL\GLGSRender.cpp" />
|
||||||
<ClCompile Include="Emu\RSX\GL\GLOverlays.cpp" />
|
<ClCompile Include="Emu\RSX\GL\GLOverlays.cpp" />
|
||||||
<ClCompile Include="Emu\RSX\GL\GLPipelineCompiler.cpp" />
|
<ClCompile Include="Emu\RSX\GL\GLPipelineCompiler.cpp" />
|
||||||
|
<ClCompile Include="Emu\RSX\GL\GLResolveHelpers.cpp" />
|
||||||
<ClCompile Include="Emu\RSX\GL\glutils\blitter.cpp" />
|
<ClCompile Include="Emu\RSX\GL\glutils\blitter.cpp" />
|
||||||
<ClCompile Include="Emu\RSX\GL\glutils\buffer_object.cpp" />
|
<ClCompile Include="Emu\RSX\GL\glutils\buffer_object.cpp" />
|
||||||
<ClCompile Include="Emu\RSX\GL\glutils\capabilities.cpp" />
|
<ClCompile Include="Emu\RSX\GL\glutils\capabilities.cpp" />
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
<Filter>upscalers\fsr1</Filter>
|
<Filter>upscalers\fsr1</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Emu\RSX\GL\GLDMA.cpp" />
|
<ClCompile Include="Emu\RSX\GL\GLDMA.cpp" />
|
||||||
|
<ClCompile Include="Emu\RSX\GL\GLResolveHelpers.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Emu\RSX\GL\GLTexture.h" />
|
<ClInclude Include="Emu\RSX\GL\GLTexture.h" />
|
||||||
|
@ -120,6 +121,7 @@
|
||||||
<Filter>upscalers</Filter>
|
<Filter>upscalers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Emu\RSX\GL\GLDMA.h" />
|
<ClInclude Include="Emu\RSX\GL\GLDMA.h" />
|
||||||
|
<ClInclude Include="Emu\RSX\GL\GLResolveHelpers.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="glutils">
|
<Filter Include="glutils">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue