mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-25 02:40:46 +02:00
mesa: replace VP/FP/ATIfs _Enabled flags with helper functions
These are only used in the GL compatibility profile. Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
parent
585c5cf8a5
commit
68a0e15f44
24 changed files with 85 additions and 76 deletions
|
|
@ -2350,7 +2350,7 @@ _mesa_meta_Bitmap(struct gl_context *ctx,
|
|||
* Check if swrast fallback is needed.
|
||||
*/
|
||||
if (ctx->_ImageTransferState ||
|
||||
ctx->FragmentProgram._Enabled ||
|
||||
_mesa_arb_fragment_program_enabled(ctx) ||
|
||||
ctx->Fog.Enabled ||
|
||||
ctx->Texture._MaxEnabledTexImageUnit != -1 ||
|
||||
width > tex->MaxSize ||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ intel_check_blit_fragment_ops(struct gl_context * ctx, bool src_alpha_is_one)
|
|||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
if (ctx->FragmentProgram._Enabled) {
|
||||
if (_mesa_arb_fragment_program_enabled(ctx)) {
|
||||
DBG("fallback due to fragment program\n");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ do_blit_copypixels(struct gl_context * ctx,
|
|||
|
||||
if (ctx->Fog.Enabled ||
|
||||
ctx->Texture._MaxEnabledTexImageUnit != -1 ||
|
||||
ctx->FragmentProgram._Enabled) {
|
||||
_mesa_arb_fragment_program_enabled(ctx)) {
|
||||
perf_debug("glCopyPixels(): Unsupported fragment shader state\n");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ intel_check_blit_fragment_ops(struct gl_context * ctx, bool src_alpha_is_one)
|
|||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
if (ctx->FragmentProgram._Enabled) {
|
||||
if (_mesa_arb_fragment_program_enabled(ctx)) {
|
||||
DBG("fallback due to fragment program\n");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ do_blit_copypixels(struct gl_context * ctx,
|
|||
|
||||
if (ctx->Fog.Enabled ||
|
||||
ctx->Texture._MaxEnabledTexImageUnit != -1 ||
|
||||
ctx->FragmentProgram._Enabled) {
|
||||
_mesa_arb_fragment_program_enabled(ctx)) {
|
||||
perf_debug("glCopyPixels(): Unsupported fragment shader state\n");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "main/mtypes.h"
|
||||
#include "main/imports.h"
|
||||
#include "main/macros.h"
|
||||
#include "main/state.h"
|
||||
|
||||
#include "swrast_setup/swrast_setup.h"
|
||||
#include "math/m_translate.h"
|
||||
|
|
@ -114,7 +115,7 @@ void r200EmitArrays( struct gl_context *ctx, GLubyte *vimap_rev )
|
|||
/* special handling to fix up fog. Will get us into trouble with vbos...*/
|
||||
assert(attrib == VERT_ATTRIB_FOG);
|
||||
if (!rmesa->radeon.tcl.aos[i].bo) {
|
||||
if (ctx->VertexProgram._Enabled)
|
||||
if (_mesa_arb_vertex_program_enabled(ctx))
|
||||
rcommon_emit_vector( ctx,
|
||||
&(rmesa->radeon.tcl.aos[nr]),
|
||||
(char *)VB->AttribPtr[attrib]->data,
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "main/light.h"
|
||||
#include "main/framebuffer.h"
|
||||
#include "main/fbobject.h"
|
||||
#include "main/state.h"
|
||||
#include "main/stencil.h"
|
||||
#include "main/viewport.h"
|
||||
|
||||
|
|
@ -2265,7 +2266,7 @@ GLboolean r200ValidateState( struct gl_context *ctx )
|
|||
_NEW_MODELVIEW|_NEW_PROJECTION|_NEW_TRANSFORM|
|
||||
_NEW_LIGHT|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX|
|
||||
_NEW_FOG|_NEW_POINT|_NEW_TRACK_MATRIX)) {
|
||||
if (ctx->VertexProgram._Enabled) {
|
||||
if (_mesa_arb_vertex_program_enabled(ctx)) {
|
||||
r200SetupVertexProg( ctx );
|
||||
}
|
||||
else TCL_FALLBACK(ctx, R200_TCL_FALLBACK_VERTEX_PROGRAM, 0);
|
||||
|
|
@ -2328,7 +2329,8 @@ static void r200WrapRunPipeline( struct gl_context *ctx )
|
|||
if (!r200ValidateState( ctx ))
|
||||
FALLBACK(rmesa, RADEON_FALLBACK_TEXTURE, GL_TRUE);
|
||||
|
||||
has_material = !ctx->VertexProgram._Enabled && ctx->Light.Enabled && check_material( ctx );
|
||||
has_material = !_mesa_arb_vertex_program_enabled(ctx) &&
|
||||
ctx->Light.Enabled && check_material( ctx );
|
||||
|
||||
if (has_material) {
|
||||
TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_TRUE );
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "main/imports.h"
|
||||
#include "main/enums.h"
|
||||
#include "main/api_arrayelt.h"
|
||||
#include "main/state.h"
|
||||
|
||||
#include "swrast/swrast.h"
|
||||
#include "vbo/vbo.h"
|
||||
|
|
@ -229,7 +230,7 @@ static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom) \
|
|||
static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom) \
|
||||
{ \
|
||||
r200ContextPtr rmesa = R200_CONTEXT(ctx); \
|
||||
return (!rmesa->radeon.TclFallback && !ctx->VertexProgram._Enabled && (FLAG)) ? atom->cmd_size + (ADD) : 0; \
|
||||
return (!rmesa->radeon.TclFallback && !_mesa_arb_vertex_program_enabled(ctx) && (FLAG)) ? atom->cmd_size + (ADD) : 0; \
|
||||
}
|
||||
|
||||
#define TCL_OR_VP_CHECK( NM, FLAG, ADD ) \
|
||||
|
|
@ -244,18 +245,18 @@ static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom )
|
|||
{ \
|
||||
r200ContextPtr rmesa = R200_CONTEXT(ctx); \
|
||||
(void) atom; \
|
||||
return (!rmesa->radeon.TclFallback && ctx->VertexProgram._Enabled && (FLAG)) ? atom->cmd_size + (ADD) : 0; \
|
||||
return (!rmesa->radeon.TclFallback && _mesa_arb_vertex_program_enabled(ctx) && (FLAG)) ? atom->cmd_size + (ADD) : 0; \
|
||||
}
|
||||
|
||||
CHECK( always, GL_TRUE, 0 )
|
||||
CHECK( always_add4, GL_TRUE, 4 )
|
||||
CHECK( never, GL_FALSE, 0 )
|
||||
CHECK( tex_any, ctx->Texture._MaxEnabledTexImageUnit != -1, 0 )
|
||||
CHECK( tf, (ctx->Texture._MaxEnabledTexImageUnit != -1 && !ctx->ATIFragmentShader._Enabled), 0 );
|
||||
CHECK( pix_zero, !ctx->ATIFragmentShader._Enabled, 0 )
|
||||
CHECK( texenv, (rmesa->state.envneeded & (1 << (atom->idx)) && !ctx->ATIFragmentShader._Enabled), 0 )
|
||||
CHECK( afs_pass1, (ctx->ATIFragmentShader._Enabled && (ctx->ATIFragmentShader.Current->NumPasses > 1)), 0 )
|
||||
CHECK( afs, ctx->ATIFragmentShader._Enabled, 0 )
|
||||
CHECK( tf, (ctx->Texture._MaxEnabledTexImageUnit != -1 && !_mesa_ati_fragment_shader_enabled(ctx)), 0 );
|
||||
CHECK( pix_zero, !_mesa_ati_fragment_shader_enabled(ctx), 0 )
|
||||
CHECK( texenv, (rmesa->state.envneeded & (1 << (atom->idx)) && !_mesa_ati_fragment_shader_enabled(ctx)), 0 )
|
||||
CHECK( afs_pass1, (_mesa_ati_fragment_shader_enabled(ctx) && (ctx->ATIFragmentShader.Current->NumPasses > 1)), 0 )
|
||||
CHECK( afs, _mesa_ati_fragment_shader_enabled(ctx), 0 )
|
||||
CHECK( tex_cube, rmesa->state.texture.unit[atom->idx].unitneeded & TEXTURE_CUBE_BIT, 3 + 3*5 - CUBE_STATE_SIZE )
|
||||
CHECK( tex_cube_cs, rmesa->state.texture.unit[atom->idx].unitneeded & TEXTURE_CUBE_BIT, 2 + 4*5 - CUBE_STATE_SIZE )
|
||||
TCL_CHECK( tcl_fog_add4, ctx->Fog.Enabled, 4 )
|
||||
|
|
|
|||
|
|
@ -383,7 +383,7 @@ static GLboolean r200_run_tcl_render( struct gl_context *ctx,
|
|||
if (!r200ValidateState( ctx ))
|
||||
return GL_TRUE; /* fallback to sw t&l */
|
||||
|
||||
if (!ctx->VertexProgram._Enabled) {
|
||||
if (!_mesa_arb_vertex_program_enabled(ctx)) {
|
||||
/* NOTE: inputs != tnl->render_inputs - these are the untransformed
|
||||
* inputs.
|
||||
*/
|
||||
|
|
@ -553,7 +553,7 @@ static void transition_to_hwtnl( struct gl_context *ctx )
|
|||
rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] |= R200_VAP_TCL_ENABLE;
|
||||
rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] &= ~R200_VAP_FORCE_W_TO_ONE;
|
||||
|
||||
if (ctx->VertexProgram._Enabled) {
|
||||
if (_mesa_arb_vertex_program_enabled(ctx)) {
|
||||
rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] |= R200_VAP_PROG_VTX_SHADER_ENABLE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "main/imports.h"
|
||||
#include "main/context.h"
|
||||
#include "main/macros.h"
|
||||
#include "main/state.h"
|
||||
#include "main/teximage.h"
|
||||
#include "main/texobj.h"
|
||||
#include "main/enums.h"
|
||||
|
|
@ -1480,7 +1481,7 @@ void r200UpdateTextureState( struct gl_context *ctx )
|
|||
atoms. */
|
||||
R200_NEWPRIM( rmesa );
|
||||
|
||||
if (ctx->ATIFragmentShader._Enabled) {
|
||||
if (_mesa_ati_fragment_shader_enabled(ctx)) {
|
||||
GLuint i;
|
||||
for (i = 0; i < R200_MAX_TEXTURE_UNITS; i++) {
|
||||
if (ctx->Texture.Unit[i]._Current)
|
||||
|
|
@ -1502,7 +1503,7 @@ void r200UpdateTextureState( struct gl_context *ctx )
|
|||
r200UpdateTextureUnit( ctx, 5 ));
|
||||
}
|
||||
|
||||
if (ok && ctx->ATIFragmentShader._Enabled) {
|
||||
if (ok && _mesa_ati_fragment_shader_enabled(ctx)) {
|
||||
r200UpdateFragmentShader(ctx);
|
||||
}
|
||||
|
||||
|
|
@ -1528,7 +1529,7 @@ void r200UpdateTextureState( struct gl_context *ctx )
|
|||
rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK;
|
||||
rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] |= R200_TXFORMAT_LOOKUP_DISABLE;
|
||||
}
|
||||
else if (!ctx->ATIFragmentShader._Enabled) {
|
||||
else if (!_mesa_ati_fragment_shader_enabled(ctx)) {
|
||||
if ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_1_ENABLE) &&
|
||||
(rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] & R200_TXFORMAT_LOOKUP_DISABLE)) {
|
||||
R200_STATECHANGE(rmesa, tex[1]);
|
||||
|
|
|
|||
|
|
@ -133,15 +133,17 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
|
|||
/* Any shader stages that are not supplied by the GLSL shader and have
|
||||
* assembly shaders enabled must now be validated.
|
||||
*/
|
||||
if (!ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]
|
||||
&& ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) {
|
||||
if (!ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX] &&
|
||||
ctx->VertexProgram.Enabled &&
|
||||
!_mesa_arb_vertex_program_enabled(ctx)) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"%s(vertex program not valid)", where);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (!ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT]) {
|
||||
if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) {
|
||||
if (ctx->FragmentProgram.Enabled &&
|
||||
!_mesa_arb_fragment_program_enabled(ctx)) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"%s(fragment program not valid)", where);
|
||||
return GL_FALSE;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "main/macros.h"
|
||||
#include "main/samplerobj.h"
|
||||
#include "main/shaderobj.h"
|
||||
#include "main/state.h"
|
||||
#include "main/texenvprogram.h"
|
||||
#include "main/texobj.h"
|
||||
#include "main/uniforms.h"
|
||||
|
|
@ -172,7 +173,7 @@ static GLbitfield filter_fp_input_mask( GLbitfield fp_inputs,
|
|||
/* _NEW_PROGRAM */
|
||||
const GLboolean vertexShader =
|
||||
ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX] != NULL;
|
||||
const GLboolean vertexProgram = ctx->VertexProgram._Enabled;
|
||||
const GLboolean vertexProgram = _mesa_arb_vertex_program_enabled(ctx);
|
||||
|
||||
if (!(vertexProgram || vertexShader)) {
|
||||
/* Fixed function vertex logic */
|
||||
|
|
|
|||
|
|
@ -2251,7 +2251,6 @@ struct gl_program_state
|
|||
struct gl_vertex_program_state
|
||||
{
|
||||
GLboolean Enabled; /**< User-set GL_VERTEX_PROGRAM_ARB/NV flag */
|
||||
GLboolean _Enabled; /**< Enabled and _valid_ user program? */
|
||||
GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */
|
||||
GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
|
||||
struct gl_program *Current; /**< User-bound vertex program */
|
||||
|
|
@ -2315,7 +2314,6 @@ struct gl_geometry_program_state
|
|||
struct gl_fragment_program_state
|
||||
{
|
||||
GLboolean Enabled; /**< User-set fragment program enable flag */
|
||||
GLboolean _Enabled; /**< Enabled and _valid_ user program? */
|
||||
struct gl_program *Current; /**< User-bound fragment program */
|
||||
|
||||
/** Currently enabled and valid fragment program (including internal
|
||||
|
|
@ -2384,7 +2382,6 @@ struct ati_fragment_shader
|
|||
struct gl_ati_fragment_shader_state
|
||||
{
|
||||
GLboolean Enabled;
|
||||
GLboolean _Enabled; /**< enabled and valid shader? */
|
||||
GLboolean Compiling;
|
||||
GLfloat GlobalConstants[8][4];
|
||||
struct ati_fragment_shader *Current;
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ compute_texgen(struct gl_context *ctx, const GLfloat vObj[4], const GLfloat vEye
|
|||
void
|
||||
_mesa_RasterPos(struct gl_context *ctx, const GLfloat vObj[4])
|
||||
{
|
||||
if (ctx->VertexProgram._Enabled) {
|
||||
if (_mesa_arb_vertex_program_enabled(ctx)) {
|
||||
/* XXX implement this */
|
||||
_mesa_problem(ctx, "Vertex programs not implemented for glRasterPos");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -56,29 +56,6 @@
|
|||
#include "blend.h"
|
||||
|
||||
|
||||
/**
|
||||
* Update the following fields:
|
||||
* ctx->VertexProgram._Enabled
|
||||
* ctx->FragmentProgram._Enabled
|
||||
* ctx->ATIFragmentShader._Enabled
|
||||
* This needs to be done before texture state validation.
|
||||
*/
|
||||
static void
|
||||
update_program_enables(struct gl_context *ctx)
|
||||
{
|
||||
/* These _Enabled flags indicate if the user-defined ARB/NV vertex/fragment
|
||||
* program is enabled AND valid. Similarly for ATI fragment shaders.
|
||||
* GLSL shaders not relevant here.
|
||||
*/
|
||||
ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled
|
||||
&& ctx->VertexProgram.Current->arb.Instructions;
|
||||
ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled
|
||||
&& ctx->FragmentProgram.Current->arb.Instructions;
|
||||
ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled
|
||||
&& ctx->ATIFragmentShader.Current->Instructions[0];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the ctx->*Program._Current pointers to point to the
|
||||
* current/active programs.
|
||||
|
|
@ -138,14 +115,14 @@ update_program(struct gl_context *ctx)
|
|||
_mesa_reference_program(ctx, &ctx->FragmentProgram._TexEnvProgram,
|
||||
NULL);
|
||||
}
|
||||
else if (ctx->FragmentProgram._Enabled) {
|
||||
else if (_mesa_arb_fragment_program_enabled(ctx)) {
|
||||
/* Use user-defined fragment program */
|
||||
_mesa_reference_program(ctx, &ctx->FragmentProgram._Current,
|
||||
ctx->FragmentProgram.Current);
|
||||
_mesa_reference_program(ctx, &ctx->FragmentProgram._TexEnvProgram,
|
||||
NULL);
|
||||
}
|
||||
else if (ctx->ATIFragmentShader._Enabled &&
|
||||
else if (_mesa_ati_fragment_shader_enabled(ctx) &&
|
||||
ctx->ATIFragmentShader.Current->Program) {
|
||||
/* Use the enabled ATI fragment shader's associated program */
|
||||
_mesa_reference_program(ctx, &ctx->FragmentProgram._Current,
|
||||
|
|
@ -203,7 +180,7 @@ update_program(struct gl_context *ctx)
|
|||
/* Use GLSL vertex shader */
|
||||
_mesa_reference_program(ctx, &ctx->VertexProgram._Current, vsProg);
|
||||
}
|
||||
else if (ctx->VertexProgram._Enabled) {
|
||||
else if (_mesa_arb_vertex_program_enabled(ctx)) {
|
||||
/* Use user-defined vertex program */
|
||||
_mesa_reference_program(ctx, &ctx->VertexProgram._Current,
|
||||
ctx->VertexProgram.Current);
|
||||
|
|
@ -320,10 +297,6 @@ _mesa_update_state_locked( struct gl_context *ctx )
|
|||
/*
|
||||
* Now update derived state info
|
||||
*/
|
||||
|
||||
if (new_state & prog_flags)
|
||||
update_program_enables( ctx );
|
||||
|
||||
if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
|
||||
_mesa_update_modelview_project( ctx, new_state );
|
||||
|
||||
|
|
|
|||
|
|
@ -72,12 +72,19 @@ _mesa_need_secondary_color(const struct gl_context *ctx)
|
|||
return GL_FALSE;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
_mesa_arb_vertex_program_enabled(const struct gl_context *ctx)
|
||||
{
|
||||
return ctx->VertexProgram.Enabled &&
|
||||
ctx->VertexProgram.Current->arb.Instructions;
|
||||
}
|
||||
|
||||
/** Compute two sided lighting state for fixed function or programs. */
|
||||
static inline bool
|
||||
_mesa_vertex_program_two_side_enabled(const struct gl_context *ctx)
|
||||
{
|
||||
if (ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX] ||
|
||||
ctx->VertexProgram._Enabled)
|
||||
_mesa_arb_vertex_program_enabled(ctx))
|
||||
return ctx->VertexProgram.TwoSideEnabled;
|
||||
|
||||
return ctx->Light.Enabled && ctx->Light.Model.TwoSide;
|
||||
|
|
@ -93,4 +100,18 @@ _mesa_polygon_get_front_bit(const struct gl_context *ctx)
|
|||
return ctx->Polygon.FrontFace == GL_CCW;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
_mesa_arb_fragment_program_enabled(const struct gl_context *ctx)
|
||||
{
|
||||
return ctx->FragmentProgram.Enabled &&
|
||||
ctx->FragmentProgram.Current->arb.Instructions;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
_mesa_ati_fragment_shader_enabled(const struct gl_context *ctx)
|
||||
{
|
||||
return ctx->ATIFragmentShader.Enabled &&
|
||||
ctx->ATIFragmentShader.Current->Instructions[0];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "teximage.h"
|
||||
#include "texstate.h"
|
||||
#include "mtypes.h"
|
||||
#include "state.h"
|
||||
#include "util/bitscan.h"
|
||||
#include "util/bitset.h"
|
||||
|
||||
|
|
@ -847,7 +848,8 @@ _mesa_update_texture_state(struct gl_context *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
if (prog[MESA_SHADER_FRAGMENT] == NULL && ctx->FragmentProgram._Enabled) {
|
||||
if (prog[MESA_SHADER_FRAGMENT] == NULL &&
|
||||
_mesa_arb_fragment_program_enabled(ctx)) {
|
||||
prog[MESA_SHADER_FRAGMENT] = ctx->FragmentProgram.Current;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#include "main/pack.h"
|
||||
#include "main/pbo.h"
|
||||
#include "main/readpix.h"
|
||||
#include "main/state.h"
|
||||
#include "main/texformat.h"
|
||||
#include "main/teximage.h"
|
||||
#include "main/texstore.h"
|
||||
|
|
@ -1319,7 +1320,7 @@ blit_copy_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
|||
!ctx->FragmentProgram.Enabled &&
|
||||
!ctx->VertexProgram.Enabled &&
|
||||
!ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT] &&
|
||||
!ctx->ATIFragmentShader._Enabled &&
|
||||
!_mesa_ati_fragment_shader_enabled(ctx) &&
|
||||
ctx->DrawBuffer->_NumColorDrawBuffers == 1 &&
|
||||
!ctx->Query.CondRenderQuery &&
|
||||
!ctx->Query.CurrentOcclusionObject) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "main/bufferobj.h"
|
||||
#include "main/mtypes.h"
|
||||
#include "main/samplerobj.h"
|
||||
#include "main/state.h"
|
||||
#include "main/stencil.h"
|
||||
#include "main/teximage.h"
|
||||
#include "program/prog_parameter.h"
|
||||
|
|
@ -109,7 +110,7 @@ _swrast_update_rasterflags( struct gl_context *ctx )
|
|||
rasterMask |= FRAGPROG_BIT;
|
||||
}
|
||||
|
||||
if (ctx->ATIFragmentShader._Enabled) {
|
||||
if (_mesa_ati_fragment_shader_enabled(ctx)) {
|
||||
rasterMask |= ATIFRAGSHADER_BIT;
|
||||
}
|
||||
|
||||
|
|
@ -289,7 +290,7 @@ _swrast_update_specular_vertex_add(struct gl_context *ctx)
|
|||
swrast->SpecularVertexAdd = (separateSpecular
|
||||
&& ctx->Texture._MaxEnabledTexImageUnit == -1
|
||||
&& !_swrast_use_fragment_program(ctx)
|
||||
&& !ctx->ATIFragmentShader._Enabled);
|
||||
&& !_mesa_ati_fragment_shader_enabled(ctx));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -504,7 +505,7 @@ _swrast_update_active_attribs(struct gl_context *ctx)
|
|||
attribsMask = ctx->FragmentProgram._Current->info.inputs_read;
|
||||
attribsMask &= ~VARYING_BIT_POS; /* WPOS is always handled specially */
|
||||
}
|
||||
else if (ctx->ATIFragmentShader._Enabled) {
|
||||
else if (_mesa_ati_fragment_shader_enabled(ctx)) {
|
||||
attribsMask = VARYING_BIT_COL0 | VARYING_BIT_COL1 |
|
||||
VARYING_BIT_FOGC | VARYING_BITS_TEX_ANY;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "main/imports.h"
|
||||
#include "main/image.h"
|
||||
#include "main/samplerobj.h"
|
||||
#include "main/state.h"
|
||||
#include "main/stencil.h"
|
||||
#include "main/teximage.h"
|
||||
|
||||
|
|
@ -143,7 +144,7 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span)
|
|||
const GLuint attr = VARYING_SLOT_TEX0 + i;
|
||||
const GLfloat *tc = ctx->Current.RasterTexCoords[i];
|
||||
if (_swrast_use_fragment_program(ctx) ||
|
||||
ctx->ATIFragmentShader._Enabled) {
|
||||
_mesa_ati_fragment_shader_enabled(ctx)) {
|
||||
COPY_4V(span->attrStart[attr], tc);
|
||||
}
|
||||
else if (tc[3] > 0.0F) {
|
||||
|
|
@ -524,7 +525,7 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span)
|
|||
if (needLambda) {
|
||||
GLuint i;
|
||||
if (_swrast_use_fragment_program(ctx)
|
||||
|| ctx->ATIFragmentShader._Enabled) {
|
||||
|| _mesa_ati_fragment_shader_enabled(ctx)) {
|
||||
/* do perspective correction but don't divide s, t, r by q */
|
||||
const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3];
|
||||
GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx;
|
||||
|
|
@ -565,7 +566,7 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span)
|
|||
else {
|
||||
GLuint i;
|
||||
if (_swrast_use_fragment_program(ctx) ||
|
||||
ctx->ATIFragmentShader._Enabled) {
|
||||
_mesa_ati_fragment_shader_enabled(ctx)) {
|
||||
/* do perspective correction but don't divide s, t, r by q */
|
||||
const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3];
|
||||
GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx;
|
||||
|
|
@ -977,7 +978,7 @@ static inline void
|
|||
shade_texture_span(struct gl_context *ctx, SWspan *span)
|
||||
{
|
||||
if (_swrast_use_fragment_program(ctx) ||
|
||||
ctx->ATIFragmentShader._Enabled) {
|
||||
_mesa_ati_fragment_shader_enabled(ctx)) {
|
||||
/* programmable shading */
|
||||
if (span->primitive == GL_BITMAP && span->array->ChanType != GL_FLOAT) {
|
||||
convert_color_type(span, span->array->ChanType, GL_FLOAT, 0);
|
||||
|
|
@ -1009,7 +1010,7 @@ shade_texture_span(struct gl_context *ctx, SWspan *span)
|
|||
_swrast_exec_fragment_program(ctx, span);
|
||||
}
|
||||
else {
|
||||
assert(ctx->ATIFragmentShader._Enabled);
|
||||
assert(_mesa_ati_fragment_shader_enabled(ctx));
|
||||
_swrast_exec_fragment_shader(ctx, span);
|
||||
}
|
||||
}
|
||||
|
|
@ -1139,7 +1140,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
|
|||
const GLenum origChanType = span->array->ChanType;
|
||||
void * const origRgba = span->array->rgba;
|
||||
const GLboolean shader = (_swrast_use_fragment_program(ctx)
|
||||
|| ctx->ATIFragmentShader._Enabled);
|
||||
|| _mesa_ati_fragment_shader_enabled(ctx));
|
||||
const GLboolean shaderOrTexture = shader || ctx->Texture._EnabledCoordUnits;
|
||||
struct gl_framebuffer *fb = ctx->DrawBuffer;
|
||||
|
||||
|
|
|
|||
|
|
@ -1042,7 +1042,7 @@ _swrast_choose_triangle( struct gl_context *ctx )
|
|||
*/
|
||||
if (ctx->Texture._EnabledCoordUnits ||
|
||||
_swrast_use_fragment_program(ctx) ||
|
||||
ctx->ATIFragmentShader._Enabled ||
|
||||
_mesa_ati_fragment_shader_enabled(ctx) ||
|
||||
_mesa_need_secondary_color(ctx) ||
|
||||
swrast->_FogEnabled) {
|
||||
/* Ugh, we do a _lot_ of tests to pick the best textured tri func */
|
||||
|
|
@ -1071,7 +1071,7 @@ _swrast_choose_triangle( struct gl_context *ctx )
|
|||
/* First see if we can use an optimized 2-D texture function */
|
||||
if (ctx->Texture._EnabledCoordUnits == 0x1
|
||||
&& !_swrast_use_fragment_program(ctx)
|
||||
&& !ctx->ATIFragmentShader._Enabled
|
||||
&& !_mesa_ati_fragment_shader_enabled(ctx)
|
||||
&& ctx->Texture._MaxEnabledTexImageUnit == 0
|
||||
&& ctx->Texture.Unit[0]._Current->Target == GL_TEXTURE_2D
|
||||
&& samp->WrapS == GL_REPEAT
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "main/glheader.h"
|
||||
#include "main/imports.h"
|
||||
#include "main/macros.h"
|
||||
#include "main/state.h"
|
||||
#include "tnl/tnl.h"
|
||||
#include "tnl/t_context.h"
|
||||
#include "tnl/t_pipeline.h"
|
||||
|
|
@ -113,7 +114,7 @@ setup_vertex_format(struct gl_context *ctx)
|
|||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
|
||||
GLboolean intColors = !ctx->FragmentProgram._Current
|
||||
&& !ctx->ATIFragmentShader._Enabled
|
||||
&& !_mesa_ati_fragment_shader_enabled(ctx)
|
||||
&& ctx->RenderMode == GL_RENDER
|
||||
&& CHAN_TYPE != GL_FLOAT;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "main/macros.h"
|
||||
#include "main/imports.h"
|
||||
#include "main/samplerobj.h"
|
||||
#include "main/state.h"
|
||||
#include "math/m_xform.h"
|
||||
#include "program/prog_instruction.h"
|
||||
#include "program/prog_statevars.h"
|
||||
|
|
@ -162,7 +163,8 @@ do_ndc_cliptest(struct gl_context *ctx, struct vp_stage_data *store)
|
|||
/* Test userclip planes. This contributes to VB->ClipMask.
|
||||
*/
|
||||
/** XXX NEW_SLANG _Enabled ??? */
|
||||
if (ctx->Transform.ClipPlanesEnabled && (!ctx->VertexProgram._Enabled ||
|
||||
if (ctx->Transform.ClipPlanesEnabled &&
|
||||
(!_mesa_arb_vertex_program_enabled(ctx) ||
|
||||
ctx->VertexProgram.Current->arb.IsPositionInvariant)) {
|
||||
userclip( ctx,
|
||||
VB->ClipPtr,
|
||||
|
|
|
|||
|
|
@ -293,8 +293,10 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
|
|||
_mesa_update_state( ctx );
|
||||
|
||||
/* XXX also need to check if shader enabled, but invalid */
|
||||
if ((ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) ||
|
||||
(ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled)) {
|
||||
if ((ctx->VertexProgram.Enabled &&
|
||||
!_mesa_arb_vertex_program_enabled(ctx)) ||
|
||||
(ctx->FragmentProgram.Enabled &&
|
||||
!_mesa_arb_fragment_program_enabled(ctx))) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glBegin (invalid vertex/fragment program)");
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue