Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Erik Faye-Lund
mesa
Commits
869ad840
Commit
869ad840
authored
Nov 03, 2020
by
Erik Faye-Lund
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d12: add pass to forward front-face
parent
44f7c57e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
0 deletions
+50
-0
src/gallium/drivers/d3d12/d3d12_nir_passes.c
src/gallium/drivers/d3d12/d3d12_nir_passes.c
+47
-0
src/gallium/drivers/d3d12/d3d12_nir_passes.h
src/gallium/drivers/d3d12/d3d12_nir_passes.h
+3
-0
No files found.
src/gallium/drivers/d3d12/d3d12_nir_passes.c
View file @
869ad840
...
...
@@ -115,6 +115,53 @@ d3d12_lower_yflip(nir_shader *nir)
}
}
static
void
lower_load_face
(
nir_builder
*
b
,
struct
nir_instr
*
instr
,
nir_variable
*
var
)
{
if
(
instr
->
type
!=
nir_instr_type_intrinsic
)
return
;
nir_intrinsic_instr
*
intr
=
nir_instr_as_intrinsic
(
instr
);
if
(
intr
->
intrinsic
!=
nir_intrinsic_load_front_face
)
return
;
b
->
cursor
=
nir_before_instr
(
&
intr
->
instr
);
nir_ssa_def
*
load
=
nir_load_var
(
b
,
var
);
nir_ssa_def_rewrite_uses
(
&
intr
->
dest
.
ssa
,
nir_src_for_ssa
(
load
));
nir_instr_remove
(
instr
);
}
void
d3d12_forward_front_face
(
nir_shader
*
nir
)
{
assert
(
nir
->
info
.
stage
==
MESA_SHADER_FRAGMENT
);
nir_variable
*
var
=
nir_variable_create
(
nir
,
nir_var_shader_in
,
glsl_bool_type
(),
"gl_FrontFacing"
);
var
->
data
.
location
=
VARYING_SLOT_VAR12
;
var
->
data
.
interpolation
=
INTERP_MODE_FLAT
;
nir_foreach_function
(
function
,
nir
)
{
if
(
function
->
impl
)
{
nir_builder
b
;
nir_builder_init
(
&
b
,
function
->
impl
);
nir_foreach_block
(
block
,
function
->
impl
)
{
nir_foreach_instr_safe
(
instr
,
block
)
{
lower_load_face
(
&
b
,
instr
,
var
);
}
}
nir_metadata_preserve
(
function
->
impl
,
nir_metadata_block_index
|
nir_metadata_dominance
);
}
}
}
static
void
lower_pos_read
(
nir_builder
*
b
,
struct
nir_instr
*
instr
,
nir_variable
**
depth_transform_var
)
...
...
src/gallium/drivers/d3d12/d3d12_nir_passes.h
View file @
869ad840
...
...
@@ -45,6 +45,9 @@ d3d12_lower_state_vars(struct nir_shader *s, struct d3d12_shader *shader);
void
d3d12_lower_yflip
(
nir_shader
*
s
);
void
d3d12_forward_front_face
(
nir_shader
*
nir
);
void
d3d12_lower_depth_range
(
nir_shader
*
nir
);
...
...
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