summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Morph2020-06-13 08:17:37 -0400
committerGravatar Morph2020-06-18 04:56:31 -0400
commit8868fb745f5adaab83a26d74ebce35ed371adffe (patch)
tree12d13068941c36546739655e99991678bbc8f863 /src
parentMerge pull request #4092 from Morph1984/image-bindings (diff)
downloadyuzu-8868fb745f5adaab83a26d74ebce35ed371adffe.tar.gz
yuzu-8868fb745f5adaab83a26d74ebce35ed371adffe.tar.xz
yuzu-8868fb745f5adaab83a26d74ebce35ed371adffe.zip
maxwell_to_gl: Miscellaneous changes
maxwell_to_gl: Log unimplemented features under UNIMPLEMENTED_MSG instead of LOG_ERROR to bring into parity with maxwell_to_vk maxwell_to_gl: Deduplicate logging in VertexType(), merging them into one. maxwell_to_gl: Return GL_NEAREST instead of GL_LINEAR if an unknown texture filter mode is encountered. maxwell_to_gl: Log the mipmap filter mode if an unknown value is passed in. maxwell_to_gl: Reorder filtering modes to start with None, then Nearest, then Linear.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/maxwell_to_gl.h82
1 files changed, 34 insertions, 48 deletions
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h
index 994ae98eb..35e329240 100644
--- a/src/video_core/renderer_opengl/maxwell_to_gl.h
+++ b/src/video_core/renderer_opengl/maxwell_to_gl.h
@@ -46,10 +46,8 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
46 return GL_UNSIGNED_INT; 46 return GL_UNSIGNED_INT;
47 case Maxwell::VertexAttribute::Size::Size_10_10_10_2: 47 case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
48 return GL_UNSIGNED_INT_2_10_10_10_REV; 48 return GL_UNSIGNED_INT_2_10_10_10_REV;
49 default:
50 LOG_ERROR(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
51 return {};
52 } 49 }
50 break;
53 case Maxwell::VertexAttribute::Type::SignedInt: 51 case Maxwell::VertexAttribute::Type::SignedInt:
54 case Maxwell::VertexAttribute::Type::SignedNorm: 52 case Maxwell::VertexAttribute::Type::SignedNorm:
55 switch (attrib.size) { 53 switch (attrib.size) {
@@ -70,10 +68,8 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
70 return GL_INT; 68 return GL_INT;
71 case Maxwell::VertexAttribute::Size::Size_10_10_10_2: 69 case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
72 return GL_INT_2_10_10_10_REV; 70 return GL_INT_2_10_10_10_REV;
73 default:
74 LOG_ERROR(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
75 return {};
76 } 71 }
72 break;
77 case Maxwell::VertexAttribute::Type::Float: 73 case Maxwell::VertexAttribute::Type::Float:
78 switch (attrib.size) { 74 switch (attrib.size) {
79 case Maxwell::VertexAttribute::Size::Size_16: 75 case Maxwell::VertexAttribute::Size::Size_16:
@@ -86,10 +82,8 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
86 case Maxwell::VertexAttribute::Size::Size_32_32_32: 82 case Maxwell::VertexAttribute::Size::Size_32_32_32:
87 case Maxwell::VertexAttribute::Size::Size_32_32_32_32: 83 case Maxwell::VertexAttribute::Size::Size_32_32_32_32:
88 return GL_FLOAT; 84 return GL_FLOAT;
89 default:
90 LOG_ERROR(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
91 return {};
92 } 85 }
86 break;
93 case Maxwell::VertexAttribute::Type::UnsignedScaled: 87 case Maxwell::VertexAttribute::Type::UnsignedScaled:
94 switch (attrib.size) { 88 switch (attrib.size) {
95 case Maxwell::VertexAttribute::Size::Size_8: 89 case Maxwell::VertexAttribute::Size::Size_8:
@@ -102,10 +96,8 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
102 case Maxwell::VertexAttribute::Size::Size_16_16_16: 96 case Maxwell::VertexAttribute::Size::Size_16_16_16:
103 case Maxwell::VertexAttribute::Size::Size_16_16_16_16: 97 case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
104 return GL_UNSIGNED_SHORT; 98 return GL_UNSIGNED_SHORT;
105 default:
106 LOG_ERROR(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
107 return {};
108 } 99 }
100 break;
109 case Maxwell::VertexAttribute::Type::SignedScaled: 101 case Maxwell::VertexAttribute::Type::SignedScaled:
110 switch (attrib.size) { 102 switch (attrib.size) {
111 case Maxwell::VertexAttribute::Size::Size_8: 103 case Maxwell::VertexAttribute::Size::Size_8:
@@ -118,14 +110,12 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
118 case Maxwell::VertexAttribute::Size::Size_16_16_16: 110 case Maxwell::VertexAttribute::Size::Size_16_16_16:
119 case Maxwell::VertexAttribute::Size::Size_16_16_16_16: 111 case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
120 return GL_SHORT; 112 return GL_SHORT;
121 default:
122 LOG_ERROR(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
123 return {};
124 } 113 }
125 default: 114 break;
126 LOG_ERROR(Render_OpenGL, "Unimplemented vertex type={}", attrib.TypeString());
127 return {};
128 } 115 }
116 UNIMPLEMENTED_MSG("Unimplemented vertex type={} and size={}", attrib.TypeString(),
117 attrib.SizeString());
118 return {};
129} 119}
130 120
131inline GLenum IndexFormat(Maxwell::IndexFormat index_format) { 121inline GLenum IndexFormat(Maxwell::IndexFormat index_format) {
@@ -137,8 +127,7 @@ inline GLenum IndexFormat(Maxwell::IndexFormat index_format) {
137 case Maxwell::IndexFormat::UnsignedInt: 127 case Maxwell::IndexFormat::UnsignedInt:
138 return GL_UNSIGNED_INT; 128 return GL_UNSIGNED_INT;
139 } 129 }
140 LOG_CRITICAL(Render_OpenGL, "Unimplemented index_format={}", static_cast<u32>(index_format)); 130 UNREACHABLE_MSG("Invalid index_format={}", static_cast<u32>(index_format));
141 UNREACHABLE();
142 return {}; 131 return {};
143} 132}
144 133
@@ -180,33 +169,32 @@ inline GLenum PrimitiveTopology(Maxwell::PrimitiveTopology topology) {
180} 169}
181 170
182inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode, 171inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode,
183 Tegra::Texture::TextureMipmapFilter mip_filter_mode) { 172 Tegra::Texture::TextureMipmapFilter mipmap_filter_mode) {
184 switch (filter_mode) { 173 switch (filter_mode) {
185 case Tegra::Texture::TextureFilter::Linear: { 174 case Tegra::Texture::TextureFilter::Nearest:
186 switch (mip_filter_mode) { 175 switch (mipmap_filter_mode) {
187 case Tegra::Texture::TextureMipmapFilter::None: 176 case Tegra::Texture::TextureMipmapFilter::None:
188 return GL_LINEAR; 177 return GL_NEAREST;
189 case Tegra::Texture::TextureMipmapFilter::Nearest: 178 case Tegra::Texture::TextureMipmapFilter::Nearest:
190 return GL_LINEAR_MIPMAP_NEAREST; 179 return GL_NEAREST_MIPMAP_NEAREST;
191 case Tegra::Texture::TextureMipmapFilter::Linear: 180 case Tegra::Texture::TextureMipmapFilter::Linear:
192 return GL_LINEAR_MIPMAP_LINEAR; 181 return GL_NEAREST_MIPMAP_LINEAR;
193 } 182 }
194 break; 183 break;
195 } 184 case Tegra::Texture::TextureFilter::Linear:
196 case Tegra::Texture::TextureFilter::Nearest: { 185 switch (mipmap_filter_mode) {
197 switch (mip_filter_mode) {
198 case Tegra::Texture::TextureMipmapFilter::None: 186 case Tegra::Texture::TextureMipmapFilter::None:
199 return GL_NEAREST; 187 return GL_LINEAR;
200 case Tegra::Texture::TextureMipmapFilter::Nearest: 188 case Tegra::Texture::TextureMipmapFilter::Nearest:
201 return GL_NEAREST_MIPMAP_NEAREST; 189 return GL_LINEAR_MIPMAP_NEAREST;
202 case Tegra::Texture::TextureMipmapFilter::Linear: 190 case Tegra::Texture::TextureMipmapFilter::Linear:
203 return GL_NEAREST_MIPMAP_LINEAR; 191 return GL_LINEAR_MIPMAP_LINEAR;
204 } 192 }
205 break; 193 break;
206 } 194 }
207 } 195 UNREACHABLE_MSG("Invalid texture filter mode={} and mipmap filter mode={}",
208 LOG_ERROR(Render_OpenGL, "Unimplemented texture filter mode={}", static_cast<u32>(filter_mode)); 196 static_cast<u32>(filter_mode), static_cast<u32>(mipmap_filter_mode));
209 return GL_LINEAR; 197 return GL_NEAREST;
210} 198}
211 199
212inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) { 200inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) {
@@ -229,10 +217,9 @@ inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) {
229 } else { 217 } else {
230 return GL_MIRROR_CLAMP_TO_EDGE; 218 return GL_MIRROR_CLAMP_TO_EDGE;
231 } 219 }
232 default:
233 LOG_ERROR(Render_OpenGL, "Unimplemented texture wrap mode={}", static_cast<u32>(wrap_mode));
234 return GL_REPEAT;
235 } 220 }
221 UNIMPLEMENTED_MSG("Unimplemented texture wrap mode={}", static_cast<u32>(wrap_mode));
222 return GL_REPEAT;
236} 223}
237 224
238inline GLenum DepthCompareFunc(Tegra::Texture::DepthCompareFunc func) { 225inline GLenum DepthCompareFunc(Tegra::Texture::DepthCompareFunc func) {
@@ -254,8 +241,7 @@ inline GLenum DepthCompareFunc(Tegra::Texture::DepthCompareFunc func) {
254 case Tegra::Texture::DepthCompareFunc::Always: 241 case Tegra::Texture::DepthCompareFunc::Always:
255 return GL_ALWAYS; 242 return GL_ALWAYS;
256 } 243 }
257 LOG_ERROR(Render_OpenGL, "Unimplemented texture depth compare function ={}", 244 UNIMPLEMENTED_MSG("Unimplemented texture depth compare function={}", static_cast<u32>(func));
258 static_cast<u32>(func));
259 return GL_GREATER; 245 return GL_GREATER;
260} 246}
261 247
@@ -277,7 +263,7 @@ inline GLenum BlendEquation(Maxwell::Blend::Equation equation) {
277 case Maxwell::Blend::Equation::MaxGL: 263 case Maxwell::Blend::Equation::MaxGL:
278 return GL_MAX; 264 return GL_MAX;
279 } 265 }
280 LOG_ERROR(Render_OpenGL, "Unimplemented blend equation={}", static_cast<u32>(equation)); 266 UNIMPLEMENTED_MSG("Unimplemented blend equation={}", static_cast<u32>(equation));
281 return GL_FUNC_ADD; 267 return GL_FUNC_ADD;
282} 268}
283 269
@@ -341,7 +327,7 @@ inline GLenum BlendFunc(Maxwell::Blend::Factor factor) {
341 case Maxwell::Blend::Factor::OneMinusConstantAlphaGL: 327 case Maxwell::Blend::Factor::OneMinusConstantAlphaGL:
342 return GL_ONE_MINUS_CONSTANT_ALPHA; 328 return GL_ONE_MINUS_CONSTANT_ALPHA;
343 } 329 }
344 LOG_ERROR(Render_OpenGL, "Unimplemented blend factor={}", static_cast<u32>(factor)); 330 UNIMPLEMENTED_MSG("Unimplemented blend factor={}", static_cast<u32>(factor));
345 return GL_ZERO; 331 return GL_ZERO;
346} 332}
347 333
@@ -361,7 +347,7 @@ inline GLenum SwizzleSource(Tegra::Texture::SwizzleSource source) {
361 case Tegra::Texture::SwizzleSource::OneFloat: 347 case Tegra::Texture::SwizzleSource::OneFloat:
362 return GL_ONE; 348 return GL_ONE;
363 } 349 }
364 LOG_ERROR(Render_OpenGL, "Unimplemented swizzle source={}", static_cast<u32>(source)); 350 UNIMPLEMENTED_MSG("Unimplemented swizzle source={}", static_cast<u32>(source));
365 return GL_ZERO; 351 return GL_ZERO;
366} 352}
367 353
@@ -392,7 +378,7 @@ inline GLenum ComparisonOp(Maxwell::ComparisonOp comparison) {
392 case Maxwell::ComparisonOp::AlwaysOld: 378 case Maxwell::ComparisonOp::AlwaysOld:
393 return GL_ALWAYS; 379 return GL_ALWAYS;
394 } 380 }
395 LOG_ERROR(Render_OpenGL, "Unimplemented comparison op={}", static_cast<u32>(comparison)); 381 UNIMPLEMENTED_MSG("Unimplemented comparison op={}", static_cast<u32>(comparison));
396 return GL_ALWAYS; 382 return GL_ALWAYS;
397} 383}
398 384
@@ -423,7 +409,7 @@ inline GLenum StencilOp(Maxwell::StencilOp stencil) {
423 case Maxwell::StencilOp::DecrWrapOGL: 409 case Maxwell::StencilOp::DecrWrapOGL:
424 return GL_DECR_WRAP; 410 return GL_DECR_WRAP;
425 } 411 }
426 LOG_ERROR(Render_OpenGL, "Unimplemented stencil op={}", static_cast<u32>(stencil)); 412 UNIMPLEMENTED_MSG("Unimplemented stencil op={}", static_cast<u32>(stencil));
427 return GL_KEEP; 413 return GL_KEEP;
428} 414}
429 415
@@ -434,7 +420,7 @@ inline GLenum FrontFace(Maxwell::FrontFace front_face) {
434 case Maxwell::FrontFace::CounterClockWise: 420 case Maxwell::FrontFace::CounterClockWise:
435 return GL_CCW; 421 return GL_CCW;
436 } 422 }
437 LOG_ERROR(Render_OpenGL, "Unimplemented front face cull={}", static_cast<u32>(front_face)); 423 UNIMPLEMENTED_MSG("Unimplemented front face cull={}", static_cast<u32>(front_face));
438 return GL_CCW; 424 return GL_CCW;
439} 425}
440 426
@@ -447,7 +433,7 @@ inline GLenum CullFace(Maxwell::CullFace cull_face) {
447 case Maxwell::CullFace::FrontAndBack: 433 case Maxwell::CullFace::FrontAndBack:
448 return GL_FRONT_AND_BACK; 434 return GL_FRONT_AND_BACK;
449 } 435 }
450 LOG_ERROR(Render_OpenGL, "Unimplemented cull face={}", static_cast<u32>(cull_face)); 436 UNIMPLEMENTED_MSG("Unimplemented cull face={}", static_cast<u32>(cull_face));
451 return GL_BACK; 437 return GL_BACK;
452} 438}
453 439
@@ -486,7 +472,7 @@ inline GLenum LogicOp(Maxwell::LogicOperation operation) {
486 case Maxwell::LogicOperation::Set: 472 case Maxwell::LogicOperation::Set:
487 return GL_SET; 473 return GL_SET;
488 } 474 }
489 LOG_ERROR(Render_OpenGL, "Unimplemented logic operation={}", static_cast<u32>(operation)); 475 UNIMPLEMENTED_MSG("Unimplemented logic operation={}", static_cast<u32>(operation));
490 return GL_COPY; 476 return GL_COPY;
491} 477}
492 478