Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Erik Faye-Lund
mesa
Commits
5f46bdb6
Commit
5f46bdb6
authored
Sep 03, 2020
by
Louis-Francis Ratté-Boulianne
Committed by
Erik Faye-Lund
Oct 28, 2020
Browse files
d3d12: Lower point sprites when polygon mode is GL_POINT
parent
1d9d99ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/gallium/drivers/d3d12/d3d12_compiler.cpp
View file @
5f46bdb6
...
...
@@ -302,26 +302,6 @@ manual_depth_range(struct d3d12_context *ctx)
return
fs
&&
fs
->
initial
->
info
.
inputs_read
&
VARYING_BIT_POS
;
}
static
bool
needs_point_sprite_lowering
(
struct
d3d12_context
*
ctx
,
const
struct
pipe_draw_info
*
dinfo
)
{
struct
d3d12_shader_selector
*
vs
=
ctx
->
gfx_stages
[
PIPE_SHADER_VERTEX
];
struct
d3d12_shader_selector
*
gs
=
ctx
->
gfx_stages
[
PIPE_SHADER_GEOMETRY
];
if
(
gs
!=
NULL
&&
!
gs
->
is_gs_variant
)
{
/* There is an user GS; Check if it outputs points with PSIZE */
return
(
gs
->
initial
->
info
.
gs
.
output_primitive
==
GL_POINTS
&&
gs
->
initial
->
info
.
outputs_written
&
VARYING_BIT_PSIZ
);
}
else
{
/* No user GS; check if we are drawing wide points */
return
(
dinfo
->
mode
==
PIPE_PRIM_POINTS
&&
(
ctx
->
gfx_pipeline_state
.
rast
->
base
.
point_size
>
1.0
||
(
ctx
->
gfx_pipeline_state
.
rast
->
base
.
point_size_per_vertex
&&
vs
->
initial
->
info
.
outputs_written
&
VARYING_BIT_PSIZ
))
&&
(
vs
->
initial
->
info
.
outputs_written
&
VARYING_BIT_POS
));
}
}
static
bool
needs_edge_flag_fix
(
enum
pipe_prim_type
mode
)
{
...
...
@@ -357,6 +337,27 @@ fill_mode_lowered(struct d3d12_context *ctx, const struct pipe_draw_info *dinfo)
return
PIPE_POLYGON_MODE_FILL
;
}
static
bool
needs_point_sprite_lowering
(
struct
d3d12_context
*
ctx
,
const
struct
pipe_draw_info
*
dinfo
)
{
struct
d3d12_shader_selector
*
vs
=
ctx
->
gfx_stages
[
PIPE_SHADER_VERTEX
];
struct
d3d12_shader_selector
*
gs
=
ctx
->
gfx_stages
[
PIPE_SHADER_GEOMETRY
];
if
(
gs
!=
NULL
&&
!
gs
->
is_gs_variant
)
{
/* There is an user GS; Check if it outputs points with PSIZE */
return
(
gs
->
initial
->
info
.
gs
.
output_primitive
==
GL_POINTS
&&
gs
->
initial
->
info
.
outputs_written
&
VARYING_BIT_PSIZ
);
}
else
{
/* No user GS; check if we are drawing wide points */
return
((
dinfo
->
mode
==
PIPE_PRIM_POINTS
||
fill_mode_lowered
(
ctx
,
dinfo
)
==
PIPE_POLYGON_MODE_POINT
)
&&
(
ctx
->
gfx_pipeline_state
.
rast
->
base
.
point_size
>
1.0
||
(
ctx
->
gfx_pipeline_state
.
rast
->
base
.
point_size_per_vertex
&&
vs
->
initial
->
info
.
outputs_written
&
VARYING_BIT_PSIZ
))
&&
(
vs
->
initial
->
info
.
outputs_written
&
VARYING_BIT_POS
));
}
}
static
unsigned
cull_mode_lowered
(
struct
d3d12_context
*
ctx
,
unsigned
fill_mode
)
{
...
...
@@ -509,15 +510,7 @@ validate_geometry_shader_variant(struct d3d12_selection_context *sel_ctx)
return
;
/* Fill the geometry shader variant key */
if
(
sel_ctx
->
needs_point_sprite_lowering
)
{
key
.
passthrough
=
true
;
variant_needed
=
true
;
}
else
if
(
sel_ctx
->
needs_vertex_reordering
)
{
/* TODO support cases where flat shading (pv != 0) and xfb are enabled */
key
.
provoking_vertex
=
sel_ctx
->
provoking_vertex
;
key
.
alternate_tri
=
sel_ctx
->
alternate_tri
;
variant_needed
=
true
;
}
else
if
(
sel_ctx
->
fill_mode_lowered
!=
PIPE_POLYGON_MODE_FILL
)
{
if
(
sel_ctx
->
fill_mode_lowered
!=
PIPE_POLYGON_MODE_FILL
)
{
key
.
fill_mode
=
sel_ctx
->
fill_mode_lowered
;
key
.
cull_mode
=
sel_ctx
->
cull_mode_lowered
;
key
.
has_front_face
=
(
fs
->
initial
->
info
.
inputs_read
&
VARYING_BIT_FACE
)
?
1
:
0
;
...
...
@@ -528,6 +521,14 @@ validate_geometry_shader_variant(struct d3d12_selection_context *sel_ctx)
if
(
key
.
flat_varyings
!=
0
)
key
.
flatshade_first
=
ctx
->
gfx_pipeline_state
.
rast
->
base
.
flatshade_first
;
variant_needed
=
true
;
}
else
if
(
sel_ctx
->
needs_point_sprite_lowering
)
{
key
.
passthrough
=
true
;
variant_needed
=
true
;
}
else
if
(
sel_ctx
->
needs_vertex_reordering
)
{
/* TODO support cases where flat shading (pv != 0) and xfb are enabled */
key
.
provoking_vertex
=
sel_ctx
->
provoking_vertex
;
key
.
alternate_tri
=
sel_ctx
->
alternate_tri
;
variant_needed
=
true
;
}
if
(
variant_needed
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment