PipelineCreater增加设置项

This commit is contained in:
hyzboy 2019-07-01 15:14:33 +08:00
parent dcc41f2073
commit 53a819abd7

View File

@ -73,34 +73,40 @@ public:
bool Set(const VkPrimitiveTopology,bool=false); bool Set(const VkPrimitiveTopology,bool=false);
void SetViewport( float x,float y,float w,float h){viewport.x=x;viewport.y=y;viewport.width=w;viewport.height=h;} void SetViewport( float x,float y,float w,float h){viewport.x=x;viewport.y=y;viewport.width=w;viewport.height=h;}
void SetDepthRange( float min_depth,float max_depth){viewport.minDepth=min_depth;viewport.maxDepth=max_depth;} void SetDepthRange( float min_depth,float max_depth){viewport.minDepth=min_depth;viewport.maxDepth=max_depth;}
void SetScissor( float l,float t,float w,float h){scissor.offset.x=l;scissor.offset.y=t;scissor.extent.width=w;scissor.extent.height=h;} void SetScissor( float l,float t,float w,float h){scissor.offset.x=l;scissor.offset.y=t;scissor.extent.width=w;scissor.extent.height=h;}
void SetAlphaTest( const float at) {alpha_test=at;} void SetAlphaTest( const float at) {alpha_test=at;}
void SetDepthTest( bool dt) {depthStencilState.depthTestEnable=dt;} void SetDepthTest( bool dt) {depthStencilState.depthTestEnable=dt;}
void SetDepthWrite( bool dw) {depthStencilState.depthWriteEnable=dw;} void SetDepthWrite( bool dw) {depthStencilState.depthWriteEnable=dw;}
void SetDepthCompareOp( VkCompareOp op) {depthStencilState.depthCompareOp=op;}
void SetDepthBoundsTest(bool dbt) {depthStencilState.depthBoundsTestEnable=dbt;}
void SetDepthBounds( float min_depth,
float max_depth) {depthStencilState.minDepthBounds=min_depth;
depthStencilState.maxDepthBounds=max_depth;}
void SetStencilTest( bool st) {depthStencilState.stencilTestEnable=st;}
void SetDepthClamp( bool dc) {rasterizer.depthClampEnable=dc;} void SetDepthClamp( bool dc) {rasterizer.depthClampEnable=dc;}
void SetDiscard( bool discard) {rasterizer.rasterizerDiscardEnable=discard;} void SetDiscard( bool discard) {rasterizer.rasterizerDiscardEnable=discard;}
void SetPolygonMode(VkPolygonMode pm) {rasterizer.polygonMode =pm;} void SetPolygonMode( VkPolygonMode pm) {rasterizer.polygonMode =pm;}
void SetCullMode( VkCullModeFlagBits cm) {rasterizer.cullMode =cm;} void SetCullMode( VkCullModeFlagBits cm) {rasterizer.cullMode =cm;}
void CloseCullFace() {rasterizer.cullMode =VK_CULL_MODE_NONE;} void CloseCullFace() {rasterizer.cullMode =VK_CULL_MODE_NONE;}
void SetFrontFace( VkFrontFace ff) {rasterizer.frontFace =ff;} void SetFrontFace( VkFrontFace ff) {rasterizer.frontFace =ff;}
void SetDepthBias( float ConstantFactor, void SetDepthBias( float ConstantFactor,
float Clamp, float Clamp,
float SlopeFactor) float SlopeFactor)
{ {
rasterizer.depthBiasEnable =VK_TRUE; rasterizer.depthBiasEnable =VK_TRUE;
rasterizer.depthBiasConstantFactor =ConstantFactor; rasterizer.depthBiasConstantFactor =ConstantFactor;
rasterizer.depthBiasClamp =Clamp; rasterizer.depthBiasClamp =Clamp;
rasterizer.depthBiasSlopeFactor =SlopeFactor; rasterizer.depthBiasSlopeFactor =SlopeFactor;
} }
void DisableDepthBias() {rasterizer.depthBiasEnable=VK_FALSE;} void DisableDepthBias() {rasterizer.depthBiasEnable=VK_FALSE;}
void SetLineWidth( float line_width) {rasterizer.lineWidth =line_width;} void SetLineWidth( float line_width) {rasterizer.lineWidth =line_width;}
void SetSamleCount( VkSampleCountFlagBits sc) void SetSamleCount( VkSampleCountFlagBits sc)
{ {
multisampling.sampleShadingEnable=(sc==VK_SAMPLE_COUNT_1_BIT?VK_FALSE:VK_TRUE); multisampling.sampleShadingEnable=(sc==VK_SAMPLE_COUNT_1_BIT?VK_FALSE:VK_TRUE);
multisampling.rasterizationSamples=sc; multisampling.rasterizationSamples=sc;