From abbb776bbefd148d9f67b41abe142205fb657a4e Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 7 Jul 2015 15:57:03 -0700 Subject: [PATCH] vk/vulkan.h: Remove programPointSize Instead, we auto-detect whether or not your shader writes gl_PointSize. If it does, we use 1.0, otherwise we take it from the shader. --- include/vulkan/vulkan.h | 1 - src/vulkan/compiler.cpp | 8 ++++++++ src/vulkan/device.c | 1 - src/vulkan/pipeline.c | 3 ++- src/vulkan/private.h | 1 + 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index 234814e92ca..3057a982f3e 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -1469,7 +1469,6 @@ typedef struct { const void* pNext; bool32_t depthClipEnable; bool32_t rasterizerDiscardEnable; - bool32_t programPointSize; VkFillMode fillMode; VkCullMode cullMode; VkFrontFace frontFace; diff --git a/src/vulkan/compiler.cpp b/src/vulkan/compiler.cpp index 7ba42151c19..558a31001e2 100644 --- a/src/vulkan/compiler.cpp +++ b/src/vulkan/compiler.cpp @@ -1018,6 +1018,8 @@ anv_compiler_run(struct anv_compiler *compiler, struct anv_pipeline *pipeline) int name = 0; struct brw_context *brw = compiler->brw; + pipeline->writes_point_size = false; + /* When we free the pipeline, we detect stages based on the NULL status * of various prog_data pointers. Make them NULL by default. */ @@ -1086,6 +1088,9 @@ anv_compiler_run(struct anv_compiler *compiler, struct anv_pipeline *pipeline) fail_if(!success, "do_wm_prog failed\n"); add_compiled_stage(pipeline, VK_SHADER_STAGE_VERTEX, &pipeline->vs_prog_data.base.base); + + if (vp->Base.OutputsWritten & VARYING_SLOT_PSIZ) + pipeline->writes_point_size = true; } else { memset(&pipeline->vs_prog_data, 0, sizeof(pipeline->vs_prog_data)); pipeline->vs_simd8 = NO_KERNEL; @@ -1104,6 +1109,9 @@ anv_compiler_run(struct anv_compiler *compiler, struct anv_pipeline *pipeline) fail_if(!success, "do_gs_prog failed\n"); add_compiled_stage(pipeline, VK_SHADER_STAGE_GEOMETRY, &pipeline->gs_prog_data.base.base); + + if (gp->Base.OutputsWritten & VARYING_SLOT_PSIZ) + pipeline->writes_point_size = true; } else { pipeline->gs_vec4 = NO_KERNEL; } diff --git a/src/vulkan/device.c b/src/vulkan/device.c index 4c0082779a8..9654637b6e1 100644 --- a/src/vulkan/device.c +++ b/src/vulkan/device.c @@ -2034,7 +2034,6 @@ VkResult anv_CreateDynamicRasterState( struct GEN8_3DSTATE_SF sf = { GEN8_3DSTATE_SF_header, .LineWidth = pCreateInfo->lineWidth, - .PointWidth = 1.0, }; GEN8_3DSTATE_SF_pack(NULL, state->state_sf, &sf); diff --git a/src/vulkan/pipeline.c b/src/vulkan/pipeline.c index c500c7a0a33..665ee773fe4 100644 --- a/src/vulkan/pipeline.c +++ b/src/vulkan/pipeline.c @@ -184,7 +184,8 @@ emit_rs_state(struct anv_pipeline *pipeline, VkPipelineRsStateCreateInfo *info, .TriangleStripListProvokingVertexSelect = 0, .LineStripListProvokingVertexSelect = 0, .TriangleFanProvokingVertexSelect = 0, - .PointWidthSource = info->programPointSize ? Vertex : State, + .PointWidthSource = pipeline->writes_point_size ? Vertex : State, + .PointWidth = 1.0, }; /* FINISHME: bool32_t rasterizerDiscardEnable; */ diff --git a/src/vulkan/private.h b/src/vulkan/private.h index a9c9f26bc73..2663d97834f 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -733,6 +733,7 @@ struct anv_pipeline { struct brw_wm_prog_data wm_prog_data; struct brw_gs_prog_data gs_prog_data; struct brw_cs_prog_data cs_prog_data; + bool writes_point_size; struct brw_stage_prog_data * prog_data[VK_SHADER_STAGE_NUM]; uint32_t scratch_start[VK_SHADER_STAGE_NUM]; uint32_t total_scratch; -- 2.30.2