ilo: add ilo_state_raster

We want to replace ilo_rasterizer_state with ilo_state_raster.
This commit is contained in:
Chia-I Wu 2015-05-10 13:52:21 +08:00
parent 4fa7ed99a1
commit 6be8b6053d
3 changed files with 1262 additions and 0 deletions

View file

@ -23,6 +23,8 @@ C_SOURCES := \
core/ilo_state_3d.h \
core/ilo_state_3d_bottom.c \
core/ilo_state_3d_top.c \
core/ilo_state_raster.c \
core/ilo_state_raster.h \
core/ilo_state_sampler.c \
core/ilo_state_sampler.h \
core/ilo_state_surface.c \

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,232 @@
/*
* Mesa 3-D graphics library
*
* Copyright (C) 2015 LunarG, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors:
* Chia-I Wu <olv@lunarg.com>
*/
#ifndef ILO_STATE_RASTER_H
#define ILO_STATE_RASTER_H
#include "genhw/genhw.h"
#include "ilo_core.h"
#include "ilo_dev.h"
enum ilo_state_raster_dirty_bits {
ILO_STATE_RASTER_3DSTATE_CLIP = (1 << 0),
ILO_STATE_RASTER_3DSTATE_SF = (1 << 1),
ILO_STATE_RASTER_3DSTATE_RASTER = (1 << 2),
ILO_STATE_RASTER_3DSTATE_MULTISAMPLE = (1 << 3),
ILO_STATE_RASTER_3DSTATE_SAMPLE_MASK = (1 << 4),
ILO_STATE_RASTER_3DSTATE_WM = (1 << 5),
ILO_STATE_RASTER_3DSTATE_WM_HZ_OP = (1 << 6),
};
enum ilo_state_raster_earlyz_op {
ILO_STATE_RASTER_EARLYZ_NORMAL,
ILO_STATE_RASTER_EARLYZ_DEPTH_CLEAR,
ILO_STATE_RASTER_EARLYZ_DEPTH_RESOLVE,
ILO_STATE_RASTER_EARLYZ_HIZ_RESOLVE,
};
/**
* VUE readback, VertexClipTest, ClipDetermination, and primitive output.
*/
struct ilo_state_raster_clip_info {
bool clip_enable;
/* CL_INVOCATION_COUNT and CL_PRIMITIVES_COUNT */
bool stats_enable;
uint8_t viewport_count;
bool force_rtaindex_zero;
/* these should be mutually exclusive */
uint8_t user_cull_enables;
uint8_t user_clip_enables;
bool gb_test_enable;
bool xy_test_enable;
/* far/near must be enabled together prior to Gen9 */
bool z_far_enable;
bool z_near_enable;
bool z_near_zero;
};
/**
* Primitive assembly, viewport transformation, scissoring, MSAA, etc.
*/
struct ilo_state_raster_setup_info {
bool cv_is_rectangle;
bool first_vertex_provoking;
bool viewport_transform;
bool scissor_enable;
/* MSAA enables for lines and non-lines */
bool msaa_enable;
bool line_msaa_enable;
};
/**
* 3DOBJ_POINT rasterization rules.
*/
struct ilo_state_raster_point_info {
/* ignored when msaa_enable is set */
bool aa_enable;
bool programmable_width;
};
/**
* 3DOBJ_LINE rasterization rules.
*/
struct ilo_state_raster_line_info {
/* ignored when line_msaa_enable is set */
bool aa_enable;
/* ignored when line_msaa_enable or aa_enable is set */
bool stipple_enable;
bool giq_enable;
bool giq_last_pixel;
};
/**
* 3DOBJ_TRIANGLE rasterization rules.
*/
struct ilo_state_raster_tri_info {
enum gen_front_winding front_winding;
enum gen_cull_mode cull_mode;
enum gen_fill_mode fill_mode_front;
enum gen_fill_mode fill_mode_back;
enum gen_depth_format depth_offset_format;
bool depth_offset_solid;
bool depth_offset_wireframe;
bool depth_offset_point;
bool poly_stipple_enable;
};
/**
* Scan conversion.
*/
struct ilo_state_raster_scan_info {
/* PS_DEPTH_COUNT and PS_INVOCATION_COUNT */
bool stats_enable;
uint8_t sample_count;
/* pixel location for non-MSAA or 1x-MSAA */
enum gen_pixel_location pixloc;
uint32_t sample_mask;
/* interpolations */
enum gen_zw_interp zw_interp;
uint8_t barycentric_interps;
/* Gen7+ only */
enum gen_edsc_mode earlyz_control;
enum ilo_state_raster_earlyz_op earlyz_op;
bool earlyz_stencil_clear;
};
/**
* Raster parameters.
*/
struct ilo_state_raster_params_info {
bool any_integer_rt;
bool hiz_enable;
float point_width;
float line_width;
/* const term will be scaled by 'r' */
float depth_offset_const;
float depth_offset_scale;
float depth_offset_clamp;
};
struct ilo_state_raster_info {
struct ilo_state_raster_clip_info clip;
struct ilo_state_raster_setup_info setup;
struct ilo_state_raster_point_info point;
struct ilo_state_raster_line_info line;
struct ilo_state_raster_tri_info tri;
struct ilo_state_raster_scan_info scan;
struct ilo_state_raster_params_info params;
};
struct ilo_state_raster {
uint32_t clip[3];
uint32_t sf[3];
uint32_t raster[4];
uint32_t sample[2];
uint32_t wm[3];
bool line_aa_enable;
bool line_giq_enable;
};
struct ilo_state_raster_delta {
uint32_t dirty;
};
bool
ilo_state_raster_init(struct ilo_state_raster *rs,
const struct ilo_dev *dev,
const struct ilo_state_raster_info *info);
bool
ilo_state_raster_init_for_rectlist(struct ilo_state_raster *rs,
const struct ilo_dev *dev,
uint8_t sample_count,
enum ilo_state_raster_earlyz_op earlyz_op,
bool earlyz_stencil_clear);
bool
ilo_state_raster_set_info(struct ilo_state_raster *rs,
const struct ilo_dev *dev,
const struct ilo_state_raster_info *info);
bool
ilo_state_raster_set_params(struct ilo_state_raster *rs,
const struct ilo_dev *dev,
const struct ilo_state_raster_params_info *params);
void
ilo_state_raster_full_delta(const struct ilo_state_raster *rs,
const struct ilo_dev *dev,
struct ilo_state_raster_delta *delta);
void
ilo_state_raster_get_delta(const struct ilo_state_raster *rs,
const struct ilo_dev *dev,
const struct ilo_state_raster *old,
struct ilo_state_raster_delta *delta);
#endif /* ILO_STATE_RASTER_H */