mirror of
https://github.com/skyline-emu/skyline.git
synced 2025-02-11 06:38:44 +03:00
Implement alpha test pipeline state
This commit is contained in:
parent
c86ad638c4
commit
2163f8cde6
@ -331,6 +331,15 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
|
|
||||||
return convertedVaryings;
|
return convertedVaryings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PackedPipelineState::SetAlphaFunc(engine::CompareFunc func) {
|
||||||
|
alphaFunc = ConvertCompareFunc(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
Shader::CompareFunction PackedPipelineState::GetAlphaFunc() const {
|
||||||
|
// Vulkan enum values match 1-1 with hades
|
||||||
|
return static_cast<Shader::CompareFunction>(alphaFunc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
@ -55,9 +55,12 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
bool apiMandatedEarlyZ : 1;
|
bool apiMandatedEarlyZ : 1;
|
||||||
bool openGlNdc : 1;
|
bool openGlNdc : 1;
|
||||||
bool transformFeedbackEnable : 1;
|
bool transformFeedbackEnable : 1;
|
||||||
|
u8 alphaFunc : 3; //!< Use {Set,Get}AlphaFunc
|
||||||
|
bool alphaTestEnable : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
u32 patchSize;
|
u32 patchSize;
|
||||||
|
float alphaRef;
|
||||||
float pointSize;
|
float pointSize;
|
||||||
std::array<engine::VertexAttribute, engine::VertexAttributeCount> vertexAttributes;
|
std::array<engine::VertexAttribute, engine::VertexAttributeCount> vertexAttributes;
|
||||||
std::array<u8, engine::ColorTargetCount> colorRenderTargetFormats; //!< Use {Set, Get}ColorRenderTargetFormat
|
std::array<u8, engine::ColorTargetCount> colorRenderTargetFormats; //!< Use {Set, Get}ColorRenderTargetFormat
|
||||||
@ -134,6 +137,10 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
|
|
||||||
std::vector<Shader::TransformFeedbackVarying> GetTransformFeedbackVaryings() const;
|
std::vector<Shader::TransformFeedbackVarying> GetTransformFeedbackVaryings() const;
|
||||||
|
|
||||||
|
void SetAlphaFunc(engine::CompareFunc func);
|
||||||
|
|
||||||
|
Shader::CompareFunction GetAlphaFunc() const;
|
||||||
|
|
||||||
bool operator==(const PackedPipelineState &other) const {
|
bool operator==(const PackedPipelineState &other) const {
|
||||||
// Only hash transform feedback state if it's enabled
|
// Only hash transform feedback state if it's enabled
|
||||||
if (other.transformFeedbackEnable && transformFeedbackEnable)
|
if (other.transformFeedbackEnable && transformFeedbackEnable)
|
||||||
|
@ -129,9 +129,11 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
info.convert_depth_mode = packedState.openGlNdc;
|
info.convert_depth_mode = packedState.openGlNdc;
|
||||||
break;
|
break;
|
||||||
case Shader::Stage::Fragment:
|
case Shader::Stage::Fragment:
|
||||||
// info.alpha_test_func = MaxwellToCompareFunction(
|
if (packedState.alphaTestEnable) {
|
||||||
// key.state.UnpackComparisonOp(key.state.alpha_test_func.Value()));
|
info.alpha_test_func = packedState.GetAlphaFunc();
|
||||||
// info.alpha_test_reference = Common::BitCast<float>(key.state.alpha_test_ref);
|
info.alpha_test_reference = packedState.alphaRef;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -411,7 +411,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
|
|
||||||
/* Depth Stencil State */
|
/* Depth Stencil State */
|
||||||
void DepthStencilState::EngineRegisters::DirtyBind(DirtyManager &manager, dirty::Handle handle) const {
|
void DepthStencilState::EngineRegisters::DirtyBind(DirtyManager &manager, dirty::Handle handle) const {
|
||||||
manager.Bind(handle, depthTestEnable, depthWriteEnable, depthFunc, depthBoundsTestEnable, stencilTestEnable, twoSidedStencilTestEnable, stencilOps, stencilBack);
|
manager.Bind(handle, depthTestEnable, depthWriteEnable, depthFunc, depthBoundsTestEnable, stencilTestEnable, twoSidedStencilTestEnable, stencilOps, stencilBack, alphaTestEnable, alphaFunc, alphaRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
DepthStencilState::DepthStencilState(dirty::Handle dirtyHandle, DirtyManager &manager, const EngineRegisters &engine) : engine{manager, dirtyHandle, engine} {}
|
DepthStencilState::DepthStencilState(dirty::Handle dirtyHandle, DirtyManager &manager, const EngineRegisters &engine) : engine{manager, dirtyHandle, engine} {}
|
||||||
@ -419,12 +419,20 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
void DepthStencilState::Flush(PackedPipelineState &packedState) {
|
void DepthStencilState::Flush(PackedPipelineState &packedState) {
|
||||||
packedState.depthTestEnable = engine->depthTestEnable;
|
packedState.depthTestEnable = engine->depthTestEnable;
|
||||||
packedState.depthWriteEnable = engine->depthWriteEnable;
|
packedState.depthWriteEnable = engine->depthWriteEnable;
|
||||||
packedState.SetDepthFunc(engine->depthFunc);
|
packedState.SetDepthFunc(engine->depthTestEnable ? engine->depthFunc : engine::CompareFunc::OglAlways);
|
||||||
packedState.depthBoundsTestEnable = engine->depthBoundsTestEnable;
|
packedState.depthBoundsTestEnable = engine->depthBoundsTestEnable;
|
||||||
packedState.stencilTestEnable = engine->stencilTestEnable;
|
|
||||||
|
|
||||||
|
packedState.stencilTestEnable = engine->stencilTestEnable;
|
||||||
|
if (packedState.stencilTestEnable) {
|
||||||
auto stencilBack{engine->twoSidedStencilTestEnable ? engine->stencilBack : engine->stencilOps};
|
auto stencilBack{engine->twoSidedStencilTestEnable ? engine->stencilBack : engine->stencilOps};
|
||||||
packedState.SetStencilOps(engine->stencilOps, engine->stencilOps);
|
packedState.SetStencilOps(engine->stencilOps, stencilBack);
|
||||||
|
} else {
|
||||||
|
packedState.SetStencilOps({ .func = engine::CompareFunc::OglAlways }, { .func = engine::CompareFunc::OglAlways });
|
||||||
|
}
|
||||||
|
|
||||||
|
packedState.alphaTestEnable = engine->alphaTestEnable;
|
||||||
|
packedState.SetAlphaFunc(engine->alphaTestEnable ? engine->alphaFunc : engine::CompareFunc::OglAlways);
|
||||||
|
packedState.alphaRef = engine->alphaTestEnable ? engine->alphaRef : 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Color Blend State */
|
/* Color Blend State */
|
||||||
|
@ -214,6 +214,9 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
const u32 &twoSidedStencilTestEnable;
|
const u32 &twoSidedStencilTestEnable;
|
||||||
const engine::StencilOps &stencilOps;
|
const engine::StencilOps &stencilOps;
|
||||||
const engine::StencilOps &stencilBack;
|
const engine::StencilOps &stencilBack;
|
||||||
|
const u32 &alphaTestEnable;
|
||||||
|
const engine::CompareFunc &alphaFunc;
|
||||||
|
const float &alphaRef;
|
||||||
|
|
||||||
void DirtyBind(DirtyManager &manager, dirty::Handle handle) const;
|
void DirtyBind(DirtyManager &manager, dirty::Handle handle) const;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user