mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-05 08:52:36 +00:00
make the feature optional, add error log, remove window offset
This commit is contained in:
parent
50bbfc4f86
commit
092db6829f
@ -208,6 +208,7 @@ std::string Instance::GetDriverVersionName() {
|
|||||||
bool Instance::CreateDevice() {
|
bool Instance::CreateDevice() {
|
||||||
const vk::StructureChain feature_chain = physical_device.getFeatures2<
|
const vk::StructureChain feature_chain = physical_device.getFeatures2<
|
||||||
vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT,
|
vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT,
|
||||||
|
vk::PhysicalDevicePrimitiveTopologyListRestartFeaturesEXT,
|
||||||
vk::PhysicalDeviceExtendedDynamicState2FeaturesEXT,
|
vk::PhysicalDeviceExtendedDynamicState2FeaturesEXT,
|
||||||
vk::PhysicalDeviceExtendedDynamicState3FeaturesEXT,
|
vk::PhysicalDeviceExtendedDynamicState3FeaturesEXT,
|
||||||
vk::PhysicalDeviceCustomBorderColorFeaturesEXT,
|
vk::PhysicalDeviceCustomBorderColorFeaturesEXT,
|
||||||
@ -316,6 +317,9 @@ bool Instance::CreateDevice() {
|
|||||||
.pQueuePriorities = queue_priorities.data(),
|
.pQueuePriorities = queue_priorities.data(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const auto topology_list_restart_features =
|
||||||
|
feature_chain.get<vk::PhysicalDevicePrimitiveTopologyListRestartFeaturesEXT>();
|
||||||
|
|
||||||
const auto vk12_features = feature_chain.get<vk::PhysicalDeviceVulkan12Features>();
|
const auto vk12_features = feature_chain.get<vk::PhysicalDeviceVulkan12Features>();
|
||||||
vk::StructureChain device_chain = {
|
vk::StructureChain device_chain = {
|
||||||
vk::DeviceCreateInfo{
|
vk::DeviceCreateInfo{
|
||||||
@ -406,7 +410,8 @@ bool Instance::CreateDevice() {
|
|||||||
},
|
},
|
||||||
vk::PhysicalDevicePrimitiveTopologyListRestartFeaturesEXT{
|
vk::PhysicalDevicePrimitiveTopologyListRestartFeaturesEXT{
|
||||||
.primitiveTopologyListRestart = true,
|
.primitiveTopologyListRestart = true,
|
||||||
.primitiveTopologyPatchListRestart = true,
|
.primitiveTopologyPatchListRestart =
|
||||||
|
topology_list_restart_features.primitiveTopologyPatchListRestart,
|
||||||
},
|
},
|
||||||
vk::PhysicalDeviceFragmentShaderBarycentricFeaturesKHR{
|
vk::PhysicalDeviceFragmentShaderBarycentricFeaturesKHR{
|
||||||
.fragmentShaderBarycentric = true,
|
.fragmentShaderBarycentric = true,
|
||||||
|
@ -1151,6 +1151,11 @@ void Rasterizer::UpdateViewportScissorState(const GraphicsPipeline& pipeline) {
|
|||||||
? 1.0f
|
? 1.0f
|
||||||
: 0.0f;
|
: 0.0f;
|
||||||
|
|
||||||
|
if (regs.polygon_control.enable_window_offset) {
|
||||||
|
LOG_ERROR(Render_Vulkan,
|
||||||
|
"PA_SU_SC_MODE_CNTL.VTX_WINDOW_OFFSET_ENABLE support is not yet implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
for (u32 i = 0; i < Liverpool::NumViewports; i++) {
|
for (u32 i = 0; i < Liverpool::NumViewports; i++) {
|
||||||
const auto& vp = regs.viewports[i];
|
const auto& vp = regs.viewports[i];
|
||||||
const auto& vp_d = regs.viewport_depths[i];
|
const auto& vp_d = regs.viewport_depths[i];
|
||||||
@ -1158,29 +1163,13 @@ void Rasterizer::UpdateViewportScissorState(const GraphicsPipeline& pipeline) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto vp_scsr = scsr;
|
|
||||||
if (regs.mode_control.vport_scissor_enable) {
|
|
||||||
vp_scsr.top_left_x =
|
|
||||||
std::max(vp_scsr.top_left_x, s16(regs.viewport_scissors[i].top_left_x.Value()));
|
|
||||||
vp_scsr.top_left_y =
|
|
||||||
std::max(vp_scsr.top_left_y, s16(regs.viewport_scissors[i].top_left_y.Value()));
|
|
||||||
vp_scsr.bottom_right_x =
|
|
||||||
std::min(vp_scsr.bottom_right_x, regs.viewport_scissors[i].bottom_right_x);
|
|
||||||
vp_scsr.bottom_right_y =
|
|
||||||
std::min(vp_scsr.bottom_right_y, regs.viewport_scissors[i].bottom_right_y);
|
|
||||||
}
|
|
||||||
scissors.push_back({
|
|
||||||
.offset = {vp_scsr.top_left_x, vp_scsr.top_left_y},
|
|
||||||
.extent = {vp_scsr.GetWidth(), vp_scsr.GetHeight()},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (pipeline.IsClipDisabled()) {
|
if (pipeline.IsClipDisabled()) {
|
||||||
// In case if clipping is disabled we patch the shader to convert vertex position
|
// In case if clipping is disabled we patch the shader to convert vertex position
|
||||||
// from screen space coordinates to NDC by defining a render space as full hardware
|
// from screen space coordinates to NDC by defining a render space as full hardware
|
||||||
// window range [0..16383, 0..16383] and setting the viewport to its size.
|
// window range [0..16383, 0..16383] and setting the viewport to its size.
|
||||||
viewports.push_back({
|
viewports.push_back({
|
||||||
.x = enable_offset ? float(regs.window_offset.window_x_offset) : 0.f,
|
.x = 0.f,
|
||||||
.y = enable_offset ? float(regs.window_offset.window_y_offset) : 0.f,
|
.y = 0.f,
|
||||||
.width = float(16_KB),
|
.width = float(16_KB),
|
||||||
.height = float(16_KB),
|
.height = float(16_KB),
|
||||||
.minDepth = 0.0,
|
.minDepth = 0.0,
|
||||||
@ -1202,6 +1191,22 @@ void Rasterizer::UpdateViewportScissorState(const GraphicsPipeline& pipeline) {
|
|||||||
.maxDepth = zscale + zoffset,
|
.maxDepth = zscale + zoffset,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto vp_scsr = scsr;
|
||||||
|
if (regs.mode_control.vport_scissor_enable) {
|
||||||
|
vp_scsr.top_left_x =
|
||||||
|
std::max(vp_scsr.top_left_x, s16(regs.viewport_scissors[i].top_left_x.Value()));
|
||||||
|
vp_scsr.top_left_y =
|
||||||
|
std::max(vp_scsr.top_left_y, s16(regs.viewport_scissors[i].top_left_y.Value()));
|
||||||
|
vp_scsr.bottom_right_x =
|
||||||
|
std::min(vp_scsr.bottom_right_x, regs.viewport_scissors[i].bottom_right_x);
|
||||||
|
vp_scsr.bottom_right_y =
|
||||||
|
std::min(vp_scsr.bottom_right_y, regs.viewport_scissors[i].bottom_right_y);
|
||||||
|
}
|
||||||
|
scissors.push_back({
|
||||||
|
.offset = {vp_scsr.top_left_x, vp_scsr.top_left_y},
|
||||||
|
.extent = {vp_scsr.GetWidth(), vp_scsr.GetHeight()},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewports.empty()) {
|
if (viewports.empty()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user