[Mesa-dev] [RFC 10/24] nv50/ir: add support for TGSI image declarations
Ilia Mirkin
imirkin at alum.mit.edu
Wed Apr 13 20:26:43 UTC 2016
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
On Tue, Apr 12, 2016 at 7:57 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Old and dead resource code will be removed once images are completely
> done. Based on original patch by Ilia Mirkin.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> .../drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 27 +++++++++++++++++++---
> 1 file changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
> index 4f012cd..44b39db 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
> @@ -373,6 +373,7 @@ static nv50_ir::DataFile translateFile(uint file)
> case TGSI_FILE_PREDICATE: return nv50_ir::FILE_PREDICATE;
> case TGSI_FILE_IMMEDIATE: return nv50_ir::FILE_IMMEDIATE;
> case TGSI_FILE_SYSTEM_VALUE: return nv50_ir::FILE_SYSTEM_VALUE;
> + case TGSI_FILE_IMAGE:
> case TGSI_FILE_BUFFER: return nv50_ir::FILE_MEMORY_GLOBAL;
> case TGSI_FILE_MEMORY: return nv50_ir::FILE_MEMORY_GLOBAL;
> case TGSI_FILE_SAMPLER:
> @@ -865,6 +866,14 @@ public:
> std::vector<Resource> resources;
> */
>
> + struct Image {
> + uint8_t target; // TGSI_TEXTURE_*
> + bool raw;
> + uint8_t slot;
> + uint16_t format; // PIPE_FORMAT_*
> + };
> + std::vector<Image> images;
> +
> struct MemoryFile {
> uint8_t mem_type; // TGSI_MEMORY_TYPE_*
> };
> @@ -915,6 +924,7 @@ bool Source::scanSource()
>
> textureViews.resize(scan.file_max[TGSI_FILE_SAMPLER_VIEW] + 1);
> //resources.resize(scan.file_max[TGSI_FILE_RESOURCE] + 1);
> + images.resize(scan.file_max[TGSI_FILE_IMAGE] + 1);
> tempArrayId.resize(scan.file_max[TGSI_FILE_TEMPORARY] + 1);
> memoryFiles.resize(scan.file_max[TGSI_FILE_MEMORY] + 1);
>
> @@ -1221,6 +1231,14 @@ bool Source::scanDeclaration(const struct tgsi_full_declaration *decl)
> }
> break;
> */
> + case TGSI_FILE_IMAGE:
> + for (i = first; i <= last; ++i) {
> + images[i].target = decl->Image.Resource;
> + images[i].raw = decl->Image.Raw;
> + images[i].format = decl->Image.Format;
> + images[i].slot = i;
> + }
> + break;
> case TGSI_FILE_SAMPLER_VIEW:
> for (i = first; i <= last; ++i)
> textureViews[i].target = decl->SamplerView.Resource;
> @@ -1289,7 +1307,8 @@ bool Source::scanInstruction(const struct tgsi_full_instruction *inst)
> if (dst.isIndirect(0))
> indirectTempArrays.insert(dst.getArrayId());
> } else
> - if (dst.getFile() == TGSI_FILE_BUFFER) {
> + if (dst.getFile() == TGSI_FILE_BUFFER ||
> + dst.getFile() == TGSI_FILE_IMAGE) {
> info->io.globalAccess |= 0x2;
> }
> }
> @@ -1300,7 +1319,8 @@ bool Source::scanInstruction(const struct tgsi_full_instruction *inst)
> if (src.isIndirect(0))
> indirectTempArrays.insert(src.getArrayId());
> } else
> - if (src.getFile() == TGSI_FILE_BUFFER) {
> + if (src.getFile() == TGSI_FILE_BUFFER ||
> + src.getFile() == TGSI_FILE_IMAGE) {
> info->io.globalAccess |= (insn.getOpcode() == TGSI_OPCODE_LOAD) ?
> 0x1 : 0x2;
> } else
> @@ -1801,7 +1821,8 @@ Converter::acquireDst(int d, int c)
> int idx = dst.getIndex(0);
> int idx2d = dst.is2D() ? dst.getIndex(1) : 0;
>
> - if (dst.isMasked(c) || f == TGSI_FILE_BUFFER || f == TGSI_FILE_MEMORY)
> + if (dst.isMasked(c) || f == TGSI_FILE_BUFFER || f == TGSI_FILE_MEMORY ||
> + f == TGSI_FILE_IMAGE)
> return NULL;
>
> if (dst.isIndirect(0) ||
> --
> 2.8.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list