projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
swrast: Use BITFIELD64_BIT for arrayAttribs.
[mesa.git]
/
src
/
mesa
/
swrast
/
s_atifragshader.c
diff --git
a/src/mesa/swrast/s_atifragshader.c
b/src/mesa/swrast/s_atifragshader.c
index e88ff1912392eb349c1f8e9dcf21bab2cb698d26..0bf03771f5bff83d72831dc8c259a013f176fac4 100644
(file)
--- a/
src/mesa/swrast/s_atifragshader.c
+++ b/
src/mesa/swrast/s_atifragshader.c
@@
-21,11
+21,11
@@
#include "main/glheader.h"
#include "main/colormac.h"
#include "main/glheader.h"
#include "main/colormac.h"
-#include "main/context.h"
#include "main/macros.h"
#include "main/macros.h"
-#include "
shader/program
.h"
-#include "
shader/atifragshader
.h"
+#include "
main/atifragshader
.h"
+#include "
main/samplerobj
.h"
#include "swrast/s_atifragshader.h"
#include "swrast/s_atifragshader.h"
+#include "swrast/s_context.h"
/**
/**
@@
-44,14
+44,15
@@
struct atifs_machine
* Fetch a texel.
*/
static void
* Fetch a texel.
*/
static void
-fetch_texel(
GL
context * ctx, const GLfloat texcoord[4], GLfloat lambda,
+fetch_texel(
struct gl_
context * ctx, const GLfloat texcoord[4], GLfloat lambda,
GLuint unit, GLfloat color[4])
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
/* XXX use a float-valued TextureSample routine here!!! */
GLuint unit, GLfloat color[4])
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
/* XXX use a float-valued TextureSample routine here!!! */
- swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current,
- 1, (const GLfloat(*)[4]) texcoord,
+ swrast->TextureSample[unit](ctx, _mesa_get_samplerobj(ctx, unit),
+ ctx->Texture.Unit[unit]._Current,
+ 1, (const GLfloat(*)[4]) texcoord,
&lambda, (GLfloat (*)[4]) color);
}
&lambda, (GLfloat (*)[4]) color);
}
@@
-83,10
+84,11
@@
apply_swizzle(GLfloat values[4], GLuint swizzle)
break;
case GL_SWIZZLE_STQ_DQ_ATI:
/* make sure q is not 0 to avoid problems later with infinite values (texture lookup)? */
break;
case GL_SWIZZLE_STQ_DQ_ATI:
/* make sure q is not 0 to avoid problems later with infinite values (texture lookup)? */
- if (q == 0.0F) q = 0.000000001;
+ if (q == 0.0F)
+ q = 0.000000001F;
values[0] = s / q;
values[1] = t / q;
values[0] = s / q;
values[1] = t / q;
- values[2] = 1 / q;
+ values[2] = 1
.0F
/ q;
break;
}
values[3] = 0.0;
break;
}
values[3] = 0.0;
@@
-138,7
+140,7
@@
apply_src_mod(GLint optype, GLuint mod, GLfloat * val)
val[i] = 1 - val[i];
if (mod & GL_BIAS_BIT_ATI)
val[i] = 1 - val[i];
if (mod & GL_BIAS_BIT_ATI)
- val[i] = val[i] - 0.5;
+ val[i] = val[i] - 0.5
F
;
if (mod & GL_2X_BIT_ATI)
val[i] = 2 * val[i];
if (mod & GL_2X_BIT_ATI)
val[i] = 2 * val[i];
@@
-172,27
+174,27
@@
apply_dst_mod(GLuint optype, GLuint mod, GLfloat * val)
val[i] = 8 * val[i];
break;
case GL_HALF_BIT_ATI:
val[i] = 8 * val[i];
break;
case GL_HALF_BIT_ATI:
- val[i] = val[i] * 0.5;
+ val[i] = val[i] * 0.5
F
;
break;
case GL_QUARTER_BIT_ATI:
break;
case GL_QUARTER_BIT_ATI:
- val[i] = val[i] * 0.25;
+ val[i] = val[i] * 0.25
F
;
break;
case GL_EIGHTH_BIT_ATI:
break;
case GL_EIGHTH_BIT_ATI:
- val[i] = val[i] * 0.125;
+ val[i] = val[i] * 0.125
F
;
break;
}
if (has_sat) {
break;
}
if (has_sat) {
- if (val[i] < 0.0)
- val[i] = 0;
- else if (val[i] > 1.0)
- val[i] = 1.0;
+ if (val[i] < 0.0
F
)
+ val[i] = 0
.0F
;
+ else if (val[i] > 1.0
F
)
+ val[i] = 1.0
F
;
}
else {
}
else {
- if (val[i] < -8.0)
- val[i] = -8.0;
- else if (val[i] > 8.0)
- val[i] = 8.0;
+ if (val[i] < -8.0
F
)
+ val[i] = -8.0
F
;
+ else if (val[i] > 8.0
F
)
+ val[i] = 8.0
F
;
}
}
}
}
}
}
@@
-235,21
+237,6
@@
finish_pass(struct atifs_machine *machine)
}
}
}
}
-struct ati_fs_opcode_st ati_fs_opcodes[] = {
- {GL_ADD_ATI, 2},
- {GL_SUB_ATI, 2},
- {GL_MUL_ATI, 2},
- {GL_MAD_ATI, 3},
- {GL_LERP_ATI, 3},
- {GL_MOV_ATI, 1},
- {GL_CND_ATI, 3},
- {GL_CND0_ATI, 3},
- {GL_DOT2_ADD_ATI, 3},
- {GL_DOT3_ATI, 2},
- {GL_DOT4_ATI, 2}
-};
-
-
static void
handle_pass_op(struct atifs_machine *machine, struct atifs_setupinst *texinst,
static void
handle_pass_op(struct atifs_machine *machine, struct atifs_setupinst *texinst,
@@
-261,7
+248,7
@@
handle_pass_op(struct atifs_machine *machine, struct atifs_setupinst *texinst,
if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) {
pass_tex -= GL_TEXTURE0_ARB;
COPY_4V(machine->Registers[idx],
if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) {
pass_tex -= GL_TEXTURE0_ARB;
COPY_4V(machine->Registers[idx],
- span->array->attribs[
FRAG_ATTRIB
_TEX0 + pass_tex][column]);
+ span->array->attribs[
VARYING_SLOT
_TEX0 + pass_tex][column]);
}
else if (pass_tex >= GL_REG_0_ATI && pass_tex <= GL_REG_5_ATI) {
pass_tex -= GL_REG_0_ATI;
}
else if (pass_tex >= GL_REG_0_ATI && pass_tex <= GL_REG_5_ATI) {
pass_tex -= GL_REG_0_ATI;
@@
-272,7
+259,7
@@
handle_pass_op(struct atifs_machine *machine, struct atifs_setupinst *texinst,
}
static void
}
static void
-handle_sample_op(
GL
context * ctx, struct atifs_machine *machine,
+handle_sample_op(
struct gl_
context * ctx, struct atifs_machine *machine,
struct atifs_setupinst *texinst, const SWspan *span,
GLuint column, GLuint idx)
{
struct atifs_setupinst *texinst, const SWspan *span,
GLuint column, GLuint idx)
{
@@
-284,7
+271,7
@@
handle_sample_op(GLcontext * ctx, struct atifs_machine *machine,
if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) {
coord_source -= GL_TEXTURE0_ARB;
COPY_4V(tex_coords,
if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) {
coord_source -= GL_TEXTURE0_ARB;
COPY_4V(tex_coords,
- span->array->attribs[
FRAG_ATTRIB
_TEX0 + coord_source][column]);
+ span->array->attribs[
VARYING_SLOT
_TEX0 + coord_source][column]);
}
else if (coord_source >= GL_REG_0_ATI && coord_source <= GL_REG_5_ATI) {
coord_source -= GL_REG_0_ATI;
}
else if (coord_source >= GL_REG_0_ATI && coord_source <= GL_REG_5_ATI) {
coord_source -= GL_REG_0_ATI;
@@
-311,7
+298,7
@@
do { \
* \param column - which pixel [i] we're operating on in the span
*/
static void
* \param column - which pixel [i] we're operating on in the span
*/
static void
-execute_shader(
GL
context *ctx, const struct ati_fragment_shader *shader,
+execute_shader(
struct gl_
context *ctx, const struct ati_fragment_shader *shader,
struct atifs_machine *machine, const SWspan *span,
GLuint column)
{
struct atifs_machine *machine, const SWspan *span,
GLuint column)
{
@@
-555,7
+542,7
@@
execute_shader(GLcontext *ctx, const struct ati_fragment_shader *shader,
* Init fragment shader virtual machine state.
*/
static void
* Init fragment shader virtual machine state.
*/
static void
-init_machine(
GL
context * ctx, struct atifs_machine *machine,
+init_machine(
struct gl_
context * ctx, struct atifs_machine *machine,
const struct ati_fragment_shader *shader,
const SWspan *span, GLuint col)
{
const struct ati_fragment_shader *shader,
const SWspan *span, GLuint col)
{
@@
-567,8
+554,8
@@
init_machine(GLcontext * ctx, struct atifs_machine *machine,
machine->Registers[i][j] = 0.0;
}
machine->Registers[i][j] = 0.0;
}
- COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[
FRAG_ATTRIB
_COL0][col]);
- COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[
FRAG_ATTRIB
_COL1][col]);
+ COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[
VARYING_SLOT
_COL0][col]);
+ COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[
VARYING_SLOT
_COL1][col]);
}
}
@@
-577,14
+564,14
@@
init_machine(GLcontext * ctx, struct atifs_machine *machine,
* Execute the current ATI shader program, operating on the given span.
*/
void
* Execute the current ATI shader program, operating on the given span.
*/
void
-_swrast_exec_fragment_shader(
GL
context * ctx, SWspan *span)
+_swrast_exec_fragment_shader(
struct gl_
context * ctx, SWspan *span)
{
const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current;
struct atifs_machine machine;
GLuint i;
/* incoming colors should be floats */
{
const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current;
struct atifs_machine machine;
GLuint i;
/* incoming colors should be floats */
-
ASSERT
(span->array->ChanType == GL_FLOAT);
+
assert
(span->array->ChanType == GL_FLOAT);
for (i = 0; i < span->end; i++) {
if (span->array->mask[i]) {
for (i = 0; i < span->end; i++) {
if (span->array->mask[i]) {
@@
-597,7
+584,7
@@
_swrast_exec_fragment_shader(GLcontext * ctx, SWspan *span)
const GLfloat *colOut = machine.Registers[0];
/*fprintf(stderr,"outputs %f %f %f %f\n",
colOut[0], colOut[1], colOut[2], colOut[3]); */
const GLfloat *colOut = machine.Registers[0];
/*fprintf(stderr,"outputs %f %f %f %f\n",
colOut[0], colOut[1], colOut[2], colOut[3]); */
- COPY_4V(span->array->attribs[
FRAG_ATTRIB
_COL0][i], colOut);
+ COPY_4V(span->array->attribs[
VARYING_SLOT
_COL0][i], colOut);
}
}
}
}
}
}