更改测试

This commit is contained in:
hyzboy 2019-07-11 01:07:16 +08:00
parent 5d61707b4d
commit ee30e6acce
5 changed files with 11 additions and 7 deletions

View File

@ -1,4 +1,4 @@
// 9.延迟渲染
// 9.延迟渲染
// 简单的延迟渲染测试,仅一个太阳光
#include"VulkanAppFramework.h"
@ -224,6 +224,7 @@ private:
AutoDelete<vulkan::PipelineCreater> pipeline_creater=new vulkan::PipelineCreater(device,sp->material,gbuffer.renderpass,gbuffer.extent);
pipeline_creater->SetDepthTest(true);
pipeline_creater->SetDepthWrite(true);
pipeline_creater->SetDepthCompareOp(VK_COMPARE_OP_ALWAYS);
//pipeline_creater->SetCullMode(VK_CULL_MODE_BACK_BIT);
pipeline_creater->SetCullMode(VK_CULL_MODE_NONE);
pipeline_creater->Set(PRIM_TRIANGLES);

View File

@ -14,7 +14,7 @@ layout (location = 2) out vec4 outColor;
void main()
{
outPosition=vec4(FragmentPosition,1.0);
outPosition=vec4(normalize(FragmentPosition*2.0-vec3(1.0)),1.0);
/* vec3 N = normalize(FragmentNormal);
N.y=-N.y;
@ -25,6 +25,6 @@ void main()
//outNormal=vec4(tnorm,1.0);
outNormal=vec4(FragmentNormal,1.0);
outNormal=vec4(normalize(FragmentNormal*2.0-vec3(1.0)),1.0);
outColor=texture(TextureColor,FragmentTexCoord);
}

View File

@ -29,7 +29,7 @@ void main()
gl_Position=pos*world.mvp;
FragmentPosition=pos.xyz;
FragmentPosition=(pos*world.modelview).xyz;
FragmentTexCoord=TexCoord;
// mat3 n=inverse(mat3(pc.local_to_world));
@ -38,6 +38,6 @@ void main()
// FragmentNormal=normalize(Normal)*n;
// FragmentTangent=normalize(Tangent)*n;
FragmentNormal=normalize((Normal+vec3(1.0))/2.0);
FragmentNormal=Normal;
FragmentTangent=Tangent;
}

View File

@ -195,7 +195,7 @@ namespace
bool CreateDepthBuffer(DeviceAttribute *rsa)
{
const VkFormat depth_format=rsa->physical_device->GetDepthFormat();
const VkFormat depth_format=rsa->physical_device->GetDepthFormat(false);
const VkFormatProperties props=rsa->physical_device->GetFormatProperties(depth_format);

View File

@ -23,7 +23,10 @@ ImageView *CreateImageView(VkDevice device,VkImageViewType type,VkFormat format,
iv_createinfo.subresourceRange.layerCount=1;
if(aspectMask&VK_IMAGE_ASPECT_DEPTH_BIT)
{
{
if(format>=VK_FORMAT_D16_UNORM_S8_UINT)
iv_createinfo.subresourceRange.aspectMask|=VK_IMAGE_ASPECT_STENCIL_BIT;
iv_createinfo.components.r=VK_COMPONENT_SWIZZLE_IDENTITY;
iv_createinfo.components.g=VK_COMPONENT_SWIZZLE_IDENTITY;
iv_createinfo.components.b=VK_COMPONENT_SWIZZLE_IDENTITY;