m[1] = (u_work1.r ^ (u_work1.g << 8) ^ (u_work1.b << 16) ^ (u_work1.a << 24));
// Block hash
- m[2] = blockHash[0];
- m[3] = blockHash[1];
- m[4] = blockHash[2];
- m[5] = blockHash[3];
- m[6] = blockHash[4];
- m[7] = blockHash[5];
- m[8] = blockHash[6];
- m[9] = blockHash[7];
+ for (i=0;i<8;i++) {
+ m[i+2] = blockHash[i];
+ }
// twelve rounds of mixing
for(i=0;i<12;i++) {
// Threshold test, first 4 bytes not significant,
// only calculate digest of the second 4 bytes
- if((BLAKE2B_IV32_1 ^ v[1] ^ v[17]) > threshold) {
- // Success found, return pixel data so work value can be constructed
- fragColor = vec4(
- float(x_index + 1u)/255., // +1 to distinguish from 0 (unsuccessful) pixels
- float(y_index + 1u)/255., // Same as previous
- float(x_pos)/255., // Return the 2 custom bytes used in work value
- float(y_pos)/255. // Second custom byte
+ //if((BLAKE2B_IV32_1 ^ v[1] ^ v[17]) > threshold) {
+ // Success found, set pixel data so work value can be constructed
+ fragColor = mix(
+ fragColor,
+ vec4(
+ float(x_index + 1u)/255., // +1 to distinguish from 0 (unsuccessful) pixels
+ float(y_index + 1u)/255., // Same as previous
+ float(x_pos)/255., // Return the 2 custom bytes used in work value
+ float(y_pos)/255. // Second custom byte
+ ),
+ float((BLAKE2B_IV32_1 ^ v[1] ^ v[17]) > threshold)
);
- }
+ //}
}`
/** Used to set canvas size. Must be a multiple of 256. */