mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
draw: asst. clean-ups in draw_pipe_aapoint.c
Signed-off-by: Brian Paul <brianp@vmware.com> Acked-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19024>
This commit is contained in:
parent
6af739bb9e
commit
4e6a32219b
1 changed files with 22 additions and 22 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright 2008 VMware, Inc.
|
* Copyright 2008 VMware, Inc.
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
|
|
@ -10,11 +10,11 @@
|
||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
* distribute, sub license, and/or sell copies of the Software, and to
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice (including the
|
* The above copyright notice and this permission notice (including the
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -405,6 +405,7 @@ fail:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
generate_aapoint_fs_nir(struct aapoint_stage *aapoint)
|
generate_aapoint_fs_nir(struct aapoint_stage *aapoint)
|
||||||
{
|
{
|
||||||
|
|
@ -428,6 +429,7 @@ fail:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When we're about to draw our first AA point in a batch, this function is
|
* When we're about to draw our first AA point in a batch, this function is
|
||||||
* called to tell the driver to bind our modified fragment shader.
|
* called to tell the driver to bind our modified fragment shader.
|
||||||
|
|
@ -454,16 +456,13 @@ bind_aapoint_fragment_shader(struct aapoint_stage *aapoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static inline struct aapoint_stage *
|
static inline struct aapoint_stage *
|
||||||
aapoint_stage( struct draw_stage *stage )
|
aapoint_stage(struct draw_stage *stage)
|
||||||
{
|
{
|
||||||
return (struct aapoint_stage *) stage;
|
return (struct aapoint_stage *) stage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw an AA point by drawing a quad.
|
* Draw an AA point by drawing a quad.
|
||||||
*/
|
*/
|
||||||
|
|
@ -476,7 +475,6 @@ aapoint_point(struct draw_stage *stage, struct prim_header *header)
|
||||||
const uint tex_slot = aapoint->tex_slot;
|
const uint tex_slot = aapoint->tex_slot;
|
||||||
const uint pos_slot = aapoint->pos_slot;
|
const uint pos_slot = aapoint->pos_slot;
|
||||||
float radius, *pos, *tex;
|
float radius, *pos, *tex;
|
||||||
uint i;
|
|
||||||
float k;
|
float k;
|
||||||
|
|
||||||
if (aapoint->psize_slot >= 0) {
|
if (aapoint->psize_slot >= 0) {
|
||||||
|
|
@ -519,7 +517,7 @@ aapoint_point(struct draw_stage *stage, struct prim_header *header)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* allocate/dup new verts */
|
/* allocate/dup new verts */
|
||||||
for (i = 0; i < 4; i++) {
|
for (unsigned i = 0; i < 4; i++) {
|
||||||
v[i] = dup_vert(stage, header->v[0], i);
|
v[i] = dup_vert(stage, header->v[0], i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -557,12 +555,12 @@ aapoint_point(struct draw_stage *stage, struct prim_header *header)
|
||||||
tri.v[0] = v[0];
|
tri.v[0] = v[0];
|
||||||
tri.v[1] = v[1];
|
tri.v[1] = v[1];
|
||||||
tri.v[2] = v[2];
|
tri.v[2] = v[2];
|
||||||
stage->next->tri( stage->next, &tri );
|
stage->next->tri(stage->next, &tri);
|
||||||
|
|
||||||
tri.v[0] = v[0];
|
tri.v[0] = v[0];
|
||||||
tri.v[1] = v[2];
|
tri.v[1] = v[2];
|
||||||
tri.v[2] = v[3];
|
tri.v[2] = v[3];
|
||||||
stage->next->tri( stage->next, &tri );
|
stage->next->tri(stage->next, &tri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -611,7 +609,7 @@ aapoint_flush(struct draw_stage *stage, unsigned flags)
|
||||||
struct pipe_context *pipe = draw->pipe;
|
struct pipe_context *pipe = draw->pipe;
|
||||||
|
|
||||||
stage->point = aapoint_first_point;
|
stage->point = aapoint_first_point;
|
||||||
stage->next->flush( stage->next, flags );
|
stage->next->flush(stage->next, flags);
|
||||||
|
|
||||||
/* restore original frag shader */
|
/* restore original frag shader */
|
||||||
draw->suspend_flushing = TRUE;
|
draw->suspend_flushing = TRUE;
|
||||||
|
|
@ -631,7 +629,7 @@ aapoint_flush(struct draw_stage *stage, unsigned flags)
|
||||||
static void
|
static void
|
||||||
aapoint_reset_stipple_counter(struct draw_stage *stage)
|
aapoint_reset_stipple_counter(struct draw_stage *stage)
|
||||||
{
|
{
|
||||||
stage->next->reset_stipple_counter( stage->next );
|
stage->next->reset_stipple_counter(stage->next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -641,16 +639,17 @@ aapoint_destroy(struct draw_stage *stage)
|
||||||
struct aapoint_stage* aapoint = aapoint_stage(stage);
|
struct aapoint_stage* aapoint = aapoint_stage(stage);
|
||||||
struct pipe_context *pipe = stage->draw->pipe;
|
struct pipe_context *pipe = stage->draw->pipe;
|
||||||
|
|
||||||
draw_free_temp_verts( stage );
|
draw_free_temp_verts(stage);
|
||||||
|
|
||||||
/* restore the old entry points */
|
/* restore the old entry points */
|
||||||
pipe->create_fs_state = aapoint->driver_create_fs_state;
|
pipe->create_fs_state = aapoint->driver_create_fs_state;
|
||||||
pipe->bind_fs_state = aapoint->driver_bind_fs_state;
|
pipe->bind_fs_state = aapoint->driver_bind_fs_state;
|
||||||
pipe->delete_fs_state = aapoint->driver_delete_fs_state;
|
pipe->delete_fs_state = aapoint->driver_delete_fs_state;
|
||||||
|
|
||||||
FREE( stage );
|
FREE(stage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
draw_aapoint_prepare_outputs(struct draw_context *draw,
|
draw_aapoint_prepare_outputs(struct draw_context *draw,
|
||||||
struct draw_stage *stage)
|
struct draw_stage *stage)
|
||||||
|
|
@ -670,16 +669,16 @@ draw_aapoint_prepare_outputs(struct draw_context *draw,
|
||||||
TGSI_SEMANTIC_GENERIC,
|
TGSI_SEMANTIC_GENERIC,
|
||||||
aapoint->fs->generic_attrib);
|
aapoint->fs->generic_attrib);
|
||||||
assert(aapoint->tex_slot > 0); /* output[0] is vertex pos */
|
assert(aapoint->tex_slot > 0); /* output[0] is vertex pos */
|
||||||
} else
|
} else {
|
||||||
aapoint->tex_slot = -1;
|
aapoint->tex_slot = -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* find psize slot in post-transform vertex */
|
/* find psize slot in post-transform vertex */
|
||||||
aapoint->psize_slot = -1;
|
aapoint->psize_slot = -1;
|
||||||
if (draw->rasterizer->point_size_per_vertex) {
|
if (draw->rasterizer->point_size_per_vertex) {
|
||||||
const struct tgsi_shader_info *info = draw_get_shader_info(draw);
|
const struct tgsi_shader_info *info = draw_get_shader_info(draw);
|
||||||
uint i;
|
|
||||||
/* find PSIZ vertex output */
|
/* find PSIZ vertex output */
|
||||||
for (i = 0; i < info->num_outputs; i++) {
|
for (unsigned i = 0; i < info->num_outputs; i++) {
|
||||||
if (info->output_semantic_name[i] == TGSI_SEMANTIC_PSIZE) {
|
if (info->output_semantic_name[i] == TGSI_SEMANTIC_PSIZE) {
|
||||||
aapoint->psize_slot = i;
|
aapoint->psize_slot = i;
|
||||||
break;
|
break;
|
||||||
|
|
@ -688,6 +687,7 @@ draw_aapoint_prepare_outputs(struct draw_context *draw,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct aapoint_stage *
|
static struct aapoint_stage *
|
||||||
draw_aapoint_stage(struct draw_context *draw)
|
draw_aapoint_stage(struct draw_context *draw)
|
||||||
{
|
{
|
||||||
|
|
@ -705,7 +705,7 @@ draw_aapoint_stage(struct draw_context *draw)
|
||||||
aapoint->stage.reset_stipple_counter = aapoint_reset_stipple_counter;
|
aapoint->stage.reset_stipple_counter = aapoint_reset_stipple_counter;
|
||||||
aapoint->stage.destroy = aapoint_destroy;
|
aapoint->stage.destroy = aapoint_destroy;
|
||||||
|
|
||||||
if (!draw_alloc_temp_verts( &aapoint->stage, 4 ))
|
if (!draw_alloc_temp_verts(&aapoint->stage, 4))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
return aapoint;
|
return aapoint;
|
||||||
|
|
@ -733,7 +733,7 @@ aapoint_stage_from_pipe(struct pipe_context *pipe)
|
||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
aapoint_create_fs_state(struct pipe_context *pipe,
|
aapoint_create_fs_state(struct pipe_context *pipe,
|
||||||
const struct pipe_shader_state *fs)
|
const struct pipe_shader_state *fs)
|
||||||
{
|
{
|
||||||
struct aapoint_stage *aapoint = aapoint_stage_from_pipe(pipe);
|
struct aapoint_stage *aapoint = aapoint_stage_from_pipe(pipe);
|
||||||
struct aapoint_fragment_shader *aafs = CALLOC_STRUCT(aapoint_fragment_shader);
|
struct aapoint_fragment_shader *aafs = CALLOC_STRUCT(aapoint_fragment_shader);
|
||||||
|
|
@ -802,7 +802,7 @@ draw_install_aapoint_stage(struct draw_context *draw,
|
||||||
/*
|
/*
|
||||||
* Create / install AA point drawing / prim stage
|
* Create / install AA point drawing / prim stage
|
||||||
*/
|
*/
|
||||||
aapoint = draw_aapoint_stage( draw );
|
aapoint = draw_aapoint_stage(draw);
|
||||||
if (!aapoint)
|
if (!aapoint)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue