void STATE_APIENTRY crStateFogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *p) { CRContext *g = GetCurrentContext(); CRClientState *c = &(g->client); CRStateBits *sb = GetCurrentBits(); CRClientBits *cb = &(sb->client); FLUSH(); if (type != GL_BYTE && type != GL_UNSIGNED_BYTE && type != GL_SHORT && type != GL_UNSIGNED_SHORT && type != GL_INT && type != GL_UNSIGNED_INT && type != GL_FLOAT && type != GL_DOUBLE) { crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glFogCoordPointerEXT: invalid type: 0x%x", type); return; } if (stride < 0) { crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "glFogCoordPointerEXT: stride was negative: %d", stride); return; } crStateClientSetPointer(&(c->array.f), 1, type, GL_FALSE, stride, p); DIRTY(cb->dirty, g->neg_bitid); DIRTY(cb->clientPointer, g->neg_bitid); DIRTY(cb->f, g->neg_bitid); }
static inline int VAR_MATCH(struct fb_var_screeninfo *x, struct fb_var_screeninfo *y) { return (!DIRTY(bits_per_pixel) && !DIRTY(xres) && !DIRTY(yres) && !DIRTY(xres_virtual) && !DIRTY(yres_virtual) && !DIRTY_CMAP(red) && !DIRTY_CMAP(green) && !DIRTY_CMAP(blue)); }
static void gen8_draw_sf(struct ilo_render *r, const struct ilo_state_vector *vec, struct ilo_render_draw_session *session) { /* 3DSTATE_RASTER */ if (DIRTY(RASTERIZER)) { gen8_3DSTATE_RASTER(r->builder, (vec->rasterizer) ? &vec->rasterizer->sf : NULL); } /* 3DSTATE_SBE */ if (DIRTY(RASTERIZER) || DIRTY(FS)) { gen8_3DSTATE_SBE(r->builder, vec->fs, (vec->rasterizer) ? vec->rasterizer->state.sprite_coord_mode : 0); } /* 3DSTATE_SBE_SWIZ */ if (DIRTY(FS)) gen8_3DSTATE_SBE_SWIZ(r->builder, vec->fs); /* 3DSTATE_SF */ if (DIRTY(RASTERIZER)) { gen8_3DSTATE_SF(r->builder, (vec->rasterizer) ? &vec->rasterizer->sf : NULL); } }
void gen6_draw_clip(struct ilo_render *r, const struct ilo_state_vector *vec, struct ilo_render_draw_session *session) { /* 3DSTATE_CLIP */ if (DIRTY(RASTERIZER) || DIRTY(FS) || DIRTY(VIEWPORT) || DIRTY(FB)) { bool enable_guardband = true; unsigned i; /* * Gen8+ has viewport extent test. Guard band test can be enabled on * prior Gens only when the viewport is larger than the framebuffer, * unless we emulate viewport extent test on them. */ if (ilo_dev_gen(r->dev) < ILO_GEN(8)) { for (i = 0; i < vec->viewport.count; i++) { const struct ilo_viewport_cso *vp = &vec->viewport.cso[i]; if (vp->min_x > 0.0f || vp->max_x < vec->fb.state.width || vp->min_y > 0.0f || vp->max_y < vec->fb.state.height) { enable_guardband = false; break; } } } gen6_3DSTATE_CLIP(r->builder, vec->rasterizer, vec->fs, enable_guardband, 1); } }
void STATE_APIENTRY crStateTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *p) { CRContext *g = GetCurrentContext(); CRClientState *c = &(g->client); CRStateBits *sb = GetCurrentBits(); CRClientBits *cb = &(sb->client); FLUSH(); if (size != 1 && size != 2 && size != 3 && size != 4) { crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "glTexCoordPointer: invalid size: %d", size); return; } if (type != GL_SHORT && type != GL_INT && type != GL_FLOAT && type != GL_DOUBLE) { crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glTexCoordPointer: invalid type: 0x%x", type); return; } if (stride < 0) { crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "glTexCoordPointer: stride was negative: %d", stride); return; } crStateClientSetPointer(&(c->array.t[c->curClientTextureUnit]), size, type, GL_FALSE, stride, p); DIRTY(cb->dirty, g->neg_bitid); DIRTY(cb->clientPointer, g->neg_bitid); DIRTY(cb->t[c->curClientTextureUnit], g->neg_bitid); }
void STATE_APIENTRY crStatePolygonStipple (PCRStateTracker pState, const GLubyte *p) { CRContext *g = GetCurrentContext(pState); CRPolygonState *poly = &(g->polygon); CRStateBits *sb = GetCurrentBits(pState); CRPolygonBits *pb = &(sb->polygon); if (g->current.inBeginEnd) { crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glPolygonStipple called in begin/end"); return; } FLUSH(); if (!p && !crStateIsBufferBound(pState, GL_PIXEL_UNPACK_BUFFER_ARB)) { crDebug("Void pointer passed to PolygonStipple"); return; } /** @todo track mask if buffer is bound?*/ if (!crStateIsBufferBound(pState, GL_PIXEL_UNPACK_BUFFER_ARB)) { crMemcpy((char*)poly->stipple, (char*)p, 128); } DIRTY(pb->dirty, g->neg_bitid); DIRTY(pb->stipple, g->neg_bitid); }
void STATE_APIENTRY crStatePointSize(GLfloat size) { CRContext *g = GetCurrentContext(); CRPointState *p = &(g->point); CRStateBits *sb = GetCurrentBits(); CRPointBits *pb = &(sb->point); if (g->current.inBeginEnd) { crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glPointSize called in begin/end"); return; } FLUSH(); if (size <= 0.0f) { crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "glPointSize called with size <= 0.0: %f", size); return; } p->pointSize = size; DIRTY(pb->size, g->neg_bitid); DIRTY(pb->dirty, g->neg_bitid); }
void gen6_draw_vf(struct ilo_render *r, const struct ilo_state_vector *vec, struct ilo_render_draw_session *session) { if (ilo_dev_gen(r->dev) >= ILO_GEN(7.5)) { /* 3DSTATE_INDEX_BUFFER */ if (DIRTY(IB) || r->batch_bo_changed) { gen6_3DSTATE_INDEX_BUFFER(r->builder, &vec->ib, false); } /* 3DSTATE_VF */ if (session->primitive_restart_changed) { gen75_3DSTATE_VF(r->builder, vec->draw->primitive_restart, vec->draw->restart_index); } } else { /* 3DSTATE_INDEX_BUFFER */ if (DIRTY(IB) || session->primitive_restart_changed || r->batch_bo_changed) { gen6_3DSTATE_INDEX_BUFFER(r->builder, &vec->ib, vec->draw->primitive_restart); } } /* 3DSTATE_VERTEX_BUFFERS */ if (DIRTY(VB) || DIRTY(VE) || r->batch_bo_changed) gen6_3DSTATE_VERTEX_BUFFERS(r->builder, vec->ve, &vec->vb); /* 3DSTATE_VERTEX_ELEMENTS */ if (DIRTY(VE)) gen6_3DSTATE_VERTEX_ELEMENTS(r->builder, vec->ve); }
void STATE_APIENTRY crStateFrontFace (PCRStateTracker pState, GLenum mode) { CRContext *g = GetCurrentContext(pState); CRPolygonState *p = &(g->polygon); CRStateBits *sb = GetCurrentBits(pState); CRPolygonBits *pb = &(sb->polygon); if (g->current.inBeginEnd) { crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION, "glFrontFace called in begin/end"); return; } FLUSH(); if (mode != GL_CW && mode != GL_CCW) { crStateError(pState, __LINE__, __FILE__, GL_INVALID_ENUM, "glFrontFace called with bogus mode: 0x%x", mode); return; } p->frontFace = mode; DIRTY(pb->mode, g->neg_bitid); DIRTY(pb->dirty, g->neg_bitid); }
void gen6_draw_clip(struct ilo_render *r, const struct ilo_state_vector *vec, struct ilo_render_draw_session *session) { /* 3DSTATE_CLIP */ if (DIRTY(RASTERIZER) || DIRTY(FS) || DIRTY(VIEWPORT) || DIRTY(FB)) { bool enable_guardband = true; unsigned i; /* * We do not do 2D clipping yet. Guard band test should only be enabled * when the viewport is larger than the framebuffer. */ for (i = 0; i < vec->viewport.count; i++) { const struct ilo_viewport_cso *vp = &vec->viewport.cso[i]; if (vp->min_x > 0.0f || vp->max_x < vec->fb.state.width || vp->min_y > 0.0f || vp->max_y < vec->fb.state.height) { enable_guardband = false; break; } } gen6_3DSTATE_CLIP(r->builder, vec->rasterizer, vec->fs, enable_guardband, 1); } }
void STATE_APIENTRY crStateClearAccum (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { CRContext *g = GetCurrentContext(); CRBufferState *b = &(g->buffer); CRStateBits *sp = GetCurrentBits(); CRBufferBits *bb = &(sp->buffer); if (g->current.inBeginEnd) { crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glClearAccum called in begin/end"); return; } FLUSH(); if (red < -1.0f) red = 0.0f; if (red > 1.0f) red = 1.0f; if (green < -1.0f) green = 0.0f; if (green > 1.0f) green = 1.0f; if (blue < -1.0f) blue = 0.0f; if (blue > 1.0f) blue = 1.0f; if (alpha < -1.0f) alpha = 0.0f; if (alpha > 1.0f) alpha = 1.0f; b->accumClearValue.r = red; b->accumClearValue.g = green; b->accumClearValue.b = blue; b->accumClearValue.a = alpha; DIRTY(bb->dirty, g->neg_bitid); DIRTY(bb->clearAccum, g->neg_bitid); }
static void gen6_draw_wm(struct ilo_render *r, const struct ilo_state_vector *vec, struct ilo_render_draw_session *session) { /* 3DSTATE_CONSTANT_PS */ if (session->pcb_fs_changed) { gen6_3DSTATE_CONSTANT_PS(r->builder, &r->state.wm.PUSH_CONSTANT_BUFFER, &r->state.wm.PUSH_CONSTANT_BUFFER_size, 1); } /* 3DSTATE_WM */ if (DIRTY(FS) || DIRTY(BLEND) || DIRTY(DSA) || DIRTY(RASTERIZER) || r->instruction_bo_changed) { const bool dual_blend = vec->blend->dual_blend; const bool cc_may_kill = (vec->dsa->dw_alpha || vec->blend->alpha_to_coverage); if (ilo_dev_gen(r->dev) == ILO_GEN(6) && r->hw_ctx_changed) gen6_wa_pre_3dstate_wm_max_threads(r); gen6_3DSTATE_WM(r->builder, vec->fs, vec->rasterizer, dual_blend, cc_may_kill); } }
static void gen6_draw_wm_multisample(struct ilo_render *r, const struct ilo_state_vector *vec, struct ilo_render_draw_session *session) { /* 3DSTATE_MULTISAMPLE and 3DSTATE_SAMPLE_MASK */ if (DIRTY(SAMPLE_MASK) || DIRTY(FB)) { const uint32_t *packed_sample_pos; packed_sample_pos = (vec->fb.num_samples > 1) ? &r->packed_sample_position_4x : &r->packed_sample_position_1x; if (ilo_dev_gen(r->dev) == ILO_GEN(6)) { gen6_wa_pre_non_pipelined(r); gen6_wa_pre_3dstate_multisample(r); } gen6_3DSTATE_MULTISAMPLE(r->builder, vec->fb.num_samples, packed_sample_pos, vec->rasterizer->state.half_pixel_center); gen6_3DSTATE_SAMPLE_MASK(r->builder, (vec->fb.num_samples > 1) ? vec->sample_mask : 0x1); } }
void gen6_draw_wm_raster(struct ilo_render *r, const struct ilo_state_vector *vec, struct ilo_render_draw_session *session) { /* 3DSTATE_POLY_STIPPLE_PATTERN and 3DSTATE_POLY_STIPPLE_OFFSET */ if ((DIRTY(RASTERIZER) || DIRTY(POLY_STIPPLE)) && vec->rasterizer->state.poly_stipple_enable) { if (ilo_dev_gen(r->dev) == ILO_GEN(6)) gen6_wa_pre_non_pipelined(r); gen6_3DSTATE_POLY_STIPPLE_PATTERN(r->builder, &vec->poly_stipple); gen6_3DSTATE_POLY_STIPPLE_OFFSET(r->builder, 0, 0); } /* 3DSTATE_LINE_STIPPLE */ if (DIRTY(RASTERIZER) && vec->rasterizer->state.line_stipple_enable) { if (ilo_dev_gen(r->dev) == ILO_GEN(6)) gen6_wa_pre_non_pipelined(r); gen6_3DSTATE_LINE_STIPPLE(r->builder, vec->rasterizer->state.line_stipple_pattern, vec->rasterizer->state.line_stipple_factor + 1); } /* 3DSTATE_AA_LINE_PARAMETERS */ if (DIRTY(RASTERIZER) && vec->rasterizer->state.line_smooth) { if (ilo_dev_gen(r->dev) == ILO_GEN(6)) gen6_wa_pre_non_pipelined(r); gen6_3DSTATE_AA_LINE_PARAMETERS(r->builder); } }
void STATE_APIENTRY crStateCullFace(GLenum mode) { CRContext *g = GetCurrentContext(); CRPolygonState *p = &(g->polygon); CRStateBits *sb = GetCurrentBits(); CRPolygonBits *pb = &(sb->polygon); if (g->current.inBeginEnd) { crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glCullFace called in begin/end"); return; } FLUSH(); if (mode != GL_FRONT && mode != GL_BACK && mode != GL_FRONT_AND_BACK) { crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glCullFace called with bogus mode: 0x%x", mode); return; } p->cullFaceMode = mode; DIRTY(pb->mode, g->neg_bitid); DIRTY(pb->dirty, g->neg_bitid); }
void STATE_APIENTRY crStatePolygonStipple (const GLubyte *p) { CRContext *g = GetCurrentContext(); CRPolygonState *poly = &(g->polygon); CRStateBits *sb = GetCurrentBits(); CRPolygonBits *pb = &(sb->polygon); if (g->current.inBeginEnd) { crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glPolygonStipple called in begin/end"); return; } FLUSH(); if (!p) { crStateError(__LINE__, __FILE__, GL_NO_ERROR, "Void pointer passed to PolygonStipple"); return; } crMemcpy((char*)poly->stipple, (char*)p, 128); DIRTY(pb->dirty, g->neg_bitid); DIRTY(pb->stipple, g->neg_bitid); }
static void gen6_emit_draw_surface_view(struct ilo_render *r, const struct ilo_state_vector *vec, int shader_type, struct ilo_render_draw_session *session) { const struct ilo_view_state *view = &vec->view[shader_type]; const struct ilo_shader_state *sh; uint32_t *surface_state; int base, count, i; ILO_DEV_ASSERT(r->dev, 6, 7.5); switch (shader_type) { case PIPE_SHADER_VERTEX: if (!DIRTY(VS) && !DIRTY(VIEW_VS)) return; if (!vec->vs) return; sh = vec->vs; surface_state = r->state.vs.SURFACE_STATE; session->binding_table_vs_changed = true; break; case PIPE_SHADER_FRAGMENT: if (!DIRTY(FS) && !DIRTY(VIEW_FS)) return; if (!vec->fs) return; sh = vec->fs; surface_state = r->state.wm.SURFACE_STATE; session->binding_table_fs_changed = true; break; default: return; break; } base = ilo_shader_get_kernel_param(sh, ILO_KERNEL_SURFACE_TEX_BASE); count = ilo_shader_get_kernel_param(sh, ILO_KERNEL_SURFACE_TEX_COUNT); /* SURFACE_STATEs for sampler views */ surface_state += base; for (i = 0; i < count; i++) { if (i < view->count && view->states[i]) { const struct ilo_view_cso *cso = (const struct ilo_view_cso *) view->states[i]; surface_state[i] = gen6_SURFACE_STATE(r->builder, &cso->surface, false); } else { surface_state[i] = 0; } } }
static void gen6_emit_draw_surface_const(struct ilo_render *r, const struct ilo_state_vector *vec, int shader_type, struct ilo_render_draw_session *session) { const struct ilo_cbuf_state *cbuf = &vec->cbuf[shader_type]; const struct ilo_shader_state *sh; uint32_t *surface_state; int base, count, i; ILO_DEV_ASSERT(r->dev, 6, 7.5); switch (shader_type) { case PIPE_SHADER_VERTEX: if (!DIRTY(VS) && !DIRTY(CBUF)) return; if (!vec->vs) return; sh = vec->vs; surface_state = r->state.vs.SURFACE_STATE; session->binding_table_vs_changed = true; break; case PIPE_SHADER_FRAGMENT: if (!DIRTY(FS) && !DIRTY(CBUF)) return; if (!vec->fs) return; sh = vec->fs; surface_state = r->state.wm.SURFACE_STATE; session->binding_table_fs_changed = true; break; default: return; break; } base = ilo_shader_get_kernel_param(sh, ILO_KERNEL_SURFACE_CONST_BASE); count = ilo_shader_get_kernel_param(sh, ILO_KERNEL_SURFACE_CONST_COUNT); /* SURFACE_STATEs for constant buffers */ surface_state += base; for (i = 0; i < count; i++) { const struct ilo_cbuf_cso *cso = &cbuf->cso[i]; if (cso->resource) { surface_state[i] = gen6_SURFACE_STATE(r->builder, &cso->surface, false); } else { surface_state[i] = 0; } } }
void STATE_APIENTRY crStateBufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data) { CRContext *g = GetCurrentContext(); CRBufferObjectState *b = &g->bufferobject; CRBufferObject *obj; CRStateBits *sb = GetCurrentBits(); CRBufferObjectBits *bb = &sb->bufferobject; FLUSH(); if (g->current.inBeginEnd) { crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glBufferSubDataARB called in begin/end"); return; } obj = crStateGetBoundBufferObject(target, b); if (!obj) { crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glBufferSubDataARB(target)"); return; } if (obj->id == 0) { crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glBufferSubDataARB"); return; } if (obj->pointer) { crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glBufferSubDataARB(buffer is mapped)"); return; } if (size < 0 || offset < 0 || (unsigned int)offset + size > obj->size) { crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glBufferSubDataARB(bad offset and/or size)"); return; } if (b->retainBufferData && obj->data) { crMemcpy((char *) obj->data + offset, data, size); } DIRTY(bb->dirty, g->neg_bitid); DIRTY(obj->dirty, g->neg_bitid); /* grow dirty region */ if (offset + size > obj->dirtyStart + obj->dirtyLength) obj->dirtyLength = offset + size; if (offset < obj->dirtyStart) obj->dirtyStart = offset; }
static void gen6_draw_sf(struct ilo_render *r, const struct ilo_state_vector *vec, struct ilo_render_draw_session *session) { /* 3DSTATE_SF */ if (DIRTY(RASTERIZER) || DIRTY(FS) || DIRTY(FB)) { gen6_3DSTATE_SF(r->builder, vec->rasterizer, vec->fs, vec->fb.num_samples); } }
static void gen6_emit_draw_surface_so(struct ilo_render *r, const struct ilo_state_vector *vec, struct ilo_render_draw_session *session) { const struct ilo_shader_state *vs = vec->vs; const struct ilo_shader_state *gs = vec->gs; const struct ilo_so_state *so = &vec->so; const struct pipe_stream_output_info *so_info; uint32_t *surface_state; int base, count, i; ILO_DEV_ASSERT(r->dev, 6, 6); if (!DIRTY(VS) && !DIRTY(GS) && !DIRTY(SO)) return; if (gs) { so_info = ilo_shader_get_kernel_so_info(gs); base = ilo_shader_get_kernel_param(gs, ILO_KERNEL_GS_GEN6_SURFACE_SO_BASE); count = ilo_shader_get_kernel_param(gs, ILO_KERNEL_GS_GEN6_SURFACE_SO_COUNT); } else if (vs) { so_info = ilo_shader_get_kernel_so_info(vs); base = 0; count = ilo_shader_get_kernel_param(vs, ILO_KERNEL_VS_GEN6_SO_SURFACE_COUNT); } else { return; } session->binding_table_gs_changed = true; /* SURFACE_STATEs for stream output targets */ surface_state = &r->state.gs.SURFACE_STATE[base]; for (i = 0; i < count; i++) { if (so_info && i < so_info->num_outputs && so_info->output[i].output_buffer < so->count && so->states[so_info->output[i].output_buffer]) { const struct pipe_stream_output_target *so_target = so->states[so_info->output[i].output_buffer]; surface_state[i] = gen6_so_SURFACE_STATE(r->builder, so_target, so_info, i); } else { surface_state[i] = 0; } } }
static void gen8_draw_wm_multisample(struct ilo_render *r, const struct ilo_state_vector *vec, struct ilo_render_draw_session *session) { /* 3DSTATE_MULTISAMPLE and 3DSTATE_SAMPLE_MASK */ if (DIRTY(SAMPLE_MASK) || DIRTY(FB) || DIRTY(RASTERIZER)) { gen8_3DSTATE_MULTISAMPLE(r->builder, vec->fb.num_samples, vec->rasterizer->state.half_pixel_center); gen7_3DSTATE_SAMPLE_MASK(r->builder, (vec->fb.num_samples > 1) ? vec->sample_mask : 0x1, vec->fb.num_samples); } }
void gen6_draw_vs(struct ilo_render *r, const struct ilo_state_vector *vec, struct ilo_render_draw_session *session) { const bool emit_3dstate_vs = (DIRTY(VS) || r->instruction_bo_changed); const bool emit_3dstate_constant_vs = session->pcb_vs_changed; /* * the classic i965 does this in upload_vs_state(), citing a spec that I * cannot find */ if (emit_3dstate_vs && ilo_dev_gen(r->dev) == ILO_GEN(6)) gen6_wa_pre_non_pipelined(r); /* 3DSTATE_CONSTANT_VS */ if (emit_3dstate_constant_vs) { gen6_3DSTATE_CONSTANT_VS(r->builder, &r->state.vs.PUSH_CONSTANT_BUFFER, &r->state.vs.PUSH_CONSTANT_BUFFER_size, 1); } /* 3DSTATE_VS */ if (emit_3dstate_vs) gen6_3DSTATE_VS(r->builder, vec->vs); if (emit_3dstate_constant_vs && ilo_dev_gen(r->dev) == ILO_GEN(6)) gen6_wa_post_3dstate_constant_vs(r); }
static void gen6_emit_draw_dynamic_scissors(struct ilo_render *r, const struct ilo_state_vector *vec, struct ilo_render_draw_session *session) { ILO_DEV_ASSERT(r->dev, 6, 7.5); /* SCISSOR_RECT */ if (DIRTY(SCISSOR) || DIRTY(VIEWPORT)) { /* there should be as many scissors as there are viewports */ r->state.SCISSOR_RECT = gen6_SCISSOR_RECT(r->builder, &vec->scissor, vec->viewport.count); session->scissor_changed = true; } }
// ************************************************************************** // ************************************************************************** // output page table entry void outPTE(char* s, int pte) { int pte1, pte2; char flags[10]; // read pt pte1 = memory[pte]; pte2 = memory[pte+1]; // look at appropriate flags strcpy(flags, "-----"); if (DEFINED(pte1)) flags[0] = 'F'; if (DIRTY(pte1)) flags[1] = 'D'; if (REFERENCED(pte1)) flags[2] = 'R'; if (PINNED(pte1)) flags[3] = 'P'; if (PAGED(pte2)) flags[4] = 'S'; // output pte line if(DEFINED(pte1) || DEFINED(pte2)) printf("\n%s x%04x = %04x %04x %s", s, pte, pte1, pte2, flags); if (DEFINED(pte1) || DEFINED(pte2)) printf(" Frame=%d", FRAME(pte1)); if (DEFINED(pte2)) printf(" Page=%d", SWAPPAGE(pte2)); return; } // end outPTE
void swapOutFrame(int entry1Index) { // clear the definition bit in entry 1 probably just set entry 1 to 0 int entry1, entry2; entry1 = memory[entry1Index]; entry2 = memory[entry1Index + 1]; // if dirty bit is not set and swap exists we are done if (DIRTY(entry1) && PAGED(entry2)) { DEBUG_STATEMENT(DEBUG_MMU,"\nDirty copy of swap write to old page"); // if swap exits swap access page with old write accessPage(SWAPPAGE(entry2), FRAME(entry1), PAGE_OLD_WRITE); } else if (!PAGED(entry2)) { DEBUG_STATEMENT(DEBUG_MMU,"\nNo copy in swap write to new swap"); // if swap doesn't exist then we need to write out to an new write memory[entry1Index + 1] = entry2 = SET_PAGED(nextPage); accessPage(nextPage, FRAME(entry1), PAGE_NEW_WRITE); } if (DEBUG_MMU) { outPTE("\nSwapped Entry - (Pre-clear) ", entry1Index); } memory[entry1Index] = 0; if (DEBUG_MMU) { outPTE("Swapped Entry - ", entry1Index); } return; }
void STATE_APIENTRY crStatePopClientAttrib( void ) { CRContext *g = GetCurrentContext(); CRClientState *c = &(g->client); CRStateBits *sb = GetCurrentBits(); CRClientBits *cb = &(sb->client); CRbitvalue mask; if (g->current.inBeginEnd) { crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glPopClientAttrib called in Begin/End"); return; } if (c->attribStackDepth == 0) { crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopClientAttrib called with an empty stack!" ); return; } FLUSH(); mask = c->pushMaskStack[--c->attribStackDepth]; if (mask & GL_CLIENT_PIXEL_STORE_BIT) { if (c->pixelStoreStackDepth == 0) { crError("bug in glPopClientAttrib (pixel store) "); return; } c->pixelStoreStackDepth--; c->pack = c->pixelPackStoreStack[c->pixelStoreStackDepth]; c->unpack = c->pixelUnpackStoreStack[c->pixelStoreStackDepth]; DIRTY(cb->pack, g->neg_bitid); } if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) { if (c->vertexArrayStackDepth == 0) { crError("bug in glPopClientAttrib (vertex array) "); return; } c->vertexArrayStackDepth--; c->array = c->vertexArrayStack[c->vertexArrayStackDepth]; DIRTY(cb->clientPointer, g->neg_bitid); } DIRTY(cb->dirty, g->neg_bitid); }
GLboolean STATE_APIENTRY crStateUnmapBufferARB(GLenum target) { CRContext *g = GetCurrentContext(); CRBufferObjectState *b = &g->bufferobject; CRBufferObject *obj; CRStateBits *sb = GetCurrentBits(); CRBufferObjectBits *bb = &sb->bufferobject; FLUSH(); if (g->current.inBeginEnd) { crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glUnmapBufferARB called in begin/end"); return GL_FALSE; } obj = crStateGetBoundBufferObject(target, b); if (!obj) { crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glUnmapBufferARB(target)"); return GL_FALSE; } if (obj->id == 0) { crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glUnmapBufferARB"); return GL_FALSE; } if (!obj->pointer) { crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glUnmapBufferARB"); return GL_FALSE; } obj->pointer = NULL; if (obj->access != GL_READ_ONLY_ARB) { /* the data was most likely modified */ DIRTY(bb->dirty, g->neg_bitid); DIRTY(obj->dirty, g->neg_bitid); obj->dirtyStart = 0; obj->dirtyLength = obj->size; } return GL_TRUE; }
void STATE_APIENTRY crStateClearIndex (GLfloat c) { CRContext *g = GetCurrentContext(); CRBufferState *b = &(g->buffer); CRStateBits *sp = GetCurrentBits(); CRBufferBits *bb = &(sp->buffer); if (g->current.inBeginEnd) { crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glClearIndex called in begin/end"); return; } b->indexClearValue = c; DIRTY(bb->dirty, g->neg_bitid); DIRTY(bb->clearIndex, g->neg_bitid); }
static void gen6_emit_draw_dynamic_cc(struct ilo_render *r, const struct ilo_state_vector *vec, struct ilo_render_draw_session *session) { ILO_DEV_ASSERT(r->dev, 6, 7.5); /* BLEND_STATE */ if (DIRTY(BLEND) || DIRTY(FB) || DIRTY(DSA)) { r->state.BLEND_STATE = gen6_BLEND_STATE(r->builder, vec->blend, &vec->fb, vec->dsa); session->blend_changed = true; } /* COLOR_CALC_STATE */ if (DIRTY(DSA) || DIRTY(STENCIL_REF) || DIRTY(BLEND_COLOR)) { r->state.COLOR_CALC_STATE = gen6_COLOR_CALC_STATE(r->builder, &vec->stencil_ref, vec->dsa->alpha_ref, &vec->blend_color); session->cc_changed = true; } /* DEPTH_STENCIL_STATE */ if (DIRTY(DSA)) { r->state.DEPTH_STENCIL_STATE = gen6_DEPTH_STENCIL_STATE(r->builder, vec->dsa); session->dsa_changed = true; } }