diff options
author | bunnei <bunneidev@gmail.com> | 2018-09-01 08:42:43 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-09-08 08:53:37 +0200 |
commit | 030676b95d8f0c0cd6c288f59daf94bbda6c7133 (patch) | |
tree | c49f4fc4b5d797b7af730c8292555a748250ab41 /src/video_core/renderer_opengl/gl_rasterizer_cache.h | |
parent | gl_rasterizer_cache: Remove unused DownloadGLTexture. (diff) | |
download | yuzu-030676b95d8f0c0cd6c288f59daf94bbda6c7133.tar yuzu-030676b95d8f0c0cd6c288f59daf94bbda6c7133.tar.gz yuzu-030676b95d8f0c0cd6c288f59daf94bbda6c7133.tar.bz2 yuzu-030676b95d8f0c0cd6c288f59daf94bbda6c7133.tar.lz yuzu-030676b95d8f0c0cd6c288f59daf94bbda6c7133.tar.xz yuzu-030676b95d8f0c0cd6c288f59daf94bbda6c7133.tar.zst yuzu-030676b95d8f0c0cd6c288f59daf94bbda6c7133.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index b17867f64..6693b5cda 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -109,6 +109,33 @@ struct SurfaceParams { Invalid = 4, }; + enum class SurfaceTarget { + Texture1D, + Texture2D, + Texture3D, + Texture1DArray, + Texture2DArray, + TextureCubemap, + }; + + static SurfaceTarget SurfaceTargetFromTextureType(Tegra::Texture::TextureType texture_type) { + switch (texture_type) { + case Tegra::Texture::TextureType::Texture1D: + return SurfaceTarget::Texture1D; + case Tegra::Texture::TextureType::Texture2D: + case Tegra::Texture::TextureType::Texture2DNoMipmap: + return SurfaceTarget::Texture2D; + case Tegra::Texture::TextureType::Texture1DArray: + return SurfaceTarget::Texture1DArray; + case Tegra::Texture::TextureType::Texture2DArray: + return SurfaceTarget::Texture2DArray; + default: + LOG_CRITICAL(HW_GPU, "Unimplemented texture_type={}", static_cast<u32>(texture_type)); + UNREACHABLE(); + return SurfaceTarget::Texture2D; + } + } + /** * Gets the compression factor for the specified PixelFormat. This applies to just the * "compressed width" and "compressed height", not the overall compression factor of a @@ -666,6 +693,7 @@ struct SurfaceParams { u32 height; u32 unaligned_height; size_t size_in_bytes; + SurfaceTarget target; // Parameters used for caching only u32 cache_width; @@ -709,6 +737,10 @@ public: return texture; } + GLenum Target() const { + return gl_target; + } + static constexpr unsigned int GetGLBytesPerPixel(SurfaceParams::PixelFormat format) { if (format == SurfaceParams::PixelFormat::Invalid) return 0; @@ -724,13 +756,14 @@ public: void LoadGLBuffer(); void FlushGLBuffer(); - // Upload/Download data in gl_buffer in/to this surface's texture + // Upload data in gl_buffer to this surface's texture void UploadGLTexture(GLuint read_fb_handle, GLuint draw_fb_handle); private: OGLTexture texture; std::vector<u8> gl_buffer; SurfaceParams params; + GLenum gl_target; }; class RasterizerCacheOpenGL final : public RasterizerCache<Surface> { |