summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNanley Chery <[email protected]>2016-03-30 17:13:01 -0700
committerNanley Chery <[email protected]>2016-04-13 18:02:38 -0700
commit79fbec30fc16399ede9385ef52cb62cefbb388f4 (patch)
treebe6ffb7d3f717d13d7e7025cf9ee4950a49aaed0
parent1949e502bc74f0d65127ceef024b2c8af848f94c (diff)
anv: Remove default scissor and viewport concepts
Users should never provide a scissor or viewport count of 0 because they are required to set such state in a graphics pipeline. This behavior was previously only used in Meta, which actually just disables those hardware operations at pipeline creation time. Kristian noticed that the current assignment of viewport count reduces the number of viewport uploads, so it is not removed. Signed-off-by: Nanley Chery <[email protected]> Reviewed-by: Kristian Høgsberg Kristensen <[email protected]>
-rw-r--r--src/intel/vulkan/anv_meta_clear.c2
-rw-r--r--src/intel/vulkan/anv_meta_resolve.c3
-rw-r--r--src/intel/vulkan/gen7_cmd_buffer.c26
-rw-r--r--src/intel/vulkan/gen8_cmd_buffer.c27
4 files changed, 9 insertions, 49 deletions
diff --git a/src/intel/vulkan/anv_meta_clear.c b/src/intel/vulkan/anv_meta_clear.c
index c5c7d563e91..eb4e56984c3 100644
--- a/src/intel/vulkan/anv_meta_clear.c
+++ b/src/intel/vulkan/anv_meta_clear.c
@@ -47,8 +47,8 @@ meta_clear_begin(struct anv_meta_saved_state *saved_state,
(1 << VK_DYNAMIC_STATE_STENCIL_REFERENCE) |
(1 << VK_DYNAMIC_STATE_STENCIL_WRITE_MASK));
+ /* Avoid uploading more viewport states than necessary */
cmd_buffer->state.dynamic.viewport.count = 0;
- cmd_buffer->state.dynamic.scissor.count = 0;
}
static void
diff --git a/src/intel/vulkan/anv_meta_resolve.c b/src/intel/vulkan/anv_meta_resolve.c
index f83bb6bbfd3..7d2a75bb752 100644
--- a/src/intel/vulkan/anv_meta_resolve.c
+++ b/src/intel/vulkan/anv_meta_resolve.c
@@ -42,9 +42,6 @@ meta_resolve_save(struct anv_meta_saved_state *saved_state,
struct anv_cmd_buffer *cmd_buffer)
{
anv_meta_save(saved_state, cmd_buffer, 0);
-
- cmd_buffer->state.dynamic.viewport.count = 0;
- cmd_buffer->state.dynamic.scissor.count = 0;
}
static void
diff --git a/src/intel/vulkan/gen7_cmd_buffer.c b/src/intel/vulkan/gen7_cmd_buffer.c
index b5d21efb203..5130a40d277 100644
--- a/src/intel/vulkan/gen7_cmd_buffer.c
+++ b/src/intel/vulkan/gen7_cmd_buffer.c
@@ -133,10 +133,11 @@ clamp_int64(int64_t x, int64_t min, int64_t max)
}
#if GEN_GEN == 7 && !GEN_IS_HASWELL
-static void
-emit_scissor_state(struct anv_cmd_buffer *cmd_buffer,
- uint32_t count, const VkRect2D *scissors)
+void
+gen7_cmd_buffer_emit_scissor(struct anv_cmd_buffer *cmd_buffer)
{
+ uint32_t count = cmd_buffer->state.dynamic.scissor.count;
+ const VkRect2D *scissors = cmd_buffer->state.dynamic.scissor.scissors;
struct anv_state scissor_state =
anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, count * 8, 32);
@@ -178,25 +179,6 @@ emit_scissor_state(struct anv_cmd_buffer *cmd_buffer,
if (!cmd_buffer->device->info.has_llc)
anv_state_clflush(scissor_state);
}
-
-void
-gen7_cmd_buffer_emit_scissor(struct anv_cmd_buffer *cmd_buffer)
-{
- if (cmd_buffer->state.dynamic.scissor.count > 0) {
- emit_scissor_state(cmd_buffer, cmd_buffer->state.dynamic.scissor.count,
- cmd_buffer->state.dynamic.scissor.scissors);
- } else {
- /* Emit a default scissor based on the currently bound framebuffer */
- emit_scissor_state(cmd_buffer, 1,
- &(VkRect2D) {
- .offset = { .x = 0, .y = 0, },
- .extent = {
- .width = cmd_buffer->state.framebuffer->width,
- .height = cmd_buffer->state.framebuffer->height,
- },
- });
- }
-}
#endif
static const uint32_t vk_to_gen_index_type[] = {
diff --git a/src/intel/vulkan/gen8_cmd_buffer.c b/src/intel/vulkan/gen8_cmd_buffer.c
index 5b6afb3d70d..3956a58d201 100644
--- a/src/intel/vulkan/gen8_cmd_buffer.c
+++ b/src/intel/vulkan/gen8_cmd_buffer.c
@@ -33,10 +33,11 @@
#include "genxml/genX_pack.h"
#if GEN_GEN == 8
-static void
-emit_viewport_state(struct anv_cmd_buffer *cmd_buffer,
- uint32_t count, const VkViewport *viewports)
+void
+gen8_cmd_buffer_emit_viewport(struct anv_cmd_buffer *cmd_buffer)
{
+ uint32_t count = cmd_buffer->state.dynamic.viewport.count;
+ const VkViewport *viewports = cmd_buffer->state.dynamic.viewport.viewports;
struct anv_state sf_clip_state =
anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, count * 64, 64);
struct anv_state cc_state =
@@ -86,26 +87,6 @@ emit_viewport_state(struct anv_cmd_buffer *cmd_buffer,
GENX(3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP),
.SFClipViewportPointer = sf_clip_state.offset);
}
-
-void
-gen8_cmd_buffer_emit_viewport(struct anv_cmd_buffer *cmd_buffer)
-{
- if (cmd_buffer->state.dynamic.viewport.count > 0) {
- emit_viewport_state(cmd_buffer, cmd_buffer->state.dynamic.viewport.count,
- cmd_buffer->state.dynamic.viewport.viewports);
- } else {
- /* If viewport count is 0, this is taken to mean "use the default" */
- emit_viewport_state(cmd_buffer, 1,
- &(VkViewport) {
- .x = 0.0f,
- .y = 0.0f,
- .width = cmd_buffer->state.framebuffer->width,
- .height = cmd_buffer->state.framebuffer->height,
- .minDepth = 0.0f,
- .maxDepth = 1.0f,
- });
- }
-}
#endif
#define emit_lri(batch, reg, imm) \