mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 04:30:10 +01:00
intel: use _mesa_is_winsys/user_fbo() helpers
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
264b584294
commit
4433b0302d
16 changed files with 48 additions and 32 deletions
|
|
@ -30,6 +30,7 @@
|
|||
#include "main/context.h"
|
||||
#include "main/macros.h"
|
||||
#include "main/enums.h"
|
||||
#include "main/fbobject.h"
|
||||
#include "main/dd.h"
|
||||
#include "main/state.h"
|
||||
|
||||
|
|
@ -545,7 +546,7 @@ i830Scissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h)
|
|||
|
||||
DBG("%s %d,%d %dx%d\n", __FUNCTION__, x, y, w, h);
|
||||
|
||||
if (ctx->DrawBuffer->Name == 0) {
|
||||
if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
|
||||
x1 = x;
|
||||
y1 = ctx->DrawBuffer->Height - (y + h);
|
||||
x2 = x + w - 1;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "main/context.h"
|
||||
#include "main/macros.h"
|
||||
#include "main/enums.h"
|
||||
#include "main/fbobject.h"
|
||||
#include "main/dd.h"
|
||||
#include "main/state.h"
|
||||
#include "tnl/tnl.h"
|
||||
|
|
@ -400,7 +401,7 @@ intelCalcViewport(struct gl_context * ctx)
|
|||
{
|
||||
struct intel_context *intel = intel_context(ctx);
|
||||
|
||||
if (ctx->DrawBuffer->Name == 0) {
|
||||
if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
|
||||
_math_matrix_viewport(&intel->ViewportMatrix,
|
||||
ctx->Viewport.X,
|
||||
ctx->DrawBuffer->Height - ctx->Viewport.Y,
|
||||
|
|
@ -518,7 +519,7 @@ i915Scissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h)
|
|||
|
||||
DBG("%s %d,%d %dx%d\n", __FUNCTION__, x, y, w, h);
|
||||
|
||||
if (ctx->DrawBuffer->Name == 0) {
|
||||
if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
|
||||
x1 = x;
|
||||
y1 = ctx->DrawBuffer->Height - (y + h);
|
||||
x2 = x + w - 1;
|
||||
|
|
@ -577,7 +578,7 @@ i915CullFaceFrontFace(struct gl_context * ctx, GLenum unused)
|
|||
else if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) {
|
||||
mode = S4_CULLMODE_CW;
|
||||
|
||||
if (ctx->DrawBuffer && ctx->DrawBuffer->Name != 0)
|
||||
if (ctx->DrawBuffer && _mesa_is_user_fbo(ctx->DrawBuffer))
|
||||
mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW);
|
||||
if (ctx->Polygon.CullFaceMode == GL_FRONT)
|
||||
mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ extern "C" {
|
|||
#include "main/macros.h"
|
||||
#include "main/shaderobj.h"
|
||||
#include "main/uniforms.h"
|
||||
#include "main/fbobject.h"
|
||||
#include "program/prog_parameter.h"
|
||||
#include "program/prog_print.h"
|
||||
#include "program/register_allocate.h"
|
||||
|
|
@ -1828,7 +1829,7 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
|
|||
|
||||
if (fp->Base.InputsRead & FRAG_BIT_WPOS) {
|
||||
key.drawable_height = ctx->DrawBuffer->Height;
|
||||
key.render_to_fbo = ctx->DrawBuffer->Name != 0;
|
||||
key.render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
|
||||
}
|
||||
|
||||
key.nr_color_regions = 1;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@
|
|||
#include "brw_state.h"
|
||||
#include "brw_defines.h"
|
||||
|
||||
#include "main/fbobject.h"
|
||||
|
||||
/* Constant single cliprect for framebuffer object or DRI2 drawing */
|
||||
static void upload_drawing_rect(struct brw_context *brw)
|
||||
{
|
||||
|
|
@ -507,7 +509,7 @@ static void upload_polygon_stipple(struct brw_context *brw)
|
|||
* to a FBO (i.e. any named frame buffer object), we *don't*
|
||||
* need to invert - we already match the layout.
|
||||
*/
|
||||
if (ctx->DrawBuffer->Name == 0) {
|
||||
if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
|
||||
for (i = 0; i < 32; i++)
|
||||
OUT_BATCH(ctx->PolygonStipple[31 - i]); /* invert */
|
||||
}
|
||||
|
|
@ -550,15 +552,13 @@ static void upload_polygon_stipple_offset(struct brw_context *brw)
|
|||
|
||||
/* _NEW_BUFFERS
|
||||
*
|
||||
* If we're drawing to a system window (ctx->DrawBuffer->Name == 0),
|
||||
* we have to invert the Y axis in order to match the OpenGL
|
||||
* pixel coordinate system, and our offset must be matched
|
||||
* to the window position. If we're drawing to a FBO
|
||||
* (ctx->DrawBuffer->Name != 0), then our native pixel coordinate
|
||||
* system works just fine, and there's no window system to
|
||||
* worry about.
|
||||
* If we're drawing to a system window we have to invert the Y axis
|
||||
* in order to match the OpenGL pixel coordinate system, and our
|
||||
* offset must be matched to the window position. If we're drawing
|
||||
* to a user-created FBO then our native pixel coordinate system
|
||||
* works just fine, and there's no window system to worry about.
|
||||
*/
|
||||
if (brw->intel.ctx.DrawBuffer->Name == 0)
|
||||
if (_mesa_is_winsys_fbo(brw->intel.ctx.DrawBuffer))
|
||||
OUT_BATCH((32 - (ctx->DrawBuffer->Height & 31)) & 31);
|
||||
else
|
||||
OUT_BATCH(0);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,9 @@
|
|||
|
||||
#include "main/glheader.h"
|
||||
#include "main/macros.h"
|
||||
#include "main/mtypes.h"
|
||||
#include "main/enums.h"
|
||||
#include "main/fbobject.h"
|
||||
|
||||
#include "intel_batchbuffer.h"
|
||||
|
||||
|
|
@ -136,7 +138,7 @@ brw_upload_sf_prog(struct brw_context *brw)
|
|||
struct gl_context *ctx = &brw->intel.ctx;
|
||||
struct brw_sf_prog_key key;
|
||||
/* _NEW_BUFFERS */
|
||||
bool render_to_fbo = ctx->DrawBuffer->Name != 0;
|
||||
bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
|
||||
|
||||
memset(&key, 0, sizeof(key));
|
||||
|
||||
|
|
|
|||
|
|
@ -31,10 +31,12 @@
|
|||
|
||||
|
||||
|
||||
#include "main/mtypes.h"
|
||||
#include "main/macros.h"
|
||||
#include "main/fbobject.h"
|
||||
#include "brw_context.h"
|
||||
#include "brw_state.h"
|
||||
#include "brw_defines.h"
|
||||
#include "main/macros.h"
|
||||
#include "brw_sf.h"
|
||||
|
||||
static void upload_sf_vp(struct brw_context *brw)
|
||||
|
|
@ -44,7 +46,7 @@ static void upload_sf_vp(struct brw_context *brw)
|
|||
const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
|
||||
struct brw_sf_viewport *sfv;
|
||||
GLfloat y_scale, y_bias;
|
||||
const bool render_to_fbo = (ctx->DrawBuffer->Name != 0);
|
||||
const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
|
||||
const GLfloat *v = ctx->Viewport._WindowMap.m;
|
||||
|
||||
sfv = brw_state_batch(brw, AUB_TRACE_SF_VP_STATE,
|
||||
|
|
@ -142,7 +144,7 @@ static void upload_sf_unit( struct brw_context *brw )
|
|||
struct brw_sf_unit_state *sf;
|
||||
drm_intel_bo *bo = intel->batch.bo;
|
||||
int chipset_max_threads;
|
||||
bool render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
|
||||
bool render_to_fbo = _mesa_is_user_fbo(brw->intel.ctx.DrawBuffer);
|
||||
|
||||
sf = brw_state_batch(brw, AUB_TRACE_SF_STATE,
|
||||
sizeof(*sf), 64, &brw->sf.state_offset);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "brw_wm.h"
|
||||
#include "brw_state.h"
|
||||
#include "main/formats.h"
|
||||
#include "main/fbobject.h"
|
||||
#include "main/samplerobj.h"
|
||||
#include "program/prog_parameter.h"
|
||||
|
||||
|
|
@ -516,7 +517,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
|
|||
*/
|
||||
if (fp->program.Base.InputsRead & FRAG_BIT_WPOS) {
|
||||
key->drawable_height = ctx->DrawBuffer->Height;
|
||||
key->render_to_fbo = ctx->DrawBuffer->Name != 0;
|
||||
key->render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
|
||||
}
|
||||
|
||||
/* _NEW_BUFFERS */
|
||||
|
|
|
|||
|
|
@ -29,13 +29,14 @@
|
|||
#include "brw_state.h"
|
||||
#include "brw_defines.h"
|
||||
#include "intel_batchbuffer.h"
|
||||
#include "main/fbobject.h"
|
||||
|
||||
static void
|
||||
gen6_upload_scissor_state(struct brw_context *brw)
|
||||
{
|
||||
struct intel_context *intel = &brw->intel;
|
||||
struct gl_context *ctx = &intel->ctx;
|
||||
const bool render_to_fbo = (ctx->DrawBuffer->Name != 0);
|
||||
const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
|
||||
struct gen6_scissor_rect *scissor;
|
||||
uint32_t scissor_state_offset;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "brw_defines.h"
|
||||
#include "brw_util.h"
|
||||
#include "main/macros.h"
|
||||
#include "main/fbobject.h"
|
||||
#include "intel_batchbuffer.h"
|
||||
|
||||
/**
|
||||
|
|
@ -120,7 +121,7 @@ upload_sf_state(struct brw_context *brw)
|
|||
uint32_t dw1, dw2, dw3, dw4, dw16, dw17;
|
||||
int i;
|
||||
/* _NEW_BUFFER */
|
||||
bool render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
|
||||
bool render_to_fbo = _mesa_is_user_fbo(brw->intel.ctx.DrawBuffer);
|
||||
int attr = 0, input_index = 0;
|
||||
int urb_entry_read_offset = 1;
|
||||
float point_size;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "brw_state.h"
|
||||
#include "brw_defines.h"
|
||||
#include "intel_batchbuffer.h"
|
||||
#include "main/fbobject.h"
|
||||
|
||||
/* The clip VP defines the guardband region where expensive clipping is skipped
|
||||
* and fragments are allowed to be generated and clipped out cheaply by the SF.
|
||||
|
|
@ -70,7 +71,7 @@ gen6_upload_sf_vp(struct brw_context *brw)
|
|||
const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
|
||||
struct brw_sf_viewport *sfv;
|
||||
GLfloat y_scale, y_bias;
|
||||
const bool render_to_fbo = (ctx->DrawBuffer->Name != 0);
|
||||
const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
|
||||
const GLfloat *v = ctx->Viewport._WindowMap.m;
|
||||
|
||||
sfv = brw_state_batch(brw, AUB_TRACE_SF_VP_STATE,
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "brw_defines.h"
|
||||
#include "brw_util.h"
|
||||
#include "intel_batchbuffer.h"
|
||||
#include "main/fbobject.h"
|
||||
|
||||
static void
|
||||
upload_clip_state(struct brw_context *brw)
|
||||
|
|
@ -38,7 +39,7 @@ upload_clip_state(struct brw_context *brw)
|
|||
uint32_t nonperspective_barycentric_enable_flag = 0;
|
||||
|
||||
/* _NEW_BUFFERS */
|
||||
bool render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
|
||||
bool render_to_fbo = _mesa_is_user_fbo(brw->intel.ctx.DrawBuffer);
|
||||
|
||||
/* CACHE_NEW_WM_PROG */
|
||||
if (brw->wm.prog_data->barycentric_interp_modes &
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "brw_defines.h"
|
||||
#include "brw_util.h"
|
||||
#include "main/macros.h"
|
||||
#include "main/fbobject.h"
|
||||
#include "intel_batchbuffer.h"
|
||||
|
||||
static void
|
||||
|
|
@ -44,7 +45,7 @@ upload_sbe_state(struct brw_context *brw)
|
|||
int urb_entry_read_offset = 1;
|
||||
uint16_t attr_overrides[FRAG_ATTRIB_MAX];
|
||||
/* _NEW_BUFFERS */
|
||||
bool render_to_fbo = ctx->DrawBuffer->Name != 0;
|
||||
bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
|
||||
uint32_t point_sprite_origin;
|
||||
|
||||
/* CACHE_NEW_VS_PROG */
|
||||
|
|
@ -159,7 +160,7 @@ upload_sf_state(struct brw_context *brw)
|
|||
uint32_t dw1, dw2, dw3;
|
||||
float point_size;
|
||||
/* _NEW_BUFFERS */
|
||||
bool render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
|
||||
bool render_to_fbo = _mesa_is_user_fbo(brw->intel.ctx.DrawBuffer);
|
||||
|
||||
dw1 = GEN6_SF_STATISTICS_ENABLE |
|
||||
GEN6_SF_VIEWPORT_TRANSFORM_ENABLE;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "brw_state.h"
|
||||
#include "brw_defines.h"
|
||||
#include "intel_batchbuffer.h"
|
||||
#include "main/fbobject.h"
|
||||
|
||||
static void
|
||||
gen7_upload_sf_clip_viewport(struct brw_context *brw)
|
||||
|
|
@ -33,7 +34,7 @@ gen7_upload_sf_clip_viewport(struct brw_context *brw)
|
|||
struct gl_context *ctx = &intel->ctx;
|
||||
const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
|
||||
GLfloat y_scale, y_bias;
|
||||
const bool render_to_fbo = (ctx->DrawBuffer->Name != 0);
|
||||
const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
|
||||
const GLfloat *v = ctx->Viewport._WindowMap.m;
|
||||
struct gen7_sf_clip_viewport *vp;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "intel_fbo.h"
|
||||
#include "intel_mipmap_tree.h"
|
||||
|
||||
#include "main/fbobject.h"
|
||||
#include "main/framebuffer.h"
|
||||
#include "main/renderbuffer.h"
|
||||
|
||||
|
|
@ -82,7 +83,7 @@ intel_check_front_buffer_rendering(struct intel_context *intel)
|
|||
static void
|
||||
intelDrawBuffer(struct gl_context * ctx, GLenum mode)
|
||||
{
|
||||
if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) {
|
||||
if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) {
|
||||
struct intel_context *const intel = intel_context(ctx);
|
||||
const bool was_front_buffer_rendering =
|
||||
intel->is_front_buffer_rendering;
|
||||
|
|
@ -105,7 +106,7 @@ intelDrawBuffer(struct gl_context * ctx, GLenum mode)
|
|||
static void
|
||||
intelReadBuffer(struct gl_context * ctx, GLenum mode)
|
||||
{
|
||||
if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) {
|
||||
if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) {
|
||||
struct intel_context *const intel = intel_context(ctx);
|
||||
const bool was_front_buffer_reading =
|
||||
intel->is_front_buffer_reading;
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ intel_flush_front(struct gl_context *ctx)
|
|||
__DRIcontext *driContext = intel->driContext;
|
||||
__DRIscreen *const screen = intel->intelScreen->driScrnPriv;
|
||||
|
||||
if ((ctx->DrawBuffer->Name == 0) && intel->front_buffer_dirty) {
|
||||
if (_mesa_is_winsys_fbo(ctx->DrawBuffer) && intel->front_buffer_dirty) {
|
||||
if (screen->dri2.loader &&
|
||||
(screen->dri2.loader->base.version >= 2)
|
||||
&& (screen->dri2.loader->flushFrontBuffer != NULL) &&
|
||||
|
|
@ -454,7 +454,7 @@ intel_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
|
|||
if (intel->saved_viewport)
|
||||
intel->saved_viewport(ctx, x, y, w, h);
|
||||
|
||||
if (ctx->DrawBuffer->Name == 0) {
|
||||
if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
|
||||
dri2InvalidateDrawable(driContext->driDrawablePriv);
|
||||
dri2InvalidateDrawable(driContext->driReadablePriv);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "main/enums.h"
|
||||
#include "main/mtypes.h"
|
||||
#include "main/macros.h"
|
||||
#include "main/fbobject.h"
|
||||
#include "main/image.h"
|
||||
#include "main/bufferobj.h"
|
||||
#include "main/readpix.h"
|
||||
|
|
@ -116,7 +117,7 @@ do_blit_readpixels(struct gl_context * ctx,
|
|||
return false;
|
||||
}
|
||||
else {
|
||||
if (ctx->ReadBuffer->Name == 0)
|
||||
if (_mesa_is_winsys_fbo(ctx->ReadBuffer))
|
||||
rowLength = -rowLength;
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +146,7 @@ do_blit_readpixels(struct gl_context * ctx,
|
|||
all ? INTEL_WRITE_FULL :
|
||||
INTEL_WRITE_PART);
|
||||
|
||||
if (ctx->ReadBuffer->Name == 0)
|
||||
if (_mesa_is_winsys_fbo(ctx->ReadBuffer))
|
||||
y = ctx->ReadBuffer->Height - (y + height);
|
||||
|
||||
if (!intelEmitCopyBlit(intel,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue