[Mesa-dev] [PATCH 1/5] nv50, nvc0: replace resInfoCBSlot by auxCBSlot

2016-03-15 Thread Samuel Pitoiset
Having two different variables for the driver constant buffer slot
is confusing and really useless.

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h |  3 +--
 .../drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp|  4 ++--
 .../drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp| 12 ++--
 src/gallium/drivers/nouveau/nouveau_compiler.c   |  2 --
 src/gallium/drivers/nouveau/nv50/nv50_program.c  |  1 -
 src/gallium/drivers/nouveau/nvc0/nvc0_program.c  |  4 +---
 6 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
index 9f7d257..21523a2 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
@@ -160,7 +160,7 @@ struct nv50_ir_prog_info
   uint8_t clipDistances; /* number of clip distance outputs */
   uint8_t cullDistances; /* number of cull distance outputs */
   int8_t genUserClip;/* request user clip planes for ClipVertex */
-  uint8_t auxCBSlot; /* constant buffer index of UCP/draw data */
+  uint8_t auxCBSlot; /* driver constant buffer slot */
   uint16_t ucpBase;  /* base address for UCPs */
   uint16_t drawInfoBase; /* base address for draw parameters */
   uint8_t pointSize; /* output index for PointSize */
@@ -175,7 +175,6 @@ struct nv50_ir_prog_info
   uint8_t globalAccess;  /* 1 for read, 2 for wr, 3 for rw */
   bool fp64; /* program uses fp64 math */
   bool nv50styleSurfaces;/* generate gX[] access for raw buffers */
-  uint8_t resInfoCBSlot; /* cX[] used for tex handles, surface info */
   uint16_t texBindBase;  /* base address for tex handles (nve4) */
   uint16_t suInfoBase;   /* base address for surface info (nve4) */
   uint16_t sampleInfoBase;   /* base address for sample positions */
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp
index 12c5f69..5a46ede 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp
@@ -682,7 +682,7 @@ void NV50LoweringPreSSA::loadTexMsInfo(uint32_t off, Value 
**ms,
Value **ms_x, Value **ms_y) {
// This loads the texture-indexed ms setting from the constant buffer
Value *tmp = new_LValue(func, FILE_GPR);
-   uint8_t b = prog->driver->io.resInfoCBSlot;
+   uint8_t b = prog->driver->io.auxCBSlot;
off += prog->driver->io.suInfoBase;
if (prog->getType() > Program::TYPE_VERTEX)
   off += 16 * 2 * 4;
@@ -1174,7 +1174,7 @@ NV50LoweringPreSSA::handleRDSV(Instruction *i)
   bld.mkLoad(TYPE_F32,
  def,
  bld.mkSymbol(
-   FILE_MEMORY_CONST, prog->driver->io.resInfoCBSlot,
+   FILE_MEMORY_CONST, prog->driver->io.auxCBSlot,
TYPE_U32, prog->driver->io.sampleInfoBase + 4 * idx),
  off);
   break;
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
index d0936d8..d879339 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
@@ -600,7 +600,7 @@ NVC0LoweringPass::visit(BasicBlock *bb)
 inline Value *
 NVC0LoweringPass::loadTexHandle(Value *ptr, unsigned int slot)
 {
-   uint8_t b = prog->driver->io.resInfoCBSlot;
+   uint8_t b = prog->driver->io.auxCBSlot;
uint32_t off = prog->driver->io.texBindBase + slot * 4;
return bld.
   mkLoadv(TYPE_U32, bld.mkSymbol(FILE_MEMORY_CONST, b, TYPE_U32, off), 
ptr);
@@ -1204,7 +1204,7 @@ NVC0LoweringPass::handleCasExch(Instruction *cas, bool 
needCctl)
 inline Value *
 NVC0LoweringPass::loadResInfo32(Value *ptr, uint32_t off)
 {
-   uint8_t b = prog->driver->io.resInfoCBSlot;
+   uint8_t b = prog->driver->io.auxCBSlot;
off += prog->driver->io.suInfoBase;
return bld.
   mkLoadv(TYPE_U32, bld.mkSymbol(FILE_MEMORY_CONST, b, TYPE_U32, off), 
ptr);
@@ -1213,7 +1213,7 @@ NVC0LoweringPass::loadResInfo32(Value *ptr, uint32_t off)
 inline Value *
 NVC0LoweringPass::loadResInfo64(Value *ptr, uint32_t off)
 {
-   uint8_t b = prog->driver->io.resInfoCBSlot;
+   uint8_t b = prog->driver->io.auxCBSlot;
off += prog->driver->io.suInfoBase;
 
if (ptr)
@@ -1226,7 +1226,7 @@ NVC0LoweringPass::loadResInfo64(Value *ptr, uint32_t off)
 inline Value *
 NVC0LoweringPass::loadResLength32(Value *ptr, uint32_t off)
 {
-   uint8_t b = prog->driver->io.resInfoCBSlot;
+   uint8_t b = prog->driver->io.auxCBSlot;
off += prog->driver->io.suInfoBase;
 
if (ptr)
@@ -1540,7 +15

Re: [Mesa-dev] [PATCH 1/5] nv50, nvc0: replace resInfoCBSlot by auxCBSlot

2016-03-19 Thread Pierre Moreau
Acked-by: Pierre Moreau 

On 09:55 PM - Mar 15 2016, Samuel Pitoiset wrote:
> Having two different variables for the driver constant buffer slot
> is confusing and really useless.
> 
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h |  3 +--
>  .../drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp|  4 ++--
>  .../drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp| 12 
> ++--
>  src/gallium/drivers/nouveau/nouveau_compiler.c   |  2 --
>  src/gallium/drivers/nouveau/nv50/nv50_program.c  |  1 -
>  src/gallium/drivers/nouveau/nvc0/nvc0_program.c  |  4 +---
>  6 files changed, 10 insertions(+), 16 deletions(-)
> 
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h 
> b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
> index 9f7d257..21523a2 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
> @@ -160,7 +160,7 @@ struct nv50_ir_prog_info
>uint8_t clipDistances; /* number of clip distance outputs */
>uint8_t cullDistances; /* number of cull distance outputs */
>int8_t genUserClip;/* request user clip planes for ClipVertex 
> */
> -  uint8_t auxCBSlot; /* constant buffer index of UCP/draw data */
> +  uint8_t auxCBSlot; /* driver constant buffer slot */
>uint16_t ucpBase;  /* base address for UCPs */
>uint16_t drawInfoBase; /* base address for draw parameters */
>uint8_t pointSize; /* output index for PointSize */
> @@ -175,7 +175,6 @@ struct nv50_ir_prog_info
>uint8_t globalAccess;  /* 1 for read, 2 for wr, 3 for rw */
>bool fp64; /* program uses fp64 math */
>bool nv50styleSurfaces;/* generate gX[] access for raw buffers */
> -  uint8_t resInfoCBSlot; /* cX[] used for tex handles, surface info 
> */
>uint16_t texBindBase;  /* base address for tex handles (nve4) */
>uint16_t suInfoBase;   /* base address for surface info (nve4) */
>uint16_t sampleInfoBase;   /* base address for sample positions */
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp 
> b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp
> index 12c5f69..5a46ede 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp
> @@ -682,7 +682,7 @@ void NV50LoweringPreSSA::loadTexMsInfo(uint32_t off, 
> Value **ms,
> Value **ms_x, Value **ms_y) {
> // This loads the texture-indexed ms setting from the constant buffer
> Value *tmp = new_LValue(func, FILE_GPR);
> -   uint8_t b = prog->driver->io.resInfoCBSlot;
> +   uint8_t b = prog->driver->io.auxCBSlot;
> off += prog->driver->io.suInfoBase;
> if (prog->getType() > Program::TYPE_VERTEX)
>off += 16 * 2 * 4;
> @@ -1174,7 +1174,7 @@ NV50LoweringPreSSA::handleRDSV(Instruction *i)
>bld.mkLoad(TYPE_F32,
>   def,
>   bld.mkSymbol(
> -   FILE_MEMORY_CONST, prog->driver->io.resInfoCBSlot,
> +   FILE_MEMORY_CONST, prog->driver->io.auxCBSlot,
> TYPE_U32, prog->driver->io.sampleInfoBase + 4 * idx),
>   off);
>break;
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp 
> b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
> index d0936d8..d879339 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
> @@ -600,7 +600,7 @@ NVC0LoweringPass::visit(BasicBlock *bb)
>  inline Value *
>  NVC0LoweringPass::loadTexHandle(Value *ptr, unsigned int slot)
>  {
> -   uint8_t b = prog->driver->io.resInfoCBSlot;
> +   uint8_t b = prog->driver->io.auxCBSlot;
> uint32_t off = prog->driver->io.texBindBase + slot * 4;
> return bld.
>mkLoadv(TYPE_U32, bld.mkSymbol(FILE_MEMORY_CONST, b, TYPE_U32, off), 
> ptr);
> @@ -1204,7 +1204,7 @@ NVC0LoweringPass::handleCasExch(Instruction *cas, bool 
> needCctl)
>  inline Value *
>  NVC0LoweringPass::loadResInfo32(Value *ptr, uint32_t off)
>  {
> -   uint8_t b = prog->driver->io.resInfoCBSlot;
> +   uint8_t b = prog->driver->io.auxCBSlot;
> off += prog->driver->io.suInfoBase;
> return bld.
>mkLoadv(TYPE_U32, bld.mkSymbol(FILE_MEMORY_CONST, b, TYPE_U32, off), 
> ptr);
> @@ -1213,7 +1213,7 @@ NVC0LoweringPass::loadResInfo32(Value *ptr, uint32_t 
> off)
>  inline Value *
>  NVC0LoweringPass::loadResInfo64(Value *ptr, uint32_t off)
>  {
> -   uint8_t b = prog->driver->io.resInfoCBSlot;
> +   uint8_t b = prog->driver->io.auxCBSlot;
> off += prog->driver->io.suInfoBase;
>  
> if (ptr)
> @@ -1226,7 +1226,7 @@ NVC0LoweringPass::loa