Nir Radian wrote:
Hello all,

I’m attempting to run Humus’s alpha2coverage demo – I understand that there is no multisample buffer, but still while analyzing the result coming from the fragment shader I noticed that

the shader doesn’t use the FetchTexelDeriv although I’m pretty certain that Humus intended these accesses to be mipmapped …

the reason for this I guess is this condition not being met:

inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit

since the texture access is done with one of the varying variables –

shader code from the program -

varying vec2 texCoord;

varying vec2 dervCoord;

void main(){

      vec4 base = texture2D(Base, texCoord);

      float derv = 255.0 * texture2D(Derv, dervCoord).x;

      // Allow 2 pixel blur instead of one ...

      //derv = 0.5 * (derv - 1.0) + 1.0;

      base.a = derv * (base.a - 0.5) + 0.5;

      gl_FragColor = base;

}

my question – where did this condition come from? Is it necessarily correct?

In swrast, we only have the partial derivatives for input attributes, not temporaries, etc.

I don't recall ATM why the TexSrcUnit check is there. The attached patch disables that part. Try it and let me know what happens.

-Brian

diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index f4beb9a..d18a002 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -357,8 +357,8 @@ fetch_texel(GLcontext *ctx,
    /* Note: we only have the right derivatives for fragment input attribs.
     */
    if (machine->NumDeriv > 0 &&
-       inst->SrcReg[0].File == PROGRAM_INPUT &&
-       inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit) {
+       inst->SrcReg[0].File == PROGRAM_INPUT /*&&
+       inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit*/) {
       /* simple texture fetch for which we should have derivatives */
       GLuint attr = inst->SrcReg[0].Index;
       machine->FetchTexelDeriv(ctx, texcoord,
------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to