From e3fb4f27e251fac58f8c3c8dfcaef68ae818fc1c Mon Sep 17 00:00:00 2001 From: Indie C++/DX developer Date: Mon, 21 Jan 2019 00:05:51 +0800 Subject: [PATCH 1/3] fix: parameter same to member name --- base/VulkanTexture.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/base/VulkanTexture.hpp b/base/VulkanTexture.hpp index fdff7517..0052097f 100644 --- a/base/VulkanTexture.hpp +++ b/base/VulkanTexture.hpp @@ -386,8 +386,8 @@ namespace vks void* buffer, VkDeviceSize bufferSize, VkFormat format, - uint32_t width, - uint32_t height, + uint32_t texWidth, + uint32_t texHeight, vks::VulkanDevice *device, VkQueue copyQueue, VkFilter filter = VK_FILTER_LINEAR, @@ -397,8 +397,8 @@ namespace vks assert(buffer); this->device = device; - width = width; - height = height; + width = texWidth; + height = texHeight; mipLevels = 1; VkMemoryAllocateInfo memAllocInfo = vks::initializers::memoryAllocateInfo(); From 715f3fd9b2bbab9235513a58556c27e7c565d39f Mon Sep 17 00:00:00 2001 From: Shanee Date: Tue, 29 Jan 2019 23:25:02 -0800 Subject: [PATCH 2/3] Removed redundant division by w --- data/shaders/shadowmapping/scene.frag | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/data/shaders/shadowmapping/scene.frag b/data/shaders/shadowmapping/scene.frag index 367984c8..476c53ed 100644 --- a/data/shaders/shadowmapping/scene.frag +++ b/data/shaders/shadowmapping/scene.frag @@ -14,10 +14,9 @@ layout (location = 0) out vec4 outFragColor; #define ambient 0.1 -float textureProj(vec4 P, vec2 off) +float textureProj(vec4 shadowCoord, vec2 off) { float shadow = 1.0; - vec4 shadowCoord = P / P.w; if ( shadowCoord.z > -1.0 && shadowCoord.z < 1.0 ) { float dist = texture( shadowMap, shadowCoord.st + off ).r; @@ -65,4 +64,4 @@ void main() outFragColor = vec4(diffuse * shadow, 1.0); -} \ No newline at end of file +} From a301ed7c5be59b56950348a1a2ce54ed59a1b106 Mon Sep 17 00:00:00 2001 From: Shanee Date: Tue, 29 Jan 2019 23:28:12 -0800 Subject: [PATCH 3/3] Removed redundant division by w --- data/shaders/shadowmappingcascade/scene.frag | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/data/shaders/shadowmappingcascade/scene.frag b/data/shaders/shadowmappingcascade/scene.frag index 470b5da6..73c3721c 100644 --- a/data/shaders/shadowmappingcascade/scene.frag +++ b/data/shaders/shadowmappingcascade/scene.frag @@ -33,12 +33,11 @@ const mat4 biasMat = mat4( 0.5, 0.5, 0.0, 1.0 ); -float textureProj(vec4 P, vec2 offset, uint cascadeIndex) +float textureProj(vec4 shadowCoord, vec2 offset, uint cascadeIndex) { float shadow = 1.0; float bias = 0.005; - vec4 shadowCoord = P / P.w; if ( shadowCoord.z > -1.0 && shadowCoord.z < 1.0 ) { float dist = texture(shadowMap, vec3(shadowCoord.st + offset, cascadeIndex)).r; if (shadowCoord.w > 0 && dist < shadowCoord.z - bias) { @@ -121,4 +120,4 @@ void main() break; } } -} \ No newline at end of file +}