rendervulkan: Don't use clock for random debug output.

Not supported on turnip.
This commit is contained in:
Georg Lehmann 2022-02-12 17:20:46 +01:00 committed by Joshie
parent ecdf214130
commit 35b381ce51
4 changed files with 15 additions and 16 deletions

View file

@ -1279,8 +1279,6 @@ retry:
vecEnabledDeviceExtensions.push_back( VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME ); vecEnabledDeviceExtensions.push_back( VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME );
vecEnabledDeviceExtensions.push_back( VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME ); vecEnabledDeviceExtensions.push_back( VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME );
vecEnabledDeviceExtensions.push_back( VK_KHR_SHADER_CLOCK_EXTENSION_NAME );
vecEnabledDeviceExtensions.push_back( VK_EXT_ROBUSTNESS_2_EXTENSION_NAME ); vecEnabledDeviceExtensions.push_back( VK_EXT_ROBUSTNESS_2_EXTENSION_NAME );
if ( supportsFp16 ) if ( supportsFp16 )
@ -1302,11 +1300,6 @@ retry:
.pEnabledFeatures = 0, .pEnabledFeatures = 0,
}; };
VkPhysicalDeviceShaderClockFeaturesKHR clockFeatures = {};
clockFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR;
clockFeatures.pNext = std::exchange(features2.pNext, &clockFeatures);
clockFeatures.shaderSubgroupClock = VK_TRUE;
VkPhysicalDeviceSamplerYcbcrConversionFeatures ycbcrFeatures = {}; VkPhysicalDeviceSamplerYcbcrConversionFeatures ycbcrFeatures = {};
ycbcrFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES; ycbcrFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES;
ycbcrFeatures.pNext = std::exchange(features2.pNext, &ycbcrFeatures); ycbcrFeatures.pNext = std::exchange(features2.pNext, &ycbcrFeatures);

View file

@ -22,15 +22,23 @@ vec4 linearToSrgb(vec4 color) {
return vec4(linearToSrgb(color.rgb), color.a); return vec4(linearToSrgb(color.rgb), color.a);
} }
void compositing_debug(uvec2 size, uvec2 coord) { uint pseudo_random(uint seed) {
seed ^= (seed << 13);
seed ^= (seed >> 17);
seed ^= (seed << 5);
return seed * 1664525u + 1013904223u;
}
void compositing_debug(uvec2 coord) {
uvec2 pos = coord; uvec2 pos = coord;
pos.x -= (u_frameId & 2) != 0 ? /* size.x - 160 */ 128 : 0; pos.x -= (u_frameId & 2) != 0 ? 128 : 0;
pos.y -= (u_frameId & 1) != 0 ? /* size.y - 160 */ 128 : 0; pos.y -= (u_frameId & 1) != 0 ? 128 : 0;
if (pos.x >= 40 && pos.x < 120 && pos.y >= 40 && pos.y < 120) { if (pos.x >= 40 && pos.x < 120 && pos.y >= 40 && pos.y < 120) {
vec4 value = vec4(1.0f, 1.0f, 1.0f, 1.0f); vec4 value = vec4(1.0f, 1.0f, 1.0f, 1.0f);
if (pos.x >= 48 && pos.x < 112 && pos.y >= 48 && pos.y < 112) { if (pos.x >= 48 && pos.x < 112 && pos.y >= 48 && pos.y < 112) {
vec4 time = round(unpackUnorm4x8(clock2x32ARB().x * 1664525u + 1013904223u)).xyzw; uint random = pseudo_random(u_frameId.x + (pos.x & ~0x7) + (pos.y & ~0x7) * 50);
vec4 time = round(unpackUnorm4x8(random)).xyzw;
if (time.x + time.y + time.z + time.w < 2.0f) if (time.x + time.y + time.z + time.w < 2.0f)
value = vec4(0.0f, 0.0f, 0.0f, 1.0f); value = vec4(0.0f, 0.0f, 0.0f, 1.0f);
} }

View file

@ -1,8 +1,7 @@
#version 450 #version 450
#extension GL_GOOGLE_include_directive : require
#extension GL_EXT_scalar_block_layout : require #extension GL_EXT_scalar_block_layout : require
#extension GL_ARB_shader_clock : require #extension GL_GOOGLE_include_directive : require
#include "descriptor_set.h" #include "descriptor_set.h"
@ -57,5 +56,5 @@ void main() {
// Indicator to quickly tell if we're in the compositing path or not. // Indicator to quickly tell if we're in the compositing path or not.
if (c_compositing_debug) if (c_compositing_debug)
compositing_debug(outSize, coord); compositing_debug(coord);
} }

View file

@ -1,6 +1,5 @@
#version 460 #version 460
#extension GL_ARB_shader_clock : require
#extension GL_EXT_scalar_block_layout : require #extension GL_EXT_scalar_block_layout : require
#extension GL_GOOGLE_include_directive : require #extension GL_GOOGLE_include_directive : require
@ -77,7 +76,7 @@ void rcasComposite(uvec2 pos)
imageStore(dst, ivec2(pos), vec4(outputValue, undef)); imageStore(dst, ivec2(pos), vec4(outputValue, undef));
if (c_compositing_debug) if (c_compositing_debug)
compositing_debug(uvec2(0), ivec2(pos)); compositing_debug(pos);
} }
void main() void main()