From 1796d1ed56391294c04b11c16aa516bf0e8ad3d8 Mon Sep 17 00:00:00 2001 From: Hristo Venev Date: Thu, 29 Nov 2012 18:15:15 +0200 Subject: [PATCH] nv50: recognize PIPE_CAP_CUBE_MAP_ARRAY Signed-off-by: Hristo Venev --- src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp | 1 + src/gallium/drivers/nv50/codegen/nv50_ir_lowering_nv50.cpp | 8 +++++--- src/gallium/drivers/nv50/nv50_blit.h | 1 + src/gallium/drivers/nv50/nv50_screen.c | 1 + src/gallium/drivers/nv50/nv50_tex.c | 1 + 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp index e73c804..10eb8c1 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp @@ -340,6 +340,7 @@ static nv50_ir::TexTarget translateTexture(uint tex) NV50_IR_TEX_TARG_CASE(2D, 2D); NV50_IR_TEX_TARG_CASE(3D, 3D); NV50_IR_TEX_TARG_CASE(CUBE, CUBE); + NV50_IR_TEX_TARG_CASE(CUBE_ARRAY, CUBE_ARRAY); NV50_IR_TEX_TARG_CASE(RECT, RECT); NV50_IR_TEX_TARG_CASE(1D_ARRAY, 1D_ARRAY); NV50_IR_TEX_TARG_CASE(2D_ARRAY, 2D_ARRAY); diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_lowering_nv50.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_lowering_nv50.cpp index 3e0dc75..82fd6e1 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_lowering_nv50.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_lowering_nv50.cpp @@ -596,17 +596,19 @@ NV50LoweringPreSSA::handleTEX(TexInstruction *i) if (i->tex.target.isCube()) { // Value *face = layer; - Value *x, *y; + Value *x, *y, *temp, *layer; x = new_LValue(func, FILE_GPR); y = new_LValue(func, FILE_GPR); + temp = new_LValue(func, FILE_GPR); layer = new_LValue(func, FILE_GPR); i->tex.target = TEX_TARGET_2D_ARRAY; - // TODO: use TEXPREP to convert x,y,z,face -> x,y,layer + //x,y,face,layer -> x,y,layer + bld.mkOp2(OP_MUL, TYPE_U32, temp, i->getSrc(3), bld.loadImm(NULL, 6)); + bld.mkOp2(OP_ADD, TYPE_U32, layer, temp, i->getSrc(2)); bld.mkMov(x, i->getSrc(0)); bld.mkMov(y, i->getSrc(1)); - bld.mkMov(layer, i->getSrc(3)); i->setSrc(0, x); i->setSrc(1, y); diff --git a/src/gallium/drivers/nv50/nv50_blit.h b/src/gallium/drivers/nv50/nv50_blit.h index 0a1c2ae..d409f21 100644 --- a/src/gallium/drivers/nv50/nv50_blit.h +++ b/src/gallium/drivers/nv50/nv50_blit.h @@ -72,6 +72,7 @@ nv50_blit_reinterpret_pipe_texture_target(enum pipe_texture_target target) { switch (target) { case PIPE_TEXTURE_CUBE: + case PIPE_TEXTURE_CUBE_ARRAY: return PIPE_TEXTURE_2D_ARRAY; case PIPE_TEXTURE_RECT: return PIPE_TEXTURE_2D; diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index d0a0295..b1d2030 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -106,6 +106,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_NPOT_TEXTURES: case PIPE_CAP_ANISOTROPIC_FILTER: case PIPE_CAP_SCALED_RESOLVE: + case PIPE_CAP_CUBE_MAP_ARRAY: return 1; case PIPE_CAP_SEAMLESS_CUBE_MAP: return nv50_screen(pscreen)->tesla->oclass >= NVA0_3D_CLASS; diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 992ac4b..e337a0a 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -175,6 +175,7 @@ nv50_create_texture_view(struct pipe_context *pipe, tic[2] |= NV50_TIC_2_TARGET_3D; break; case PIPE_TEXTURE_CUBE: + case PIPE_TEXTURE_CUBE_ARRAY: depth /= 6; if (depth > 1) tic[2] |= NV50_TIC_2_TARGET_CUBE_ARRAY; -- 1.8.0