打开宏定义:tdfx_span.c:需要左值作为赋值的左操作数

发布于 2024-10-10 00:18:06 字数 3356 浏览 0 评论 0原文

我试图在 Ubuntu maverick 下编译 X11R6-7.0 并遇到一些奇怪的编译错误,我无法自己解决。

我需要 X11R6-7.0,因为 ati Catalyst 驱动程序不支持较新的 xorg,并且 oss 驱动程序不支持我的硬件的 3D 加速。

有人知道这个错误信息是什么意思吗?我知道一些C,但我有点困惑。这是否意味着 GET_FB_DATA 宏返回了 NULL 或者某些方法/属性未设置?

此时,任何有关如何“调试”预处理器定义的进一步见解都会很棒。我认为我无法使用 #error 打印任何有用的内容。

我得到的错误:

tdfx_span.c:在函数“tdfxDDWriteDepthPixels”中:
tdfx_span.c:976:错误:需要左值作为赋值的左操作数
tdfx_span.c:1008: 错误:需要左值作为赋值的左操作数
tdfx_span.c:在函数“write_stencil_pixels”中:
tdfx_span.c:1242:错误:需要左值作为赋值的左操作数

代码:

958-   switch (depth_size) {
959-   case 16:
960-      GetBackBufferInfo(fxMesa, &backBufferInfo);
961-      /*
962-       * Note that the _LOCK macro adds a curly brace,
963-       * and the UNLOCK macro removes it.
964-       */
965-      WRITE_FB_SPAN_LOCK(fxMesa, info,
966-             GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY);
967-      {
968-     LFBParameters ReadParams;
969-     GetFbParams(fxMesa, &info, &backBufferInfo,
970-             &ReadParams, sizeof(GLushort));
971-     for (i = 0; i < n; i++) {
972-        if (mask[i] && visible_pixel(fxMesa, x[i], y[i])) {
973-           xpos = x[i] + fxMesa->x_offset;
974-           ypos = bottom - y[i];
975-           d16 = depth[i];
976:           PUT_FB_DATA(&ReadParams, GLushort, xpos, ypos, d16);
977-        }
978-     }
979-      }
980-      WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
981-      break;
982-   case 24:

和相关宏:

#define GET_FB_DATA(ReadParamsp, type, x, y)                        \
   (((x) < (ReadParamsp)->firstWrappedX)                            \
        ? (((type *)((ReadParamsp)->lfbPtr))                        \
                 [(y) * ((ReadParamsp)->LFBStrideInElts)            \
                   + (x)])                                          \
        : (((type *)((ReadParamsp)->lfbWrapPtr))                    \
                 [((y)) * ((ReadParamsp)->LFBStrideInElts)          \
                   + ((x) - (ReadParamsp)->firstWrappedX)]))
#define GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y)               \
    (((type *)((ReadParamsp)->lfbPtr))                              \
                 [(y) * ((ReadParamsp)->LFBStrideInElts)            \
                   + (x)])
#define GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y)                \
    (((type *)((ReadParamsp)->lfbWrapPtr))                          \
                 [((y)) * ((ReadParamsp)->LFBStrideInElts)          \
                   + ((x) - (ReadParamsp)->firstWrappedX)])
#define PUT_FB_DATA(ReadParamsp, type, x, y, value)                        \
    (GET_FB_DATA(ReadParamsp, type, x, y) = (type)(value))
#define PUT_ORDINARY_FB_DATA(ReadParamsp, type, x, y, value)              \
    (GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) = (type)(value))
#define PUT_WRAPPED_FB_DATA(ReadParamsp, type, x, y, value)                \
    (GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) = (type)(value))

LFBParameters 结构

483-typedef struct
484-{
485-   void *lfbPtr;
486-   void *lfbWrapPtr;
487-   FxU32 LFBStrideInElts;
488-   GLint firstWrappedX;
489-}
490:LFBParameters;

I'm trying to compile X11R6-7.0 under Ubuntu maverick and got some weird compilation errors I'm unable to resolve myself.

I needed X11R6-7.0 as ati catalyst drivers don't support newer xorg and oss drivers don't support 3d acceleration of my hardware.

Anyone know what this error message means? I know some C but I got a bit confused. Does it mean GET_FB_DATA macro returned NULL or some method/property not set?

Any further insight how to "debug" preprocessor definitions at this point would be great. I don't think I can print anything useful with #error.

The error I get:

tdfx_span.c: In function ‘tdfxDDWriteDepthPixels’:
tdfx_span.c:976: error: lvalue required as left operand of assignment
tdfx_span.c:1008: error: lvalue required as left operand of assignment
tdfx_span.c: In function ‘write_stencil_pixels’:
tdfx_span.c:1242: error: lvalue required as left operand of assignment

the Code:

958-   switch (depth_size) {
959-   case 16:
960-      GetBackBufferInfo(fxMesa, &backBufferInfo);
961-      /*
962-       * Note that the _LOCK macro adds a curly brace,
963-       * and the UNLOCK macro removes it.
964-       */
965-      WRITE_FB_SPAN_LOCK(fxMesa, info,
966-             GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY);
967-      {
968-     LFBParameters ReadParams;
969-     GetFbParams(fxMesa, &info, &backBufferInfo,
970-             &ReadParams, sizeof(GLushort));
971-     for (i = 0; i < n; i++) {
972-        if (mask[i] && visible_pixel(fxMesa, x[i], y[i])) {
973-           xpos = x[i] + fxMesa->x_offset;
974-           ypos = bottom - y[i];
975-           d16 = depth[i];
976:           PUT_FB_DATA(&ReadParams, GLushort, xpos, ypos, d16);
977-        }
978-     }
979-      }
980-      WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
981-      break;
982-   case 24:

And relative macros:

#define GET_FB_DATA(ReadParamsp, type, x, y)                        \
   (((x) < (ReadParamsp)->firstWrappedX)                            \
        ? (((type *)((ReadParamsp)->lfbPtr))                        \
                 [(y) * ((ReadParamsp)->LFBStrideInElts)            \
                   + (x)])                                          \
        : (((type *)((ReadParamsp)->lfbWrapPtr))                    \
                 [((y)) * ((ReadParamsp)->LFBStrideInElts)          \
                   + ((x) - (ReadParamsp)->firstWrappedX)]))
#define GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y)               \
    (((type *)((ReadParamsp)->lfbPtr))                              \
                 [(y) * ((ReadParamsp)->LFBStrideInElts)            \
                   + (x)])
#define GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y)                \
    (((type *)((ReadParamsp)->lfbWrapPtr))                          \
                 [((y)) * ((ReadParamsp)->LFBStrideInElts)          \
                   + ((x) - (ReadParamsp)->firstWrappedX)])
#define PUT_FB_DATA(ReadParamsp, type, x, y, value)                        \
    (GET_FB_DATA(ReadParamsp, type, x, y) = (type)(value))
#define PUT_ORDINARY_FB_DATA(ReadParamsp, type, x, y, value)              \
    (GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) = (type)(value))
#define PUT_WRAPPED_FB_DATA(ReadParamsp, type, x, y, value)                \
    (GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) = (type)(value))

The LFBParameters Struct

483-typedef struct
484-{
485-   void *lfbPtr;
486-   void *lfbWrapPtr;
487-   FxU32 LFBStrideInElts;
488-   GLint firstWrappedX;
489-}
490:LFBParameters;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

吹泡泡o 2024-10-17 00:18:06

不,这当然不是因为指针是0。这表明类型错误。正如消息所述,您需要在赋值的左侧添加一个左值。 (这听起来很正常,不是吗?)

我猜想其中一个宏以某种方式返回了一个指针值,而您缺少取消引用它。

No, certainly this is not because a pointer is 0. This indicates that a type is wrong. As the message says, you need an lvalue on the left of an assignment. (which sounds normal, doesn't it?)

I'd guess that somehow one of the macros returns a pointer value and you are missing to dereference it.

天气好吗我好吗 2024-10-17 00:18:06

你的宏扩展为:

(
(
  ((xpos) < (&ReadParams)->firstWrappedX) ?
  (((GLushort *)((&ReadParams)->lfbPtr)) [(ypos) * ((&ReadParams)->LFBStrideInElts) + (xpos)])
  :
  (((GLushort *)((&ReadParams)->lfbWrapPtr)) [((ypos)) * ((&ReadParams)->LFBStrideInElts) + ((xpos) - (&ReadParams)->firstWrappedX)])) = (GLushort)(d16)
);

所以基本上它正在做(类似的事情):

   ((GLushort *)((&ReadParams)->lfbWrapPtr))[SOME_INDEX] = (GLushort)(d16);

我认为这是不对的并导致了问题。这是你所期待的吗?

Your macro expands to:

(
(
  ((xpos) < (&ReadParams)->firstWrappedX) ?
  (((GLushort *)((&ReadParams)->lfbPtr)) [(ypos) * ((&ReadParams)->LFBStrideInElts) + (xpos)])
  :
  (((GLushort *)((&ReadParams)->lfbWrapPtr)) [((ypos)) * ((&ReadParams)->LFBStrideInElts) + ((xpos) - (&ReadParams)->firstWrappedX)])) = (GLushort)(d16)
);

So basically it is doing (some thing like):

   ((GLushort *)((&ReadParams)->lfbWrapPtr))[SOME_INDEX] = (GLushort)(d16);

Which I don't think is right and causing the problem. Is this what you are expecting?

口干舌燥 2024-10-17 00:18:06

您可能不喜欢听到这个,但按照大多数标准来看,X11R6 已经很古老了。您拥有哪种显卡?为什么需要 fglrx?看看我的墙,我没有任何需要 fglrx 的 ATI/AMD 芯片组;只有最新的芯片组(例如 Cayman)才需要它,而且这些芯片组的 fglrx 无论如何都不会构建在 X11R6 上。

无论如何,如果您绝对坚持这样做,您可能应该使用 --with-dri-drivers=swrast 构建台面,因为这将阻止构建像 tdfx_dri 这样的驱动程序。你肯定没有需要加速的 Voodoo,对吧? :3

You're probably not going to like to hear this, but X11R6 is ancient by most standards. Which video card do you have and why is fglrx required? Looking at my wall, I don't have any ATI/AMD chipsets which require fglrx; only the very newest chipsets, like the Cayman, require it, and fglrx for those chipsets won't build on X11R6 anyway.

Anyway, if you absolutely insist on doing this, you probably should build mesa with --with-dri-drivers=swrast as this will prevent drivers like tdfx_dri from being built. Surely you don't have a Voodoo that needs to be accelerated as well, right? :3

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文