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.
This commit is contained in:
parent
edb2114bac
commit
8868fb745f
|
@ -46,10 +46,8 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
|
||||||
return GL_UNSIGNED_INT;
|
return GL_UNSIGNED_INT;
|
||||||
case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
|
case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
|
||||||
return GL_UNSIGNED_INT_2_10_10_10_REV;
|
return GL_UNSIGNED_INT_2_10_10_10_REV;
|
||||||
default:
|
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case Maxwell::VertexAttribute::Type::SignedInt:
|
case Maxwell::VertexAttribute::Type::SignedInt:
|
||||||
case Maxwell::VertexAttribute::Type::SignedNorm:
|
case Maxwell::VertexAttribute::Type::SignedNorm:
|
||||||
switch (attrib.size) {
|
switch (attrib.size) {
|
||||||
|
@ -70,10 +68,8 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
|
||||||
return GL_INT;
|
return GL_INT;
|
||||||
case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
|
case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
|
||||||
return GL_INT_2_10_10_10_REV;
|
return GL_INT_2_10_10_10_REV;
|
||||||
default:
|
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case Maxwell::VertexAttribute::Type::Float:
|
case Maxwell::VertexAttribute::Type::Float:
|
||||||
switch (attrib.size) {
|
switch (attrib.size) {
|
||||||
case Maxwell::VertexAttribute::Size::Size_16:
|
case Maxwell::VertexAttribute::Size::Size_16:
|
||||||
|
@ -86,10 +82,8 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
|
||||||
case Maxwell::VertexAttribute::Size::Size_32_32_32:
|
case Maxwell::VertexAttribute::Size::Size_32_32_32:
|
||||||
case Maxwell::VertexAttribute::Size::Size_32_32_32_32:
|
case Maxwell::VertexAttribute::Size::Size_32_32_32_32:
|
||||||
return GL_FLOAT;
|
return GL_FLOAT;
|
||||||
default:
|
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case Maxwell::VertexAttribute::Type::UnsignedScaled:
|
case Maxwell::VertexAttribute::Type::UnsignedScaled:
|
||||||
switch (attrib.size) {
|
switch (attrib.size) {
|
||||||
case Maxwell::VertexAttribute::Size::Size_8:
|
case Maxwell::VertexAttribute::Size::Size_8:
|
||||||
|
@ -102,10 +96,8 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
|
||||||
case Maxwell::VertexAttribute::Size::Size_16_16_16:
|
case Maxwell::VertexAttribute::Size::Size_16_16_16:
|
||||||
case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
|
case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
|
||||||
return GL_UNSIGNED_SHORT;
|
return GL_UNSIGNED_SHORT;
|
||||||
default:
|
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case Maxwell::VertexAttribute::Type::SignedScaled:
|
case Maxwell::VertexAttribute::Type::SignedScaled:
|
||||||
switch (attrib.size) {
|
switch (attrib.size) {
|
||||||
case Maxwell::VertexAttribute::Size::Size_8:
|
case Maxwell::VertexAttribute::Size::Size_8:
|
||||||
|
@ -118,14 +110,12 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
|
||||||
case Maxwell::VertexAttribute::Size::Size_16_16_16:
|
case Maxwell::VertexAttribute::Size::Size_16_16_16:
|
||||||
case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
|
case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
|
||||||
return GL_SHORT;
|
return GL_SHORT;
|
||||||
default:
|
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
default:
|
break;
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented vertex type={}", attrib.TypeString());
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
UNIMPLEMENTED_MSG("Unimplemented vertex type={} and size={}", attrib.TypeString(),
|
||||||
|
attrib.SizeString());
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline GLenum IndexFormat(Maxwell::IndexFormat index_format) {
|
inline GLenum IndexFormat(Maxwell::IndexFormat index_format) {
|
||||||
|
@ -137,8 +127,7 @@ inline GLenum IndexFormat(Maxwell::IndexFormat index_format) {
|
||||||
case Maxwell::IndexFormat::UnsignedInt:
|
case Maxwell::IndexFormat::UnsignedInt:
|
||||||
return GL_UNSIGNED_INT;
|
return GL_UNSIGNED_INT;
|
||||||
}
|
}
|
||||||
LOG_CRITICAL(Render_OpenGL, "Unimplemented index_format={}", static_cast<u32>(index_format));
|
UNREACHABLE_MSG("Invalid index_format={}", static_cast<u32>(index_format));
|
||||||
UNREACHABLE();
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,10 +169,20 @@ inline GLenum PrimitiveTopology(Maxwell::PrimitiveTopology topology) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode,
|
inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode,
|
||||||
Tegra::Texture::TextureMipmapFilter mip_filter_mode) {
|
Tegra::Texture::TextureMipmapFilter mipmap_filter_mode) {
|
||||||
switch (filter_mode) {
|
switch (filter_mode) {
|
||||||
case Tegra::Texture::TextureFilter::Linear: {
|
case Tegra::Texture::TextureFilter::Nearest:
|
||||||
switch (mip_filter_mode) {
|
switch (mipmap_filter_mode) {
|
||||||
|
case Tegra::Texture::TextureMipmapFilter::None:
|
||||||
|
return GL_NEAREST;
|
||||||
|
case Tegra::Texture::TextureMipmapFilter::Nearest:
|
||||||
|
return GL_NEAREST_MIPMAP_NEAREST;
|
||||||
|
case Tegra::Texture::TextureMipmapFilter::Linear:
|
||||||
|
return GL_NEAREST_MIPMAP_LINEAR;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Tegra::Texture::TextureFilter::Linear:
|
||||||
|
switch (mipmap_filter_mode) {
|
||||||
case Tegra::Texture::TextureMipmapFilter::None:
|
case Tegra::Texture::TextureMipmapFilter::None:
|
||||||
return GL_LINEAR;
|
return GL_LINEAR;
|
||||||
case Tegra::Texture::TextureMipmapFilter::Nearest:
|
case Tegra::Texture::TextureMipmapFilter::Nearest:
|
||||||
|
@ -193,20 +192,9 @@ inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Tegra::Texture::TextureFilter::Nearest: {
|
UNREACHABLE_MSG("Invalid texture filter mode={} and mipmap filter mode={}",
|
||||||
switch (mip_filter_mode) {
|
static_cast<u32>(filter_mode), static_cast<u32>(mipmap_filter_mode));
|
||||||
case Tegra::Texture::TextureMipmapFilter::None:
|
|
||||||
return GL_NEAREST;
|
return GL_NEAREST;
|
||||||
case Tegra::Texture::TextureMipmapFilter::Nearest:
|
|
||||||
return GL_NEAREST_MIPMAP_NEAREST;
|
|
||||||
case Tegra::Texture::TextureMipmapFilter::Linear:
|
|
||||||
return GL_NEAREST_MIPMAP_LINEAR;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented texture filter mode={}", static_cast<u32>(filter_mode));
|
|
||||||
return GL_LINEAR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) {
|
inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) {
|
||||||
|
@ -229,10 +217,9 @@ inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) {
|
||||||
} else {
|
} else {
|
||||||
return GL_MIRROR_CLAMP_TO_EDGE;
|
return GL_MIRROR_CLAMP_TO_EDGE;
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented texture wrap mode={}", static_cast<u32>(wrap_mode));
|
|
||||||
return GL_REPEAT;
|
|
||||||
}
|
}
|
||||||
|
UNIMPLEMENTED_MSG("Unimplemented texture wrap mode={}", static_cast<u32>(wrap_mode));
|
||||||
|
return GL_REPEAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline GLenum DepthCompareFunc(Tegra::Texture::DepthCompareFunc func) {
|
inline GLenum DepthCompareFunc(Tegra::Texture::DepthCompareFunc func) {
|
||||||
|
@ -254,8 +241,7 @@ inline GLenum DepthCompareFunc(Tegra::Texture::DepthCompareFunc func) {
|
||||||
case Tegra::Texture::DepthCompareFunc::Always:
|
case Tegra::Texture::DepthCompareFunc::Always:
|
||||||
return GL_ALWAYS;
|
return GL_ALWAYS;
|
||||||
}
|
}
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented texture depth compare function ={}",
|
UNIMPLEMENTED_MSG("Unimplemented texture depth compare function={}", static_cast<u32>(func));
|
||||||
static_cast<u32>(func));
|
|
||||||
return GL_GREATER;
|
return GL_GREATER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +263,7 @@ inline GLenum BlendEquation(Maxwell::Blend::Equation equation) {
|
||||||
case Maxwell::Blend::Equation::MaxGL:
|
case Maxwell::Blend::Equation::MaxGL:
|
||||||
return GL_MAX;
|
return GL_MAX;
|
||||||
}
|
}
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented blend equation={}", static_cast<u32>(equation));
|
UNIMPLEMENTED_MSG("Unimplemented blend equation={}", static_cast<u32>(equation));
|
||||||
return GL_FUNC_ADD;
|
return GL_FUNC_ADD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +327,7 @@ inline GLenum BlendFunc(Maxwell::Blend::Factor factor) {
|
||||||
case Maxwell::Blend::Factor::OneMinusConstantAlphaGL:
|
case Maxwell::Blend::Factor::OneMinusConstantAlphaGL:
|
||||||
return GL_ONE_MINUS_CONSTANT_ALPHA;
|
return GL_ONE_MINUS_CONSTANT_ALPHA;
|
||||||
}
|
}
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented blend factor={}", static_cast<u32>(factor));
|
UNIMPLEMENTED_MSG("Unimplemented blend factor={}", static_cast<u32>(factor));
|
||||||
return GL_ZERO;
|
return GL_ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +347,7 @@ inline GLenum SwizzleSource(Tegra::Texture::SwizzleSource source) {
|
||||||
case Tegra::Texture::SwizzleSource::OneFloat:
|
case Tegra::Texture::SwizzleSource::OneFloat:
|
||||||
return GL_ONE;
|
return GL_ONE;
|
||||||
}
|
}
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented swizzle source={}", static_cast<u32>(source));
|
UNIMPLEMENTED_MSG("Unimplemented swizzle source={}", static_cast<u32>(source));
|
||||||
return GL_ZERO;
|
return GL_ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +378,7 @@ inline GLenum ComparisonOp(Maxwell::ComparisonOp comparison) {
|
||||||
case Maxwell::ComparisonOp::AlwaysOld:
|
case Maxwell::ComparisonOp::AlwaysOld:
|
||||||
return GL_ALWAYS;
|
return GL_ALWAYS;
|
||||||
}
|
}
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented comparison op={}", static_cast<u32>(comparison));
|
UNIMPLEMENTED_MSG("Unimplemented comparison op={}", static_cast<u32>(comparison));
|
||||||
return GL_ALWAYS;
|
return GL_ALWAYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,7 +409,7 @@ inline GLenum StencilOp(Maxwell::StencilOp stencil) {
|
||||||
case Maxwell::StencilOp::DecrWrapOGL:
|
case Maxwell::StencilOp::DecrWrapOGL:
|
||||||
return GL_DECR_WRAP;
|
return GL_DECR_WRAP;
|
||||||
}
|
}
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented stencil op={}", static_cast<u32>(stencil));
|
UNIMPLEMENTED_MSG("Unimplemented stencil op={}", static_cast<u32>(stencil));
|
||||||
return GL_KEEP;
|
return GL_KEEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,7 +420,7 @@ inline GLenum FrontFace(Maxwell::FrontFace front_face) {
|
||||||
case Maxwell::FrontFace::CounterClockWise:
|
case Maxwell::FrontFace::CounterClockWise:
|
||||||
return GL_CCW;
|
return GL_CCW;
|
||||||
}
|
}
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented front face cull={}", static_cast<u32>(front_face));
|
UNIMPLEMENTED_MSG("Unimplemented front face cull={}", static_cast<u32>(front_face));
|
||||||
return GL_CCW;
|
return GL_CCW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,7 +433,7 @@ inline GLenum CullFace(Maxwell::CullFace cull_face) {
|
||||||
case Maxwell::CullFace::FrontAndBack:
|
case Maxwell::CullFace::FrontAndBack:
|
||||||
return GL_FRONT_AND_BACK;
|
return GL_FRONT_AND_BACK;
|
||||||
}
|
}
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented cull face={}", static_cast<u32>(cull_face));
|
UNIMPLEMENTED_MSG("Unimplemented cull face={}", static_cast<u32>(cull_face));
|
||||||
return GL_BACK;
|
return GL_BACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,7 +472,7 @@ inline GLenum LogicOp(Maxwell::LogicOperation operation) {
|
||||||
case Maxwell::LogicOperation::Set:
|
case Maxwell::LogicOperation::Set:
|
||||||
return GL_SET;
|
return GL_SET;
|
||||||
}
|
}
|
||||||
LOG_ERROR(Render_OpenGL, "Unimplemented logic operation={}", static_cast<u32>(operation));
|
UNIMPLEMENTED_MSG("Unimplemented logic operation={}", static_cast<u32>(operation));
|
||||||
return GL_COPY;
|
return GL_COPY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue