完成延迟渲染调试SHADER,但几何多边形生成有问题
This commit is contained in:
parent
424a7e8c1d
commit
79957d0ed2
@ -279,7 +279,7 @@ private:
|
|||||||
bool InitMaterial()
|
bool InitMaterial()
|
||||||
{
|
{
|
||||||
if(!InitSubpass(&sp_gbuffer, OS_TEXT("res/shader/gbuffer_opaque.vert.spv"),OS_TEXT("res/shader/gbuffer_opaque.frag.spv")))return(false);
|
if(!InitSubpass(&sp_gbuffer, OS_TEXT("res/shader/gbuffer_opaque.vert.spv"),OS_TEXT("res/shader/gbuffer_opaque.frag.spv")))return(false);
|
||||||
if(!InitSubpass(&sp_composition,OS_TEXT("res/shader/gbuffer_composition.vert.spv"),OS_TEXT("res/shader/gbuffer_composition.frag.spv")))return(false);
|
if(!InitSubpass(&sp_composition,OS_TEXT("res/shader/gbuffer_debug.vert.spv"),OS_TEXT("res/shader/gbuffer_debug.frag.spv")))return(false);
|
||||||
|
|
||||||
if(!InitGBufferPipeline(&sp_gbuffer))return(false);
|
if(!InitGBufferPipeline(&sp_gbuffer))return(false);
|
||||||
if(!InitCompositionPipeline(&sp_composition))return(false);
|
if(!InitCompositionPipeline(&sp_composition))return(false);
|
||||||
@ -466,6 +466,7 @@ public:
|
|||||||
sc_render_target->Submit(cb,gbuffer.render_complete_semaphore,render_complete_semaphore);
|
sc_render_target->Submit(cb,gbuffer.render_complete_semaphore,render_complete_semaphore);
|
||||||
sc_render_target->PresentBackbuffer(render_complete_semaphore);
|
sc_render_target->PresentBackbuffer(render_complete_semaphore);
|
||||||
sc_render_target->Wait();
|
sc_render_target->Wait();
|
||||||
|
gbuffer.rt->Wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildCommandBuffer(uint32_t index) override
|
void BuildCommandBuffer(uint32_t index) override
|
||||||
|
@ -444,16 +444,16 @@ namespace hgl
|
|||||||
}
|
}
|
||||||
|
|
||||||
*this->access++=scope.GetLeft();
|
*this->access++=scope.GetLeft();
|
||||||
*this->access++=scope.GetTop();
|
*this->access++=scope.GetBottom();
|
||||||
|
|
||||||
*this->access++=scope.GetRight();
|
|
||||||
*this->access++=scope.GetTop();
|
|
||||||
|
|
||||||
*this->access++=scope.GetRight();
|
*this->access++=scope.GetRight();
|
||||||
*this->access++=scope.GetBottom();
|
*this->access++=scope.GetBottom();
|
||||||
|
|
||||||
|
*this->access++=scope.GetRight();
|
||||||
|
*this->access++=scope.GetTop();
|
||||||
|
|
||||||
*this->access++=scope.GetLeft();
|
*this->access++=scope.GetLeft();
|
||||||
*this->access++=scope.GetBottom();
|
*this->access++=scope.GetTop();
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ void main()
|
|||||||
|
|
||||||
vec3 light_pos=vec3(1,1,1);
|
vec3 light_pos=vec3(1,1,1);
|
||||||
vec3 light_halfVector=vec3(1,1,1);
|
vec3 light_halfVector=vec3(1,1,1);
|
||||||
|
|
||||||
|
|
||||||
float pf;
|
float pf;
|
||||||
|
|
||||||
float nDotVP=max(0.0,dot(normal,normalize(light_pos)));
|
float nDotVP=max(0.0,dot(normal,normalize(light_pos)));
|
||||||
|
40
res/shader/gbuffer_debug.frag
Normal file
40
res/shader/gbuffer_debug.frag
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#version 450 core
|
||||||
|
|
||||||
|
layout(binding = 0) uniform WorldMatrix
|
||||||
|
{
|
||||||
|
mat4 ortho;
|
||||||
|
mat4 projection;
|
||||||
|
mat4 modelview;
|
||||||
|
mat4 mvp;
|
||||||
|
vec4 view_pos;
|
||||||
|
} world;
|
||||||
|
|
||||||
|
layout(push_constant) uniform Consts {
|
||||||
|
mat4 local_to_world;
|
||||||
|
} pc;
|
||||||
|
|
||||||
|
layout(binding = 0) uniform sampler2D GB_Position;
|
||||||
|
layout(binding = 1) uniform sampler2D GB_Normal;
|
||||||
|
layout(binding = 2) uniform sampler2D GB_Color;
|
||||||
|
|
||||||
|
layout(location = 0) in vec2 FragmentPosition;
|
||||||
|
layout(location = 1) flat in uint FragmentTexID;
|
||||||
|
layout(location = 2) in vec2 FragmentTexCoord;
|
||||||
|
|
||||||
|
layout(location = 0) out vec4 FragColor;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
FragColor=vec4(normalize(FragmentTexCoord),0.0,1.0);
|
||||||
|
/* vec3 components[3];
|
||||||
|
|
||||||
|
components[0]=texture(GB_Position, FragmentTexCoord).xyz;
|
||||||
|
components[1]=texture(GB_Normal, FragmentTexCoord).xyz;
|
||||||
|
components[2]=texture(GB_Color, FragmentTexCoord).xyz;
|
||||||
|
|
||||||
|
if(FragmentTexID<3)
|
||||||
|
FragColor=vec4(components[FragmentTexID],1.0);
|
||||||
|
else
|
||||||
|
FragColor=vec4(0.0,0.0,0.0,1.0);*/
|
||||||
|
}
|
||||||
|
|
31
res/shader/gbuffer_debug.vert
Normal file
31
res/shader/gbuffer_debug.vert
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#version 450 core
|
||||||
|
|
||||||
|
layout(location = 0) in vec2 Vertex;
|
||||||
|
|
||||||
|
layout(location = 0) out vec2 FragmentPosition;
|
||||||
|
|
||||||
|
layout(location = 1) out uint FragmentTexID;
|
||||||
|
layout(location = 2) out vec2 FragmentTexCoord;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_Position=vec4(Vertex,0.0,1.0);
|
||||||
|
|
||||||
|
FragmentPosition=Vertex;
|
||||||
|
FragmentTexCoord=(Vertex+1.0)/2.0;
|
||||||
|
|
||||||
|
if(Vertex.x<0)
|
||||||
|
{
|
||||||
|
if(Vertex.y<0)
|
||||||
|
FragmentTexID=0;
|
||||||
|
else
|
||||||
|
FragmentTexID=1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(Vertex.y<0)
|
||||||
|
FragmentTexID=2;
|
||||||
|
else
|
||||||
|
FragmentTexID=3;
|
||||||
|
}
|
||||||
|
}
|
@ -20,3 +20,6 @@ glslangValidator -V -o gbuffer_opaque.frag.spv gbuffer_opaque.frag
|
|||||||
|
|
||||||
glslangValidator -V -o gbuffer_composition.vert.spv gbuffer_composition.vert
|
glslangValidator -V -o gbuffer_composition.vert.spv gbuffer_composition.vert
|
||||||
glslangValidator -V -o gbuffer_composition.frag.spv gbuffer_composition.frag
|
glslangValidator -V -o gbuffer_composition.frag.spv gbuffer_composition.frag
|
||||||
|
|
||||||
|
glslangValidator -V -o gbuffer_debug.vert.spv gbuffer_debug.vert
|
||||||
|
glslangValidator -V -o gbuffer_debug.frag.spv gbuffer_debug.frag
|
||||||
|
@ -148,7 +148,7 @@ namespace hgl
|
|||||||
|
|
||||||
VB2f *vertex=gc.GetVertex();
|
VB2f *vertex=gc.GetVertex();
|
||||||
|
|
||||||
vertex->WriteRectFan(rci->scope);
|
vertex->WriteRectTriangleStrip(rci->scope);
|
||||||
|
|
||||||
return gc.Finish();
|
return gc.Finish();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user