mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-05 13:20:10 +01:00
radv/meta: cleanup resolve vertex state emission
For the hw resolve there is no need to emit any sort of texture coordinates, so drop them all in the meta path. Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
24427e31ef
commit
fa57b77105
1 changed files with 2 additions and 47 deletions
|
|
@ -33,7 +33,6 @@
|
|||
*/
|
||||
struct vertex_attrs {
|
||||
float position[2]; /**< 3DPRIM_RECTLIST */
|
||||
float tex_position[2];
|
||||
};
|
||||
|
||||
/* passthrough vertex shader */
|
||||
|
|
@ -45,8 +44,6 @@ build_nir_vs(void)
|
|||
nir_builder b;
|
||||
nir_variable *a_position;
|
||||
nir_variable *v_position;
|
||||
nir_variable *a_tex_position;
|
||||
nir_variable *v_tex_position;
|
||||
|
||||
nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_VERTEX, NULL);
|
||||
b.shader->info->name = ralloc_strdup(b.shader, "meta_resolve_vs");
|
||||
|
|
@ -59,16 +56,7 @@ build_nir_vs(void)
|
|||
"gl_Position");
|
||||
v_position->data.location = VARYING_SLOT_POS;
|
||||
|
||||
a_tex_position = nir_variable_create(b.shader, nir_var_shader_in, vec4,
|
||||
"a_tex_position");
|
||||
a_tex_position->data.location = VERT_ATTRIB_GENERIC1;
|
||||
|
||||
v_tex_position = nir_variable_create(b.shader, nir_var_shader_out, vec4,
|
||||
"v_tex_position");
|
||||
v_tex_position->data.location = VARYING_SLOT_VAR0;
|
||||
|
||||
nir_copy_var(&b, v_position, a_position);
|
||||
nir_copy_var(&b, v_tex_position, a_tex_position);
|
||||
|
||||
return b.shader;
|
||||
}
|
||||
|
|
@ -79,22 +67,16 @@ build_nir_fs(void)
|
|||
{
|
||||
const struct glsl_type *vec4 = glsl_vec4_type();
|
||||
nir_builder b;
|
||||
nir_variable *v_tex_position; /* vec4, varying texture coordinate */
|
||||
nir_variable *f_color; /* vec4, fragment output color */
|
||||
|
||||
nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_FRAGMENT, NULL);
|
||||
b.shader->info->name = ralloc_asprintf(b.shader,
|
||||
"meta_resolve_fs");
|
||||
|
||||
v_tex_position = nir_variable_create(b.shader, nir_var_shader_in, vec4,
|
||||
"v_tex_position");
|
||||
v_tex_position->data.location = VARYING_SLOT_VAR0;
|
||||
|
||||
f_color = nir_variable_create(b.shader, nir_var_shader_out, vec4,
|
||||
"f_color");
|
||||
f_color->data.location = FRAG_RESULT_DATA0;
|
||||
|
||||
nir_copy_var(&b, f_color, v_tex_position);
|
||||
nir_store_var(&b, f_color, nir_imm_vec4(&b, 0.0, 0.0, 0.0, 1.0), 0xf);
|
||||
|
||||
return b.shader;
|
||||
}
|
||||
|
|
@ -198,7 +180,7 @@ create_pipeline(struct radv_device *device,
|
|||
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX
|
||||
},
|
||||
},
|
||||
.vertexAttributeDescriptionCount = 2,
|
||||
.vertexAttributeDescriptionCount = 1,
|
||||
.pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[]) {
|
||||
{
|
||||
/* Position */
|
||||
|
|
@ -207,13 +189,6 @@ create_pipeline(struct radv_device *device,
|
|||
.format = VK_FORMAT_R32G32_SFLOAT,
|
||||
.offset = offsetof(struct vertex_attrs, position),
|
||||
},
|
||||
{
|
||||
/* Texture Coordinate */
|
||||
.location = 1,
|
||||
.binding = 0,
|
||||
.format = VK_FORMAT_R32G32_SFLOAT,
|
||||
.offset = offsetof(struct vertex_attrs, tex_position),
|
||||
},
|
||||
},
|
||||
},
|
||||
.pInputAssemblyState = &(VkPipelineInputAssemblyStateCreateInfo) {
|
||||
|
|
@ -333,7 +308,6 @@ cleanup:
|
|||
|
||||
static void
|
||||
emit_resolve(struct radv_cmd_buffer *cmd_buffer,
|
||||
const VkOffset2D *src_offset,
|
||||
const VkOffset2D *dest_offset,
|
||||
const VkExtent2D *resolve_extent)
|
||||
{
|
||||
|
|
@ -346,30 +320,18 @@ emit_resolve(struct radv_cmd_buffer *cmd_buffer,
|
|||
dest_offset->x,
|
||||
dest_offset->y,
|
||||
},
|
||||
.tex_position = {
|
||||
src_offset->x,
|
||||
src_offset->y,
|
||||
},
|
||||
},
|
||||
{
|
||||
.position = {
|
||||
dest_offset->x,
|
||||
dest_offset->y + resolve_extent->height,
|
||||
},
|
||||
.tex_position = {
|
||||
src_offset->x,
|
||||
src_offset->y + resolve_extent->height,
|
||||
},
|
||||
},
|
||||
{
|
||||
.position = {
|
||||
dest_offset->x + resolve_extent->width,
|
||||
dest_offset->y,
|
||||
},
|
||||
.tex_position = {
|
||||
src_offset->x + resolve_extent->width,
|
||||
src_offset->y,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -505,8 +467,6 @@ void radv_CmdResolveImage(
|
|||
*/
|
||||
const struct VkExtent3D extent =
|
||||
radv_sanitize_image_extent(src_image->type, region->extent);
|
||||
const struct VkOffset3D srcOffset =
|
||||
radv_sanitize_image_offset(src_image->type, region->srcOffset);
|
||||
const struct VkOffset3D dstOffset =
|
||||
radv_sanitize_image_offset(dest_image->type, region->dstOffset);
|
||||
|
||||
|
|
@ -587,10 +547,6 @@ void radv_CmdResolveImage(
|
|||
VK_SUBPASS_CONTENTS_INLINE);
|
||||
|
||||
emit_resolve(cmd_buffer,
|
||||
&(VkOffset2D) {
|
||||
.x = srcOffset.x,
|
||||
.y = srcOffset.y,
|
||||
},
|
||||
&(VkOffset2D) {
|
||||
.x = dstOffset.x,
|
||||
.y = dstOffset.y,
|
||||
|
|
@ -662,7 +618,6 @@ radv_cmd_buffer_resolve_subpass(struct radv_cmd_buffer *cmd_buffer)
|
|||
* 3DSTATE_DRAWING_RECTANGLE when draing a 3DPRIM_RECTLIST?
|
||||
*/
|
||||
emit_resolve(cmd_buffer,
|
||||
&(VkOffset2D) { 0, 0 },
|
||||
&(VkOffset2D) { 0, 0 },
|
||||
&(VkExtent2D) { fb->width, fb->height });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue