Merge pull request #2070 from ReinUsesLisp/cubearray-view
gl_shader_cache: Fix texture view for cubemaps as cubemap arrays
This commit is contained in:
commit
3c3d9afd61
|
@ -167,6 +167,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
|
||||||
}
|
}
|
||||||
|
|
||||||
params.is_layered = SurfaceTargetIsLayered(params.target);
|
params.is_layered = SurfaceTargetIsLayered(params.target);
|
||||||
|
params.is_array = SurfaceTargetIsArray(params.target);
|
||||||
params.max_mip_level = config.tic.max_mip_level + 1;
|
params.max_mip_level = config.tic.max_mip_level + 1;
|
||||||
params.rt = {};
|
params.rt = {};
|
||||||
|
|
||||||
|
@ -877,10 +878,13 @@ void CachedSurface::EnsureTextureView() {
|
||||||
UNIMPLEMENTED_IF(gl_is_compressed);
|
UNIMPLEMENTED_IF(gl_is_compressed);
|
||||||
|
|
||||||
const GLenum target{TargetLayer()};
|
const GLenum target{TargetLayer()};
|
||||||
|
const GLuint num_layers{target == GL_TEXTURE_CUBE_MAP_ARRAY ? 6u : 1u};
|
||||||
|
constexpr GLuint min_layer = 0;
|
||||||
|
constexpr GLuint min_level = 0;
|
||||||
|
|
||||||
texture_view.Create();
|
texture_view.Create();
|
||||||
glTextureView(texture_view.handle, target, texture.handle, gl_internal_format, 0,
|
glTextureView(texture_view.handle, target, texture.handle, gl_internal_format, min_level,
|
||||||
params.max_mip_level, 0, 1);
|
params.max_mip_level, min_layer, num_layers);
|
||||||
|
|
||||||
OpenGLState cur_state = OpenGLState::GetCurState();
|
OpenGLState cur_state = OpenGLState::GetCurState();
|
||||||
const auto& old_tex = cur_state.texture_units[0];
|
const auto& old_tex = cur_state.texture_units[0];
|
||||||
|
|
|
@ -225,6 +225,7 @@ struct SurfaceParams {
|
||||||
SurfaceTarget target;
|
SurfaceTarget target;
|
||||||
u32 max_mip_level;
|
u32 max_mip_level;
|
||||||
bool is_layered;
|
bool is_layered;
|
||||||
|
bool is_array;
|
||||||
bool srgb_conversion;
|
bool srgb_conversion;
|
||||||
// Parameters used for caching
|
// Parameters used for caching
|
||||||
VAddr addr;
|
VAddr addr;
|
||||||
|
@ -294,7 +295,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
const OGLTexture& TextureLayer() {
|
const OGLTexture& TextureLayer() {
|
||||||
if (params.is_layered) {
|
if (params.is_array) {
|
||||||
return Texture();
|
return Texture();
|
||||||
}
|
}
|
||||||
EnsureTextureView();
|
EnsureTextureView();
|
||||||
|
|
|
@ -50,6 +50,24 @@ bool SurfaceTargetIsLayered(SurfaceTarget target) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SurfaceTargetIsArray(SurfaceTarget target) {
|
||||||
|
switch (target) {
|
||||||
|
case SurfaceTarget::Texture1D:
|
||||||
|
case SurfaceTarget::Texture2D:
|
||||||
|
case SurfaceTarget::Texture3D:
|
||||||
|
case SurfaceTarget::TextureCubemap:
|
||||||
|
return false;
|
||||||
|
case SurfaceTarget::Texture1DArray:
|
||||||
|
case SurfaceTarget::Texture2DArray:
|
||||||
|
case SurfaceTarget::TextureCubeArray:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
LOG_CRITICAL(HW_GPU, "Unimplemented surface_target={}", static_cast<u32>(target));
|
||||||
|
UNREACHABLE();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format) {
|
PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case Tegra::DepthFormat::S8_Z24_UNORM:
|
case Tegra::DepthFormat::S8_Z24_UNORM:
|
||||||
|
|
|
@ -441,6 +441,8 @@ SurfaceTarget SurfaceTargetFromTextureType(Tegra::Texture::TextureType texture_t
|
||||||
|
|
||||||
bool SurfaceTargetIsLayered(SurfaceTarget target);
|
bool SurfaceTargetIsLayered(SurfaceTarget target);
|
||||||
|
|
||||||
|
bool SurfaceTargetIsArray(SurfaceTarget target);
|
||||||
|
|
||||||
PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format);
|
PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format);
|
||||||
|
|
||||||
PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format);
|
PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format);
|
||||||
|
|
Loading…
Reference in a new issue