summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-04-28 01:01:22 -0300
committerGravatar ReinUsesLisp2019-06-20 21:36:12 -0300
commitb8c75a845b1784045a10fa8b5f1f57f2ec53eeca (patch)
treeb71f71b5d3d8c3d12556e3fbf9344dbb9e8f220c /src
parentgl_shader_decompiler: Allow 1D textures to be texture buffers (diff)
downloadyuzu-b8c75a845b1784045a10fa8b5f1f57f2ec53eeca.tar.gz
yuzu-b8c75a845b1784045a10fa8b5f1f57f2ec53eeca.tar.xz
yuzu-b8c75a845b1784045a10fa8b5f1f57f2ec53eeca.zip
maxwell_3d: Partially implement texture buffers as 1D textures
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/maxwell_3d.cpp12
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp2
-rw-r--r--src/video_core/surface.cpp2
-rw-r--r--src/video_core/textures/texture.h18
4 files changed, 24 insertions, 10 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 08d553696..8755b8af4 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -430,14 +430,10 @@ Texture::TICEntry Maxwell3D::GetTICEntry(u32 tic_index) const {
430 Texture::TICEntry tic_entry; 430 Texture::TICEntry tic_entry;
431 memory_manager.ReadBlockUnsafe(tic_address_gpu, &tic_entry, sizeof(Texture::TICEntry)); 431 memory_manager.ReadBlockUnsafe(tic_address_gpu, &tic_entry, sizeof(Texture::TICEntry));
432 432
433 ASSERT_MSG(tic_entry.header_version == Texture::TICHeaderVersion::BlockLinear || 433 const auto r_type{tic_entry.r_type.Value()};
434 tic_entry.header_version == Texture::TICHeaderVersion::Pitch, 434 const auto g_type{tic_entry.g_type.Value()};
435 "TIC versions other than BlockLinear or Pitch are unimplemented"); 435 const auto b_type{tic_entry.b_type.Value()};
436 436 const auto a_type{tic_entry.a_type.Value()};
437 const auto r_type = tic_entry.r_type.Value();
438 const auto g_type = tic_entry.g_type.Value();
439 const auto b_type = tic_entry.b_type.Value();
440 const auto a_type = tic_entry.a_type.Value();
441 437
442 // TODO(Subv): Different data types for separate components are not supported 438 // TODO(Subv): Different data types for separate components are not supported
443 DEBUG_ASSERT(r_type == g_type && r_type == b_type && r_type == a_type); 439 DEBUG_ASSERT(r_type == g_type && r_type == b_type && r_type == a_type);
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index a7681902e..543b36271 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -140,7 +140,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
140 140
141 params.width = Common::AlignUp(config.tic.Width(), GetCompressionFactor(params.pixel_format)); 141 params.width = Common::AlignUp(config.tic.Width(), GetCompressionFactor(params.pixel_format));
142 params.height = Common::AlignUp(config.tic.Height(), GetCompressionFactor(params.pixel_format)); 142 params.height = Common::AlignUp(config.tic.Height(), GetCompressionFactor(params.pixel_format));
143 if (!params.is_tiled) { 143 if (config.tic.IsLineal()) {
144 params.pitch = config.tic.Pitch(); 144 params.pitch = config.tic.Pitch();
145 } 145 }
146 params.unaligned_height = config.tic.Height(); 146 params.unaligned_height = config.tic.Height();
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp
index 6384fa8d2..56c43af17 100644
--- a/src/video_core/surface.cpp
+++ b/src/video_core/surface.cpp
@@ -12,6 +12,8 @@ SurfaceTarget SurfaceTargetFromTextureType(Tegra::Texture::TextureType texture_t
12 switch (texture_type) { 12 switch (texture_type) {
13 case Tegra::Texture::TextureType::Texture1D: 13 case Tegra::Texture::TextureType::Texture1D:
14 return SurfaceTarget::Texture1D; 14 return SurfaceTarget::Texture1D;
15 case Tegra::Texture::TextureType::Texture1DBuffer:
16 return SurfaceTarget::Texture1D; // Fixme
15 case Tegra::Texture::TextureType::Texture2D: 17 case Tegra::Texture::TextureType::Texture2D:
16 case Tegra::Texture::TextureType::Texture2DNoMipmap: 18 case Tegra::Texture::TextureType::Texture2DNoMipmap:
17 return SurfaceTarget::Texture2D; 19 return SurfaceTarget::Texture2D;
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h
index f22b4e7c7..ddeed73d0 100644
--- a/src/video_core/textures/texture.h
+++ b/src/video_core/textures/texture.h
@@ -172,12 +172,16 @@ struct TICEntry {
172 BitField<26, 1, u32> use_header_opt_control; 172 BitField<26, 1, u32> use_header_opt_control;
173 BitField<27, 1, u32> depth_texture; 173 BitField<27, 1, u32> depth_texture;
174 BitField<28, 4, u32> max_mip_level; 174 BitField<28, 4, u32> max_mip_level;
175
176 BitField<0, 16, u32> buffer_high_width_minus_one;
175 }; 177 };
176 union { 178 union {
177 BitField<0, 16, u32> width_minus_1; 179 BitField<0, 16, u32> width_minus_1;
178 BitField<22, 1, u32> srgb_conversion; 180 BitField<22, 1, u32> srgb_conversion;
179 BitField<23, 4, TextureType> texture_type; 181 BitField<23, 4, TextureType> texture_type;
180 BitField<29, 3, u32> border_size; 182 BitField<29, 3, u32> border_size;
183
184 BitField<0, 16, u32> buffer_low_width_minus_one;
181 }; 185 };
182 union { 186 union {
183 BitField<0, 16, u32> height_minus_1; 187 BitField<0, 16, u32> height_minus_1;
@@ -206,7 +210,10 @@ struct TICEntry {
206 } 210 }
207 211
208 u32 Width() const { 212 u32 Width() const {
209 return width_minus_1 + 1; 213 if (header_version != TICHeaderVersion::OneDBuffer) {
214 return width_minus_1 + 1;
215 }
216 return (buffer_high_width_minus_one << 16) | buffer_low_width_minus_one;
210 } 217 }
211 218
212 u32 Height() const { 219 u32 Height() const {
@@ -237,6 +244,15 @@ struct TICEntry {
237 header_version == TICHeaderVersion::BlockLinearColorKey; 244 header_version == TICHeaderVersion::BlockLinearColorKey;
238 } 245 }
239 246
247 bool IsLineal() const {
248 return header_version == TICHeaderVersion::Pitch ||
249 header_version == TICHeaderVersion::PitchColorKey;
250 }
251
252 bool IsBuffer() const {
253 return header_version == TICHeaderVersion::OneDBuffer;
254 }
255
240 bool IsSrgbConversionEnabled() const { 256 bool IsSrgbConversionEnabled() const {
241 return srgb_conversion != 0; 257 return srgb_conversion != 0;
242 } 258 }